custom-electron-titlebar 4.2.0 → 4.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (65) hide show
  1. package/dist/base/browser/browser.d.ts +26 -0
  2. package/dist/base/browser/browser.js +317 -0
  3. package/dist/base/browser/event.d.ts +12 -0
  4. package/dist/base/browser/event.js +215 -0
  5. package/dist/base/browser/keyboardEvent.d.ts +38 -0
  6. package/dist/base/browser/keyboardEvent.js +466 -0
  7. package/dist/base/browser/mouseEvent.d.ts +61 -0
  8. package/dist/base/browser/mouseEvent.js +327 -0
  9. package/dist/base/browser/touch.d.ts +39 -0
  10. package/dist/base/browser/touch.js +454 -0
  11. package/dist/base/common/arrays.d.ts +10 -0
  12. package/dist/base/common/arrays.js +210 -0
  13. package/dist/base/common/async.d.ts +35 -0
  14. package/dist/base/common/async.js +280 -0
  15. package/dist/base/common/charCode.d.ts +405 -0
  16. package/dist/base/common/charCode.js +9 -0
  17. package/dist/base/common/color.d.ts +159 -0
  18. package/dist/base/common/color.js +709 -0
  19. package/dist/base/common/decorators.d.ts +6 -0
  20. package/dist/base/common/decorators.js +300 -0
  21. package/dist/base/common/dom.d.ts +221 -0
  22. package/dist/base/common/dom.js +1478 -0
  23. package/dist/base/common/event.d.ts +213 -0
  24. package/dist/base/common/event.js +804 -0
  25. package/dist/base/common/iterator.d.ts +69 -0
  26. package/dist/base/common/iterator.js +381 -0
  27. package/dist/base/common/keyCodes.d.ts +478 -0
  28. package/dist/base/common/keyCodes.js +479 -0
  29. package/dist/base/common/lifecycle.d.ts +17 -0
  30. package/dist/base/common/lifecycle.js +258 -0
  31. package/dist/base/common/linkedList.d.ts +17 -0
  32. package/dist/base/common/linkedList.js +319 -0
  33. package/dist/base/common/platform.d.ts +33 -0
  34. package/dist/base/common/platform.js +302 -0
  35. package/dist/base/common/strings.d.ts +23 -0
  36. package/dist/base/common/strings.js +273 -0
  37. package/dist/consts.d.ts +49 -0
  38. package/dist/consts.js +303 -0
  39. package/dist/index.d.ts +3 -0
  40. package/dist/index.js +211 -0
  41. package/dist/main/attach-titlebar-to-window.d.ts +3 -0
  42. package/dist/main/attach-titlebar-to-window.js +207 -0
  43. package/dist/main/index.d.ts +3 -0
  44. package/dist/main/index.js +202 -0
  45. package/dist/main/setup-titlebar.d.ts +2 -0
  46. package/dist/main/setup-titlebar.js +242 -0
  47. package/dist/menubar/index.d.ts +86 -0
  48. package/dist/menubar/index.js +1118 -0
  49. package/dist/menubar/menu/index.d.ts +46 -0
  50. package/dist/menubar/menu/index.js +556 -0
  51. package/dist/menubar/menu/item.d.ts +67 -0
  52. package/dist/menubar/menu/item.js +575 -0
  53. package/dist/menubar/menu/separator.d.ts +11 -0
  54. package/dist/menubar/menu/separator.js +213 -0
  55. package/dist/menubar/menu/submenu.d.ts +32 -0
  56. package/dist/menubar/menu/submenu.js +372 -0
  57. package/dist/menubar/menubar-options.d.ts +55 -0
  58. package/dist/menubar/menubar-options.js +9 -0
  59. package/dist/titlebar/index.d.ts +99 -0
  60. package/dist/titlebar/index.js +663 -0
  61. package/dist/titlebar/options.d.ts +84 -0
  62. package/dist/titlebar/options.js +9 -0
  63. package/dist/titlebar/themebar.d.ts +20 -0
  64. package/dist/titlebar/themebar.js +267 -0
  65. package/package.json +1 -1
@@ -0,0 +1,1478 @@
1
+ "use strict";
2
+
3
+ /* ---------------------------------------------------------------------------------------------
4
+ * Copyright (c) Microsoft Corporation. All rights reserved.
5
+ * Licensed under the MIT License. See License.txt in the project root for license information.
6
+ *-------------------------------------------------------------------------------------------- */
7
+ var __createBinding = this && this.__createBinding || (Object.create ? function (o, m, k, k2) {
8
+ if (k2 === undefined) k2 = k;
9
+ var desc = Object.getOwnPropertyDescriptor(m, k);
10
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
11
+ desc = {
12
+ enumerable: true,
13
+ get: function () {
14
+ return m[k];
15
+ }
16
+ };
17
+ }
18
+ Object.defineProperty(o, k2, desc);
19
+ } : function (o, m, k, k2) {
20
+ if (k2 === undefined) k2 = k;
21
+ o[k2] = m[k];
22
+ });
23
+ var __setModuleDefault = this && this.__setModuleDefault || (Object.create ? function (o, v) {
24
+ Object.defineProperty(o, "default", {
25
+ enumerable: true,
26
+ value: v
27
+ });
28
+ } : function (o, v) {
29
+ o["default"] = v;
30
+ });
31
+ var __importStar = this && this.__importStar || function (mod) {
32
+ if (mod && mod.__esModule) return mod;
33
+ var result = {};
34
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) _get__("__createBinding")(result, mod, k);
35
+ _get__("__setModuleDefault")(result, mod);
36
+ return result;
37
+ };
38
+ Object.defineProperty(exports, "__esModule", {
39
+ value: true
40
+ });
41
+ exports.hide = exports.show = exports.join = exports.$ = exports.prepend = exports.append = exports.trackFocus = exports.restoreParentsScrollTop = exports.saveParentsScrollTop = exports.EventHelper = exports.EventType = exports.isHTMLElement = exports.removeCSSRulesContainingSelector = exports.createCSSRule = exports.createStyleSheet = exports.findParentWithClass = exports.isAncestor = exports.getLargestChildWidth = exports.getTotalHeight = exports.getContentHeight = exports.getTotalScrollWidth = exports.getContentWidth = exports.getTotalWidth = exports.StandardWindow = exports.getDomNodePagePosition = exports.position = exports.size = exports.getTopLeftOffset = exports.Dimension = exports.getDomNodeZoomLevel = exports.getClientArea = exports.getComputedStyle = exports.addDisposableThrottledListener = exports.modify = exports.measure = exports.scheduleAtNextAnimationFrame = exports.runAtThisOrScheduleAtNextAnimationFrame = exports.addDisposableNonBubblingMouseOutListener = exports.addStandardDisposableListener = exports.addDisposableListener = exports.toggleClass = exports.removeClasses = exports.removeClass = exports.addClasses = exports.addClass = exports.hasClass = exports.ModifierKeyEmitter = exports.isInDOM = exports.removeNode = exports.clearNode = void 0;
42
+ exports.animate = exports.windowOpenNoOpener = exports.computeScreenAwareSize = exports.domContentLoaded = exports.finalHandler = exports.getElementsByTagName = exports.removeTabIndexAndUpdateFocus = void 0;
43
+ const browser = _get__("__importStar")(require("../browser/browser"));
44
+ const event_1 = require("../browser/event");
45
+ const keyboardEvent_1 = require("../browser/keyboardEvent");
46
+ const mouseEvent_1 = require("../browser/mouseEvent");
47
+ const async_1 = require("../common/async");
48
+ const event_2 = require("../common/event");
49
+ const lifecycle_1 = require("../common/lifecycle");
50
+ const platform = _get__("__importStar")(require("../common/platform"));
51
+ const arrays_1 = require("../common/arrays");
52
+ function clearNode(node) {
53
+ while (node.firstChild) {
54
+ node.removeChild(node.firstChild);
55
+ }
56
+ }
57
+ exports.clearNode = _get__("clearNode");
58
+ function removeNode(node) {
59
+ if (node.parentNode) {
60
+ node.parentNode.removeChild(node);
61
+ }
62
+ }
63
+ exports.removeNode = _get__("removeNode");
64
+ function isInDOM(node) {
65
+ while (node) {
66
+ if (node === document.body) {
67
+ return true;
68
+ }
69
+ node = node.parentNode;
70
+ }
71
+ return false;
72
+ }
73
+ exports.isInDOM = _get__("isInDOM");
74
+ class ModifierKeyEmitter extends _get__("event_2").Emitter {
75
+ constructor() {
76
+ super();
77
+ this._keyStatus = {
78
+ altKey: false,
79
+ shiftKey: false,
80
+ ctrlKey: false,
81
+ metaKey: false
82
+ };
83
+ _get__("addDisposableListener")(window, 'keydown', e => {
84
+ if (e.defaultPrevented) {
85
+ return;
86
+ }
87
+ const event = new (_get__("keyboardEvent_1").StandardKeyboardEvent)(e);
88
+ // If Alt-key keydown event is repeated, ignore it #112347
89
+ // Only known to be necessary for Alt-Key at the moment #115810
90
+ if (event.keyCode === 6 /* KeyCode.Alt */ && e.repeat) {
91
+ return;
92
+ }
93
+ if (e.altKey && !this._keyStatus.altKey) {
94
+ this._keyStatus.lastKeyPressed = 'alt';
95
+ } else if (e.ctrlKey && !this._keyStatus.ctrlKey) {
96
+ this._keyStatus.lastKeyPressed = 'ctrl';
97
+ } else if (e.metaKey && !this._keyStatus.metaKey) {
98
+ this._keyStatus.lastKeyPressed = 'meta';
99
+ } else if (e.shiftKey && !this._keyStatus.shiftKey) {
100
+ this._keyStatus.lastKeyPressed = 'shift';
101
+ } else if (event.keyCode !== 6 /* KeyCode.Alt */) {
102
+ this._keyStatus.lastKeyPressed = undefined;
103
+ } else {
104
+ return;
105
+ }
106
+ this._keyStatus.altKey = e.altKey;
107
+ this._keyStatus.ctrlKey = e.ctrlKey;
108
+ this._keyStatus.metaKey = e.metaKey;
109
+ this._keyStatus.shiftKey = e.shiftKey;
110
+ if (this._keyStatus.lastKeyPressed) {
111
+ this._keyStatus.event = e;
112
+ this.fire(this._keyStatus);
113
+ }
114
+ }, true);
115
+ _get__("addDisposableListener")(window, 'keyup', e => {
116
+ if (e.defaultPrevented) {
117
+ return;
118
+ }
119
+ if (!e.altKey && this._keyStatus.altKey) {
120
+ this._keyStatus.lastKeyReleased = 'alt';
121
+ } else if (!e.ctrlKey && this._keyStatus.ctrlKey) {
122
+ this._keyStatus.lastKeyReleased = 'ctrl';
123
+ } else if (!e.metaKey && this._keyStatus.metaKey) {
124
+ this._keyStatus.lastKeyReleased = 'meta';
125
+ } else if (!e.shiftKey && this._keyStatus.shiftKey) {
126
+ this._keyStatus.lastKeyReleased = 'shift';
127
+ } else {
128
+ this._keyStatus.lastKeyReleased = undefined;
129
+ }
130
+ if (this._keyStatus.lastKeyPressed !== this._keyStatus.lastKeyReleased) {
131
+ this._keyStatus.lastKeyPressed = undefined;
132
+ }
133
+ this._keyStatus.altKey = e.altKey;
134
+ this._keyStatus.ctrlKey = e.ctrlKey;
135
+ this._keyStatus.metaKey = e.metaKey;
136
+ this._keyStatus.shiftKey = e.shiftKey;
137
+ if (this._keyStatus.lastKeyReleased) {
138
+ this._keyStatus.event = e;
139
+ this.fire(this._keyStatus);
140
+ }
141
+ }, true);
142
+ _get__("addDisposableListener")(document.body, 'mousedown', () => {
143
+ this._keyStatus.lastKeyPressed = undefined;
144
+ }, true);
145
+ _get__("addDisposableListener")(document.body, 'mouseup', () => {
146
+ this._keyStatus.lastKeyPressed = undefined;
147
+ }, true);
148
+ _get__("addDisposableListener")(document.body, 'mousemove', e => {
149
+ if (e.buttons) {
150
+ this._keyStatus.lastKeyPressed = undefined;
151
+ }
152
+ }, true);
153
+ _get__("addDisposableListener")(window, 'blur', () => {
154
+ this.resetKeyStatus();
155
+ });
156
+ }
157
+ get keyStatus() {
158
+ return this._keyStatus;
159
+ }
160
+ get isModifierPressed() {
161
+ return this._keyStatus.altKey || this._keyStatus.ctrlKey || this._keyStatus.metaKey || this._keyStatus.shiftKey;
162
+ }
163
+ /**
164
+ * Allows to explicitly reset the key status based on more knowledge (#109062)
165
+ */
166
+ resetKeyStatus() {
167
+ this.doResetKeyStatus();
168
+ this.fire(this._keyStatus);
169
+ }
170
+ doResetKeyStatus() {
171
+ this._keyStatus = {
172
+ altKey: false,
173
+ shiftKey: false,
174
+ ctrlKey: false,
175
+ metaKey: false
176
+ };
177
+ }
178
+ static getInstance() {
179
+ if (!_get__("ModifierKeyEmitter").instance) {
180
+ _get__("ModifierKeyEmitter").instance = new (_get__("ModifierKeyEmitter"))();
181
+ }
182
+ return _get__("ModifierKeyEmitter").instance;
183
+ }
184
+ dispose() {
185
+ super.dispose();
186
+ }
187
+ }
188
+ exports.ModifierKeyEmitter = _get__("ModifierKeyEmitter");
189
+ const _manualClassList = new class {
190
+ _findClassName(node, className) {
191
+ const classes = node.className;
192
+ if (!classes) {
193
+ this._lastStart = -1;
194
+ return;
195
+ }
196
+ className = className.trim();
197
+ const classesLen = classes.length;
198
+ const classLen = className.length;
199
+ if (classLen === 0) {
200
+ this._lastStart = -1;
201
+ return;
202
+ }
203
+ if (classesLen < classLen) {
204
+ this._lastStart = -1;
205
+ return;
206
+ }
207
+ if (classes === className) {
208
+ this._lastStart = 0;
209
+ this._lastEnd = classesLen;
210
+ return;
211
+ }
212
+ let idx = -1;
213
+ let idxEnd;
214
+ while ((idx = classes.indexOf(className, idx + 1)) >= 0) {
215
+ idxEnd = idx + classLen;
216
+ // a class that is followed by another class
217
+ if ((idx === 0 || classes.charCodeAt(idx - 1) === 32 /* CharCode.Space */) && classes.charCodeAt(idxEnd) === 32 /* CharCode.Space */) {
218
+ this._lastStart = idx;
219
+ this._lastEnd = idxEnd + 1;
220
+ return;
221
+ }
222
+ // last class
223
+ if (idx > 0 && classes.charCodeAt(idx - 1) === 32 /* CharCode.Space */ && idxEnd === classesLen) {
224
+ this._lastStart = idx - 1;
225
+ this._lastEnd = idxEnd;
226
+ return;
227
+ }
228
+ // equal - duplicate of cmp above
229
+ if (idx === 0 && idxEnd === classesLen) {
230
+ this._lastStart = 0;
231
+ this._lastEnd = idxEnd;
232
+ return;
233
+ }
234
+ }
235
+ this._lastStart = -1;
236
+ }
237
+ hasClass(node, className) {
238
+ this._findClassName(node, className);
239
+ return this._lastStart !== -1;
240
+ }
241
+ addClasses(node, ...classNames) {
242
+ classNames.forEach(nameValue => nameValue.split(' ').forEach(name => this.addClass(node, name)));
243
+ }
244
+ addClass(node, className) {
245
+ if (!node.className) {
246
+ // doesn't have it for sure
247
+ node.className = className;
248
+ } else {
249
+ this._findClassName(node, className); // see if it's already there
250
+ if (this._lastStart === -1) {
251
+ node.className = node.className + ' ' + className;
252
+ }
253
+ }
254
+ }
255
+ removeClass(node, className) {
256
+ this._findClassName(node, className);
257
+ if (this._lastStart === -1) {
258
+ // Prevent styles invalidation if not necessary
259
+ } else {
260
+ node.className = node.className.substring(0, this._lastStart) + node.className.substring(this._lastEnd || 0);
261
+ }
262
+ }
263
+ removeClasses(node, ...classNames) {
264
+ classNames.forEach(nameValue => nameValue.split(' ').forEach(name => this.removeClass(node, name)));
265
+ }
266
+ toggleClass(node, className, shouldHaveIt) {
267
+ this._findClassName(node, className);
268
+ if (this._lastStart !== -1 && (shouldHaveIt === undefined || !shouldHaveIt)) {
269
+ this.removeClass(node, className);
270
+ }
271
+ if (this._lastStart === -1 && (shouldHaveIt === undefined || shouldHaveIt)) {
272
+ this.addClass(node, className);
273
+ }
274
+ }
275
+ }();
276
+ const _nativeClassList = new class {
277
+ hasClass(node, className) {
278
+ return Boolean(className) && node.classList && node.classList.contains(className);
279
+ }
280
+ addClasses(node, ...classNames) {
281
+ classNames.forEach(nameValue => nameValue.split(' ').forEach(name => this.addClass(node, name)));
282
+ }
283
+ addClass(node, className) {
284
+ if (className && node.classList) {
285
+ node.classList.add(className);
286
+ }
287
+ }
288
+ removeClass(node, className) {
289
+ if (className && node.classList) {
290
+ node.classList.remove(className);
291
+ }
292
+ }
293
+ removeClasses(node, ...classNames) {
294
+ classNames.forEach(nameValue => nameValue.split(' ').forEach(name => this.removeClass(node, name)));
295
+ }
296
+ toggleClass(node, className, shouldHaveIt) {
297
+ if (node.classList) {
298
+ node.classList.toggle(className, shouldHaveIt);
299
+ }
300
+ }
301
+ }();
302
+ // In IE11 there is only partial support for `classList` which makes us keep our
303
+ // custom implementation. Otherwise use the native implementation, see: http://caniuse.com/#search=classlist
304
+ const _classList = _get__("browser").isIE ? _get__("_manualClassList") : _get__("_nativeClassList");
305
+ exports.hasClass = _get__("_classList").hasClass.bind(_get__("_classList"));
306
+ exports.addClass = _get__("_classList").addClass.bind(_get__("_classList"));
307
+ exports.addClasses = _get__("_classList").addClasses.bind(_get__("_classList"));
308
+ exports.removeClass = _get__("_classList").removeClass.bind(_get__("_classList"));
309
+ exports.removeClasses = _get__("_classList").removeClasses.bind(_get__("_classList"));
310
+ exports.toggleClass = _get__("_classList").toggleClass.bind(_get__("_classList"));
311
+ class DomListener {
312
+ constructor(node, type, handler, options) {
313
+ this._node = node;
314
+ this._type = type;
315
+ this._handler = handler;
316
+ this._options = options || false;
317
+ this._node.addEventListener(this._type, this._handler, this._options);
318
+ }
319
+ dispose() {
320
+ if (!this._handler) {
321
+ // Already disposed
322
+ return;
323
+ }
324
+ this._node.removeEventListener(this._type, this._handler, this._options);
325
+ // Prevent leakers from holding on to the dom or handler func
326
+ this._node = null;
327
+ this._handler = null;
328
+ }
329
+ }
330
+ function addDisposableListener(node, type, handler, useCaptureOrOptions) {
331
+ return new (_get__("DomListener"))(node, type, handler, useCaptureOrOptions);
332
+ }
333
+ exports.addDisposableListener = _get__("addDisposableListener");
334
+ function _wrapAsStandardMouseEvent(handler) {
335
+ return function (e) {
336
+ return handler(new (_get__("mouseEvent_1").StandardMouseEvent)(e));
337
+ };
338
+ }
339
+ function _wrapAsStandardKeyboardEvent(handler) {
340
+ return function (e) {
341
+ return handler(new (_get__("keyboardEvent_1").StandardKeyboardEvent)(e));
342
+ };
343
+ }
344
+ const addStandardDisposableListener = function addStandardDisposableListener(node, type, handler, useCapture) {
345
+ let wrapHandler = handler;
346
+ if (type === 'click' || type === 'mousedown') {
347
+ wrapHandler = _get__("_wrapAsStandardMouseEvent")(handler);
348
+ } else if (type === 'keydown' || type === 'keypress' || type === 'keyup') {
349
+ wrapHandler = _get__("_wrapAsStandardKeyboardEvent")(handler);
350
+ }
351
+ return _get__("addDisposableListener")(node, type, wrapHandler, useCapture);
352
+ };
353
+ exports.addStandardDisposableListener = _get__("addStandardDisposableListener");
354
+ function addDisposableNonBubblingMouseOutListener(node, handler) {
355
+ return _get__("addDisposableListener")(node, 'mouseout', e => {
356
+ // Mouse out bubbles, so this is an attempt to ignore faux mouse outs coming from children elements
357
+ let toElement = e.relatedTarget || e.target;
358
+ while (toElement && toElement !== node) {
359
+ toElement = toElement.parentNode;
360
+ }
361
+ if (toElement === node) {
362
+ return;
363
+ }
364
+ handler(e);
365
+ });
366
+ }
367
+ exports.addDisposableNonBubblingMouseOutListener = _get__("addDisposableNonBubblingMouseOutListener");
368
+ let _animationFrame = null;
369
+ function doRequestAnimationFrame(callback) {
370
+ if (!_get__("_animationFrame")) {
371
+ const emulatedRequestAnimationFrame = callback => {
372
+ return setTimeout(() => callback(new Date().getTime()), 0);
373
+ };
374
+ _assign__("_animationFrame", self.requestAnimationFrame || self.msRequestAnimationFrame || self.webkitRequestAnimationFrame || self.mozRequestAnimationFrame || self.oRequestAnimationFrame || emulatedRequestAnimationFrame);
375
+ }
376
+ return _get__("_animationFrame").call(self, callback);
377
+ }
378
+ class AnimationFrameQueueItem {
379
+ constructor(runner, priority = 0) {
380
+ this._runner = runner;
381
+ this.priority = priority;
382
+ this._canceled = false;
383
+ }
384
+ dispose() {
385
+ this._canceled = true;
386
+ }
387
+ execute() {
388
+ if (this._canceled) {
389
+ return;
390
+ }
391
+ try {
392
+ this._runner();
393
+ } catch (e) {
394
+ console.error(e);
395
+ }
396
+ }
397
+ // Sort by priority (largest to lowest)
398
+ static sort(a, b) {
399
+ return b.priority - a.priority;
400
+ }
401
+ }
402
+ (function () {
403
+ /**
404
+ * The runners scheduled at the next animation frame
405
+ */
406
+ let NEXT_QUEUE = [];
407
+ /**
408
+ * The runners scheduled at the current animation frame
409
+ */
410
+ let CURRENT_QUEUE = null;
411
+ /**
412
+ * A flag to keep track if the native requestAnimationFrame was already called
413
+ */
414
+ let animFrameRequested = false;
415
+ /**
416
+ * A flag to indicate if currently handling a native requestAnimationFrame callback
417
+ */
418
+ let inAnimationFrameRunner = false;
419
+ const animationFrameRunner = () => {
420
+ animFrameRequested = false;
421
+ CURRENT_QUEUE = NEXT_QUEUE;
422
+ NEXT_QUEUE = [];
423
+ inAnimationFrameRunner = true;
424
+ while (CURRENT_QUEUE.length > 0) {
425
+ CURRENT_QUEUE.sort(_get__("AnimationFrameQueueItem").sort);
426
+ const top = CURRENT_QUEUE.shift();
427
+ top.execute();
428
+ }
429
+ inAnimationFrameRunner = false;
430
+ };
431
+ exports.scheduleAtNextAnimationFrame = (runner, priority = 0) => {
432
+ const item = new (_get__("AnimationFrameQueueItem"))(runner, priority);
433
+ NEXT_QUEUE.push(item);
434
+ if (!animFrameRequested) {
435
+ animFrameRequested = true;
436
+ _get__("doRequestAnimationFrame")(animationFrameRunner);
437
+ }
438
+ return item;
439
+ };
440
+ exports.runAtThisOrScheduleAtNextAnimationFrame = (runner, priority) => {
441
+ if (inAnimationFrameRunner) {
442
+ const item = new (_get__("AnimationFrameQueueItem"))(runner, priority);
443
+ CURRENT_QUEUE.push(item);
444
+ return item;
445
+ } else {
446
+ return (0, exports.scheduleAtNextAnimationFrame)(runner, priority);
447
+ }
448
+ };
449
+ })();
450
+ function measure(callback) {
451
+ return (0, exports.scheduleAtNextAnimationFrame)(callback, 10000 /* must be early */);
452
+ }
453
+
454
+ exports.measure = _get__("measure");
455
+ function modify(callback) {
456
+ return (0, exports.scheduleAtNextAnimationFrame)(callback, -10000 /* must be late */);
457
+ }
458
+
459
+ exports.modify = _get__("modify");
460
+ const MINIMUM_TIME_MS = 16;
461
+ const DEFAULT_EVENT_MERGER = function (lastEvent, currentEvent) {
462
+ return currentEvent;
463
+ };
464
+ class TimeoutThrottledDomListener extends _get__("lifecycle_1").Disposable {
465
+ constructor(node, type, handler, eventMerger = _get__("DEFAULT_EVENT_MERGER"), minimumTimeMs = _get__("MINIMUM_TIME_MS")) {
466
+ super();
467
+ let lastEvent = null;
468
+ let lastHandlerTime = 0;
469
+ const timeout = this._register(new (_get__("async_1").TimeoutTimer)());
470
+ const invokeHandler = () => {
471
+ lastHandlerTime = new Date().getTime();
472
+ handler(lastEvent);
473
+ lastEvent = null;
474
+ };
475
+ this._register(_get__("addDisposableListener")(node, type, e => {
476
+ lastEvent = eventMerger(lastEvent, e);
477
+ const elapsedTime = new Date().getTime() - lastHandlerTime;
478
+ if (elapsedTime >= minimumTimeMs) {
479
+ timeout.cancel();
480
+ invokeHandler();
481
+ } else {
482
+ timeout.setIfNotSet(invokeHandler, minimumTimeMs - elapsedTime);
483
+ }
484
+ }));
485
+ }
486
+ }
487
+ function addDisposableThrottledListener(node, type, handler, eventMerger, minimumTimeMs) {
488
+ return new (_get__("TimeoutThrottledDomListener"))(node, type, handler, eventMerger, minimumTimeMs);
489
+ }
490
+ exports.addDisposableThrottledListener = _get__("addDisposableThrottledListener");
491
+ function getComputedStyle(el) {
492
+ return document.defaultView.getComputedStyle(el, null);
493
+ }
494
+ exports.getComputedStyle = _get__("getComputedStyle");
495
+ // Adapted from WinJS
496
+ // Converts a CSS positioning string for the specified element to pixels.
497
+ const convertToPixels = function () {
498
+ return function (element, value) {
499
+ return parseFloat(value) || 0;
500
+ };
501
+ }();
502
+ function getDimension(element, cssPropertyName, jsPropertyName) {
503
+ const computedStyle = _get__("getComputedStyle")(element);
504
+ let value = '0';
505
+ if (computedStyle) {
506
+ if (computedStyle.getPropertyValue) {
507
+ value = computedStyle.getPropertyValue(cssPropertyName);
508
+ } else {
509
+ // IE8
510
+ value = computedStyle.getAttribute(jsPropertyName);
511
+ }
512
+ }
513
+ return _get__("convertToPixels")(element, value);
514
+ }
515
+ function getClientArea(element) {
516
+ // Try with DOM clientWidth / clientHeight
517
+ if (element !== document.body) {
518
+ return new (_get__("Dimension"))(element.clientWidth, element.clientHeight);
519
+ }
520
+ // Try innerWidth / innerHeight
521
+ if (window.innerWidth && window.innerHeight) {
522
+ return new (_get__("Dimension"))(window.innerWidth, window.innerHeight);
523
+ }
524
+ // Try with document.body.clientWidth / document.body.clientHeight
525
+ if (document.body && document.body.clientWidth && document.body.clientHeight) {
526
+ return new (_get__("Dimension"))(document.body.clientWidth, document.body.clientHeight);
527
+ }
528
+ // Try with document.documentElement.clientWidth / document.documentElement.clientHeight
529
+ if (document.documentElement && document.documentElement.clientWidth && document.documentElement.clientHeight) {
530
+ return new (_get__("Dimension"))(document.documentElement.clientWidth, document.documentElement.clientHeight);
531
+ }
532
+ throw new Error('Unable to figure out browser width and height');
533
+ }
534
+ exports.getClientArea = _get__("getClientArea");
535
+ /**
536
+ * Returns the effective zoom on a given element before window zoom level is applied
537
+ */
538
+ function getDomNodeZoomLevel(domNode) {
539
+ let testElement = domNode;
540
+ let zoom = 1.0;
541
+ do {
542
+ const elementZoomLevel = _get__("getComputedStyle")(testElement).zoom;
543
+ if (elementZoomLevel !== null && elementZoomLevel !== undefined && elementZoomLevel !== '1') {
544
+ zoom *= elementZoomLevel;
545
+ }
546
+ testElement = testElement.parentElement;
547
+ } while (testElement !== null && testElement !== document.documentElement);
548
+ return zoom;
549
+ }
550
+ exports.getDomNodeZoomLevel = _get__("getDomNodeZoomLevel");
551
+ const sizeUtils = {
552
+ getBorderLeftWidth: function (element) {
553
+ return _get__("getDimension")(element, 'border-left-width', 'borderLeftWidth');
554
+ },
555
+ getBorderRightWidth: function (element) {
556
+ return _get__("getDimension")(element, 'border-right-width', 'borderRightWidth');
557
+ },
558
+ getBorderTopWidth: function (element) {
559
+ return _get__("getDimension")(element, 'border-top-width', 'borderTopWidth');
560
+ },
561
+ getBorderBottomWidth: function (element) {
562
+ return _get__("getDimension")(element, 'border-bottom-width', 'borderBottomWidth');
563
+ },
564
+ getPaddingLeft: function (element) {
565
+ return _get__("getDimension")(element, 'padding-left', 'paddingLeft');
566
+ },
567
+ getPaddingRight: function (element) {
568
+ return _get__("getDimension")(element, 'padding-right', 'paddingRight');
569
+ },
570
+ getPaddingTop: function (element) {
571
+ return _get__("getDimension")(element, 'padding-top', 'paddingTop');
572
+ },
573
+ getPaddingBottom: function (element) {
574
+ return _get__("getDimension")(element, 'padding-bottom', 'paddingBottom');
575
+ },
576
+ getMarginLeft: function (element) {
577
+ return _get__("getDimension")(element, 'margin-left', 'marginLeft');
578
+ },
579
+ getMarginTop: function (element) {
580
+ return _get__("getDimension")(element, 'margin-top', 'marginTop');
581
+ },
582
+ getMarginRight: function (element) {
583
+ return _get__("getDimension")(element, 'margin-right', 'marginRight');
584
+ },
585
+ getMarginBottom: function (element) {
586
+ return _get__("getDimension")(element, 'margin-bottom', 'marginBottom');
587
+ },
588
+ __commaSentinel: false
589
+ };
590
+ // ----------------------------------------------------------------------------------------
591
+ // Position & Dimension
592
+ class Dimension {
593
+ constructor(width, height) {
594
+ this.width = width;
595
+ this.height = height;
596
+ }
597
+ static equals(a, b) {
598
+ if (a === b) {
599
+ return true;
600
+ }
601
+ if (!a || !b) {
602
+ return false;
603
+ }
604
+ return a.width === b.width && a.height === b.height;
605
+ }
606
+ }
607
+ exports.Dimension = _get__("Dimension");
608
+ function getTopLeftOffset(element) {
609
+ // Adapted from WinJS.Utilities.getPosition
610
+ // and added borders to the mix
611
+ let offsetParent = element.offsetParent;
612
+ let top = element.offsetTop;
613
+ let left = element.offsetLeft;
614
+ while ((element = element.parentNode) !== null && element !== document.body && element !== document.documentElement) {
615
+ top -= element.scrollTop;
616
+ const c = _get__("getComputedStyle")(element);
617
+ if (c) {
618
+ left -= c.direction !== 'rtl' ? element.scrollLeft : -element.scrollLeft;
619
+ }
620
+ if (element === offsetParent) {
621
+ left += _get__("sizeUtils").getBorderLeftWidth(element);
622
+ top += _get__("sizeUtils").getBorderTopWidth(element);
623
+ top += element.offsetTop;
624
+ left += element.offsetLeft;
625
+ offsetParent = element.offsetParent;
626
+ }
627
+ }
628
+ return {
629
+ left,
630
+ top
631
+ };
632
+ }
633
+ exports.getTopLeftOffset = _get__("getTopLeftOffset");
634
+ function size(element, width, height) {
635
+ if (typeof width === 'number') {
636
+ element.style.width = `${width}px`;
637
+ }
638
+ if (typeof height === 'number') {
639
+ element.style.height = `${height}px`;
640
+ }
641
+ }
642
+ exports.size = _get__("size");
643
+ function position(element, top, right, bottom, left, position = 'absolute') {
644
+ if (typeof top === 'number') {
645
+ element.style.top = `${top}px`;
646
+ }
647
+ if (typeof right === 'number') {
648
+ element.style.right = `${right}px`;
649
+ }
650
+ if (typeof bottom === 'number') {
651
+ element.style.bottom = `${bottom}px`;
652
+ }
653
+ if (typeof left === 'number') {
654
+ element.style.left = `${left}px`;
655
+ }
656
+ element.style.position = position;
657
+ }
658
+ exports.position = _get__("position");
659
+ /**
660
+ * Returns the position of a dom node relative to the entire page.
661
+ */
662
+ function getDomNodePagePosition(domNode) {
663
+ const bb = domNode.getBoundingClientRect();
664
+ return {
665
+ left: bb.left + exports.StandardWindow.scrollX,
666
+ top: bb.top + exports.StandardWindow.scrollY,
667
+ width: bb.width,
668
+ height: bb.height
669
+ };
670
+ }
671
+ exports.getDomNodePagePosition = _get__("getDomNodePagePosition");
672
+ exports.StandardWindow = new class {
673
+ get scrollX() {
674
+ if (typeof window.scrollX === 'number') {
675
+ // modern browsers
676
+ return window.scrollX;
677
+ } else {
678
+ return document.body.scrollLeft + document.documentElement.scrollLeft;
679
+ }
680
+ }
681
+ get scrollY() {
682
+ if (typeof window.scrollY === 'number') {
683
+ // modern browsers
684
+ return window.scrollY;
685
+ } else {
686
+ return document.body.scrollTop + document.documentElement.scrollTop;
687
+ }
688
+ }
689
+ }();
690
+ // Adapted from WinJS
691
+ // Gets the width of the element, including margins.
692
+ function getTotalWidth(element) {
693
+ const margin = _get__("sizeUtils").getMarginLeft(element) + _get__("sizeUtils").getMarginRight(element);
694
+ return element.offsetWidth + margin;
695
+ }
696
+ exports.getTotalWidth = _get__("getTotalWidth");
697
+ function getContentWidth(element) {
698
+ const border = _get__("sizeUtils").getBorderLeftWidth(element) + _get__("sizeUtils").getBorderRightWidth(element);
699
+ const padding = _get__("sizeUtils").getPaddingLeft(element) + _get__("sizeUtils").getPaddingRight(element);
700
+ return element.offsetWidth - border - padding;
701
+ }
702
+ exports.getContentWidth = _get__("getContentWidth");
703
+ function getTotalScrollWidth(element) {
704
+ const margin = _get__("sizeUtils").getMarginLeft(element) + _get__("sizeUtils").getMarginRight(element);
705
+ return element.scrollWidth + margin;
706
+ }
707
+ exports.getTotalScrollWidth = _get__("getTotalScrollWidth");
708
+ // Adapted from WinJS
709
+ // Gets the height of the content of the specified element. The content height does not include borders or padding.
710
+ function getContentHeight(element) {
711
+ const border = _get__("sizeUtils").getBorderTopWidth(element) + _get__("sizeUtils").getBorderBottomWidth(element);
712
+ const padding = _get__("sizeUtils").getPaddingTop(element) + _get__("sizeUtils").getPaddingBottom(element);
713
+ return element.offsetHeight - border - padding;
714
+ }
715
+ exports.getContentHeight = _get__("getContentHeight");
716
+ // Adapted from WinJS
717
+ // Gets the height of the element, including its margins.
718
+ function getTotalHeight(element) {
719
+ const margin = _get__("sizeUtils").getMarginTop(element) + _get__("sizeUtils").getMarginBottom(element);
720
+ return element.offsetHeight + margin;
721
+ }
722
+ exports.getTotalHeight = _get__("getTotalHeight");
723
+ // Gets the left coordinate of the specified element relative to the specified parent.
724
+ function getRelativeLeft(element, parent) {
725
+ if (element === null) {
726
+ return 0;
727
+ }
728
+ const elementPosition = _get__("getTopLeftOffset")(element);
729
+ const parentPosition = _get__("getTopLeftOffset")(parent);
730
+ return elementPosition.left - parentPosition.left;
731
+ }
732
+ function getLargestChildWidth(parent, children) {
733
+ const childWidths = children.map(child => {
734
+ return Math.max(_get__("getTotalScrollWidth")(child), _get__("getTotalWidth")(child)) + _get__("getRelativeLeft")(child, parent) || 0;
735
+ });
736
+ const maxWidth = Math.max(...childWidths);
737
+ return maxWidth;
738
+ }
739
+ exports.getLargestChildWidth = _get__("getLargestChildWidth");
740
+ // ----------------------------------------------------------------------------------------
741
+ function isAncestor(testChild, testAncestor) {
742
+ while (testChild) {
743
+ if (testChild === testAncestor) {
744
+ return true;
745
+ }
746
+ testChild = testChild.parentNode;
747
+ }
748
+ return false;
749
+ }
750
+ exports.isAncestor = _get__("isAncestor");
751
+ function findParentWithClass(node, clazz, stopAtClazzOrNode) {
752
+ while (node) {
753
+ if ((0, exports.hasClass)(node, clazz)) {
754
+ return node;
755
+ }
756
+ if (stopAtClazzOrNode) {
757
+ if (typeof stopAtClazzOrNode === 'string') {
758
+ if ((0, exports.hasClass)(node, stopAtClazzOrNode)) {
759
+ return null;
760
+ }
761
+ } else {
762
+ if (node === stopAtClazzOrNode) {
763
+ return null;
764
+ }
765
+ }
766
+ }
767
+ node = node.parentNode;
768
+ }
769
+ return null;
770
+ }
771
+ exports.findParentWithClass = _get__("findParentWithClass");
772
+ function createStyleSheet(container = document.getElementsByTagName('head')[0]) {
773
+ const style = document.createElement('style');
774
+ style.type = 'text/css';
775
+ style.media = 'screen';
776
+ container.appendChild(style);
777
+ return style;
778
+ }
779
+ exports.createStyleSheet = _get__("createStyleSheet");
780
+ let _sharedStyleSheet = null;
781
+ function getSharedStyleSheet() {
782
+ if (!_get__("_sharedStyleSheet")) {
783
+ _assign__("_sharedStyleSheet", _get__("createStyleSheet")());
784
+ }
785
+ return _get__("_sharedStyleSheet");
786
+ }
787
+ function getDynamicStyleSheetRules(style) {
788
+ if (style && style.sheet && style.sheet.rules) {
789
+ // Chrome, IE
790
+ return style.sheet.rules;
791
+ }
792
+ if (style && style.sheet && style.sheet.cssRules) {
793
+ // FF
794
+ return style.sheet.cssRules;
795
+ }
796
+ return [];
797
+ }
798
+ function createCSSRule(selector, cssText, style = _get__("getSharedStyleSheet")()) {
799
+ if (!style || !cssText) {
800
+ return;
801
+ }
802
+ style.sheet.insertRule(selector + '{' + cssText + '}', 0);
803
+ }
804
+ exports.createCSSRule = _get__("createCSSRule");
805
+ function removeCSSRulesContainingSelector(ruleName, style = _get__("getSharedStyleSheet")()) {
806
+ if (!style) {
807
+ return;
808
+ }
809
+ const rules = _get__("getDynamicStyleSheetRules")(style);
810
+ const toDelete = [];
811
+ for (let i = 0; i < rules.length; i++) {
812
+ const rule = rules[i];
813
+ if (rule.selectorText.indexOf(ruleName) !== -1) {
814
+ toDelete.push(i);
815
+ }
816
+ }
817
+ for (let i = toDelete.length - 1; i >= 0; i--) {
818
+ style.sheet.deleteRule(toDelete[i]);
819
+ }
820
+ }
821
+ exports.removeCSSRulesContainingSelector = _get__("removeCSSRulesContainingSelector");
822
+ function isHTMLElement(o) {
823
+ if (typeof HTMLElement === 'object') {
824
+ return o instanceof HTMLElement;
825
+ }
826
+ return o && typeof o === 'object' && o.nodeType === 1 && typeof o.nodeName === 'string';
827
+ }
828
+ exports.isHTMLElement = _get__("isHTMLElement");
829
+ exports.EventType = {
830
+ // Mouse
831
+ CLICK: 'click',
832
+ AUXCLICK: 'auxclick',
833
+ DBLCLICK: 'dblclick',
834
+ MOUSE_UP: 'mouseup',
835
+ MOUSE_DOWN: 'mousedown',
836
+ MOUSE_OVER: 'mouseover',
837
+ MOUSE_MOVE: 'mousemove',
838
+ MOUSE_OUT: 'mouseout',
839
+ MOUSE_ENTER: 'mouseenter',
840
+ MOUSE_LEAVE: 'mouseleave',
841
+ MOUSE_WHEEL: 'wheel',
842
+ POINTER_UP: 'pointerup',
843
+ POINTER_DOWN: 'pointerdown',
844
+ POINTER_MOVE: 'pointermove',
845
+ POINTER_LEAVE: 'pointerleave',
846
+ CONTEXT_MENU: 'contextmenu',
847
+ WHEEL: 'wheel',
848
+ // Keyboard
849
+ KEY_DOWN: 'keydown',
850
+ KEY_PRESS: 'keypress',
851
+ KEY_UP: 'keyup',
852
+ // HTML Document
853
+ LOAD: 'load',
854
+ BEFORE_UNLOAD: 'beforeunload',
855
+ UNLOAD: 'unload',
856
+ PAGE_SHOW: 'pageshow',
857
+ PAGE_HIDE: 'pagehide',
858
+ ABORT: 'abort',
859
+ ERROR: 'error',
860
+ RESIZE: 'resize',
861
+ SCROLL: 'scroll',
862
+ FULLSCREEN_CHANGE: 'fullscreenchange',
863
+ WK_FULLSCREEN_CHANGE: 'webkitfullscreenchange',
864
+ // Form
865
+ SELECT: 'select',
866
+ CHANGE: 'change',
867
+ SUBMIT: 'submit',
868
+ RESET: 'reset',
869
+ FOCUS: 'focus',
870
+ FOCUS_IN: 'focusin',
871
+ FOCUS_OUT: 'focusout',
872
+ BLUR: 'blur',
873
+ INPUT: 'input',
874
+ // Local Storage
875
+ STORAGE: 'storage',
876
+ // Drag
877
+ DRAG_START: 'dragstart',
878
+ DRAG: 'drag',
879
+ DRAG_ENTER: 'dragenter',
880
+ DRAG_LEAVE: 'dragleave',
881
+ DRAG_OVER: 'dragover',
882
+ DROP: 'drop',
883
+ DRAG_END: 'dragend',
884
+ // Animation
885
+ ANIMATION_START: _get__("browser").isWebKit ? 'webkitAnimationStart' : 'animationstart',
886
+ ANIMATION_END: _get__("browser").isWebKit ? 'webkitAnimationEnd' : 'animationend',
887
+ ANIMATION_ITERATION: _get__("browser").isWebKit ? 'webkitAnimationIteration' : 'animationiteration'
888
+ };
889
+ exports.EventHelper = {
890
+ stop: function (e, cancelBubble) {
891
+ if (e.preventDefault) {
892
+ e.preventDefault();
893
+ } else {
894
+ // IE8
895
+ e.returnValue = false;
896
+ }
897
+ if (cancelBubble) {
898
+ if (e.stopPropagation) {
899
+ e.stopPropagation();
900
+ } else {
901
+ // IE8
902
+ e.cancelBubble = true;
903
+ }
904
+ }
905
+ }
906
+ };
907
+ function saveParentsScrollTop(node) {
908
+ const r = [];
909
+ for (let i = 0; node && node.nodeType === node.ELEMENT_NODE; i++) {
910
+ r[i] = node.scrollTop;
911
+ node = node.parentNode;
912
+ }
913
+ return r;
914
+ }
915
+ exports.saveParentsScrollTop = _get__("saveParentsScrollTop");
916
+ function restoreParentsScrollTop(node, state) {
917
+ for (let i = 0; node && node.nodeType === node.ELEMENT_NODE; i++) {
918
+ if (node.scrollTop !== state[i]) {
919
+ node.scrollTop = state[i];
920
+ }
921
+ node = node.parentNode;
922
+ }
923
+ }
924
+ exports.restoreParentsScrollTop = _get__("restoreParentsScrollTop");
925
+ class FocusTracker {
926
+ constructor(element) {
927
+ this._onDidFocus = new (_get__("event_2").Emitter)();
928
+ this.onDidFocus = this._onDidFocus.event;
929
+ this._onDidBlur = new (_get__("event_2").Emitter)();
930
+ this.onDidBlur = this._onDidBlur.event;
931
+ this.disposables = [];
932
+ let hasFocus = _get__("isAncestor")(document.activeElement, element);
933
+ let loosingFocus = false;
934
+ const onFocus = () => {
935
+ loosingFocus = false;
936
+ if (!hasFocus) {
937
+ hasFocus = true;
938
+ this._onDidFocus.fire();
939
+ }
940
+ };
941
+ const onBlur = () => {
942
+ if (hasFocus) {
943
+ loosingFocus = true;
944
+ window.setTimeout(() => {
945
+ if (loosingFocus) {
946
+ loosingFocus = false;
947
+ hasFocus = false;
948
+ this._onDidBlur.fire();
949
+ }
950
+ }, 0);
951
+ }
952
+ };
953
+ (0, _get__("event_1").domEvent)(element, exports.EventType.FOCUS, true)(onFocus, null, this.disposables);
954
+ (0, _get__("event_1").domEvent)(element, exports.EventType.BLUR, true)(onBlur, null, this.disposables);
955
+ }
956
+ dispose() {
957
+ this.disposables = (0, _get__("lifecycle_1").dispose)(this.disposables);
958
+ this._onDidFocus.dispose();
959
+ this._onDidBlur.dispose();
960
+ }
961
+ }
962
+ function trackFocus(element) {
963
+ return new (_get__("FocusTracker"))(element);
964
+ }
965
+ exports.trackFocus = _get__("trackFocus");
966
+ function append(parent, ...children) {
967
+ children.forEach(child => parent.appendChild(child));
968
+ return children[children.length - 1];
969
+ }
970
+ exports.append = _get__("append");
971
+ function prepend(parent, child) {
972
+ parent.insertBefore(child, parent.firstChild);
973
+ return child;
974
+ }
975
+ exports.prepend = _get__("prepend");
976
+ const SELECTOR_REGEX = /([\w\\-]+)?(#([\w\\-]+))?((.([\w\\-]+))*)/;
977
+ function $(description, attrs, ...children) {
978
+ const match = _get__("SELECTOR_REGEX").exec(description);
979
+ if (!match) {
980
+ throw new Error('Bad use of emmet');
981
+ }
982
+ const result = document.createElement(match[1] || 'div');
983
+ if (match[3]) {
984
+ result.id = match[3];
985
+ }
986
+ if (match[4]) {
987
+ result.className = match[4].replace(/\./g, ' ').trim();
988
+ }
989
+ attrs = attrs || {};
990
+ Object.keys(attrs).forEach(name => {
991
+ const value = attrs[name];
992
+ if (/^on\w+$/.test(name)) {
993
+ result[name] = value;
994
+ } else if (name === 'selected') {
995
+ if (value) {
996
+ result.setAttribute(name, 'true');
997
+ }
998
+ } else {
999
+ result.setAttribute(name, value);
1000
+ }
1001
+ });
1002
+ (0, _get__("arrays_1").coalesce)(children).forEach(child => {
1003
+ if (child instanceof Node) {
1004
+ result.appendChild(child);
1005
+ } else {
1006
+ result.appendChild(document.createTextNode(child));
1007
+ }
1008
+ });
1009
+ return result;
1010
+ }
1011
+ exports.$ = _get__("$");
1012
+ function join(nodes, separator) {
1013
+ const result = [];
1014
+ nodes.forEach((node, index) => {
1015
+ if (index > 0) {
1016
+ if (separator instanceof Node) {
1017
+ result.push(separator.cloneNode());
1018
+ } else {
1019
+ result.push(document.createTextNode(separator));
1020
+ }
1021
+ }
1022
+ result.push(node);
1023
+ });
1024
+ return result;
1025
+ }
1026
+ exports.join = _get__("join");
1027
+ function show(...elements) {
1028
+ for (const element of elements) {
1029
+ if (element) {
1030
+ element.style.display = '';
1031
+ element.removeAttribute('aria-hidden');
1032
+ }
1033
+ }
1034
+ }
1035
+ exports.show = _get__("show");
1036
+ function hide(...elements) {
1037
+ for (const element of elements) {
1038
+ if (element) {
1039
+ element.style.display = 'none';
1040
+ element.setAttribute('aria-hidden', 'true');
1041
+ }
1042
+ }
1043
+ }
1044
+ exports.hide = _get__("hide");
1045
+ function findParentWithAttribute(node, attribute) {
1046
+ while (node) {
1047
+ if (node instanceof HTMLElement && node.hasAttribute(attribute)) {
1048
+ return node;
1049
+ }
1050
+ node = node.parentNode;
1051
+ }
1052
+ return null;
1053
+ }
1054
+ function removeTabIndexAndUpdateFocus(node) {
1055
+ if (!node || !node.hasAttribute('tabIndex')) {
1056
+ return;
1057
+ }
1058
+ // If we are the currently focused element and tabIndex is removed,
1059
+ // standard DOM behavior is to move focus to the <body> element. We
1060
+ // typically never want that, rather put focus to the closest element
1061
+ // in the hierarchy of the parent DOM nodes.
1062
+ if (document.activeElement === node) {
1063
+ const parentFocusable = _get__("findParentWithAttribute")(node.parentElement, 'tabIndex');
1064
+ if (parentFocusable) {
1065
+ parentFocusable.focus();
1066
+ }
1067
+ }
1068
+ node.removeAttribute('tabindex');
1069
+ }
1070
+ exports.removeTabIndexAndUpdateFocus = _get__("removeTabIndexAndUpdateFocus");
1071
+ function getElementsByTagName(tag) {
1072
+ return Array.prototype.slice.call(document.getElementsByTagName(tag), 0);
1073
+ }
1074
+ exports.getElementsByTagName = _get__("getElementsByTagName");
1075
+ function finalHandler(fn) {
1076
+ return e => {
1077
+ e.preventDefault();
1078
+ e.stopPropagation();
1079
+ fn(e);
1080
+ };
1081
+ }
1082
+ exports.finalHandler = _get__("finalHandler");
1083
+ function domContentLoaded() {
1084
+ return new Promise(resolve => {
1085
+ const readyState = document.readyState;
1086
+ if (readyState === 'complete' || document && document.body !== null) {
1087
+ _get__("platform").setImmediate(resolve);
1088
+ } else {
1089
+ window.addEventListener('DOMContentLoaded', resolve, false);
1090
+ }
1091
+ });
1092
+ }
1093
+ exports.domContentLoaded = _get__("domContentLoaded");
1094
+ /**
1095
+ * Find a value usable for a dom node size such that the likelihood that it would be
1096
+ * displayed with constant screen pixels size is as high as possible.
1097
+ *
1098
+ * e.g. We would desire for the cursors to be 2px (CSS px) wide. Under a devicePixelRatio
1099
+ * of 1.25, the cursor will be 2.5 screen pixels wide. Depending on how the dom node aligns/"snaps"
1100
+ * with the screen pixels, it will sometimes be rendered with 2 screen pixels, and sometimes with 3 screen pixels.
1101
+ */
1102
+ function computeScreenAwareSize(cssPx) {
1103
+ const screenPx = window.devicePixelRatio * cssPx;
1104
+ return Math.max(1, Math.floor(screenPx)) / window.devicePixelRatio;
1105
+ }
1106
+ exports.computeScreenAwareSize = _get__("computeScreenAwareSize");
1107
+ /**
1108
+ * See https://github.com/Microsoft/monaco-editor/issues/601
1109
+ * To protect against malicious code in the linked site, particularly phishing attempts,
1110
+ * the window.opener should be set to null to prevent the linked site from having access
1111
+ * to change the location of the current page.
1112
+ * See https://mathiasbynens.github.io/rel-noopener/
1113
+ */
1114
+ function windowOpenNoOpener(url) {
1115
+ if (_get__("platform").isNative || _get__("browser").isEdgeWebView) {
1116
+ // In VSCode, window.open() always returns null...
1117
+ // The same is true for a WebView (see https://github.com/Microsoft/monaco-editor/issues/628)
1118
+ window.open(url);
1119
+ } else {
1120
+ const newTab = window.open();
1121
+ if (newTab) {
1122
+ newTab.opener = null;
1123
+ newTab.location.href = url;
1124
+ }
1125
+ }
1126
+ }
1127
+ exports.windowOpenNoOpener = _get__("windowOpenNoOpener");
1128
+ function animate(fn) {
1129
+ const step = () => {
1130
+ fn();
1131
+ stepDisposable = (0, exports.scheduleAtNextAnimationFrame)(step);
1132
+ };
1133
+ let stepDisposable = (0, exports.scheduleAtNextAnimationFrame)(step);
1134
+ return (0, _get__("lifecycle_1").toDisposable)(() => stepDisposable.dispose());
1135
+ }
1136
+ exports.animate = _get__("animate");
1137
+ function _getGlobalObject() {
1138
+ try {
1139
+ if (!!global) {
1140
+ return global;
1141
+ }
1142
+ } catch (e) {
1143
+ try {
1144
+ if (!!window) {
1145
+ return window;
1146
+ }
1147
+ } catch (e) {
1148
+ return this;
1149
+ }
1150
+ }
1151
+ }
1152
+ ;
1153
+ var _RewireModuleId__ = null;
1154
+ function _getRewireModuleId__() {
1155
+ if (_RewireModuleId__ === null) {
1156
+ let globalVariable = _getGlobalObject();
1157
+ if (!globalVariable.__$$GLOBAL_REWIRE_NEXT_MODULE_ID__) {
1158
+ globalVariable.__$$GLOBAL_REWIRE_NEXT_MODULE_ID__ = 0;
1159
+ }
1160
+ _RewireModuleId__ = __$$GLOBAL_REWIRE_NEXT_MODULE_ID__++;
1161
+ }
1162
+ return _RewireModuleId__;
1163
+ }
1164
+ function _getRewireRegistry__() {
1165
+ let theGlobalVariable = _getGlobalObject();
1166
+ if (!theGlobalVariable.__$$GLOBAL_REWIRE_REGISTRY__) {
1167
+ theGlobalVariable.__$$GLOBAL_REWIRE_REGISTRY__ = Object.create(null);
1168
+ }
1169
+ return theGlobalVariable.__$$GLOBAL_REWIRE_REGISTRY__;
1170
+ }
1171
+ function _getRewiredData__() {
1172
+ let moduleId = _getRewireModuleId__();
1173
+ let registry = _getRewireRegistry__();
1174
+ let rewireData = registry[moduleId];
1175
+ if (!rewireData) {
1176
+ registry[moduleId] = Object.create(null);
1177
+ rewireData = registry[moduleId];
1178
+ }
1179
+ return rewireData;
1180
+ }
1181
+ (function registerResetAll() {
1182
+ let theGlobalVariable = _getGlobalObject();
1183
+ if (!theGlobalVariable['__rewire_reset_all__']) {
1184
+ theGlobalVariable['__rewire_reset_all__'] = function () {
1185
+ theGlobalVariable.__$$GLOBAL_REWIRE_REGISTRY__ = Object.create(null);
1186
+ };
1187
+ }
1188
+ })();
1189
+ var INTENTIONAL_UNDEFINED = '__INTENTIONAL_UNDEFINED__';
1190
+ let _RewireAPI__ = {};
1191
+ (function () {
1192
+ function addPropertyToAPIObject(name, value) {
1193
+ Object.defineProperty(_RewireAPI__, name, {
1194
+ value: value,
1195
+ enumerable: false,
1196
+ configurable: true
1197
+ });
1198
+ }
1199
+ addPropertyToAPIObject('__get__', _get__);
1200
+ addPropertyToAPIObject('__GetDependency__', _get__);
1201
+ addPropertyToAPIObject('__Rewire__', _set__);
1202
+ addPropertyToAPIObject('__set__', _set__);
1203
+ addPropertyToAPIObject('__reset__', _reset__);
1204
+ addPropertyToAPIObject('__ResetDependency__', _reset__);
1205
+ addPropertyToAPIObject('__with__', _with__);
1206
+ })();
1207
+ function _get__(variableName) {
1208
+ let rewireData = _getRewiredData__();
1209
+ if (rewireData[variableName] === undefined) {
1210
+ return _get_original__(variableName);
1211
+ } else {
1212
+ var value = rewireData[variableName];
1213
+ if (value === INTENTIONAL_UNDEFINED) {
1214
+ return undefined;
1215
+ } else {
1216
+ return value;
1217
+ }
1218
+ }
1219
+ }
1220
+ function _get_original__(variableName) {
1221
+ switch (variableName) {
1222
+ case "__createBinding":
1223
+ return __createBinding;
1224
+ case "__setModuleDefault":
1225
+ return __setModuleDefault;
1226
+ case "__importStar":
1227
+ return __importStar;
1228
+ case "clearNode":
1229
+ return clearNode;
1230
+ case "removeNode":
1231
+ return removeNode;
1232
+ case "isInDOM":
1233
+ return isInDOM;
1234
+ case "addDisposableListener":
1235
+ return addDisposableListener;
1236
+ case "keyboardEvent_1":
1237
+ return keyboardEvent_1;
1238
+ case "ModifierKeyEmitter":
1239
+ return ModifierKeyEmitter;
1240
+ case "event_2":
1241
+ return event_2;
1242
+ case "browser":
1243
+ return browser;
1244
+ case "_manualClassList":
1245
+ return _manualClassList;
1246
+ case "_nativeClassList":
1247
+ return _nativeClassList;
1248
+ case "_classList":
1249
+ return _classList;
1250
+ case "DomListener":
1251
+ return DomListener;
1252
+ case "mouseEvent_1":
1253
+ return mouseEvent_1;
1254
+ case "_wrapAsStandardMouseEvent":
1255
+ return _wrapAsStandardMouseEvent;
1256
+ case "_wrapAsStandardKeyboardEvent":
1257
+ return _wrapAsStandardKeyboardEvent;
1258
+ case "addStandardDisposableListener":
1259
+ return addStandardDisposableListener;
1260
+ case "addDisposableNonBubblingMouseOutListener":
1261
+ return addDisposableNonBubblingMouseOutListener;
1262
+ case "_animationFrame":
1263
+ return _animationFrame;
1264
+ case "AnimationFrameQueueItem":
1265
+ return AnimationFrameQueueItem;
1266
+ case "doRequestAnimationFrame":
1267
+ return doRequestAnimationFrame;
1268
+ case "measure":
1269
+ return measure;
1270
+ case "modify":
1271
+ return modify;
1272
+ case "DEFAULT_EVENT_MERGER":
1273
+ return DEFAULT_EVENT_MERGER;
1274
+ case "MINIMUM_TIME_MS":
1275
+ return MINIMUM_TIME_MS;
1276
+ case "async_1":
1277
+ return async_1;
1278
+ case "lifecycle_1":
1279
+ return lifecycle_1;
1280
+ case "TimeoutThrottledDomListener":
1281
+ return TimeoutThrottledDomListener;
1282
+ case "addDisposableThrottledListener":
1283
+ return addDisposableThrottledListener;
1284
+ case "getComputedStyle":
1285
+ return getComputedStyle;
1286
+ case "convertToPixels":
1287
+ return convertToPixels;
1288
+ case "Dimension":
1289
+ return Dimension;
1290
+ case "getClientArea":
1291
+ return getClientArea;
1292
+ case "getDomNodeZoomLevel":
1293
+ return getDomNodeZoomLevel;
1294
+ case "getDimension":
1295
+ return getDimension;
1296
+ case "sizeUtils":
1297
+ return sizeUtils;
1298
+ case "getTopLeftOffset":
1299
+ return getTopLeftOffset;
1300
+ case "size":
1301
+ return size;
1302
+ case "position":
1303
+ return position;
1304
+ case "getDomNodePagePosition":
1305
+ return getDomNodePagePosition;
1306
+ case "getTotalWidth":
1307
+ return getTotalWidth;
1308
+ case "getContentWidth":
1309
+ return getContentWidth;
1310
+ case "getTotalScrollWidth":
1311
+ return getTotalScrollWidth;
1312
+ case "getContentHeight":
1313
+ return getContentHeight;
1314
+ case "getTotalHeight":
1315
+ return getTotalHeight;
1316
+ case "getRelativeLeft":
1317
+ return getRelativeLeft;
1318
+ case "getLargestChildWidth":
1319
+ return getLargestChildWidth;
1320
+ case "isAncestor":
1321
+ return isAncestor;
1322
+ case "findParentWithClass":
1323
+ return findParentWithClass;
1324
+ case "createStyleSheet":
1325
+ return createStyleSheet;
1326
+ case "_sharedStyleSheet":
1327
+ return _sharedStyleSheet;
1328
+ case "getSharedStyleSheet":
1329
+ return getSharedStyleSheet;
1330
+ case "createCSSRule":
1331
+ return createCSSRule;
1332
+ case "getDynamicStyleSheetRules":
1333
+ return getDynamicStyleSheetRules;
1334
+ case "removeCSSRulesContainingSelector":
1335
+ return removeCSSRulesContainingSelector;
1336
+ case "isHTMLElement":
1337
+ return isHTMLElement;
1338
+ case "saveParentsScrollTop":
1339
+ return saveParentsScrollTop;
1340
+ case "restoreParentsScrollTop":
1341
+ return restoreParentsScrollTop;
1342
+ case "event_1":
1343
+ return event_1;
1344
+ case "FocusTracker":
1345
+ return FocusTracker;
1346
+ case "trackFocus":
1347
+ return trackFocus;
1348
+ case "append":
1349
+ return append;
1350
+ case "prepend":
1351
+ return prepend;
1352
+ case "SELECTOR_REGEX":
1353
+ return SELECTOR_REGEX;
1354
+ case "arrays_1":
1355
+ return arrays_1;
1356
+ case "$":
1357
+ return $;
1358
+ case "join":
1359
+ return join;
1360
+ case "show":
1361
+ return show;
1362
+ case "hide":
1363
+ return hide;
1364
+ case "findParentWithAttribute":
1365
+ return findParentWithAttribute;
1366
+ case "removeTabIndexAndUpdateFocus":
1367
+ return removeTabIndexAndUpdateFocus;
1368
+ case "getElementsByTagName":
1369
+ return getElementsByTagName;
1370
+ case "finalHandler":
1371
+ return finalHandler;
1372
+ case "platform":
1373
+ return platform;
1374
+ case "domContentLoaded":
1375
+ return domContentLoaded;
1376
+ case "computeScreenAwareSize":
1377
+ return computeScreenAwareSize;
1378
+ case "windowOpenNoOpener":
1379
+ return windowOpenNoOpener;
1380
+ case "animate":
1381
+ return animate;
1382
+ }
1383
+ return undefined;
1384
+ }
1385
+ function _assign__(variableName, value) {
1386
+ let rewireData = _getRewiredData__();
1387
+ if (rewireData[variableName] === undefined) {
1388
+ return _set_original__(variableName, value);
1389
+ } else {
1390
+ return rewireData[variableName] = value;
1391
+ }
1392
+ }
1393
+ function _set_original__(variableName, _value) {
1394
+ switch (variableName) {
1395
+ case "_animationFrame":
1396
+ return _animationFrame = _value;
1397
+ case "_sharedStyleSheet":
1398
+ return _sharedStyleSheet = _value;
1399
+ }
1400
+ return undefined;
1401
+ }
1402
+ function _update_operation__(operation, variableName, prefix) {
1403
+ var oldValue = _get__(variableName);
1404
+ var newValue = operation === '++' ? oldValue + 1 : oldValue - 1;
1405
+ _assign__(variableName, newValue);
1406
+ return prefix ? newValue : oldValue;
1407
+ }
1408
+ function _set__(variableName, value) {
1409
+ let rewireData = _getRewiredData__();
1410
+ if (typeof variableName === 'object') {
1411
+ Object.keys(variableName).forEach(function (name) {
1412
+ rewireData[name] = variableName[name];
1413
+ });
1414
+ return function () {
1415
+ Object.keys(variableName).forEach(function (name) {
1416
+ _reset__(variableName);
1417
+ });
1418
+ };
1419
+ } else {
1420
+ if (value === undefined) {
1421
+ rewireData[variableName] = INTENTIONAL_UNDEFINED;
1422
+ } else {
1423
+ rewireData[variableName] = value;
1424
+ }
1425
+ return function () {
1426
+ _reset__(variableName);
1427
+ };
1428
+ }
1429
+ }
1430
+ function _reset__(variableName) {
1431
+ let rewireData = _getRewiredData__();
1432
+ delete rewireData[variableName];
1433
+ if (Object.keys(rewireData).length == 0) {
1434
+ delete _getRewireRegistry__()[_getRewireModuleId__];
1435
+ }
1436
+ ;
1437
+ }
1438
+ function _with__(object) {
1439
+ let rewireData = _getRewiredData__();
1440
+ var rewiredVariableNames = Object.keys(object);
1441
+ var previousValues = {};
1442
+ function reset() {
1443
+ rewiredVariableNames.forEach(function (variableName) {
1444
+ rewireData[variableName] = previousValues[variableName];
1445
+ });
1446
+ }
1447
+ return function (callback) {
1448
+ rewiredVariableNames.forEach(function (variableName) {
1449
+ previousValues[variableName] = rewireData[variableName];
1450
+ rewireData[variableName] = object[variableName];
1451
+ });
1452
+ let result = callback();
1453
+ if (!!result && typeof result.then == 'function') {
1454
+ result.then(reset).catch(reset);
1455
+ } else {
1456
+ reset();
1457
+ }
1458
+ return result;
1459
+ };
1460
+ }
1461
+ let _typeOfOriginalExport = typeof module.exports;
1462
+ function addNonEnumerableProperty(name, value) {
1463
+ Object.defineProperty(module.exports, name, {
1464
+ value: value,
1465
+ enumerable: false,
1466
+ configurable: true
1467
+ });
1468
+ }
1469
+ if ((_typeOfOriginalExport === 'object' || _typeOfOriginalExport === 'function') && Object.isExtensible(module.exports)) {
1470
+ addNonEnumerableProperty('__get__', _get__);
1471
+ addNonEnumerableProperty('__GetDependency__', _get__);
1472
+ addNonEnumerableProperty('__Rewire__', _set__);
1473
+ addNonEnumerableProperty('__set__', _set__);
1474
+ addNonEnumerableProperty('__reset__', _reset__);
1475
+ addNonEnumerableProperty('__ResetDependency__', _reset__);
1476
+ addNonEnumerableProperty('__with__', _with__);
1477
+ addNonEnumerableProperty('__RewireAPI__', _RewireAPI__);
1478
+ }