@nsshunt/stsvueutils 1.0.89 → 1.0.91
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.
- package/dist/stsvueutils.mjs +31 -3423
- package/dist/stsvueutils.mjs.map +1 -1
- package/dist/stsvueutils.umd.js +43 -3435
- package/dist/stsvueutils.umd.js.map +1 -1
- package/package.json +1 -1
- package/types/plugins/workerManager.d.ts.map +1 -1
package/dist/stsvueutils.mjs
CHANGED
|
@@ -37,13 +37,12 @@ var __privateMethod = (obj, member, method) => {
|
|
|
37
37
|
var _store, _storage, _workersEx, _runner, _workerId, _options, _STSInstrumentController, _app, _CreateRunnerCopy, CreateRunnerCopy_fn, _SetRunnerIntoWorker, _ProcessTelemetry, _CreateAsyncRunner, _PostMessageToWorker, _TerminateWorker, _StopRunner, _StopWorker, _requestResponseMessages, _requestResponseMessageTimeout, _port, _SetupListener, _collectorCollectorPort, _requestResponseHelper, _runners, _options2, _SetMessagePort, _AddAsyncRunner, _StopRunners;
|
|
38
38
|
import { inject } from "vue";
|
|
39
39
|
import debugModule from "debug";
|
|
40
|
+
import { STSInstrumentControllerPluginKey, GetSTSInstrumentController, Gauge, GetSTSInstrumentControllerPluginKey } from "@nsshunt/stsobservability";
|
|
40
41
|
import { ModelDelimeter, Sleep } from "@nsshunt/stsutils";
|
|
41
|
-
import "socket.io-client";
|
|
42
42
|
import { defineStore } from "pinia";
|
|
43
43
|
const STSStoragePluginKey = Symbol("storage");
|
|
44
44
|
const STSEmitterPluginKey = Symbol("emitter");
|
|
45
45
|
const STSWorkerManagerPluginKey = Symbol("workerManager");
|
|
46
|
-
var commonjsGlobal$1 = typeof globalThis !== "undefined" ? globalThis : typeof window !== "undefined" ? window : typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : {};
|
|
47
46
|
function getDefaultExportFromCjs(x) {
|
|
48
47
|
return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, "default") ? x["default"] : x;
|
|
49
48
|
}
|
|
@@ -60,9 +59,9 @@ E.prototype = {
|
|
|
60
59
|
return this;
|
|
61
60
|
},
|
|
62
61
|
once: function(name, callback, ctx) {
|
|
63
|
-
var
|
|
62
|
+
var self = this;
|
|
64
63
|
function listener() {
|
|
65
|
-
|
|
64
|
+
self.off(name, listener);
|
|
66
65
|
callback.apply(ctx, arguments);
|
|
67
66
|
}
|
|
68
67
|
listener._ = callback;
|
|
@@ -352,3402 +351,6 @@ var eIWMessageCommands = /* @__PURE__ */ ((eIWMessageCommands2) => {
|
|
|
352
351
|
eIWMessageCommands2["StopAllAsyncRunners"] = "__STS__StopAllAsyncRunners";
|
|
353
352
|
return eIWMessageCommands2;
|
|
354
353
|
})(eIWMessageCommands || {});
|
|
355
|
-
var lodash_clonedeep = { exports: {} };
|
|
356
|
-
lodash_clonedeep.exports;
|
|
357
|
-
(function(module, exports) {
|
|
358
|
-
var LARGE_ARRAY_SIZE = 200;
|
|
359
|
-
var HASH_UNDEFINED = "__lodash_hash_undefined__";
|
|
360
|
-
var MAX_SAFE_INTEGER = 9007199254740991;
|
|
361
|
-
var argsTag = "[object Arguments]", arrayTag = "[object Array]", boolTag = "[object Boolean]", dateTag = "[object Date]", errorTag = "[object Error]", funcTag = "[object Function]", genTag = "[object GeneratorFunction]", mapTag = "[object Map]", numberTag = "[object Number]", objectTag = "[object Object]", promiseTag = "[object Promise]", regexpTag = "[object RegExp]", setTag = "[object Set]", stringTag = "[object String]", symbolTag = "[object Symbol]", weakMapTag = "[object WeakMap]";
|
|
362
|
-
var arrayBufferTag = "[object ArrayBuffer]", dataViewTag = "[object DataView]", float32Tag = "[object Float32Array]", float64Tag = "[object Float64Array]", int8Tag = "[object Int8Array]", int16Tag = "[object Int16Array]", int32Tag = "[object Int32Array]", uint8Tag = "[object Uint8Array]", uint8ClampedTag = "[object Uint8ClampedArray]", uint16Tag = "[object Uint16Array]", uint32Tag = "[object Uint32Array]";
|
|
363
|
-
var reRegExpChar = /[\\^$.*+?()[\]{}|]/g;
|
|
364
|
-
var reFlags = /\w*$/;
|
|
365
|
-
var reIsHostCtor = /^\[object .+?Constructor\]$/;
|
|
366
|
-
var reIsUint = /^(?:0|[1-9]\d*)$/;
|
|
367
|
-
var cloneableTags = {};
|
|
368
|
-
cloneableTags[argsTag] = cloneableTags[arrayTag] = cloneableTags[arrayBufferTag] = cloneableTags[dataViewTag] = cloneableTags[boolTag] = cloneableTags[dateTag] = cloneableTags[float32Tag] = cloneableTags[float64Tag] = cloneableTags[int8Tag] = cloneableTags[int16Tag] = cloneableTags[int32Tag] = cloneableTags[mapTag] = cloneableTags[numberTag] = cloneableTags[objectTag] = cloneableTags[regexpTag] = cloneableTags[setTag] = cloneableTags[stringTag] = cloneableTags[symbolTag] = cloneableTags[uint8Tag] = cloneableTags[uint8ClampedTag] = cloneableTags[uint16Tag] = cloneableTags[uint32Tag] = true;
|
|
369
|
-
cloneableTags[errorTag] = cloneableTags[funcTag] = cloneableTags[weakMapTag] = false;
|
|
370
|
-
var freeGlobal = typeof commonjsGlobal$1 == "object" && commonjsGlobal$1 && commonjsGlobal$1.Object === Object && commonjsGlobal$1;
|
|
371
|
-
var freeSelf = typeof self == "object" && self && self.Object === Object && self;
|
|
372
|
-
var root = freeGlobal || freeSelf || Function("return this")();
|
|
373
|
-
var freeExports = exports && !exports.nodeType && exports;
|
|
374
|
-
var freeModule = freeExports && true && module && !module.nodeType && module;
|
|
375
|
-
var moduleExports = freeModule && freeModule.exports === freeExports;
|
|
376
|
-
function addMapEntry(map, pair) {
|
|
377
|
-
map.set(pair[0], pair[1]);
|
|
378
|
-
return map;
|
|
379
|
-
}
|
|
380
|
-
function addSetEntry(set, value) {
|
|
381
|
-
set.add(value);
|
|
382
|
-
return set;
|
|
383
|
-
}
|
|
384
|
-
function arrayEach(array, iteratee) {
|
|
385
|
-
var index = -1, length = array ? array.length : 0;
|
|
386
|
-
while (++index < length) {
|
|
387
|
-
if (iteratee(array[index], index, array) === false) {
|
|
388
|
-
break;
|
|
389
|
-
}
|
|
390
|
-
}
|
|
391
|
-
return array;
|
|
392
|
-
}
|
|
393
|
-
function arrayPush(array, values) {
|
|
394
|
-
var index = -1, length = values.length, offset = array.length;
|
|
395
|
-
while (++index < length) {
|
|
396
|
-
array[offset + index] = values[index];
|
|
397
|
-
}
|
|
398
|
-
return array;
|
|
399
|
-
}
|
|
400
|
-
function arrayReduce(array, iteratee, accumulator, initAccum) {
|
|
401
|
-
var index = -1, length = array ? array.length : 0;
|
|
402
|
-
if (initAccum && length) {
|
|
403
|
-
accumulator = array[++index];
|
|
404
|
-
}
|
|
405
|
-
while (++index < length) {
|
|
406
|
-
accumulator = iteratee(accumulator, array[index], index, array);
|
|
407
|
-
}
|
|
408
|
-
return accumulator;
|
|
409
|
-
}
|
|
410
|
-
function baseTimes(n, iteratee) {
|
|
411
|
-
var index = -1, result = Array(n);
|
|
412
|
-
while (++index < n) {
|
|
413
|
-
result[index] = iteratee(index);
|
|
414
|
-
}
|
|
415
|
-
return result;
|
|
416
|
-
}
|
|
417
|
-
function getValue(object, key) {
|
|
418
|
-
return object == null ? void 0 : object[key];
|
|
419
|
-
}
|
|
420
|
-
function isHostObject(value) {
|
|
421
|
-
var result = false;
|
|
422
|
-
if (value != null && typeof value.toString != "function") {
|
|
423
|
-
try {
|
|
424
|
-
result = !!(value + "");
|
|
425
|
-
} catch (e) {
|
|
426
|
-
}
|
|
427
|
-
}
|
|
428
|
-
return result;
|
|
429
|
-
}
|
|
430
|
-
function mapToArray(map) {
|
|
431
|
-
var index = -1, result = Array(map.size);
|
|
432
|
-
map.forEach(function(value, key) {
|
|
433
|
-
result[++index] = [key, value];
|
|
434
|
-
});
|
|
435
|
-
return result;
|
|
436
|
-
}
|
|
437
|
-
function overArg(func, transform) {
|
|
438
|
-
return function(arg) {
|
|
439
|
-
return func(transform(arg));
|
|
440
|
-
};
|
|
441
|
-
}
|
|
442
|
-
function setToArray(set) {
|
|
443
|
-
var index = -1, result = Array(set.size);
|
|
444
|
-
set.forEach(function(value) {
|
|
445
|
-
result[++index] = value;
|
|
446
|
-
});
|
|
447
|
-
return result;
|
|
448
|
-
}
|
|
449
|
-
var arrayProto = Array.prototype, funcProto = Function.prototype, objectProto = Object.prototype;
|
|
450
|
-
var coreJsData = root["__core-js_shared__"];
|
|
451
|
-
var maskSrcKey = function() {
|
|
452
|
-
var uid = /[^.]+$/.exec(coreJsData && coreJsData.keys && coreJsData.keys.IE_PROTO || "");
|
|
453
|
-
return uid ? "Symbol(src)_1." + uid : "";
|
|
454
|
-
}();
|
|
455
|
-
var funcToString = funcProto.toString;
|
|
456
|
-
var hasOwnProperty = objectProto.hasOwnProperty;
|
|
457
|
-
var objectToString = objectProto.toString;
|
|
458
|
-
var reIsNative = RegExp(
|
|
459
|
-
"^" + funcToString.call(hasOwnProperty).replace(reRegExpChar, "\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, "$1.*?") + "$"
|
|
460
|
-
);
|
|
461
|
-
var Buffer2 = moduleExports ? root.Buffer : void 0, Symbol2 = root.Symbol, Uint8Array2 = root.Uint8Array, getPrototype = overArg(Object.getPrototypeOf, Object), objectCreate = Object.create, propertyIsEnumerable = objectProto.propertyIsEnumerable, splice = arrayProto.splice;
|
|
462
|
-
var nativeGetSymbols = Object.getOwnPropertySymbols, nativeIsBuffer = Buffer2 ? Buffer2.isBuffer : void 0, nativeKeys = overArg(Object.keys, Object);
|
|
463
|
-
var DataView2 = getNative(root, "DataView"), Map2 = getNative(root, "Map"), Promise2 = getNative(root, "Promise"), Set = getNative(root, "Set"), WeakMap2 = getNative(root, "WeakMap"), nativeCreate = getNative(Object, "create");
|
|
464
|
-
var dataViewCtorString = toSource(DataView2), mapCtorString = toSource(Map2), promiseCtorString = toSource(Promise2), setCtorString = toSource(Set), weakMapCtorString = toSource(WeakMap2);
|
|
465
|
-
var symbolProto = Symbol2 ? Symbol2.prototype : void 0, symbolValueOf = symbolProto ? symbolProto.valueOf : void 0;
|
|
466
|
-
function Hash(entries) {
|
|
467
|
-
var index = -1, length = entries ? entries.length : 0;
|
|
468
|
-
this.clear();
|
|
469
|
-
while (++index < length) {
|
|
470
|
-
var entry = entries[index];
|
|
471
|
-
this.set(entry[0], entry[1]);
|
|
472
|
-
}
|
|
473
|
-
}
|
|
474
|
-
function hashClear() {
|
|
475
|
-
this.__data__ = nativeCreate ? nativeCreate(null) : {};
|
|
476
|
-
}
|
|
477
|
-
function hashDelete(key) {
|
|
478
|
-
return this.has(key) && delete this.__data__[key];
|
|
479
|
-
}
|
|
480
|
-
function hashGet(key) {
|
|
481
|
-
var data = this.__data__;
|
|
482
|
-
if (nativeCreate) {
|
|
483
|
-
var result = data[key];
|
|
484
|
-
return result === HASH_UNDEFINED ? void 0 : result;
|
|
485
|
-
}
|
|
486
|
-
return hasOwnProperty.call(data, key) ? data[key] : void 0;
|
|
487
|
-
}
|
|
488
|
-
function hashHas(key) {
|
|
489
|
-
var data = this.__data__;
|
|
490
|
-
return nativeCreate ? data[key] !== void 0 : hasOwnProperty.call(data, key);
|
|
491
|
-
}
|
|
492
|
-
function hashSet(key, value) {
|
|
493
|
-
var data = this.__data__;
|
|
494
|
-
data[key] = nativeCreate && value === void 0 ? HASH_UNDEFINED : value;
|
|
495
|
-
return this;
|
|
496
|
-
}
|
|
497
|
-
Hash.prototype.clear = hashClear;
|
|
498
|
-
Hash.prototype["delete"] = hashDelete;
|
|
499
|
-
Hash.prototype.get = hashGet;
|
|
500
|
-
Hash.prototype.has = hashHas;
|
|
501
|
-
Hash.prototype.set = hashSet;
|
|
502
|
-
function ListCache(entries) {
|
|
503
|
-
var index = -1, length = entries ? entries.length : 0;
|
|
504
|
-
this.clear();
|
|
505
|
-
while (++index < length) {
|
|
506
|
-
var entry = entries[index];
|
|
507
|
-
this.set(entry[0], entry[1]);
|
|
508
|
-
}
|
|
509
|
-
}
|
|
510
|
-
function listCacheClear() {
|
|
511
|
-
this.__data__ = [];
|
|
512
|
-
}
|
|
513
|
-
function listCacheDelete(key) {
|
|
514
|
-
var data = this.__data__, index = assocIndexOf(data, key);
|
|
515
|
-
if (index < 0) {
|
|
516
|
-
return false;
|
|
517
|
-
}
|
|
518
|
-
var lastIndex = data.length - 1;
|
|
519
|
-
if (index == lastIndex) {
|
|
520
|
-
data.pop();
|
|
521
|
-
} else {
|
|
522
|
-
splice.call(data, index, 1);
|
|
523
|
-
}
|
|
524
|
-
return true;
|
|
525
|
-
}
|
|
526
|
-
function listCacheGet(key) {
|
|
527
|
-
var data = this.__data__, index = assocIndexOf(data, key);
|
|
528
|
-
return index < 0 ? void 0 : data[index][1];
|
|
529
|
-
}
|
|
530
|
-
function listCacheHas(key) {
|
|
531
|
-
return assocIndexOf(this.__data__, key) > -1;
|
|
532
|
-
}
|
|
533
|
-
function listCacheSet(key, value) {
|
|
534
|
-
var data = this.__data__, index = assocIndexOf(data, key);
|
|
535
|
-
if (index < 0) {
|
|
536
|
-
data.push([key, value]);
|
|
537
|
-
} else {
|
|
538
|
-
data[index][1] = value;
|
|
539
|
-
}
|
|
540
|
-
return this;
|
|
541
|
-
}
|
|
542
|
-
ListCache.prototype.clear = listCacheClear;
|
|
543
|
-
ListCache.prototype["delete"] = listCacheDelete;
|
|
544
|
-
ListCache.prototype.get = listCacheGet;
|
|
545
|
-
ListCache.prototype.has = listCacheHas;
|
|
546
|
-
ListCache.prototype.set = listCacheSet;
|
|
547
|
-
function MapCache(entries) {
|
|
548
|
-
var index = -1, length = entries ? entries.length : 0;
|
|
549
|
-
this.clear();
|
|
550
|
-
while (++index < length) {
|
|
551
|
-
var entry = entries[index];
|
|
552
|
-
this.set(entry[0], entry[1]);
|
|
553
|
-
}
|
|
554
|
-
}
|
|
555
|
-
function mapCacheClear() {
|
|
556
|
-
this.__data__ = {
|
|
557
|
-
"hash": new Hash(),
|
|
558
|
-
"map": new (Map2 || ListCache)(),
|
|
559
|
-
"string": new Hash()
|
|
560
|
-
};
|
|
561
|
-
}
|
|
562
|
-
function mapCacheDelete(key) {
|
|
563
|
-
return getMapData(this, key)["delete"](key);
|
|
564
|
-
}
|
|
565
|
-
function mapCacheGet(key) {
|
|
566
|
-
return getMapData(this, key).get(key);
|
|
567
|
-
}
|
|
568
|
-
function mapCacheHas(key) {
|
|
569
|
-
return getMapData(this, key).has(key);
|
|
570
|
-
}
|
|
571
|
-
function mapCacheSet(key, value) {
|
|
572
|
-
getMapData(this, key).set(key, value);
|
|
573
|
-
return this;
|
|
574
|
-
}
|
|
575
|
-
MapCache.prototype.clear = mapCacheClear;
|
|
576
|
-
MapCache.prototype["delete"] = mapCacheDelete;
|
|
577
|
-
MapCache.prototype.get = mapCacheGet;
|
|
578
|
-
MapCache.prototype.has = mapCacheHas;
|
|
579
|
-
MapCache.prototype.set = mapCacheSet;
|
|
580
|
-
function Stack(entries) {
|
|
581
|
-
this.__data__ = new ListCache(entries);
|
|
582
|
-
}
|
|
583
|
-
function stackClear() {
|
|
584
|
-
this.__data__ = new ListCache();
|
|
585
|
-
}
|
|
586
|
-
function stackDelete(key) {
|
|
587
|
-
return this.__data__["delete"](key);
|
|
588
|
-
}
|
|
589
|
-
function stackGet(key) {
|
|
590
|
-
return this.__data__.get(key);
|
|
591
|
-
}
|
|
592
|
-
function stackHas(key) {
|
|
593
|
-
return this.__data__.has(key);
|
|
594
|
-
}
|
|
595
|
-
function stackSet(key, value) {
|
|
596
|
-
var cache = this.__data__;
|
|
597
|
-
if (cache instanceof ListCache) {
|
|
598
|
-
var pairs = cache.__data__;
|
|
599
|
-
if (!Map2 || pairs.length < LARGE_ARRAY_SIZE - 1) {
|
|
600
|
-
pairs.push([key, value]);
|
|
601
|
-
return this;
|
|
602
|
-
}
|
|
603
|
-
cache = this.__data__ = new MapCache(pairs);
|
|
604
|
-
}
|
|
605
|
-
cache.set(key, value);
|
|
606
|
-
return this;
|
|
607
|
-
}
|
|
608
|
-
Stack.prototype.clear = stackClear;
|
|
609
|
-
Stack.prototype["delete"] = stackDelete;
|
|
610
|
-
Stack.prototype.get = stackGet;
|
|
611
|
-
Stack.prototype.has = stackHas;
|
|
612
|
-
Stack.prototype.set = stackSet;
|
|
613
|
-
function arrayLikeKeys(value, inherited) {
|
|
614
|
-
var result = isArray2(value) || isArguments(value) ? baseTimes(value.length, String) : [];
|
|
615
|
-
var length = result.length, skipIndexes = !!length;
|
|
616
|
-
for (var key in value) {
|
|
617
|
-
if ((inherited || hasOwnProperty.call(value, key)) && !(skipIndexes && (key == "length" || isIndex(key, length)))) {
|
|
618
|
-
result.push(key);
|
|
619
|
-
}
|
|
620
|
-
}
|
|
621
|
-
return result;
|
|
622
|
-
}
|
|
623
|
-
function assignValue(object, key, value) {
|
|
624
|
-
var objValue = object[key];
|
|
625
|
-
if (!(hasOwnProperty.call(object, key) && eq(objValue, value)) || value === void 0 && !(key in object)) {
|
|
626
|
-
object[key] = value;
|
|
627
|
-
}
|
|
628
|
-
}
|
|
629
|
-
function assocIndexOf(array, key) {
|
|
630
|
-
var length = array.length;
|
|
631
|
-
while (length--) {
|
|
632
|
-
if (eq(array[length][0], key)) {
|
|
633
|
-
return length;
|
|
634
|
-
}
|
|
635
|
-
}
|
|
636
|
-
return -1;
|
|
637
|
-
}
|
|
638
|
-
function baseAssign(object, source2) {
|
|
639
|
-
return object && copyObject(source2, keys(source2), object);
|
|
640
|
-
}
|
|
641
|
-
function baseClone(value, isDeep, isFull, customizer, key, object, stack) {
|
|
642
|
-
var result;
|
|
643
|
-
if (customizer) {
|
|
644
|
-
result = object ? customizer(value, key, object, stack) : customizer(value);
|
|
645
|
-
}
|
|
646
|
-
if (result !== void 0) {
|
|
647
|
-
return result;
|
|
648
|
-
}
|
|
649
|
-
if (!isObject(value)) {
|
|
650
|
-
return value;
|
|
651
|
-
}
|
|
652
|
-
var isArr = isArray2(value);
|
|
653
|
-
if (isArr) {
|
|
654
|
-
result = initCloneArray(value);
|
|
655
|
-
if (!isDeep) {
|
|
656
|
-
return copyArray(value, result);
|
|
657
|
-
}
|
|
658
|
-
} else {
|
|
659
|
-
var tag = getTag(value), isFunc = tag == funcTag || tag == genTag;
|
|
660
|
-
if (isBuffer(value)) {
|
|
661
|
-
return cloneBuffer(value, isDeep);
|
|
662
|
-
}
|
|
663
|
-
if (tag == objectTag || tag == argsTag || isFunc && !object) {
|
|
664
|
-
if (isHostObject(value)) {
|
|
665
|
-
return object ? value : {};
|
|
666
|
-
}
|
|
667
|
-
result = initCloneObject(isFunc ? {} : value);
|
|
668
|
-
if (!isDeep) {
|
|
669
|
-
return copySymbols(value, baseAssign(result, value));
|
|
670
|
-
}
|
|
671
|
-
} else {
|
|
672
|
-
if (!cloneableTags[tag]) {
|
|
673
|
-
return object ? value : {};
|
|
674
|
-
}
|
|
675
|
-
result = initCloneByTag(value, tag, baseClone, isDeep);
|
|
676
|
-
}
|
|
677
|
-
}
|
|
678
|
-
stack || (stack = new Stack());
|
|
679
|
-
var stacked = stack.get(value);
|
|
680
|
-
if (stacked) {
|
|
681
|
-
return stacked;
|
|
682
|
-
}
|
|
683
|
-
stack.set(value, result);
|
|
684
|
-
if (!isArr) {
|
|
685
|
-
var props = isFull ? getAllKeys(value) : keys(value);
|
|
686
|
-
}
|
|
687
|
-
arrayEach(props || value, function(subValue, key2) {
|
|
688
|
-
if (props) {
|
|
689
|
-
key2 = subValue;
|
|
690
|
-
subValue = value[key2];
|
|
691
|
-
}
|
|
692
|
-
assignValue(result, key2, baseClone(subValue, isDeep, isFull, customizer, key2, value, stack));
|
|
693
|
-
});
|
|
694
|
-
return result;
|
|
695
|
-
}
|
|
696
|
-
function baseCreate(proto2) {
|
|
697
|
-
return isObject(proto2) ? objectCreate(proto2) : {};
|
|
698
|
-
}
|
|
699
|
-
function baseGetAllKeys(object, keysFunc, symbolsFunc) {
|
|
700
|
-
var result = keysFunc(object);
|
|
701
|
-
return isArray2(object) ? result : arrayPush(result, symbolsFunc(object));
|
|
702
|
-
}
|
|
703
|
-
function baseGetTag(value) {
|
|
704
|
-
return objectToString.call(value);
|
|
705
|
-
}
|
|
706
|
-
function baseIsNative(value) {
|
|
707
|
-
if (!isObject(value) || isMasked(value)) {
|
|
708
|
-
return false;
|
|
709
|
-
}
|
|
710
|
-
var pattern = isFunction(value) || isHostObject(value) ? reIsNative : reIsHostCtor;
|
|
711
|
-
return pattern.test(toSource(value));
|
|
712
|
-
}
|
|
713
|
-
function baseKeys(object) {
|
|
714
|
-
if (!isPrototype(object)) {
|
|
715
|
-
return nativeKeys(object);
|
|
716
|
-
}
|
|
717
|
-
var result = [];
|
|
718
|
-
for (var key in Object(object)) {
|
|
719
|
-
if (hasOwnProperty.call(object, key) && key != "constructor") {
|
|
720
|
-
result.push(key);
|
|
721
|
-
}
|
|
722
|
-
}
|
|
723
|
-
return result;
|
|
724
|
-
}
|
|
725
|
-
function cloneBuffer(buffer, isDeep) {
|
|
726
|
-
if (isDeep) {
|
|
727
|
-
return buffer.slice();
|
|
728
|
-
}
|
|
729
|
-
var result = new buffer.constructor(buffer.length);
|
|
730
|
-
buffer.copy(result);
|
|
731
|
-
return result;
|
|
732
|
-
}
|
|
733
|
-
function cloneArrayBuffer(arrayBuffer) {
|
|
734
|
-
var result = new arrayBuffer.constructor(arrayBuffer.byteLength);
|
|
735
|
-
new Uint8Array2(result).set(new Uint8Array2(arrayBuffer));
|
|
736
|
-
return result;
|
|
737
|
-
}
|
|
738
|
-
function cloneDataView(dataView, isDeep) {
|
|
739
|
-
var buffer = isDeep ? cloneArrayBuffer(dataView.buffer) : dataView.buffer;
|
|
740
|
-
return new dataView.constructor(buffer, dataView.byteOffset, dataView.byteLength);
|
|
741
|
-
}
|
|
742
|
-
function cloneMap(map, isDeep, cloneFunc) {
|
|
743
|
-
var array = isDeep ? cloneFunc(mapToArray(map), true) : mapToArray(map);
|
|
744
|
-
return arrayReduce(array, addMapEntry, new map.constructor());
|
|
745
|
-
}
|
|
746
|
-
function cloneRegExp(regexp) {
|
|
747
|
-
var result = new regexp.constructor(regexp.source, reFlags.exec(regexp));
|
|
748
|
-
result.lastIndex = regexp.lastIndex;
|
|
749
|
-
return result;
|
|
750
|
-
}
|
|
751
|
-
function cloneSet(set, isDeep, cloneFunc) {
|
|
752
|
-
var array = isDeep ? cloneFunc(setToArray(set), true) : setToArray(set);
|
|
753
|
-
return arrayReduce(array, addSetEntry, new set.constructor());
|
|
754
|
-
}
|
|
755
|
-
function cloneSymbol(symbol) {
|
|
756
|
-
return symbolValueOf ? Object(symbolValueOf.call(symbol)) : {};
|
|
757
|
-
}
|
|
758
|
-
function cloneTypedArray(typedArray, isDeep) {
|
|
759
|
-
var buffer = isDeep ? cloneArrayBuffer(typedArray.buffer) : typedArray.buffer;
|
|
760
|
-
return new typedArray.constructor(buffer, typedArray.byteOffset, typedArray.length);
|
|
761
|
-
}
|
|
762
|
-
function copyArray(source2, array) {
|
|
763
|
-
var index = -1, length = source2.length;
|
|
764
|
-
array || (array = Array(length));
|
|
765
|
-
while (++index < length) {
|
|
766
|
-
array[index] = source2[index];
|
|
767
|
-
}
|
|
768
|
-
return array;
|
|
769
|
-
}
|
|
770
|
-
function copyObject(source2, props, object, customizer) {
|
|
771
|
-
object || (object = {});
|
|
772
|
-
var index = -1, length = props.length;
|
|
773
|
-
while (++index < length) {
|
|
774
|
-
var key = props[index];
|
|
775
|
-
var newValue = customizer ? customizer(object[key], source2[key], key, object, source2) : void 0;
|
|
776
|
-
assignValue(object, key, newValue === void 0 ? source2[key] : newValue);
|
|
777
|
-
}
|
|
778
|
-
return object;
|
|
779
|
-
}
|
|
780
|
-
function copySymbols(source2, object) {
|
|
781
|
-
return copyObject(source2, getSymbols(source2), object);
|
|
782
|
-
}
|
|
783
|
-
function getAllKeys(object) {
|
|
784
|
-
return baseGetAllKeys(object, keys, getSymbols);
|
|
785
|
-
}
|
|
786
|
-
function getMapData(map, key) {
|
|
787
|
-
var data = map.__data__;
|
|
788
|
-
return isKeyable(key) ? data[typeof key == "string" ? "string" : "hash"] : data.map;
|
|
789
|
-
}
|
|
790
|
-
function getNative(object, key) {
|
|
791
|
-
var value = getValue(object, key);
|
|
792
|
-
return baseIsNative(value) ? value : void 0;
|
|
793
|
-
}
|
|
794
|
-
var getSymbols = nativeGetSymbols ? overArg(nativeGetSymbols, Object) : stubArray;
|
|
795
|
-
var getTag = baseGetTag;
|
|
796
|
-
if (DataView2 && getTag(new DataView2(new ArrayBuffer(1))) != dataViewTag || Map2 && getTag(new Map2()) != mapTag || Promise2 && getTag(Promise2.resolve()) != promiseTag || Set && getTag(new Set()) != setTag || WeakMap2 && getTag(new WeakMap2()) != weakMapTag) {
|
|
797
|
-
getTag = function(value) {
|
|
798
|
-
var result = objectToString.call(value), Ctor = result == objectTag ? value.constructor : void 0, ctorString = Ctor ? toSource(Ctor) : void 0;
|
|
799
|
-
if (ctorString) {
|
|
800
|
-
switch (ctorString) {
|
|
801
|
-
case dataViewCtorString:
|
|
802
|
-
return dataViewTag;
|
|
803
|
-
case mapCtorString:
|
|
804
|
-
return mapTag;
|
|
805
|
-
case promiseCtorString:
|
|
806
|
-
return promiseTag;
|
|
807
|
-
case setCtorString:
|
|
808
|
-
return setTag;
|
|
809
|
-
case weakMapCtorString:
|
|
810
|
-
return weakMapTag;
|
|
811
|
-
}
|
|
812
|
-
}
|
|
813
|
-
return result;
|
|
814
|
-
};
|
|
815
|
-
}
|
|
816
|
-
function initCloneArray(array) {
|
|
817
|
-
var length = array.length, result = array.constructor(length);
|
|
818
|
-
if (length && typeof array[0] == "string" && hasOwnProperty.call(array, "index")) {
|
|
819
|
-
result.index = array.index;
|
|
820
|
-
result.input = array.input;
|
|
821
|
-
}
|
|
822
|
-
return result;
|
|
823
|
-
}
|
|
824
|
-
function initCloneObject(object) {
|
|
825
|
-
return typeof object.constructor == "function" && !isPrototype(object) ? baseCreate(getPrototype(object)) : {};
|
|
826
|
-
}
|
|
827
|
-
function initCloneByTag(object, tag, cloneFunc, isDeep) {
|
|
828
|
-
var Ctor = object.constructor;
|
|
829
|
-
switch (tag) {
|
|
830
|
-
case arrayBufferTag:
|
|
831
|
-
return cloneArrayBuffer(object);
|
|
832
|
-
case boolTag:
|
|
833
|
-
case dateTag:
|
|
834
|
-
return new Ctor(+object);
|
|
835
|
-
case dataViewTag:
|
|
836
|
-
return cloneDataView(object, isDeep);
|
|
837
|
-
case float32Tag:
|
|
838
|
-
case float64Tag:
|
|
839
|
-
case int8Tag:
|
|
840
|
-
case int16Tag:
|
|
841
|
-
case int32Tag:
|
|
842
|
-
case uint8Tag:
|
|
843
|
-
case uint8ClampedTag:
|
|
844
|
-
case uint16Tag:
|
|
845
|
-
case uint32Tag:
|
|
846
|
-
return cloneTypedArray(object, isDeep);
|
|
847
|
-
case mapTag:
|
|
848
|
-
return cloneMap(object, isDeep, cloneFunc);
|
|
849
|
-
case numberTag:
|
|
850
|
-
case stringTag:
|
|
851
|
-
return new Ctor(object);
|
|
852
|
-
case regexpTag:
|
|
853
|
-
return cloneRegExp(object);
|
|
854
|
-
case setTag:
|
|
855
|
-
return cloneSet(object, isDeep, cloneFunc);
|
|
856
|
-
case symbolTag:
|
|
857
|
-
return cloneSymbol(object);
|
|
858
|
-
}
|
|
859
|
-
}
|
|
860
|
-
function isIndex(value, length) {
|
|
861
|
-
length = length == null ? MAX_SAFE_INTEGER : length;
|
|
862
|
-
return !!length && (typeof value == "number" || reIsUint.test(value)) && (value > -1 && value % 1 == 0 && value < length);
|
|
863
|
-
}
|
|
864
|
-
function isKeyable(value) {
|
|
865
|
-
var type = typeof value;
|
|
866
|
-
return type == "string" || type == "number" || type == "symbol" || type == "boolean" ? value !== "__proto__" : value === null;
|
|
867
|
-
}
|
|
868
|
-
function isMasked(func) {
|
|
869
|
-
return !!maskSrcKey && maskSrcKey in func;
|
|
870
|
-
}
|
|
871
|
-
function isPrototype(value) {
|
|
872
|
-
var Ctor = value && value.constructor, proto2 = typeof Ctor == "function" && Ctor.prototype || objectProto;
|
|
873
|
-
return value === proto2;
|
|
874
|
-
}
|
|
875
|
-
function toSource(func) {
|
|
876
|
-
if (func != null) {
|
|
877
|
-
try {
|
|
878
|
-
return funcToString.call(func);
|
|
879
|
-
} catch (e) {
|
|
880
|
-
}
|
|
881
|
-
try {
|
|
882
|
-
return func + "";
|
|
883
|
-
} catch (e) {
|
|
884
|
-
}
|
|
885
|
-
}
|
|
886
|
-
return "";
|
|
887
|
-
}
|
|
888
|
-
function cloneDeep(value) {
|
|
889
|
-
return baseClone(value, true, true);
|
|
890
|
-
}
|
|
891
|
-
function eq(value, other) {
|
|
892
|
-
return value === other || value !== value && other !== other;
|
|
893
|
-
}
|
|
894
|
-
function isArguments(value) {
|
|
895
|
-
return isArrayLikeObject(value) && hasOwnProperty.call(value, "callee") && (!propertyIsEnumerable.call(value, "callee") || objectToString.call(value) == argsTag);
|
|
896
|
-
}
|
|
897
|
-
var isArray2 = Array.isArray;
|
|
898
|
-
function isArrayLike(value) {
|
|
899
|
-
return value != null && isLength(value.length) && !isFunction(value);
|
|
900
|
-
}
|
|
901
|
-
function isArrayLikeObject(value) {
|
|
902
|
-
return isObjectLike(value) && isArrayLike(value);
|
|
903
|
-
}
|
|
904
|
-
var isBuffer = nativeIsBuffer || stubFalse;
|
|
905
|
-
function isFunction(value) {
|
|
906
|
-
var tag = isObject(value) ? objectToString.call(value) : "";
|
|
907
|
-
return tag == funcTag || tag == genTag;
|
|
908
|
-
}
|
|
909
|
-
function isLength(value) {
|
|
910
|
-
return typeof value == "number" && value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER;
|
|
911
|
-
}
|
|
912
|
-
function isObject(value) {
|
|
913
|
-
var type = typeof value;
|
|
914
|
-
return !!value && (type == "object" || type == "function");
|
|
915
|
-
}
|
|
916
|
-
function isObjectLike(value) {
|
|
917
|
-
return !!value && typeof value == "object";
|
|
918
|
-
}
|
|
919
|
-
function keys(object) {
|
|
920
|
-
return isArrayLike(object) ? arrayLikeKeys(object) : baseKeys(object);
|
|
921
|
-
}
|
|
922
|
-
function stubArray() {
|
|
923
|
-
return [];
|
|
924
|
-
}
|
|
925
|
-
function stubFalse() {
|
|
926
|
-
return false;
|
|
927
|
-
}
|
|
928
|
-
module.exports = cloneDeep;
|
|
929
|
-
})(lodash_clonedeep, lodash_clonedeep.exports);
|
|
930
|
-
lodash_clonedeep.exports;
|
|
931
|
-
Object.prototype.toString.call(typeof process !== "undefined" ? process : 0) === "[object process]";
|
|
932
|
-
var __defProp2 = Object.defineProperty;
|
|
933
|
-
var __defNormalProp2 = (obj, key, value) => key in obj ? __defProp2(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
934
|
-
var __publicField2 = (obj, key, value) => {
|
|
935
|
-
__defNormalProp2(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
936
|
-
return value;
|
|
937
|
-
};
|
|
938
|
-
var Gauge = /* @__PURE__ */ ((Gauge2) => {
|
|
939
|
-
Gauge2["ACTIVE_REQUEST_GAUGE"] = "a";
|
|
940
|
-
Gauge2["AUTHENTICATION_COUNT_GAUGE"] = "b";
|
|
941
|
-
Gauge2["AUTHENTICATION_ERROR_COUNT_GAUGE"] = "aa";
|
|
942
|
-
Gauge2["AUTHENTICATION_RETRY_COUNT_GAUGE"] = "ab";
|
|
943
|
-
Gauge2["CONNECTION_POOL_IDLE_GAUGE"] = "c";
|
|
944
|
-
Gauge2["CONNECTION_POOL_TOTAL_GAUGE"] = "d";
|
|
945
|
-
Gauge2["CONNECTION_POOL_WAITING_GAUGE"] = "e";
|
|
946
|
-
Gauge2["CPU_LOAD_GAUGE"] = "f";
|
|
947
|
-
Gauge2["CPU_SYSTEM_LOAD_GAUGE"] = "g";
|
|
948
|
-
Gauge2["DURATION_GAUGE"] = "h";
|
|
949
|
-
Gauge2["DURATION_HISTOGRAM_GAUGE"] = "i";
|
|
950
|
-
Gauge2["ERROR_COUNT_GAUGE"] = "j";
|
|
951
|
-
Gauge2["LATENCY_GAUGE"] = "k";
|
|
952
|
-
Gauge2["LATENCY_HISTOGRAM_GAUGE"] = "l";
|
|
953
|
-
Gauge2["LOGGER"] = "m";
|
|
954
|
-
Gauge2["LOGGER_COPY"] = "n";
|
|
955
|
-
Gauge2["NETWORK_RX_GAUGE"] = "o";
|
|
956
|
-
Gauge2["NETWORK_TX_GAUGE"] = "p";
|
|
957
|
-
Gauge2["REQUEST_COUNT_GAUGE"] = "q";
|
|
958
|
-
Gauge2["RETRY_COUNT_GAUGE"] = "r";
|
|
959
|
-
Gauge2["TIMER_GAUGE"] = "s";
|
|
960
|
-
Gauge2["VELOCITY_GAUGE"] = "t";
|
|
961
|
-
Gauge2["CONNECTION_COUNT_GAUGE"] = "u";
|
|
962
|
-
Gauge2["OBJECT_GAUGE"] = "v";
|
|
963
|
-
Gauge2["PAYLOAD_SIZE"] = "w";
|
|
964
|
-
Gauge2["CORE_COUNT_GAUGE"] = "x";
|
|
965
|
-
Gauge2["CHILD_COUNT"] = "y";
|
|
966
|
-
Gauge2["UNKNOWN"] = "z";
|
|
967
|
-
return Gauge2;
|
|
968
|
-
})(Gauge || {});
|
|
969
|
-
var GaugeTypes = /* @__PURE__ */ ((GaugeTypes2) => {
|
|
970
|
-
GaugeTypes2["GAUGE_TYPE"] = "_";
|
|
971
|
-
GaugeTypes2["INSTRUMENT_GAUGE"] = "a";
|
|
972
|
-
GaugeTypes2["INSTRUMENT_VELOCITY"] = "b";
|
|
973
|
-
GaugeTypes2["INSTRUMENT_HISTOGRAM"] = "c";
|
|
974
|
-
GaugeTypes2["INSTRUMENT_LOG"] = "d";
|
|
975
|
-
GaugeTypes2["INSTRUMENT_TIMER"] = "e";
|
|
976
|
-
GaugeTypes2["INSTRUMENT_OBJECT"] = "f";
|
|
977
|
-
return GaugeTypes2;
|
|
978
|
-
})(GaugeTypes || {});
|
|
979
|
-
GaugeTypes.GAUGE_TYPE;
|
|
980
|
-
var commonjsGlobal = typeof globalThis !== "undefined" ? globalThis : typeof window !== "undefined" ? window : typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : {};
|
|
981
|
-
var timsort$1 = {};
|
|
982
|
-
(function(exports) {
|
|
983
|
-
(function(global2, factory) {
|
|
984
|
-
{
|
|
985
|
-
factory(exports);
|
|
986
|
-
}
|
|
987
|
-
})(commonjsGlobal, function(exports2) {
|
|
988
|
-
exports2.__esModule = true;
|
|
989
|
-
exports2.sort = sort;
|
|
990
|
-
function _classCallCheck(instance, Constructor) {
|
|
991
|
-
if (!(instance instanceof Constructor)) {
|
|
992
|
-
throw new TypeError("Cannot call a class as a function");
|
|
993
|
-
}
|
|
994
|
-
}
|
|
995
|
-
var DEFAULT_MIN_MERGE = 32;
|
|
996
|
-
var DEFAULT_MIN_GALLOPING = 7;
|
|
997
|
-
var DEFAULT_TMP_STORAGE_LENGTH = 256;
|
|
998
|
-
var POWERS_OF_TEN = [1, 10, 100, 1e3, 1e4, 1e5, 1e6, 1e7, 1e8, 1e9];
|
|
999
|
-
function log10(x) {
|
|
1000
|
-
if (x < 1e5) {
|
|
1001
|
-
if (x < 100) {
|
|
1002
|
-
return x < 10 ? 0 : 1;
|
|
1003
|
-
}
|
|
1004
|
-
if (x < 1e4) {
|
|
1005
|
-
return x < 1e3 ? 2 : 3;
|
|
1006
|
-
}
|
|
1007
|
-
return 4;
|
|
1008
|
-
}
|
|
1009
|
-
if (x < 1e7) {
|
|
1010
|
-
return x < 1e6 ? 5 : 6;
|
|
1011
|
-
}
|
|
1012
|
-
if (x < 1e9) {
|
|
1013
|
-
return x < 1e8 ? 7 : 8;
|
|
1014
|
-
}
|
|
1015
|
-
return 9;
|
|
1016
|
-
}
|
|
1017
|
-
function alphabeticalCompare(a, b) {
|
|
1018
|
-
if (a === b) {
|
|
1019
|
-
return 0;
|
|
1020
|
-
}
|
|
1021
|
-
if (~~a === a && ~~b === b) {
|
|
1022
|
-
if (a === 0 || b === 0) {
|
|
1023
|
-
return a < b ? -1 : 1;
|
|
1024
|
-
}
|
|
1025
|
-
if (a < 0 || b < 0) {
|
|
1026
|
-
if (b >= 0) {
|
|
1027
|
-
return -1;
|
|
1028
|
-
}
|
|
1029
|
-
if (a >= 0) {
|
|
1030
|
-
return 1;
|
|
1031
|
-
}
|
|
1032
|
-
a = -a;
|
|
1033
|
-
b = -b;
|
|
1034
|
-
}
|
|
1035
|
-
var al = log10(a);
|
|
1036
|
-
var bl = log10(b);
|
|
1037
|
-
var t = 0;
|
|
1038
|
-
if (al < bl) {
|
|
1039
|
-
a *= POWERS_OF_TEN[bl - al - 1];
|
|
1040
|
-
b /= 10;
|
|
1041
|
-
t = -1;
|
|
1042
|
-
} else if (al > bl) {
|
|
1043
|
-
b *= POWERS_OF_TEN[al - bl - 1];
|
|
1044
|
-
a /= 10;
|
|
1045
|
-
t = 1;
|
|
1046
|
-
}
|
|
1047
|
-
if (a === b) {
|
|
1048
|
-
return t;
|
|
1049
|
-
}
|
|
1050
|
-
return a < b ? -1 : 1;
|
|
1051
|
-
}
|
|
1052
|
-
var aStr = String(a);
|
|
1053
|
-
var bStr = String(b);
|
|
1054
|
-
if (aStr === bStr) {
|
|
1055
|
-
return 0;
|
|
1056
|
-
}
|
|
1057
|
-
return aStr < bStr ? -1 : 1;
|
|
1058
|
-
}
|
|
1059
|
-
function minRunLength(n) {
|
|
1060
|
-
var r = 0;
|
|
1061
|
-
while (n >= DEFAULT_MIN_MERGE) {
|
|
1062
|
-
r |= n & 1;
|
|
1063
|
-
n >>= 1;
|
|
1064
|
-
}
|
|
1065
|
-
return n + r;
|
|
1066
|
-
}
|
|
1067
|
-
function makeAscendingRun(array, lo, hi, compare) {
|
|
1068
|
-
var runHi = lo + 1;
|
|
1069
|
-
if (runHi === hi) {
|
|
1070
|
-
return 1;
|
|
1071
|
-
}
|
|
1072
|
-
if (compare(array[runHi++], array[lo]) < 0) {
|
|
1073
|
-
while (runHi < hi && compare(array[runHi], array[runHi - 1]) < 0) {
|
|
1074
|
-
runHi++;
|
|
1075
|
-
}
|
|
1076
|
-
reverseRun(array, lo, runHi);
|
|
1077
|
-
} else {
|
|
1078
|
-
while (runHi < hi && compare(array[runHi], array[runHi - 1]) >= 0) {
|
|
1079
|
-
runHi++;
|
|
1080
|
-
}
|
|
1081
|
-
}
|
|
1082
|
-
return runHi - lo;
|
|
1083
|
-
}
|
|
1084
|
-
function reverseRun(array, lo, hi) {
|
|
1085
|
-
hi--;
|
|
1086
|
-
while (lo < hi) {
|
|
1087
|
-
var t = array[lo];
|
|
1088
|
-
array[lo++] = array[hi];
|
|
1089
|
-
array[hi--] = t;
|
|
1090
|
-
}
|
|
1091
|
-
}
|
|
1092
|
-
function binaryInsertionSort(array, lo, hi, start, compare) {
|
|
1093
|
-
if (start === lo) {
|
|
1094
|
-
start++;
|
|
1095
|
-
}
|
|
1096
|
-
for (; start < hi; start++) {
|
|
1097
|
-
var pivot = array[start];
|
|
1098
|
-
var left = lo;
|
|
1099
|
-
var right = start;
|
|
1100
|
-
while (left < right) {
|
|
1101
|
-
var mid = left + right >>> 1;
|
|
1102
|
-
if (compare(pivot, array[mid]) < 0) {
|
|
1103
|
-
right = mid;
|
|
1104
|
-
} else {
|
|
1105
|
-
left = mid + 1;
|
|
1106
|
-
}
|
|
1107
|
-
}
|
|
1108
|
-
var n = start - left;
|
|
1109
|
-
switch (n) {
|
|
1110
|
-
case 3:
|
|
1111
|
-
array[left + 3] = array[left + 2];
|
|
1112
|
-
case 2:
|
|
1113
|
-
array[left + 2] = array[left + 1];
|
|
1114
|
-
case 1:
|
|
1115
|
-
array[left + 1] = array[left];
|
|
1116
|
-
break;
|
|
1117
|
-
default:
|
|
1118
|
-
while (n > 0) {
|
|
1119
|
-
array[left + n] = array[left + n - 1];
|
|
1120
|
-
n--;
|
|
1121
|
-
}
|
|
1122
|
-
}
|
|
1123
|
-
array[left] = pivot;
|
|
1124
|
-
}
|
|
1125
|
-
}
|
|
1126
|
-
function gallopLeft(value, array, start, length, hint, compare) {
|
|
1127
|
-
var lastOffset = 0;
|
|
1128
|
-
var maxOffset = 0;
|
|
1129
|
-
var offset = 1;
|
|
1130
|
-
if (compare(value, array[start + hint]) > 0) {
|
|
1131
|
-
maxOffset = length - hint;
|
|
1132
|
-
while (offset < maxOffset && compare(value, array[start + hint + offset]) > 0) {
|
|
1133
|
-
lastOffset = offset;
|
|
1134
|
-
offset = (offset << 1) + 1;
|
|
1135
|
-
if (offset <= 0) {
|
|
1136
|
-
offset = maxOffset;
|
|
1137
|
-
}
|
|
1138
|
-
}
|
|
1139
|
-
if (offset > maxOffset) {
|
|
1140
|
-
offset = maxOffset;
|
|
1141
|
-
}
|
|
1142
|
-
lastOffset += hint;
|
|
1143
|
-
offset += hint;
|
|
1144
|
-
} else {
|
|
1145
|
-
maxOffset = hint + 1;
|
|
1146
|
-
while (offset < maxOffset && compare(value, array[start + hint - offset]) <= 0) {
|
|
1147
|
-
lastOffset = offset;
|
|
1148
|
-
offset = (offset << 1) + 1;
|
|
1149
|
-
if (offset <= 0) {
|
|
1150
|
-
offset = maxOffset;
|
|
1151
|
-
}
|
|
1152
|
-
}
|
|
1153
|
-
if (offset > maxOffset) {
|
|
1154
|
-
offset = maxOffset;
|
|
1155
|
-
}
|
|
1156
|
-
var tmp = lastOffset;
|
|
1157
|
-
lastOffset = hint - offset;
|
|
1158
|
-
offset = hint - tmp;
|
|
1159
|
-
}
|
|
1160
|
-
lastOffset++;
|
|
1161
|
-
while (lastOffset < offset) {
|
|
1162
|
-
var m = lastOffset + (offset - lastOffset >>> 1);
|
|
1163
|
-
if (compare(value, array[start + m]) > 0) {
|
|
1164
|
-
lastOffset = m + 1;
|
|
1165
|
-
} else {
|
|
1166
|
-
offset = m;
|
|
1167
|
-
}
|
|
1168
|
-
}
|
|
1169
|
-
return offset;
|
|
1170
|
-
}
|
|
1171
|
-
function gallopRight(value, array, start, length, hint, compare) {
|
|
1172
|
-
var lastOffset = 0;
|
|
1173
|
-
var maxOffset = 0;
|
|
1174
|
-
var offset = 1;
|
|
1175
|
-
if (compare(value, array[start + hint]) < 0) {
|
|
1176
|
-
maxOffset = hint + 1;
|
|
1177
|
-
while (offset < maxOffset && compare(value, array[start + hint - offset]) < 0) {
|
|
1178
|
-
lastOffset = offset;
|
|
1179
|
-
offset = (offset << 1) + 1;
|
|
1180
|
-
if (offset <= 0) {
|
|
1181
|
-
offset = maxOffset;
|
|
1182
|
-
}
|
|
1183
|
-
}
|
|
1184
|
-
if (offset > maxOffset) {
|
|
1185
|
-
offset = maxOffset;
|
|
1186
|
-
}
|
|
1187
|
-
var tmp = lastOffset;
|
|
1188
|
-
lastOffset = hint - offset;
|
|
1189
|
-
offset = hint - tmp;
|
|
1190
|
-
} else {
|
|
1191
|
-
maxOffset = length - hint;
|
|
1192
|
-
while (offset < maxOffset && compare(value, array[start + hint + offset]) >= 0) {
|
|
1193
|
-
lastOffset = offset;
|
|
1194
|
-
offset = (offset << 1) + 1;
|
|
1195
|
-
if (offset <= 0) {
|
|
1196
|
-
offset = maxOffset;
|
|
1197
|
-
}
|
|
1198
|
-
}
|
|
1199
|
-
if (offset > maxOffset) {
|
|
1200
|
-
offset = maxOffset;
|
|
1201
|
-
}
|
|
1202
|
-
lastOffset += hint;
|
|
1203
|
-
offset += hint;
|
|
1204
|
-
}
|
|
1205
|
-
lastOffset++;
|
|
1206
|
-
while (lastOffset < offset) {
|
|
1207
|
-
var m = lastOffset + (offset - lastOffset >>> 1);
|
|
1208
|
-
if (compare(value, array[start + m]) < 0) {
|
|
1209
|
-
offset = m;
|
|
1210
|
-
} else {
|
|
1211
|
-
lastOffset = m + 1;
|
|
1212
|
-
}
|
|
1213
|
-
}
|
|
1214
|
-
return offset;
|
|
1215
|
-
}
|
|
1216
|
-
var TimSort = function() {
|
|
1217
|
-
function TimSort2(array, compare) {
|
|
1218
|
-
_classCallCheck(this, TimSort2);
|
|
1219
|
-
this.array = null;
|
|
1220
|
-
this.compare = null;
|
|
1221
|
-
this.minGallop = DEFAULT_MIN_GALLOPING;
|
|
1222
|
-
this.length = 0;
|
|
1223
|
-
this.tmpStorageLength = DEFAULT_TMP_STORAGE_LENGTH;
|
|
1224
|
-
this.stackLength = 0;
|
|
1225
|
-
this.runStart = null;
|
|
1226
|
-
this.runLength = null;
|
|
1227
|
-
this.stackSize = 0;
|
|
1228
|
-
this.array = array;
|
|
1229
|
-
this.compare = compare;
|
|
1230
|
-
this.length = array.length;
|
|
1231
|
-
if (this.length < 2 * DEFAULT_TMP_STORAGE_LENGTH) {
|
|
1232
|
-
this.tmpStorageLength = this.length >>> 1;
|
|
1233
|
-
}
|
|
1234
|
-
this.tmp = new Array(this.tmpStorageLength);
|
|
1235
|
-
this.stackLength = this.length < 120 ? 5 : this.length < 1542 ? 10 : this.length < 119151 ? 19 : 40;
|
|
1236
|
-
this.runStart = new Array(this.stackLength);
|
|
1237
|
-
this.runLength = new Array(this.stackLength);
|
|
1238
|
-
}
|
|
1239
|
-
TimSort2.prototype.pushRun = function pushRun(runStart, runLength) {
|
|
1240
|
-
this.runStart[this.stackSize] = runStart;
|
|
1241
|
-
this.runLength[this.stackSize] = runLength;
|
|
1242
|
-
this.stackSize += 1;
|
|
1243
|
-
};
|
|
1244
|
-
TimSort2.prototype.mergeRuns = function mergeRuns() {
|
|
1245
|
-
while (this.stackSize > 1) {
|
|
1246
|
-
var n = this.stackSize - 2;
|
|
1247
|
-
if (n >= 1 && this.runLength[n - 1] <= this.runLength[n] + this.runLength[n + 1] || n >= 2 && this.runLength[n - 2] <= this.runLength[n] + this.runLength[n - 1]) {
|
|
1248
|
-
if (this.runLength[n - 1] < this.runLength[n + 1]) {
|
|
1249
|
-
n--;
|
|
1250
|
-
}
|
|
1251
|
-
} else if (this.runLength[n] > this.runLength[n + 1]) {
|
|
1252
|
-
break;
|
|
1253
|
-
}
|
|
1254
|
-
this.mergeAt(n);
|
|
1255
|
-
}
|
|
1256
|
-
};
|
|
1257
|
-
TimSort2.prototype.forceMergeRuns = function forceMergeRuns() {
|
|
1258
|
-
while (this.stackSize > 1) {
|
|
1259
|
-
var n = this.stackSize - 2;
|
|
1260
|
-
if (n > 0 && this.runLength[n - 1] < this.runLength[n + 1]) {
|
|
1261
|
-
n--;
|
|
1262
|
-
}
|
|
1263
|
-
this.mergeAt(n);
|
|
1264
|
-
}
|
|
1265
|
-
};
|
|
1266
|
-
TimSort2.prototype.mergeAt = function mergeAt(i) {
|
|
1267
|
-
var compare = this.compare;
|
|
1268
|
-
var array = this.array;
|
|
1269
|
-
var start1 = this.runStart[i];
|
|
1270
|
-
var length1 = this.runLength[i];
|
|
1271
|
-
var start2 = this.runStart[i + 1];
|
|
1272
|
-
var length2 = this.runLength[i + 1];
|
|
1273
|
-
this.runLength[i] = length1 + length2;
|
|
1274
|
-
if (i === this.stackSize - 3) {
|
|
1275
|
-
this.runStart[i + 1] = this.runStart[i + 2];
|
|
1276
|
-
this.runLength[i + 1] = this.runLength[i + 2];
|
|
1277
|
-
}
|
|
1278
|
-
this.stackSize--;
|
|
1279
|
-
var k = gallopRight(array[start2], array, start1, length1, 0, compare);
|
|
1280
|
-
start1 += k;
|
|
1281
|
-
length1 -= k;
|
|
1282
|
-
if (length1 === 0) {
|
|
1283
|
-
return;
|
|
1284
|
-
}
|
|
1285
|
-
length2 = gallopLeft(array[start1 + length1 - 1], array, start2, length2, length2 - 1, compare);
|
|
1286
|
-
if (length2 === 0) {
|
|
1287
|
-
return;
|
|
1288
|
-
}
|
|
1289
|
-
if (length1 <= length2) {
|
|
1290
|
-
this.mergeLow(start1, length1, start2, length2);
|
|
1291
|
-
} else {
|
|
1292
|
-
this.mergeHigh(start1, length1, start2, length2);
|
|
1293
|
-
}
|
|
1294
|
-
};
|
|
1295
|
-
TimSort2.prototype.mergeLow = function mergeLow(start1, length1, start2, length2) {
|
|
1296
|
-
var compare = this.compare;
|
|
1297
|
-
var array = this.array;
|
|
1298
|
-
var tmp = this.tmp;
|
|
1299
|
-
var i = 0;
|
|
1300
|
-
for (i = 0; i < length1; i++) {
|
|
1301
|
-
tmp[i] = array[start1 + i];
|
|
1302
|
-
}
|
|
1303
|
-
var cursor1 = 0;
|
|
1304
|
-
var cursor2 = start2;
|
|
1305
|
-
var dest = start1;
|
|
1306
|
-
array[dest++] = array[cursor2++];
|
|
1307
|
-
if (--length2 === 0) {
|
|
1308
|
-
for (i = 0; i < length1; i++) {
|
|
1309
|
-
array[dest + i] = tmp[cursor1 + i];
|
|
1310
|
-
}
|
|
1311
|
-
return;
|
|
1312
|
-
}
|
|
1313
|
-
if (length1 === 1) {
|
|
1314
|
-
for (i = 0; i < length2; i++) {
|
|
1315
|
-
array[dest + i] = array[cursor2 + i];
|
|
1316
|
-
}
|
|
1317
|
-
array[dest + length2] = tmp[cursor1];
|
|
1318
|
-
return;
|
|
1319
|
-
}
|
|
1320
|
-
var minGallop = this.minGallop;
|
|
1321
|
-
while (true) {
|
|
1322
|
-
var count1 = 0;
|
|
1323
|
-
var count2 = 0;
|
|
1324
|
-
var exit = false;
|
|
1325
|
-
do {
|
|
1326
|
-
if (compare(array[cursor2], tmp[cursor1]) < 0) {
|
|
1327
|
-
array[dest++] = array[cursor2++];
|
|
1328
|
-
count2++;
|
|
1329
|
-
count1 = 0;
|
|
1330
|
-
if (--length2 === 0) {
|
|
1331
|
-
exit = true;
|
|
1332
|
-
break;
|
|
1333
|
-
}
|
|
1334
|
-
} else {
|
|
1335
|
-
array[dest++] = tmp[cursor1++];
|
|
1336
|
-
count1++;
|
|
1337
|
-
count2 = 0;
|
|
1338
|
-
if (--length1 === 1) {
|
|
1339
|
-
exit = true;
|
|
1340
|
-
break;
|
|
1341
|
-
}
|
|
1342
|
-
}
|
|
1343
|
-
} while ((count1 | count2) < minGallop);
|
|
1344
|
-
if (exit) {
|
|
1345
|
-
break;
|
|
1346
|
-
}
|
|
1347
|
-
do {
|
|
1348
|
-
count1 = gallopRight(array[cursor2], tmp, cursor1, length1, 0, compare);
|
|
1349
|
-
if (count1 !== 0) {
|
|
1350
|
-
for (i = 0; i < count1; i++) {
|
|
1351
|
-
array[dest + i] = tmp[cursor1 + i];
|
|
1352
|
-
}
|
|
1353
|
-
dest += count1;
|
|
1354
|
-
cursor1 += count1;
|
|
1355
|
-
length1 -= count1;
|
|
1356
|
-
if (length1 <= 1) {
|
|
1357
|
-
exit = true;
|
|
1358
|
-
break;
|
|
1359
|
-
}
|
|
1360
|
-
}
|
|
1361
|
-
array[dest++] = array[cursor2++];
|
|
1362
|
-
if (--length2 === 0) {
|
|
1363
|
-
exit = true;
|
|
1364
|
-
break;
|
|
1365
|
-
}
|
|
1366
|
-
count2 = gallopLeft(tmp[cursor1], array, cursor2, length2, 0, compare);
|
|
1367
|
-
if (count2 !== 0) {
|
|
1368
|
-
for (i = 0; i < count2; i++) {
|
|
1369
|
-
array[dest + i] = array[cursor2 + i];
|
|
1370
|
-
}
|
|
1371
|
-
dest += count2;
|
|
1372
|
-
cursor2 += count2;
|
|
1373
|
-
length2 -= count2;
|
|
1374
|
-
if (length2 === 0) {
|
|
1375
|
-
exit = true;
|
|
1376
|
-
break;
|
|
1377
|
-
}
|
|
1378
|
-
}
|
|
1379
|
-
array[dest++] = tmp[cursor1++];
|
|
1380
|
-
if (--length1 === 1) {
|
|
1381
|
-
exit = true;
|
|
1382
|
-
break;
|
|
1383
|
-
}
|
|
1384
|
-
minGallop--;
|
|
1385
|
-
} while (count1 >= DEFAULT_MIN_GALLOPING || count2 >= DEFAULT_MIN_GALLOPING);
|
|
1386
|
-
if (exit) {
|
|
1387
|
-
break;
|
|
1388
|
-
}
|
|
1389
|
-
if (minGallop < 0) {
|
|
1390
|
-
minGallop = 0;
|
|
1391
|
-
}
|
|
1392
|
-
minGallop += 2;
|
|
1393
|
-
}
|
|
1394
|
-
this.minGallop = minGallop;
|
|
1395
|
-
if (minGallop < 1) {
|
|
1396
|
-
this.minGallop = 1;
|
|
1397
|
-
}
|
|
1398
|
-
if (length1 === 1) {
|
|
1399
|
-
for (i = 0; i < length2; i++) {
|
|
1400
|
-
array[dest + i] = array[cursor2 + i];
|
|
1401
|
-
}
|
|
1402
|
-
array[dest + length2] = tmp[cursor1];
|
|
1403
|
-
} else if (length1 === 0) {
|
|
1404
|
-
throw new Error("mergeLow preconditions were not respected");
|
|
1405
|
-
} else {
|
|
1406
|
-
for (i = 0; i < length1; i++) {
|
|
1407
|
-
array[dest + i] = tmp[cursor1 + i];
|
|
1408
|
-
}
|
|
1409
|
-
}
|
|
1410
|
-
};
|
|
1411
|
-
TimSort2.prototype.mergeHigh = function mergeHigh(start1, length1, start2, length2) {
|
|
1412
|
-
var compare = this.compare;
|
|
1413
|
-
var array = this.array;
|
|
1414
|
-
var tmp = this.tmp;
|
|
1415
|
-
var i = 0;
|
|
1416
|
-
for (i = 0; i < length2; i++) {
|
|
1417
|
-
tmp[i] = array[start2 + i];
|
|
1418
|
-
}
|
|
1419
|
-
var cursor1 = start1 + length1 - 1;
|
|
1420
|
-
var cursor2 = length2 - 1;
|
|
1421
|
-
var dest = start2 + length2 - 1;
|
|
1422
|
-
var customCursor = 0;
|
|
1423
|
-
var customDest = 0;
|
|
1424
|
-
array[dest--] = array[cursor1--];
|
|
1425
|
-
if (--length1 === 0) {
|
|
1426
|
-
customCursor = dest - (length2 - 1);
|
|
1427
|
-
for (i = 0; i < length2; i++) {
|
|
1428
|
-
array[customCursor + i] = tmp[i];
|
|
1429
|
-
}
|
|
1430
|
-
return;
|
|
1431
|
-
}
|
|
1432
|
-
if (length2 === 1) {
|
|
1433
|
-
dest -= length1;
|
|
1434
|
-
cursor1 -= length1;
|
|
1435
|
-
customDest = dest + 1;
|
|
1436
|
-
customCursor = cursor1 + 1;
|
|
1437
|
-
for (i = length1 - 1; i >= 0; i--) {
|
|
1438
|
-
array[customDest + i] = array[customCursor + i];
|
|
1439
|
-
}
|
|
1440
|
-
array[dest] = tmp[cursor2];
|
|
1441
|
-
return;
|
|
1442
|
-
}
|
|
1443
|
-
var minGallop = this.minGallop;
|
|
1444
|
-
while (true) {
|
|
1445
|
-
var count1 = 0;
|
|
1446
|
-
var count2 = 0;
|
|
1447
|
-
var exit = false;
|
|
1448
|
-
do {
|
|
1449
|
-
if (compare(tmp[cursor2], array[cursor1]) < 0) {
|
|
1450
|
-
array[dest--] = array[cursor1--];
|
|
1451
|
-
count1++;
|
|
1452
|
-
count2 = 0;
|
|
1453
|
-
if (--length1 === 0) {
|
|
1454
|
-
exit = true;
|
|
1455
|
-
break;
|
|
1456
|
-
}
|
|
1457
|
-
} else {
|
|
1458
|
-
array[dest--] = tmp[cursor2--];
|
|
1459
|
-
count2++;
|
|
1460
|
-
count1 = 0;
|
|
1461
|
-
if (--length2 === 1) {
|
|
1462
|
-
exit = true;
|
|
1463
|
-
break;
|
|
1464
|
-
}
|
|
1465
|
-
}
|
|
1466
|
-
} while ((count1 | count2) < minGallop);
|
|
1467
|
-
if (exit) {
|
|
1468
|
-
break;
|
|
1469
|
-
}
|
|
1470
|
-
do {
|
|
1471
|
-
count1 = length1 - gallopRight(tmp[cursor2], array, start1, length1, length1 - 1, compare);
|
|
1472
|
-
if (count1 !== 0) {
|
|
1473
|
-
dest -= count1;
|
|
1474
|
-
cursor1 -= count1;
|
|
1475
|
-
length1 -= count1;
|
|
1476
|
-
customDest = dest + 1;
|
|
1477
|
-
customCursor = cursor1 + 1;
|
|
1478
|
-
for (i = count1 - 1; i >= 0; i--) {
|
|
1479
|
-
array[customDest + i] = array[customCursor + i];
|
|
1480
|
-
}
|
|
1481
|
-
if (length1 === 0) {
|
|
1482
|
-
exit = true;
|
|
1483
|
-
break;
|
|
1484
|
-
}
|
|
1485
|
-
}
|
|
1486
|
-
array[dest--] = tmp[cursor2--];
|
|
1487
|
-
if (--length2 === 1) {
|
|
1488
|
-
exit = true;
|
|
1489
|
-
break;
|
|
1490
|
-
}
|
|
1491
|
-
count2 = length2 - gallopLeft(array[cursor1], tmp, 0, length2, length2 - 1, compare);
|
|
1492
|
-
if (count2 !== 0) {
|
|
1493
|
-
dest -= count2;
|
|
1494
|
-
cursor2 -= count2;
|
|
1495
|
-
length2 -= count2;
|
|
1496
|
-
customDest = dest + 1;
|
|
1497
|
-
customCursor = cursor2 + 1;
|
|
1498
|
-
for (i = 0; i < count2; i++) {
|
|
1499
|
-
array[customDest + i] = tmp[customCursor + i];
|
|
1500
|
-
}
|
|
1501
|
-
if (length2 <= 1) {
|
|
1502
|
-
exit = true;
|
|
1503
|
-
break;
|
|
1504
|
-
}
|
|
1505
|
-
}
|
|
1506
|
-
array[dest--] = array[cursor1--];
|
|
1507
|
-
if (--length1 === 0) {
|
|
1508
|
-
exit = true;
|
|
1509
|
-
break;
|
|
1510
|
-
}
|
|
1511
|
-
minGallop--;
|
|
1512
|
-
} while (count1 >= DEFAULT_MIN_GALLOPING || count2 >= DEFAULT_MIN_GALLOPING);
|
|
1513
|
-
if (exit) {
|
|
1514
|
-
break;
|
|
1515
|
-
}
|
|
1516
|
-
if (minGallop < 0) {
|
|
1517
|
-
minGallop = 0;
|
|
1518
|
-
}
|
|
1519
|
-
minGallop += 2;
|
|
1520
|
-
}
|
|
1521
|
-
this.minGallop = minGallop;
|
|
1522
|
-
if (minGallop < 1) {
|
|
1523
|
-
this.minGallop = 1;
|
|
1524
|
-
}
|
|
1525
|
-
if (length2 === 1) {
|
|
1526
|
-
dest -= length1;
|
|
1527
|
-
cursor1 -= length1;
|
|
1528
|
-
customDest = dest + 1;
|
|
1529
|
-
customCursor = cursor1 + 1;
|
|
1530
|
-
for (i = length1 - 1; i >= 0; i--) {
|
|
1531
|
-
array[customDest + i] = array[customCursor + i];
|
|
1532
|
-
}
|
|
1533
|
-
array[dest] = tmp[cursor2];
|
|
1534
|
-
} else if (length2 === 0) {
|
|
1535
|
-
throw new Error("mergeHigh preconditions were not respected");
|
|
1536
|
-
} else {
|
|
1537
|
-
customCursor = dest - (length2 - 1);
|
|
1538
|
-
for (i = 0; i < length2; i++) {
|
|
1539
|
-
array[customCursor + i] = tmp[i];
|
|
1540
|
-
}
|
|
1541
|
-
}
|
|
1542
|
-
};
|
|
1543
|
-
return TimSort2;
|
|
1544
|
-
}();
|
|
1545
|
-
function sort(array, compare, lo, hi) {
|
|
1546
|
-
if (!Array.isArray(array)) {
|
|
1547
|
-
throw new TypeError("Can only sort arrays");
|
|
1548
|
-
}
|
|
1549
|
-
if (!compare) {
|
|
1550
|
-
compare = alphabeticalCompare;
|
|
1551
|
-
} else if (typeof compare !== "function") {
|
|
1552
|
-
hi = lo;
|
|
1553
|
-
lo = compare;
|
|
1554
|
-
compare = alphabeticalCompare;
|
|
1555
|
-
}
|
|
1556
|
-
if (!lo) {
|
|
1557
|
-
lo = 0;
|
|
1558
|
-
}
|
|
1559
|
-
if (!hi) {
|
|
1560
|
-
hi = array.length;
|
|
1561
|
-
}
|
|
1562
|
-
var remaining = hi - lo;
|
|
1563
|
-
if (remaining < 2) {
|
|
1564
|
-
return;
|
|
1565
|
-
}
|
|
1566
|
-
var runLength = 0;
|
|
1567
|
-
if (remaining < DEFAULT_MIN_MERGE) {
|
|
1568
|
-
runLength = makeAscendingRun(array, lo, hi, compare);
|
|
1569
|
-
binaryInsertionSort(array, lo, hi, lo + runLength, compare);
|
|
1570
|
-
return;
|
|
1571
|
-
}
|
|
1572
|
-
var ts = new TimSort(array, compare);
|
|
1573
|
-
var minRun = minRunLength(remaining);
|
|
1574
|
-
do {
|
|
1575
|
-
runLength = makeAscendingRun(array, lo, hi, compare);
|
|
1576
|
-
if (runLength < minRun) {
|
|
1577
|
-
var force = remaining;
|
|
1578
|
-
if (force > minRun) {
|
|
1579
|
-
force = minRun;
|
|
1580
|
-
}
|
|
1581
|
-
binaryInsertionSort(array, lo, lo + force, lo + runLength, compare);
|
|
1582
|
-
runLength = force;
|
|
1583
|
-
}
|
|
1584
|
-
ts.pushRun(lo, runLength);
|
|
1585
|
-
ts.mergeRuns();
|
|
1586
|
-
remaining -= runLength;
|
|
1587
|
-
lo += runLength;
|
|
1588
|
-
} while (remaining !== 0);
|
|
1589
|
-
ts.forceMergeRuns();
|
|
1590
|
-
}
|
|
1591
|
-
});
|
|
1592
|
-
})(timsort$1);
|
|
1593
|
-
var ansiStyles$1$1 = { exports: {} };
|
|
1594
|
-
var colorName$1;
|
|
1595
|
-
var hasRequiredColorName$1;
|
|
1596
|
-
function requireColorName$1() {
|
|
1597
|
-
if (hasRequiredColorName$1)
|
|
1598
|
-
return colorName$1;
|
|
1599
|
-
hasRequiredColorName$1 = 1;
|
|
1600
|
-
colorName$1 = {
|
|
1601
|
-
"aliceblue": [240, 248, 255],
|
|
1602
|
-
"antiquewhite": [250, 235, 215],
|
|
1603
|
-
"aqua": [0, 255, 255],
|
|
1604
|
-
"aquamarine": [127, 255, 212],
|
|
1605
|
-
"azure": [240, 255, 255],
|
|
1606
|
-
"beige": [245, 245, 220],
|
|
1607
|
-
"bisque": [255, 228, 196],
|
|
1608
|
-
"black": [0, 0, 0],
|
|
1609
|
-
"blanchedalmond": [255, 235, 205],
|
|
1610
|
-
"blue": [0, 0, 255],
|
|
1611
|
-
"blueviolet": [138, 43, 226],
|
|
1612
|
-
"brown": [165, 42, 42],
|
|
1613
|
-
"burlywood": [222, 184, 135],
|
|
1614
|
-
"cadetblue": [95, 158, 160],
|
|
1615
|
-
"chartreuse": [127, 255, 0],
|
|
1616
|
-
"chocolate": [210, 105, 30],
|
|
1617
|
-
"coral": [255, 127, 80],
|
|
1618
|
-
"cornflowerblue": [100, 149, 237],
|
|
1619
|
-
"cornsilk": [255, 248, 220],
|
|
1620
|
-
"crimson": [220, 20, 60],
|
|
1621
|
-
"cyan": [0, 255, 255],
|
|
1622
|
-
"darkblue": [0, 0, 139],
|
|
1623
|
-
"darkcyan": [0, 139, 139],
|
|
1624
|
-
"darkgoldenrod": [184, 134, 11],
|
|
1625
|
-
"darkgray": [169, 169, 169],
|
|
1626
|
-
"darkgreen": [0, 100, 0],
|
|
1627
|
-
"darkgrey": [169, 169, 169],
|
|
1628
|
-
"darkkhaki": [189, 183, 107],
|
|
1629
|
-
"darkmagenta": [139, 0, 139],
|
|
1630
|
-
"darkolivegreen": [85, 107, 47],
|
|
1631
|
-
"darkorange": [255, 140, 0],
|
|
1632
|
-
"darkorchid": [153, 50, 204],
|
|
1633
|
-
"darkred": [139, 0, 0],
|
|
1634
|
-
"darksalmon": [233, 150, 122],
|
|
1635
|
-
"darkseagreen": [143, 188, 143],
|
|
1636
|
-
"darkslateblue": [72, 61, 139],
|
|
1637
|
-
"darkslategray": [47, 79, 79],
|
|
1638
|
-
"darkslategrey": [47, 79, 79],
|
|
1639
|
-
"darkturquoise": [0, 206, 209],
|
|
1640
|
-
"darkviolet": [148, 0, 211],
|
|
1641
|
-
"deeppink": [255, 20, 147],
|
|
1642
|
-
"deepskyblue": [0, 191, 255],
|
|
1643
|
-
"dimgray": [105, 105, 105],
|
|
1644
|
-
"dimgrey": [105, 105, 105],
|
|
1645
|
-
"dodgerblue": [30, 144, 255],
|
|
1646
|
-
"firebrick": [178, 34, 34],
|
|
1647
|
-
"floralwhite": [255, 250, 240],
|
|
1648
|
-
"forestgreen": [34, 139, 34],
|
|
1649
|
-
"fuchsia": [255, 0, 255],
|
|
1650
|
-
"gainsboro": [220, 220, 220],
|
|
1651
|
-
"ghostwhite": [248, 248, 255],
|
|
1652
|
-
"gold": [255, 215, 0],
|
|
1653
|
-
"goldenrod": [218, 165, 32],
|
|
1654
|
-
"gray": [128, 128, 128],
|
|
1655
|
-
"green": [0, 128, 0],
|
|
1656
|
-
"greenyellow": [173, 255, 47],
|
|
1657
|
-
"grey": [128, 128, 128],
|
|
1658
|
-
"honeydew": [240, 255, 240],
|
|
1659
|
-
"hotpink": [255, 105, 180],
|
|
1660
|
-
"indianred": [205, 92, 92],
|
|
1661
|
-
"indigo": [75, 0, 130],
|
|
1662
|
-
"ivory": [255, 255, 240],
|
|
1663
|
-
"khaki": [240, 230, 140],
|
|
1664
|
-
"lavender": [230, 230, 250],
|
|
1665
|
-
"lavenderblush": [255, 240, 245],
|
|
1666
|
-
"lawngreen": [124, 252, 0],
|
|
1667
|
-
"lemonchiffon": [255, 250, 205],
|
|
1668
|
-
"lightblue": [173, 216, 230],
|
|
1669
|
-
"lightcoral": [240, 128, 128],
|
|
1670
|
-
"lightcyan": [224, 255, 255],
|
|
1671
|
-
"lightgoldenrodyellow": [250, 250, 210],
|
|
1672
|
-
"lightgray": [211, 211, 211],
|
|
1673
|
-
"lightgreen": [144, 238, 144],
|
|
1674
|
-
"lightgrey": [211, 211, 211],
|
|
1675
|
-
"lightpink": [255, 182, 193],
|
|
1676
|
-
"lightsalmon": [255, 160, 122],
|
|
1677
|
-
"lightseagreen": [32, 178, 170],
|
|
1678
|
-
"lightskyblue": [135, 206, 250],
|
|
1679
|
-
"lightslategray": [119, 136, 153],
|
|
1680
|
-
"lightslategrey": [119, 136, 153],
|
|
1681
|
-
"lightsteelblue": [176, 196, 222],
|
|
1682
|
-
"lightyellow": [255, 255, 224],
|
|
1683
|
-
"lime": [0, 255, 0],
|
|
1684
|
-
"limegreen": [50, 205, 50],
|
|
1685
|
-
"linen": [250, 240, 230],
|
|
1686
|
-
"magenta": [255, 0, 255],
|
|
1687
|
-
"maroon": [128, 0, 0],
|
|
1688
|
-
"mediumaquamarine": [102, 205, 170],
|
|
1689
|
-
"mediumblue": [0, 0, 205],
|
|
1690
|
-
"mediumorchid": [186, 85, 211],
|
|
1691
|
-
"mediumpurple": [147, 112, 219],
|
|
1692
|
-
"mediumseagreen": [60, 179, 113],
|
|
1693
|
-
"mediumslateblue": [123, 104, 238],
|
|
1694
|
-
"mediumspringgreen": [0, 250, 154],
|
|
1695
|
-
"mediumturquoise": [72, 209, 204],
|
|
1696
|
-
"mediumvioletred": [199, 21, 133],
|
|
1697
|
-
"midnightblue": [25, 25, 112],
|
|
1698
|
-
"mintcream": [245, 255, 250],
|
|
1699
|
-
"mistyrose": [255, 228, 225],
|
|
1700
|
-
"moccasin": [255, 228, 181],
|
|
1701
|
-
"navajowhite": [255, 222, 173],
|
|
1702
|
-
"navy": [0, 0, 128],
|
|
1703
|
-
"oldlace": [253, 245, 230],
|
|
1704
|
-
"olive": [128, 128, 0],
|
|
1705
|
-
"olivedrab": [107, 142, 35],
|
|
1706
|
-
"orange": [255, 165, 0],
|
|
1707
|
-
"orangered": [255, 69, 0],
|
|
1708
|
-
"orchid": [218, 112, 214],
|
|
1709
|
-
"palegoldenrod": [238, 232, 170],
|
|
1710
|
-
"palegreen": [152, 251, 152],
|
|
1711
|
-
"paleturquoise": [175, 238, 238],
|
|
1712
|
-
"palevioletred": [219, 112, 147],
|
|
1713
|
-
"papayawhip": [255, 239, 213],
|
|
1714
|
-
"peachpuff": [255, 218, 185],
|
|
1715
|
-
"peru": [205, 133, 63],
|
|
1716
|
-
"pink": [255, 192, 203],
|
|
1717
|
-
"plum": [221, 160, 221],
|
|
1718
|
-
"powderblue": [176, 224, 230],
|
|
1719
|
-
"purple": [128, 0, 128],
|
|
1720
|
-
"rebeccapurple": [102, 51, 153],
|
|
1721
|
-
"red": [255, 0, 0],
|
|
1722
|
-
"rosybrown": [188, 143, 143],
|
|
1723
|
-
"royalblue": [65, 105, 225],
|
|
1724
|
-
"saddlebrown": [139, 69, 19],
|
|
1725
|
-
"salmon": [250, 128, 114],
|
|
1726
|
-
"sandybrown": [244, 164, 96],
|
|
1727
|
-
"seagreen": [46, 139, 87],
|
|
1728
|
-
"seashell": [255, 245, 238],
|
|
1729
|
-
"sienna": [160, 82, 45],
|
|
1730
|
-
"silver": [192, 192, 192],
|
|
1731
|
-
"skyblue": [135, 206, 235],
|
|
1732
|
-
"slateblue": [106, 90, 205],
|
|
1733
|
-
"slategray": [112, 128, 144],
|
|
1734
|
-
"slategrey": [112, 128, 144],
|
|
1735
|
-
"snow": [255, 250, 250],
|
|
1736
|
-
"springgreen": [0, 255, 127],
|
|
1737
|
-
"steelblue": [70, 130, 180],
|
|
1738
|
-
"tan": [210, 180, 140],
|
|
1739
|
-
"teal": [0, 128, 128],
|
|
1740
|
-
"thistle": [216, 191, 216],
|
|
1741
|
-
"tomato": [255, 99, 71],
|
|
1742
|
-
"turquoise": [64, 224, 208],
|
|
1743
|
-
"violet": [238, 130, 238],
|
|
1744
|
-
"wheat": [245, 222, 179],
|
|
1745
|
-
"white": [255, 255, 255],
|
|
1746
|
-
"whitesmoke": [245, 245, 245],
|
|
1747
|
-
"yellow": [255, 255, 0],
|
|
1748
|
-
"yellowgreen": [154, 205, 50]
|
|
1749
|
-
};
|
|
1750
|
-
return colorName$1;
|
|
1751
|
-
}
|
|
1752
|
-
var conversions$1;
|
|
1753
|
-
var hasRequiredConversions$1;
|
|
1754
|
-
function requireConversions$1() {
|
|
1755
|
-
if (hasRequiredConversions$1)
|
|
1756
|
-
return conversions$1;
|
|
1757
|
-
hasRequiredConversions$1 = 1;
|
|
1758
|
-
const cssKeywords = requireColorName$1();
|
|
1759
|
-
const reverseKeywords = {};
|
|
1760
|
-
for (const key of Object.keys(cssKeywords)) {
|
|
1761
|
-
reverseKeywords[cssKeywords[key]] = key;
|
|
1762
|
-
}
|
|
1763
|
-
const convert = {
|
|
1764
|
-
rgb: { channels: 3, labels: "rgb" },
|
|
1765
|
-
hsl: { channels: 3, labels: "hsl" },
|
|
1766
|
-
hsv: { channels: 3, labels: "hsv" },
|
|
1767
|
-
hwb: { channels: 3, labels: "hwb" },
|
|
1768
|
-
cmyk: { channels: 4, labels: "cmyk" },
|
|
1769
|
-
xyz: { channels: 3, labels: "xyz" },
|
|
1770
|
-
lab: { channels: 3, labels: "lab" },
|
|
1771
|
-
lch: { channels: 3, labels: "lch" },
|
|
1772
|
-
hex: { channels: 1, labels: ["hex"] },
|
|
1773
|
-
keyword: { channels: 1, labels: ["keyword"] },
|
|
1774
|
-
ansi16: { channels: 1, labels: ["ansi16"] },
|
|
1775
|
-
ansi256: { channels: 1, labels: ["ansi256"] },
|
|
1776
|
-
hcg: { channels: 3, labels: ["h", "c", "g"] },
|
|
1777
|
-
apple: { channels: 3, labels: ["r16", "g16", "b16"] },
|
|
1778
|
-
gray: { channels: 1, labels: ["gray"] }
|
|
1779
|
-
};
|
|
1780
|
-
conversions$1 = convert;
|
|
1781
|
-
for (const model of Object.keys(convert)) {
|
|
1782
|
-
if (!("channels" in convert[model])) {
|
|
1783
|
-
throw new Error("missing channels property: " + model);
|
|
1784
|
-
}
|
|
1785
|
-
if (!("labels" in convert[model])) {
|
|
1786
|
-
throw new Error("missing channel labels property: " + model);
|
|
1787
|
-
}
|
|
1788
|
-
if (convert[model].labels.length !== convert[model].channels) {
|
|
1789
|
-
throw new Error("channel and label counts mismatch: " + model);
|
|
1790
|
-
}
|
|
1791
|
-
const { channels, labels } = convert[model];
|
|
1792
|
-
delete convert[model].channels;
|
|
1793
|
-
delete convert[model].labels;
|
|
1794
|
-
Object.defineProperty(convert[model], "channels", { value: channels });
|
|
1795
|
-
Object.defineProperty(convert[model], "labels", { value: labels });
|
|
1796
|
-
}
|
|
1797
|
-
convert.rgb.hsl = function(rgb) {
|
|
1798
|
-
const r = rgb[0] / 255;
|
|
1799
|
-
const g = rgb[1] / 255;
|
|
1800
|
-
const b = rgb[2] / 255;
|
|
1801
|
-
const min = Math.min(r, g, b);
|
|
1802
|
-
const max = Math.max(r, g, b);
|
|
1803
|
-
const delta = max - min;
|
|
1804
|
-
let h;
|
|
1805
|
-
let s;
|
|
1806
|
-
if (max === min) {
|
|
1807
|
-
h = 0;
|
|
1808
|
-
} else if (r === max) {
|
|
1809
|
-
h = (g - b) / delta;
|
|
1810
|
-
} else if (g === max) {
|
|
1811
|
-
h = 2 + (b - r) / delta;
|
|
1812
|
-
} else if (b === max) {
|
|
1813
|
-
h = 4 + (r - g) / delta;
|
|
1814
|
-
}
|
|
1815
|
-
h = Math.min(h * 60, 360);
|
|
1816
|
-
if (h < 0) {
|
|
1817
|
-
h += 360;
|
|
1818
|
-
}
|
|
1819
|
-
const l = (min + max) / 2;
|
|
1820
|
-
if (max === min) {
|
|
1821
|
-
s = 0;
|
|
1822
|
-
} else if (l <= 0.5) {
|
|
1823
|
-
s = delta / (max + min);
|
|
1824
|
-
} else {
|
|
1825
|
-
s = delta / (2 - max - min);
|
|
1826
|
-
}
|
|
1827
|
-
return [h, s * 100, l * 100];
|
|
1828
|
-
};
|
|
1829
|
-
convert.rgb.hsv = function(rgb) {
|
|
1830
|
-
let rdif;
|
|
1831
|
-
let gdif;
|
|
1832
|
-
let bdif;
|
|
1833
|
-
let h;
|
|
1834
|
-
let s;
|
|
1835
|
-
const r = rgb[0] / 255;
|
|
1836
|
-
const g = rgb[1] / 255;
|
|
1837
|
-
const b = rgb[2] / 255;
|
|
1838
|
-
const v = Math.max(r, g, b);
|
|
1839
|
-
const diff = v - Math.min(r, g, b);
|
|
1840
|
-
const diffc = function(c) {
|
|
1841
|
-
return (v - c) / 6 / diff + 1 / 2;
|
|
1842
|
-
};
|
|
1843
|
-
if (diff === 0) {
|
|
1844
|
-
h = 0;
|
|
1845
|
-
s = 0;
|
|
1846
|
-
} else {
|
|
1847
|
-
s = diff / v;
|
|
1848
|
-
rdif = diffc(r);
|
|
1849
|
-
gdif = diffc(g);
|
|
1850
|
-
bdif = diffc(b);
|
|
1851
|
-
if (r === v) {
|
|
1852
|
-
h = bdif - gdif;
|
|
1853
|
-
} else if (g === v) {
|
|
1854
|
-
h = 1 / 3 + rdif - bdif;
|
|
1855
|
-
} else if (b === v) {
|
|
1856
|
-
h = 2 / 3 + gdif - rdif;
|
|
1857
|
-
}
|
|
1858
|
-
if (h < 0) {
|
|
1859
|
-
h += 1;
|
|
1860
|
-
} else if (h > 1) {
|
|
1861
|
-
h -= 1;
|
|
1862
|
-
}
|
|
1863
|
-
}
|
|
1864
|
-
return [
|
|
1865
|
-
h * 360,
|
|
1866
|
-
s * 100,
|
|
1867
|
-
v * 100
|
|
1868
|
-
];
|
|
1869
|
-
};
|
|
1870
|
-
convert.rgb.hwb = function(rgb) {
|
|
1871
|
-
const r = rgb[0];
|
|
1872
|
-
const g = rgb[1];
|
|
1873
|
-
let b = rgb[2];
|
|
1874
|
-
const h = convert.rgb.hsl(rgb)[0];
|
|
1875
|
-
const w = 1 / 255 * Math.min(r, Math.min(g, b));
|
|
1876
|
-
b = 1 - 1 / 255 * Math.max(r, Math.max(g, b));
|
|
1877
|
-
return [h, w * 100, b * 100];
|
|
1878
|
-
};
|
|
1879
|
-
convert.rgb.cmyk = function(rgb) {
|
|
1880
|
-
const r = rgb[0] / 255;
|
|
1881
|
-
const g = rgb[1] / 255;
|
|
1882
|
-
const b = rgb[2] / 255;
|
|
1883
|
-
const k = Math.min(1 - r, 1 - g, 1 - b);
|
|
1884
|
-
const c = (1 - r - k) / (1 - k) || 0;
|
|
1885
|
-
const m = (1 - g - k) / (1 - k) || 0;
|
|
1886
|
-
const y = (1 - b - k) / (1 - k) || 0;
|
|
1887
|
-
return [c * 100, m * 100, y * 100, k * 100];
|
|
1888
|
-
};
|
|
1889
|
-
function comparativeDistance(x, y) {
|
|
1890
|
-
return (x[0] - y[0]) ** 2 + (x[1] - y[1]) ** 2 + (x[2] - y[2]) ** 2;
|
|
1891
|
-
}
|
|
1892
|
-
convert.rgb.keyword = function(rgb) {
|
|
1893
|
-
const reversed = reverseKeywords[rgb];
|
|
1894
|
-
if (reversed) {
|
|
1895
|
-
return reversed;
|
|
1896
|
-
}
|
|
1897
|
-
let currentClosestDistance = Infinity;
|
|
1898
|
-
let currentClosestKeyword;
|
|
1899
|
-
for (const keyword of Object.keys(cssKeywords)) {
|
|
1900
|
-
const value = cssKeywords[keyword];
|
|
1901
|
-
const distance = comparativeDistance(rgb, value);
|
|
1902
|
-
if (distance < currentClosestDistance) {
|
|
1903
|
-
currentClosestDistance = distance;
|
|
1904
|
-
currentClosestKeyword = keyword;
|
|
1905
|
-
}
|
|
1906
|
-
}
|
|
1907
|
-
return currentClosestKeyword;
|
|
1908
|
-
};
|
|
1909
|
-
convert.keyword.rgb = function(keyword) {
|
|
1910
|
-
return cssKeywords[keyword];
|
|
1911
|
-
};
|
|
1912
|
-
convert.rgb.xyz = function(rgb) {
|
|
1913
|
-
let r = rgb[0] / 255;
|
|
1914
|
-
let g = rgb[1] / 255;
|
|
1915
|
-
let b = rgb[2] / 255;
|
|
1916
|
-
r = r > 0.04045 ? ((r + 0.055) / 1.055) ** 2.4 : r / 12.92;
|
|
1917
|
-
g = g > 0.04045 ? ((g + 0.055) / 1.055) ** 2.4 : g / 12.92;
|
|
1918
|
-
b = b > 0.04045 ? ((b + 0.055) / 1.055) ** 2.4 : b / 12.92;
|
|
1919
|
-
const x = r * 0.4124 + g * 0.3576 + b * 0.1805;
|
|
1920
|
-
const y = r * 0.2126 + g * 0.7152 + b * 0.0722;
|
|
1921
|
-
const z = r * 0.0193 + g * 0.1192 + b * 0.9505;
|
|
1922
|
-
return [x * 100, y * 100, z * 100];
|
|
1923
|
-
};
|
|
1924
|
-
convert.rgb.lab = function(rgb) {
|
|
1925
|
-
const xyz = convert.rgb.xyz(rgb);
|
|
1926
|
-
let x = xyz[0];
|
|
1927
|
-
let y = xyz[1];
|
|
1928
|
-
let z = xyz[2];
|
|
1929
|
-
x /= 95.047;
|
|
1930
|
-
y /= 100;
|
|
1931
|
-
z /= 108.883;
|
|
1932
|
-
x = x > 8856e-6 ? x ** (1 / 3) : 7.787 * x + 16 / 116;
|
|
1933
|
-
y = y > 8856e-6 ? y ** (1 / 3) : 7.787 * y + 16 / 116;
|
|
1934
|
-
z = z > 8856e-6 ? z ** (1 / 3) : 7.787 * z + 16 / 116;
|
|
1935
|
-
const l = 116 * y - 16;
|
|
1936
|
-
const a = 500 * (x - y);
|
|
1937
|
-
const b = 200 * (y - z);
|
|
1938
|
-
return [l, a, b];
|
|
1939
|
-
};
|
|
1940
|
-
convert.hsl.rgb = function(hsl) {
|
|
1941
|
-
const h = hsl[0] / 360;
|
|
1942
|
-
const s = hsl[1] / 100;
|
|
1943
|
-
const l = hsl[2] / 100;
|
|
1944
|
-
let t2;
|
|
1945
|
-
let t3;
|
|
1946
|
-
let val;
|
|
1947
|
-
if (s === 0) {
|
|
1948
|
-
val = l * 255;
|
|
1949
|
-
return [val, val, val];
|
|
1950
|
-
}
|
|
1951
|
-
if (l < 0.5) {
|
|
1952
|
-
t2 = l * (1 + s);
|
|
1953
|
-
} else {
|
|
1954
|
-
t2 = l + s - l * s;
|
|
1955
|
-
}
|
|
1956
|
-
const t1 = 2 * l - t2;
|
|
1957
|
-
const rgb = [0, 0, 0];
|
|
1958
|
-
for (let i = 0; i < 3; i++) {
|
|
1959
|
-
t3 = h + 1 / 3 * -(i - 1);
|
|
1960
|
-
if (t3 < 0) {
|
|
1961
|
-
t3++;
|
|
1962
|
-
}
|
|
1963
|
-
if (t3 > 1) {
|
|
1964
|
-
t3--;
|
|
1965
|
-
}
|
|
1966
|
-
if (6 * t3 < 1) {
|
|
1967
|
-
val = t1 + (t2 - t1) * 6 * t3;
|
|
1968
|
-
} else if (2 * t3 < 1) {
|
|
1969
|
-
val = t2;
|
|
1970
|
-
} else if (3 * t3 < 2) {
|
|
1971
|
-
val = t1 + (t2 - t1) * (2 / 3 - t3) * 6;
|
|
1972
|
-
} else {
|
|
1973
|
-
val = t1;
|
|
1974
|
-
}
|
|
1975
|
-
rgb[i] = val * 255;
|
|
1976
|
-
}
|
|
1977
|
-
return rgb;
|
|
1978
|
-
};
|
|
1979
|
-
convert.hsl.hsv = function(hsl) {
|
|
1980
|
-
const h = hsl[0];
|
|
1981
|
-
let s = hsl[1] / 100;
|
|
1982
|
-
let l = hsl[2] / 100;
|
|
1983
|
-
let smin = s;
|
|
1984
|
-
const lmin = Math.max(l, 0.01);
|
|
1985
|
-
l *= 2;
|
|
1986
|
-
s *= l <= 1 ? l : 2 - l;
|
|
1987
|
-
smin *= lmin <= 1 ? lmin : 2 - lmin;
|
|
1988
|
-
const v = (l + s) / 2;
|
|
1989
|
-
const sv = l === 0 ? 2 * smin / (lmin + smin) : 2 * s / (l + s);
|
|
1990
|
-
return [h, sv * 100, v * 100];
|
|
1991
|
-
};
|
|
1992
|
-
convert.hsv.rgb = function(hsv) {
|
|
1993
|
-
const h = hsv[0] / 60;
|
|
1994
|
-
const s = hsv[1] / 100;
|
|
1995
|
-
let v = hsv[2] / 100;
|
|
1996
|
-
const hi = Math.floor(h) % 6;
|
|
1997
|
-
const f = h - Math.floor(h);
|
|
1998
|
-
const p = 255 * v * (1 - s);
|
|
1999
|
-
const q = 255 * v * (1 - s * f);
|
|
2000
|
-
const t = 255 * v * (1 - s * (1 - f));
|
|
2001
|
-
v *= 255;
|
|
2002
|
-
switch (hi) {
|
|
2003
|
-
case 0:
|
|
2004
|
-
return [v, t, p];
|
|
2005
|
-
case 1:
|
|
2006
|
-
return [q, v, p];
|
|
2007
|
-
case 2:
|
|
2008
|
-
return [p, v, t];
|
|
2009
|
-
case 3:
|
|
2010
|
-
return [p, q, v];
|
|
2011
|
-
case 4:
|
|
2012
|
-
return [t, p, v];
|
|
2013
|
-
case 5:
|
|
2014
|
-
return [v, p, q];
|
|
2015
|
-
}
|
|
2016
|
-
};
|
|
2017
|
-
convert.hsv.hsl = function(hsv) {
|
|
2018
|
-
const h = hsv[0];
|
|
2019
|
-
const s = hsv[1] / 100;
|
|
2020
|
-
const v = hsv[2] / 100;
|
|
2021
|
-
const vmin = Math.max(v, 0.01);
|
|
2022
|
-
let sl;
|
|
2023
|
-
let l;
|
|
2024
|
-
l = (2 - s) * v;
|
|
2025
|
-
const lmin = (2 - s) * vmin;
|
|
2026
|
-
sl = s * vmin;
|
|
2027
|
-
sl /= lmin <= 1 ? lmin : 2 - lmin;
|
|
2028
|
-
sl = sl || 0;
|
|
2029
|
-
l /= 2;
|
|
2030
|
-
return [h, sl * 100, l * 100];
|
|
2031
|
-
};
|
|
2032
|
-
convert.hwb.rgb = function(hwb) {
|
|
2033
|
-
const h = hwb[0] / 360;
|
|
2034
|
-
let wh = hwb[1] / 100;
|
|
2035
|
-
let bl = hwb[2] / 100;
|
|
2036
|
-
const ratio = wh + bl;
|
|
2037
|
-
let f;
|
|
2038
|
-
if (ratio > 1) {
|
|
2039
|
-
wh /= ratio;
|
|
2040
|
-
bl /= ratio;
|
|
2041
|
-
}
|
|
2042
|
-
const i = Math.floor(6 * h);
|
|
2043
|
-
const v = 1 - bl;
|
|
2044
|
-
f = 6 * h - i;
|
|
2045
|
-
if ((i & 1) !== 0) {
|
|
2046
|
-
f = 1 - f;
|
|
2047
|
-
}
|
|
2048
|
-
const n = wh + f * (v - wh);
|
|
2049
|
-
let r;
|
|
2050
|
-
let g;
|
|
2051
|
-
let b;
|
|
2052
|
-
switch (i) {
|
|
2053
|
-
default:
|
|
2054
|
-
case 6:
|
|
2055
|
-
case 0:
|
|
2056
|
-
r = v;
|
|
2057
|
-
g = n;
|
|
2058
|
-
b = wh;
|
|
2059
|
-
break;
|
|
2060
|
-
case 1:
|
|
2061
|
-
r = n;
|
|
2062
|
-
g = v;
|
|
2063
|
-
b = wh;
|
|
2064
|
-
break;
|
|
2065
|
-
case 2:
|
|
2066
|
-
r = wh;
|
|
2067
|
-
g = v;
|
|
2068
|
-
b = n;
|
|
2069
|
-
break;
|
|
2070
|
-
case 3:
|
|
2071
|
-
r = wh;
|
|
2072
|
-
g = n;
|
|
2073
|
-
b = v;
|
|
2074
|
-
break;
|
|
2075
|
-
case 4:
|
|
2076
|
-
r = n;
|
|
2077
|
-
g = wh;
|
|
2078
|
-
b = v;
|
|
2079
|
-
break;
|
|
2080
|
-
case 5:
|
|
2081
|
-
r = v;
|
|
2082
|
-
g = wh;
|
|
2083
|
-
b = n;
|
|
2084
|
-
break;
|
|
2085
|
-
}
|
|
2086
|
-
return [r * 255, g * 255, b * 255];
|
|
2087
|
-
};
|
|
2088
|
-
convert.cmyk.rgb = function(cmyk) {
|
|
2089
|
-
const c = cmyk[0] / 100;
|
|
2090
|
-
const m = cmyk[1] / 100;
|
|
2091
|
-
const y = cmyk[2] / 100;
|
|
2092
|
-
const k = cmyk[3] / 100;
|
|
2093
|
-
const r = 1 - Math.min(1, c * (1 - k) + k);
|
|
2094
|
-
const g = 1 - Math.min(1, m * (1 - k) + k);
|
|
2095
|
-
const b = 1 - Math.min(1, y * (1 - k) + k);
|
|
2096
|
-
return [r * 255, g * 255, b * 255];
|
|
2097
|
-
};
|
|
2098
|
-
convert.xyz.rgb = function(xyz) {
|
|
2099
|
-
const x = xyz[0] / 100;
|
|
2100
|
-
const y = xyz[1] / 100;
|
|
2101
|
-
const z = xyz[2] / 100;
|
|
2102
|
-
let r;
|
|
2103
|
-
let g;
|
|
2104
|
-
let b;
|
|
2105
|
-
r = x * 3.2406 + y * -1.5372 + z * -0.4986;
|
|
2106
|
-
g = x * -0.9689 + y * 1.8758 + z * 0.0415;
|
|
2107
|
-
b = x * 0.0557 + y * -0.204 + z * 1.057;
|
|
2108
|
-
r = r > 31308e-7 ? 1.055 * r ** (1 / 2.4) - 0.055 : r * 12.92;
|
|
2109
|
-
g = g > 31308e-7 ? 1.055 * g ** (1 / 2.4) - 0.055 : g * 12.92;
|
|
2110
|
-
b = b > 31308e-7 ? 1.055 * b ** (1 / 2.4) - 0.055 : b * 12.92;
|
|
2111
|
-
r = Math.min(Math.max(0, r), 1);
|
|
2112
|
-
g = Math.min(Math.max(0, g), 1);
|
|
2113
|
-
b = Math.min(Math.max(0, b), 1);
|
|
2114
|
-
return [r * 255, g * 255, b * 255];
|
|
2115
|
-
};
|
|
2116
|
-
convert.xyz.lab = function(xyz) {
|
|
2117
|
-
let x = xyz[0];
|
|
2118
|
-
let y = xyz[1];
|
|
2119
|
-
let z = xyz[2];
|
|
2120
|
-
x /= 95.047;
|
|
2121
|
-
y /= 100;
|
|
2122
|
-
z /= 108.883;
|
|
2123
|
-
x = x > 8856e-6 ? x ** (1 / 3) : 7.787 * x + 16 / 116;
|
|
2124
|
-
y = y > 8856e-6 ? y ** (1 / 3) : 7.787 * y + 16 / 116;
|
|
2125
|
-
z = z > 8856e-6 ? z ** (1 / 3) : 7.787 * z + 16 / 116;
|
|
2126
|
-
const l = 116 * y - 16;
|
|
2127
|
-
const a = 500 * (x - y);
|
|
2128
|
-
const b = 200 * (y - z);
|
|
2129
|
-
return [l, a, b];
|
|
2130
|
-
};
|
|
2131
|
-
convert.lab.xyz = function(lab) {
|
|
2132
|
-
const l = lab[0];
|
|
2133
|
-
const a = lab[1];
|
|
2134
|
-
const b = lab[2];
|
|
2135
|
-
let x;
|
|
2136
|
-
let y;
|
|
2137
|
-
let z;
|
|
2138
|
-
y = (l + 16) / 116;
|
|
2139
|
-
x = a / 500 + y;
|
|
2140
|
-
z = y - b / 200;
|
|
2141
|
-
const y2 = y ** 3;
|
|
2142
|
-
const x2 = x ** 3;
|
|
2143
|
-
const z2 = z ** 3;
|
|
2144
|
-
y = y2 > 8856e-6 ? y2 : (y - 16 / 116) / 7.787;
|
|
2145
|
-
x = x2 > 8856e-6 ? x2 : (x - 16 / 116) / 7.787;
|
|
2146
|
-
z = z2 > 8856e-6 ? z2 : (z - 16 / 116) / 7.787;
|
|
2147
|
-
x *= 95.047;
|
|
2148
|
-
y *= 100;
|
|
2149
|
-
z *= 108.883;
|
|
2150
|
-
return [x, y, z];
|
|
2151
|
-
};
|
|
2152
|
-
convert.lab.lch = function(lab) {
|
|
2153
|
-
const l = lab[0];
|
|
2154
|
-
const a = lab[1];
|
|
2155
|
-
const b = lab[2];
|
|
2156
|
-
let h;
|
|
2157
|
-
const hr = Math.atan2(b, a);
|
|
2158
|
-
h = hr * 360 / 2 / Math.PI;
|
|
2159
|
-
if (h < 0) {
|
|
2160
|
-
h += 360;
|
|
2161
|
-
}
|
|
2162
|
-
const c = Math.sqrt(a * a + b * b);
|
|
2163
|
-
return [l, c, h];
|
|
2164
|
-
};
|
|
2165
|
-
convert.lch.lab = function(lch) {
|
|
2166
|
-
const l = lch[0];
|
|
2167
|
-
const c = lch[1];
|
|
2168
|
-
const h = lch[2];
|
|
2169
|
-
const hr = h / 360 * 2 * Math.PI;
|
|
2170
|
-
const a = c * Math.cos(hr);
|
|
2171
|
-
const b = c * Math.sin(hr);
|
|
2172
|
-
return [l, a, b];
|
|
2173
|
-
};
|
|
2174
|
-
convert.rgb.ansi16 = function(args, saturation = null) {
|
|
2175
|
-
const [r, g, b] = args;
|
|
2176
|
-
let value = saturation === null ? convert.rgb.hsv(args)[2] : saturation;
|
|
2177
|
-
value = Math.round(value / 50);
|
|
2178
|
-
if (value === 0) {
|
|
2179
|
-
return 30;
|
|
2180
|
-
}
|
|
2181
|
-
let ansi = 30 + (Math.round(b / 255) << 2 | Math.round(g / 255) << 1 | Math.round(r / 255));
|
|
2182
|
-
if (value === 2) {
|
|
2183
|
-
ansi += 60;
|
|
2184
|
-
}
|
|
2185
|
-
return ansi;
|
|
2186
|
-
};
|
|
2187
|
-
convert.hsv.ansi16 = function(args) {
|
|
2188
|
-
return convert.rgb.ansi16(convert.hsv.rgb(args), args[2]);
|
|
2189
|
-
};
|
|
2190
|
-
convert.rgb.ansi256 = function(args) {
|
|
2191
|
-
const r = args[0];
|
|
2192
|
-
const g = args[1];
|
|
2193
|
-
const b = args[2];
|
|
2194
|
-
if (r === g && g === b) {
|
|
2195
|
-
if (r < 8) {
|
|
2196
|
-
return 16;
|
|
2197
|
-
}
|
|
2198
|
-
if (r > 248) {
|
|
2199
|
-
return 231;
|
|
2200
|
-
}
|
|
2201
|
-
return Math.round((r - 8) / 247 * 24) + 232;
|
|
2202
|
-
}
|
|
2203
|
-
const ansi = 16 + 36 * Math.round(r / 255 * 5) + 6 * Math.round(g / 255 * 5) + Math.round(b / 255 * 5);
|
|
2204
|
-
return ansi;
|
|
2205
|
-
};
|
|
2206
|
-
convert.ansi16.rgb = function(args) {
|
|
2207
|
-
let color = args % 10;
|
|
2208
|
-
if (color === 0 || color === 7) {
|
|
2209
|
-
if (args > 50) {
|
|
2210
|
-
color += 3.5;
|
|
2211
|
-
}
|
|
2212
|
-
color = color / 10.5 * 255;
|
|
2213
|
-
return [color, color, color];
|
|
2214
|
-
}
|
|
2215
|
-
const mult = (~~(args > 50) + 1) * 0.5;
|
|
2216
|
-
const r = (color & 1) * mult * 255;
|
|
2217
|
-
const g = (color >> 1 & 1) * mult * 255;
|
|
2218
|
-
const b = (color >> 2 & 1) * mult * 255;
|
|
2219
|
-
return [r, g, b];
|
|
2220
|
-
};
|
|
2221
|
-
convert.ansi256.rgb = function(args) {
|
|
2222
|
-
if (args >= 232) {
|
|
2223
|
-
const c = (args - 232) * 10 + 8;
|
|
2224
|
-
return [c, c, c];
|
|
2225
|
-
}
|
|
2226
|
-
args -= 16;
|
|
2227
|
-
let rem;
|
|
2228
|
-
const r = Math.floor(args / 36) / 5 * 255;
|
|
2229
|
-
const g = Math.floor((rem = args % 36) / 6) / 5 * 255;
|
|
2230
|
-
const b = rem % 6 / 5 * 255;
|
|
2231
|
-
return [r, g, b];
|
|
2232
|
-
};
|
|
2233
|
-
convert.rgb.hex = function(args) {
|
|
2234
|
-
const integer = ((Math.round(args[0]) & 255) << 16) + ((Math.round(args[1]) & 255) << 8) + (Math.round(args[2]) & 255);
|
|
2235
|
-
const string = integer.toString(16).toUpperCase();
|
|
2236
|
-
return "000000".substring(string.length) + string;
|
|
2237
|
-
};
|
|
2238
|
-
convert.hex.rgb = function(args) {
|
|
2239
|
-
const match = args.toString(16).match(/[a-f0-9]{6}|[a-f0-9]{3}/i);
|
|
2240
|
-
if (!match) {
|
|
2241
|
-
return [0, 0, 0];
|
|
2242
|
-
}
|
|
2243
|
-
let colorString = match[0];
|
|
2244
|
-
if (match[0].length === 3) {
|
|
2245
|
-
colorString = colorString.split("").map((char) => {
|
|
2246
|
-
return char + char;
|
|
2247
|
-
}).join("");
|
|
2248
|
-
}
|
|
2249
|
-
const integer = parseInt(colorString, 16);
|
|
2250
|
-
const r = integer >> 16 & 255;
|
|
2251
|
-
const g = integer >> 8 & 255;
|
|
2252
|
-
const b = integer & 255;
|
|
2253
|
-
return [r, g, b];
|
|
2254
|
-
};
|
|
2255
|
-
convert.rgb.hcg = function(rgb) {
|
|
2256
|
-
const r = rgb[0] / 255;
|
|
2257
|
-
const g = rgb[1] / 255;
|
|
2258
|
-
const b = rgb[2] / 255;
|
|
2259
|
-
const max = Math.max(Math.max(r, g), b);
|
|
2260
|
-
const min = Math.min(Math.min(r, g), b);
|
|
2261
|
-
const chroma = max - min;
|
|
2262
|
-
let grayscale;
|
|
2263
|
-
let hue;
|
|
2264
|
-
if (chroma < 1) {
|
|
2265
|
-
grayscale = min / (1 - chroma);
|
|
2266
|
-
} else {
|
|
2267
|
-
grayscale = 0;
|
|
2268
|
-
}
|
|
2269
|
-
if (chroma <= 0) {
|
|
2270
|
-
hue = 0;
|
|
2271
|
-
} else if (max === r) {
|
|
2272
|
-
hue = (g - b) / chroma % 6;
|
|
2273
|
-
} else if (max === g) {
|
|
2274
|
-
hue = 2 + (b - r) / chroma;
|
|
2275
|
-
} else {
|
|
2276
|
-
hue = 4 + (r - g) / chroma;
|
|
2277
|
-
}
|
|
2278
|
-
hue /= 6;
|
|
2279
|
-
hue %= 1;
|
|
2280
|
-
return [hue * 360, chroma * 100, grayscale * 100];
|
|
2281
|
-
};
|
|
2282
|
-
convert.hsl.hcg = function(hsl) {
|
|
2283
|
-
const s = hsl[1] / 100;
|
|
2284
|
-
const l = hsl[2] / 100;
|
|
2285
|
-
const c = l < 0.5 ? 2 * s * l : 2 * s * (1 - l);
|
|
2286
|
-
let f = 0;
|
|
2287
|
-
if (c < 1) {
|
|
2288
|
-
f = (l - 0.5 * c) / (1 - c);
|
|
2289
|
-
}
|
|
2290
|
-
return [hsl[0], c * 100, f * 100];
|
|
2291
|
-
};
|
|
2292
|
-
convert.hsv.hcg = function(hsv) {
|
|
2293
|
-
const s = hsv[1] / 100;
|
|
2294
|
-
const v = hsv[2] / 100;
|
|
2295
|
-
const c = s * v;
|
|
2296
|
-
let f = 0;
|
|
2297
|
-
if (c < 1) {
|
|
2298
|
-
f = (v - c) / (1 - c);
|
|
2299
|
-
}
|
|
2300
|
-
return [hsv[0], c * 100, f * 100];
|
|
2301
|
-
};
|
|
2302
|
-
convert.hcg.rgb = function(hcg) {
|
|
2303
|
-
const h = hcg[0] / 360;
|
|
2304
|
-
const c = hcg[1] / 100;
|
|
2305
|
-
const g = hcg[2] / 100;
|
|
2306
|
-
if (c === 0) {
|
|
2307
|
-
return [g * 255, g * 255, g * 255];
|
|
2308
|
-
}
|
|
2309
|
-
const pure = [0, 0, 0];
|
|
2310
|
-
const hi = h % 1 * 6;
|
|
2311
|
-
const v = hi % 1;
|
|
2312
|
-
const w = 1 - v;
|
|
2313
|
-
let mg = 0;
|
|
2314
|
-
switch (Math.floor(hi)) {
|
|
2315
|
-
case 0:
|
|
2316
|
-
pure[0] = 1;
|
|
2317
|
-
pure[1] = v;
|
|
2318
|
-
pure[2] = 0;
|
|
2319
|
-
break;
|
|
2320
|
-
case 1:
|
|
2321
|
-
pure[0] = w;
|
|
2322
|
-
pure[1] = 1;
|
|
2323
|
-
pure[2] = 0;
|
|
2324
|
-
break;
|
|
2325
|
-
case 2:
|
|
2326
|
-
pure[0] = 0;
|
|
2327
|
-
pure[1] = 1;
|
|
2328
|
-
pure[2] = v;
|
|
2329
|
-
break;
|
|
2330
|
-
case 3:
|
|
2331
|
-
pure[0] = 0;
|
|
2332
|
-
pure[1] = w;
|
|
2333
|
-
pure[2] = 1;
|
|
2334
|
-
break;
|
|
2335
|
-
case 4:
|
|
2336
|
-
pure[0] = v;
|
|
2337
|
-
pure[1] = 0;
|
|
2338
|
-
pure[2] = 1;
|
|
2339
|
-
break;
|
|
2340
|
-
default:
|
|
2341
|
-
pure[0] = 1;
|
|
2342
|
-
pure[1] = 0;
|
|
2343
|
-
pure[2] = w;
|
|
2344
|
-
}
|
|
2345
|
-
mg = (1 - c) * g;
|
|
2346
|
-
return [
|
|
2347
|
-
(c * pure[0] + mg) * 255,
|
|
2348
|
-
(c * pure[1] + mg) * 255,
|
|
2349
|
-
(c * pure[2] + mg) * 255
|
|
2350
|
-
];
|
|
2351
|
-
};
|
|
2352
|
-
convert.hcg.hsv = function(hcg) {
|
|
2353
|
-
const c = hcg[1] / 100;
|
|
2354
|
-
const g = hcg[2] / 100;
|
|
2355
|
-
const v = c + g * (1 - c);
|
|
2356
|
-
let f = 0;
|
|
2357
|
-
if (v > 0) {
|
|
2358
|
-
f = c / v;
|
|
2359
|
-
}
|
|
2360
|
-
return [hcg[0], f * 100, v * 100];
|
|
2361
|
-
};
|
|
2362
|
-
convert.hcg.hsl = function(hcg) {
|
|
2363
|
-
const c = hcg[1] / 100;
|
|
2364
|
-
const g = hcg[2] / 100;
|
|
2365
|
-
const l = g * (1 - c) + 0.5 * c;
|
|
2366
|
-
let s = 0;
|
|
2367
|
-
if (l > 0 && l < 0.5) {
|
|
2368
|
-
s = c / (2 * l);
|
|
2369
|
-
} else if (l >= 0.5 && l < 1) {
|
|
2370
|
-
s = c / (2 * (1 - l));
|
|
2371
|
-
}
|
|
2372
|
-
return [hcg[0], s * 100, l * 100];
|
|
2373
|
-
};
|
|
2374
|
-
convert.hcg.hwb = function(hcg) {
|
|
2375
|
-
const c = hcg[1] / 100;
|
|
2376
|
-
const g = hcg[2] / 100;
|
|
2377
|
-
const v = c + g * (1 - c);
|
|
2378
|
-
return [hcg[0], (v - c) * 100, (1 - v) * 100];
|
|
2379
|
-
};
|
|
2380
|
-
convert.hwb.hcg = function(hwb) {
|
|
2381
|
-
const w = hwb[1] / 100;
|
|
2382
|
-
const b = hwb[2] / 100;
|
|
2383
|
-
const v = 1 - b;
|
|
2384
|
-
const c = v - w;
|
|
2385
|
-
let g = 0;
|
|
2386
|
-
if (c < 1) {
|
|
2387
|
-
g = (v - c) / (1 - c);
|
|
2388
|
-
}
|
|
2389
|
-
return [hwb[0], c * 100, g * 100];
|
|
2390
|
-
};
|
|
2391
|
-
convert.apple.rgb = function(apple) {
|
|
2392
|
-
return [apple[0] / 65535 * 255, apple[1] / 65535 * 255, apple[2] / 65535 * 255];
|
|
2393
|
-
};
|
|
2394
|
-
convert.rgb.apple = function(rgb) {
|
|
2395
|
-
return [rgb[0] / 255 * 65535, rgb[1] / 255 * 65535, rgb[2] / 255 * 65535];
|
|
2396
|
-
};
|
|
2397
|
-
convert.gray.rgb = function(args) {
|
|
2398
|
-
return [args[0] / 100 * 255, args[0] / 100 * 255, args[0] / 100 * 255];
|
|
2399
|
-
};
|
|
2400
|
-
convert.gray.hsl = function(args) {
|
|
2401
|
-
return [0, 0, args[0]];
|
|
2402
|
-
};
|
|
2403
|
-
convert.gray.hsv = convert.gray.hsl;
|
|
2404
|
-
convert.gray.hwb = function(gray) {
|
|
2405
|
-
return [0, 100, gray[0]];
|
|
2406
|
-
};
|
|
2407
|
-
convert.gray.cmyk = function(gray) {
|
|
2408
|
-
return [0, 0, 0, gray[0]];
|
|
2409
|
-
};
|
|
2410
|
-
convert.gray.lab = function(gray) {
|
|
2411
|
-
return [gray[0], 0, 0];
|
|
2412
|
-
};
|
|
2413
|
-
convert.gray.hex = function(gray) {
|
|
2414
|
-
const val = Math.round(gray[0] / 100 * 255) & 255;
|
|
2415
|
-
const integer = (val << 16) + (val << 8) + val;
|
|
2416
|
-
const string = integer.toString(16).toUpperCase();
|
|
2417
|
-
return "000000".substring(string.length) + string;
|
|
2418
|
-
};
|
|
2419
|
-
convert.rgb.gray = function(rgb) {
|
|
2420
|
-
const val = (rgb[0] + rgb[1] + rgb[2]) / 3;
|
|
2421
|
-
return [val / 255 * 100];
|
|
2422
|
-
};
|
|
2423
|
-
return conversions$1;
|
|
2424
|
-
}
|
|
2425
|
-
var route$1;
|
|
2426
|
-
var hasRequiredRoute$1;
|
|
2427
|
-
function requireRoute$1() {
|
|
2428
|
-
if (hasRequiredRoute$1)
|
|
2429
|
-
return route$1;
|
|
2430
|
-
hasRequiredRoute$1 = 1;
|
|
2431
|
-
const conversions2 = requireConversions$1();
|
|
2432
|
-
function buildGraph() {
|
|
2433
|
-
const graph = {};
|
|
2434
|
-
const models = Object.keys(conversions2);
|
|
2435
|
-
for (let len = models.length, i = 0; i < len; i++) {
|
|
2436
|
-
graph[models[i]] = {
|
|
2437
|
-
// http://jsperf.com/1-vs-infinity
|
|
2438
|
-
// micro-opt, but this is simple.
|
|
2439
|
-
distance: -1,
|
|
2440
|
-
parent: null
|
|
2441
|
-
};
|
|
2442
|
-
}
|
|
2443
|
-
return graph;
|
|
2444
|
-
}
|
|
2445
|
-
function deriveBFS(fromModel) {
|
|
2446
|
-
const graph = buildGraph();
|
|
2447
|
-
const queue = [fromModel];
|
|
2448
|
-
graph[fromModel].distance = 0;
|
|
2449
|
-
while (queue.length) {
|
|
2450
|
-
const current = queue.pop();
|
|
2451
|
-
const adjacents = Object.keys(conversions2[current]);
|
|
2452
|
-
for (let len = adjacents.length, i = 0; i < len; i++) {
|
|
2453
|
-
const adjacent = adjacents[i];
|
|
2454
|
-
const node = graph[adjacent];
|
|
2455
|
-
if (node.distance === -1) {
|
|
2456
|
-
node.distance = graph[current].distance + 1;
|
|
2457
|
-
node.parent = current;
|
|
2458
|
-
queue.unshift(adjacent);
|
|
2459
|
-
}
|
|
2460
|
-
}
|
|
2461
|
-
}
|
|
2462
|
-
return graph;
|
|
2463
|
-
}
|
|
2464
|
-
function link(from, to) {
|
|
2465
|
-
return function(args) {
|
|
2466
|
-
return to(from(args));
|
|
2467
|
-
};
|
|
2468
|
-
}
|
|
2469
|
-
function wrapConversion(toModel, graph) {
|
|
2470
|
-
const path = [graph[toModel].parent, toModel];
|
|
2471
|
-
let fn = conversions2[graph[toModel].parent][toModel];
|
|
2472
|
-
let cur = graph[toModel].parent;
|
|
2473
|
-
while (graph[cur].parent) {
|
|
2474
|
-
path.unshift(graph[cur].parent);
|
|
2475
|
-
fn = link(conversions2[graph[cur].parent][cur], fn);
|
|
2476
|
-
cur = graph[cur].parent;
|
|
2477
|
-
}
|
|
2478
|
-
fn.conversion = path;
|
|
2479
|
-
return fn;
|
|
2480
|
-
}
|
|
2481
|
-
route$1 = function(fromModel) {
|
|
2482
|
-
const graph = deriveBFS(fromModel);
|
|
2483
|
-
const conversion = {};
|
|
2484
|
-
const models = Object.keys(graph);
|
|
2485
|
-
for (let len = models.length, i = 0; i < len; i++) {
|
|
2486
|
-
const toModel = models[i];
|
|
2487
|
-
const node = graph[toModel];
|
|
2488
|
-
if (node.parent === null) {
|
|
2489
|
-
continue;
|
|
2490
|
-
}
|
|
2491
|
-
conversion[toModel] = wrapConversion(toModel, graph);
|
|
2492
|
-
}
|
|
2493
|
-
return conversion;
|
|
2494
|
-
};
|
|
2495
|
-
return route$1;
|
|
2496
|
-
}
|
|
2497
|
-
var colorConvert$1;
|
|
2498
|
-
var hasRequiredColorConvert$1;
|
|
2499
|
-
function requireColorConvert$1() {
|
|
2500
|
-
if (hasRequiredColorConvert$1)
|
|
2501
|
-
return colorConvert$1;
|
|
2502
|
-
hasRequiredColorConvert$1 = 1;
|
|
2503
|
-
const conversions2 = requireConversions$1();
|
|
2504
|
-
const route2 = requireRoute$1();
|
|
2505
|
-
const convert = {};
|
|
2506
|
-
const models = Object.keys(conversions2);
|
|
2507
|
-
function wrapRaw(fn) {
|
|
2508
|
-
const wrappedFn = function(...args) {
|
|
2509
|
-
const arg0 = args[0];
|
|
2510
|
-
if (arg0 === void 0 || arg0 === null) {
|
|
2511
|
-
return arg0;
|
|
2512
|
-
}
|
|
2513
|
-
if (arg0.length > 1) {
|
|
2514
|
-
args = arg0;
|
|
2515
|
-
}
|
|
2516
|
-
return fn(args);
|
|
2517
|
-
};
|
|
2518
|
-
if ("conversion" in fn) {
|
|
2519
|
-
wrappedFn.conversion = fn.conversion;
|
|
2520
|
-
}
|
|
2521
|
-
return wrappedFn;
|
|
2522
|
-
}
|
|
2523
|
-
function wrapRounded(fn) {
|
|
2524
|
-
const wrappedFn = function(...args) {
|
|
2525
|
-
const arg0 = args[0];
|
|
2526
|
-
if (arg0 === void 0 || arg0 === null) {
|
|
2527
|
-
return arg0;
|
|
2528
|
-
}
|
|
2529
|
-
if (arg0.length > 1) {
|
|
2530
|
-
args = arg0;
|
|
2531
|
-
}
|
|
2532
|
-
const result = fn(args);
|
|
2533
|
-
if (typeof result === "object") {
|
|
2534
|
-
for (let len = result.length, i = 0; i < len; i++) {
|
|
2535
|
-
result[i] = Math.round(result[i]);
|
|
2536
|
-
}
|
|
2537
|
-
}
|
|
2538
|
-
return result;
|
|
2539
|
-
};
|
|
2540
|
-
if ("conversion" in fn) {
|
|
2541
|
-
wrappedFn.conversion = fn.conversion;
|
|
2542
|
-
}
|
|
2543
|
-
return wrappedFn;
|
|
2544
|
-
}
|
|
2545
|
-
models.forEach((fromModel) => {
|
|
2546
|
-
convert[fromModel] = {};
|
|
2547
|
-
Object.defineProperty(convert[fromModel], "channels", { value: conversions2[fromModel].channels });
|
|
2548
|
-
Object.defineProperty(convert[fromModel], "labels", { value: conversions2[fromModel].labels });
|
|
2549
|
-
const routes = route2(fromModel);
|
|
2550
|
-
const routeModels = Object.keys(routes);
|
|
2551
|
-
routeModels.forEach((toModel) => {
|
|
2552
|
-
const fn = routes[toModel];
|
|
2553
|
-
convert[fromModel][toModel] = wrapRounded(fn);
|
|
2554
|
-
convert[fromModel][toModel].raw = wrapRaw(fn);
|
|
2555
|
-
});
|
|
2556
|
-
});
|
|
2557
|
-
colorConvert$1 = convert;
|
|
2558
|
-
return colorConvert$1;
|
|
2559
|
-
}
|
|
2560
|
-
ansiStyles$1$1.exports;
|
|
2561
|
-
(function(module) {
|
|
2562
|
-
const wrapAnsi16 = (fn, offset) => (...args) => {
|
|
2563
|
-
const code = fn(...args);
|
|
2564
|
-
return `\x1B[${code + offset}m`;
|
|
2565
|
-
};
|
|
2566
|
-
const wrapAnsi256 = (fn, offset) => (...args) => {
|
|
2567
|
-
const code = fn(...args);
|
|
2568
|
-
return `\x1B[${38 + offset};5;${code}m`;
|
|
2569
|
-
};
|
|
2570
|
-
const wrapAnsi16m = (fn, offset) => (...args) => {
|
|
2571
|
-
const rgb = fn(...args);
|
|
2572
|
-
return `\x1B[${38 + offset};2;${rgb[0]};${rgb[1]};${rgb[2]}m`;
|
|
2573
|
-
};
|
|
2574
|
-
const ansi2ansi = (n) => n;
|
|
2575
|
-
const rgb2rgb = (r, g, b) => [r, g, b];
|
|
2576
|
-
const setLazyProperty = (object, property, get) => {
|
|
2577
|
-
Object.defineProperty(object, property, {
|
|
2578
|
-
get: () => {
|
|
2579
|
-
const value = get();
|
|
2580
|
-
Object.defineProperty(object, property, {
|
|
2581
|
-
value,
|
|
2582
|
-
enumerable: true,
|
|
2583
|
-
configurable: true
|
|
2584
|
-
});
|
|
2585
|
-
return value;
|
|
2586
|
-
},
|
|
2587
|
-
enumerable: true,
|
|
2588
|
-
configurable: true
|
|
2589
|
-
});
|
|
2590
|
-
};
|
|
2591
|
-
let colorConvert2;
|
|
2592
|
-
const makeDynamicStyles = (wrap, targetSpace, identity, isBackground) => {
|
|
2593
|
-
if (colorConvert2 === void 0) {
|
|
2594
|
-
colorConvert2 = requireColorConvert$1();
|
|
2595
|
-
}
|
|
2596
|
-
const offset = isBackground ? 10 : 0;
|
|
2597
|
-
const styles2 = {};
|
|
2598
|
-
for (const [sourceSpace, suite] of Object.entries(colorConvert2)) {
|
|
2599
|
-
const name = sourceSpace === "ansi16" ? "ansi" : sourceSpace;
|
|
2600
|
-
if (sourceSpace === targetSpace) {
|
|
2601
|
-
styles2[name] = wrap(identity, offset);
|
|
2602
|
-
} else if (typeof suite === "object") {
|
|
2603
|
-
styles2[name] = wrap(suite[targetSpace], offset);
|
|
2604
|
-
}
|
|
2605
|
-
}
|
|
2606
|
-
return styles2;
|
|
2607
|
-
};
|
|
2608
|
-
function assembleStyles() {
|
|
2609
|
-
const codes = /* @__PURE__ */ new Map();
|
|
2610
|
-
const styles2 = {
|
|
2611
|
-
modifier: {
|
|
2612
|
-
reset: [0, 0],
|
|
2613
|
-
// 21 isn't widely supported and 22 does the same thing
|
|
2614
|
-
bold: [1, 22],
|
|
2615
|
-
dim: [2, 22],
|
|
2616
|
-
italic: [3, 23],
|
|
2617
|
-
underline: [4, 24],
|
|
2618
|
-
inverse: [7, 27],
|
|
2619
|
-
hidden: [8, 28],
|
|
2620
|
-
strikethrough: [9, 29]
|
|
2621
|
-
},
|
|
2622
|
-
color: {
|
|
2623
|
-
black: [30, 39],
|
|
2624
|
-
red: [31, 39],
|
|
2625
|
-
green: [32, 39],
|
|
2626
|
-
yellow: [33, 39],
|
|
2627
|
-
blue: [34, 39],
|
|
2628
|
-
magenta: [35, 39],
|
|
2629
|
-
cyan: [36, 39],
|
|
2630
|
-
white: [37, 39],
|
|
2631
|
-
// Bright color
|
|
2632
|
-
blackBright: [90, 39],
|
|
2633
|
-
redBright: [91, 39],
|
|
2634
|
-
greenBright: [92, 39],
|
|
2635
|
-
yellowBright: [93, 39],
|
|
2636
|
-
blueBright: [94, 39],
|
|
2637
|
-
magentaBright: [95, 39],
|
|
2638
|
-
cyanBright: [96, 39],
|
|
2639
|
-
whiteBright: [97, 39]
|
|
2640
|
-
},
|
|
2641
|
-
bgColor: {
|
|
2642
|
-
bgBlack: [40, 49],
|
|
2643
|
-
bgRed: [41, 49],
|
|
2644
|
-
bgGreen: [42, 49],
|
|
2645
|
-
bgYellow: [43, 49],
|
|
2646
|
-
bgBlue: [44, 49],
|
|
2647
|
-
bgMagenta: [45, 49],
|
|
2648
|
-
bgCyan: [46, 49],
|
|
2649
|
-
bgWhite: [47, 49],
|
|
2650
|
-
// Bright color
|
|
2651
|
-
bgBlackBright: [100, 49],
|
|
2652
|
-
bgRedBright: [101, 49],
|
|
2653
|
-
bgGreenBright: [102, 49],
|
|
2654
|
-
bgYellowBright: [103, 49],
|
|
2655
|
-
bgBlueBright: [104, 49],
|
|
2656
|
-
bgMagentaBright: [105, 49],
|
|
2657
|
-
bgCyanBright: [106, 49],
|
|
2658
|
-
bgWhiteBright: [107, 49]
|
|
2659
|
-
}
|
|
2660
|
-
};
|
|
2661
|
-
styles2.color.gray = styles2.color.blackBright;
|
|
2662
|
-
styles2.bgColor.bgGray = styles2.bgColor.bgBlackBright;
|
|
2663
|
-
styles2.color.grey = styles2.color.blackBright;
|
|
2664
|
-
styles2.bgColor.bgGrey = styles2.bgColor.bgBlackBright;
|
|
2665
|
-
for (const [groupName, group] of Object.entries(styles2)) {
|
|
2666
|
-
for (const [styleName, style] of Object.entries(group)) {
|
|
2667
|
-
styles2[styleName] = {
|
|
2668
|
-
open: `\x1B[${style[0]}m`,
|
|
2669
|
-
close: `\x1B[${style[1]}m`
|
|
2670
|
-
};
|
|
2671
|
-
group[styleName] = styles2[styleName];
|
|
2672
|
-
codes.set(style[0], style[1]);
|
|
2673
|
-
}
|
|
2674
|
-
Object.defineProperty(styles2, groupName, {
|
|
2675
|
-
value: group,
|
|
2676
|
-
enumerable: false
|
|
2677
|
-
});
|
|
2678
|
-
}
|
|
2679
|
-
Object.defineProperty(styles2, "codes", {
|
|
2680
|
-
value: codes,
|
|
2681
|
-
enumerable: false
|
|
2682
|
-
});
|
|
2683
|
-
styles2.color.close = "\x1B[39m";
|
|
2684
|
-
styles2.bgColor.close = "\x1B[49m";
|
|
2685
|
-
setLazyProperty(styles2.color, "ansi", () => makeDynamicStyles(wrapAnsi16, "ansi16", ansi2ansi, false));
|
|
2686
|
-
setLazyProperty(styles2.color, "ansi256", () => makeDynamicStyles(wrapAnsi256, "ansi256", ansi2ansi, false));
|
|
2687
|
-
setLazyProperty(styles2.color, "ansi16m", () => makeDynamicStyles(wrapAnsi16m, "rgb", rgb2rgb, false));
|
|
2688
|
-
setLazyProperty(styles2.bgColor, "ansi", () => makeDynamicStyles(wrapAnsi16, "ansi16", ansi2ansi, true));
|
|
2689
|
-
setLazyProperty(styles2.bgColor, "ansi256", () => makeDynamicStyles(wrapAnsi256, "ansi256", ansi2ansi, true));
|
|
2690
|
-
setLazyProperty(styles2.bgColor, "ansi16m", () => makeDynamicStyles(wrapAnsi16m, "rgb", rgb2rgb, true));
|
|
2691
|
-
return styles2;
|
|
2692
|
-
}
|
|
2693
|
-
Object.defineProperty(module, "exports", {
|
|
2694
|
-
enumerable: true,
|
|
2695
|
-
get: assembleStyles
|
|
2696
|
-
});
|
|
2697
|
-
})(ansiStyles$1$1);
|
|
2698
|
-
var ansiStylesExports$1 = ansiStyles$1$1.exports;
|
|
2699
|
-
var browser$1 = {
|
|
2700
|
-
stdout: false,
|
|
2701
|
-
stderr: false
|
|
2702
|
-
};
|
|
2703
|
-
const stringReplaceAll$1$1 = (string, substring, replacer) => {
|
|
2704
|
-
let index = string.indexOf(substring);
|
|
2705
|
-
if (index === -1) {
|
|
2706
|
-
return string;
|
|
2707
|
-
}
|
|
2708
|
-
const substringLength = substring.length;
|
|
2709
|
-
let endIndex = 0;
|
|
2710
|
-
let returnValue = "";
|
|
2711
|
-
do {
|
|
2712
|
-
returnValue += string.substr(endIndex, index - endIndex) + substring + replacer;
|
|
2713
|
-
endIndex = index + substringLength;
|
|
2714
|
-
index = string.indexOf(substring, endIndex);
|
|
2715
|
-
} while (index !== -1);
|
|
2716
|
-
returnValue += string.substr(endIndex);
|
|
2717
|
-
return returnValue;
|
|
2718
|
-
};
|
|
2719
|
-
const stringEncaseCRLFWithFirstIndex$1$1 = (string, prefix, postfix, index) => {
|
|
2720
|
-
let endIndex = 0;
|
|
2721
|
-
let returnValue = "";
|
|
2722
|
-
do {
|
|
2723
|
-
const gotCR = string[index - 1] === "\r";
|
|
2724
|
-
returnValue += string.substr(endIndex, (gotCR ? index - 1 : index) - endIndex) + prefix + (gotCR ? "\r\n" : "\n") + postfix;
|
|
2725
|
-
endIndex = index + 1;
|
|
2726
|
-
index = string.indexOf("\n", endIndex);
|
|
2727
|
-
} while (index !== -1);
|
|
2728
|
-
returnValue += string.substr(endIndex);
|
|
2729
|
-
return returnValue;
|
|
2730
|
-
};
|
|
2731
|
-
var util$1 = {
|
|
2732
|
-
stringReplaceAll: stringReplaceAll$1$1,
|
|
2733
|
-
stringEncaseCRLFWithFirstIndex: stringEncaseCRLFWithFirstIndex$1$1
|
|
2734
|
-
};
|
|
2735
|
-
var templates$1;
|
|
2736
|
-
var hasRequiredTemplates$1;
|
|
2737
|
-
function requireTemplates$1() {
|
|
2738
|
-
if (hasRequiredTemplates$1)
|
|
2739
|
-
return templates$1;
|
|
2740
|
-
hasRequiredTemplates$1 = 1;
|
|
2741
|
-
const TEMPLATE_REGEX = /(?:\\(u(?:[a-f\d]{4}|\{[a-f\d]{1,6}\})|x[a-f\d]{2}|.))|(?:\{(~)?(\w+(?:\([^)]*\))?(?:\.\w+(?:\([^)]*\))?)*)(?:[ \t]|(?=\r?\n)))|(\})|((?:.|[\r\n\f])+?)/gi;
|
|
2742
|
-
const STYLE_REGEX = /(?:^|\.)(\w+)(?:\(([^)]*)\))?/g;
|
|
2743
|
-
const STRING_REGEX = /^(['"])((?:\\.|(?!\1)[^\\])*)\1$/;
|
|
2744
|
-
const ESCAPE_REGEX = /\\(u(?:[a-f\d]{4}|{[a-f\d]{1,6}})|x[a-f\d]{2}|.)|([^\\])/gi;
|
|
2745
|
-
const ESCAPES = /* @__PURE__ */ new Map([
|
|
2746
|
-
["n", "\n"],
|
|
2747
|
-
["r", "\r"],
|
|
2748
|
-
["t", " "],
|
|
2749
|
-
["b", "\b"],
|
|
2750
|
-
["f", "\f"],
|
|
2751
|
-
["v", "\v"],
|
|
2752
|
-
["0", "\0"],
|
|
2753
|
-
["\\", "\\"],
|
|
2754
|
-
["e", "\x1B"],
|
|
2755
|
-
["a", "\x07"]
|
|
2756
|
-
]);
|
|
2757
|
-
function unescape(c) {
|
|
2758
|
-
const u = c[0] === "u";
|
|
2759
|
-
const bracket = c[1] === "{";
|
|
2760
|
-
if (u && !bracket && c.length === 5 || c[0] === "x" && c.length === 3) {
|
|
2761
|
-
return String.fromCharCode(parseInt(c.slice(1), 16));
|
|
2762
|
-
}
|
|
2763
|
-
if (u && bracket) {
|
|
2764
|
-
return String.fromCodePoint(parseInt(c.slice(2, -1), 16));
|
|
2765
|
-
}
|
|
2766
|
-
return ESCAPES.get(c) || c;
|
|
2767
|
-
}
|
|
2768
|
-
function parseArguments(name, arguments_) {
|
|
2769
|
-
const results = [];
|
|
2770
|
-
const chunks = arguments_.trim().split(/\s*,\s*/g);
|
|
2771
|
-
let matches;
|
|
2772
|
-
for (const chunk of chunks) {
|
|
2773
|
-
const number = Number(chunk);
|
|
2774
|
-
if (!Number.isNaN(number)) {
|
|
2775
|
-
results.push(number);
|
|
2776
|
-
} else if (matches = chunk.match(STRING_REGEX)) {
|
|
2777
|
-
results.push(matches[2].replace(ESCAPE_REGEX, (m, escape2, character) => escape2 ? unescape(escape2) : character));
|
|
2778
|
-
} else {
|
|
2779
|
-
throw new Error(`Invalid Chalk template style argument: ${chunk} (in style '${name}')`);
|
|
2780
|
-
}
|
|
2781
|
-
}
|
|
2782
|
-
return results;
|
|
2783
|
-
}
|
|
2784
|
-
function parseStyle(style) {
|
|
2785
|
-
STYLE_REGEX.lastIndex = 0;
|
|
2786
|
-
const results = [];
|
|
2787
|
-
let matches;
|
|
2788
|
-
while ((matches = STYLE_REGEX.exec(style)) !== null) {
|
|
2789
|
-
const name = matches[1];
|
|
2790
|
-
if (matches[2]) {
|
|
2791
|
-
const args = parseArguments(name, matches[2]);
|
|
2792
|
-
results.push([name].concat(args));
|
|
2793
|
-
} else {
|
|
2794
|
-
results.push([name]);
|
|
2795
|
-
}
|
|
2796
|
-
}
|
|
2797
|
-
return results;
|
|
2798
|
-
}
|
|
2799
|
-
function buildStyle(chalk2, styles2) {
|
|
2800
|
-
const enabled = {};
|
|
2801
|
-
for (const layer of styles2) {
|
|
2802
|
-
for (const style of layer.styles) {
|
|
2803
|
-
enabled[style[0]] = layer.inverse ? null : style.slice(1);
|
|
2804
|
-
}
|
|
2805
|
-
}
|
|
2806
|
-
let current = chalk2;
|
|
2807
|
-
for (const [styleName, styles3] of Object.entries(enabled)) {
|
|
2808
|
-
if (!Array.isArray(styles3)) {
|
|
2809
|
-
continue;
|
|
2810
|
-
}
|
|
2811
|
-
if (!(styleName in current)) {
|
|
2812
|
-
throw new Error(`Unknown Chalk style: ${styleName}`);
|
|
2813
|
-
}
|
|
2814
|
-
current = styles3.length > 0 ? current[styleName](...styles3) : current[styleName];
|
|
2815
|
-
}
|
|
2816
|
-
return current;
|
|
2817
|
-
}
|
|
2818
|
-
templates$1 = (chalk2, temporary) => {
|
|
2819
|
-
const styles2 = [];
|
|
2820
|
-
const chunks = [];
|
|
2821
|
-
let chunk = [];
|
|
2822
|
-
temporary.replace(TEMPLATE_REGEX, (m, escapeCharacter, inverse, style, close, character) => {
|
|
2823
|
-
if (escapeCharacter) {
|
|
2824
|
-
chunk.push(unescape(escapeCharacter));
|
|
2825
|
-
} else if (style) {
|
|
2826
|
-
const string = chunk.join("");
|
|
2827
|
-
chunk = [];
|
|
2828
|
-
chunks.push(styles2.length === 0 ? string : buildStyle(chalk2, styles2)(string));
|
|
2829
|
-
styles2.push({ inverse, styles: parseStyle(style) });
|
|
2830
|
-
} else if (close) {
|
|
2831
|
-
if (styles2.length === 0) {
|
|
2832
|
-
throw new Error("Found extraneous } in Chalk template literal");
|
|
2833
|
-
}
|
|
2834
|
-
chunks.push(buildStyle(chalk2, styles2)(chunk.join("")));
|
|
2835
|
-
chunk = [];
|
|
2836
|
-
styles2.pop();
|
|
2837
|
-
} else {
|
|
2838
|
-
chunk.push(character);
|
|
2839
|
-
}
|
|
2840
|
-
});
|
|
2841
|
-
chunks.push(chunk.join(""));
|
|
2842
|
-
if (styles2.length > 0) {
|
|
2843
|
-
const errMessage = `Chalk template literal is missing ${styles2.length} closing bracket${styles2.length === 1 ? "" : "s"} (\`}\`)`;
|
|
2844
|
-
throw new Error(errMessage);
|
|
2845
|
-
}
|
|
2846
|
-
return chunks.join("");
|
|
2847
|
-
};
|
|
2848
|
-
return templates$1;
|
|
2849
|
-
}
|
|
2850
|
-
const ansiStyles$2 = ansiStylesExports$1;
|
|
2851
|
-
const { stdout: stdoutColor$1, stderr: stderrColor$1 } = browser$1;
|
|
2852
|
-
const {
|
|
2853
|
-
stringReplaceAll: stringReplaceAll$2,
|
|
2854
|
-
stringEncaseCRLFWithFirstIndex: stringEncaseCRLFWithFirstIndex$2
|
|
2855
|
-
} = util$1;
|
|
2856
|
-
const { isArray: isArray$1 } = Array;
|
|
2857
|
-
const levelMapping$1 = [
|
|
2858
|
-
"ansi",
|
|
2859
|
-
"ansi",
|
|
2860
|
-
"ansi256",
|
|
2861
|
-
"ansi16m"
|
|
2862
|
-
];
|
|
2863
|
-
const styles$1 = /* @__PURE__ */ Object.create(null);
|
|
2864
|
-
const applyOptions$1 = (object, options = {}) => {
|
|
2865
|
-
if (options.level && !(Number.isInteger(options.level) && options.level >= 0 && options.level <= 3)) {
|
|
2866
|
-
throw new Error("The `level` option should be an integer from 0 to 3");
|
|
2867
|
-
}
|
|
2868
|
-
const colorLevel = stdoutColor$1 ? stdoutColor$1.level : 0;
|
|
2869
|
-
object.level = options.level === void 0 ? colorLevel : options.level;
|
|
2870
|
-
};
|
|
2871
|
-
let ChalkClass$1 = class ChalkClass {
|
|
2872
|
-
constructor(options) {
|
|
2873
|
-
return chalkFactory$1(options);
|
|
2874
|
-
}
|
|
2875
|
-
};
|
|
2876
|
-
const chalkFactory$1 = (options) => {
|
|
2877
|
-
const chalk2 = {};
|
|
2878
|
-
applyOptions$1(chalk2, options);
|
|
2879
|
-
chalk2.template = (...arguments_) => chalkTag$1(chalk2.template, ...arguments_);
|
|
2880
|
-
Object.setPrototypeOf(chalk2, Chalk$1.prototype);
|
|
2881
|
-
Object.setPrototypeOf(chalk2.template, chalk2);
|
|
2882
|
-
chalk2.template.constructor = () => {
|
|
2883
|
-
throw new Error("`chalk.constructor()` is deprecated. Use `new chalk.Instance()` instead.");
|
|
2884
|
-
};
|
|
2885
|
-
chalk2.template.Instance = ChalkClass$1;
|
|
2886
|
-
return chalk2.template;
|
|
2887
|
-
};
|
|
2888
|
-
function Chalk$1(options) {
|
|
2889
|
-
return chalkFactory$1(options);
|
|
2890
|
-
}
|
|
2891
|
-
for (const [styleName, style] of Object.entries(ansiStyles$2)) {
|
|
2892
|
-
styles$1[styleName] = {
|
|
2893
|
-
get() {
|
|
2894
|
-
const builder = createBuilder$1(this, createStyler$1(style.open, style.close, this._styler), this._isEmpty);
|
|
2895
|
-
Object.defineProperty(this, styleName, { value: builder });
|
|
2896
|
-
return builder;
|
|
2897
|
-
}
|
|
2898
|
-
};
|
|
2899
|
-
}
|
|
2900
|
-
styles$1.visible = {
|
|
2901
|
-
get() {
|
|
2902
|
-
const builder = createBuilder$1(this, this._styler, true);
|
|
2903
|
-
Object.defineProperty(this, "visible", { value: builder });
|
|
2904
|
-
return builder;
|
|
2905
|
-
}
|
|
2906
|
-
};
|
|
2907
|
-
const usedModels$1 = ["rgb", "hex", "keyword", "hsl", "hsv", "hwb", "ansi", "ansi256"];
|
|
2908
|
-
for (const model of usedModels$1) {
|
|
2909
|
-
styles$1[model] = {
|
|
2910
|
-
get() {
|
|
2911
|
-
const { level } = this;
|
|
2912
|
-
return function(...arguments_) {
|
|
2913
|
-
const styler = createStyler$1(ansiStyles$2.color[levelMapping$1[level]][model](...arguments_), ansiStyles$2.color.close, this._styler);
|
|
2914
|
-
return createBuilder$1(this, styler, this._isEmpty);
|
|
2915
|
-
};
|
|
2916
|
-
}
|
|
2917
|
-
};
|
|
2918
|
-
}
|
|
2919
|
-
for (const model of usedModels$1) {
|
|
2920
|
-
const bgModel = "bg" + model[0].toUpperCase() + model.slice(1);
|
|
2921
|
-
styles$1[bgModel] = {
|
|
2922
|
-
get() {
|
|
2923
|
-
const { level } = this;
|
|
2924
|
-
return function(...arguments_) {
|
|
2925
|
-
const styler = createStyler$1(ansiStyles$2.bgColor[levelMapping$1[level]][model](...arguments_), ansiStyles$2.bgColor.close, this._styler);
|
|
2926
|
-
return createBuilder$1(this, styler, this._isEmpty);
|
|
2927
|
-
};
|
|
2928
|
-
}
|
|
2929
|
-
};
|
|
2930
|
-
}
|
|
2931
|
-
const proto$1 = Object.defineProperties(() => {
|
|
2932
|
-
}, {
|
|
2933
|
-
...styles$1,
|
|
2934
|
-
level: {
|
|
2935
|
-
enumerable: true,
|
|
2936
|
-
get() {
|
|
2937
|
-
return this._generator.level;
|
|
2938
|
-
},
|
|
2939
|
-
set(level) {
|
|
2940
|
-
this._generator.level = level;
|
|
2941
|
-
}
|
|
2942
|
-
}
|
|
2943
|
-
});
|
|
2944
|
-
const createStyler$1 = (open, close, parent) => {
|
|
2945
|
-
let openAll;
|
|
2946
|
-
let closeAll;
|
|
2947
|
-
if (parent === void 0) {
|
|
2948
|
-
openAll = open;
|
|
2949
|
-
closeAll = close;
|
|
2950
|
-
} else {
|
|
2951
|
-
openAll = parent.openAll + open;
|
|
2952
|
-
closeAll = close + parent.closeAll;
|
|
2953
|
-
}
|
|
2954
|
-
return {
|
|
2955
|
-
open,
|
|
2956
|
-
close,
|
|
2957
|
-
openAll,
|
|
2958
|
-
closeAll,
|
|
2959
|
-
parent
|
|
2960
|
-
};
|
|
2961
|
-
};
|
|
2962
|
-
const createBuilder$1 = (self2, _styler, _isEmpty) => {
|
|
2963
|
-
const builder = (...arguments_) => {
|
|
2964
|
-
if (isArray$1(arguments_[0]) && isArray$1(arguments_[0].raw)) {
|
|
2965
|
-
return applyStyle$1(builder, chalkTag$1(builder, ...arguments_));
|
|
2966
|
-
}
|
|
2967
|
-
return applyStyle$1(builder, arguments_.length === 1 ? "" + arguments_[0] : arguments_.join(" "));
|
|
2968
|
-
};
|
|
2969
|
-
Object.setPrototypeOf(builder, proto$1);
|
|
2970
|
-
builder._generator = self2;
|
|
2971
|
-
builder._styler = _styler;
|
|
2972
|
-
builder._isEmpty = _isEmpty;
|
|
2973
|
-
return builder;
|
|
2974
|
-
};
|
|
2975
|
-
const applyStyle$1 = (self2, string) => {
|
|
2976
|
-
if (self2.level <= 0 || !string) {
|
|
2977
|
-
return self2._isEmpty ? "" : string;
|
|
2978
|
-
}
|
|
2979
|
-
let styler = self2._styler;
|
|
2980
|
-
if (styler === void 0) {
|
|
2981
|
-
return string;
|
|
2982
|
-
}
|
|
2983
|
-
const { openAll, closeAll } = styler;
|
|
2984
|
-
if (string.indexOf("\x1B") !== -1) {
|
|
2985
|
-
while (styler !== void 0) {
|
|
2986
|
-
string = stringReplaceAll$2(string, styler.close, styler.open);
|
|
2987
|
-
styler = styler.parent;
|
|
2988
|
-
}
|
|
2989
|
-
}
|
|
2990
|
-
const lfIndex = string.indexOf("\n");
|
|
2991
|
-
if (lfIndex !== -1) {
|
|
2992
|
-
string = stringEncaseCRLFWithFirstIndex$2(string, closeAll, openAll, lfIndex);
|
|
2993
|
-
}
|
|
2994
|
-
return openAll + string + closeAll;
|
|
2995
|
-
};
|
|
2996
|
-
let template$1;
|
|
2997
|
-
const chalkTag$1 = (chalk2, ...strings) => {
|
|
2998
|
-
const [firstString] = strings;
|
|
2999
|
-
if (!isArray$1(firstString) || !isArray$1(firstString.raw)) {
|
|
3000
|
-
return strings.join(" ");
|
|
3001
|
-
}
|
|
3002
|
-
const arguments_ = strings.slice(1);
|
|
3003
|
-
const parts = [firstString.raw[0]];
|
|
3004
|
-
for (let i = 1; i < firstString.length; i++) {
|
|
3005
|
-
parts.push(
|
|
3006
|
-
String(arguments_[i - 1]).replace(/[{}\\]/g, "\\$&"),
|
|
3007
|
-
String(firstString.raw[i])
|
|
3008
|
-
);
|
|
3009
|
-
}
|
|
3010
|
-
if (template$1 === void 0) {
|
|
3011
|
-
template$1 = requireTemplates$1();
|
|
3012
|
-
}
|
|
3013
|
-
return template$1(chalk2, parts.join(""));
|
|
3014
|
-
};
|
|
3015
|
-
Object.defineProperties(Chalk$1.prototype, styles$1);
|
|
3016
|
-
const chalk$2 = Chalk$1();
|
|
3017
|
-
chalk$2.supportsColor = stdoutColor$1;
|
|
3018
|
-
chalk$2.stderr = Chalk$1({ level: stderrColor$1 ? stderrColor$1.level : 0 });
|
|
3019
|
-
chalk$2.stderr.supportsColor = stderrColor$1;
|
|
3020
|
-
const STSInstrumentControllerPluginKey = Symbol("instrumentController");
|
|
3021
|
-
const GetSTSInstrumentControllerPluginKey = () => STSInstrumentControllerPluginKey;
|
|
3022
|
-
new TextEncoder();
|
|
3023
|
-
new TextDecoder();
|
|
3024
|
-
var ExtData = (
|
|
3025
|
-
/** @class */
|
|
3026
|
-
/* @__PURE__ */ function() {
|
|
3027
|
-
function ExtData2(type, data) {
|
|
3028
|
-
this.type = type;
|
|
3029
|
-
this.data = data;
|
|
3030
|
-
}
|
|
3031
|
-
return ExtData2;
|
|
3032
|
-
}()
|
|
3033
|
-
);
|
|
3034
|
-
var __extends = /* @__PURE__ */ function() {
|
|
3035
|
-
var extendStatics = function(d, b) {
|
|
3036
|
-
extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(d2, b2) {
|
|
3037
|
-
d2.__proto__ = b2;
|
|
3038
|
-
} || function(d2, b2) {
|
|
3039
|
-
for (var p in b2)
|
|
3040
|
-
if (Object.prototype.hasOwnProperty.call(b2, p))
|
|
3041
|
-
d2[p] = b2[p];
|
|
3042
|
-
};
|
|
3043
|
-
return extendStatics(d, b);
|
|
3044
|
-
};
|
|
3045
|
-
return function(d, b) {
|
|
3046
|
-
if (typeof b !== "function" && b !== null)
|
|
3047
|
-
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
3048
|
-
extendStatics(d, b);
|
|
3049
|
-
function __() {
|
|
3050
|
-
this.constructor = d;
|
|
3051
|
-
}
|
|
3052
|
-
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
3053
|
-
};
|
|
3054
|
-
}();
|
|
3055
|
-
var DecodeError = (
|
|
3056
|
-
/** @class */
|
|
3057
|
-
function(_super) {
|
|
3058
|
-
__extends(DecodeError2, _super);
|
|
3059
|
-
function DecodeError2(message) {
|
|
3060
|
-
var _this = _super.call(this, message) || this;
|
|
3061
|
-
var proto2 = Object.create(DecodeError2.prototype);
|
|
3062
|
-
Object.setPrototypeOf(_this, proto2);
|
|
3063
|
-
Object.defineProperty(_this, "name", {
|
|
3064
|
-
configurable: true,
|
|
3065
|
-
enumerable: false,
|
|
3066
|
-
value: DecodeError2.name
|
|
3067
|
-
});
|
|
3068
|
-
return _this;
|
|
3069
|
-
}
|
|
3070
|
-
return DecodeError2;
|
|
3071
|
-
}(Error)
|
|
3072
|
-
);
|
|
3073
|
-
function setInt64(view, offset, value) {
|
|
3074
|
-
var high = Math.floor(value / 4294967296);
|
|
3075
|
-
var low = value;
|
|
3076
|
-
view.setUint32(offset, high);
|
|
3077
|
-
view.setUint32(offset + 4, low);
|
|
3078
|
-
}
|
|
3079
|
-
function getInt64(view, offset) {
|
|
3080
|
-
var high = view.getInt32(offset);
|
|
3081
|
-
var low = view.getUint32(offset + 4);
|
|
3082
|
-
return high * 4294967296 + low;
|
|
3083
|
-
}
|
|
3084
|
-
var EXT_TIMESTAMP = -1;
|
|
3085
|
-
var TIMESTAMP32_MAX_SEC = 4294967296 - 1;
|
|
3086
|
-
var TIMESTAMP64_MAX_SEC = 17179869184 - 1;
|
|
3087
|
-
function encodeTimeSpecToTimestamp(_a2) {
|
|
3088
|
-
var sec = _a2.sec, nsec = _a2.nsec;
|
|
3089
|
-
if (sec >= 0 && nsec >= 0 && sec <= TIMESTAMP64_MAX_SEC) {
|
|
3090
|
-
if (nsec === 0 && sec <= TIMESTAMP32_MAX_SEC) {
|
|
3091
|
-
var rv = new Uint8Array(4);
|
|
3092
|
-
var view = new DataView(rv.buffer);
|
|
3093
|
-
view.setUint32(0, sec);
|
|
3094
|
-
return rv;
|
|
3095
|
-
} else {
|
|
3096
|
-
var secHigh = sec / 4294967296;
|
|
3097
|
-
var secLow = sec & 4294967295;
|
|
3098
|
-
var rv = new Uint8Array(8);
|
|
3099
|
-
var view = new DataView(rv.buffer);
|
|
3100
|
-
view.setUint32(0, nsec << 2 | secHigh & 3);
|
|
3101
|
-
view.setUint32(4, secLow);
|
|
3102
|
-
return rv;
|
|
3103
|
-
}
|
|
3104
|
-
} else {
|
|
3105
|
-
var rv = new Uint8Array(12);
|
|
3106
|
-
var view = new DataView(rv.buffer);
|
|
3107
|
-
view.setUint32(0, nsec);
|
|
3108
|
-
setInt64(view, 4, sec);
|
|
3109
|
-
return rv;
|
|
3110
|
-
}
|
|
3111
|
-
}
|
|
3112
|
-
function encodeDateToTimeSpec(date) {
|
|
3113
|
-
var msec = date.getTime();
|
|
3114
|
-
var sec = Math.floor(msec / 1e3);
|
|
3115
|
-
var nsec = (msec - sec * 1e3) * 1e6;
|
|
3116
|
-
var nsecInSec = Math.floor(nsec / 1e9);
|
|
3117
|
-
return {
|
|
3118
|
-
sec: sec + nsecInSec,
|
|
3119
|
-
nsec: nsec - nsecInSec * 1e9
|
|
3120
|
-
};
|
|
3121
|
-
}
|
|
3122
|
-
function encodeTimestampExtension(object) {
|
|
3123
|
-
if (object instanceof Date) {
|
|
3124
|
-
var timeSpec = encodeDateToTimeSpec(object);
|
|
3125
|
-
return encodeTimeSpecToTimestamp(timeSpec);
|
|
3126
|
-
} else {
|
|
3127
|
-
return null;
|
|
3128
|
-
}
|
|
3129
|
-
}
|
|
3130
|
-
function decodeTimestampToTimeSpec(data) {
|
|
3131
|
-
var view = new DataView(data.buffer, data.byteOffset, data.byteLength);
|
|
3132
|
-
switch (data.byteLength) {
|
|
3133
|
-
case 4: {
|
|
3134
|
-
var sec = view.getUint32(0);
|
|
3135
|
-
var nsec = 0;
|
|
3136
|
-
return { sec, nsec };
|
|
3137
|
-
}
|
|
3138
|
-
case 8: {
|
|
3139
|
-
var nsec30AndSecHigh2 = view.getUint32(0);
|
|
3140
|
-
var secLow32 = view.getUint32(4);
|
|
3141
|
-
var sec = (nsec30AndSecHigh2 & 3) * 4294967296 + secLow32;
|
|
3142
|
-
var nsec = nsec30AndSecHigh2 >>> 2;
|
|
3143
|
-
return { sec, nsec };
|
|
3144
|
-
}
|
|
3145
|
-
case 12: {
|
|
3146
|
-
var sec = getInt64(view, 4);
|
|
3147
|
-
var nsec = view.getUint32(0);
|
|
3148
|
-
return { sec, nsec };
|
|
3149
|
-
}
|
|
3150
|
-
default:
|
|
3151
|
-
throw new DecodeError("Unrecognized data size for timestamp (expected 4, 8, or 12): ".concat(data.length));
|
|
3152
|
-
}
|
|
3153
|
-
}
|
|
3154
|
-
function decodeTimestampExtension(data) {
|
|
3155
|
-
var timeSpec = decodeTimestampToTimeSpec(data);
|
|
3156
|
-
return new Date(timeSpec.sec * 1e3 + timeSpec.nsec / 1e6);
|
|
3157
|
-
}
|
|
3158
|
-
var timestampExtension = {
|
|
3159
|
-
type: EXT_TIMESTAMP,
|
|
3160
|
-
encode: encodeTimestampExtension,
|
|
3161
|
-
decode: decodeTimestampExtension
|
|
3162
|
-
};
|
|
3163
|
-
/** @class */
|
|
3164
|
-
(function() {
|
|
3165
|
-
function ExtensionCodec2() {
|
|
3166
|
-
this.builtInEncoders = [];
|
|
3167
|
-
this.builtInDecoders = [];
|
|
3168
|
-
this.encoders = [];
|
|
3169
|
-
this.decoders = [];
|
|
3170
|
-
this.register(timestampExtension);
|
|
3171
|
-
}
|
|
3172
|
-
ExtensionCodec2.prototype.register = function(_a2) {
|
|
3173
|
-
var type = _a2.type, encode2 = _a2.encode, decode = _a2.decode;
|
|
3174
|
-
if (type >= 0) {
|
|
3175
|
-
this.encoders[type] = encode2;
|
|
3176
|
-
this.decoders[type] = decode;
|
|
3177
|
-
} else {
|
|
3178
|
-
var index = 1 + type;
|
|
3179
|
-
this.builtInEncoders[index] = encode2;
|
|
3180
|
-
this.builtInDecoders[index] = decode;
|
|
3181
|
-
}
|
|
3182
|
-
};
|
|
3183
|
-
ExtensionCodec2.prototype.tryToEncode = function(object, context) {
|
|
3184
|
-
for (var i = 0; i < this.builtInEncoders.length; i++) {
|
|
3185
|
-
var encodeExt = this.builtInEncoders[i];
|
|
3186
|
-
if (encodeExt != null) {
|
|
3187
|
-
var data = encodeExt(object, context);
|
|
3188
|
-
if (data != null) {
|
|
3189
|
-
var type = -1 - i;
|
|
3190
|
-
return new ExtData(type, data);
|
|
3191
|
-
}
|
|
3192
|
-
}
|
|
3193
|
-
}
|
|
3194
|
-
for (var i = 0; i < this.encoders.length; i++) {
|
|
3195
|
-
var encodeExt = this.encoders[i];
|
|
3196
|
-
if (encodeExt != null) {
|
|
3197
|
-
var data = encodeExt(object, context);
|
|
3198
|
-
if (data != null) {
|
|
3199
|
-
var type = i;
|
|
3200
|
-
return new ExtData(type, data);
|
|
3201
|
-
}
|
|
3202
|
-
}
|
|
3203
|
-
}
|
|
3204
|
-
if (object instanceof ExtData) {
|
|
3205
|
-
return object;
|
|
3206
|
-
}
|
|
3207
|
-
return null;
|
|
3208
|
-
};
|
|
3209
|
-
ExtensionCodec2.prototype.decode = function(data, type, context) {
|
|
3210
|
-
var decodeExt = type < 0 ? this.builtInDecoders[-1 - type] : this.decoders[type];
|
|
3211
|
-
if (decodeExt) {
|
|
3212
|
-
return decodeExt(data, type, context);
|
|
3213
|
-
} else {
|
|
3214
|
-
return new ExtData(type, data);
|
|
3215
|
-
}
|
|
3216
|
-
};
|
|
3217
|
-
ExtensionCodec2.defaultCodec = new ExtensionCodec2();
|
|
3218
|
-
return ExtensionCodec2;
|
|
3219
|
-
})();
|
|
3220
|
-
var SubscriptionTopic = /* @__PURE__ */ ((SubscriptionTopic2) => {
|
|
3221
|
-
SubscriptionTopic2["AllServicesCombined"] = "AllServicesCombined";
|
|
3222
|
-
SubscriptionTopic2["Services"] = "Services";
|
|
3223
|
-
SubscriptionTopic2["ServiceInstances"] = "ServiceInstances";
|
|
3224
|
-
SubscriptionTopic2["ServiceInstance"] = "ServiceInstance";
|
|
3225
|
-
SubscriptionTopic2["AllAgentsCombined"] = "AllAgentsCombined";
|
|
3226
|
-
SubscriptionTopic2["Agents"] = "Agents";
|
|
3227
|
-
SubscriptionTopic2["AgentWorkers"] = "AgentWorkers";
|
|
3228
|
-
SubscriptionTopic2["AgentWorker"] = "AgentWorker";
|
|
3229
|
-
SubscriptionTopic2["AllLambdasCombined"] = "AllLambdasCombined";
|
|
3230
|
-
SubscriptionTopic2["LambdaTechnologies"] = "LambdaTechnologies";
|
|
3231
|
-
SubscriptionTopic2["LambdaSubTechnologies"] = "LambdaSubTechnologies";
|
|
3232
|
-
SubscriptionTopic2["LambdaSubTechnologiesInstance"] = "LambdaSubTechnologiesInstance";
|
|
3233
|
-
SubscriptionTopic2["LogProcessing"] = "LogProcessing";
|
|
3234
|
-
return SubscriptionTopic2;
|
|
3235
|
-
})(SubscriptionTopic || {});
|
|
3236
|
-
const instrumentationObservationInterval = 1e3;
|
|
3237
|
-
const instrumentationTimeWindow = 600;
|
|
3238
|
-
const consoleLogging = true;
|
|
3239
|
-
const instrumentLogging = true;
|
|
3240
|
-
const globalServiceDefinitions = {
|
|
3241
|
-
coreFieldList: [
|
|
3242
|
-
{ fieldName: "requestCount", gauge: Gauge.REQUEST_COUNT_GAUGE, instrumentProperty: "val", dataType: "number", influxdbDataType: "intField", gaugeType: GaugeTypes.INSTRUMENT_GAUGE },
|
|
3243
|
-
{ fieldName: "errorCount", gauge: Gauge.ERROR_COUNT_GAUGE, instrumentProperty: "val", dataType: "number", influxdbDataType: "intField", gaugeType: GaugeTypes.INSTRUMENT_GAUGE },
|
|
3244
|
-
{ fieldName: "retryCount", gauge: Gauge.RETRY_COUNT_GAUGE, instrumentProperty: "val", dataType: "number", influxdbDataType: "intField", gaugeType: GaugeTypes.INSTRUMENT_GAUGE },
|
|
3245
|
-
{ fieldName: "authenticationCount", gauge: Gauge.AUTHENTICATION_COUNT_GAUGE, instrumentProperty: "val", dataType: "number", influxdbDataType: "intField", gaugeType: GaugeTypes.INSTRUMENT_GAUGE },
|
|
3246
|
-
{ fieldName: "authenticationErrorCount", gauge: Gauge.AUTHENTICATION_ERROR_COUNT_GAUGE, instrumentProperty: "val", dataType: "number", influxdbDataType: "intField", gaugeType: GaugeTypes.INSTRUMENT_GAUGE },
|
|
3247
|
-
{ fieldName: "authenticationRetryCount", gauge: Gauge.AUTHENTICATION_RETRY_COUNT_GAUGE, instrumentProperty: "val", dataType: "number", influxdbDataType: "intField", gaugeType: GaugeTypes.INSTRUMENT_GAUGE },
|
|
3248
|
-
{ fieldName: "velocity", gauge: Gauge.VELOCITY_GAUGE, instrumentProperty: "va", dataType: "number", influxdbDataType: "floatField", gaugeType: GaugeTypes.INSTRUMENT_VELOCITY },
|
|
3249
|
-
{
|
|
3250
|
-
fieldName: "activeRequestCount",
|
|
3251
|
-
gauge: Gauge.ACTIVE_REQUEST_GAUGE,
|
|
3252
|
-
instrumentProperty: "val",
|
|
3253
|
-
dataType: "number",
|
|
3254
|
-
timeSeriesIndex: true,
|
|
3255
|
-
quantile: true,
|
|
3256
|
-
influxdbDataType: "intField",
|
|
3257
|
-
gaugeType: GaugeTypes.INSTRUMENT_GAUGE,
|
|
3258
|
-
instrumentOptions: {
|
|
3259
|
-
interval: instrumentationObservationInterval,
|
|
3260
|
-
sampleSize: instrumentationTimeWindow
|
|
3261
|
-
}
|
|
3262
|
-
},
|
|
3263
|
-
{ fieldName: "coreCount", gauge: Gauge.CORE_COUNT_GAUGE, instrumentProperty: "val", dataType: "number", influxdbDataType: "intField", gaugeType: GaugeTypes.INSTRUMENT_GAUGE },
|
|
3264
|
-
{ fieldName: "rx", gauge: Gauge.NETWORK_RX_GAUGE, instrumentProperty: "va", dataType: "number", influxdbDataType: "floatField", gaugeType: GaugeTypes.INSTRUMENT_VELOCITY },
|
|
3265
|
-
{ fieldName: "tx", gauge: Gauge.NETWORK_TX_GAUGE, instrumentProperty: "va", dataType: "number", influxdbDataType: "floatField", gaugeType: GaugeTypes.INSTRUMENT_VELOCITY },
|
|
3266
|
-
{ fieldName: "timer", gauge: Gauge.TIMER_GAUGE, instrumentProperty: "val", dataType: "number", influxdbDataType: "floatField", gaugeType: GaugeTypes.INSTRUMENT_TIMER },
|
|
3267
|
-
{
|
|
3268
|
-
fieldName: "duration",
|
|
3269
|
-
gauge: Gauge.DURATION_GAUGE,
|
|
3270
|
-
instrumentProperty: "val",
|
|
3271
|
-
dataType: "number",
|
|
3272
|
-
timeSeriesIndex: true,
|
|
3273
|
-
quantile: true,
|
|
3274
|
-
influxdbDataType: "floatField",
|
|
3275
|
-
gaugeType: GaugeTypes.INSTRUMENT_GAUGE,
|
|
3276
|
-
instrumentOptions: {
|
|
3277
|
-
interval: instrumentationObservationInterval,
|
|
3278
|
-
sampleSize: instrumentationTimeWindow
|
|
3279
|
-
},
|
|
3280
|
-
histo: [
|
|
3281
|
-
{ label: "B10", bucketLimit: 10 },
|
|
3282
|
-
{ label: "B20", bucketLimit: 20 },
|
|
3283
|
-
{ label: "B50", bucketLimit: 50 },
|
|
3284
|
-
{ label: "B100", bucketLimit: 100 },
|
|
3285
|
-
{ label: "B1000", bucketLimit: 1e3 },
|
|
3286
|
-
{ label: "B50000", bucketLimit: 5e4 },
|
|
3287
|
-
{ label: "BInfinity", bucketLimit: -1 }
|
|
3288
|
-
],
|
|
3289
|
-
histoGauge: Gauge.DURATION_HISTOGRAM_GAUGE
|
|
3290
|
-
},
|
|
3291
|
-
{
|
|
3292
|
-
fieldName: "latency",
|
|
3293
|
-
gauge: Gauge.LATENCY_GAUGE,
|
|
3294
|
-
instrumentProperty: "val",
|
|
3295
|
-
dataType: "number",
|
|
3296
|
-
timeSeriesIndex: true,
|
|
3297
|
-
quantile: true,
|
|
3298
|
-
influxdbDataType: "floatField",
|
|
3299
|
-
gaugeType: GaugeTypes.INSTRUMENT_GAUGE,
|
|
3300
|
-
instrumentOptions: {
|
|
3301
|
-
interval: instrumentationObservationInterval,
|
|
3302
|
-
sampleSize: instrumentationTimeWindow
|
|
3303
|
-
},
|
|
3304
|
-
histo: [
|
|
3305
|
-
{ label: "B10", bucketLimit: 10 },
|
|
3306
|
-
{ label: "B20", bucketLimit: 20 },
|
|
3307
|
-
{ label: "B50", bucketLimit: 50 },
|
|
3308
|
-
{ label: "B100", bucketLimit: 100 },
|
|
3309
|
-
{ label: "B1000", bucketLimit: 1e3 },
|
|
3310
|
-
{ label: "B50000", bucketLimit: 5e4 },
|
|
3311
|
-
{ label: "BInfinity", bucketLimit: -1 }
|
|
3312
|
-
],
|
|
3313
|
-
histoGauge: Gauge.LATENCY_HISTOGRAM_GAUGE
|
|
3314
|
-
}
|
|
3315
|
-
],
|
|
3316
|
-
logFieldList: [
|
|
3317
|
-
{
|
|
3318
|
-
fieldName: "log",
|
|
3319
|
-
gauge: Gauge.LOGGER,
|
|
3320
|
-
instrumentProperty: "val",
|
|
3321
|
-
dataType: "string",
|
|
3322
|
-
timeSeriesIndex: false,
|
|
3323
|
-
quantile: false,
|
|
3324
|
-
influxdbDataType: "stringField",
|
|
3325
|
-
gaugeType: GaugeTypes.INSTRUMENT_LOG,
|
|
3326
|
-
instrumentOptions: {
|
|
3327
|
-
consoleLogging,
|
|
3328
|
-
instrumentLogging
|
|
3329
|
-
}
|
|
3330
|
-
}
|
|
3331
|
-
],
|
|
3332
|
-
services: {
|
|
3333
|
-
["service"]: {
|
|
3334
|
-
influxDBContextTags: [
|
|
3335
|
-
"serviceId",
|
|
3336
|
-
"serviceName",
|
|
3337
|
-
"serviceVersion",
|
|
3338
|
-
"serviceInstanceId",
|
|
3339
|
-
"serviceInstanceProcessId",
|
|
3340
|
-
"hostName",
|
|
3341
|
-
"pid",
|
|
3342
|
-
"ppid"
|
|
3343
|
-
],
|
|
3344
|
-
redisIndexPrefixDefinitions: {
|
|
3345
|
-
timeSeriesIndex: "idx:serviceIndexTimeSeries",
|
|
3346
|
-
timeSeriesPrefix: "/serviceTimeSeries:",
|
|
3347
|
-
instantIndex: "idx:serviceIndexInstant",
|
|
3348
|
-
instantPrefix: "/serviceInstant:"
|
|
3349
|
-
},
|
|
3350
|
-
fieldList: [
|
|
3351
|
-
{
|
|
3352
|
-
fieldName: "cpu",
|
|
3353
|
-
gauge: Gauge.CPU_LOAD_GAUGE,
|
|
3354
|
-
instrumentProperty: "val",
|
|
3355
|
-
dataType: "number",
|
|
3356
|
-
timeSeriesIndex: true,
|
|
3357
|
-
quantile: true,
|
|
3358
|
-
influxdbDataType: "floatField",
|
|
3359
|
-
gaugeType: GaugeTypes.INSTRUMENT_GAUGE,
|
|
3360
|
-
instrumentOptions: {
|
|
3361
|
-
interval: instrumentationObservationInterval,
|
|
3362
|
-
sampleSize: instrumentationTimeWindow
|
|
3363
|
-
}
|
|
3364
|
-
},
|
|
3365
|
-
{
|
|
3366
|
-
fieldName: "connectionCount",
|
|
3367
|
-
gauge: Gauge.CONNECTION_COUNT_GAUGE,
|
|
3368
|
-
instrumentProperty: "val",
|
|
3369
|
-
dataType: "number",
|
|
3370
|
-
timeSeriesIndex: true,
|
|
3371
|
-
quantile: true,
|
|
3372
|
-
influxdbDataType: "intField",
|
|
3373
|
-
gaugeType: GaugeTypes.INSTRUMENT_GAUGE,
|
|
3374
|
-
instrumentOptions: {
|
|
3375
|
-
interval: instrumentationObservationInterval,
|
|
3376
|
-
sampleSize: instrumentationTimeWindow
|
|
3377
|
-
}
|
|
3378
|
-
},
|
|
3379
|
-
{ fieldName: "connectionPoolCount", gauge: Gauge.CONNECTION_POOL_TOTAL_GAUGE, instrumentProperty: "val", dataType: "number", influxdbDataType: "intField", gaugeType: GaugeTypes.INSTRUMENT_GAUGE },
|
|
3380
|
-
{ fieldName: "connectionIdleCount", gauge: Gauge.CONNECTION_POOL_IDLE_GAUGE, instrumentProperty: "val", dataType: "number", influxdbDataType: "intField", gaugeType: GaugeTypes.INSTRUMENT_GAUGE },
|
|
3381
|
-
{ fieldName: "connectionWaitingCount", gauge: Gauge.CONNECTION_POOL_WAITING_GAUGE, instrumentProperty: "val", dataType: "number", influxdbDataType: "intField", gaugeType: GaugeTypes.INSTRUMENT_GAUGE },
|
|
3382
|
-
{ fieldName: "systemcpu", gauge: Gauge.CPU_SYSTEM_LOAD_GAUGE, instrumentProperty: "val", dataType: "number", timeSeriesIndex: true, quantile: true, influxdbDataType: "floatField", gaugeType: GaugeTypes.INSTRUMENT_GAUGE },
|
|
3383
|
-
{
|
|
3384
|
-
fieldName: "memory",
|
|
3385
|
-
gauge: Gauge.OBJECT_GAUGE,
|
|
3386
|
-
instrumentProperty: "val",
|
|
3387
|
-
dataType: "JSON",
|
|
3388
|
-
influxdbDataType: "stringField",
|
|
3389
|
-
gaugeType: GaugeTypes.INSTRUMENT_OBJECT,
|
|
3390
|
-
instrumentOptions: {
|
|
3391
|
-
label: "InstrumentObjectMaster"
|
|
3392
|
-
}
|
|
3393
|
-
}
|
|
3394
|
-
],
|
|
3395
|
-
GetPathFromContext(context) {
|
|
3396
|
-
const { serviceId, serviceInstanceId, serviceInstanceProcessId } = context;
|
|
3397
|
-
return `/${serviceId}/${serviceInstanceId}/${serviceInstanceProcessId}`;
|
|
3398
|
-
},
|
|
3399
|
-
redisQueryFilters: {
|
|
3400
|
-
level1ContextField: "serviceType",
|
|
3401
|
-
level2ContextField: "appid",
|
|
3402
|
-
level3ContextField: "appinstanceid"
|
|
3403
|
-
},
|
|
3404
|
-
subscriptionTopics: [
|
|
3405
|
-
{
|
|
3406
|
-
subscriptionTopic: SubscriptionTopic.AllServicesCombined,
|
|
3407
|
-
route: "/metrics"
|
|
3408
|
-
},
|
|
3409
|
-
{
|
|
3410
|
-
subscriptionTopic: SubscriptionTopic.Services,
|
|
3411
|
-
route: "/metrics/services"
|
|
3412
|
-
},
|
|
3413
|
-
{
|
|
3414
|
-
subscriptionTopic: SubscriptionTopic.ServiceInstances,
|
|
3415
|
-
route: "/metrics/services/:key"
|
|
3416
|
-
},
|
|
3417
|
-
{
|
|
3418
|
-
subscriptionTopic: SubscriptionTopic.ServiceInstance,
|
|
3419
|
-
route: "/metrics/services/:key/:subkey"
|
|
3420
|
-
}
|
|
3421
|
-
]
|
|
3422
|
-
},
|
|
3423
|
-
["agent"]: {
|
|
3424
|
-
influxDBContextTags: [
|
|
3425
|
-
"id",
|
|
3426
|
-
"hostName",
|
|
3427
|
-
"agentName",
|
|
3428
|
-
"threadId",
|
|
3429
|
-
"asyncRunnerId"
|
|
3430
|
-
],
|
|
3431
|
-
redisIndexPrefixDefinitions: {
|
|
3432
|
-
timeSeriesIndex: "idx:agentIndexTimeSeries",
|
|
3433
|
-
timeSeriesPrefix: "/agentTimeSeries:",
|
|
3434
|
-
instantIndex: "idx:agentIndexInstant",
|
|
3435
|
-
instantPrefix: "/agentInstant:"
|
|
3436
|
-
},
|
|
3437
|
-
fieldList: [
|
|
3438
|
-
{ fieldName: "childCount", gauge: Gauge.CHILD_COUNT, instrumentProperty: "val", dataType: "number", influxdbDataType: "intField", gaugeType: GaugeTypes.INSTRUMENT_GAUGE }
|
|
3439
|
-
],
|
|
3440
|
-
//@@ need type declare in appframework ?? agent does not use appframework ... perhaps stspublisher
|
|
3441
|
-
GetPathFromContext(context) {
|
|
3442
|
-
const { agentName, threadId, asyncRunnerId } = context;
|
|
3443
|
-
return `/${agentName}/${threadId}/${asyncRunnerId}`;
|
|
3444
|
-
},
|
|
3445
|
-
redisQueryFilters: {
|
|
3446
|
-
level1ContextField: "serviceType",
|
|
3447
|
-
level2ContextField: "appid",
|
|
3448
|
-
//@@ this should be named something else
|
|
3449
|
-
level3ContextField: "appinstanceid"
|
|
3450
|
-
//@@ this should be named something else
|
|
3451
|
-
},
|
|
3452
|
-
subscriptionTopics: [
|
|
3453
|
-
{
|
|
3454
|
-
subscriptionTopic: SubscriptionTopic.AllAgentsCombined,
|
|
3455
|
-
route: "/metrics"
|
|
3456
|
-
},
|
|
3457
|
-
{
|
|
3458
|
-
subscriptionTopic: SubscriptionTopic.Agents,
|
|
3459
|
-
route: "/metrics/agents"
|
|
3460
|
-
},
|
|
3461
|
-
{
|
|
3462
|
-
subscriptionTopic: SubscriptionTopic.AgentWorkers,
|
|
3463
|
-
route: "/metrics/agents/:key"
|
|
3464
|
-
},
|
|
3465
|
-
{
|
|
3466
|
-
subscriptionTopic: SubscriptionTopic.AgentWorker,
|
|
3467
|
-
route: "/metrics/agents/:key/:subkey"
|
|
3468
|
-
}
|
|
3469
|
-
]
|
|
3470
|
-
},
|
|
3471
|
-
["lambda"]: {
|
|
3472
|
-
influxDBContextTags: [
|
|
3473
|
-
"technology",
|
|
3474
|
-
"subTechnology",
|
|
3475
|
-
"lambdaFunctionName",
|
|
3476
|
-
"lambdaInstance",
|
|
3477
|
-
"hostName",
|
|
3478
|
-
"processId",
|
|
3479
|
-
"parentProcessId",
|
|
3480
|
-
"useCase",
|
|
3481
|
-
"pattern"
|
|
3482
|
-
],
|
|
3483
|
-
redisIndexPrefixDefinitions: {
|
|
3484
|
-
timeSeriesIndex: "idx:lambdaIndexTimeSeries",
|
|
3485
|
-
timeSeriesPrefix: "/lambdaTimeSeries:",
|
|
3486
|
-
instantIndex: "idx:lambdaIndexInstant",
|
|
3487
|
-
instantPrefix: "/lambdaInstant:"
|
|
3488
|
-
},
|
|
3489
|
-
fieldList: [
|
|
3490
|
-
{ fieldName: "cpu", gauge: Gauge.CPU_LOAD_GAUGE, instrumentProperty: "val", dataType: "number", timeSeriesIndex: true, quantile: true, influxdbDataType: "floatField", gaugeType: GaugeTypes.INSTRUMENT_GAUGE },
|
|
3491
|
-
{ fieldName: "connectionCount", gauge: Gauge.CONNECTION_COUNT_GAUGE, instrumentProperty: "val", dataType: "number", timeSeriesIndex: true, quantile: true, influxdbDataType: "intField", gaugeType: GaugeTypes.INSTRUMENT_GAUGE },
|
|
3492
|
-
{ fieldName: "connectionPoolCount", gauge: Gauge.CONNECTION_POOL_TOTAL_GAUGE, instrumentProperty: "val", dataType: "number", influxdbDataType: "intField", gaugeType: GaugeTypes.INSTRUMENT_GAUGE },
|
|
3493
|
-
{ fieldName: "connectionIdleCount", gauge: Gauge.CONNECTION_POOL_IDLE_GAUGE, instrumentProperty: "val", dataType: "number", influxdbDataType: "intField", gaugeType: GaugeTypes.INSTRUMENT_GAUGE },
|
|
3494
|
-
{ fieldName: "connectionWaitingCount", gauge: Gauge.CONNECTION_POOL_WAITING_GAUGE, instrumentProperty: "val", dataType: "number", influxdbDataType: "intField", gaugeType: GaugeTypes.INSTRUMENT_GAUGE },
|
|
3495
|
-
{ fieldName: "systemcpu", gauge: Gauge.CPU_SYSTEM_LOAD_GAUGE, instrumentProperty: "val", dataType: "number", timeSeriesIndex: true, quantile: true, influxdbDataType: "floatField", gaugeType: GaugeTypes.INSTRUMENT_GAUGE },
|
|
3496
|
-
{ fieldName: "memory", gauge: Gauge.OBJECT_GAUGE, instrumentProperty: "val", dataType: "JSON", influxdbDataType: "stringField", gaugeType: GaugeTypes.INSTRUMENT_OBJECT }
|
|
3497
|
-
],
|
|
3498
|
-
//@@ need type declare in appframework
|
|
3499
|
-
GetPathFromContext(context) {
|
|
3500
|
-
const { technology, subTechnology, lambdaInstance } = context;
|
|
3501
|
-
return `/${technology}/${subTechnology}/${lambdaInstance}`;
|
|
3502
|
-
},
|
|
3503
|
-
redisQueryFilters: {
|
|
3504
|
-
level1ContextField: "serviceType",
|
|
3505
|
-
level2ContextField: "technology",
|
|
3506
|
-
level3ContextField: "subTechnology"
|
|
3507
|
-
},
|
|
3508
|
-
subscriptionTopics: [
|
|
3509
|
-
{
|
|
3510
|
-
subscriptionTopic: SubscriptionTopic.AllLambdasCombined,
|
|
3511
|
-
// uicontrollerlanding
|
|
3512
|
-
route: "/metrics"
|
|
3513
|
-
},
|
|
3514
|
-
{
|
|
3515
|
-
subscriptionTopic: SubscriptionTopic.LambdaTechnologies,
|
|
3516
|
-
// uicontrollerlambda
|
|
3517
|
-
route: "/metrics/lambdas"
|
|
3518
|
-
},
|
|
3519
|
-
{
|
|
3520
|
-
subscriptionTopic: SubscriptionTopic.LambdaSubTechnologies,
|
|
3521
|
-
// uicontrollerlambdasubtechnologies
|
|
3522
|
-
route: "/metrics/lambdas/:key"
|
|
3523
|
-
},
|
|
3524
|
-
{
|
|
3525
|
-
subscriptionTopic: SubscriptionTopic.LambdaSubTechnologiesInstance,
|
|
3526
|
-
// uicontrollerlambdasubtechnologiesinstance
|
|
3527
|
-
route: "/metrics/lambdas/:key/:subkey"
|
|
3528
|
-
}
|
|
3529
|
-
]
|
|
3530
|
-
}
|
|
3531
|
-
}
|
|
3532
|
-
};
|
|
3533
|
-
const _ObservabilityModelUtils = class _ObservabilityModelUtils2 {
|
|
3534
|
-
static GetModelNode(data) {
|
|
3535
|
-
const fixedSize = 2;
|
|
3536
|
-
const padLength = 9;
|
|
3537
|
-
try {
|
|
3538
|
-
return {
|
|
3539
|
-
val: data,
|
|
3540
|
-
vf: parseFloat(data.toString()).toFixed(fixedSize).padStart(padLength, " "),
|
|
3541
|
-
value: parseFloat(data.toString()).toFixed(fixedSize)
|
|
3542
|
-
};
|
|
3543
|
-
} catch (error) {
|
|
3544
|
-
return {
|
|
3545
|
-
val: 0,
|
|
3546
|
-
vf: "",
|
|
3547
|
-
value: ""
|
|
3548
|
-
};
|
|
3549
|
-
}
|
|
3550
|
-
}
|
|
3551
|
-
static GetModelNodeRawStringArray(data) {
|
|
3552
|
-
try {
|
|
3553
|
-
return {
|
|
3554
|
-
val: data
|
|
3555
|
-
};
|
|
3556
|
-
} catch (error) {
|
|
3557
|
-
return {
|
|
3558
|
-
val: []
|
|
3559
|
-
};
|
|
3560
|
-
}
|
|
3561
|
-
}
|
|
3562
|
-
static GetModelNodeObject(data) {
|
|
3563
|
-
try {
|
|
3564
|
-
return {
|
|
3565
|
-
val: JSON.parse(data)
|
|
3566
|
-
};
|
|
3567
|
-
} catch (error) {
|
|
3568
|
-
return {
|
|
3569
|
-
val: null
|
|
3570
|
-
};
|
|
3571
|
-
}
|
|
3572
|
-
}
|
|
3573
|
-
static GetModelNodeWithQuantile(data, quantileData) {
|
|
3574
|
-
let quantile2 = "";
|
|
3575
|
-
const quantileDataElementArray = [];
|
|
3576
|
-
for (const [key, val] of Object.entries(quantileData)) {
|
|
3577
|
-
quantile2 += parseFloat(val.toFixed(2)).toString().padStart(8, " ");
|
|
3578
|
-
quantileDataElementArray.push([
|
|
3579
|
-
key,
|
|
3580
|
-
val
|
|
3581
|
-
]);
|
|
3582
|
-
}
|
|
3583
|
-
const fixedSize = 2;
|
|
3584
|
-
const padLength = 9;
|
|
3585
|
-
try {
|
|
3586
|
-
return {
|
|
3587
|
-
val: data,
|
|
3588
|
-
vf: parseFloat(data.toString()).toFixed(fixedSize).padStart(padLength, " "),
|
|
3589
|
-
value: parseFloat(data.toString()).toFixed(fixedSize),
|
|
3590
|
-
percentile: quantileDataElementArray,
|
|
3591
|
-
percentileFormatted: quantile2
|
|
3592
|
-
};
|
|
3593
|
-
} catch (error) {
|
|
3594
|
-
return {
|
|
3595
|
-
val: 0,
|
|
3596
|
-
vf: "",
|
|
3597
|
-
value: "",
|
|
3598
|
-
percentile: [],
|
|
3599
|
-
percentileFormatted: ""
|
|
3600
|
-
};
|
|
3601
|
-
}
|
|
3602
|
-
}
|
|
3603
|
-
static GetModelNodeHistFromInfluxData(data) {
|
|
3604
|
-
try {
|
|
3605
|
-
const histVal = [];
|
|
3606
|
-
if (data) {
|
|
3607
|
-
for (const [key, val] of Object.entries(data)) {
|
|
3608
|
-
const dataElement = [
|
|
3609
|
-
val,
|
|
3610
|
-
key,
|
|
3611
|
-
parseInt(key)
|
|
3612
|
-
];
|
|
3613
|
-
histVal.push(dataElement);
|
|
3614
|
-
}
|
|
3615
|
-
}
|
|
3616
|
-
try {
|
|
3617
|
-
return {
|
|
3618
|
-
hist: histVal
|
|
3619
|
-
};
|
|
3620
|
-
} catch (error) {
|
|
3621
|
-
return {
|
|
3622
|
-
hist: []
|
|
3623
|
-
};
|
|
3624
|
-
}
|
|
3625
|
-
} catch (error) {
|
|
3626
|
-
return {
|
|
3627
|
-
hist: []
|
|
3628
|
-
};
|
|
3629
|
-
}
|
|
3630
|
-
}
|
|
3631
|
-
static GetModelData(serviceType, model, data, parseLog) {
|
|
3632
|
-
const fieldList = [
|
|
3633
|
-
...globalServiceDefinitions.coreFieldList,
|
|
3634
|
-
...globalServiceDefinitions.services[serviceType].fieldList
|
|
3635
|
-
];
|
|
3636
|
-
fieldList.forEach((field) => {
|
|
3637
|
-
if (field.quantile) {
|
|
3638
|
-
_ObservabilityModelUtils2.ParseModelNodeWithQuantile(model, data, parseLog, field.gauge, field.fieldName, `${field.fieldName}_quantile`);
|
|
3639
|
-
} else if (field.gaugeType.localeCompare(GaugeTypes.INSTRUMENT_OBJECT) === 0) {
|
|
3640
|
-
_ObservabilityModelUtils2.ParseModelNodeObject(model, data, parseLog, field.gauge, field.fieldName);
|
|
3641
|
-
} else {
|
|
3642
|
-
_ObservabilityModelUtils2.ParseModelNode(model, data, parseLog, field.gauge, field.fieldName);
|
|
3643
|
-
}
|
|
3644
|
-
if (field.histo) {
|
|
3645
|
-
_ObservabilityModelUtils2.ParseModelNodeHisto(model, data, parseLog, field.histoGauge, `${field.fieldName}_histo`);
|
|
3646
|
-
}
|
|
3647
|
-
});
|
|
3648
|
-
}
|
|
3649
|
-
static GetModelForService(id, data, subscribeToKafka, logger) {
|
|
3650
|
-
try {
|
|
3651
|
-
const parseLog = [];
|
|
3652
|
-
const model = {
|
|
3653
|
-
id,
|
|
3654
|
-
instruments: {}
|
|
3655
|
-
};
|
|
3656
|
-
this.GetModelData("service", model, data, parseLog);
|
|
3657
|
-
if (!subscribeToKafka) {
|
|
3658
|
-
model.instruments[Gauge.LOGGER] = _ObservabilityModelUtils2.GetModelNodeRawStringArray(data["logMessages"]);
|
|
3659
|
-
}
|
|
3660
|
-
if (parseLog.length > 0) {
|
|
3661
|
-
parseLog.forEach((logEntry) => logger.debug(logEntry));
|
|
3662
|
-
}
|
|
3663
|
-
return model;
|
|
3664
|
-
} catch (error) {
|
|
3665
|
-
return null;
|
|
3666
|
-
}
|
|
3667
|
-
}
|
|
3668
|
-
static GetModelForLambda(id, data, subscribeToKafka, logger) {
|
|
3669
|
-
try {
|
|
3670
|
-
const parseLog = [];
|
|
3671
|
-
const model = {
|
|
3672
|
-
id,
|
|
3673
|
-
instruments: {}
|
|
3674
|
-
};
|
|
3675
|
-
this.GetModelData("lambda", model, data, parseLog);
|
|
3676
|
-
if (!subscribeToKafka) {
|
|
3677
|
-
model.instruments[Gauge.LOGGER] = _ObservabilityModelUtils2.GetModelNodeRawStringArray(data["logMessages"]);
|
|
3678
|
-
}
|
|
3679
|
-
if (parseLog.length > 0) {
|
|
3680
|
-
parseLog.forEach((logEntry) => logger.debug(logEntry));
|
|
3681
|
-
}
|
|
3682
|
-
return model;
|
|
3683
|
-
} catch (error) {
|
|
3684
|
-
return null;
|
|
3685
|
-
}
|
|
3686
|
-
}
|
|
3687
|
-
static GetModelForAgent(id, data, subscribeToKafka, logger) {
|
|
3688
|
-
try {
|
|
3689
|
-
if (Object.keys(data).length === 0) {
|
|
3690
|
-
return null;
|
|
3691
|
-
}
|
|
3692
|
-
const parseLog = [];
|
|
3693
|
-
const model = {
|
|
3694
|
-
id,
|
|
3695
|
-
instruments: {}
|
|
3696
|
-
};
|
|
3697
|
-
this.GetModelData("agent", model, data, parseLog);
|
|
3698
|
-
if (!subscribeToKafka) {
|
|
3699
|
-
model.instruments[Gauge.LOGGER] = _ObservabilityModelUtils2.GetModelNodeRawStringArray(data["logMessages"]);
|
|
3700
|
-
}
|
|
3701
|
-
if (parseLog.length > 0) {
|
|
3702
|
-
parseLog.forEach((logEntry) => logger.debug(logEntry));
|
|
3703
|
-
}
|
|
3704
|
-
return model;
|
|
3705
|
-
} catch (error) {
|
|
3706
|
-
return null;
|
|
3707
|
-
}
|
|
3708
|
-
}
|
|
3709
|
-
};
|
|
3710
|
-
__publicField2(_ObservabilityModelUtils, "ParseModelNode", (model, data, parseLog, gaugeName, fieldName) => {
|
|
3711
|
-
if (fieldName in data) {
|
|
3712
|
-
model.instruments[gaugeName] = _ObservabilityModelUtils.GetModelNode(data[fieldName]);
|
|
3713
|
-
} else {
|
|
3714
|
-
parseLog.push(`ObservabilityModelUtils:ParseModelNode(): Field not present: [${fieldName}], default to [0]`);
|
|
3715
|
-
model.instruments[gaugeName] = _ObservabilityModelUtils.GetModelNode(0);
|
|
3716
|
-
}
|
|
3717
|
-
});
|
|
3718
|
-
__publicField2(_ObservabilityModelUtils, "ParseModelNodeWithQuantile", (model, data, parseLog, gaugeName, fieldName, quantileFieldName) => {
|
|
3719
|
-
if (fieldName in data && quantileFieldName in data) {
|
|
3720
|
-
model.instruments[gaugeName] = _ObservabilityModelUtils.GetModelNodeWithQuantile(data[fieldName], data[quantileFieldName]);
|
|
3721
|
-
} else if (fieldName in data) {
|
|
3722
|
-
const dataVal = data[fieldName];
|
|
3723
|
-
parseLog.push(`ObservabilityModelUtils:ParseModelNodeWithQuantile(): QuantileFieldName not present: [${quantileFieldName}], default to [${dataVal},{}]`);
|
|
3724
|
-
model.instruments[gaugeName] = _ObservabilityModelUtils.GetModelNodeWithQuantile(dataVal, {});
|
|
3725
|
-
} else {
|
|
3726
|
-
parseLog.push(`ObservabilityModelUtils:ParseModelNodeWithQuantile(): Field not present: [${fieldName}], QuantileFieldName not present: [${quantileFieldName}], default to [0,{}]`);
|
|
3727
|
-
model.instruments[gaugeName] = _ObservabilityModelUtils.GetModelNodeWithQuantile(0, {});
|
|
3728
|
-
}
|
|
3729
|
-
});
|
|
3730
|
-
__publicField2(_ObservabilityModelUtils, "ParseModelNodeHisto", (model, data, parseLog, gaugeName, fieldName) => {
|
|
3731
|
-
if (fieldName in data) {
|
|
3732
|
-
model.instruments[gaugeName] = _ObservabilityModelUtils.GetModelNodeHistFromInfluxData(data[fieldName]);
|
|
3733
|
-
} else {
|
|
3734
|
-
parseLog.push(`ObservabilityModelUtils:ParseModelNodeHisto(): Field not present: [${fieldName}], default to [{}]`);
|
|
3735
|
-
model.instruments[gaugeName] = _ObservabilityModelUtils.GetModelNodeHistFromInfluxData({});
|
|
3736
|
-
}
|
|
3737
|
-
});
|
|
3738
|
-
__publicField2(_ObservabilityModelUtils, "ParseModelNodeObject", (model, data, parseLog, gaugeName, fieldName) => {
|
|
3739
|
-
if (fieldName in data) {
|
|
3740
|
-
model.instruments[gaugeName] = _ObservabilityModelUtils.GetModelNodeObject(data[fieldName]);
|
|
3741
|
-
} else {
|
|
3742
|
-
parseLog.push(`ObservabilityModelUtils:ParseModelNodeObject(): Field not present: [${fieldName}], default to [{}]`);
|
|
3743
|
-
model.instruments[gaugeName] = _ObservabilityModelUtils.GetModelNodeObject({});
|
|
3744
|
-
}
|
|
3745
|
-
});
|
|
3746
|
-
const byteToHex = [];
|
|
3747
|
-
for (let i = 0; i < 256; ++i) {
|
|
3748
|
-
byteToHex.push((i + 256).toString(16).slice(1));
|
|
3749
|
-
}
|
|
3750
|
-
typeof crypto !== "undefined" && crypto.randomUUID && crypto.randomUUID.bind(crypto);
|
|
3751
354
|
const TelemetryStore = defineStore("__sts__TelemetryStore", {
|
|
3752
355
|
// State
|
|
3753
356
|
// https://pinia.vuejs.org/core-concepts/state.html
|
|
@@ -5091,7 +1694,7 @@ const applyOptions = (object, options = {}) => {
|
|
|
5091
1694
|
const colorLevel = stdoutColor ? stdoutColor.level : 0;
|
|
5092
1695
|
object.level = options.level === void 0 ? colorLevel : options.level;
|
|
5093
1696
|
};
|
|
5094
|
-
class
|
|
1697
|
+
class ChalkClass {
|
|
5095
1698
|
constructor(options) {
|
|
5096
1699
|
return chalkFactory(options);
|
|
5097
1700
|
}
|
|
@@ -5105,7 +1708,7 @@ const chalkFactory = (options) => {
|
|
|
5105
1708
|
chalk2.template.constructor = () => {
|
|
5106
1709
|
throw new Error("`chalk.constructor()` is deprecated. Use `new chalk.Instance()` instead.");
|
|
5107
1710
|
};
|
|
5108
|
-
chalk2.template.Instance =
|
|
1711
|
+
chalk2.template.Instance = ChalkClass;
|
|
5109
1712
|
return chalk2.template;
|
|
5110
1713
|
};
|
|
5111
1714
|
function Chalk(options) {
|
|
@@ -5182,7 +1785,7 @@ const createStyler = (open, close, parent) => {
|
|
|
5182
1785
|
parent
|
|
5183
1786
|
};
|
|
5184
1787
|
};
|
|
5185
|
-
const createBuilder = (
|
|
1788
|
+
const createBuilder = (self, _styler, _isEmpty) => {
|
|
5186
1789
|
const builder = (...arguments_) => {
|
|
5187
1790
|
if (isArray(arguments_[0]) && isArray(arguments_[0].raw)) {
|
|
5188
1791
|
return applyStyle(builder, chalkTag(builder, ...arguments_));
|
|
@@ -5190,16 +1793,16 @@ const createBuilder = (self2, _styler, _isEmpty) => {
|
|
|
5190
1793
|
return applyStyle(builder, arguments_.length === 1 ? "" + arguments_[0] : arguments_.join(" "));
|
|
5191
1794
|
};
|
|
5192
1795
|
Object.setPrototypeOf(builder, proto);
|
|
5193
|
-
builder._generator =
|
|
1796
|
+
builder._generator = self;
|
|
5194
1797
|
builder._styler = _styler;
|
|
5195
1798
|
builder._isEmpty = _isEmpty;
|
|
5196
1799
|
return builder;
|
|
5197
1800
|
};
|
|
5198
|
-
const applyStyle = (
|
|
5199
|
-
if (
|
|
5200
|
-
return
|
|
1801
|
+
const applyStyle = (self, string) => {
|
|
1802
|
+
if (self.level <= 0 || !string) {
|
|
1803
|
+
return self._isEmpty ? "" : string;
|
|
5201
1804
|
}
|
|
5202
|
-
let styler =
|
|
1805
|
+
let styler = self._styler;
|
|
5203
1806
|
if (styler === void 0) {
|
|
5204
1807
|
return string;
|
|
5205
1808
|
}
|
|
@@ -5256,6 +1859,7 @@ class STSWorkerManager {
|
|
|
5256
1859
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
5257
1860
|
__privateAdd(this, _app, void 0);
|
|
5258
1861
|
__publicField(this, "AddWorker", async (useWorkerFactory) => {
|
|
1862
|
+
var _a;
|
|
5259
1863
|
let workerFactory;
|
|
5260
1864
|
if (useWorkerFactory) {
|
|
5261
1865
|
workerFactory = useWorkerFactory;
|
|
@@ -5275,7 +1879,7 @@ class STSWorkerManager {
|
|
|
5275
1879
|
StopRunner: (runner) => __privateGet(this, _StopRunner).call(this, stsWorkerEx, runner),
|
|
5276
1880
|
Stop: async () => __privateGet(this, _StopWorker).call(this, stsWorkerEx)
|
|
5277
1881
|
};
|
|
5278
|
-
__privateGet(this, _STSInstrumentController).LogEx(chalk$1.yellow(`Creating new worker: [${stsWorkerEx.id}]`));
|
|
1882
|
+
(_a = __privateGet(this, _STSInstrumentController)) == null ? void 0 : _a.LogEx(chalk$1.yellow(`Creating new worker: [${stsWorkerEx.id}]`));
|
|
5279
1883
|
console.log(`Adding worker: [${stsWorkerEx.id}]`);
|
|
5280
1884
|
stsWorkerEx.worker.onmessage = function(data) {
|
|
5281
1885
|
console.log(data.data);
|
|
@@ -5446,8 +2050,9 @@ class STSWorkerManager {
|
|
|
5446
2050
|
}
|
|
5447
2051
|
});
|
|
5448
2052
|
__privateAdd(this, _CreateAsyncRunner, (workerEx, runnerOptions) => {
|
|
2053
|
+
var _a;
|
|
5449
2054
|
__privateWrapper(this, _runner)._++;
|
|
5450
|
-
__privateGet(this, _STSInstrumentController).LogEx(chalk$1.yellow(`Creating new async runner: [${__privateGet(this, _runner)}]`));
|
|
2055
|
+
(_a = __privateGet(this, _STSInstrumentController)) == null ? void 0 : _a.LogEx(chalk$1.yellow(`Creating new async runner: [${__privateGet(this, _runner)}]`));
|
|
5451
2056
|
const asyncRunnerContext = {
|
|
5452
2057
|
nid: `${workerEx.workerThreadWorkerOptions.hostName}${ModelDelimeter.COMPONENT_SEPERATOR}${workerEx.workerThreadWorkerOptions.agentId}-${workerEx.workerThreadWorkerOptions.userAgent}${ModelDelimeter.NID_SEPERATOR}worker${workerEx.id}${ModelDelimeter.SEPERATOR}${__privateGet(this, _runner)}`,
|
|
5453
2058
|
id: __privateGet(this, _runner).toString(),
|
|
@@ -5621,19 +2226,22 @@ class STSWorkerManager {
|
|
|
5621
2226
|
} else {
|
|
5622
2227
|
__privateSet(this, _options, {});
|
|
5623
2228
|
}
|
|
5624
|
-
|
|
5625
|
-
|
|
5626
|
-
|
|
5627
|
-
|
|
5628
|
-
|
|
5629
|
-
|
|
5630
|
-
|
|
5631
|
-
|
|
5632
|
-
console.log(chalk$1.yellow(
|
|
5633
|
-
|
|
5634
|
-
|
|
5635
|
-
|
|
5636
|
-
|
|
2229
|
+
setTimeout(() => {
|
|
2230
|
+
console.log(chalk$1.yellow(`CompareSTSInstrumentControllerPluginKeyWMEx(): [${CompareSTSInstrumentControllerPluginKeyWMEx()}]`));
|
|
2231
|
+
console.log(chalk$1.yellow(`Attempting to get STSInstrumentControllerPlugin using symbol: [${String(STSInstrumentControllerPluginKey)}]`));
|
|
2232
|
+
__privateSet(this, _STSInstrumentController, app.config.globalProperties.$sts.aic);
|
|
2233
|
+
console.log(chalk$1.yellow(GetSTSInstrumentController(app)));
|
|
2234
|
+
console.log(chalk$1.yellow(app.config.globalProperties.$sts[STSInstrumentControllerPluginKey]));
|
|
2235
|
+
console.log(chalk$1.yellow(__privateGet(this, _STSInstrumentController)));
|
|
2236
|
+
console.log(chalk$1.yellow(app.config.globalProperties.$sts.aic));
|
|
2237
|
+
console.log(chalk$1.yellow("keys within app.config.globalProperties.$sts"));
|
|
2238
|
+
for (const [key] of Object.entries(app.config.globalProperties.$sts)) {
|
|
2239
|
+
console.log(chalk$1.yellow(`${key}`));
|
|
2240
|
+
}
|
|
2241
|
+
if (!__privateGet(this, _STSInstrumentController)) {
|
|
2242
|
+
console.log(chalk$1.yellow(`Failed to get STSInstrumentControllerPlugin using symbol: [${String(STSInstrumentControllerPluginKey)}]`));
|
|
2243
|
+
}
|
|
2244
|
+
}, 0);
|
|
5637
2245
|
}
|
|
5638
2246
|
get WorkersEx() {
|
|
5639
2247
|
return __privateGet(this, _workersEx);
|