@nsshunt/stsoauth2plugin 1.0.119 → 1.0.121

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.
@@ -17,16 +17,14 @@ var __privateWrapper = (obj, member, setter, getter) => ({
17
17
  return __privateGet(obj, member, getter);
18
18
  }
19
19
  });
20
- var _router, _STORAGE_AUTHORIZE_OPTIONS_KEY, _aic, _options2, _oauth2ManagerPort, _messageId, _messageHandlers, _messageTimeout, _worker, _transactionStore, _operationSemaphore, _maxSemaphoreRetries, _semaphoreRetrySleep, _STSOAuth2Manager_instances, LogDebugMessage_fn, LogInfoMessage_fn, LogErrorMessage_fn, _ProcessMessageResponse, _PostMessage, _HandleLogEvent, _HandleUpdateInstrumentEvent, _GetStore, _HandleErrorEvent, _HandleAuthenticateEvent, _SetupRoute, _crypto, _clientSessionStore, _cUtils, _qParams, _STORAGE_SESSION_KEY, _oauthWorkerPort, _options3, _logger, _agentManager2, _STSOAuth2Worker_instances, LogDebugMessage_fn2, LogInfoMessage_fn2, LogErrorMessage_fn2, _HandleAuthenticateEvent2, _HandleErrorEvent2, _LogMessage, _GetAccessToken, _GetCookies, _UpdateInstrument, _ProcessCommand, _RestoreSession, _Authorize, _HandleRedirect, _GetTokenFromBroker, _GetToken, _RefreshToken, _Logout;
20
+ var _router, _STORAGE_AUTHORIZE_OPTIONS_KEY, _aic, _options, _oauth2ManagerPort, _messageId, _messageHandlers, _messageTimeout, _worker, _transactionStore, _operationSemaphore, _maxSemaphoreRetries, _semaphoreRetrySleep, _STSOAuth2Manager_instances, LogDebugMessage_fn, LogInfoMessage_fn, LogErrorMessage_fn, _ProcessMessageResponse, _PostMessage, _HandleLogEvent, _HandleUpdateInstrumentEvent, _GetStore, _HandleErrorEvent, _HandleAuthenticateEvent, _SetupRoute, _crypto, _clientSessionStore, _cUtils, _qParams, _STORAGE_SESSION_KEY, _oauthWorkerPort, _options2, _logger, _agentManager, _STSOAuth2Worker_instances, LogDebugMessage_fn2, LogInfoMessage_fn2, LogErrorMessage_fn2, _HandleAuthenticateEvent2, _HandleErrorEvent2, _LogMessage, _GetAccessToken, _GetCookies, _UpdateInstrument, _ProcessCommand, _RestoreSession, _Authorize, _HandleRedirect, _GetTokenFromBroker, _GetToken, _RefreshToken, _Logout;
21
21
  import { inject } from "vue";
22
22
  import * as wt from "node:worker_threads";
23
- import { OAuth2ParameterType, Sleep } from "@nsshunt/stsutils";
23
+ import { OAuth2ParameterType, Sleep, AgentManager, STSAxiosConfig } from "@nsshunt/stsutils";
24
24
  import { ClientStorageFactory, ClientStorageType } from "@nsshunt/stsvueutils";
25
25
  import { defineStore } from "pinia";
26
26
  import { STSInstrumentControllerPluginKey, Gauge } from "@nsshunt/stsobservability";
27
27
  import axios from "axios";
28
- import * as fs$1 from "node:fs";
29
- import require$$3 from "crypto";
30
28
  import http from "node:http";
31
29
  import https from "node:https";
32
30
  const STSOAuth2ManagerPluginKey = Symbol();
@@ -34,37 +32,13 @@ var commonjsGlobal = typeof globalThis !== "undefined" ? globalThis : typeof win
34
32
  function getDefaultExportFromCjs(x) {
35
33
  return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, "default") ? x["default"] : x;
36
34
  }
37
- function getAugmentedNamespace(n) {
38
- if (n.__esModule) return n;
39
- var f = n.default;
40
- if (typeof f == "function") {
41
- var a = function a2() {
42
- if (this instanceof a2) {
43
- return Reflect.construct(f, arguments, this.constructor);
44
- }
45
- return f.apply(this, arguments);
46
- };
47
- a.prototype = f.prototype;
48
- } else a = {};
49
- Object.defineProperty(a, "__esModule", { value: true });
50
- Object.keys(n).forEach(function(k) {
51
- var d = Object.getOwnPropertyDescriptor(n, k);
52
- Object.defineProperty(a, k, d.get ? d : {
53
- enumerable: true,
54
- get: function() {
55
- return n[k];
56
- }
57
- });
58
- });
59
- return a;
60
- }
61
- var ansiStyles$3 = { exports: {} };
62
- var colorName$1;
63
- var hasRequiredColorName$1;
64
- function requireColorName$1() {
65
- if (hasRequiredColorName$1) return colorName$1;
66
- hasRequiredColorName$1 = 1;
67
- colorName$1 = {
35
+ var ansiStyles$1 = { exports: {} };
36
+ var colorName;
37
+ var hasRequiredColorName;
38
+ function requireColorName() {
39
+ if (hasRequiredColorName) return colorName;
40
+ hasRequiredColorName = 1;
41
+ colorName = {
68
42
  "aliceblue": [240, 248, 255],
69
43
  "antiquewhite": [250, 235, 215],
70
44
  "aqua": [0, 255, 255],
@@ -214,14 +188,14 @@ function requireColorName$1() {
214
188
  "yellow": [255, 255, 0],
215
189
  "yellowgreen": [154, 205, 50]
216
190
  };
217
- return colorName$1;
191
+ return colorName;
218
192
  }
219
- var conversions$1;
220
- var hasRequiredConversions$1;
221
- function requireConversions$1() {
222
- if (hasRequiredConversions$1) return conversions$1;
223
- hasRequiredConversions$1 = 1;
224
- const cssKeywords = requireColorName$1();
193
+ var conversions;
194
+ var hasRequiredConversions;
195
+ function requireConversions() {
196
+ if (hasRequiredConversions) return conversions;
197
+ hasRequiredConversions = 1;
198
+ const cssKeywords = requireColorName();
225
199
  const reverseKeywords = {};
226
200
  for (const key of Object.keys(cssKeywords)) {
227
201
  reverseKeywords[cssKeywords[key]] = key;
@@ -243,7 +217,7 @@ function requireConversions$1() {
243
217
  apple: { channels: 3, labels: ["r16", "g16", "b16"] },
244
218
  gray: { channels: 1, labels: ["gray"] }
245
219
  };
246
- conversions$1 = convert;
220
+ conversions = convert;
247
221
  for (const model of Object.keys(convert)) {
248
222
  if (!("channels" in convert[model])) {
249
223
  throw new Error("missing channels property: " + model);
@@ -886,14 +860,14 @@ function requireConversions$1() {
886
860
  const val = (rgb[0] + rgb[1] + rgb[2]) / 3;
887
861
  return [val / 255 * 100];
888
862
  };
889
- return conversions$1;
863
+ return conversions;
890
864
  }
891
- var route$1;
892
- var hasRequiredRoute$1;
893
- function requireRoute$1() {
894
- if (hasRequiredRoute$1) return route$1;
895
- hasRequiredRoute$1 = 1;
896
- const conversions2 = requireConversions$1();
865
+ var route;
866
+ var hasRequiredRoute;
867
+ function requireRoute() {
868
+ if (hasRequiredRoute) return route;
869
+ hasRequiredRoute = 1;
870
+ const conversions2 = requireConversions();
897
871
  function buildGraph() {
898
872
  const graph = {};
899
873
  const models = Object.keys(conversions2);
@@ -932,18 +906,18 @@ function requireRoute$1() {
932
906
  };
933
907
  }
934
908
  function wrapConversion(toModel, graph) {
935
- const path2 = [graph[toModel].parent, toModel];
909
+ const path = [graph[toModel].parent, toModel];
936
910
  let fn = conversions2[graph[toModel].parent][toModel];
937
911
  let cur = graph[toModel].parent;
938
912
  while (graph[cur].parent) {
939
- path2.unshift(graph[cur].parent);
913
+ path.unshift(graph[cur].parent);
940
914
  fn = link(conversions2[graph[cur].parent][cur], fn);
941
915
  cur = graph[cur].parent;
942
916
  }
943
- fn.conversion = path2;
917
+ fn.conversion = path;
944
918
  return fn;
945
919
  }
946
- route$1 = function(fromModel) {
920
+ route = function(fromModel) {
947
921
  const graph = deriveBFS(fromModel);
948
922
  const conversion = {};
949
923
  const models = Object.keys(graph);
@@ -957,15 +931,15 @@ function requireRoute$1() {
957
931
  }
958
932
  return conversion;
959
933
  };
960
- return route$1;
934
+ return route;
961
935
  }
962
- var colorConvert$1;
963
- var hasRequiredColorConvert$1;
964
- function requireColorConvert$1() {
965
- if (hasRequiredColorConvert$1) return colorConvert$1;
966
- hasRequiredColorConvert$1 = 1;
967
- const conversions2 = requireConversions$1();
968
- const route2 = requireRoute$1();
936
+ var colorConvert;
937
+ var hasRequiredColorConvert;
938
+ function requireColorConvert() {
939
+ if (hasRequiredColorConvert) return colorConvert;
940
+ hasRequiredColorConvert = 1;
941
+ const conversions2 = requireConversions();
942
+ const route2 = requireRoute();
969
943
  const convert = {};
970
944
  const models = Object.keys(conversions2);
971
945
  function wrapRaw(fn) {
@@ -1018,10 +992,10 @@ function requireColorConvert$1() {
1018
992
  convert[fromModel][toModel].raw = wrapRaw(fn);
1019
993
  });
1020
994
  });
1021
- colorConvert$1 = convert;
1022
- return colorConvert$1;
995
+ colorConvert = convert;
996
+ return colorConvert;
1023
997
  }
1024
- ansiStyles$3.exports;
998
+ ansiStyles$1.exports;
1025
999
  (function(module) {
1026
1000
  const wrapAnsi16 = (fn, offset) => (...args) => {
1027
1001
  const code = fn(...args);
@@ -1055,16 +1029,16 @@ ansiStyles$3.exports;
1055
1029
  let colorConvert2;
1056
1030
  const makeDynamicStyles = (wrap, targetSpace, identity, isBackground) => {
1057
1031
  if (colorConvert2 === void 0) {
1058
- colorConvert2 = requireColorConvert$1();
1032
+ colorConvert2 = requireColorConvert();
1059
1033
  }
1060
1034
  const offset = isBackground ? 10 : 0;
1061
1035
  const styles2 = {};
1062
1036
  for (const [sourceSpace, suite] of Object.entries(colorConvert2)) {
1063
- const name2 = sourceSpace === "ansi16" ? "ansi" : sourceSpace;
1037
+ const name = sourceSpace === "ansi16" ? "ansi" : sourceSpace;
1064
1038
  if (sourceSpace === targetSpace) {
1065
- styles2[name2] = wrap(identity, offset);
1039
+ styles2[name] = wrap(identity, offset);
1066
1040
  } else if (typeof suite === "object") {
1067
- styles2[name2] = wrap(suite[targetSpace], offset);
1041
+ styles2[name] = wrap(suite[targetSpace], offset);
1068
1042
  }
1069
1043
  }
1070
1044
  return styles2;
@@ -1158,13 +1132,13 @@ ansiStyles$3.exports;
1158
1132
  enumerable: true,
1159
1133
  get: assembleStyles
1160
1134
  });
1161
- })(ansiStyles$3);
1162
- var ansiStylesExports$1 = ansiStyles$3.exports;
1163
- var browser$2 = {
1135
+ })(ansiStyles$1);
1136
+ var ansiStylesExports = ansiStyles$1.exports;
1137
+ var browser = {
1164
1138
  stdout: false,
1165
1139
  stderr: false
1166
1140
  };
1167
- const stringReplaceAll$3 = (string, substring, replacer) => {
1141
+ const stringReplaceAll$1 = (string, substring, replacer) => {
1168
1142
  let index = string.indexOf(substring);
1169
1143
  if (index === -1) {
1170
1144
  return string;
@@ -1180,7 +1154,7 @@ const stringReplaceAll$3 = (string, substring, replacer) => {
1180
1154
  returnValue += string.substr(endIndex);
1181
1155
  return returnValue;
1182
1156
  };
1183
- const stringEncaseCRLFWithFirstIndex$3 = (string, prefix, postfix, index) => {
1157
+ const stringEncaseCRLFWithFirstIndex$1 = (string, prefix, postfix, index) => {
1184
1158
  let endIndex = 0;
1185
1159
  let returnValue = "";
1186
1160
  do {
@@ -1192,15 +1166,15 @@ const stringEncaseCRLFWithFirstIndex$3 = (string, prefix, postfix, index) => {
1192
1166
  returnValue += string.substr(endIndex);
1193
1167
  return returnValue;
1194
1168
  };
1195
- var util$1 = {
1196
- stringReplaceAll: stringReplaceAll$3,
1197
- stringEncaseCRLFWithFirstIndex: stringEncaseCRLFWithFirstIndex$3
1169
+ var util = {
1170
+ stringReplaceAll: stringReplaceAll$1,
1171
+ stringEncaseCRLFWithFirstIndex: stringEncaseCRLFWithFirstIndex$1
1198
1172
  };
1199
- var templates$1;
1200
- var hasRequiredTemplates$1;
1201
- function requireTemplates$1() {
1202
- if (hasRequiredTemplates$1) return templates$1;
1203
- hasRequiredTemplates$1 = 1;
1173
+ var templates;
1174
+ var hasRequiredTemplates;
1175
+ function requireTemplates() {
1176
+ if (hasRequiredTemplates) return templates;
1177
+ hasRequiredTemplates = 1;
1204
1178
  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;
1205
1179
  const STYLE_REGEX = /(?:^|\.)(\w+)(?:\(([^)]*)\))?/g;
1206
1180
  const STRING_REGEX = /^(['"])((?:\\.|(?!\1)[^\\])*)\1$/;
@@ -1228,7 +1202,7 @@ function requireTemplates$1() {
1228
1202
  }
1229
1203
  return ESCAPES.get(c) || c;
1230
1204
  }
1231
- function parseArguments(name2, arguments_) {
1205
+ function parseArguments(name, arguments_) {
1232
1206
  const results = [];
1233
1207
  const chunks = arguments_.trim().split(/\s*,\s*/g);
1234
1208
  let matches;
@@ -1239,7 +1213,7 @@ function requireTemplates$1() {
1239
1213
  } else if (matches = chunk.match(STRING_REGEX)) {
1240
1214
  results.push(matches[2].replace(ESCAPE_REGEX, (m, escape2, character) => escape2 ? unescape2(escape2) : character));
1241
1215
  } else {
1242
- throw new Error(`Invalid Chalk template style argument: ${chunk} (in style '${name2}')`);
1216
+ throw new Error(`Invalid Chalk template style argument: ${chunk} (in style '${name}')`);
1243
1217
  }
1244
1218
  }
1245
1219
  return results;
@@ -1249,12 +1223,12 @@ function requireTemplates$1() {
1249
1223
  const results = [];
1250
1224
  let matches;
1251
1225
  while ((matches = STYLE_REGEX.exec(style)) !== null) {
1252
- const name2 = matches[1];
1226
+ const name = matches[1];
1253
1227
  if (matches[2]) {
1254
- const args = parseArguments(name2, matches[2]);
1255
- results.push([name2].concat(args));
1228
+ const args = parseArguments(name, matches[2]);
1229
+ results.push([name].concat(args));
1256
1230
  } else {
1257
- results.push([name2]);
1231
+ results.push([name]);
1258
1232
  }
1259
1233
  }
1260
1234
  return results;
@@ -1278,7 +1252,7 @@ function requireTemplates$1() {
1278
1252
  }
1279
1253
  return current;
1280
1254
  }
1281
- templates$1 = (chalk2, temporary) => {
1255
+ templates = (chalk2, temporary) => {
1282
1256
  const styles2 = [];
1283
1257
  const chunks = [];
1284
1258
  let chunk = [];
@@ -1308,92 +1282,92 @@ function requireTemplates$1() {
1308
1282
  }
1309
1283
  return chunks.join("");
1310
1284
  };
1311
- return templates$1;
1285
+ return templates;
1312
1286
  }
1313
- const ansiStyles$2 = ansiStylesExports$1;
1314
- const { stdout: stdoutColor$1, stderr: stderrColor$1 } = browser$2;
1287
+ const ansiStyles = ansiStylesExports;
1288
+ const { stdout: stdoutColor, stderr: stderrColor } = browser;
1315
1289
  const {
1316
- stringReplaceAll: stringReplaceAll$2,
1317
- stringEncaseCRLFWithFirstIndex: stringEncaseCRLFWithFirstIndex$2
1318
- } = util$1;
1319
- const { isArray: isArray$1 } = Array;
1320
- const levelMapping$1 = [
1290
+ stringReplaceAll,
1291
+ stringEncaseCRLFWithFirstIndex
1292
+ } = util;
1293
+ const { isArray } = Array;
1294
+ const levelMapping = [
1321
1295
  "ansi",
1322
1296
  "ansi",
1323
1297
  "ansi256",
1324
1298
  "ansi16m"
1325
1299
  ];
1326
- const styles$1 = /* @__PURE__ */ Object.create(null);
1327
- const applyOptions$1 = (object, options = {}) => {
1300
+ const styles = /* @__PURE__ */ Object.create(null);
1301
+ const applyOptions = (object, options = {}) => {
1328
1302
  if (options.level && !(Number.isInteger(options.level) && options.level >= 0 && options.level <= 3)) {
1329
1303
  throw new Error("The `level` option should be an integer from 0 to 3");
1330
1304
  }
1331
- const colorLevel = stdoutColor$1 ? stdoutColor$1.level : 0;
1305
+ const colorLevel = stdoutColor ? stdoutColor.level : 0;
1332
1306
  object.level = options.level === void 0 ? colorLevel : options.level;
1333
1307
  };
1334
- let ChalkClass$1 = class ChalkClass {
1308
+ class ChalkClass {
1335
1309
  constructor(options) {
1336
- return chalkFactory$1(options);
1310
+ return chalkFactory(options);
1337
1311
  }
1338
- };
1339
- const chalkFactory$1 = (options) => {
1312
+ }
1313
+ const chalkFactory = (options) => {
1340
1314
  const chalk2 = {};
1341
- applyOptions$1(chalk2, options);
1342
- chalk2.template = (...arguments_) => chalkTag$1(chalk2.template, ...arguments_);
1343
- Object.setPrototypeOf(chalk2, Chalk$1.prototype);
1315
+ applyOptions(chalk2, options);
1316
+ chalk2.template = (...arguments_) => chalkTag(chalk2.template, ...arguments_);
1317
+ Object.setPrototypeOf(chalk2, Chalk.prototype);
1344
1318
  Object.setPrototypeOf(chalk2.template, chalk2);
1345
1319
  chalk2.template.constructor = () => {
1346
1320
  throw new Error("`chalk.constructor()` is deprecated. Use `new chalk.Instance()` instead.");
1347
1321
  };
1348
- chalk2.template.Instance = ChalkClass$1;
1322
+ chalk2.template.Instance = ChalkClass;
1349
1323
  return chalk2.template;
1350
1324
  };
1351
- function Chalk$1(options) {
1352
- return chalkFactory$1(options);
1325
+ function Chalk(options) {
1326
+ return chalkFactory(options);
1353
1327
  }
1354
- for (const [styleName, style] of Object.entries(ansiStyles$2)) {
1355
- styles$1[styleName] = {
1328
+ for (const [styleName, style] of Object.entries(ansiStyles)) {
1329
+ styles[styleName] = {
1356
1330
  get() {
1357
- const builder = createBuilder$1(this, createStyler$1(style.open, style.close, this._styler), this._isEmpty);
1331
+ const builder = createBuilder(this, createStyler(style.open, style.close, this._styler), this._isEmpty);
1358
1332
  Object.defineProperty(this, styleName, { value: builder });
1359
1333
  return builder;
1360
1334
  }
1361
1335
  };
1362
1336
  }
1363
- styles$1.visible = {
1337
+ styles.visible = {
1364
1338
  get() {
1365
- const builder = createBuilder$1(this, this._styler, true);
1339
+ const builder = createBuilder(this, this._styler, true);
1366
1340
  Object.defineProperty(this, "visible", { value: builder });
1367
1341
  return builder;
1368
1342
  }
1369
1343
  };
1370
- const usedModels$1 = ["rgb", "hex", "keyword", "hsl", "hsv", "hwb", "ansi", "ansi256"];
1371
- for (const model of usedModels$1) {
1372
- styles$1[model] = {
1344
+ const usedModels = ["rgb", "hex", "keyword", "hsl", "hsv", "hwb", "ansi", "ansi256"];
1345
+ for (const model of usedModels) {
1346
+ styles[model] = {
1373
1347
  get() {
1374
1348
  const { level } = this;
1375
1349
  return function(...arguments_) {
1376
- const styler = createStyler$1(ansiStyles$2.color[levelMapping$1[level]][model](...arguments_), ansiStyles$2.color.close, this._styler);
1377
- return createBuilder$1(this, styler, this._isEmpty);
1350
+ const styler = createStyler(ansiStyles.color[levelMapping[level]][model](...arguments_), ansiStyles.color.close, this._styler);
1351
+ return createBuilder(this, styler, this._isEmpty);
1378
1352
  };
1379
1353
  }
1380
1354
  };
1381
1355
  }
1382
- for (const model of usedModels$1) {
1356
+ for (const model of usedModels) {
1383
1357
  const bgModel = "bg" + model[0].toUpperCase() + model.slice(1);
1384
- styles$1[bgModel] = {
1358
+ styles[bgModel] = {
1385
1359
  get() {
1386
1360
  const { level } = this;
1387
1361
  return function(...arguments_) {
1388
- const styler = createStyler$1(ansiStyles$2.bgColor[levelMapping$1[level]][model](...arguments_), ansiStyles$2.bgColor.close, this._styler);
1389
- return createBuilder$1(this, styler, this._isEmpty);
1362
+ const styler = createStyler(ansiStyles.bgColor[levelMapping[level]][model](...arguments_), ansiStyles.bgColor.close, this._styler);
1363
+ return createBuilder(this, styler, this._isEmpty);
1390
1364
  };
1391
1365
  }
1392
1366
  };
1393
1367
  }
1394
- const proto$1 = Object.defineProperties(() => {
1368
+ const proto = Object.defineProperties(() => {
1395
1369
  }, {
1396
- ...styles$1,
1370
+ ...styles,
1397
1371
  level: {
1398
1372
  enumerable: true,
1399
1373
  get() {
@@ -1404,7 +1378,7 @@ const proto$1 = Object.defineProperties(() => {
1404
1378
  }
1405
1379
  }
1406
1380
  });
1407
- const createStyler$1 = (open, close, parent) => {
1381
+ const createStyler = (open, close, parent) => {
1408
1382
  let openAll;
1409
1383
  let closeAll;
1410
1384
  if (parent === void 0) {
@@ -1422,20 +1396,20 @@ const createStyler$1 = (open, close, parent) => {
1422
1396
  parent
1423
1397
  };
1424
1398
  };
1425
- const createBuilder$1 = (self2, _styler, _isEmpty) => {
1399
+ const createBuilder = (self2, _styler, _isEmpty) => {
1426
1400
  const builder = (...arguments_) => {
1427
- if (isArray$1(arguments_[0]) && isArray$1(arguments_[0].raw)) {
1428
- return applyStyle$1(builder, chalkTag$1(builder, ...arguments_));
1401
+ if (isArray(arguments_[0]) && isArray(arguments_[0].raw)) {
1402
+ return applyStyle(builder, chalkTag(builder, ...arguments_));
1429
1403
  }
1430
- return applyStyle$1(builder, arguments_.length === 1 ? "" + arguments_[0] : arguments_.join(" "));
1404
+ return applyStyle(builder, arguments_.length === 1 ? "" + arguments_[0] : arguments_.join(" "));
1431
1405
  };
1432
- Object.setPrototypeOf(builder, proto$1);
1406
+ Object.setPrototypeOf(builder, proto);
1433
1407
  builder._generator = self2;
1434
1408
  builder._styler = _styler;
1435
1409
  builder._isEmpty = _isEmpty;
1436
1410
  return builder;
1437
1411
  };
1438
- const applyStyle$1 = (self2, string) => {
1412
+ const applyStyle = (self2, string) => {
1439
1413
  if (self2.level <= 0 || !string) {
1440
1414
  return self2._isEmpty ? "" : string;
1441
1415
  }
@@ -1446,20 +1420,20 @@ const applyStyle$1 = (self2, string) => {
1446
1420
  const { openAll, closeAll } = styler;
1447
1421
  if (string.indexOf("\x1B") !== -1) {
1448
1422
  while (styler !== void 0) {
1449
- string = stringReplaceAll$2(string, styler.close, styler.open);
1423
+ string = stringReplaceAll(string, styler.close, styler.open);
1450
1424
  styler = styler.parent;
1451
1425
  }
1452
1426
  }
1453
1427
  const lfIndex = string.indexOf("\n");
1454
1428
  if (lfIndex !== -1) {
1455
- string = stringEncaseCRLFWithFirstIndex$2(string, closeAll, openAll, lfIndex);
1429
+ string = stringEncaseCRLFWithFirstIndex(string, closeAll, openAll, lfIndex);
1456
1430
  }
1457
1431
  return openAll + string + closeAll;
1458
1432
  };
1459
- let template$1;
1460
- const chalkTag$1 = (chalk2, ...strings) => {
1433
+ let template;
1434
+ const chalkTag = (chalk2, ...strings) => {
1461
1435
  const [firstString] = strings;
1462
- if (!isArray$1(firstString) || !isArray$1(firstString.raw)) {
1436
+ if (!isArray(firstString) || !isArray(firstString.raw)) {
1463
1437
  return strings.join(" ");
1464
1438
  }
1465
1439
  const arguments_ = strings.slice(1);
@@ -1470,18 +1444,18 @@ const chalkTag$1 = (chalk2, ...strings) => {
1470
1444
  String(firstString.raw[i])
1471
1445
  );
1472
1446
  }
1473
- if (template$1 === void 0) {
1474
- template$1 = requireTemplates$1();
1447
+ if (template === void 0) {
1448
+ template = requireTemplates();
1475
1449
  }
1476
- return template$1(chalk2, parts.join(""));
1450
+ return template(chalk2, parts.join(""));
1477
1451
  };
1478
- Object.defineProperties(Chalk$1.prototype, styles$1);
1479
- const chalk$1 = Chalk$1();
1480
- chalk$1.supportsColor = stdoutColor$1;
1481
- chalk$1.stderr = Chalk$1({ level: stderrColor$1 ? stderrColor$1.level : 0 });
1482
- chalk$1.stderr.supportsColor = stderrColor$1;
1483
- var source = chalk$1;
1484
- const chalk$2 = /* @__PURE__ */ getDefaultExportFromCjs(source);
1452
+ Object.defineProperties(Chalk.prototype, styles);
1453
+ const chalk = Chalk();
1454
+ chalk.supportsColor = stdoutColor;
1455
+ chalk.stderr = Chalk({ level: stderrColor ? stderrColor.level : 0 });
1456
+ chalk.stderr.supportsColor = stderrColor;
1457
+ var source = chalk;
1458
+ const chalk$1 = /* @__PURE__ */ getDefaultExportFromCjs(source);
1485
1459
  const isNode = Object.prototype.toString.call(typeof process !== "undefined" ? process : 0) === "[object process]";
1486
1460
  var AuthorizeOptionsResponseType = /* @__PURE__ */ ((AuthorizeOptionsResponseType2) => {
1487
1461
  AuthorizeOptionsResponseType2["CODE"] = "code";
@@ -1624,7 +1598,7 @@ class STSOAuth2Manager {
1624
1598
  __privateAdd(this, _router, null);
1625
1599
  __privateAdd(this, _STORAGE_AUTHORIZE_OPTIONS_KEY, "authorize_options.stsmda.com.au");
1626
1600
  __privateAdd(this, _aic, null);
1627
- __privateAdd(this, _options2);
1601
+ __privateAdd(this, _options);
1628
1602
  __privateAdd(this, _oauth2ManagerPort);
1629
1603
  __privateAdd(this, _messageId, 0);
1630
1604
  __privateAdd(this, _messageHandlers, {});
@@ -1639,7 +1613,7 @@ class STSOAuth2Manager {
1639
1613
  __privateAdd(this, _semaphoreRetrySleep, 50);
1640
1614
  __privateAdd(this, _ProcessMessageResponse, (data) => {
1641
1615
  const messageResponse = data;
1642
- __privateMethod(this, _STSOAuth2Manager_instances, LogDebugMessage_fn).call(this, chalk$2.yellow(`STSOAuth2Manager:#ProcessMessageResponse: message data = [${JSON.stringify(messageResponse)}]`));
1616
+ __privateMethod(this, _STSOAuth2Manager_instances, LogDebugMessage_fn).call(this, chalk$1.yellow(`STSOAuth2Manager:#ProcessMessageResponse: message data = [${JSON.stringify(messageResponse)}]`));
1643
1617
  if (messageResponse.messageId === -1) {
1644
1618
  switch (messageResponse.command) {
1645
1619
  case IOauth2ListenerCommand.AUTHENTICATE_EVENT:
@@ -1676,10 +1650,10 @@ class STSOAuth2Manager {
1676
1650
  __privateGet(this, _messageHandlers)[message.messageId] = (response) => {
1677
1651
  clearTimeout(timeout);
1678
1652
  delete __privateGet(this, _messageHandlers)[message.messageId];
1679
- __privateMethod(this, _STSOAuth2Manager_instances, LogDebugMessage_fn).call(this, chalk$2.yellow(`STSOAuth2Manager:#PostMessage: resolve callback response= [${JSON.stringify(response)}]`));
1653
+ __privateMethod(this, _STSOAuth2Manager_instances, LogDebugMessage_fn).call(this, chalk$1.yellow(`STSOAuth2Manager:#PostMessage: resolve callback response= [${JSON.stringify(response)}]`));
1680
1654
  resolve(response);
1681
1655
  };
1682
- __privateMethod(this, _STSOAuth2Manager_instances, LogDebugMessage_fn).call(this, chalk$2.yellow(`STSOAuth2Manager:#PostMessage: posting message = [${JSON.stringify(message)}]`));
1656
+ __privateMethod(this, _STSOAuth2Manager_instances, LogDebugMessage_fn).call(this, chalk$1.yellow(`STSOAuth2Manager:#PostMessage: posting message = [${JSON.stringify(message)}]`));
1683
1657
  __privateGet(this, _oauth2ManagerPort).postMessage(message);
1684
1658
  });
1685
1659
  });
@@ -1696,7 +1670,7 @@ class STSOAuth2Manager {
1696
1670
  }
1697
1671
  });
1698
1672
  __privateAdd(this, _GetStore, () => {
1699
- return STSOauth2Store(__privateGet(this, _options2).pinia);
1673
+ return STSOauth2Store(__privateGet(this, _options).pinia);
1700
1674
  });
1701
1675
  // Will come from message channel
1702
1676
  __privateAdd(this, _HandleErrorEvent, (error) => {
@@ -1707,66 +1681,66 @@ class STSOAuth2Manager {
1707
1681
  message: error
1708
1682
  });
1709
1683
  setTimeout(() => {
1710
- __privateGet(this, _router).replace(`${__privateGet(this, _options2).uriBase}error`);
1684
+ __privateGet(this, _router).replace(`${__privateGet(this, _options).uriBase}error`);
1711
1685
  }, 0);
1712
1686
  }
1713
1687
  });
1714
1688
  __privateAdd(this, _HandleAuthenticateEvent, (id_token) => {
1715
1689
  if (isNode) ;
1716
1690
  else {
1717
- if (__privateGet(this, _options2).authenticateEvent) {
1718
- __privateGet(this, _options2).authenticateEvent(id_token);
1691
+ if (__privateGet(this, _options).authenticateEvent) {
1692
+ __privateGet(this, _options).authenticateEvent(id_token);
1719
1693
  }
1720
1694
  __privateGet(this, _GetStore).call(this).UpdateIdToken(id_token);
1721
1695
  }
1722
1696
  });
1723
1697
  __privateAdd(this, _SetupRoute, (app, router) => {
1724
- __privateMethod(this, _STSOAuth2Manager_instances, LogDebugMessage_fn).call(this, chalk$2.gray(`STSOAuth2Manager:#SetupRoute`));
1698
+ __privateMethod(this, _STSOAuth2Manager_instances, LogDebugMessage_fn).call(this, chalk$1.gray(`STSOAuth2Manager:#SetupRoute`));
1725
1699
  router.beforeEach(async (to, from, next) => {
1726
1700
  const oAuth2Manager = app.config.globalProperties.$sts[STSOAuth2ManagerPluginKey];
1727
- __privateMethod(this, _STSOAuth2Manager_instances, LogDebugMessage_fn).call(this, chalk$2.gray(`beforeEach: from: [${from.path}], to: [${to.path}]`));
1701
+ __privateMethod(this, _STSOAuth2Manager_instances, LogDebugMessage_fn).call(this, chalk$1.gray(`beforeEach: from: [${from.path}], to: [${to.path}]`));
1728
1702
  if (__privateGet(this, _GetStore).call(this).LoggedIn === false) {
1729
1703
  __privateMethod(this, _STSOAuth2Manager_instances, LogInfoMessage_fn).call(this, `Not logged in`);
1730
- if (to.path.localeCompare(`${__privateGet(this, _options2).uriBase}authorize`) === 0) {
1731
- __privateMethod(this, _STSOAuth2Manager_instances, LogInfoMessage_fn).call(this, `to = ${__privateGet(this, _options2).uriBase}authorize`);
1704
+ if (to.path.localeCompare(`${__privateGet(this, _options).uriBase}authorize`) === 0) {
1705
+ __privateMethod(this, _STSOAuth2Manager_instances, LogInfoMessage_fn).call(this, `to = ${__privateGet(this, _options).uriBase}authorize`);
1732
1706
  next();
1733
1707
  return;
1734
- } else if (to.path.localeCompare(`${__privateGet(this, _options2).uriBase}consent`) === 0) {
1708
+ } else if (to.path.localeCompare(`${__privateGet(this, _options).uriBase}consent`) === 0) {
1735
1709
  if (__privateGet(this, _GetStore).call(this).id_token) {
1736
1710
  next();
1737
1711
  return;
1738
1712
  }
1739
1713
  }
1740
- if (to.path.localeCompare(`${__privateGet(this, _options2).uriBase}logout`) === 0) {
1714
+ if (to.path.localeCompare(`${__privateGet(this, _options).uriBase}logout`) === 0) {
1741
1715
  next();
1742
1716
  return;
1743
1717
  }
1744
- if (to.path.localeCompare(`${__privateGet(this, _options2).uriBase}error`) === 0) {
1718
+ if (to.path.localeCompare(`${__privateGet(this, _options).uriBase}error`) === 0) {
1745
1719
  next();
1746
1720
  return;
1747
1721
  }
1748
- if (to.path.localeCompare(`${__privateGet(this, _options2).uriBase}config`) === 0) {
1722
+ if (to.path.localeCompare(`${__privateGet(this, _options).uriBase}config`) === 0) {
1749
1723
  next();
1750
1724
  return;
1751
1725
  }
1752
- if (to.path.localeCompare(`${__privateGet(this, _options2).uriBase}redirected`) === 0) {
1726
+ if (to.path.localeCompare(`${__privateGet(this, _options).uriBase}redirected`) === 0) {
1753
1727
  next();
1754
1728
  return;
1755
1729
  }
1756
1730
  const str = to.query;
1757
1731
  if (str[OAuth2ParameterType.CODE] || str[OAuth2ParameterType.ERROR]) {
1758
- __privateMethod(this, _STSOAuth2Manager_instances, LogDebugMessage_fn).call(this, chalk$2.magenta(`STSOAuth2Manager:#SetupRoute:Processing redirect: [${JSON.stringify(str)}]`));
1732
+ __privateMethod(this, _STSOAuth2Manager_instances, LogDebugMessage_fn).call(this, chalk$1.magenta(`STSOAuth2Manager:#SetupRoute:Processing redirect: [${JSON.stringify(str)}]`));
1759
1733
  const retVal = await oAuth2Manager.HandleRedirect(str);
1760
- __privateMethod(this, _STSOAuth2Manager_instances, LogDebugMessage_fn).call(this, chalk$2.magenta(`STSOAuth2Manager:#SetupRoute:Redirect result: [${retVal}]`));
1734
+ __privateMethod(this, _STSOAuth2Manager_instances, LogDebugMessage_fn).call(this, chalk$1.magenta(`STSOAuth2Manager:#SetupRoute:Redirect result: [${retVal}]`));
1761
1735
  if (retVal) {
1762
1736
  next({
1763
- path: `${__privateGet(this, _options2).uriBase}`,
1737
+ path: `${__privateGet(this, _options).uriBase}`,
1764
1738
  replace: true
1765
1739
  });
1766
1740
  return;
1767
1741
  } else {
1768
1742
  next({
1769
- path: `${__privateGet(this, _options2).uriBase}error`,
1743
+ path: `${__privateGet(this, _options).uriBase}error`,
1770
1744
  replace: true
1771
1745
  });
1772
1746
  return;
@@ -1781,20 +1755,20 @@ class STSOAuth2Manager {
1781
1755
  next();
1782
1756
  return;
1783
1757
  } else {
1784
- next(`${__privateGet(this, _options2).uriBase}`);
1758
+ next(`${__privateGet(this, _options).uriBase}`);
1785
1759
  return;
1786
1760
  }
1787
1761
  } else {
1788
- if (to.path.localeCompare(`${__privateGet(this, _options2).uriBase}consent`) === 0) {
1789
- next(`${__privateGet(this, _options2).uriBase}`);
1762
+ if (to.path.localeCompare(`${__privateGet(this, _options).uriBase}consent`) === 0) {
1763
+ next(`${__privateGet(this, _options).uriBase}`);
1790
1764
  return;
1791
1765
  }
1792
- if (to.path.localeCompare(`${__privateGet(this, _options2).uriBase}authorize`) === 0) {
1793
- next(`${__privateGet(this, _options2).uriBase}`);
1766
+ if (to.path.localeCompare(`${__privateGet(this, _options).uriBase}authorize`) === 0) {
1767
+ next(`${__privateGet(this, _options).uriBase}`);
1794
1768
  return;
1795
1769
  }
1796
- if (to.path.localeCompare(`${__privateGet(this, _options2).uriBase}logout`) === 0) {
1797
- next(`${__privateGet(this, _options2).uriBase}`);
1770
+ if (to.path.localeCompare(`${__privateGet(this, _options).uriBase}logout`) === 0) {
1771
+ next(`${__privateGet(this, _options).uriBase}`);
1798
1772
  return;
1799
1773
  }
1800
1774
  next();
@@ -1813,7 +1787,7 @@ class STSOAuth2Manager {
1813
1787
  throw new Error(`STSOAuth2Manager:ExecuteRefreshToken:maxSemaphoreRetries: [${__privateGet(this, _maxSemaphoreRetries)}] exceeded.`);
1814
1788
  }
1815
1789
  await Sleep(__privateGet(this, _semaphoreRetrySleep));
1816
- __privateMethod(this, _STSOAuth2Manager_instances, LogDebugMessage_fn).call(this, chalk$2.cyan(`STSOAuth2Manager:ExecuteRefreshToken:locked by operationSemaphore, retry count: [${retryCount}]`));
1790
+ __privateMethod(this, _STSOAuth2Manager_instances, LogDebugMessage_fn).call(this, chalk$1.cyan(`STSOAuth2Manager:ExecuteRefreshToken:locked by operationSemaphore, retry count: [${retryCount}]`));
1817
1791
  return await this.ExecuteRefreshToken(retryCount + 1);
1818
1792
  } else {
1819
1793
  __privateSet(this, _operationSemaphore, true);
@@ -1833,7 +1807,7 @@ class STSOAuth2Manager {
1833
1807
  __privateMethod(this, _STSOAuth2Manager_instances, LogDebugMessage_fn).call(this, `STSOAuth2Manager:RestoreSession:response: [${JSON.stringify(response.payload)}]`);
1834
1808
  return response.payload;
1835
1809
  } catch (error) {
1836
- __privateMethod(this, _STSOAuth2Manager_instances, LogErrorMessage_fn).call(this, chalk$2.red(`RestoreSession Error: ${error}`));
1810
+ __privateMethod(this, _STSOAuth2Manager_instances, LogErrorMessage_fn).call(this, chalk$1.red(`RestoreSession Error: ${error}`));
1837
1811
  return false;
1838
1812
  }
1839
1813
  });
@@ -1848,18 +1822,18 @@ class STSOAuth2Manager {
1848
1822
  return response.payload.authorizeOptionsClientCopy;
1849
1823
  }
1850
1824
  } catch (error) {
1851
- __privateMethod(this, _STSOAuth2Manager_instances, LogErrorMessage_fn).call(this, chalk$2.red(`Authorize Error: ${error}`));
1825
+ __privateMethod(this, _STSOAuth2Manager_instances, LogErrorMessage_fn).call(this, chalk$1.red(`Authorize Error: ${error}`));
1852
1826
  }
1853
1827
  return {};
1854
1828
  });
1855
1829
  __publicField(this, "HandleRedirect", async (queryVars) => {
1856
1830
  try {
1857
- __privateMethod(this, _STSOAuth2Manager_instances, LogDebugMessage_fn).call(this, chalk$2.magenta(`STSOAuth2Manager:HandleRedirect`));
1831
+ __privateMethod(this, _STSOAuth2Manager_instances, LogDebugMessage_fn).call(this, chalk$1.magenta(`STSOAuth2Manager:HandleRedirect`));
1858
1832
  let response = null;
1859
1833
  if (queryVars[OAuth2ParameterType.CODE]) {
1860
1834
  const authorizeOptions = __privateGet(this, _transactionStore).get(__privateGet(this, _STORAGE_AUTHORIZE_OPTIONS_KEY));
1861
1835
  __privateGet(this, _transactionStore).remove(__privateGet(this, _STORAGE_AUTHORIZE_OPTIONS_KEY));
1862
- __privateMethod(this, _STSOAuth2Manager_instances, LogDebugMessage_fn).call(this, chalk$2.magenta(`STSOAuth2Manager:HandleRedirect: sending HANDLE_REDIRECT command`));
1836
+ __privateMethod(this, _STSOAuth2Manager_instances, LogDebugMessage_fn).call(this, chalk$1.magenta(`STSOAuth2Manager:HandleRedirect: sending HANDLE_REDIRECT command`));
1863
1837
  response = await __privateGet(this, _PostMessage).call(this, { command: IOauth2ListenerCommand.HANDLE_REDIRECT, payload: {
1864
1838
  queryVars,
1865
1839
  authorizeOptions
@@ -1867,10 +1841,10 @@ class STSOAuth2Manager {
1867
1841
  } else {
1868
1842
  response = await __privateGet(this, _PostMessage).call(this, { command: IOauth2ListenerCommand.HANDLE_REDIRECT, payload: queryVars });
1869
1843
  }
1870
- __privateMethod(this, _STSOAuth2Manager_instances, LogDebugMessage_fn).call(this, chalk$2.magenta(`STSOAuth2Manager:HandleRedirect: HANDLE_REDIRECT response: [${JSON.stringify(response)}]`));
1844
+ __privateMethod(this, _STSOAuth2Manager_instances, LogDebugMessage_fn).call(this, chalk$1.magenta(`STSOAuth2Manager:HandleRedirect: HANDLE_REDIRECT response: [${JSON.stringify(response)}]`));
1871
1845
  return response.payload;
1872
1846
  } catch (error) {
1873
- __privateMethod(this, _STSOAuth2Manager_instances, LogErrorMessage_fn).call(this, chalk$2.red(`HandleRedirect Error: ${error}`));
1847
+ __privateMethod(this, _STSOAuth2Manager_instances, LogErrorMessage_fn).call(this, chalk$1.red(`HandleRedirect Error: ${error}`));
1874
1848
  return false;
1875
1849
  }
1876
1850
  });
@@ -1879,7 +1853,7 @@ class STSOAuth2Manager {
1879
1853
  const response = await __privateGet(this, _PostMessage).call(this, { command: IOauth2ListenerCommand.LOGOUT });
1880
1854
  return response.payload;
1881
1855
  } catch (error) {
1882
- __privateMethod(this, _STSOAuth2Manager_instances, LogErrorMessage_fn).call(this, chalk$2.red(`Logout Error: ${error}`));
1856
+ __privateMethod(this, _STSOAuth2Manager_instances, LogErrorMessage_fn).call(this, chalk$1.red(`Logout Error: ${error}`));
1883
1857
  return false;
1884
1858
  }
1885
1859
  });
@@ -1888,7 +1862,7 @@ class STSOAuth2Manager {
1888
1862
  const response = await __privateGet(this, _PostMessage).call(this, { command: IOauth2ListenerCommand.LOGOUT });
1889
1863
  return response.payload;
1890
1864
  } catch (error) {
1891
- __privateMethod(this, _STSOAuth2Manager_instances, LogErrorMessage_fn).call(this, chalk$2.red(`InvokeExternalAPI Error: ${error}`));
1865
+ __privateMethod(this, _STSOAuth2Manager_instances, LogErrorMessage_fn).call(this, chalk$1.red(`InvokeExternalAPI Error: ${error}`));
1892
1866
  return null;
1893
1867
  }
1894
1868
  });
@@ -1899,7 +1873,7 @@ class STSOAuth2Manager {
1899
1873
  return false;
1900
1874
  }
1901
1875
  });
1902
- __privateSet(this, _options2, options);
1876
+ __privateSet(this, _options, options);
1903
1877
  if (!isNode) {
1904
1878
  if (app.config.globalProperties.$sts[STSInstrumentControllerPluginKey]) {
1905
1879
  const STSInstrumentController = app.config.globalProperties.$sts[STSInstrumentControllerPluginKey];
@@ -1912,17 +1886,17 @@ class STSOAuth2Manager {
1912
1886
  } else {
1913
1887
  __privateSet(this, _transactionStore, new ClientStorageFactory({ clientStorageType: ClientStorageType.SESSION_STORAGE, usePrefix: false }).GetStorage());
1914
1888
  }
1915
- if (__privateGet(this, _options2).workerFactory) {
1916
- __privateSet(this, _worker, __privateGet(this, _options2).workerFactory());
1889
+ if (__privateGet(this, _options).workerFactory) {
1890
+ __privateSet(this, _worker, __privateGet(this, _options).workerFactory());
1917
1891
  } else {
1918
1892
  throw new Error(`STSOAuth2Manager:constructor: Cannot init STSOAuth2Manager - this.#options.workerFactory not specified`);
1919
1893
  }
1920
1894
  if (!isNode) {
1921
1895
  __privateGet(this, _worker).onmessage = (data) => {
1922
- __privateMethod(this, _STSOAuth2Manager_instances, LogInfoMessage_fn).call(this, chalk$2.green(`this.#worker.onmessage = [${data}]`));
1896
+ __privateMethod(this, _STSOAuth2Manager_instances, LogInfoMessage_fn).call(this, chalk$1.green(`this.#worker.onmessage = [${data}]`));
1923
1897
  };
1924
1898
  __privateGet(this, _worker).onerror = (error) => {
1925
- __privateMethod(this, _STSOAuth2Manager_instances, LogInfoMessage_fn).call(this, chalk$2.green(`this.#worker.onerror = [${JSON.stringify(error)}]`));
1899
+ __privateMethod(this, _STSOAuth2Manager_instances, LogInfoMessage_fn).call(this, chalk$1.green(`this.#worker.onerror = [${JSON.stringify(error)}]`));
1926
1900
  };
1927
1901
  }
1928
1902
  let workerMessage;
@@ -1936,7 +1910,7 @@ class STSOAuth2Manager {
1936
1910
  __privateSet(this, _oauth2ManagerPort, oauth2ManagerPort);
1937
1911
  workerMessage = {
1938
1912
  workerPort: oauth2WorkerPort,
1939
- options: __privateGet(this, _options2).workerOptions
1913
+ options: __privateGet(this, _options).workerOptions
1940
1914
  };
1941
1915
  __privateGet(this, _worker).postMessage(workerMessage, [oauth2WorkerPort]);
1942
1916
  __privateGet(this, _oauth2ManagerPort).on("message", (payload) => {
@@ -1952,7 +1926,7 @@ class STSOAuth2Manager {
1952
1926
  __privateSet(this, _oauth2ManagerPort, oauth2ManagerPort);
1953
1927
  workerMessage = {
1954
1928
  workerPort: oauth2WorkerPort,
1955
- options: __privateGet(this, _options2).workerOptions
1929
+ options: __privateGet(this, _options).workerOptions
1956
1930
  };
1957
1931
  __privateGet(this, _worker).postMessage(workerMessage, [oauth2WorkerPort]);
1958
1932
  __privateGet(this, _oauth2ManagerPort).onmessage = (data) => {
@@ -1965,7 +1939,7 @@ class STSOAuth2Manager {
1965
1939
  _router = new WeakMap();
1966
1940
  _STORAGE_AUTHORIZE_OPTIONS_KEY = new WeakMap();
1967
1941
  _aic = new WeakMap();
1968
- _options2 = new WeakMap();
1942
+ _options = new WeakMap();
1969
1943
  _oauth2ManagerPort = new WeakMap();
1970
1944
  _messageId = new WeakMap();
1971
1945
  _messageHandlers = new WeakMap();
@@ -1977,13 +1951,13 @@ _maxSemaphoreRetries = new WeakMap();
1977
1951
  _semaphoreRetrySleep = new WeakMap();
1978
1952
  _STSOAuth2Manager_instances = new WeakSet();
1979
1953
  LogDebugMessage_fn = function(message) {
1980
- __privateGet(this, _options2).logger.debug(message);
1954
+ __privateGet(this, _options).logger.debug(message);
1981
1955
  };
1982
1956
  LogInfoMessage_fn = function(message) {
1983
- __privateGet(this, _options2).logger.info(message);
1957
+ __privateGet(this, _options).logger.info(message);
1984
1958
  };
1985
1959
  LogErrorMessage_fn = function(message) {
1986
- __privateGet(this, _options2).logger.error(message);
1960
+ __privateGet(this, _options).logger.error(message);
1987
1961
  };
1988
1962
  _ProcessMessageResponse = new WeakMap();
1989
1963
  _PostMessage = new WeakMap();
@@ -1994,15 +1968,15 @@ _HandleErrorEvent = new WeakMap();
1994
1968
  _HandleAuthenticateEvent = new WeakMap();
1995
1969
  _SetupRoute = new WeakMap();
1996
1970
  var sha256$1 = { exports: {} };
1997
- function commonjsRequire(path2) {
1998
- throw new Error('Could not dynamically require "' + path2 + '". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.');
1971
+ function commonjsRequire(path) {
1972
+ throw new Error('Could not dynamically require "' + path + '". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.');
1999
1973
  }
2000
1974
  var core = { exports: {} };
2001
1975
  var hasRequiredCore;
2002
1976
  function requireCore() {
2003
1977
  if (hasRequiredCore) return core.exports;
2004
1978
  hasRequiredCore = 1;
2005
- (function(module, exports2) {
1979
+ (function(module, exports) {
2006
1980
  (function(root, factory) {
2007
1981
  {
2008
1982
  module.exports = factory();
@@ -2604,7 +2578,7 @@ function requireCore() {
2604
2578
  })(core);
2605
2579
  return core.exports;
2606
2580
  }
2607
- (function(module, exports2) {
2581
+ (function(module, exports) {
2608
2582
  (function(root, factory) {
2609
2583
  {
2610
2584
  module.exports = factory(requireCore());
@@ -2720,7 +2694,7 @@ function requireCore() {
2720
2694
  var sha256Exports = sha256$1.exports;
2721
2695
  const sha256 = /* @__PURE__ */ getDefaultExportFromCjs(sha256Exports);
2722
2696
  var encBase64 = { exports: {} };
2723
- (function(module, exports2) {
2697
+ (function(module, exports) {
2724
2698
  (function(root, factory) {
2725
2699
  {
2726
2700
  module.exports = factory(requireCore());
@@ -2941,2311 +2915,79 @@ var StatusCodes;
2941
2915
  StatusCodes2[StatusCodes2["INSUFFICIENT_STORAGE"] = 507] = "INSUFFICIENT_STORAGE";
2942
2916
  StatusCodes2[StatusCodes2["NETWORK_AUTHENTICATION_REQUIRED"] = 511] = "NETWORK_AUTHENTICATION_REQUIRED";
2943
2917
  })(StatusCodes || (StatusCodes = {}));
2944
- var main$1 = { exports: {} };
2945
- const __viteBrowserExternal = {};
2946
- const __viteBrowserExternal$1 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
2947
- __proto__: null,
2948
- default: __viteBrowserExternal
2949
- }, Symbol.toStringTag, { value: "Module" }));
2950
- const require$$2 = /* @__PURE__ */ getAugmentedNamespace(__viteBrowserExternal$1);
2951
- const name = "dotenv";
2952
- const version$1 = "16.4.5";
2953
- const description = "Loads environment variables from .env file";
2954
- const main = "lib/main.js";
2955
- const types = "lib/main.d.ts";
2956
- const exports = {
2957
- ".": {
2958
- types: "./lib/main.d.ts",
2959
- require: "./lib/main.js",
2960
- "default": "./lib/main.js"
2961
- },
2962
- "./config": "./config.js",
2963
- "./config.js": "./config.js",
2964
- "./lib/env-options": "./lib/env-options.js",
2965
- "./lib/env-options.js": "./lib/env-options.js",
2966
- "./lib/cli-options": "./lib/cli-options.js",
2967
- "./lib/cli-options.js": "./lib/cli-options.js",
2968
- "./package.json": "./package.json"
2969
- };
2970
- const scripts = {
2971
- "dts-check": "tsc --project tests/types/tsconfig.json",
2972
- lint: "standard",
2973
- "lint-readme": "standard-markdown",
2974
- pretest: "npm run lint && npm run dts-check",
2975
- test: "tap tests/*.js --100 -Rspec",
2976
- "test:coverage": "tap --coverage-report=lcov",
2977
- prerelease: "npm test",
2978
- release: "standard-version"
2979
- };
2980
- const repository = {
2981
- type: "git",
2982
- url: "git://github.com/motdotla/dotenv.git"
2983
- };
2984
- const funding = "https://dotenvx.com";
2985
- const keywords = [
2986
- "dotenv",
2987
- "env",
2988
- ".env",
2989
- "environment",
2990
- "variables",
2991
- "config",
2992
- "settings"
2993
- ];
2994
- const readmeFilename = "README.md";
2995
- const license = "BSD-2-Clause";
2996
- const devDependencies = {
2997
- "@definitelytyped/dtslint": "^0.0.133",
2998
- "@types/node": "^18.11.3",
2999
- decache: "^4.6.1",
3000
- sinon: "^14.0.1",
3001
- standard: "^17.0.0",
3002
- "standard-markdown": "^7.1.0",
3003
- "standard-version": "^9.5.0",
3004
- tap: "^16.3.0",
3005
- tar: "^6.1.11",
3006
- typescript: "^4.8.4"
3007
- };
3008
- const engines = {
3009
- node: ">=12"
3010
- };
3011
- const browser$1 = {
3012
- fs: false
3013
- };
3014
- const require$$4 = {
3015
- name,
3016
- version: version$1,
3017
- description,
3018
- main,
3019
- types,
3020
- exports,
3021
- scripts,
3022
- repository,
3023
- funding,
3024
- keywords,
3025
- readmeFilename,
3026
- license,
3027
- devDependencies,
3028
- engines,
3029
- browser: browser$1
3030
- };
3031
- const fs = require$$2;
3032
- const path = require$$2;
3033
- const os = require$$2;
3034
- const crypto$1 = require$$3;
3035
- const packageJson = require$$4;
3036
- const version = packageJson.version;
3037
- const LINE = /(?:^|^)\s*(?:export\s+)?([\w.-]+)(?:\s*=\s*?|:\s+?)(\s*'(?:\\'|[^'])*'|\s*"(?:\\"|[^"])*"|\s*`(?:\\`|[^`])*`|[^#\r\n]+)?\s*(?:#.*)?(?:$|$)/mg;
3038
- function parse(src) {
3039
- const obj = {};
3040
- let lines = src.toString();
3041
- lines = lines.replace(/\r\n?/mg, "\n");
3042
- let match;
3043
- while ((match = LINE.exec(lines)) != null) {
3044
- const key = match[1];
3045
- let value = match[2] || "";
3046
- value = value.trim();
3047
- const maybeQuote = value[0];
3048
- value = value.replace(/^(['"`])([\s\S]*)\1$/mg, "$2");
3049
- if (maybeQuote === '"') {
3050
- value = value.replace(/\\n/g, "\n");
3051
- value = value.replace(/\\r/g, "\r");
3052
- }
3053
- obj[key] = value;
3054
- }
3055
- return obj;
3056
- }
3057
- function _parseVault(options) {
3058
- const vaultPath = _vaultPath(options);
3059
- const result = DotenvModule.configDotenv({ path: vaultPath });
3060
- if (!result.parsed) {
3061
- const err = new Error(`MISSING_DATA: Cannot parse ${vaultPath} for an unknown reason`);
3062
- err.code = "MISSING_DATA";
3063
- throw err;
3064
- }
3065
- const keys = _dotenvKey(options).split(",");
3066
- const length = keys.length;
3067
- let decrypted;
3068
- for (let i = 0; i < length; i++) {
3069
- try {
3070
- const key = keys[i].trim();
3071
- const attrs = _instructions(result, key);
3072
- decrypted = DotenvModule.decrypt(attrs.ciphertext, attrs.key);
3073
- break;
3074
- } catch (error) {
3075
- if (i + 1 >= length) {
3076
- throw error;
3077
- }
3078
- }
3079
- }
3080
- return DotenvModule.parse(decrypted);
3081
- }
3082
- function _log(message) {
3083
- console.log(`[dotenv@${version}][INFO] ${message}`);
3084
- }
3085
- function _warn(message) {
3086
- console.log(`[dotenv@${version}][WARN] ${message}`);
3087
- }
3088
- function _debug(message) {
3089
- console.log(`[dotenv@${version}][DEBUG] ${message}`);
3090
- }
3091
- function _dotenvKey(options) {
3092
- if (options && options.DOTENV_KEY && options.DOTENV_KEY.length > 0) {
3093
- return options.DOTENV_KEY;
3094
- }
3095
- if (process.env.DOTENV_KEY && process.env.DOTENV_KEY.length > 0) {
3096
- return process.env.DOTENV_KEY;
3097
- }
3098
- return "";
3099
- }
3100
- function _instructions(result, dotenvKey) {
3101
- let uri;
3102
- try {
3103
- uri = new URL(dotenvKey);
3104
- } catch (error) {
3105
- if (error.code === "ERR_INVALID_URL") {
3106
- const err = new Error("INVALID_DOTENV_KEY: Wrong format. Must be in valid uri format like dotenv://:key_1234@dotenvx.com/vault/.env.vault?environment=development");
3107
- err.code = "INVALID_DOTENV_KEY";
3108
- throw err;
3109
- }
3110
- throw error;
3111
- }
3112
- const key = uri.password;
3113
- if (!key) {
3114
- const err = new Error("INVALID_DOTENV_KEY: Missing key part");
3115
- err.code = "INVALID_DOTENV_KEY";
3116
- throw err;
3117
- }
3118
- const environment = uri.searchParams.get("environment");
3119
- if (!environment) {
3120
- const err = new Error("INVALID_DOTENV_KEY: Missing environment part");
3121
- err.code = "INVALID_DOTENV_KEY";
3122
- throw err;
3123
- }
3124
- const environmentKey = `DOTENV_VAULT_${environment.toUpperCase()}`;
3125
- const ciphertext = result.parsed[environmentKey];
3126
- if (!ciphertext) {
3127
- const err = new Error(`NOT_FOUND_DOTENV_ENVIRONMENT: Cannot locate environment ${environmentKey} in your .env.vault file.`);
3128
- err.code = "NOT_FOUND_DOTENV_ENVIRONMENT";
3129
- throw err;
3130
- }
3131
- return { ciphertext, key };
3132
- }
3133
- function _vaultPath(options) {
3134
- let possibleVaultPath = null;
3135
- if (options && options.path && options.path.length > 0) {
3136
- if (Array.isArray(options.path)) {
3137
- for (const filepath of options.path) {
3138
- if (fs.existsSync(filepath)) {
3139
- possibleVaultPath = filepath.endsWith(".vault") ? filepath : `${filepath}.vault`;
2918
+ class STSOAuth2Worker {
2919
+ constructor(workerPort, options, logger) {
2920
+ __privateAdd(this, _STSOAuth2Worker_instances);
2921
+ //#storageManager = null;
2922
+ __privateAdd(this, _clientSessionStore);
2923
+ __privateAdd(this, _cUtils, new CryptoUtils());
2924
+ __privateAdd(this, _qParams, new QueryParams());
2925
+ __privateAdd(this, _STORAGE_SESSION_KEY, "session.stsmda.com.au");
2926
+ //@@#aic = null;
2927
+ __privateAdd(this, _oauthWorkerPort);
2928
+ __privateAdd(this, _options2);
2929
+ __privateAdd(this, _logger);
2930
+ __privateAdd(this, _agentManager, null);
2931
+ // Attempt to restore a previous session using the STSBroker
2932
+ /*
2933
+ { parameterType: OAuth2ParameterType.CLIENT_ID, errorType: authErrorType.CLIENT_ID_MISMATCH },
2934
+ { parameterType: OAuth2ParameterType.SCOPE, errorType: authErrorType.SCOPE_MISMATCH }
2935
+ { parameterType: OAuth2ParameterType.REDIRECT_URI, errorType: authErrorType.REDIRECT_URI_MISMATCH },
2936
+ { parameterType: OAuth2ParameterType.AUDIENCE, errorType: authErrorType.SCOPE_MISMATCH }
2937
+
2938
+ Successful Response
2939
+ {
2940
+ "access_token": "eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiIsIng1dCI6Ik5HVEZ2ZEstZnl0aEV1Q...",
2941
+ "token_type": "Bearer",
2942
+ "expires_in": 3599,
2943
+ "scope": "https%3A%2F%2Fgraph.microsoft.com%2Fmail.read",
2944
+ "refresh_token": "AwABAAAAvPM1KaPlrEqdFSBzjqfTGAMxZGUTdM0t4B4...",
2945
+ "id_token": "eyJ0eXAiOiJKV1QiLCJhbGciOiJub25lIn0.eyJhdWQiOiIyZDRkMTFhMi1mODE0LTQ2YTctOD...",
3140
2946
  }
3141
- }
3142
- } else {
3143
- possibleVaultPath = options.path.endsWith(".vault") ? options.path : `${options.path}.vault`;
3144
- }
3145
- } else {
3146
- possibleVaultPath = path.resolve(process.cwd(), ".env.vault");
3147
- }
3148
- if (fs.existsSync(possibleVaultPath)) {
3149
- return possibleVaultPath;
3150
- }
3151
- return null;
3152
- }
3153
- function _resolveHome(envPath) {
3154
- return envPath[0] === "~" ? path.join(os.homedir(), envPath.slice(1)) : envPath;
3155
- }
3156
- function _configVault(options) {
3157
- _log("Loading env from encrypted .env.vault");
3158
- const parsed = DotenvModule._parseVault(options);
3159
- let processEnv = process.env;
3160
- if (options && options.processEnv != null) {
3161
- processEnv = options.processEnv;
3162
- }
3163
- DotenvModule.populate(processEnv, parsed, options);
3164
- return { parsed };
3165
- }
3166
- function configDotenv(options) {
3167
- const dotenvPath = path.resolve(process.cwd(), ".env");
3168
- let encoding = "utf8";
3169
- const debug = Boolean(options && options.debug);
3170
- if (options && options.encoding) {
3171
- encoding = options.encoding;
3172
- } else {
3173
- if (debug) {
3174
- _debug("No encoding is specified. UTF-8 is used by default");
3175
- }
3176
- }
3177
- let optionPaths = [dotenvPath];
3178
- if (options && options.path) {
3179
- if (!Array.isArray(options.path)) {
3180
- optionPaths = [_resolveHome(options.path)];
3181
- } else {
3182
- optionPaths = [];
3183
- for (const filepath of options.path) {
3184
- optionPaths.push(_resolveHome(filepath));
3185
- }
3186
- }
3187
- }
3188
- let lastError;
3189
- const parsedAll = {};
3190
- for (const path2 of optionPaths) {
3191
- try {
3192
- const parsed = DotenvModule.parse(fs.readFileSync(path2, { encoding }));
3193
- DotenvModule.populate(parsedAll, parsed, options);
3194
- } catch (e) {
3195
- if (debug) {
3196
- _debug(`Failed to load ${path2} ${e.message}`);
3197
- }
3198
- lastError = e;
3199
- }
3200
- }
3201
- let processEnv = process.env;
3202
- if (options && options.processEnv != null) {
3203
- processEnv = options.processEnv;
3204
- }
3205
- DotenvModule.populate(processEnv, parsedAll, options);
3206
- if (lastError) {
3207
- return { parsed: parsedAll, error: lastError };
3208
- } else {
3209
- return { parsed: parsedAll };
3210
- }
3211
- }
3212
- function config(options) {
3213
- if (_dotenvKey(options).length === 0) {
3214
- return DotenvModule.configDotenv(options);
3215
- }
3216
- const vaultPath = _vaultPath(options);
3217
- if (!vaultPath) {
3218
- _warn(`You set DOTENV_KEY but you are missing a .env.vault file at ${vaultPath}. Did you forget to build it?`);
3219
- return DotenvModule.configDotenv(options);
3220
- }
3221
- return DotenvModule._configVault(options);
3222
- }
3223
- function decrypt(encrypted, keyStr) {
3224
- const key = Buffer.from(keyStr.slice(-64), "hex");
3225
- let ciphertext = Buffer.from(encrypted, "base64");
3226
- const nonce = ciphertext.subarray(0, 12);
3227
- const authTag = ciphertext.subarray(-16);
3228
- ciphertext = ciphertext.subarray(12, -16);
3229
- try {
3230
- const aesgcm = crypto$1.createDecipheriv("aes-256-gcm", key, nonce);
3231
- aesgcm.setAuthTag(authTag);
3232
- return `${aesgcm.update(ciphertext)}${aesgcm.final()}`;
3233
- } catch (error) {
3234
- const isRange = error instanceof RangeError;
3235
- const invalidKeyLength = error.message === "Invalid key length";
3236
- const decryptionFailed = error.message === "Unsupported state or unable to authenticate data";
3237
- if (isRange || invalidKeyLength) {
3238
- const err = new Error("INVALID_DOTENV_KEY: It must be 64 characters long (or more)");
3239
- err.code = "INVALID_DOTENV_KEY";
3240
- throw err;
3241
- } else if (decryptionFailed) {
3242
- const err = new Error("DECRYPTION_FAILED: Please check your DOTENV_KEY");
3243
- err.code = "DECRYPTION_FAILED";
3244
- throw err;
3245
- } else {
3246
- throw error;
3247
- }
3248
- }
3249
- }
3250
- function populate(processEnv, parsed, options = {}) {
3251
- const debug = Boolean(options && options.debug);
3252
- const override = Boolean(options && options.override);
3253
- if (typeof parsed !== "object") {
3254
- const err = new Error("OBJECT_REQUIRED: Please check the processEnv argument being passed to populate");
3255
- err.code = "OBJECT_REQUIRED";
3256
- throw err;
3257
- }
3258
- for (const key of Object.keys(parsed)) {
3259
- if (Object.prototype.hasOwnProperty.call(processEnv, key)) {
3260
- if (override === true) {
3261
- processEnv[key] = parsed[key];
3262
- }
3263
- if (debug) {
3264
- if (override === true) {
3265
- _debug(`"${key}" is already defined and WAS overwritten`);
3266
- } else {
3267
- _debug(`"${key}" is already defined and was NOT overwritten`);
2947
+
2948
+ Error Response
2949
+ {
2950
+ "error": "invalid_scope",
2951
+ "error_description": "AADSTS70011: The provided value for the input parameter 'scope' is not valid. The scope https://foo.microsoft.com/mail.read is not valid.\r\nTrace ID: 255d1aef-8c98-452f-ac51-23d051240864\r\nCorrelation ID: fb3d2015-bc17-4bb9-bb85-30c5cf1aaaa7\r\nTimestamp: 2016-01-09 02:02:12Z",
2952
+ "error_codes": [
2953
+ 70011
2954
+ ],
2955
+ "timestamp": "2016-01-09 02:02:12Z",
3268
2956
  }
3269
- }
3270
- } else {
3271
- processEnv[key] = parsed[key];
3272
- }
3273
- }
3274
- }
3275
- const DotenvModule = {
3276
- configDotenv,
3277
- _configVault,
3278
- _parseVault,
3279
- config,
3280
- decrypt,
3281
- parse,
3282
- populate
3283
- };
3284
- main$1.exports.configDotenv = DotenvModule.configDotenv;
3285
- main$1.exports._configVault = DotenvModule._configVault;
3286
- main$1.exports._parseVault = DotenvModule._parseVault;
3287
- var config_1 = main$1.exports.config = DotenvModule.config;
3288
- main$1.exports.decrypt = DotenvModule.decrypt;
3289
- main$1.exports.parse = DotenvModule.parse;
3290
- main$1.exports.populate = DotenvModule.populate;
3291
- main$1.exports = DotenvModule;
3292
- var __typeError2 = (msg) => {
3293
- throw TypeError(msg);
3294
- };
3295
- var __accessCheck2 = (obj, member, msg) => member.has(obj) || __typeError2("Cannot " + msg);
3296
- var __privateGet2 = (obj, member, getter) => (__accessCheck2(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj));
3297
- var __privateAdd2 = (obj, member, value) => member.has(obj) ? __typeError2("Cannot add the same private member more than once") : member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
3298
- var __privateSet2 = (obj, member, value, setter) => (__accessCheck2(obj, member, "write to private field"), member.set(obj, value), value);
3299
- var __privateWrapper2 = (obj, member, setter, getter) => ({
3300
- set _(value) {
3301
- __privateSet2(obj, member, value);
3302
- },
3303
- get _() {
3304
- return __privateGet2(obj, member, getter);
3305
- }
3306
- });
3307
- var _options, _httpAgent, _httpsAgent, _agentResetInterval, _requestCount, _SetupResetInterval, _GetAgentOptions, _url, _method, _headers, _data, _agentManager, _timeout, _withCredentials;
3308
- var ansiStyles$1 = { exports: {} };
3309
- var colorName;
3310
- var hasRequiredColorName;
3311
- function requireColorName() {
3312
- if (hasRequiredColorName) return colorName;
3313
- hasRequiredColorName = 1;
3314
- colorName = {
3315
- "aliceblue": [240, 248, 255],
3316
- "antiquewhite": [250, 235, 215],
3317
- "aqua": [0, 255, 255],
3318
- "aquamarine": [127, 255, 212],
3319
- "azure": [240, 255, 255],
3320
- "beige": [245, 245, 220],
3321
- "bisque": [255, 228, 196],
3322
- "black": [0, 0, 0],
3323
- "blanchedalmond": [255, 235, 205],
3324
- "blue": [0, 0, 255],
3325
- "blueviolet": [138, 43, 226],
3326
- "brown": [165, 42, 42],
3327
- "burlywood": [222, 184, 135],
3328
- "cadetblue": [95, 158, 160],
3329
- "chartreuse": [127, 255, 0],
3330
- "chocolate": [210, 105, 30],
3331
- "coral": [255, 127, 80],
3332
- "cornflowerblue": [100, 149, 237],
3333
- "cornsilk": [255, 248, 220],
3334
- "crimson": [220, 20, 60],
3335
- "cyan": [0, 255, 255],
3336
- "darkblue": [0, 0, 139],
3337
- "darkcyan": [0, 139, 139],
3338
- "darkgoldenrod": [184, 134, 11],
3339
- "darkgray": [169, 169, 169],
3340
- "darkgreen": [0, 100, 0],
3341
- "darkgrey": [169, 169, 169],
3342
- "darkkhaki": [189, 183, 107],
3343
- "darkmagenta": [139, 0, 139],
3344
- "darkolivegreen": [85, 107, 47],
3345
- "darkorange": [255, 140, 0],
3346
- "darkorchid": [153, 50, 204],
3347
- "darkred": [139, 0, 0],
3348
- "darksalmon": [233, 150, 122],
3349
- "darkseagreen": [143, 188, 143],
3350
- "darkslateblue": [72, 61, 139],
3351
- "darkslategray": [47, 79, 79],
3352
- "darkslategrey": [47, 79, 79],
3353
- "darkturquoise": [0, 206, 209],
3354
- "darkviolet": [148, 0, 211],
3355
- "deeppink": [255, 20, 147],
3356
- "deepskyblue": [0, 191, 255],
3357
- "dimgray": [105, 105, 105],
3358
- "dimgrey": [105, 105, 105],
3359
- "dodgerblue": [30, 144, 255],
3360
- "firebrick": [178, 34, 34],
3361
- "floralwhite": [255, 250, 240],
3362
- "forestgreen": [34, 139, 34],
3363
- "fuchsia": [255, 0, 255],
3364
- "gainsboro": [220, 220, 220],
3365
- "ghostwhite": [248, 248, 255],
3366
- "gold": [255, 215, 0],
3367
- "goldenrod": [218, 165, 32],
3368
- "gray": [128, 128, 128],
3369
- "green": [0, 128, 0],
3370
- "greenyellow": [173, 255, 47],
3371
- "grey": [128, 128, 128],
3372
- "honeydew": [240, 255, 240],
3373
- "hotpink": [255, 105, 180],
3374
- "indianred": [205, 92, 92],
3375
- "indigo": [75, 0, 130],
3376
- "ivory": [255, 255, 240],
3377
- "khaki": [240, 230, 140],
3378
- "lavender": [230, 230, 250],
3379
- "lavenderblush": [255, 240, 245],
3380
- "lawngreen": [124, 252, 0],
3381
- "lemonchiffon": [255, 250, 205],
3382
- "lightblue": [173, 216, 230],
3383
- "lightcoral": [240, 128, 128],
3384
- "lightcyan": [224, 255, 255],
3385
- "lightgoldenrodyellow": [250, 250, 210],
3386
- "lightgray": [211, 211, 211],
3387
- "lightgreen": [144, 238, 144],
3388
- "lightgrey": [211, 211, 211],
3389
- "lightpink": [255, 182, 193],
3390
- "lightsalmon": [255, 160, 122],
3391
- "lightseagreen": [32, 178, 170],
3392
- "lightskyblue": [135, 206, 250],
3393
- "lightslategray": [119, 136, 153],
3394
- "lightslategrey": [119, 136, 153],
3395
- "lightsteelblue": [176, 196, 222],
3396
- "lightyellow": [255, 255, 224],
3397
- "lime": [0, 255, 0],
3398
- "limegreen": [50, 205, 50],
3399
- "linen": [250, 240, 230],
3400
- "magenta": [255, 0, 255],
3401
- "maroon": [128, 0, 0],
3402
- "mediumaquamarine": [102, 205, 170],
3403
- "mediumblue": [0, 0, 205],
3404
- "mediumorchid": [186, 85, 211],
3405
- "mediumpurple": [147, 112, 219],
3406
- "mediumseagreen": [60, 179, 113],
3407
- "mediumslateblue": [123, 104, 238],
3408
- "mediumspringgreen": [0, 250, 154],
3409
- "mediumturquoise": [72, 209, 204],
3410
- "mediumvioletred": [199, 21, 133],
3411
- "midnightblue": [25, 25, 112],
3412
- "mintcream": [245, 255, 250],
3413
- "mistyrose": [255, 228, 225],
3414
- "moccasin": [255, 228, 181],
3415
- "navajowhite": [255, 222, 173],
3416
- "navy": [0, 0, 128],
3417
- "oldlace": [253, 245, 230],
3418
- "olive": [128, 128, 0],
3419
- "olivedrab": [107, 142, 35],
3420
- "orange": [255, 165, 0],
3421
- "orangered": [255, 69, 0],
3422
- "orchid": [218, 112, 214],
3423
- "palegoldenrod": [238, 232, 170],
3424
- "palegreen": [152, 251, 152],
3425
- "paleturquoise": [175, 238, 238],
3426
- "palevioletred": [219, 112, 147],
3427
- "papayawhip": [255, 239, 213],
3428
- "peachpuff": [255, 218, 185],
3429
- "peru": [205, 133, 63],
3430
- "pink": [255, 192, 203],
3431
- "plum": [221, 160, 221],
3432
- "powderblue": [176, 224, 230],
3433
- "purple": [128, 0, 128],
3434
- "rebeccapurple": [102, 51, 153],
3435
- "red": [255, 0, 0],
3436
- "rosybrown": [188, 143, 143],
3437
- "royalblue": [65, 105, 225],
3438
- "saddlebrown": [139, 69, 19],
3439
- "salmon": [250, 128, 114],
3440
- "sandybrown": [244, 164, 96],
3441
- "seagreen": [46, 139, 87],
3442
- "seashell": [255, 245, 238],
3443
- "sienna": [160, 82, 45],
3444
- "silver": [192, 192, 192],
3445
- "skyblue": [135, 206, 235],
3446
- "slateblue": [106, 90, 205],
3447
- "slategray": [112, 128, 144],
3448
- "slategrey": [112, 128, 144],
3449
- "snow": [255, 250, 250],
3450
- "springgreen": [0, 255, 127],
3451
- "steelblue": [70, 130, 180],
3452
- "tan": [210, 180, 140],
3453
- "teal": [0, 128, 128],
3454
- "thistle": [216, 191, 216],
3455
- "tomato": [255, 99, 71],
3456
- "turquoise": [64, 224, 208],
3457
- "violet": [238, 130, 238],
3458
- "wheat": [245, 222, 179],
3459
- "white": [255, 255, 255],
3460
- "whitesmoke": [245, 245, 245],
3461
- "yellow": [255, 255, 0],
3462
- "yellowgreen": [154, 205, 50]
3463
- };
3464
- return colorName;
3465
- }
3466
- var conversions;
3467
- var hasRequiredConversions;
3468
- function requireConversions() {
3469
- if (hasRequiredConversions) return conversions;
3470
- hasRequiredConversions = 1;
3471
- const cssKeywords = requireColorName();
3472
- const reverseKeywords = {};
3473
- for (const key of Object.keys(cssKeywords)) {
3474
- reverseKeywords[cssKeywords[key]] = key;
3475
- }
3476
- const convert = {
3477
- rgb: { channels: 3, labels: "rgb" },
3478
- hsl: { channels: 3, labels: "hsl" },
3479
- hsv: { channels: 3, labels: "hsv" },
3480
- hwb: { channels: 3, labels: "hwb" },
3481
- cmyk: { channels: 4, labels: "cmyk" },
3482
- xyz: { channels: 3, labels: "xyz" },
3483
- lab: { channels: 3, labels: "lab" },
3484
- lch: { channels: 3, labels: "lch" },
3485
- hex: { channels: 1, labels: ["hex"] },
3486
- keyword: { channels: 1, labels: ["keyword"] },
3487
- ansi16: { channels: 1, labels: ["ansi16"] },
3488
- ansi256: { channels: 1, labels: ["ansi256"] },
3489
- hcg: { channels: 3, labels: ["h", "c", "g"] },
3490
- apple: { channels: 3, labels: ["r16", "g16", "b16"] },
3491
- gray: { channels: 1, labels: ["gray"] }
3492
- };
3493
- conversions = convert;
3494
- for (const model of Object.keys(convert)) {
3495
- if (!("channels" in convert[model])) {
3496
- throw new Error("missing channels property: " + model);
3497
- }
3498
- if (!("labels" in convert[model])) {
3499
- throw new Error("missing channel labels property: " + model);
3500
- }
3501
- if (convert[model].labels.length !== convert[model].channels) {
3502
- throw new Error("channel and label counts mismatch: " + model);
3503
- }
3504
- const { channels, labels } = convert[model];
3505
- delete convert[model].channels;
3506
- delete convert[model].labels;
3507
- Object.defineProperty(convert[model], "channels", { value: channels });
3508
- Object.defineProperty(convert[model], "labels", { value: labels });
3509
- }
3510
- convert.rgb.hsl = function(rgb) {
3511
- const r = rgb[0] / 255;
3512
- const g = rgb[1] / 255;
3513
- const b = rgb[2] / 255;
3514
- const min = Math.min(r, g, b);
3515
- const max = Math.max(r, g, b);
3516
- const delta = max - min;
3517
- let h;
3518
- let s;
3519
- if (max === min) {
3520
- h = 0;
3521
- } else if (r === max) {
3522
- h = (g - b) / delta;
3523
- } else if (g === max) {
3524
- h = 2 + (b - r) / delta;
3525
- } else if (b === max) {
3526
- h = 4 + (r - g) / delta;
3527
- }
3528
- h = Math.min(h * 60, 360);
3529
- if (h < 0) {
3530
- h += 360;
3531
- }
3532
- const l = (min + max) / 2;
3533
- if (max === min) {
3534
- s = 0;
3535
- } else if (l <= 0.5) {
3536
- s = delta / (max + min);
3537
- } else {
3538
- s = delta / (2 - max - min);
3539
- }
3540
- return [h, s * 100, l * 100];
3541
- };
3542
- convert.rgb.hsv = function(rgb) {
3543
- let rdif;
3544
- let gdif;
3545
- let bdif;
3546
- let h;
3547
- let s;
3548
- const r = rgb[0] / 255;
3549
- const g = rgb[1] / 255;
3550
- const b = rgb[2] / 255;
3551
- const v = Math.max(r, g, b);
3552
- const diff = v - Math.min(r, g, b);
3553
- const diffc = function(c) {
3554
- return (v - c) / 6 / diff + 1 / 2;
3555
- };
3556
- if (diff === 0) {
3557
- h = 0;
3558
- s = 0;
3559
- } else {
3560
- s = diff / v;
3561
- rdif = diffc(r);
3562
- gdif = diffc(g);
3563
- bdif = diffc(b);
3564
- if (r === v) {
3565
- h = bdif - gdif;
3566
- } else if (g === v) {
3567
- h = 1 / 3 + rdif - bdif;
3568
- } else if (b === v) {
3569
- h = 2 / 3 + gdif - rdif;
3570
- }
3571
- if (h < 0) {
3572
- h += 1;
3573
- } else if (h > 1) {
3574
- h -= 1;
3575
- }
3576
- }
3577
- return [
3578
- h * 360,
3579
- s * 100,
3580
- v * 100
3581
- ];
3582
- };
3583
- convert.rgb.hwb = function(rgb) {
3584
- const r = rgb[0];
3585
- const g = rgb[1];
3586
- let b = rgb[2];
3587
- const h = convert.rgb.hsl(rgb)[0];
3588
- const w = 1 / 255 * Math.min(r, Math.min(g, b));
3589
- b = 1 - 1 / 255 * Math.max(r, Math.max(g, b));
3590
- return [h, w * 100, b * 100];
3591
- };
3592
- convert.rgb.cmyk = function(rgb) {
3593
- const r = rgb[0] / 255;
3594
- const g = rgb[1] / 255;
3595
- const b = rgb[2] / 255;
3596
- const k = Math.min(1 - r, 1 - g, 1 - b);
3597
- const c = (1 - r - k) / (1 - k) || 0;
3598
- const m = (1 - g - k) / (1 - k) || 0;
3599
- const y = (1 - b - k) / (1 - k) || 0;
3600
- return [c * 100, m * 100, y * 100, k * 100];
3601
- };
3602
- function comparativeDistance(x, y) {
3603
- return (x[0] - y[0]) ** 2 + (x[1] - y[1]) ** 2 + (x[2] - y[2]) ** 2;
3604
- }
3605
- convert.rgb.keyword = function(rgb) {
3606
- const reversed = reverseKeywords[rgb];
3607
- if (reversed) {
3608
- return reversed;
3609
- }
3610
- let currentClosestDistance = Infinity;
3611
- let currentClosestKeyword;
3612
- for (const keyword of Object.keys(cssKeywords)) {
3613
- const value = cssKeywords[keyword];
3614
- const distance = comparativeDistance(rgb, value);
3615
- if (distance < currentClosestDistance) {
3616
- currentClosestDistance = distance;
3617
- currentClosestKeyword = keyword;
3618
- }
3619
- }
3620
- return currentClosestKeyword;
3621
- };
3622
- convert.keyword.rgb = function(keyword) {
3623
- return cssKeywords[keyword];
3624
- };
3625
- convert.rgb.xyz = function(rgb) {
3626
- let r = rgb[0] / 255;
3627
- let g = rgb[1] / 255;
3628
- let b = rgb[2] / 255;
3629
- r = r > 0.04045 ? ((r + 0.055) / 1.055) ** 2.4 : r / 12.92;
3630
- g = g > 0.04045 ? ((g + 0.055) / 1.055) ** 2.4 : g / 12.92;
3631
- b = b > 0.04045 ? ((b + 0.055) / 1.055) ** 2.4 : b / 12.92;
3632
- const x = r * 0.4124 + g * 0.3576 + b * 0.1805;
3633
- const y = r * 0.2126 + g * 0.7152 + b * 0.0722;
3634
- const z = r * 0.0193 + g * 0.1192 + b * 0.9505;
3635
- return [x * 100, y * 100, z * 100];
3636
- };
3637
- convert.rgb.lab = function(rgb) {
3638
- const xyz = convert.rgb.xyz(rgb);
3639
- let x = xyz[0];
3640
- let y = xyz[1];
3641
- let z = xyz[2];
3642
- x /= 95.047;
3643
- y /= 100;
3644
- z /= 108.883;
3645
- x = x > 8856e-6 ? x ** (1 / 3) : 7.787 * x + 16 / 116;
3646
- y = y > 8856e-6 ? y ** (1 / 3) : 7.787 * y + 16 / 116;
3647
- z = z > 8856e-6 ? z ** (1 / 3) : 7.787 * z + 16 / 116;
3648
- const l = 116 * y - 16;
3649
- const a = 500 * (x - y);
3650
- const b = 200 * (y - z);
3651
- return [l, a, b];
3652
- };
3653
- convert.hsl.rgb = function(hsl) {
3654
- const h = hsl[0] / 360;
3655
- const s = hsl[1] / 100;
3656
- const l = hsl[2] / 100;
3657
- let t2;
3658
- let t3;
3659
- let val;
3660
- if (s === 0) {
3661
- val = l * 255;
3662
- return [val, val, val];
3663
- }
3664
- if (l < 0.5) {
3665
- t2 = l * (1 + s);
3666
- } else {
3667
- t2 = l + s - l * s;
3668
- }
3669
- const t1 = 2 * l - t2;
3670
- const rgb = [0, 0, 0];
3671
- for (let i = 0; i < 3; i++) {
3672
- t3 = h + 1 / 3 * -(i - 1);
3673
- if (t3 < 0) {
3674
- t3++;
3675
- }
3676
- if (t3 > 1) {
3677
- t3--;
3678
- }
3679
- if (6 * t3 < 1) {
3680
- val = t1 + (t2 - t1) * 6 * t3;
3681
- } else if (2 * t3 < 1) {
3682
- val = t2;
3683
- } else if (3 * t3 < 2) {
3684
- val = t1 + (t2 - t1) * (2 / 3 - t3) * 6;
3685
- } else {
3686
- val = t1;
3687
- }
3688
- rgb[i] = val * 255;
3689
- }
3690
- return rgb;
3691
- };
3692
- convert.hsl.hsv = function(hsl) {
3693
- const h = hsl[0];
3694
- let s = hsl[1] / 100;
3695
- let l = hsl[2] / 100;
3696
- let smin = s;
3697
- const lmin = Math.max(l, 0.01);
3698
- l *= 2;
3699
- s *= l <= 1 ? l : 2 - l;
3700
- smin *= lmin <= 1 ? lmin : 2 - lmin;
3701
- const v = (l + s) / 2;
3702
- const sv = l === 0 ? 2 * smin / (lmin + smin) : 2 * s / (l + s);
3703
- return [h, sv * 100, v * 100];
3704
- };
3705
- convert.hsv.rgb = function(hsv) {
3706
- const h = hsv[0] / 60;
3707
- const s = hsv[1] / 100;
3708
- let v = hsv[2] / 100;
3709
- const hi = Math.floor(h) % 6;
3710
- const f = h - Math.floor(h);
3711
- const p = 255 * v * (1 - s);
3712
- const q = 255 * v * (1 - s * f);
3713
- const t = 255 * v * (1 - s * (1 - f));
3714
- v *= 255;
3715
- switch (hi) {
3716
- case 0:
3717
- return [v, t, p];
3718
- case 1:
3719
- return [q, v, p];
3720
- case 2:
3721
- return [p, v, t];
3722
- case 3:
3723
- return [p, q, v];
3724
- case 4:
3725
- return [t, p, v];
3726
- case 5:
3727
- return [v, p, q];
3728
- }
3729
- };
3730
- convert.hsv.hsl = function(hsv) {
3731
- const h = hsv[0];
3732
- const s = hsv[1] / 100;
3733
- const v = hsv[2] / 100;
3734
- const vmin = Math.max(v, 0.01);
3735
- let sl;
3736
- let l;
3737
- l = (2 - s) * v;
3738
- const lmin = (2 - s) * vmin;
3739
- sl = s * vmin;
3740
- sl /= lmin <= 1 ? lmin : 2 - lmin;
3741
- sl = sl || 0;
3742
- l /= 2;
3743
- return [h, sl * 100, l * 100];
3744
- };
3745
- convert.hwb.rgb = function(hwb) {
3746
- const h = hwb[0] / 360;
3747
- let wh = hwb[1] / 100;
3748
- let bl = hwb[2] / 100;
3749
- const ratio = wh + bl;
3750
- let f;
3751
- if (ratio > 1) {
3752
- wh /= ratio;
3753
- bl /= ratio;
3754
- }
3755
- const i = Math.floor(6 * h);
3756
- const v = 1 - bl;
3757
- f = 6 * h - i;
3758
- if ((i & 1) !== 0) {
3759
- f = 1 - f;
3760
- }
3761
- const n = wh + f * (v - wh);
3762
- let r;
3763
- let g;
3764
- let b;
3765
- switch (i) {
3766
- default:
3767
- case 6:
3768
- case 0:
3769
- r = v;
3770
- g = n;
3771
- b = wh;
3772
- break;
3773
- case 1:
3774
- r = n;
3775
- g = v;
3776
- b = wh;
3777
- break;
3778
- case 2:
3779
- r = wh;
3780
- g = v;
3781
- b = n;
3782
- break;
3783
- case 3:
3784
- r = wh;
3785
- g = n;
3786
- b = v;
3787
- break;
3788
- case 4:
3789
- r = n;
3790
- g = wh;
3791
- b = v;
3792
- break;
3793
- case 5:
3794
- r = v;
3795
- g = wh;
3796
- b = n;
3797
- break;
3798
- }
3799
- return [r * 255, g * 255, b * 255];
3800
- };
3801
- convert.cmyk.rgb = function(cmyk) {
3802
- const c = cmyk[0] / 100;
3803
- const m = cmyk[1] / 100;
3804
- const y = cmyk[2] / 100;
3805
- const k = cmyk[3] / 100;
3806
- const r = 1 - Math.min(1, c * (1 - k) + k);
3807
- const g = 1 - Math.min(1, m * (1 - k) + k);
3808
- const b = 1 - Math.min(1, y * (1 - k) + k);
3809
- return [r * 255, g * 255, b * 255];
3810
- };
3811
- convert.xyz.rgb = function(xyz) {
3812
- const x = xyz[0] / 100;
3813
- const y = xyz[1] / 100;
3814
- const z = xyz[2] / 100;
3815
- let r;
3816
- let g;
3817
- let b;
3818
- r = x * 3.2406 + y * -1.5372 + z * -0.4986;
3819
- g = x * -0.9689 + y * 1.8758 + z * 0.0415;
3820
- b = x * 0.0557 + y * -0.204 + z * 1.057;
3821
- r = r > 31308e-7 ? 1.055 * r ** (1 / 2.4) - 0.055 : r * 12.92;
3822
- g = g > 31308e-7 ? 1.055 * g ** (1 / 2.4) - 0.055 : g * 12.92;
3823
- b = b > 31308e-7 ? 1.055 * b ** (1 / 2.4) - 0.055 : b * 12.92;
3824
- r = Math.min(Math.max(0, r), 1);
3825
- g = Math.min(Math.max(0, g), 1);
3826
- b = Math.min(Math.max(0, b), 1);
3827
- return [r * 255, g * 255, b * 255];
3828
- };
3829
- convert.xyz.lab = function(xyz) {
3830
- let x = xyz[0];
3831
- let y = xyz[1];
3832
- let z = xyz[2];
3833
- x /= 95.047;
3834
- y /= 100;
3835
- z /= 108.883;
3836
- x = x > 8856e-6 ? x ** (1 / 3) : 7.787 * x + 16 / 116;
3837
- y = y > 8856e-6 ? y ** (1 / 3) : 7.787 * y + 16 / 116;
3838
- z = z > 8856e-6 ? z ** (1 / 3) : 7.787 * z + 16 / 116;
3839
- const l = 116 * y - 16;
3840
- const a = 500 * (x - y);
3841
- const b = 200 * (y - z);
3842
- return [l, a, b];
3843
- };
3844
- convert.lab.xyz = function(lab) {
3845
- const l = lab[0];
3846
- const a = lab[1];
3847
- const b = lab[2];
3848
- let x;
3849
- let y;
3850
- let z;
3851
- y = (l + 16) / 116;
3852
- x = a / 500 + y;
3853
- z = y - b / 200;
3854
- const y2 = y ** 3;
3855
- const x2 = x ** 3;
3856
- const z2 = z ** 3;
3857
- y = y2 > 8856e-6 ? y2 : (y - 16 / 116) / 7.787;
3858
- x = x2 > 8856e-6 ? x2 : (x - 16 / 116) / 7.787;
3859
- z = z2 > 8856e-6 ? z2 : (z - 16 / 116) / 7.787;
3860
- x *= 95.047;
3861
- y *= 100;
3862
- z *= 108.883;
3863
- return [x, y, z];
3864
- };
3865
- convert.lab.lch = function(lab) {
3866
- const l = lab[0];
3867
- const a = lab[1];
3868
- const b = lab[2];
3869
- let h;
3870
- const hr = Math.atan2(b, a);
3871
- h = hr * 360 / 2 / Math.PI;
3872
- if (h < 0) {
3873
- h += 360;
3874
- }
3875
- const c = Math.sqrt(a * a + b * b);
3876
- return [l, c, h];
3877
- };
3878
- convert.lch.lab = function(lch) {
3879
- const l = lch[0];
3880
- const c = lch[1];
3881
- const h = lch[2];
3882
- const hr = h / 360 * 2 * Math.PI;
3883
- const a = c * Math.cos(hr);
3884
- const b = c * Math.sin(hr);
3885
- return [l, a, b];
3886
- };
3887
- convert.rgb.ansi16 = function(args, saturation = null) {
3888
- const [r, g, b] = args;
3889
- let value = saturation === null ? convert.rgb.hsv(args)[2] : saturation;
3890
- value = Math.round(value / 50);
3891
- if (value === 0) {
3892
- return 30;
3893
- }
3894
- let ansi = 30 + (Math.round(b / 255) << 2 | Math.round(g / 255) << 1 | Math.round(r / 255));
3895
- if (value === 2) {
3896
- ansi += 60;
3897
- }
3898
- return ansi;
3899
- };
3900
- convert.hsv.ansi16 = function(args) {
3901
- return convert.rgb.ansi16(convert.hsv.rgb(args), args[2]);
3902
- };
3903
- convert.rgb.ansi256 = function(args) {
3904
- const r = args[0];
3905
- const g = args[1];
3906
- const b = args[2];
3907
- if (r === g && g === b) {
3908
- if (r < 8) {
3909
- return 16;
3910
- }
3911
- if (r > 248) {
3912
- return 231;
3913
- }
3914
- return Math.round((r - 8) / 247 * 24) + 232;
3915
- }
3916
- const ansi = 16 + 36 * Math.round(r / 255 * 5) + 6 * Math.round(g / 255 * 5) + Math.round(b / 255 * 5);
3917
- return ansi;
3918
- };
3919
- convert.ansi16.rgb = function(args) {
3920
- let color = args % 10;
3921
- if (color === 0 || color === 7) {
3922
- if (args > 50) {
3923
- color += 3.5;
3924
- }
3925
- color = color / 10.5 * 255;
3926
- return [color, color, color];
3927
- }
3928
- const mult = (~~(args > 50) + 1) * 0.5;
3929
- const r = (color & 1) * mult * 255;
3930
- const g = (color >> 1 & 1) * mult * 255;
3931
- const b = (color >> 2 & 1) * mult * 255;
3932
- return [r, g, b];
3933
- };
3934
- convert.ansi256.rgb = function(args) {
3935
- if (args >= 232) {
3936
- const c = (args - 232) * 10 + 8;
3937
- return [c, c, c];
3938
- }
3939
- args -= 16;
3940
- let rem;
3941
- const r = Math.floor(args / 36) / 5 * 255;
3942
- const g = Math.floor((rem = args % 36) / 6) / 5 * 255;
3943
- const b = rem % 6 / 5 * 255;
3944
- return [r, g, b];
3945
- };
3946
- convert.rgb.hex = function(args) {
3947
- const integer = ((Math.round(args[0]) & 255) << 16) + ((Math.round(args[1]) & 255) << 8) + (Math.round(args[2]) & 255);
3948
- const string = integer.toString(16).toUpperCase();
3949
- return "000000".substring(string.length) + string;
3950
- };
3951
- convert.hex.rgb = function(args) {
3952
- const match = args.toString(16).match(/[a-f0-9]{6}|[a-f0-9]{3}/i);
3953
- if (!match) {
3954
- return [0, 0, 0];
3955
- }
3956
- let colorString = match[0];
3957
- if (match[0].length === 3) {
3958
- colorString = colorString.split("").map((char) => {
3959
- return char + char;
3960
- }).join("");
3961
- }
3962
- const integer = parseInt(colorString, 16);
3963
- const r = integer >> 16 & 255;
3964
- const g = integer >> 8 & 255;
3965
- const b = integer & 255;
3966
- return [r, g, b];
3967
- };
3968
- convert.rgb.hcg = function(rgb) {
3969
- const r = rgb[0] / 255;
3970
- const g = rgb[1] / 255;
3971
- const b = rgb[2] / 255;
3972
- const max = Math.max(Math.max(r, g), b);
3973
- const min = Math.min(Math.min(r, g), b);
3974
- const chroma = max - min;
3975
- let grayscale;
3976
- let hue;
3977
- if (chroma < 1) {
3978
- grayscale = min / (1 - chroma);
3979
- } else {
3980
- grayscale = 0;
3981
- }
3982
- if (chroma <= 0) {
3983
- hue = 0;
3984
- } else if (max === r) {
3985
- hue = (g - b) / chroma % 6;
3986
- } else if (max === g) {
3987
- hue = 2 + (b - r) / chroma;
3988
- } else {
3989
- hue = 4 + (r - g) / chroma;
3990
- }
3991
- hue /= 6;
3992
- hue %= 1;
3993
- return [hue * 360, chroma * 100, grayscale * 100];
3994
- };
3995
- convert.hsl.hcg = function(hsl) {
3996
- const s = hsl[1] / 100;
3997
- const l = hsl[2] / 100;
3998
- const c = l < 0.5 ? 2 * s * l : 2 * s * (1 - l);
3999
- let f = 0;
4000
- if (c < 1) {
4001
- f = (l - 0.5 * c) / (1 - c);
4002
- }
4003
- return [hsl[0], c * 100, f * 100];
4004
- };
4005
- convert.hsv.hcg = function(hsv) {
4006
- const s = hsv[1] / 100;
4007
- const v = hsv[2] / 100;
4008
- const c = s * v;
4009
- let f = 0;
4010
- if (c < 1) {
4011
- f = (v - c) / (1 - c);
4012
- }
4013
- return [hsv[0], c * 100, f * 100];
4014
- };
4015
- convert.hcg.rgb = function(hcg) {
4016
- const h = hcg[0] / 360;
4017
- const c = hcg[1] / 100;
4018
- const g = hcg[2] / 100;
4019
- if (c === 0) {
4020
- return [g * 255, g * 255, g * 255];
4021
- }
4022
- const pure = [0, 0, 0];
4023
- const hi = h % 1 * 6;
4024
- const v = hi % 1;
4025
- const w = 1 - v;
4026
- let mg = 0;
4027
- switch (Math.floor(hi)) {
4028
- case 0:
4029
- pure[0] = 1;
4030
- pure[1] = v;
4031
- pure[2] = 0;
4032
- break;
4033
- case 1:
4034
- pure[0] = w;
4035
- pure[1] = 1;
4036
- pure[2] = 0;
4037
- break;
4038
- case 2:
4039
- pure[0] = 0;
4040
- pure[1] = 1;
4041
- pure[2] = v;
4042
- break;
4043
- case 3:
4044
- pure[0] = 0;
4045
- pure[1] = w;
4046
- pure[2] = 1;
4047
- break;
4048
- case 4:
4049
- pure[0] = v;
4050
- pure[1] = 0;
4051
- pure[2] = 1;
4052
- break;
4053
- default:
4054
- pure[0] = 1;
4055
- pure[1] = 0;
4056
- pure[2] = w;
4057
- }
4058
- mg = (1 - c) * g;
4059
- return [
4060
- (c * pure[0] + mg) * 255,
4061
- (c * pure[1] + mg) * 255,
4062
- (c * pure[2] + mg) * 255
4063
- ];
4064
- };
4065
- convert.hcg.hsv = function(hcg) {
4066
- const c = hcg[1] / 100;
4067
- const g = hcg[2] / 100;
4068
- const v = c + g * (1 - c);
4069
- let f = 0;
4070
- if (v > 0) {
4071
- f = c / v;
4072
- }
4073
- return [hcg[0], f * 100, v * 100];
4074
- };
4075
- convert.hcg.hsl = function(hcg) {
4076
- const c = hcg[1] / 100;
4077
- const g = hcg[2] / 100;
4078
- const l = g * (1 - c) + 0.5 * c;
4079
- let s = 0;
4080
- if (l > 0 && l < 0.5) {
4081
- s = c / (2 * l);
4082
- } else if (l >= 0.5 && l < 1) {
4083
- s = c / (2 * (1 - l));
4084
- }
4085
- return [hcg[0], s * 100, l * 100];
4086
- };
4087
- convert.hcg.hwb = function(hcg) {
4088
- const c = hcg[1] / 100;
4089
- const g = hcg[2] / 100;
4090
- const v = c + g * (1 - c);
4091
- return [hcg[0], (v - c) * 100, (1 - v) * 100];
4092
- };
4093
- convert.hwb.hcg = function(hwb) {
4094
- const w = hwb[1] / 100;
4095
- const b = hwb[2] / 100;
4096
- const v = 1 - b;
4097
- const c = v - w;
4098
- let g = 0;
4099
- if (c < 1) {
4100
- g = (v - c) / (1 - c);
4101
- }
4102
- return [hwb[0], c * 100, g * 100];
4103
- };
4104
- convert.apple.rgb = function(apple) {
4105
- return [apple[0] / 65535 * 255, apple[1] / 65535 * 255, apple[2] / 65535 * 255];
4106
- };
4107
- convert.rgb.apple = function(rgb) {
4108
- return [rgb[0] / 255 * 65535, rgb[1] / 255 * 65535, rgb[2] / 255 * 65535];
4109
- };
4110
- convert.gray.rgb = function(args) {
4111
- return [args[0] / 100 * 255, args[0] / 100 * 255, args[0] / 100 * 255];
4112
- };
4113
- convert.gray.hsl = function(args) {
4114
- return [0, 0, args[0]];
4115
- };
4116
- convert.gray.hsv = convert.gray.hsl;
4117
- convert.gray.hwb = function(gray) {
4118
- return [0, 100, gray[0]];
4119
- };
4120
- convert.gray.cmyk = function(gray) {
4121
- return [0, 0, 0, gray[0]];
4122
- };
4123
- convert.gray.lab = function(gray) {
4124
- return [gray[0], 0, 0];
4125
- };
4126
- convert.gray.hex = function(gray) {
4127
- const val = Math.round(gray[0] / 100 * 255) & 255;
4128
- const integer = (val << 16) + (val << 8) + val;
4129
- const string = integer.toString(16).toUpperCase();
4130
- return "000000".substring(string.length) + string;
4131
- };
4132
- convert.rgb.gray = function(rgb) {
4133
- const val = (rgb[0] + rgb[1] + rgb[2]) / 3;
4134
- return [val / 255 * 100];
4135
- };
4136
- return conversions;
4137
- }
4138
- var route;
4139
- var hasRequiredRoute;
4140
- function requireRoute() {
4141
- if (hasRequiredRoute) return route;
4142
- hasRequiredRoute = 1;
4143
- const conversions2 = requireConversions();
4144
- function buildGraph() {
4145
- const graph = {};
4146
- const models = Object.keys(conversions2);
4147
- for (let len = models.length, i = 0; i < len; i++) {
4148
- graph[models[i]] = {
4149
- // http://jsperf.com/1-vs-infinity
4150
- // micro-opt, but this is simple.
4151
- distance: -1,
4152
- parent: null
4153
- };
4154
- }
4155
- return graph;
4156
- }
4157
- function deriveBFS(fromModel) {
4158
- const graph = buildGraph();
4159
- const queue = [fromModel];
4160
- graph[fromModel].distance = 0;
4161
- while (queue.length) {
4162
- const current = queue.pop();
4163
- const adjacents = Object.keys(conversions2[current]);
4164
- for (let len = adjacents.length, i = 0; i < len; i++) {
4165
- const adjacent = adjacents[i];
4166
- const node = graph[adjacent];
4167
- if (node.distance === -1) {
4168
- node.distance = graph[current].distance + 1;
4169
- node.parent = current;
4170
- queue.unshift(adjacent);
4171
- }
4172
- }
4173
- }
4174
- return graph;
4175
- }
4176
- function link(from, to) {
4177
- return function(args) {
4178
- return to(from(args));
4179
- };
4180
- }
4181
- function wrapConversion(toModel, graph) {
4182
- const path2 = [graph[toModel].parent, toModel];
4183
- let fn = conversions2[graph[toModel].parent][toModel];
4184
- let cur = graph[toModel].parent;
4185
- while (graph[cur].parent) {
4186
- path2.unshift(graph[cur].parent);
4187
- fn = link(conversions2[graph[cur].parent][cur], fn);
4188
- cur = graph[cur].parent;
4189
- }
4190
- fn.conversion = path2;
4191
- return fn;
4192
- }
4193
- route = function(fromModel) {
4194
- const graph = deriveBFS(fromModel);
4195
- const conversion = {};
4196
- const models = Object.keys(graph);
4197
- for (let len = models.length, i = 0; i < len; i++) {
4198
- const toModel = models[i];
4199
- const node = graph[toModel];
4200
- if (node.parent === null) {
4201
- continue;
4202
- }
4203
- conversion[toModel] = wrapConversion(toModel, graph);
4204
- }
4205
- return conversion;
4206
- };
4207
- return route;
4208
- }
4209
- var colorConvert;
4210
- var hasRequiredColorConvert;
4211
- function requireColorConvert() {
4212
- if (hasRequiredColorConvert) return colorConvert;
4213
- hasRequiredColorConvert = 1;
4214
- const conversions2 = requireConversions();
4215
- const route2 = requireRoute();
4216
- const convert = {};
4217
- const models = Object.keys(conversions2);
4218
- function wrapRaw(fn) {
4219
- const wrappedFn = function(...args) {
4220
- const arg0 = args[0];
4221
- if (arg0 === void 0 || arg0 === null) {
4222
- return arg0;
4223
- }
4224
- if (arg0.length > 1) {
4225
- args = arg0;
4226
- }
4227
- return fn(args);
4228
- };
4229
- if ("conversion" in fn) {
4230
- wrappedFn.conversion = fn.conversion;
4231
- }
4232
- return wrappedFn;
4233
- }
4234
- function wrapRounded(fn) {
4235
- const wrappedFn = function(...args) {
4236
- const arg0 = args[0];
4237
- if (arg0 === void 0 || arg0 === null) {
4238
- return arg0;
4239
- }
4240
- if (arg0.length > 1) {
4241
- args = arg0;
4242
- }
4243
- const result = fn(args);
4244
- if (typeof result === "object") {
4245
- for (let len = result.length, i = 0; i < len; i++) {
4246
- result[i] = Math.round(result[i]);
4247
- }
4248
- }
4249
- return result;
4250
- };
4251
- if ("conversion" in fn) {
4252
- wrappedFn.conversion = fn.conversion;
4253
- }
4254
- return wrappedFn;
4255
- }
4256
- models.forEach((fromModel) => {
4257
- convert[fromModel] = {};
4258
- Object.defineProperty(convert[fromModel], "channels", { value: conversions2[fromModel].channels });
4259
- Object.defineProperty(convert[fromModel], "labels", { value: conversions2[fromModel].labels });
4260
- const routes = route2(fromModel);
4261
- const routeModels = Object.keys(routes);
4262
- routeModels.forEach((toModel) => {
4263
- const fn = routes[toModel];
4264
- convert[fromModel][toModel] = wrapRounded(fn);
4265
- convert[fromModel][toModel].raw = wrapRaw(fn);
4266
- });
4267
- });
4268
- colorConvert = convert;
4269
- return colorConvert;
4270
- }
4271
- ansiStyles$1.exports;
4272
- (function(module) {
4273
- const wrapAnsi16 = (fn, offset) => (...args) => {
4274
- const code = fn(...args);
4275
- return `\x1B[${code + offset}m`;
4276
- };
4277
- const wrapAnsi256 = (fn, offset) => (...args) => {
4278
- const code = fn(...args);
4279
- return `\x1B[${38 + offset};5;${code}m`;
4280
- };
4281
- const wrapAnsi16m = (fn, offset) => (...args) => {
4282
- const rgb = fn(...args);
4283
- return `\x1B[${38 + offset};2;${rgb[0]};${rgb[1]};${rgb[2]}m`;
4284
- };
4285
- const ansi2ansi = (n) => n;
4286
- const rgb2rgb = (r, g, b) => [r, g, b];
4287
- const setLazyProperty = (object, property, get) => {
4288
- Object.defineProperty(object, property, {
4289
- get: () => {
4290
- const value = get();
4291
- Object.defineProperty(object, property, {
4292
- value,
4293
- enumerable: true,
4294
- configurable: true
4295
- });
4296
- return value;
4297
- },
4298
- enumerable: true,
4299
- configurable: true
4300
- });
4301
- };
4302
- let colorConvert2;
4303
- const makeDynamicStyles = (wrap, targetSpace, identity, isBackground) => {
4304
- if (colorConvert2 === void 0) {
4305
- colorConvert2 = requireColorConvert();
4306
- }
4307
- const offset = isBackground ? 10 : 0;
4308
- const styles2 = {};
4309
- for (const [sourceSpace, suite] of Object.entries(colorConvert2)) {
4310
- const name2 = sourceSpace === "ansi16" ? "ansi" : sourceSpace;
4311
- if (sourceSpace === targetSpace) {
4312
- styles2[name2] = wrap(identity, offset);
4313
- } else if (typeof suite === "object") {
4314
- styles2[name2] = wrap(suite[targetSpace], offset);
4315
- }
4316
- }
4317
- return styles2;
4318
- };
4319
- function assembleStyles() {
4320
- const codes = /* @__PURE__ */ new Map();
4321
- const styles2 = {
4322
- modifier: {
4323
- reset: [0, 0],
4324
- // 21 isn't widely supported and 22 does the same thing
4325
- bold: [1, 22],
4326
- dim: [2, 22],
4327
- italic: [3, 23],
4328
- underline: [4, 24],
4329
- inverse: [7, 27],
4330
- hidden: [8, 28],
4331
- strikethrough: [9, 29]
4332
- },
4333
- color: {
4334
- black: [30, 39],
4335
- red: [31, 39],
4336
- green: [32, 39],
4337
- yellow: [33, 39],
4338
- blue: [34, 39],
4339
- magenta: [35, 39],
4340
- cyan: [36, 39],
4341
- white: [37, 39],
4342
- // Bright color
4343
- blackBright: [90, 39],
4344
- redBright: [91, 39],
4345
- greenBright: [92, 39],
4346
- yellowBright: [93, 39],
4347
- blueBright: [94, 39],
4348
- magentaBright: [95, 39],
4349
- cyanBright: [96, 39],
4350
- whiteBright: [97, 39]
4351
- },
4352
- bgColor: {
4353
- bgBlack: [40, 49],
4354
- bgRed: [41, 49],
4355
- bgGreen: [42, 49],
4356
- bgYellow: [43, 49],
4357
- bgBlue: [44, 49],
4358
- bgMagenta: [45, 49],
4359
- bgCyan: [46, 49],
4360
- bgWhite: [47, 49],
4361
- // Bright color
4362
- bgBlackBright: [100, 49],
4363
- bgRedBright: [101, 49],
4364
- bgGreenBright: [102, 49],
4365
- bgYellowBright: [103, 49],
4366
- bgBlueBright: [104, 49],
4367
- bgMagentaBright: [105, 49],
4368
- bgCyanBright: [106, 49],
4369
- bgWhiteBright: [107, 49]
4370
- }
4371
- };
4372
- styles2.color.gray = styles2.color.blackBright;
4373
- styles2.bgColor.bgGray = styles2.bgColor.bgBlackBright;
4374
- styles2.color.grey = styles2.color.blackBright;
4375
- styles2.bgColor.bgGrey = styles2.bgColor.bgBlackBright;
4376
- for (const [groupName, group] of Object.entries(styles2)) {
4377
- for (const [styleName, style] of Object.entries(group)) {
4378
- styles2[styleName] = {
4379
- open: `\x1B[${style[0]}m`,
4380
- close: `\x1B[${style[1]}m`
4381
- };
4382
- group[styleName] = styles2[styleName];
4383
- codes.set(style[0], style[1]);
4384
- }
4385
- Object.defineProperty(styles2, groupName, {
4386
- value: group,
4387
- enumerable: false
4388
- });
4389
- }
4390
- Object.defineProperty(styles2, "codes", {
4391
- value: codes,
4392
- enumerable: false
4393
- });
4394
- styles2.color.close = "\x1B[39m";
4395
- styles2.bgColor.close = "\x1B[49m";
4396
- setLazyProperty(styles2.color, "ansi", () => makeDynamicStyles(wrapAnsi16, "ansi16", ansi2ansi, false));
4397
- setLazyProperty(styles2.color, "ansi256", () => makeDynamicStyles(wrapAnsi256, "ansi256", ansi2ansi, false));
4398
- setLazyProperty(styles2.color, "ansi16m", () => makeDynamicStyles(wrapAnsi16m, "rgb", rgb2rgb, false));
4399
- setLazyProperty(styles2.bgColor, "ansi", () => makeDynamicStyles(wrapAnsi16, "ansi16", ansi2ansi, true));
4400
- setLazyProperty(styles2.bgColor, "ansi256", () => makeDynamicStyles(wrapAnsi256, "ansi256", ansi2ansi, true));
4401
- setLazyProperty(styles2.bgColor, "ansi16m", () => makeDynamicStyles(wrapAnsi16m, "rgb", rgb2rgb, true));
4402
- return styles2;
4403
- }
4404
- Object.defineProperty(module, "exports", {
4405
- enumerable: true,
4406
- get: assembleStyles
4407
- });
4408
- })(ansiStyles$1);
4409
- var ansiStylesExports = ansiStyles$1.exports;
4410
- var browser = {
4411
- stdout: false,
4412
- stderr: false
4413
- };
4414
- const stringReplaceAll$1 = (string, substring, replacer) => {
4415
- let index = string.indexOf(substring);
4416
- if (index === -1) {
4417
- return string;
4418
- }
4419
- const substringLength = substring.length;
4420
- let endIndex = 0;
4421
- let returnValue = "";
4422
- do {
4423
- returnValue += string.substr(endIndex, index - endIndex) + substring + replacer;
4424
- endIndex = index + substringLength;
4425
- index = string.indexOf(substring, endIndex);
4426
- } while (index !== -1);
4427
- returnValue += string.substr(endIndex);
4428
- return returnValue;
4429
- };
4430
- const stringEncaseCRLFWithFirstIndex$1 = (string, prefix, postfix, index) => {
4431
- let endIndex = 0;
4432
- let returnValue = "";
4433
- do {
4434
- const gotCR = string[index - 1] === "\r";
4435
- returnValue += string.substr(endIndex, (gotCR ? index - 1 : index) - endIndex) + prefix + (gotCR ? "\r\n" : "\n") + postfix;
4436
- endIndex = index + 1;
4437
- index = string.indexOf("\n", endIndex);
4438
- } while (index !== -1);
4439
- returnValue += string.substr(endIndex);
4440
- return returnValue;
4441
- };
4442
- var util = {
4443
- stringReplaceAll: stringReplaceAll$1,
4444
- stringEncaseCRLFWithFirstIndex: stringEncaseCRLFWithFirstIndex$1
4445
- };
4446
- var templates;
4447
- var hasRequiredTemplates;
4448
- function requireTemplates() {
4449
- if (hasRequiredTemplates) return templates;
4450
- hasRequiredTemplates = 1;
4451
- 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;
4452
- const STYLE_REGEX = /(?:^|\.)(\w+)(?:\(([^)]*)\))?/g;
4453
- const STRING_REGEX = /^(['"])((?:\\.|(?!\1)[^\\])*)\1$/;
4454
- const ESCAPE_REGEX = /\\(u(?:[a-f\d]{4}|{[a-f\d]{1,6}})|x[a-f\d]{2}|.)|([^\\])/gi;
4455
- const ESCAPES = /* @__PURE__ */ new Map([
4456
- ["n", "\n"],
4457
- ["r", "\r"],
4458
- ["t", " "],
4459
- ["b", "\b"],
4460
- ["f", "\f"],
4461
- ["v", "\v"],
4462
- ["0", "\0"],
4463
- ["\\", "\\"],
4464
- ["e", "\x1B"],
4465
- ["a", "\x07"]
4466
- ]);
4467
- function unescape2(c) {
4468
- const u = c[0] === "u";
4469
- const bracket = c[1] === "{";
4470
- if (u && !bracket && c.length === 5 || c[0] === "x" && c.length === 3) {
4471
- return String.fromCharCode(parseInt(c.slice(1), 16));
4472
- }
4473
- if (u && bracket) {
4474
- return String.fromCodePoint(parseInt(c.slice(2, -1), 16));
4475
- }
4476
- return ESCAPES.get(c) || c;
4477
- }
4478
- function parseArguments(name2, arguments_) {
4479
- const results = [];
4480
- const chunks = arguments_.trim().split(/\s*,\s*/g);
4481
- let matches;
4482
- for (const chunk of chunks) {
4483
- const number = Number(chunk);
4484
- if (!Number.isNaN(number)) {
4485
- results.push(number);
4486
- } else if (matches = chunk.match(STRING_REGEX)) {
4487
- results.push(matches[2].replace(ESCAPE_REGEX, (m, escape2, character) => escape2 ? unescape2(escape2) : character));
4488
- } else {
4489
- throw new Error(`Invalid Chalk template style argument: ${chunk} (in style '${name2}')`);
4490
- }
4491
- }
4492
- return results;
4493
- }
4494
- function parseStyle(style) {
4495
- STYLE_REGEX.lastIndex = 0;
4496
- const results = [];
4497
- let matches;
4498
- while ((matches = STYLE_REGEX.exec(style)) !== null) {
4499
- const name2 = matches[1];
4500
- if (matches[2]) {
4501
- const args = parseArguments(name2, matches[2]);
4502
- results.push([name2].concat(args));
4503
- } else {
4504
- results.push([name2]);
4505
- }
4506
- }
4507
- return results;
4508
- }
4509
- function buildStyle(chalk2, styles2) {
4510
- const enabled = {};
4511
- for (const layer of styles2) {
4512
- for (const style of layer.styles) {
4513
- enabled[style[0]] = layer.inverse ? null : style.slice(1);
4514
- }
4515
- }
4516
- let current = chalk2;
4517
- for (const [styleName, styles3] of Object.entries(enabled)) {
4518
- if (!Array.isArray(styles3)) {
4519
- continue;
4520
- }
4521
- if (!(styleName in current)) {
4522
- throw new Error(`Unknown Chalk style: ${styleName}`);
4523
- }
4524
- current = styles3.length > 0 ? current[styleName](...styles3) : current[styleName];
4525
- }
4526
- return current;
4527
- }
4528
- templates = (chalk2, temporary) => {
4529
- const styles2 = [];
4530
- const chunks = [];
4531
- let chunk = [];
4532
- temporary.replace(TEMPLATE_REGEX, (m, escapeCharacter, inverse, style, close, character) => {
4533
- if (escapeCharacter) {
4534
- chunk.push(unescape2(escapeCharacter));
4535
- } else if (style) {
4536
- const string = chunk.join("");
4537
- chunk = [];
4538
- chunks.push(styles2.length === 0 ? string : buildStyle(chalk2, styles2)(string));
4539
- styles2.push({ inverse, styles: parseStyle(style) });
4540
- } else if (close) {
4541
- if (styles2.length === 0) {
4542
- throw new Error("Found extraneous } in Chalk template literal");
4543
- }
4544
- chunks.push(buildStyle(chalk2, styles2)(chunk.join("")));
4545
- chunk = [];
4546
- styles2.pop();
4547
- } else {
4548
- chunk.push(character);
4549
- }
4550
- });
4551
- chunks.push(chunk.join(""));
4552
- if (styles2.length > 0) {
4553
- const errMessage = `Chalk template literal is missing ${styles2.length} closing bracket${styles2.length === 1 ? "" : "s"} (\`}\`)`;
4554
- throw new Error(errMessage);
4555
- }
4556
- return chunks.join("");
4557
- };
4558
- return templates;
4559
- }
4560
- const ansiStyles = ansiStylesExports;
4561
- const { stdout: stdoutColor, stderr: stderrColor } = browser;
4562
- const {
4563
- stringReplaceAll,
4564
- stringEncaseCRLFWithFirstIndex
4565
- } = util;
4566
- const { isArray } = Array;
4567
- const levelMapping = [
4568
- "ansi",
4569
- "ansi",
4570
- "ansi256",
4571
- "ansi16m"
4572
- ];
4573
- const styles = /* @__PURE__ */ Object.create(null);
4574
- const applyOptions = (object, options = {}) => {
4575
- if (options.level && !(Number.isInteger(options.level) && options.level >= 0 && options.level <= 3)) {
4576
- throw new Error("The `level` option should be an integer from 0 to 3");
4577
- }
4578
- const colorLevel = 0;
4579
- object.level = options.level === void 0 ? colorLevel : options.level;
4580
- };
4581
- class ChalkClass2 {
4582
- constructor(options) {
4583
- return chalkFactory(options);
4584
- }
4585
- }
4586
- const chalkFactory = (options) => {
4587
- const chalk2 = {};
4588
- applyOptions(chalk2, options);
4589
- chalk2.template = (...arguments_) => chalkTag(chalk2.template, ...arguments_);
4590
- Object.setPrototypeOf(chalk2, Chalk.prototype);
4591
- Object.setPrototypeOf(chalk2.template, chalk2);
4592
- chalk2.template.constructor = () => {
4593
- throw new Error("`chalk.constructor()` is deprecated. Use `new chalk.Instance()` instead.");
4594
- };
4595
- chalk2.template.Instance = ChalkClass2;
4596
- return chalk2.template;
4597
- };
4598
- function Chalk(options) {
4599
- return chalkFactory(options);
4600
- }
4601
- for (const [styleName, style] of Object.entries(ansiStyles)) {
4602
- styles[styleName] = {
4603
- get() {
4604
- const builder = createBuilder(this, createStyler(style.open, style.close, this._styler), this._isEmpty);
4605
- Object.defineProperty(this, styleName, { value: builder });
4606
- return builder;
4607
- }
4608
- };
4609
- }
4610
- styles.visible = {
4611
- get() {
4612
- const builder = createBuilder(this, this._styler, true);
4613
- Object.defineProperty(this, "visible", { value: builder });
4614
- return builder;
4615
- }
4616
- };
4617
- const usedModels = ["rgb", "hex", "keyword", "hsl", "hsv", "hwb", "ansi", "ansi256"];
4618
- for (const model of usedModels) {
4619
- styles[model] = {
4620
- get() {
4621
- const { level } = this;
4622
- return function(...arguments_) {
4623
- const styler = createStyler(ansiStyles.color[levelMapping[level]][model](...arguments_), ansiStyles.color.close, this._styler);
4624
- return createBuilder(this, styler, this._isEmpty);
4625
- };
4626
- }
4627
- };
4628
- }
4629
- for (const model of usedModels) {
4630
- const bgModel = "bg" + model[0].toUpperCase() + model.slice(1);
4631
- styles[bgModel] = {
4632
- get() {
4633
- const { level } = this;
4634
- return function(...arguments_) {
4635
- const styler = createStyler(ansiStyles.bgColor[levelMapping[level]][model](...arguments_), ansiStyles.bgColor.close, this._styler);
4636
- return createBuilder(this, styler, this._isEmpty);
4637
- };
4638
- }
4639
- };
4640
- }
4641
- const proto = Object.defineProperties(() => {
4642
- }, {
4643
- ...styles,
4644
- level: {
4645
- enumerable: true,
4646
- get() {
4647
- return this._generator.level;
4648
- },
4649
- set(level) {
4650
- this._generator.level = level;
4651
- }
4652
- }
4653
- });
4654
- const createStyler = (open, close, parent) => {
4655
- let openAll;
4656
- let closeAll;
4657
- if (parent === void 0) {
4658
- openAll = open;
4659
- closeAll = close;
4660
- } else {
4661
- openAll = parent.openAll + open;
4662
- closeAll = close + parent.closeAll;
4663
- }
4664
- return {
4665
- open,
4666
- close,
4667
- openAll,
4668
- closeAll,
4669
- parent
4670
- };
4671
- };
4672
- const createBuilder = (self2, _styler, _isEmpty) => {
4673
- const builder = (...arguments_) => {
4674
- if (isArray(arguments_[0]) && isArray(arguments_[0].raw)) {
4675
- return applyStyle(builder, chalkTag(builder, ...arguments_));
4676
- }
4677
- return applyStyle(builder, arguments_.length === 1 ? "" + arguments_[0] : arguments_.join(" "));
4678
- };
4679
- Object.setPrototypeOf(builder, proto);
4680
- builder._generator = self2;
4681
- builder._styler = _styler;
4682
- builder._isEmpty = _isEmpty;
4683
- return builder;
4684
- };
4685
- const applyStyle = (self2, string) => {
4686
- if (self2.level <= 0 || !string) {
4687
- return self2._isEmpty ? "" : string;
4688
- }
4689
- let styler = self2._styler;
4690
- if (styler === void 0) {
4691
- return string;
4692
- }
4693
- const { openAll, closeAll } = styler;
4694
- if (string.indexOf("\x1B") !== -1) {
4695
- while (styler !== void 0) {
4696
- string = stringReplaceAll(string, styler.close, styler.open);
4697
- styler = styler.parent;
4698
- }
4699
- }
4700
- const lfIndex = string.indexOf("\n");
4701
- if (lfIndex !== -1) {
4702
- string = stringEncaseCRLFWithFirstIndex(string, closeAll, openAll, lfIndex);
4703
- }
4704
- return openAll + string + closeAll;
4705
- };
4706
- let template;
4707
- const chalkTag = (chalk2, ...strings) => {
4708
- const [firstString] = strings;
4709
- if (!isArray(firstString) || !isArray(firstString.raw)) {
4710
- return strings.join(" ");
4711
- }
4712
- const arguments_ = strings.slice(1);
4713
- const parts = [firstString.raw[0]];
4714
- for (let i = 1; i < firstString.length; i++) {
4715
- parts.push(
4716
- String(arguments_[i - 1]).replace(/[{}\\]/g, "\\$&"),
4717
- String(firstString.raw[i])
4718
- );
4719
- }
4720
- if (template === void 0) {
4721
- template = requireTemplates();
4722
- }
4723
- return template(chalk2, parts.join(""));
4724
- };
4725
- Object.defineProperties(Chalk.prototype, styles);
4726
- const chalk = Chalk();
4727
- chalk.supportsColor = stdoutColor;
4728
- chalk.stderr = Chalk({ level: 0 });
4729
- chalk.stderr.supportsColor = stderrColor;
4730
- const { accessSync, constants, readFileSync } = fs$1;
4731
- const envOptions = {};
4732
- function SetupConfig(envOptions2, logger) {
4733
- const envfile = process.env.STSENVFILE === void 0 ? "/.env" : process.env.STSENVFILE;
4734
- config_1({ path: envfile });
4735
- const defconfig = {
4736
- // Node runtime environment
4737
- isProduction: process.env.NODE_ENV === void 0 ? false : process.env.NODE_ENV === "production" ? true : false,
4738
- isTest: process.env.NODE_ENV === void 0 ? false : process.env.NODE_ENV === "test" ? true : false,
4739
- dbuser: process.env.DB_USER === void 0 ? "postgres" : process.env.DB_USER,
4740
- dbpassword: process.env.DB_PASSWORD === void 0 ? "postgres" : process.env.DB_PASSWORD,
4741
- dbpasswordfile: process.env.DB_PASSWORD_FILE,
4742
- dbhost: process.env.DB_HOST === void 0 ? "localhost:5432" : process.env.DB_HOST,
4743
- database: process.env.DB_DATABASE === void 0 ? "stsrestmsdb01" : process.env.DB_DATABASE,
4744
- databaseUrl: process.env.DATABASE_URL,
4745
- connectionString: "",
4746
- defaultDatabaseConnectionString: "",
4747
- STSServerType: process.env.STS_SERVER_TYPE === void 0 ? "EXPRESS_TLS" : process.env.STS_SERVER_TYPE,
4748
- logToFile: process.env.LOG_TO_FILE === void 0 ? false : process.env.LOG_TO_FILE === "true" ? true : false,
4749
- logFilePath: process.env.LOG_FILE_PATH === void 0 ? "/var/lib/sts" : process.env.LOG_FILE_PATH,
4750
- logFileFormat: process.env.LOG_FILE_FORMAT === void 0 ? "csv" : process.env.LOG_FILE_FORMAT,
4751
- poolSize: process.env.POOL_SIZE === void 0 ? 500 : parseInt(process.env.POOL_SIZE),
4752
- useCPUs: process.env.MAX_CPU === void 0 ? -1 : parseFloat(process.env.MAX_CPU),
4753
- respawnOnFail: process.env.RESPAWN === void 0 ? true : process.env.RESPAWN === "true" ? true : false,
4754
- defaultDatabaseEntries: process.env.DEFAULT_DB_ENTRIES === void 0 ? 1e4 : parseInt(process.env.DEFAULT_DB_ENTRIES),
4755
- useRedisDatabaseCache: process.env.USE_REDIS_DATABASE_CACHE === void 0 ? false : process.env.USE_REDIS_DATABASE_CACHE === "true" ? true : false,
4756
- useSocketIoRedisAdaptor: process.env.USE_SOCKET_IO_REDIS_ADAPTOR === void 0 ? false : process.env.USE_SOCKET_IO_REDIS_ADAPTOR === "true" ? true : false,
4757
- socketIoRedisAdaptorUrl: process.env.SOCKET_IO_REDIS_ADAPTOR_URL === void 0 ? "redis://localhost:6379" : process.env.SOCKET_IO_REDIS_ADAPTOR_URL,
4758
- useRedisInstrumentationTransport: process.env.USE_REDIS_INSTRUMENTATION_TRANSPORT === void 0 ? false : process.env.USE_REDIS_INSTRUMENTATION_TRANSPORT === "true" ? true : false,
4759
- redisInstrumentationTransportUrl: process.env.REDIS_INSTRUMENTATION_TRANSPORT_URL === void 0 ? "redis://localhost:6379" : process.env.REDIS_INSTRUMENTATION_TRANSPORT_URL,
4760
- redisDatabaseCacheEndFlush: process.env.REDIS_DATABASE_CACHE_END_FLUSH === void 0 ? false : process.env.REDIS_DATABASE_CACHE_END_FLUSH === "true" ? true : false,
4761
- redisDatabaseCacheUrl: process.env.REDIS_DATABASE_CACHE_URL === void 0 ? "redis://localhost:6379" : process.env.REDIS_DATABASE_CACHE_URL,
4762
- defaultDatabaseMinExtraDataSize: process.env.DEFAULT_DATABASE_MIN_EXTRA_DATA_SIZE === void 0 ? 0 : parseInt(process.env.DEFAULT_DATABASE_MIN_EXTRA_DATA_SIZE),
4763
- defaultDatabaseMaxExtraDataSize: process.env.DEFAULT_DATABASE_MAX_EXTRA_DATA_SIZE === void 0 ? 2e3 : parseInt(process.env.DEFAULT_DATABASE_MAX_EXTRA_DATA_SIZE),
4764
- rest01endpoint: process.env.REST01_ENDPOINT === void 0 ? "https://localhost" : process.env.REST01_ENDPOINT,
4765
- rest01hostport: process.env.REST01_HOST_PORT === void 0 ? "3003" : process.env.REST01_HOST_PORT,
4766
- rest01port: process.env.REST01_PORT === void 0 ? "3003" : process.env.REST01_PORT,
4767
- rest01apiroot: process.env.REST01_APIROOT === void 0 ? "/stsrest01/v1" : process.env.REST01_APIROOT,
4768
- rest01prometheussupport: process.env.REST01_PROM_SUPPORT === void 0 ? true : process.env.REST01_PROM_SUPPORT === "true" ? true : false,
4769
- rest01prometheusclusterport: process.env.REST01_PROM_CLUSTER_PORT === void 0 ? "3013" : process.env.REST01_PROM_CLUSTER_PORT,
4770
- rest01servicename: process.env.REST01_SERVICE_NAME === void 0 ? "STSRest01" : process.env.REST01_SERVICE_NAME,
4771
- rest01serviceversion: process.env.REST01_SERVICE_VERSION === void 0 ? "1.0.0" : process.env.REST01_SERVICE_VERSION,
4772
- stsfhirendpoint: process.env.STSFHIR_ENDPOINT === void 0 ? "https://localhost" : process.env.STSFHIR_ENDPOINT,
4773
- stsfhirhostport: process.env.STSFHIR_HOST_PORT === void 0 ? "3005" : process.env.STSFHIR_HOST_PORT,
4774
- stsfhirport: process.env.STSFHIR_PORT === void 0 ? "3005" : process.env.STSFHIR_PORT,
4775
- stsfhirapiroot: process.env.STSFHIR_APIROOT === void 0 ? "/stsfhir/r5" : process.env.STSFHIR_APIROOT,
4776
- stsfhirprometheussupport: process.env.STSFHIR_PROM_SUPPORT === void 0 ? true : process.env.STSFHIR_PROM_SUPPORT === "true" ? true : false,
4777
- stsfhirprometheusclusterport: process.env.STSFHIR_PROM_CLUSTER_PORT === void 0 ? "3015" : process.env.STSFHIR_PROM_CLUSTER_PORT,
4778
- stsfhirservicename: process.env.STSFHIR_SERVICE_NAME === void 0 ? "STSFHIR" : process.env.STSFHIR_SERVICE_NAME,
4779
- stsfhirserviceversion: process.env.STSFHIR_SERVICE_VERSION === void 0 ? "1.0.0" : process.env.STSFHIR_SERVICE_VERSION,
4780
- imendpoint: process.env.IM_ENDPOINT === void 0 ? "https://localhost" : process.env.IM_ENDPOINT,
4781
- imhostport: process.env.IM_HOST_PORT === void 0 ? "3001" : process.env.IM_HOST_PORT,
4782
- import: process.env.IM_PORT === void 0 ? "3001" : process.env.IM_PORT,
4783
- imapiroot: process.env.IM_APIROOT === void 0 ? "/stsinstrumentmanager/v1" : process.env.IM_APIROOT,
4784
- imprometheussupport: process.env.IM_PROM_SUPPORT === void 0 ? true : process.env.IM_PROM_SUPPORT === "true" ? true : false,
4785
- imprometheusclusterport: process.env.IM_PROM_CLUSTER_PORT === void 0 ? "3011" : process.env.IM_PROM_CLUSTER_PORT,
4786
- imservicename: process.env.IM_SERVICE_NAME === void 0 ? "STSInstrumentManager" : process.env.IM_SERVICE_NAME,
4787
- imserviceversion: process.env.IM_SERVICE_VERSION === void 0 ? "1.0.0" : process.env.IM_SERVICE_VERSION,
4788
- imRedisKeepAliveProcessorUrl: process.env.IM_REDIS_KEEP_ALIVE_PROCESSOR_URL === void 0 ? "redis://localhost:6379" : process.env.IM_REDIS_KEEP_ALIVE_PROCESSOR_URL,
4789
- imRedisMessageProcessorUrl: process.env.IM_REDIS_MESSAGE_PROCESSOR_URL === void 0 ? "redis://localhost:6379" : process.env.IM_REDIS_MESSAGE_PROCESSOR_URL,
4790
- asendpoint: process.env.AS_ENDPOINT === void 0 ? "https://localhost" : process.env.AS_ENDPOINT,
4791
- ashostport: process.env.AS_HOST_PORT === void 0 ? "3002" : process.env.AS_HOST_PORT,
4792
- asport: process.env.AS_PORT === void 0 ? "3002" : process.env.AS_PORT,
4793
- asapiroot: process.env.AS_API_ROOT === void 0 ? "/stsauth/v1.0" : process.env.AS_API_ROOT,
4794
- asoauthapiroot: process.env.AS_OAUTH_API_ROOT === void 0 ? "/oauth2/v2.0" : process.env.AS_OAUTH_API_ROOT,
4795
- asadminapiroot: process.env.AS_ADMIN_API_ROOT === void 0 ? "/admin/v1.0" : process.env.AS_ADMIN_API_ROOT,
4796
- asprometheussupport: process.env.AS_PROM_SUPPORT === void 0 ? true : process.env.AS_PROM_SUPPORT === "true" ? true : false,
4797
- asprometheusclusterport: process.env.AS_PROM_CLUSTER_PORT === void 0 ? "3012" : process.env.AS_PROM_CLUSTER_PORT,
4798
- asservicename: process.env.AS_SERVICE_NAME === void 0 ? "STSAuth" : process.env.AS_SERVICE_NAME,
4799
- asserviceversion: process.env.AS_SERVICE_VERSION === void 0 ? "1.0.0" : process.env.AS_SERVICE_VERSION,
4800
- asjwksjsonpath: process.env.AS_JWKS_JSON_PATH === void 0 ? "/.well-known/jwks.json" : process.env.AS_JWKS_JSON_PATH,
4801
- asjwkskeyrotationtime: process.env.AS_JWKS_KEY_ROTATION_TIME === void 0 ? 86400 : parseInt(process.env.AS_JWKS_KEY_ROTATION_TIME),
4802
- asjwkskeypurgetimeoffset: process.env.AS_JWKS_KEY_PURGE_TIME_OFFSET === void 0 ? 300 : parseInt(process.env.AS_JWKS_KEY_PURGE_TIME_OFFSET),
4803
- asjwkskeycount: process.env.AS_JWKS_KEY_COUNT === void 0 ? 4 : parseInt(process.env.AS_JWKS_KEY_COUNT),
4804
- asaccesstokenexpire: process.env.AS_ACCESS_TOKEN_EXPIRE === void 0 ? 43200 : parseInt(process.env.AS_ACCESS_TOKEN_EXPIRE),
4805
- authorizeendpoint: process.env.AUTHORIZE_ENDPOINT === void 0 ? "https://localhost" : process.env.AUTHORIZE_ENDPOINT,
4806
- authorizeport: process.env.AUTHORIZE_PORT === void 0 ? "3010" : process.env.AUTHORIZE_PORT,
4807
- authorizeapiroot: process.env.AUTHORIZE_API_ROOT === void 0 ? "/stsa" : process.env.AUTHORIZE_API_ROOT,
4808
- authorizeapi: process.env.AUTHORIZE_API === void 0 ? "/authorize" : process.env.AUTHORIZE_API,
4809
- brokerendpoint: process.env.BROKER_ENDPOINT === void 0 ? "https://localhost" : process.env.BROKER_ENDPOINT,
4810
- brokerhostport: process.env.BROKER_HOST_PORT === void 0 ? "3006" : process.env.BROKER_HOST_PORT,
4811
- brokerport: process.env.BROKER_PORT === void 0 ? "3006" : process.env.BROKER_PORT,
4812
- brokerapiroot: process.env.BROKER_APIROOT === void 0 ? "/stsbroker/v1.0" : process.env.BROKER_APIROOT,
4813
- brokerprometheussupport: process.env.BROKER_PROM_SUPPORT === void 0 ? true : process.env.BROKER_PROM_SUPPORT === "true" ? true : false,
4814
- brokerprometheusclusterport: process.env.BROKER_PROM_CLUSTER_PORT === void 0 ? "3016" : process.env.BROKER_PROM_CLUSTER_PORT,
4815
- brokerservicename: process.env.BROKER_SERVICE_NAME === void 0 ? "STSBroker" : process.env.BROKER_SERVICE_NAME,
4816
- brokerserviceversion: process.env.BROKER_SERVICE_VERSION === void 0 ? "1.0.0" : process.env.BROKER_SERVICE_VERSION,
4817
- trnendpoint: process.env.TRN_ENDPOINT === void 0 ? "https://localhost" : process.env.TRN_ENDPOINT,
4818
- trnhostport: process.env.TRN_HOST_PORT === void 0 ? "3007" : process.env.TRN_HOST_PORT,
4819
- trnport: process.env.TRN_PORT === void 0 ? "3007" : process.env.TRN_PORT,
4820
- trnapiroot: process.env.TRN_APIROOT === void 0 ? "/ststrn/v1.0" : process.env.TRN_APIROOT,
4821
- trnprometheussupport: process.env.TRN_PROM_SUPPORT === void 0 ? true : process.env.TRN_PROM_SUPPORT === "true" ? true : false,
4822
- trnprometheusclusterport: process.env.TRN_PROM_CLUSTER_PORT === void 0 ? "3017" : process.env.TRN_PROM_CLUSTER_PORT,
4823
- trnservicename: process.env.TRN_SERVICE_NAME === void 0 ? "STSTestRunnerNode" : process.env.TRN_SERVICE_NAME,
4824
- trnserviceversion: process.env.TRN_SERVICE_VERSION === void 0 ? "1.0.0" : process.env.TRN_SERVICE_VERSION,
4825
- trnautostartdelay: process.env.TRN_AUTO_START_DELAY === void 0 ? 0 : parseInt(process.env.TRN_AUTO_START_DELAY),
4826
- trnautostartconfig: process.env.TRN_AUTO_START_CONFIG === void 0 ? "" : process.env.TRN_AUTO_START_CONFIG,
4827
- trnRedisMessageProcessorUrl: process.env.TRN_REDIS_MESSAGE_PROCESSOR_URL === void 0 ? "redis://localhost:6379" : process.env.TRN_REDIS_MESSAGE_PROCESSOR_URL,
4828
- lambdaendpoint: process.env.LAMBDA_ENDPOINT === void 0 ? "https://localhost" : process.env.LAMBDA_ENDPOINT,
4829
- lambdahostport: process.env.LAMBDA_HOST_PORT === void 0 ? "3009" : process.env.LAMBDA_HOST_PORT,
4830
- lambdaport: process.env.LAMBDA_PORT === void 0 ? "3009" : process.env.LAMBDA_PORT,
4831
- lambdaapiroot: process.env.LAMBDA_APIROOT === void 0 ? "/stslambda/v1.0" : process.env.LAMBDA_APIROOT,
4832
- lambdaprometheussupport: process.env.LAMBDA_PROM_SUPPORT === void 0 ? true : process.env.LAMBDA_PROM_SUPPORT === "true" ? true : false,
4833
- lambdaprometheusclusterport: process.env.LAMBDA_PROM_CLUSTER_PORT === void 0 ? "3019" : process.env.LAMBDA_PROM_CLUSTER_PORT,
4834
- lambdaservicename: process.env.LAMBDA_SERVICE_NAME === void 0 ? "STSLambda" : process.env.LAMBDA_SERVICE_NAME,
4835
- lambdaserviceversion: process.env.LAMBDA_SERVICE_VERSION === void 0 ? "1.0.0" : process.env.LAMBDA_SERVICE_VERSION,
4836
- publishinterval: process.env.PUBLISH_INTERVAL === void 0 ? 1e3 : parseInt(process.env.PUBLISH_INTERVAL),
4837
- publishtimeout: process.env.PUBLISH_TIMEOUT === void 0 ? 750 : parseInt(process.env.PUBLISH_TIMEOUT),
4838
- transport: process.env.TRANSPORT === void 0 ? "RESTAPI" : process.env.TRANSPORT,
4839
- useSecureCookies: process.env.USE_SECURE_COOKIES === void 0 ? false : process.env.USE_SECURE_COOKIES === "true" ? true : false,
4840
- keepAlive: process.env.KEEP_ALIVE === void 0 ? true : process.env.KEEP_ALIVE === "true" ? true : false,
4841
- maxSockets: process.env.MAX_SOCKETS === void 0 ? 10 : parseInt(process.env.MAX_SOCKETS),
4842
- maxTotalSockets: process.env.MAX_TOTAL_SOCKETS === void 0 ? 20 : parseInt(process.env.MAX_TOTAL_SOCKETS),
4843
- maxFreeSockets: process.env.MAX_FREE_SOCKETS === void 0 ? 256 : parseInt(process.env.MAX_FREE_SOCKETS),
4844
- timeout: process.env.TIMEOUT === void 0 ? 1e4 : parseInt(process.env.TIMEOUT),
4845
- maxPayloadSize: process.env.MAX_PAYLOAD_SIZE === void 0 ? "50mb" : process.env.MAX_PAYLOAD_SIZE,
4846
- instrumentationObservationInterval: process.env.INSTRUMENTATION_OBSERVATION_INTERVAL === void 0 ? 1e3 : parseInt(process.env.INSTRUMENTATION_OBSERVATION_INTERVAL),
4847
- instrumentationTimeWindow: process.env.INSTRUMENTATION_TIME_WINDOW === void 0 ? 600 : parseInt(process.env.INSTRUMENTATION_TIME_WINDOW),
4848
- authJWTAccessTokenTimeout: process.env.AUTH_JWT_ACCESS_TOKEN_TIMEOUT === void 0 ? 600 : parseInt(process.env.AUTH_JWT_ACCESS_TOKEN_TIMEOUT),
4849
- authJWTRefreshTokenTimeout: process.env.AUTH_JWT_REFRESH_TOKEN_TIMEOUT === void 0 ? 3600 * 24 : parseInt(process.env.AUTH_JWT_REFRESH_TOKEN_TIMEOUT),
4850
- authCookieTimeout: process.env.AUTH_COOKIE_TIMEOUT === void 0 ? 3600 * 24 : parseInt(process.env.AUTH_COOKIE_TIMEOUT),
4851
- masterProcessExitTime: process.env.MASTER_PROCESS_EXIT_TIME === void 0 ? 500 : parseInt(process.env.MASTER_PROCESS_EXIT_TIME),
4852
- childProcessExitTime: process.env.CHILD_PROCESS_EXIT_TIME === void 0 ? 500 : parseInt(process.env.CHILD_PROCESS_EXIT_TIME),
4853
- systemInformationInterval: process.env.SYSTEM_INFORMATION_INTERVAL === void 0 ? 1e3 : parseInt(process.env.SYSTEM_INFORMATION_INTERVAL),
4854
- ignoresocketio: process.env.IGNORE_SOCKETIO === void 0 ? true : process.env.IGNORE_SOCKETIO === "true" ? true : false,
4855
- httpsserverkeypath: process.env.HTTPS_SERVER_KEY_PATH === void 0 ? "/var/lib/sts/stsglobalresources/keys/server.key" : process.env.HTTPS_SERVER_KEY_PATH,
4856
- httpsservercertpath: process.env.HTTPS_SERVER_CERT_PATH === void 0 ? "/var/lib/sts/stsglobalresources/keys/server.cert" : process.env.HTTPS_SERVER_CERT_PATH,
4857
- tsjwkskeys: process.env.TS_JWKS_KEYS === void 0 ? 3 : parseInt(process.env.TS_JWKS_KEYS),
4858
- jwksAuthConfigCache: process.env.JWKS_AUTH_CONFIG_CACHE === void 0 ? true : process.env.JWKS_AUTH_CONFIG_CACHE === "true" ? true : false,
4859
- jwksAuthConfigCacheMaxEntries: process.env.JWKS_AUTH_CONFIG_CACHE_MAX_ENTRIES === void 0 ? 5 : parseInt(process.env.JWKS_AUTH_CONFIG_CACHE_MAX_ENTRIES),
4860
- jwksAuthConfigCacheMaxAge: process.env.JWKS_AUTH_CONFIG_CACHE_MAX_AGE === void 0 ? 6e5 : parseInt(process.env.JWKS_AUTH_CONFIG_CACHE_MAX_AGE),
4861
- jwksAuthConfigRateLimit: process.env.JWKS_AUTH_CONFIG_RATE_LIMIT === void 0 ? true : process.env.JWKS_AUTH_CONFIG_RATE_LIMIT === "true" ? true : false,
4862
- jwksAuthConfigRateLimitRequestsPerMinute: process.env.JWKS_AUTH_CONFIG_RATE_LIMIT_REQUESTS_PER_MINUTE === void 0 ? 10 : parseInt(process.env.JWKS_AUTH_CONFIG_RATE_LIMIT_REQUESTS_PER_MINUTE),
4863
- jwksAuthConfigTimeout: process.env.JWKS_AUTH_CONFIG_TIMEOUT === void 0 ? 3e4 : parseInt(process.env.JWKS_AUTH_CONFIG_TIMEOUT),
4864
- influxDB_APIToken: process.env.INFLUXDB_API_TOKEN === void 0 ? "password" : process.env.INFLUXDB_API_TOKEN,
4865
- influxDB_APITokenFile: process.env.INFLUXDB_API_TOKEN_FILE,
4866
- influxDB_Url: process.env.INFLUXDB_URL === void 0 ? "http://localhost:8086" : process.env.INFLUXDB_URL,
4867
- influxDB_Org: process.env.INFLUXDB_ORG === void 0 ? "my-org" : process.env.INFLUXDB_ORG,
4868
- influxDB_Bucket: process.env.INFLUXDB_BUCKET === void 0 ? "TestBucket01" : process.env.INFLUXDB_BUCKET,
4869
- influxDB_keepAlive: process.env.INFLUXDB_KEEP_ALIVE === void 0 ? true : process.env.INFLUXDB_KEEP_ALIVE === "true" ? true : false,
4870
- influxDB_maxSockets: process.env.INFLUXDB_MAX_SOCKETS === void 0 ? 10 : parseInt(process.env.INFLUXDB_MAX_SOCKETS),
4871
- influxDB_maxTotalSockets: process.env.INFLUXDB_MAX_TOTAL_SOCKETS === void 0 ? 20 : parseInt(process.env.INFLUXDB_MAX_TOTAL_SOCKETS),
4872
- influxDB_maxFreeSockets: process.env.INFLUXDB_MAX_FREE_SOCKETS === void 0 ? 256 : parseInt(process.env.INFLUXDB_MAX_FREE_SOCKETS),
4873
- influxDB_timeout: process.env.INFLUXDB_TIMEOUT === void 0 ? 1e4 : parseInt(process.env.INFLUXDB_TIMEOUT),
4874
- influxDB_rejectUnauthorized: process.env.INFLUXDB_REJECT_UNAUTHORIZED === void 0 ? true : process.env.INFLUXDB_REJECT_UNAUTHORIZED === "true" ? true : false,
4875
- influxDB_writeDataPointFlushTimeout: process.env.INFLUXDB_WRITE_DATA_POINT_FLUSH_TIMEOUT === void 0 ? 1e3 : parseInt(process.env.INFLUXDB_WRITE_DATA_POINT_FLUSH_TIMEOUT),
4876
- kafka_clientId: process.env.KAFKA_CLIENT_ID === void 0 ? "myclient" : process.env.KAFKA_CLIENT_ID,
4877
- kafka_brokers: process.env.KAFKA_BROKERS === void 0 ? "localhost:9092" : process.env.KAFKA_BROKERS,
4878
- kafka_admin_timeout: process.env.KAFKA_ADMIN_TIMEOUT === void 0 ? 5e3 : parseInt(process.env.KAFKA_ADMIN_TIMEOUT),
4879
- kafka_connection_timeout: process.env.KAFKA_CONNECTION_TIMEOUT === void 0 ? 5e3 : parseInt(process.env.KAFKA_CONNECTION_TIMEOUT),
4880
- kafka_request_timeout: process.env.KAFKA_REQUEST_TIMEOUT === void 0 ? 5e3 : parseInt(process.env.KAFKA_REQUEST_TIMEOUT),
4881
- kafka_log_level: process.env.KAFKA_LOG_LEVEL === void 0 ? "nothing" : process.env.KAFKA_LOG_LEVEL,
4882
- kafka_keep_alive: process.env.KAFKA_KEEP_ALIVE === void 0 ? 3e4 : parseInt(process.env.KAFKA_KEEP_ALIVE),
4883
- kafka_use_ssl: process.env.KAFKA_USE_SSL === void 0 ? false : process.env.KAFKA_USE_SSL === "true" ? true : false,
4884
- kafka_ssl_rejectUnauthorized: process.env.KAFKA_SSL_REJECT_UNAUTHORIZED === void 0 ? true : process.env.KAFKA_SSL_REJECT_UNAUTHORIZED === "true" ? true : false,
4885
- kafka_ssl_cafile: process.env.KAFKA_SSL_CAFILE === void 0 ? "/my/custom/ca.crt" : process.env.KAFKA_SSL_CAFILE,
4886
- kafka_ssl_keyfile: process.env.KAFKA_SSL_KEYFILE === void 0 ? "/my/custom/client-key.pem" : process.env.KAFKA_SSL_KEYFILE,
4887
- kafka_ssl_certfile: process.env.KAFKA_SSL_CERTFILE === void 0 ? "/my/custom/client-cert.pem" : process.env.KAFKA_SSL_CERTFILE,
4888
- kafka_consume_from_beginning: process.env.KAFKA_CONSUME_FROM_BEGINNING === void 0 ? true : process.env.KAFKA_CONSUME_FROM_BEGINNING === "true" ? true : false,
4889
- observabilityPublishMode: process.env.OBSERVABILITY_PUBLISH_MODE === void 0 ? "PROXY" : process.env.OBSERVABILITY_PUBLISH_MODE,
4890
- stsUiTermObservabilityConsumptionMode: process.env.STSUITERM_OBSERVABILITY_CONSUMPTION_MODE === void 0 ? "PROXY" : process.env.STSUITERM_OBSERVABILITY_CONSUMPTION_MODE
4891
- };
4892
- const ReadFile = (passwordFile) => {
4893
- try {
4894
- accessSync(passwordFile, constants.R_OK);
4895
- const data = readFileSync(passwordFile, "utf8");
4896
- if (logger) ;
4897
- return data;
4898
- } catch (err) {
4899
- return "";
4900
- }
4901
- };
4902
- const fileconfig = [
4903
- { fileprop: "dbpasswordfile", prop: "dbpassword" },
4904
- // JWKS secret file processing
4905
- { fileprop: "tsjwksstorepathfile", prop: "tsjwksstorepath" },
4906
- // InfluxDB file processing
4907
- { fileprop: "influxDB_APITokenFile", prop: "influxDB_APIToken" }
4908
- ];
4909
- fileconfig.forEach((v) => {
4910
- if (defconfig[v.fileprop] !== void 0) {
4911
- defconfig[v.prop] = ReadFile(defconfig[v.fileprop]);
4912
- }
4913
- });
4914
- for (const [key, val] of Object.entries(defconfig)) {
4915
- envOptions2[key] = val;
4916
- }
4917
- }
4918
- function $SetupOptions(envOptions2) {
4919
- SetupConfig(envOptions2);
4920
- const options = envOptions2;
4921
- if (options.dbhost) {
4922
- const hosts = options.dbhost.split(",");
4923
- envOptions2.connectionString = hosts.map((host) => {
4924
- return `postgresql://${options.dbuser}:${options.dbpassword}@${host}/${options.database}`;
4925
- }).join(",");
4926
- envOptions2.defaultDatabaseConnectionString = hosts.map((host) => {
4927
- return `postgresql://${options.dbuser}:${options.dbpassword}@${host}/postgres`;
4928
- }).join(",");
4929
- }
4930
- }
4931
- const envOptionsHandler = {
4932
- get(target, prop, receiver) {
4933
- if (Object.keys(target).length === 0) {
4934
- $SetupOptions(target);
4935
- }
4936
- return Reflect.get(target, prop, receiver);
4937
- }
4938
- };
4939
- const goptions = new Proxy(envOptions, envOptionsHandler);
4940
- class AgentManager {
4941
- constructor(agentManagerOptions) {
4942
- __privateAdd2(this, _options);
4943
- __privateAdd2(this, _httpAgent, null);
4944
- __privateAdd2(this, _httpsAgent, null);
4945
- __privateAdd2(this, _agentResetInterval, null);
4946
- __privateAdd2(this, _requestCount, 0);
4947
- __privateAdd2(this, _SetupResetInterval, () => {
4948
- if (__privateGet2(this, _options).agentResetInterval && __privateGet2(this, _options).agentResetInterval > 0) {
4949
- __privateSet2(this, _agentResetInterval, setTimeout(() => {
4950
- this.ResetAgent();
4951
- __privateGet2(this, _SetupResetInterval).call(this);
4952
- }, __privateGet2(this, _options).agentResetInterval).unref());
4953
- }
4954
- });
4955
- __privateAdd2(this, _GetAgentOptions, (https2) => {
4956
- let options;
4957
- if (__privateGet2(this, _options).agentOptions) {
4958
- options = {
4959
- keepAlive: __privateGet2(this, _options).agentOptions.keepAlive,
4960
- maxSockets: __privateGet2(this, _options).agentOptions.maxSockets,
4961
- maxTotalSockets: __privateGet2(this, _options).agentOptions.maxTotalSockets,
4962
- maxFreeSockets: __privateGet2(this, _options).agentOptions.maxFreeSockets,
4963
- timeout: __privateGet2(this, _options).agentOptions.timeout
4964
- //@@ config
4965
- };
4966
- if (https2 === true) {
4967
- options.rejectUnauthorized = __privateGet2(this, _options).agentOptions.rejectUnauthorized;
4968
- }
4969
- } else {
4970
- options = {
4971
- keepAlive: process.env.NODE_ENV === "test" ? false : goptions.keepAlive,
4972
- maxSockets: goptions.maxSockets,
4973
- maxTotalSockets: goptions.maxTotalSockets,
4974
- maxFreeSockets: goptions.maxFreeSockets,
4975
- timeout: 3e4
4976
- //@@ config
4977
- };
4978
- if (https2 === true) {
4979
- options.rejectUnauthorized = goptions.isProduction;
4980
- }
4981
- }
4982
- return options;
4983
- });
4984
- __privateSet2(this, _options, agentManagerOptions);
4985
- if (__privateGet2(this, _options).agentResetInterval) {
4986
- __privateGet2(this, _SetupResetInterval).call(this);
4987
- }
4988
- }
4989
- get agentResetInterval() {
4990
- return __privateGet2(this, _options).agentResetInterval;
4991
- }
4992
- set agentResetInterval(val) {
4993
- if (__privateGet2(this, _agentResetInterval)) {
4994
- clearTimeout(__privateGet2(this, _agentResetInterval));
4995
- }
4996
- __privateGet2(this, _options).agentResetInterval = val;
4997
- __privateGet2(this, _SetupResetInterval).call(this);
4998
- }
4999
- get agentResetCount() {
5000
- return __privateGet2(this, _options).agentResetCount;
5001
- }
5002
- set agentResetCount(val) {
5003
- __privateGet2(this, _options).agentResetCount = val;
5004
- }
5005
- IncRequestCount() {
5006
- __privateWrapper2(this, _requestCount)._++;
5007
- if (__privateGet2(this, _options).agentResetCount) {
5008
- if (__privateGet2(this, _requestCount) % __privateGet2(this, _options).agentResetCount === 0) {
5009
- this.ResetAgent();
5010
- }
5011
- }
5012
- }
5013
- IsHttps(protocol) {
5014
- if (protocol.toLowerCase().startsWith("https:")) {
5015
- return true;
5016
- }
5017
- return false;
5018
- }
5019
- GetAgent(protocol) {
5020
- if (protocol.toLowerCase().startsWith("https:")) {
5021
- if (__privateGet2(this, _httpsAgent) === null) {
5022
- __privateSet2(this, _httpsAgent, new https.Agent(__privateGet2(this, _GetAgentOptions).call(this, true)));
5023
- }
5024
- return __privateGet2(this, _httpsAgent);
5025
- } else if (protocol.toLowerCase().startsWith("http:")) {
5026
- if (__privateGet2(this, _httpAgent) === null) {
5027
- __privateSet2(this, _httpAgent, new http.Agent(__privateGet2(this, _GetAgentOptions).call(this, false)));
5028
- }
5029
- return __privateGet2(this, _httpAgent);
5030
- } else {
5031
- return null;
5032
- }
5033
- }
5034
- ResetAgent() {
5035
- __privateSet2(this, _httpAgent, null);
5036
- __privateSet2(this, _httpsAgent, null);
5037
- }
5038
- /*
5039
- url
5040
- ,method: 'post'
5041
- ,data: payload
5042
- ,headers: headers
5043
- ,httpsAgent: this.#agentManager.GetAgent(url)
5044
- */
5045
- /*
5046
- postgresContainer = await new GenericContainer("postgres")
5047
- .withExposedPorts(5432)
5048
- .withEnvironment({
5049
- POSTGRES_PASSWORD: "postgres",
5050
- //UV_THREADPOOL_SIZE: "64"
5051
- })
5052
- .withCommand(['-c', 'max_connections=20'])
5053
- .start();
5054
- */
5055
- Terminate() {
5056
- if (__privateGet2(this, _agentResetInterval)) {
5057
- clearTimeout(__privateGet2(this, _agentResetInterval));
5058
- __privateSet2(this, _agentResetInterval, null);
5059
- }
5060
- if (__privateGet2(this, _httpAgent)) {
5061
- __privateGet2(this, _httpAgent).destroy();
5062
- __privateSet2(this, _httpAgent, null);
5063
- }
5064
- if (__privateGet2(this, _httpsAgent)) {
5065
- __privateGet2(this, _httpsAgent).destroy();
5066
- __privateSet2(this, _httpsAgent, null);
5067
- }
5068
- }
5069
- }
5070
- _options = /* @__PURE__ */ new WeakMap();
5071
- _httpAgent = /* @__PURE__ */ new WeakMap();
5072
- _httpsAgent = /* @__PURE__ */ new WeakMap();
5073
- _agentResetInterval = /* @__PURE__ */ new WeakMap();
5074
- _requestCount = /* @__PURE__ */ new WeakMap();
5075
- _SetupResetInterval = /* @__PURE__ */ new WeakMap();
5076
- _GetAgentOptions = /* @__PURE__ */ new WeakMap();
5077
- class STSAxiosConfig {
5078
- constructor(url, method, headers, timeout) {
5079
- __privateAdd2(this, _url);
5080
- __privateAdd2(this, _method);
5081
- __privateAdd2(this, _headers);
5082
- __privateAdd2(this, _data);
5083
- __privateAdd2(this, _agentManager);
5084
- __privateAdd2(this, _timeout);
5085
- __privateAdd2(this, _withCredentials);
5086
- __privateSet2(this, _url, url);
5087
- __privateSet2(this, _method, method);
5088
- if (headers !== void 0) {
5089
- __privateSet2(this, _headers, headers);
5090
- }
5091
- if (timeout !== void 0) {
5092
- __privateSet2(this, _timeout, timeout);
5093
- }
5094
- }
5095
- withCookies(cookies) {
5096
- if (!__privateGet2(this, _headers)) {
5097
- __privateSet2(this, _headers, {});
5098
- }
5099
- __privateGet2(this, _headers)["Cookie"] = cookies.join("; ");
5100
- return this;
5101
- }
5102
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
5103
- withData(data) {
5104
- __privateSet2(this, _data, data);
5105
- return this;
5106
- }
5107
- // 'Content-Type': 'application/json'
5108
- withAuthHeaders(accesssToken, stsUserId) {
5109
- if (!__privateGet2(this, _headers)) {
5110
- __privateSet2(this, _headers, {});
5111
- }
5112
- __privateGet2(this, _headers)["Content-Type"] = "application/json";
5113
- __privateGet2(this, _headers)["Authorization"] = "Bearer " + accesssToken;
5114
- if (stsUserId) {
5115
- __privateGet2(this, _headers)["x-sts_user_id"] = stsUserId;
5116
- }
5117
- return this;
5118
- }
5119
- withHeaders(headers) {
5120
- __privateSet2(this, _headers, headers);
5121
- return this;
5122
- }
5123
- withDefaultHeaders() {
5124
- if (!__privateGet2(this, _headers)) {
5125
- __privateSet2(this, _headers, {});
5126
- }
5127
- __privateGet2(this, _headers)["Content-Type"] = "application/json";
5128
- return this;
5129
- }
5130
- withCredentials() {
5131
- __privateSet2(this, _withCredentials, true);
5132
- return this;
5133
- }
5134
- withTimeout(timeout) {
5135
- __privateSet2(this, _timeout, timeout);
5136
- return this;
5137
- }
5138
- withAgentManager(agentManager) {
5139
- __privateSet2(this, _agentManager, agentManager);
5140
- return this;
5141
- }
5142
- get config() {
5143
- const retVal = {
5144
- url: __privateGet2(this, _url),
5145
- method: __privateGet2(this, _method)
5146
- };
5147
- if (__privateGet2(this, _headers)) {
5148
- retVal.headers = __privateGet2(this, _headers);
5149
- }
5150
- if (__privateGet2(this, _agentManager) !== void 0) {
5151
- if (__privateGet2(this, _agentManager).IsHttps(__privateGet2(this, _url))) {
5152
- retVal.httpsAgent = __privateGet2(this, _agentManager).GetAgent(__privateGet2(this, _url));
5153
- } else {
5154
- retVal.httpAgent = __privateGet2(this, _agentManager).GetAgent(__privateGet2(this, _url));
5155
- }
5156
- }
5157
- if (__privateGet2(this, _data) !== void 0) {
5158
- retVal.data = __privateGet2(this, _data);
5159
- }
5160
- if (__privateGet2(this, _timeout) !== void 0) {
5161
- retVal.timeout = __privateGet2(this, _timeout);
5162
- }
5163
- if (__privateGet2(this, _withCredentials) !== void 0 && __privateGet2(this, _withCredentials) === true) {
5164
- retVal.withCredentials = true;
5165
- }
5166
- return retVal;
5167
- }
5168
- }
5169
- _url = /* @__PURE__ */ new WeakMap();
5170
- _method = /* @__PURE__ */ new WeakMap();
5171
- _headers = /* @__PURE__ */ new WeakMap();
5172
- _data = /* @__PURE__ */ new WeakMap();
5173
- _agentManager = /* @__PURE__ */ new WeakMap();
5174
- _timeout = /* @__PURE__ */ new WeakMap();
5175
- _withCredentials = /* @__PURE__ */ new WeakMap();
5176
- class STSOAuth2Worker {
5177
- constructor(workerPort, options, logger) {
5178
- __privateAdd(this, _STSOAuth2Worker_instances);
5179
- //#storageManager = null;
5180
- __privateAdd(this, _clientSessionStore);
5181
- __privateAdd(this, _cUtils, new CryptoUtils());
5182
- __privateAdd(this, _qParams, new QueryParams());
5183
- __privateAdd(this, _STORAGE_SESSION_KEY, "session.stsmda.com.au");
5184
- //@@#aic = null;
5185
- __privateAdd(this, _oauthWorkerPort);
5186
- __privateAdd(this, _options3);
5187
- __privateAdd(this, _logger);
5188
- __privateAdd(this, _agentManager2, null);
5189
- // Attempt to restore a previous session using the STSBroker
5190
- /*
5191
- { parameterType: OAuth2ParameterType.CLIENT_ID, errorType: authErrorType.CLIENT_ID_MISMATCH },
5192
- { parameterType: OAuth2ParameterType.SCOPE, errorType: authErrorType.SCOPE_MISMATCH }
5193
- { parameterType: OAuth2ParameterType.REDIRECT_URI, errorType: authErrorType.REDIRECT_URI_MISMATCH },
5194
- { parameterType: OAuth2ParameterType.AUDIENCE, errorType: authErrorType.SCOPE_MISMATCH }
5195
-
5196
- Successful Response
5197
- {
5198
- "access_token": "eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiIsIng1dCI6Ik5HVEZ2ZEstZnl0aEV1Q...",
5199
- "token_type": "Bearer",
5200
- "expires_in": 3599,
5201
- "scope": "https%3A%2F%2Fgraph.microsoft.com%2Fmail.read",
5202
- "refresh_token": "AwABAAAAvPM1KaPlrEqdFSBzjqfTGAMxZGUTdM0t4B4...",
5203
- "id_token": "eyJ0eXAiOiJKV1QiLCJhbGciOiJub25lIn0.eyJhdWQiOiIyZDRkMTFhMi1mODE0LTQ2YTctOD...",
5204
- }
5205
-
5206
- Error Response
5207
- {
5208
- "error": "invalid_scope",
5209
- "error_description": "AADSTS70011: The provided value for the input parameter 'scope' is not valid. The scope https://foo.microsoft.com/mail.read is not valid.\r\nTrace ID: 255d1aef-8c98-452f-ac51-23d051240864\r\nCorrelation ID: fb3d2015-bc17-4bb9-bb85-30c5cf1aaaa7\r\nTimestamp: 2016-01-09 02:02:12Z",
5210
- "error_codes": [
5211
- 70011
5212
- ],
5213
- "timestamp": "2016-01-09 02:02:12Z",
5214
- }
5215
-
5216
- */
5217
- __privateAdd(this, _HandleAuthenticateEvent2, (id_token) => {
5218
- const message = {
5219
- messageId: -1,
5220
- // un-solicited message
5221
- command: IOauth2ListenerCommand.AUTHENTICATE_EVENT
5222
- };
5223
- __privateGet(this, _ProcessCommand).call(this, message, id_token);
5224
- });
5225
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
5226
- __privateAdd(this, _HandleErrorEvent2, (error) => {
5227
- const message = {
5228
- messageId: -1,
5229
- // un-solicited message
5230
- command: IOauth2ListenerCommand.ERROR
5231
- };
5232
- __privateGet(this, _ProcessCommand).call(this, message, error);
5233
- });
5234
- __privateAdd(this, _LogMessage, (messageToSend) => {
5235
- const message = {
5236
- messageId: -1,
5237
- // un-solicited message
5238
- command: IOauth2ListenerCommand.LOG
5239
- };
5240
- __privateGet(this, _ProcessCommand).call(this, message, messageToSend);
5241
- });
5242
- __privateAdd(this, _GetAccessToken, () => {
5243
- const sessionData = __privateGet(this, _clientSessionStore).get(__privateGet(this, _STORAGE_SESSION_KEY));
5244
- if (sessionData) {
5245
- const tokens = sessionData.tokenResponse;
5246
- return tokens.access_token;
5247
- } else {
5248
- return null;
2957
+
2958
+ */
2959
+ __privateAdd(this, _HandleAuthenticateEvent2, (id_token) => {
2960
+ const message = {
2961
+ messageId: -1,
2962
+ // un-solicited message
2963
+ command: IOauth2ListenerCommand.AUTHENTICATE_EVENT
2964
+ };
2965
+ __privateGet(this, _ProcessCommand).call(this, message, id_token);
2966
+ });
2967
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
2968
+ __privateAdd(this, _HandleErrorEvent2, (error) => {
2969
+ const message = {
2970
+ messageId: -1,
2971
+ // un-solicited message
2972
+ command: IOauth2ListenerCommand.ERROR
2973
+ };
2974
+ __privateGet(this, _ProcessCommand).call(this, message, error);
2975
+ });
2976
+ __privateAdd(this, _LogMessage, (messageToSend) => {
2977
+ const message = {
2978
+ messageId: -1,
2979
+ // un-solicited message
2980
+ command: IOauth2ListenerCommand.LOG
2981
+ };
2982
+ __privateGet(this, _ProcessCommand).call(this, message, messageToSend);
2983
+ });
2984
+ __privateAdd(this, _GetAccessToken, () => {
2985
+ const sessionData = __privateGet(this, _clientSessionStore).get(__privateGet(this, _STORAGE_SESSION_KEY));
2986
+ if (sessionData) {
2987
+ const tokens = sessionData.tokenResponse;
2988
+ return tokens.access_token;
2989
+ } else {
2990
+ return null;
5249
2991
  }
5250
2992
  });
5251
2993
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
@@ -5320,21 +3062,21 @@ class STSOAuth2Worker {
5320
3062
  __privateMethod(this, _STSOAuth2Worker_instances, LogInfoMessage_fn2).call(this, "Session restored from client storage.");
5321
3063
  __privateGet(this, _LogMessage).call(this, "Session restored from client storage.");
5322
3064
  } else {
5323
- const url = `${__privateGet(this, _options3).brokerendpoint}:${__privateGet(this, _options3).brokerport}${__privateGet(this, _options3).brokerapiroot}/session`;
3065
+ const url = `${__privateGet(this, _options2).brokerendpoint}:${__privateGet(this, _options2).brokerport}${__privateGet(this, _options2).brokerapiroot}/session`;
5324
3066
  __privateMethod(this, _STSOAuth2Worker_instances, LogInfoMessage_fn2).call(this, "RestoreSession");
5325
3067
  __privateMethod(this, _STSOAuth2Worker_instances, LogInfoMessage_fn2).call(this, url);
5326
3068
  __privateGet(this, _LogMessage).call(this, "RestoreSession.");
5327
3069
  __privateGet(this, _LogMessage).call(this, url);
5328
3070
  try {
5329
3071
  const rConfig = new STSAxiosConfig(url, "post").withData({
5330
- [OAuth2ParameterType.CLIENT_ID]: __privateGet(this, _options3).client_id,
5331
- [OAuth2ParameterType.SCOPE]: __privateGet(this, _options3).scope,
5332
- [OAuth2ParameterType.REDIRECT_URI]: __privateGet(this, _options3).redirect_uri,
5333
- [OAuth2ParameterType.AUDIENCE]: __privateGet(this, _options3).audience
5334
- }).withDefaultHeaders().withCredentials().withTimeout(__privateGet(this, _options3).timeout);
5335
- __privateMethod(this, _STSOAuth2Worker_instances, LogDebugMessage_fn2).call(this, chalk$2.magenta(`#RestoreSession:session request detail: [${JSON.stringify(rConfig)}]`));
5336
- if (isNode && __privateGet(this, _agentManager2)) {
5337
- rConfig.withAgentManager(__privateGet(this, _agentManager2));
3072
+ [OAuth2ParameterType.CLIENT_ID]: __privateGet(this, _options2).client_id,
3073
+ [OAuth2ParameterType.SCOPE]: __privateGet(this, _options2).scope,
3074
+ [OAuth2ParameterType.REDIRECT_URI]: __privateGet(this, _options2).redirect_uri,
3075
+ [OAuth2ParameterType.AUDIENCE]: __privateGet(this, _options2).audience
3076
+ }).withDefaultHeaders().withCredentials().withTimeout(__privateGet(this, _options2).timeout);
3077
+ __privateMethod(this, _STSOAuth2Worker_instances, LogDebugMessage_fn2).call(this, chalk$1.magenta(`#RestoreSession:session request detail: [${JSON.stringify(rConfig)}]`));
3078
+ if (isNode && __privateGet(this, _agentManager)) {
3079
+ rConfig.withAgentManager(__privateGet(this, _agentManager));
5338
3080
  }
5339
3081
  const retVal = await axios(rConfig.config);
5340
3082
  if (retVal.data.status === StatusCodes.OK) {
@@ -5373,12 +3115,12 @@ class STSOAuth2Worker {
5373
3115
  });
5374
3116
  __privateAdd(this, _Authorize, async () => {
5375
3117
  __privateMethod(this, _STSOAuth2Worker_instances, LogInfoMessage_fn2).call(this, "Authorize ...");
5376
- const client_id = __privateGet(this, _options3).client_id;
3118
+ const client_id = __privateGet(this, _options2).client_id;
5377
3119
  const nonce = __privateGet(this, _cUtils).CreateRandomString();
5378
3120
  const response_type = [AuthorizeOptionsResponseType.CODE];
5379
- const redirect_uri = __privateGet(this, _options3).redirect_uri;
3121
+ const redirect_uri = __privateGet(this, _options2).redirect_uri;
5380
3122
  const response_mode = AuthorizeOptionsResponseMode.QUERY;
5381
- const scope = __privateGet(this, _options3).scope;
3123
+ const scope = __privateGet(this, _options2).scope;
5382
3124
  const state = __privateGet(this, _cUtils).CreateRandomString();
5383
3125
  const code_verifier = __privateGet(this, _cUtils).CreateRandomString();
5384
3126
  const code_challenge = await __privateGet(this, _cUtils).DigestMessage(code_verifier);
@@ -5395,7 +3137,7 @@ class STSOAuth2Worker {
5395
3137
  code_challenge_method
5396
3138
  };
5397
3139
  const authorizeOptionsClientCopy = { ...authorizeOptions };
5398
- const url = `${__privateGet(this, _options3).authorizeendpoint}:${__privateGet(this, _options3).authorizeport}${__privateGet(this, _options3).authorizeapiroot}${__privateGet(this, _options3).authorizeapi}?${__privateGet(this, _qParams).CreateQueryParams(authorizeOptions)}`;
3140
+ const url = `${__privateGet(this, _options2).authorizeendpoint}:${__privateGet(this, _options2).authorizeport}${__privateGet(this, _options2).authorizeapiroot}${__privateGet(this, _options2).authorizeapi}?${__privateGet(this, _qParams).CreateQueryParams(authorizeOptions)}`;
5399
3141
  __privateMethod(this, _STSOAuth2Worker_instances, LogInfoMessage_fn2).call(this, url);
5400
3142
  authorizeOptions.code_verifier = code_verifier;
5401
3143
  __privateMethod(this, _STSOAuth2Worker_instances, LogInfoMessage_fn2).call(this, `Authorize:authorizeOptions: [${JSON.stringify(authorizeOptions)}]`);
@@ -5409,29 +3151,29 @@ class STSOAuth2Worker {
5409
3151
  __privateAdd(this, _HandleRedirect, async (payload) => {
5410
3152
  const queryVars = payload.queryVars;
5411
3153
  const authorizeOptions = payload.authorizeOptions;
5412
- __privateMethod(this, _STSOAuth2Worker_instances, LogDebugMessage_fn2).call(this, chalk$2.magenta(`#HandleRedirect: HandleRedirect`));
5413
- __privateMethod(this, _STSOAuth2Worker_instances, LogDebugMessage_fn2).call(this, chalk$2.magenta(`#HandleRedirect: HandleRedirect:Query Vars: [${JSON.stringify(queryVars)}]`));
3154
+ __privateMethod(this, _STSOAuth2Worker_instances, LogDebugMessage_fn2).call(this, chalk$1.magenta(`#HandleRedirect: HandleRedirect`));
3155
+ __privateMethod(this, _STSOAuth2Worker_instances, LogDebugMessage_fn2).call(this, chalk$1.magenta(`#HandleRedirect: HandleRedirect:Query Vars: [${JSON.stringify(queryVars)}]`));
5414
3156
  if (queryVars[OAuth2ParameterType.CODE]) {
5415
3157
  const response = queryVars;
5416
3158
  __privateMethod(this, _STSOAuth2Worker_instances, LogInfoMessage_fn2).call(this, `authorizeOptions from transaction state: [${JSON.stringify(authorizeOptions)}]`);
5417
3159
  const redirectState = response.state;
5418
3160
  const authorizeOptionsState = authorizeOptions.state;
5419
3161
  if (authorizeOptionsState.localeCompare(redirectState) === 0) {
5420
- __privateMethod(this, _STSOAuth2Worker_instances, LogInfoMessage_fn2).call(this, chalk$2.green("redirected state (from queryVars) matched previously saved transaction authorizeOptions state"));
3162
+ __privateMethod(this, _STSOAuth2Worker_instances, LogInfoMessage_fn2).call(this, chalk$1.green("redirected state (from queryVars) matched previously saved transaction authorizeOptions state"));
5421
3163
  return await __privateGet(this, _GetToken).call(this, authorizeOptions, response);
5422
3164
  } else {
5423
- __privateMethod(this, _STSOAuth2Worker_instances, LogErrorMessage_fn2).call(this, chalk$2.red("redirected state (from queryVars) did NOT match previously saved transaction authorizeOptions state"));
5424
- __privateMethod(this, _STSOAuth2Worker_instances, LogErrorMessage_fn2).call(this, chalk$2.red(`authorizeOptionsState: [${authorizeOptionsState}]`));
5425
- __privateMethod(this, _STSOAuth2Worker_instances, LogErrorMessage_fn2).call(this, chalk$2.red(`redirectState: [${redirectState}]`));
3165
+ __privateMethod(this, _STSOAuth2Worker_instances, LogErrorMessage_fn2).call(this, chalk$1.red("redirected state (from queryVars) did NOT match previously saved transaction authorizeOptions state"));
3166
+ __privateMethod(this, _STSOAuth2Worker_instances, LogErrorMessage_fn2).call(this, chalk$1.red(`authorizeOptionsState: [${authorizeOptionsState}]`));
3167
+ __privateMethod(this, _STSOAuth2Worker_instances, LogErrorMessage_fn2).call(this, chalk$1.red(`redirectState: [${redirectState}]`));
5426
3168
  __privateGet(this, _HandleErrorEvent2).call(this, { message: "State un-matched" });
5427
3169
  return false;
5428
3170
  }
5429
3171
  } else if (queryVars[OAuth2ParameterType.ERROR]) {
5430
- __privateMethod(this, _STSOAuth2Worker_instances, LogErrorMessage_fn2).call(this, chalk$2.red(`State un-matched (1)`));
3172
+ __privateMethod(this, _STSOAuth2Worker_instances, LogErrorMessage_fn2).call(this, chalk$1.red(`State un-matched (1)`));
5431
3173
  __privateGet(this, _HandleErrorEvent2).call(this, { message: "State un-matched" });
5432
3174
  return false;
5433
3175
  } else {
5434
- __privateMethod(this, _STSOAuth2Worker_instances, LogErrorMessage_fn2).call(this, chalk$2.red(`State un-matched (2)`));
3176
+ __privateMethod(this, _STSOAuth2Worker_instances, LogErrorMessage_fn2).call(this, chalk$1.red(`State un-matched (2)`));
5435
3177
  __privateGet(this, _HandleErrorEvent2).call(this, { message: "State un-matched" });
5436
3178
  return false;
5437
3179
  }
@@ -5457,20 +3199,20 @@ class STSOAuth2Worker {
5457
3199
  */
5458
3200
  // Get access_token, refresh_token and id_token using OAuth2 Authorization Code Flow
5459
3201
  __privateAdd(this, _GetTokenFromBroker, async (authorizationCodeFlowParameters) => {
5460
- __privateMethod(this, _STSOAuth2Worker_instances, LogDebugMessage_fn2).call(this, chalk$2.magenta(`#GetTokenFromBroker`));
3202
+ __privateMethod(this, _STSOAuth2Worker_instances, LogDebugMessage_fn2).call(this, chalk$1.magenta(`#GetTokenFromBroker`));
5461
3203
  __privateGet(this, _clientSessionStore).remove(__privateGet(this, _STORAGE_SESSION_KEY));
5462
- const url = `${__privateGet(this, _options3).brokerendpoint}:${__privateGet(this, _options3).brokerport}${__privateGet(this, _options3).brokerapiroot}/token`;
3204
+ const url = `${__privateGet(this, _options2).brokerendpoint}:${__privateGet(this, _options2).brokerport}${__privateGet(this, _options2).brokerapiroot}/token`;
5463
3205
  try {
5464
- const rConfig = new STSAxiosConfig(url, "post").withDefaultHeaders().withData(authorizationCodeFlowParameters).withCredentials().withTimeout(__privateGet(this, _options3).timeout);
5465
- __privateMethod(this, _STSOAuth2Worker_instances, LogDebugMessage_fn2).call(this, chalk$2.magenta(`#GetTokenFromBroker: request config: [${JSON.stringify(rConfig)}]`));
5466
- if (isNode && __privateGet(this, _agentManager2)) {
5467
- rConfig.withAgentManager(__privateGet(this, _agentManager2));
3206
+ const rConfig = new STSAxiosConfig(url, "post").withDefaultHeaders().withData(authorizationCodeFlowParameters).withCredentials().withTimeout(__privateGet(this, _options2).timeout);
3207
+ __privateMethod(this, _STSOAuth2Worker_instances, LogDebugMessage_fn2).call(this, chalk$1.magenta(`#GetTokenFromBroker: request config: [${JSON.stringify(rConfig)}]`));
3208
+ if (isNode && __privateGet(this, _agentManager)) {
3209
+ rConfig.withAgentManager(__privateGet(this, _agentManager));
5468
3210
  }
5469
- __privateMethod(this, _STSOAuth2Worker_instances, LogDebugMessage_fn2).call(this, chalk$2.magenta(`#GetTokenFromBroker: axios API call`));
3211
+ __privateMethod(this, _STSOAuth2Worker_instances, LogDebugMessage_fn2).call(this, chalk$1.magenta(`#GetTokenFromBroker: axios API call`));
5470
3212
  const retVal = await axios(rConfig.config);
5471
- __privateMethod(this, _STSOAuth2Worker_instances, LogDebugMessage_fn2).call(this, chalk$2.magenta(`#GetTokenFromBroker: axios API call result: [${retVal.status}]`));
3213
+ __privateMethod(this, _STSOAuth2Worker_instances, LogDebugMessage_fn2).call(this, chalk$1.magenta(`#GetTokenFromBroker: axios API call result: [${retVal.status}]`));
5472
3214
  if (retVal.status === StatusCodes.OK) {
5473
- __privateMethod(this, _STSOAuth2Worker_instances, LogDebugMessage_fn2).call(this, chalk$2.magenta(`#GetTokenFromBroker: storing tokens`));
3215
+ __privateMethod(this, _STSOAuth2Worker_instances, LogDebugMessage_fn2).call(this, chalk$1.magenta(`#GetTokenFromBroker: storing tokens`));
5474
3216
  const tokenResponse = retVal.data;
5475
3217
  __privateGet(this, _HandleAuthenticateEvent2).call(this, tokenResponse.id_token);
5476
3218
  const newSessionData = {
@@ -5482,18 +3224,18 @@ class STSOAuth2Worker {
5482
3224
  __privateGet(this, _clientSessionStore).set(__privateGet(this, _STORAGE_SESSION_KEY), newSessionData);
5483
3225
  return true;
5484
3226
  } else if (retVal.status === StatusCodes.UNAUTHORIZED) {
5485
- __privateMethod(this, _STSOAuth2Worker_instances, LogDebugMessage_fn2).call(this, chalk$2.magenta(`#GetTokenFromBroker: NOT storing tokens, status: [${retVal.status}]`));
3227
+ __privateMethod(this, _STSOAuth2Worker_instances, LogDebugMessage_fn2).call(this, chalk$1.magenta(`#GetTokenFromBroker: NOT storing tokens, status: [${retVal.status}]`));
5486
3228
  __privateGet(this, _HandleAuthenticateEvent2).call(this, null);
5487
3229
  return false;
5488
3230
  } else {
5489
- __privateMethod(this, _STSOAuth2Worker_instances, LogDebugMessage_fn2).call(this, chalk$2.magenta(`#GetTokenFromBroker: NOT storing tokens (general error 1), status: [${retVal.status}]`));
3231
+ __privateMethod(this, _STSOAuth2Worker_instances, LogDebugMessage_fn2).call(this, chalk$1.magenta(`#GetTokenFromBroker: NOT storing tokens (general error 1), status: [${retVal.status}]`));
5490
3232
  __privateGet(this, _HandleAuthenticateEvent2).call(this, null);
5491
- __privateMethod(this, _STSOAuth2Worker_instances, LogErrorMessage_fn2).call(this, chalk$2.red("Could not obtain access_token from token end-point:-"));
5492
- __privateMethod(this, _STSOAuth2Worker_instances, LogErrorMessage_fn2).call(this, chalk$2.red(JSON.stringify(retVal.data)));
3233
+ __privateMethod(this, _STSOAuth2Worker_instances, LogErrorMessage_fn2).call(this, chalk$1.red("Could not obtain access_token from token end-point:-"));
3234
+ __privateMethod(this, _STSOAuth2Worker_instances, LogErrorMessage_fn2).call(this, chalk$1.red(JSON.stringify(retVal.data)));
5493
3235
  return false;
5494
3236
  }
5495
3237
  } catch (error) {
5496
- __privateMethod(this, _STSOAuth2Worker_instances, LogErrorMessage_fn2).call(this, chalk$2.red(`#GetTokenFromBroker: NOT storing tokens (general error 2), status: [${error}]`));
3238
+ __privateMethod(this, _STSOAuth2Worker_instances, LogErrorMessage_fn2).call(this, chalk$1.red(`#GetTokenFromBroker: NOT storing tokens (general error 2), status: [${error}]`));
5497
3239
  __privateGet(this, _HandleAuthenticateEvent2).call(this, null);
5498
3240
  return false;
5499
3241
  }
@@ -5504,10 +3246,10 @@ class STSOAuth2Worker {
5504
3246
  __privateMethod(this, _STSOAuth2Worker_instances, LogInfoMessage_fn2).call(this, authorizeResponse);
5505
3247
  __privateGet(this, _clientSessionStore).remove(__privateGet(this, _STORAGE_SESSION_KEY));
5506
3248
  const authorizationCodeFlowParameters = {
5507
- client_id: __privateGet(this, _options3).client_id,
5508
- scope: __privateGet(this, _options3).scope,
3249
+ client_id: __privateGet(this, _options2).client_id,
3250
+ scope: __privateGet(this, _options2).scope,
5509
3251
  code: authorizeResponse.code,
5510
- redirect_uri: __privateGet(this, _options3).redirect_uri,
3252
+ redirect_uri: __privateGet(this, _options2).redirect_uri,
5511
3253
  grant_type: OAuthGrantTypes.AUTHORIZATION_CODE,
5512
3254
  code_verifier: authorizeOptions.code_verifier
5513
3255
  };
@@ -5539,20 +3281,20 @@ class STSOAuth2Worker {
5539
3281
  }
5540
3282
  */
5541
3283
  __privateAdd(this, _RefreshToken, async () => {
5542
- __privateMethod(this, _STSOAuth2Worker_instances, LogDebugMessage_fn2).call(this, chalk$2.cyan(`STSOAuth2Worker:#RefreshToken:start`));
3284
+ __privateMethod(this, _STSOAuth2Worker_instances, LogDebugMessage_fn2).call(this, chalk$1.cyan(`STSOAuth2Worker:#RefreshToken:start`));
5543
3285
  const sessionData = __privateGet(this, _clientSessionStore).get(__privateGet(this, _STORAGE_SESSION_KEY));
5544
3286
  if (sessionData) {
5545
- __privateMethod(this, _STSOAuth2Worker_instances, LogDebugMessage_fn2).call(this, chalk$2.cyan(`STSOAuth2Worker:#RefreshToken:sessionData: [${JSON.stringify(sessionData)}]`));
3287
+ __privateMethod(this, _STSOAuth2Worker_instances, LogDebugMessage_fn2).call(this, chalk$1.cyan(`STSOAuth2Worker:#RefreshToken:sessionData: [${JSON.stringify(sessionData)}]`));
5546
3288
  const currentSessionData = sessionData.tokenResponse;
5547
3289
  const refreshFlowParameters = {
5548
- client_id: __privateGet(this, _options3).client_id,
5549
- scope: __privateGet(this, _options3).scope,
3290
+ client_id: __privateGet(this, _options2).client_id,
3291
+ scope: __privateGet(this, _options2).scope,
5550
3292
  refresh_token: currentSessionData.refresh_token,
5551
3293
  grant_type: OAuthGrantTypes.REFRESH_TOKEN
5552
3294
  };
5553
3295
  return await __privateGet(this, _GetTokenFromBroker).call(this, refreshFlowParameters);
5554
3296
  } else {
5555
- __privateMethod(this, _STSOAuth2Worker_instances, LogErrorMessage_fn2).call(this, chalk$2.red(`STSOAuth2Worker:#RefreshToken:sessionData not found within clientSessionStore`));
3297
+ __privateMethod(this, _STSOAuth2Worker_instances, LogErrorMessage_fn2).call(this, chalk$1.red(`STSOAuth2Worker:#RefreshToken:sessionData not found within clientSessionStore`));
5556
3298
  return false;
5557
3299
  }
5558
3300
  });
@@ -5563,7 +3305,7 @@ class STSOAuth2Worker {
5563
3305
  // clear all state from $store
5564
3306
  __privateAdd(this, _Logout, async () => {
5565
3307
  __privateMethod(this, _STSOAuth2Worker_instances, LogInfoMessage_fn2).call(this, "Logout");
5566
- const url = `${__privateGet(this, _options3).brokerendpoint}:${__privateGet(this, _options3).brokerport}${__privateGet(this, _options3).brokerapiroot}/logout`;
3308
+ const url = `${__privateGet(this, _options2).brokerendpoint}:${__privateGet(this, _options2).brokerport}${__privateGet(this, _options2).brokerapiroot}/logout`;
5567
3309
  __privateMethod(this, _STSOAuth2Worker_instances, LogInfoMessage_fn2).call(this, url);
5568
3310
  const sessionData = __privateGet(this, _clientSessionStore).get(__privateGet(this, _STORAGE_SESSION_KEY));
5569
3311
  if (sessionData) {
@@ -5579,23 +3321,23 @@ class STSOAuth2Worker {
5579
3321
  try {
5580
3322
  const rConfig = new STSAxiosConfig(url, "post").withData({
5581
3323
  sessionId
5582
- }).withDefaultHeaders().withCredentials().withTimeout(__privateGet(this, _options3).timeout);
5583
- if (isNode && __privateGet(this, _agentManager2)) {
5584
- rConfig.withAgentManager(__privateGet(this, _agentManager2));
3324
+ }).withDefaultHeaders().withCredentials().withTimeout(__privateGet(this, _options2).timeout);
3325
+ if (isNode && __privateGet(this, _agentManager)) {
3326
+ rConfig.withAgentManager(__privateGet(this, _agentManager));
5585
3327
  }
5586
- __privateMethod(this, _STSOAuth2Worker_instances, LogDebugMessage_fn2).call(this, chalk$2.magenta(`#Logout: request config: [${rConfig}]`));
3328
+ __privateMethod(this, _STSOAuth2Worker_instances, LogDebugMessage_fn2).call(this, chalk$1.magenta(`#Logout: request config: [${rConfig}]`));
5587
3329
  const retVal = await axios(rConfig.config);
5588
3330
  if (retVal.data.status === StatusCodes.OK) {
5589
3331
  return true;
5590
3332
  } else {
5591
- __privateMethod(this, _STSOAuth2Worker_instances, LogErrorMessage_fn2).call(this, chalk$2.red("Error during logout (1: server side)"));
5592
- __privateMethod(this, _STSOAuth2Worker_instances, LogErrorMessage_fn2).call(this, chalk$2.red(JSON.stringify(retVal.data)));
3333
+ __privateMethod(this, _STSOAuth2Worker_instances, LogErrorMessage_fn2).call(this, chalk$1.red("Error during logout (1: server side)"));
3334
+ __privateMethod(this, _STSOAuth2Worker_instances, LogErrorMessage_fn2).call(this, chalk$1.red(JSON.stringify(retVal.data)));
5593
3335
  return false;
5594
3336
  }
5595
3337
  } catch (error) {
5596
- __privateMethod(this, _STSOAuth2Worker_instances, LogErrorMessage_fn2).call(this, chalk$2.red("Error during logout (2: server side)"));
5597
- __privateMethod(this, _STSOAuth2Worker_instances, LogErrorMessage_fn2).call(this, chalk$2.red(error));
5598
- __privateMethod(this, _STSOAuth2Worker_instances, LogErrorMessage_fn2).call(this, chalk$2.red(JSON.stringify(error)));
3338
+ __privateMethod(this, _STSOAuth2Worker_instances, LogErrorMessage_fn2).call(this, chalk$1.red("Error during logout (2: server side)"));
3339
+ __privateMethod(this, _STSOAuth2Worker_instances, LogErrorMessage_fn2).call(this, chalk$1.red(error));
3340
+ __privateMethod(this, _STSOAuth2Worker_instances, LogErrorMessage_fn2).call(this, chalk$1.red(JSON.stringify(error)));
5599
3341
  return false;
5600
3342
  }
5601
3343
  } else {
@@ -5603,15 +3345,21 @@ class STSOAuth2Worker {
5603
3345
  return false;
5604
3346
  }
5605
3347
  });
5606
- __privateSet(this, _options3, options);
3348
+ __privateSet(this, _options2, options);
5607
3349
  __privateSet(this, _logger, logger);
5608
- __privateMethod(this, _STSOAuth2Worker_instances, LogDebugMessage_fn2).call(this, `STSOAuth2Worker:constructor:#options: [${JSON.stringify(__privateGet(this, _options3))}]`);
3350
+ __privateMethod(this, _STSOAuth2Worker_instances, LogDebugMessage_fn2).call(this, `STSOAuth2Worker:constructor:#options: [${JSON.stringify(__privateGet(this, _options2))}]`);
5609
3351
  __privateSet(this, _clientSessionStore, new ClientStorageFactory({ clientStorageType: ClientStorageType.MEMORY_STORAGE, usePrefix: false }).GetStorage());
5610
3352
  __privateSet(this, _oauthWorkerPort, workerPort);
5611
3353
  __privateMethod(this, _STSOAuth2Worker_instances, LogDebugMessage_fn2).call(this, `STSOAuth2Worker:constructor:#oauthWorkerPort: [${JSON.stringify(__privateGet(this, _oauthWorkerPort))}]`);
5612
- if (isNode && __privateGet(this, _options3).agentOptions) {
5613
- __privateSet(this, _agentManager2, new AgentManager({
5614
- agentOptions: __privateGet(this, _options3).agentOptions
3354
+ if (isNode && __privateGet(this, _options2).agentOptions) {
3355
+ __privateSet(this, _agentManager, new AgentManager({
3356
+ agentOptions: __privateGet(this, _options2).agentOptions,
3357
+ httpAgentFactory(options2) {
3358
+ return new http.Agent(options2);
3359
+ },
3360
+ httpsAgentFactory(options2) {
3361
+ return new https.Agent(options2);
3362
+ }
5615
3363
  }));
5616
3364
  }
5617
3365
  this.SetupListener();
@@ -5625,9 +3373,9 @@ _cUtils = new WeakMap();
5625
3373
  _qParams = new WeakMap();
5626
3374
  _STORAGE_SESSION_KEY = new WeakMap();
5627
3375
  _oauthWorkerPort = new WeakMap();
5628
- _options3 = new WeakMap();
3376
+ _options2 = new WeakMap();
5629
3377
  _logger = new WeakMap();
5630
- _agentManager2 = new WeakMap();
3378
+ _agentManager = new WeakMap();
5631
3379
  _STSOAuth2Worker_instances = new WeakSet();
5632
3380
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
5633
3381
  LogDebugMessage_fn2 = function(message) {