@nsshunt/stsfhirclient 1.0.6 → 1.0.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/stsfhirclient.mjs +43 -2041
- package/dist/stsfhirclient.mjs.map +1 -1
- package/dist/stsfhirclient.umd.js +41 -2039
- package/dist/stsfhirclient.umd.js.map +1 -1
- package/package.json +3 -6
- package/types/FhirClient.d.ts +9 -0
- package/types/FhirClient.d.ts.map +1 -1
package/dist/stsfhirclient.mjs
CHANGED
|
@@ -8,7 +8,7 @@ var __accessCheck = (obj, member, msg) => member.has(obj) || __typeError("Cannot
|
|
|
8
8
|
var __privateGet = (obj, member, getter) => (__accessCheck(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj));
|
|
9
9
|
var __privateAdd = (obj, member, value) => member.has(obj) ? __typeError("Cannot add the same private member more than once") : member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
|
|
10
10
|
var __privateSet = (obj, member, value, setter) => (__accessCheck(obj, member, "write to private field"), setter ? setter.call(obj, value) : member.set(obj, value), value);
|
|
11
|
-
var _options, _DUMMY_USER, _httpsAgent, _invokeMethods, _maxRetries, _sleepDuration, _NoRetryStatusCodes, _LogDebugMessage, _LogErrorMessage, _GetHttpsAgent, _HandleError, _InvokeResourceAPI, _TestMode, ___InvokeResourceAPI;
|
|
11
|
+
var _options, _DUMMY_USER, _httpsAgent, _invokeMethods, _maxRetries, _sleepDuration, _NoRetryStatusCodes, _stsfhirapiroot, _LogDebugMessage, _LogErrorMessage, _GetHttpsAgent, _HandleError, _InvokeResourceAPI, _TestMode, ___InvokeResourceAPI;
|
|
12
12
|
import https from "node:https";
|
|
13
13
|
import axios from "axios";
|
|
14
14
|
import { Sleep } from "@nsshunt/stsutils";
|
|
@@ -56,2014 +56,6 @@ const isNode = Object.prototype.toString.call(typeof process !== "undefined" ? p
|
|
|
56
56
|
function getDefaultExportFromCjs(x) {
|
|
57
57
|
return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, "default") ? x["default"] : x;
|
|
58
58
|
}
|
|
59
|
-
function getAugmentedNamespace(n) {
|
|
60
|
-
if (n.__esModule) return n;
|
|
61
|
-
var f = n.default;
|
|
62
|
-
if (typeof f == "function") {
|
|
63
|
-
var a = function a2() {
|
|
64
|
-
if (this instanceof a2) {
|
|
65
|
-
return Reflect.construct(f, arguments, this.constructor);
|
|
66
|
-
}
|
|
67
|
-
return f.apply(this, arguments);
|
|
68
|
-
};
|
|
69
|
-
a.prototype = f.prototype;
|
|
70
|
-
} else a = {};
|
|
71
|
-
Object.defineProperty(a, "__esModule", { value: true });
|
|
72
|
-
Object.keys(n).forEach(function(k) {
|
|
73
|
-
var d = Object.getOwnPropertyDescriptor(n, k);
|
|
74
|
-
Object.defineProperty(a, k, d.get ? d : {
|
|
75
|
-
enumerable: true,
|
|
76
|
-
get: function() {
|
|
77
|
-
return n[k];
|
|
78
|
-
}
|
|
79
|
-
});
|
|
80
|
-
});
|
|
81
|
-
return a;
|
|
82
|
-
}
|
|
83
|
-
var main$1 = { exports: {} };
|
|
84
|
-
const __viteBrowserExternal$1 = {};
|
|
85
|
-
const __viteBrowserExternal$2 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
86
|
-
__proto__: null,
|
|
87
|
-
default: __viteBrowserExternal$1
|
|
88
|
-
}, Symbol.toStringTag, { value: "Module" }));
|
|
89
|
-
const require$$3 = /* @__PURE__ */ getAugmentedNamespace(__viteBrowserExternal$2);
|
|
90
|
-
const name = "dotenv";
|
|
91
|
-
const version$1 = "16.4.5";
|
|
92
|
-
const description = "Loads environment variables from .env file";
|
|
93
|
-
const main = "lib/main.js";
|
|
94
|
-
const types = "lib/main.d.ts";
|
|
95
|
-
const exports = {
|
|
96
|
-
".": {
|
|
97
|
-
types: "./lib/main.d.ts",
|
|
98
|
-
require: "./lib/main.js",
|
|
99
|
-
"default": "./lib/main.js"
|
|
100
|
-
},
|
|
101
|
-
"./config": "./config.js",
|
|
102
|
-
"./config.js": "./config.js",
|
|
103
|
-
"./lib/env-options": "./lib/env-options.js",
|
|
104
|
-
"./lib/env-options.js": "./lib/env-options.js",
|
|
105
|
-
"./lib/cli-options": "./lib/cli-options.js",
|
|
106
|
-
"./lib/cli-options.js": "./lib/cli-options.js",
|
|
107
|
-
"./package.json": "./package.json"
|
|
108
|
-
};
|
|
109
|
-
const scripts = {
|
|
110
|
-
"dts-check": "tsc --project tests/types/tsconfig.json",
|
|
111
|
-
lint: "standard",
|
|
112
|
-
"lint-readme": "standard-markdown",
|
|
113
|
-
pretest: "npm run lint && npm run dts-check",
|
|
114
|
-
test: "tap tests/*.js --100 -Rspec",
|
|
115
|
-
"test:coverage": "tap --coverage-report=lcov",
|
|
116
|
-
prerelease: "npm test",
|
|
117
|
-
release: "standard-version"
|
|
118
|
-
};
|
|
119
|
-
const repository = {
|
|
120
|
-
type: "git",
|
|
121
|
-
url: "git://github.com/motdotla/dotenv.git"
|
|
122
|
-
};
|
|
123
|
-
const funding = "https://dotenvx.com";
|
|
124
|
-
const keywords = [
|
|
125
|
-
"dotenv",
|
|
126
|
-
"env",
|
|
127
|
-
".env",
|
|
128
|
-
"environment",
|
|
129
|
-
"variables",
|
|
130
|
-
"config",
|
|
131
|
-
"settings"
|
|
132
|
-
];
|
|
133
|
-
const readmeFilename = "README.md";
|
|
134
|
-
const license = "BSD-2-Clause";
|
|
135
|
-
const devDependencies = {
|
|
136
|
-
"@definitelytyped/dtslint": "^0.0.133",
|
|
137
|
-
"@types/node": "^18.11.3",
|
|
138
|
-
decache: "^4.6.1",
|
|
139
|
-
sinon: "^14.0.1",
|
|
140
|
-
standard: "^17.0.0",
|
|
141
|
-
"standard-markdown": "^7.1.0",
|
|
142
|
-
"standard-version": "^9.5.0",
|
|
143
|
-
tap: "^16.3.0",
|
|
144
|
-
tar: "^6.1.11",
|
|
145
|
-
typescript: "^4.8.4"
|
|
146
|
-
};
|
|
147
|
-
const engines = {
|
|
148
|
-
node: ">=12"
|
|
149
|
-
};
|
|
150
|
-
const browser$2 = {
|
|
151
|
-
fs: false
|
|
152
|
-
};
|
|
153
|
-
const require$$4 = {
|
|
154
|
-
name,
|
|
155
|
-
version: version$1,
|
|
156
|
-
description,
|
|
157
|
-
main,
|
|
158
|
-
types,
|
|
159
|
-
exports,
|
|
160
|
-
scripts,
|
|
161
|
-
repository,
|
|
162
|
-
funding,
|
|
163
|
-
keywords,
|
|
164
|
-
readmeFilename,
|
|
165
|
-
license,
|
|
166
|
-
devDependencies,
|
|
167
|
-
engines,
|
|
168
|
-
browser: browser$2
|
|
169
|
-
};
|
|
170
|
-
const fs$1 = require$$3;
|
|
171
|
-
const path = require$$3;
|
|
172
|
-
const os = require$$3;
|
|
173
|
-
const crypto$1 = require$$3;
|
|
174
|
-
const packageJson = require$$4;
|
|
175
|
-
const version = packageJson.version;
|
|
176
|
-
const LINE = /(?:^|^)\s*(?:export\s+)?([\w.-]+)(?:\s*=\s*?|:\s+?)(\s*'(?:\\'|[^'])*'|\s*"(?:\\"|[^"])*"|\s*`(?:\\`|[^`])*`|[^#\r\n]+)?\s*(?:#.*)?(?:$|$)/mg;
|
|
177
|
-
function parse(src) {
|
|
178
|
-
const obj = {};
|
|
179
|
-
let lines = src.toString();
|
|
180
|
-
lines = lines.replace(/\r\n?/mg, "\n");
|
|
181
|
-
let match;
|
|
182
|
-
while ((match = LINE.exec(lines)) != null) {
|
|
183
|
-
const key = match[1];
|
|
184
|
-
let value = match[2] || "";
|
|
185
|
-
value = value.trim();
|
|
186
|
-
const maybeQuote = value[0];
|
|
187
|
-
value = value.replace(/^(['"`])([\s\S]*)\1$/mg, "$2");
|
|
188
|
-
if (maybeQuote === '"') {
|
|
189
|
-
value = value.replace(/\\n/g, "\n");
|
|
190
|
-
value = value.replace(/\\r/g, "\r");
|
|
191
|
-
}
|
|
192
|
-
obj[key] = value;
|
|
193
|
-
}
|
|
194
|
-
return obj;
|
|
195
|
-
}
|
|
196
|
-
function _parseVault(options) {
|
|
197
|
-
const vaultPath = _vaultPath(options);
|
|
198
|
-
const result = DotenvModule.configDotenv({ path: vaultPath });
|
|
199
|
-
if (!result.parsed) {
|
|
200
|
-
const err = new Error(`MISSING_DATA: Cannot parse ${vaultPath} for an unknown reason`);
|
|
201
|
-
err.code = "MISSING_DATA";
|
|
202
|
-
throw err;
|
|
203
|
-
}
|
|
204
|
-
const keys = _dotenvKey(options).split(",");
|
|
205
|
-
const length = keys.length;
|
|
206
|
-
let decrypted;
|
|
207
|
-
for (let i = 0; i < length; i++) {
|
|
208
|
-
try {
|
|
209
|
-
const key = keys[i].trim();
|
|
210
|
-
const attrs = _instructions(result, key);
|
|
211
|
-
decrypted = DotenvModule.decrypt(attrs.ciphertext, attrs.key);
|
|
212
|
-
break;
|
|
213
|
-
} catch (error) {
|
|
214
|
-
if (i + 1 >= length) {
|
|
215
|
-
throw error;
|
|
216
|
-
}
|
|
217
|
-
}
|
|
218
|
-
}
|
|
219
|
-
return DotenvModule.parse(decrypted);
|
|
220
|
-
}
|
|
221
|
-
function _log(message) {
|
|
222
|
-
console.log(`[dotenv@${version}][INFO] ${message}`);
|
|
223
|
-
}
|
|
224
|
-
function _warn(message) {
|
|
225
|
-
console.log(`[dotenv@${version}][WARN] ${message}`);
|
|
226
|
-
}
|
|
227
|
-
function _debug(message) {
|
|
228
|
-
console.log(`[dotenv@${version}][DEBUG] ${message}`);
|
|
229
|
-
}
|
|
230
|
-
function _dotenvKey(options) {
|
|
231
|
-
if (options && options.DOTENV_KEY && options.DOTENV_KEY.length > 0) {
|
|
232
|
-
return options.DOTENV_KEY;
|
|
233
|
-
}
|
|
234
|
-
if (process.env.DOTENV_KEY && process.env.DOTENV_KEY.length > 0) {
|
|
235
|
-
return process.env.DOTENV_KEY;
|
|
236
|
-
}
|
|
237
|
-
return "";
|
|
238
|
-
}
|
|
239
|
-
function _instructions(result, dotenvKey) {
|
|
240
|
-
let uri;
|
|
241
|
-
try {
|
|
242
|
-
uri = new URL(dotenvKey);
|
|
243
|
-
} catch (error) {
|
|
244
|
-
if (error.code === "ERR_INVALID_URL") {
|
|
245
|
-
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");
|
|
246
|
-
err.code = "INVALID_DOTENV_KEY";
|
|
247
|
-
throw err;
|
|
248
|
-
}
|
|
249
|
-
throw error;
|
|
250
|
-
}
|
|
251
|
-
const key = uri.password;
|
|
252
|
-
if (!key) {
|
|
253
|
-
const err = new Error("INVALID_DOTENV_KEY: Missing key part");
|
|
254
|
-
err.code = "INVALID_DOTENV_KEY";
|
|
255
|
-
throw err;
|
|
256
|
-
}
|
|
257
|
-
const environment = uri.searchParams.get("environment");
|
|
258
|
-
if (!environment) {
|
|
259
|
-
const err = new Error("INVALID_DOTENV_KEY: Missing environment part");
|
|
260
|
-
err.code = "INVALID_DOTENV_KEY";
|
|
261
|
-
throw err;
|
|
262
|
-
}
|
|
263
|
-
const environmentKey = `DOTENV_VAULT_${environment.toUpperCase()}`;
|
|
264
|
-
const ciphertext = result.parsed[environmentKey];
|
|
265
|
-
if (!ciphertext) {
|
|
266
|
-
const err = new Error(`NOT_FOUND_DOTENV_ENVIRONMENT: Cannot locate environment ${environmentKey} in your .env.vault file.`);
|
|
267
|
-
err.code = "NOT_FOUND_DOTENV_ENVIRONMENT";
|
|
268
|
-
throw err;
|
|
269
|
-
}
|
|
270
|
-
return { ciphertext, key };
|
|
271
|
-
}
|
|
272
|
-
function _vaultPath(options) {
|
|
273
|
-
let possibleVaultPath = null;
|
|
274
|
-
if (options && options.path && options.path.length > 0) {
|
|
275
|
-
if (Array.isArray(options.path)) {
|
|
276
|
-
for (const filepath of options.path) {
|
|
277
|
-
if (fs$1.existsSync(filepath)) {
|
|
278
|
-
possibleVaultPath = filepath.endsWith(".vault") ? filepath : `${filepath}.vault`;
|
|
279
|
-
}
|
|
280
|
-
}
|
|
281
|
-
} else {
|
|
282
|
-
possibleVaultPath = options.path.endsWith(".vault") ? options.path : `${options.path}.vault`;
|
|
283
|
-
}
|
|
284
|
-
} else {
|
|
285
|
-
possibleVaultPath = path.resolve(process.cwd(), ".env.vault");
|
|
286
|
-
}
|
|
287
|
-
if (fs$1.existsSync(possibleVaultPath)) {
|
|
288
|
-
return possibleVaultPath;
|
|
289
|
-
}
|
|
290
|
-
return null;
|
|
291
|
-
}
|
|
292
|
-
function _resolveHome(envPath) {
|
|
293
|
-
return envPath[0] === "~" ? path.join(os.homedir(), envPath.slice(1)) : envPath;
|
|
294
|
-
}
|
|
295
|
-
function _configVault(options) {
|
|
296
|
-
_log("Loading env from encrypted .env.vault");
|
|
297
|
-
const parsed = DotenvModule._parseVault(options);
|
|
298
|
-
let processEnv = process.env;
|
|
299
|
-
if (options && options.processEnv != null) {
|
|
300
|
-
processEnv = options.processEnv;
|
|
301
|
-
}
|
|
302
|
-
DotenvModule.populate(processEnv, parsed, options);
|
|
303
|
-
return { parsed };
|
|
304
|
-
}
|
|
305
|
-
function configDotenv(options) {
|
|
306
|
-
const dotenvPath = path.resolve(process.cwd(), ".env");
|
|
307
|
-
let encoding = "utf8";
|
|
308
|
-
const debug = Boolean(options && options.debug);
|
|
309
|
-
if (options && options.encoding) {
|
|
310
|
-
encoding = options.encoding;
|
|
311
|
-
} else {
|
|
312
|
-
if (debug) {
|
|
313
|
-
_debug("No encoding is specified. UTF-8 is used by default");
|
|
314
|
-
}
|
|
315
|
-
}
|
|
316
|
-
let optionPaths = [dotenvPath];
|
|
317
|
-
if (options && options.path) {
|
|
318
|
-
if (!Array.isArray(options.path)) {
|
|
319
|
-
optionPaths = [_resolveHome(options.path)];
|
|
320
|
-
} else {
|
|
321
|
-
optionPaths = [];
|
|
322
|
-
for (const filepath of options.path) {
|
|
323
|
-
optionPaths.push(_resolveHome(filepath));
|
|
324
|
-
}
|
|
325
|
-
}
|
|
326
|
-
}
|
|
327
|
-
let lastError;
|
|
328
|
-
const parsedAll = {};
|
|
329
|
-
for (const path2 of optionPaths) {
|
|
330
|
-
try {
|
|
331
|
-
const parsed = DotenvModule.parse(fs$1.readFileSync(path2, { encoding }));
|
|
332
|
-
DotenvModule.populate(parsedAll, parsed, options);
|
|
333
|
-
} catch (e) {
|
|
334
|
-
if (debug) {
|
|
335
|
-
_debug(`Failed to load ${path2} ${e.message}`);
|
|
336
|
-
}
|
|
337
|
-
lastError = e;
|
|
338
|
-
}
|
|
339
|
-
}
|
|
340
|
-
let processEnv = process.env;
|
|
341
|
-
if (options && options.processEnv != null) {
|
|
342
|
-
processEnv = options.processEnv;
|
|
343
|
-
}
|
|
344
|
-
DotenvModule.populate(processEnv, parsedAll, options);
|
|
345
|
-
if (lastError) {
|
|
346
|
-
return { parsed: parsedAll, error: lastError };
|
|
347
|
-
} else {
|
|
348
|
-
return { parsed: parsedAll };
|
|
349
|
-
}
|
|
350
|
-
}
|
|
351
|
-
function config(options) {
|
|
352
|
-
if (_dotenvKey(options).length === 0) {
|
|
353
|
-
return DotenvModule.configDotenv(options);
|
|
354
|
-
}
|
|
355
|
-
const vaultPath = _vaultPath(options);
|
|
356
|
-
if (!vaultPath) {
|
|
357
|
-
_warn(`You set DOTENV_KEY but you are missing a .env.vault file at ${vaultPath}. Did you forget to build it?`);
|
|
358
|
-
return DotenvModule.configDotenv(options);
|
|
359
|
-
}
|
|
360
|
-
return DotenvModule._configVault(options);
|
|
361
|
-
}
|
|
362
|
-
function decrypt(encrypted, keyStr) {
|
|
363
|
-
const key = Buffer.from(keyStr.slice(-64), "hex");
|
|
364
|
-
let ciphertext = Buffer.from(encrypted, "base64");
|
|
365
|
-
const nonce = ciphertext.subarray(0, 12);
|
|
366
|
-
const authTag = ciphertext.subarray(-16);
|
|
367
|
-
ciphertext = ciphertext.subarray(12, -16);
|
|
368
|
-
try {
|
|
369
|
-
const aesgcm = crypto$1.createDecipheriv("aes-256-gcm", key, nonce);
|
|
370
|
-
aesgcm.setAuthTag(authTag);
|
|
371
|
-
return `${aesgcm.update(ciphertext)}${aesgcm.final()}`;
|
|
372
|
-
} catch (error) {
|
|
373
|
-
const isRange = error instanceof RangeError;
|
|
374
|
-
const invalidKeyLength = error.message === "Invalid key length";
|
|
375
|
-
const decryptionFailed = error.message === "Unsupported state or unable to authenticate data";
|
|
376
|
-
if (isRange || invalidKeyLength) {
|
|
377
|
-
const err = new Error("INVALID_DOTENV_KEY: It must be 64 characters long (or more)");
|
|
378
|
-
err.code = "INVALID_DOTENV_KEY";
|
|
379
|
-
throw err;
|
|
380
|
-
} else if (decryptionFailed) {
|
|
381
|
-
const err = new Error("DECRYPTION_FAILED: Please check your DOTENV_KEY");
|
|
382
|
-
err.code = "DECRYPTION_FAILED";
|
|
383
|
-
throw err;
|
|
384
|
-
} else {
|
|
385
|
-
throw error;
|
|
386
|
-
}
|
|
387
|
-
}
|
|
388
|
-
}
|
|
389
|
-
function populate(processEnv, parsed, options = {}) {
|
|
390
|
-
const debug = Boolean(options && options.debug);
|
|
391
|
-
const override = Boolean(options && options.override);
|
|
392
|
-
if (typeof parsed !== "object") {
|
|
393
|
-
const err = new Error("OBJECT_REQUIRED: Please check the processEnv argument being passed to populate");
|
|
394
|
-
err.code = "OBJECT_REQUIRED";
|
|
395
|
-
throw err;
|
|
396
|
-
}
|
|
397
|
-
for (const key of Object.keys(parsed)) {
|
|
398
|
-
if (Object.prototype.hasOwnProperty.call(processEnv, key)) {
|
|
399
|
-
if (override === true) {
|
|
400
|
-
processEnv[key] = parsed[key];
|
|
401
|
-
}
|
|
402
|
-
if (debug) {
|
|
403
|
-
if (override === true) {
|
|
404
|
-
_debug(`"${key}" is already defined and WAS overwritten`);
|
|
405
|
-
} else {
|
|
406
|
-
_debug(`"${key}" is already defined and was NOT overwritten`);
|
|
407
|
-
}
|
|
408
|
-
}
|
|
409
|
-
} else {
|
|
410
|
-
processEnv[key] = parsed[key];
|
|
411
|
-
}
|
|
412
|
-
}
|
|
413
|
-
}
|
|
414
|
-
const DotenvModule = {
|
|
415
|
-
configDotenv,
|
|
416
|
-
_configVault,
|
|
417
|
-
_parseVault,
|
|
418
|
-
config,
|
|
419
|
-
decrypt,
|
|
420
|
-
parse,
|
|
421
|
-
populate
|
|
422
|
-
};
|
|
423
|
-
main$1.exports.configDotenv = DotenvModule.configDotenv;
|
|
424
|
-
main$1.exports._configVault = DotenvModule._configVault;
|
|
425
|
-
main$1.exports._parseVault = DotenvModule._parseVault;
|
|
426
|
-
var config_1 = main$1.exports.config = DotenvModule.config;
|
|
427
|
-
main$1.exports.decrypt = DotenvModule.decrypt;
|
|
428
|
-
main$1.exports.parse = DotenvModule.parse;
|
|
429
|
-
main$1.exports.populate = DotenvModule.populate;
|
|
430
|
-
main$1.exports = DotenvModule;
|
|
431
|
-
const __viteBrowserExternal = {};
|
|
432
|
-
const fs = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
433
|
-
__proto__: null,
|
|
434
|
-
default: __viteBrowserExternal
|
|
435
|
-
}, Symbol.toStringTag, { value: "Module" }));
|
|
436
|
-
var ansiStyles$1$1 = { exports: {} };
|
|
437
|
-
var colorName$1;
|
|
438
|
-
var hasRequiredColorName$1;
|
|
439
|
-
function requireColorName$1() {
|
|
440
|
-
if (hasRequiredColorName$1) return colorName$1;
|
|
441
|
-
hasRequiredColorName$1 = 1;
|
|
442
|
-
colorName$1 = {
|
|
443
|
-
"aliceblue": [240, 248, 255],
|
|
444
|
-
"antiquewhite": [250, 235, 215],
|
|
445
|
-
"aqua": [0, 255, 255],
|
|
446
|
-
"aquamarine": [127, 255, 212],
|
|
447
|
-
"azure": [240, 255, 255],
|
|
448
|
-
"beige": [245, 245, 220],
|
|
449
|
-
"bisque": [255, 228, 196],
|
|
450
|
-
"black": [0, 0, 0],
|
|
451
|
-
"blanchedalmond": [255, 235, 205],
|
|
452
|
-
"blue": [0, 0, 255],
|
|
453
|
-
"blueviolet": [138, 43, 226],
|
|
454
|
-
"brown": [165, 42, 42],
|
|
455
|
-
"burlywood": [222, 184, 135],
|
|
456
|
-
"cadetblue": [95, 158, 160],
|
|
457
|
-
"chartreuse": [127, 255, 0],
|
|
458
|
-
"chocolate": [210, 105, 30],
|
|
459
|
-
"coral": [255, 127, 80],
|
|
460
|
-
"cornflowerblue": [100, 149, 237],
|
|
461
|
-
"cornsilk": [255, 248, 220],
|
|
462
|
-
"crimson": [220, 20, 60],
|
|
463
|
-
"cyan": [0, 255, 255],
|
|
464
|
-
"darkblue": [0, 0, 139],
|
|
465
|
-
"darkcyan": [0, 139, 139],
|
|
466
|
-
"darkgoldenrod": [184, 134, 11],
|
|
467
|
-
"darkgray": [169, 169, 169],
|
|
468
|
-
"darkgreen": [0, 100, 0],
|
|
469
|
-
"darkgrey": [169, 169, 169],
|
|
470
|
-
"darkkhaki": [189, 183, 107],
|
|
471
|
-
"darkmagenta": [139, 0, 139],
|
|
472
|
-
"darkolivegreen": [85, 107, 47],
|
|
473
|
-
"darkorange": [255, 140, 0],
|
|
474
|
-
"darkorchid": [153, 50, 204],
|
|
475
|
-
"darkred": [139, 0, 0],
|
|
476
|
-
"darksalmon": [233, 150, 122],
|
|
477
|
-
"darkseagreen": [143, 188, 143],
|
|
478
|
-
"darkslateblue": [72, 61, 139],
|
|
479
|
-
"darkslategray": [47, 79, 79],
|
|
480
|
-
"darkslategrey": [47, 79, 79],
|
|
481
|
-
"darkturquoise": [0, 206, 209],
|
|
482
|
-
"darkviolet": [148, 0, 211],
|
|
483
|
-
"deeppink": [255, 20, 147],
|
|
484
|
-
"deepskyblue": [0, 191, 255],
|
|
485
|
-
"dimgray": [105, 105, 105],
|
|
486
|
-
"dimgrey": [105, 105, 105],
|
|
487
|
-
"dodgerblue": [30, 144, 255],
|
|
488
|
-
"firebrick": [178, 34, 34],
|
|
489
|
-
"floralwhite": [255, 250, 240],
|
|
490
|
-
"forestgreen": [34, 139, 34],
|
|
491
|
-
"fuchsia": [255, 0, 255],
|
|
492
|
-
"gainsboro": [220, 220, 220],
|
|
493
|
-
"ghostwhite": [248, 248, 255],
|
|
494
|
-
"gold": [255, 215, 0],
|
|
495
|
-
"goldenrod": [218, 165, 32],
|
|
496
|
-
"gray": [128, 128, 128],
|
|
497
|
-
"green": [0, 128, 0],
|
|
498
|
-
"greenyellow": [173, 255, 47],
|
|
499
|
-
"grey": [128, 128, 128],
|
|
500
|
-
"honeydew": [240, 255, 240],
|
|
501
|
-
"hotpink": [255, 105, 180],
|
|
502
|
-
"indianred": [205, 92, 92],
|
|
503
|
-
"indigo": [75, 0, 130],
|
|
504
|
-
"ivory": [255, 255, 240],
|
|
505
|
-
"khaki": [240, 230, 140],
|
|
506
|
-
"lavender": [230, 230, 250],
|
|
507
|
-
"lavenderblush": [255, 240, 245],
|
|
508
|
-
"lawngreen": [124, 252, 0],
|
|
509
|
-
"lemonchiffon": [255, 250, 205],
|
|
510
|
-
"lightblue": [173, 216, 230],
|
|
511
|
-
"lightcoral": [240, 128, 128],
|
|
512
|
-
"lightcyan": [224, 255, 255],
|
|
513
|
-
"lightgoldenrodyellow": [250, 250, 210],
|
|
514
|
-
"lightgray": [211, 211, 211],
|
|
515
|
-
"lightgreen": [144, 238, 144],
|
|
516
|
-
"lightgrey": [211, 211, 211],
|
|
517
|
-
"lightpink": [255, 182, 193],
|
|
518
|
-
"lightsalmon": [255, 160, 122],
|
|
519
|
-
"lightseagreen": [32, 178, 170],
|
|
520
|
-
"lightskyblue": [135, 206, 250],
|
|
521
|
-
"lightslategray": [119, 136, 153],
|
|
522
|
-
"lightslategrey": [119, 136, 153],
|
|
523
|
-
"lightsteelblue": [176, 196, 222],
|
|
524
|
-
"lightyellow": [255, 255, 224],
|
|
525
|
-
"lime": [0, 255, 0],
|
|
526
|
-
"limegreen": [50, 205, 50],
|
|
527
|
-
"linen": [250, 240, 230],
|
|
528
|
-
"magenta": [255, 0, 255],
|
|
529
|
-
"maroon": [128, 0, 0],
|
|
530
|
-
"mediumaquamarine": [102, 205, 170],
|
|
531
|
-
"mediumblue": [0, 0, 205],
|
|
532
|
-
"mediumorchid": [186, 85, 211],
|
|
533
|
-
"mediumpurple": [147, 112, 219],
|
|
534
|
-
"mediumseagreen": [60, 179, 113],
|
|
535
|
-
"mediumslateblue": [123, 104, 238],
|
|
536
|
-
"mediumspringgreen": [0, 250, 154],
|
|
537
|
-
"mediumturquoise": [72, 209, 204],
|
|
538
|
-
"mediumvioletred": [199, 21, 133],
|
|
539
|
-
"midnightblue": [25, 25, 112],
|
|
540
|
-
"mintcream": [245, 255, 250],
|
|
541
|
-
"mistyrose": [255, 228, 225],
|
|
542
|
-
"moccasin": [255, 228, 181],
|
|
543
|
-
"navajowhite": [255, 222, 173],
|
|
544
|
-
"navy": [0, 0, 128],
|
|
545
|
-
"oldlace": [253, 245, 230],
|
|
546
|
-
"olive": [128, 128, 0],
|
|
547
|
-
"olivedrab": [107, 142, 35],
|
|
548
|
-
"orange": [255, 165, 0],
|
|
549
|
-
"orangered": [255, 69, 0],
|
|
550
|
-
"orchid": [218, 112, 214],
|
|
551
|
-
"palegoldenrod": [238, 232, 170],
|
|
552
|
-
"palegreen": [152, 251, 152],
|
|
553
|
-
"paleturquoise": [175, 238, 238],
|
|
554
|
-
"palevioletred": [219, 112, 147],
|
|
555
|
-
"papayawhip": [255, 239, 213],
|
|
556
|
-
"peachpuff": [255, 218, 185],
|
|
557
|
-
"peru": [205, 133, 63],
|
|
558
|
-
"pink": [255, 192, 203],
|
|
559
|
-
"plum": [221, 160, 221],
|
|
560
|
-
"powderblue": [176, 224, 230],
|
|
561
|
-
"purple": [128, 0, 128],
|
|
562
|
-
"rebeccapurple": [102, 51, 153],
|
|
563
|
-
"red": [255, 0, 0],
|
|
564
|
-
"rosybrown": [188, 143, 143],
|
|
565
|
-
"royalblue": [65, 105, 225],
|
|
566
|
-
"saddlebrown": [139, 69, 19],
|
|
567
|
-
"salmon": [250, 128, 114],
|
|
568
|
-
"sandybrown": [244, 164, 96],
|
|
569
|
-
"seagreen": [46, 139, 87],
|
|
570
|
-
"seashell": [255, 245, 238],
|
|
571
|
-
"sienna": [160, 82, 45],
|
|
572
|
-
"silver": [192, 192, 192],
|
|
573
|
-
"skyblue": [135, 206, 235],
|
|
574
|
-
"slateblue": [106, 90, 205],
|
|
575
|
-
"slategray": [112, 128, 144],
|
|
576
|
-
"slategrey": [112, 128, 144],
|
|
577
|
-
"snow": [255, 250, 250],
|
|
578
|
-
"springgreen": [0, 255, 127],
|
|
579
|
-
"steelblue": [70, 130, 180],
|
|
580
|
-
"tan": [210, 180, 140],
|
|
581
|
-
"teal": [0, 128, 128],
|
|
582
|
-
"thistle": [216, 191, 216],
|
|
583
|
-
"tomato": [255, 99, 71],
|
|
584
|
-
"turquoise": [64, 224, 208],
|
|
585
|
-
"violet": [238, 130, 238],
|
|
586
|
-
"wheat": [245, 222, 179],
|
|
587
|
-
"white": [255, 255, 255],
|
|
588
|
-
"whitesmoke": [245, 245, 245],
|
|
589
|
-
"yellow": [255, 255, 0],
|
|
590
|
-
"yellowgreen": [154, 205, 50]
|
|
591
|
-
};
|
|
592
|
-
return colorName$1;
|
|
593
|
-
}
|
|
594
|
-
var conversions$1;
|
|
595
|
-
var hasRequiredConversions$1;
|
|
596
|
-
function requireConversions$1() {
|
|
597
|
-
if (hasRequiredConversions$1) return conversions$1;
|
|
598
|
-
hasRequiredConversions$1 = 1;
|
|
599
|
-
const cssKeywords = requireColorName$1();
|
|
600
|
-
const reverseKeywords = {};
|
|
601
|
-
for (const key of Object.keys(cssKeywords)) {
|
|
602
|
-
reverseKeywords[cssKeywords[key]] = key;
|
|
603
|
-
}
|
|
604
|
-
const convert = {
|
|
605
|
-
rgb: { channels: 3, labels: "rgb" },
|
|
606
|
-
hsl: { channels: 3, labels: "hsl" },
|
|
607
|
-
hsv: { channels: 3, labels: "hsv" },
|
|
608
|
-
hwb: { channels: 3, labels: "hwb" },
|
|
609
|
-
cmyk: { channels: 4, labels: "cmyk" },
|
|
610
|
-
xyz: { channels: 3, labels: "xyz" },
|
|
611
|
-
lab: { channels: 3, labels: "lab" },
|
|
612
|
-
lch: { channels: 3, labels: "lch" },
|
|
613
|
-
hex: { channels: 1, labels: ["hex"] },
|
|
614
|
-
keyword: { channels: 1, labels: ["keyword"] },
|
|
615
|
-
ansi16: { channels: 1, labels: ["ansi16"] },
|
|
616
|
-
ansi256: { channels: 1, labels: ["ansi256"] },
|
|
617
|
-
hcg: { channels: 3, labels: ["h", "c", "g"] },
|
|
618
|
-
apple: { channels: 3, labels: ["r16", "g16", "b16"] },
|
|
619
|
-
gray: { channels: 1, labels: ["gray"] }
|
|
620
|
-
};
|
|
621
|
-
conversions$1 = convert;
|
|
622
|
-
for (const model of Object.keys(convert)) {
|
|
623
|
-
if (!("channels" in convert[model])) {
|
|
624
|
-
throw new Error("missing channels property: " + model);
|
|
625
|
-
}
|
|
626
|
-
if (!("labels" in convert[model])) {
|
|
627
|
-
throw new Error("missing channel labels property: " + model);
|
|
628
|
-
}
|
|
629
|
-
if (convert[model].labels.length !== convert[model].channels) {
|
|
630
|
-
throw new Error("channel and label counts mismatch: " + model);
|
|
631
|
-
}
|
|
632
|
-
const { channels, labels } = convert[model];
|
|
633
|
-
delete convert[model].channels;
|
|
634
|
-
delete convert[model].labels;
|
|
635
|
-
Object.defineProperty(convert[model], "channels", { value: channels });
|
|
636
|
-
Object.defineProperty(convert[model], "labels", { value: labels });
|
|
637
|
-
}
|
|
638
|
-
convert.rgb.hsl = function(rgb) {
|
|
639
|
-
const r = rgb[0] / 255;
|
|
640
|
-
const g = rgb[1] / 255;
|
|
641
|
-
const b = rgb[2] / 255;
|
|
642
|
-
const min = Math.min(r, g, b);
|
|
643
|
-
const max = Math.max(r, g, b);
|
|
644
|
-
const delta = max - min;
|
|
645
|
-
let h;
|
|
646
|
-
let s;
|
|
647
|
-
if (max === min) {
|
|
648
|
-
h = 0;
|
|
649
|
-
} else if (r === max) {
|
|
650
|
-
h = (g - b) / delta;
|
|
651
|
-
} else if (g === max) {
|
|
652
|
-
h = 2 + (b - r) / delta;
|
|
653
|
-
} else if (b === max) {
|
|
654
|
-
h = 4 + (r - g) / delta;
|
|
655
|
-
}
|
|
656
|
-
h = Math.min(h * 60, 360);
|
|
657
|
-
if (h < 0) {
|
|
658
|
-
h += 360;
|
|
659
|
-
}
|
|
660
|
-
const l = (min + max) / 2;
|
|
661
|
-
if (max === min) {
|
|
662
|
-
s = 0;
|
|
663
|
-
} else if (l <= 0.5) {
|
|
664
|
-
s = delta / (max + min);
|
|
665
|
-
} else {
|
|
666
|
-
s = delta / (2 - max - min);
|
|
667
|
-
}
|
|
668
|
-
return [h, s * 100, l * 100];
|
|
669
|
-
};
|
|
670
|
-
convert.rgb.hsv = function(rgb) {
|
|
671
|
-
let rdif;
|
|
672
|
-
let gdif;
|
|
673
|
-
let bdif;
|
|
674
|
-
let h;
|
|
675
|
-
let s;
|
|
676
|
-
const r = rgb[0] / 255;
|
|
677
|
-
const g = rgb[1] / 255;
|
|
678
|
-
const b = rgb[2] / 255;
|
|
679
|
-
const v = Math.max(r, g, b);
|
|
680
|
-
const diff = v - Math.min(r, g, b);
|
|
681
|
-
const diffc = function(c) {
|
|
682
|
-
return (v - c) / 6 / diff + 1 / 2;
|
|
683
|
-
};
|
|
684
|
-
if (diff === 0) {
|
|
685
|
-
h = 0;
|
|
686
|
-
s = 0;
|
|
687
|
-
} else {
|
|
688
|
-
s = diff / v;
|
|
689
|
-
rdif = diffc(r);
|
|
690
|
-
gdif = diffc(g);
|
|
691
|
-
bdif = diffc(b);
|
|
692
|
-
if (r === v) {
|
|
693
|
-
h = bdif - gdif;
|
|
694
|
-
} else if (g === v) {
|
|
695
|
-
h = 1 / 3 + rdif - bdif;
|
|
696
|
-
} else if (b === v) {
|
|
697
|
-
h = 2 / 3 + gdif - rdif;
|
|
698
|
-
}
|
|
699
|
-
if (h < 0) {
|
|
700
|
-
h += 1;
|
|
701
|
-
} else if (h > 1) {
|
|
702
|
-
h -= 1;
|
|
703
|
-
}
|
|
704
|
-
}
|
|
705
|
-
return [
|
|
706
|
-
h * 360,
|
|
707
|
-
s * 100,
|
|
708
|
-
v * 100
|
|
709
|
-
];
|
|
710
|
-
};
|
|
711
|
-
convert.rgb.hwb = function(rgb) {
|
|
712
|
-
const r = rgb[0];
|
|
713
|
-
const g = rgb[1];
|
|
714
|
-
let b = rgb[2];
|
|
715
|
-
const h = convert.rgb.hsl(rgb)[0];
|
|
716
|
-
const w = 1 / 255 * Math.min(r, Math.min(g, b));
|
|
717
|
-
b = 1 - 1 / 255 * Math.max(r, Math.max(g, b));
|
|
718
|
-
return [h, w * 100, b * 100];
|
|
719
|
-
};
|
|
720
|
-
convert.rgb.cmyk = function(rgb) {
|
|
721
|
-
const r = rgb[0] / 255;
|
|
722
|
-
const g = rgb[1] / 255;
|
|
723
|
-
const b = rgb[2] / 255;
|
|
724
|
-
const k = Math.min(1 - r, 1 - g, 1 - b);
|
|
725
|
-
const c = (1 - r - k) / (1 - k) || 0;
|
|
726
|
-
const m = (1 - g - k) / (1 - k) || 0;
|
|
727
|
-
const y = (1 - b - k) / (1 - k) || 0;
|
|
728
|
-
return [c * 100, m * 100, y * 100, k * 100];
|
|
729
|
-
};
|
|
730
|
-
function comparativeDistance(x, y) {
|
|
731
|
-
return (x[0] - y[0]) ** 2 + (x[1] - y[1]) ** 2 + (x[2] - y[2]) ** 2;
|
|
732
|
-
}
|
|
733
|
-
convert.rgb.keyword = function(rgb) {
|
|
734
|
-
const reversed = reverseKeywords[rgb];
|
|
735
|
-
if (reversed) {
|
|
736
|
-
return reversed;
|
|
737
|
-
}
|
|
738
|
-
let currentClosestDistance = Infinity;
|
|
739
|
-
let currentClosestKeyword;
|
|
740
|
-
for (const keyword of Object.keys(cssKeywords)) {
|
|
741
|
-
const value = cssKeywords[keyword];
|
|
742
|
-
const distance = comparativeDistance(rgb, value);
|
|
743
|
-
if (distance < currentClosestDistance) {
|
|
744
|
-
currentClosestDistance = distance;
|
|
745
|
-
currentClosestKeyword = keyword;
|
|
746
|
-
}
|
|
747
|
-
}
|
|
748
|
-
return currentClosestKeyword;
|
|
749
|
-
};
|
|
750
|
-
convert.keyword.rgb = function(keyword) {
|
|
751
|
-
return cssKeywords[keyword];
|
|
752
|
-
};
|
|
753
|
-
convert.rgb.xyz = function(rgb) {
|
|
754
|
-
let r = rgb[0] / 255;
|
|
755
|
-
let g = rgb[1] / 255;
|
|
756
|
-
let b = rgb[2] / 255;
|
|
757
|
-
r = r > 0.04045 ? ((r + 0.055) / 1.055) ** 2.4 : r / 12.92;
|
|
758
|
-
g = g > 0.04045 ? ((g + 0.055) / 1.055) ** 2.4 : g / 12.92;
|
|
759
|
-
b = b > 0.04045 ? ((b + 0.055) / 1.055) ** 2.4 : b / 12.92;
|
|
760
|
-
const x = r * 0.4124 + g * 0.3576 + b * 0.1805;
|
|
761
|
-
const y = r * 0.2126 + g * 0.7152 + b * 0.0722;
|
|
762
|
-
const z = r * 0.0193 + g * 0.1192 + b * 0.9505;
|
|
763
|
-
return [x * 100, y * 100, z * 100];
|
|
764
|
-
};
|
|
765
|
-
convert.rgb.lab = function(rgb) {
|
|
766
|
-
const xyz = convert.rgb.xyz(rgb);
|
|
767
|
-
let x = xyz[0];
|
|
768
|
-
let y = xyz[1];
|
|
769
|
-
let z = xyz[2];
|
|
770
|
-
x /= 95.047;
|
|
771
|
-
y /= 100;
|
|
772
|
-
z /= 108.883;
|
|
773
|
-
x = x > 8856e-6 ? x ** (1 / 3) : 7.787 * x + 16 / 116;
|
|
774
|
-
y = y > 8856e-6 ? y ** (1 / 3) : 7.787 * y + 16 / 116;
|
|
775
|
-
z = z > 8856e-6 ? z ** (1 / 3) : 7.787 * z + 16 / 116;
|
|
776
|
-
const l = 116 * y - 16;
|
|
777
|
-
const a = 500 * (x - y);
|
|
778
|
-
const b = 200 * (y - z);
|
|
779
|
-
return [l, a, b];
|
|
780
|
-
};
|
|
781
|
-
convert.hsl.rgb = function(hsl) {
|
|
782
|
-
const h = hsl[0] / 360;
|
|
783
|
-
const s = hsl[1] / 100;
|
|
784
|
-
const l = hsl[2] / 100;
|
|
785
|
-
let t2;
|
|
786
|
-
let t3;
|
|
787
|
-
let val;
|
|
788
|
-
if (s === 0) {
|
|
789
|
-
val = l * 255;
|
|
790
|
-
return [val, val, val];
|
|
791
|
-
}
|
|
792
|
-
if (l < 0.5) {
|
|
793
|
-
t2 = l * (1 + s);
|
|
794
|
-
} else {
|
|
795
|
-
t2 = l + s - l * s;
|
|
796
|
-
}
|
|
797
|
-
const t1 = 2 * l - t2;
|
|
798
|
-
const rgb = [0, 0, 0];
|
|
799
|
-
for (let i = 0; i < 3; i++) {
|
|
800
|
-
t3 = h + 1 / 3 * -(i - 1);
|
|
801
|
-
if (t3 < 0) {
|
|
802
|
-
t3++;
|
|
803
|
-
}
|
|
804
|
-
if (t3 > 1) {
|
|
805
|
-
t3--;
|
|
806
|
-
}
|
|
807
|
-
if (6 * t3 < 1) {
|
|
808
|
-
val = t1 + (t2 - t1) * 6 * t3;
|
|
809
|
-
} else if (2 * t3 < 1) {
|
|
810
|
-
val = t2;
|
|
811
|
-
} else if (3 * t3 < 2) {
|
|
812
|
-
val = t1 + (t2 - t1) * (2 / 3 - t3) * 6;
|
|
813
|
-
} else {
|
|
814
|
-
val = t1;
|
|
815
|
-
}
|
|
816
|
-
rgb[i] = val * 255;
|
|
817
|
-
}
|
|
818
|
-
return rgb;
|
|
819
|
-
};
|
|
820
|
-
convert.hsl.hsv = function(hsl) {
|
|
821
|
-
const h = hsl[0];
|
|
822
|
-
let s = hsl[1] / 100;
|
|
823
|
-
let l = hsl[2] / 100;
|
|
824
|
-
let smin = s;
|
|
825
|
-
const lmin = Math.max(l, 0.01);
|
|
826
|
-
l *= 2;
|
|
827
|
-
s *= l <= 1 ? l : 2 - l;
|
|
828
|
-
smin *= lmin <= 1 ? lmin : 2 - lmin;
|
|
829
|
-
const v = (l + s) / 2;
|
|
830
|
-
const sv = l === 0 ? 2 * smin / (lmin + smin) : 2 * s / (l + s);
|
|
831
|
-
return [h, sv * 100, v * 100];
|
|
832
|
-
};
|
|
833
|
-
convert.hsv.rgb = function(hsv) {
|
|
834
|
-
const h = hsv[0] / 60;
|
|
835
|
-
const s = hsv[1] / 100;
|
|
836
|
-
let v = hsv[2] / 100;
|
|
837
|
-
const hi = Math.floor(h) % 6;
|
|
838
|
-
const f = h - Math.floor(h);
|
|
839
|
-
const p = 255 * v * (1 - s);
|
|
840
|
-
const q = 255 * v * (1 - s * f);
|
|
841
|
-
const t = 255 * v * (1 - s * (1 - f));
|
|
842
|
-
v *= 255;
|
|
843
|
-
switch (hi) {
|
|
844
|
-
case 0:
|
|
845
|
-
return [v, t, p];
|
|
846
|
-
case 1:
|
|
847
|
-
return [q, v, p];
|
|
848
|
-
case 2:
|
|
849
|
-
return [p, v, t];
|
|
850
|
-
case 3:
|
|
851
|
-
return [p, q, v];
|
|
852
|
-
case 4:
|
|
853
|
-
return [t, p, v];
|
|
854
|
-
case 5:
|
|
855
|
-
return [v, p, q];
|
|
856
|
-
}
|
|
857
|
-
};
|
|
858
|
-
convert.hsv.hsl = function(hsv) {
|
|
859
|
-
const h = hsv[0];
|
|
860
|
-
const s = hsv[1] / 100;
|
|
861
|
-
const v = hsv[2] / 100;
|
|
862
|
-
const vmin = Math.max(v, 0.01);
|
|
863
|
-
let sl;
|
|
864
|
-
let l;
|
|
865
|
-
l = (2 - s) * v;
|
|
866
|
-
const lmin = (2 - s) * vmin;
|
|
867
|
-
sl = s * vmin;
|
|
868
|
-
sl /= lmin <= 1 ? lmin : 2 - lmin;
|
|
869
|
-
sl = sl || 0;
|
|
870
|
-
l /= 2;
|
|
871
|
-
return [h, sl * 100, l * 100];
|
|
872
|
-
};
|
|
873
|
-
convert.hwb.rgb = function(hwb) {
|
|
874
|
-
const h = hwb[0] / 360;
|
|
875
|
-
let wh = hwb[1] / 100;
|
|
876
|
-
let bl = hwb[2] / 100;
|
|
877
|
-
const ratio = wh + bl;
|
|
878
|
-
let f;
|
|
879
|
-
if (ratio > 1) {
|
|
880
|
-
wh /= ratio;
|
|
881
|
-
bl /= ratio;
|
|
882
|
-
}
|
|
883
|
-
const i = Math.floor(6 * h);
|
|
884
|
-
const v = 1 - bl;
|
|
885
|
-
f = 6 * h - i;
|
|
886
|
-
if ((i & 1) !== 0) {
|
|
887
|
-
f = 1 - f;
|
|
888
|
-
}
|
|
889
|
-
const n = wh + f * (v - wh);
|
|
890
|
-
let r;
|
|
891
|
-
let g;
|
|
892
|
-
let b;
|
|
893
|
-
switch (i) {
|
|
894
|
-
default:
|
|
895
|
-
case 6:
|
|
896
|
-
case 0:
|
|
897
|
-
r = v;
|
|
898
|
-
g = n;
|
|
899
|
-
b = wh;
|
|
900
|
-
break;
|
|
901
|
-
case 1:
|
|
902
|
-
r = n;
|
|
903
|
-
g = v;
|
|
904
|
-
b = wh;
|
|
905
|
-
break;
|
|
906
|
-
case 2:
|
|
907
|
-
r = wh;
|
|
908
|
-
g = v;
|
|
909
|
-
b = n;
|
|
910
|
-
break;
|
|
911
|
-
case 3:
|
|
912
|
-
r = wh;
|
|
913
|
-
g = n;
|
|
914
|
-
b = v;
|
|
915
|
-
break;
|
|
916
|
-
case 4:
|
|
917
|
-
r = n;
|
|
918
|
-
g = wh;
|
|
919
|
-
b = v;
|
|
920
|
-
break;
|
|
921
|
-
case 5:
|
|
922
|
-
r = v;
|
|
923
|
-
g = wh;
|
|
924
|
-
b = n;
|
|
925
|
-
break;
|
|
926
|
-
}
|
|
927
|
-
return [r * 255, g * 255, b * 255];
|
|
928
|
-
};
|
|
929
|
-
convert.cmyk.rgb = function(cmyk) {
|
|
930
|
-
const c = cmyk[0] / 100;
|
|
931
|
-
const m = cmyk[1] / 100;
|
|
932
|
-
const y = cmyk[2] / 100;
|
|
933
|
-
const k = cmyk[3] / 100;
|
|
934
|
-
const r = 1 - Math.min(1, c * (1 - k) + k);
|
|
935
|
-
const g = 1 - Math.min(1, m * (1 - k) + k);
|
|
936
|
-
const b = 1 - Math.min(1, y * (1 - k) + k);
|
|
937
|
-
return [r * 255, g * 255, b * 255];
|
|
938
|
-
};
|
|
939
|
-
convert.xyz.rgb = function(xyz) {
|
|
940
|
-
const x = xyz[0] / 100;
|
|
941
|
-
const y = xyz[1] / 100;
|
|
942
|
-
const z = xyz[2] / 100;
|
|
943
|
-
let r;
|
|
944
|
-
let g;
|
|
945
|
-
let b;
|
|
946
|
-
r = x * 3.2406 + y * -1.5372 + z * -0.4986;
|
|
947
|
-
g = x * -0.9689 + y * 1.8758 + z * 0.0415;
|
|
948
|
-
b = x * 0.0557 + y * -0.204 + z * 1.057;
|
|
949
|
-
r = r > 31308e-7 ? 1.055 * r ** (1 / 2.4) - 0.055 : r * 12.92;
|
|
950
|
-
g = g > 31308e-7 ? 1.055 * g ** (1 / 2.4) - 0.055 : g * 12.92;
|
|
951
|
-
b = b > 31308e-7 ? 1.055 * b ** (1 / 2.4) - 0.055 : b * 12.92;
|
|
952
|
-
r = Math.min(Math.max(0, r), 1);
|
|
953
|
-
g = Math.min(Math.max(0, g), 1);
|
|
954
|
-
b = Math.min(Math.max(0, b), 1);
|
|
955
|
-
return [r * 255, g * 255, b * 255];
|
|
956
|
-
};
|
|
957
|
-
convert.xyz.lab = function(xyz) {
|
|
958
|
-
let x = xyz[0];
|
|
959
|
-
let y = xyz[1];
|
|
960
|
-
let z = xyz[2];
|
|
961
|
-
x /= 95.047;
|
|
962
|
-
y /= 100;
|
|
963
|
-
z /= 108.883;
|
|
964
|
-
x = x > 8856e-6 ? x ** (1 / 3) : 7.787 * x + 16 / 116;
|
|
965
|
-
y = y > 8856e-6 ? y ** (1 / 3) : 7.787 * y + 16 / 116;
|
|
966
|
-
z = z > 8856e-6 ? z ** (1 / 3) : 7.787 * z + 16 / 116;
|
|
967
|
-
const l = 116 * y - 16;
|
|
968
|
-
const a = 500 * (x - y);
|
|
969
|
-
const b = 200 * (y - z);
|
|
970
|
-
return [l, a, b];
|
|
971
|
-
};
|
|
972
|
-
convert.lab.xyz = function(lab) {
|
|
973
|
-
const l = lab[0];
|
|
974
|
-
const a = lab[1];
|
|
975
|
-
const b = lab[2];
|
|
976
|
-
let x;
|
|
977
|
-
let y;
|
|
978
|
-
let z;
|
|
979
|
-
y = (l + 16) / 116;
|
|
980
|
-
x = a / 500 + y;
|
|
981
|
-
z = y - b / 200;
|
|
982
|
-
const y2 = y ** 3;
|
|
983
|
-
const x2 = x ** 3;
|
|
984
|
-
const z2 = z ** 3;
|
|
985
|
-
y = y2 > 8856e-6 ? y2 : (y - 16 / 116) / 7.787;
|
|
986
|
-
x = x2 > 8856e-6 ? x2 : (x - 16 / 116) / 7.787;
|
|
987
|
-
z = z2 > 8856e-6 ? z2 : (z - 16 / 116) / 7.787;
|
|
988
|
-
x *= 95.047;
|
|
989
|
-
y *= 100;
|
|
990
|
-
z *= 108.883;
|
|
991
|
-
return [x, y, z];
|
|
992
|
-
};
|
|
993
|
-
convert.lab.lch = function(lab) {
|
|
994
|
-
const l = lab[0];
|
|
995
|
-
const a = lab[1];
|
|
996
|
-
const b = lab[2];
|
|
997
|
-
let h;
|
|
998
|
-
const hr = Math.atan2(b, a);
|
|
999
|
-
h = hr * 360 / 2 / Math.PI;
|
|
1000
|
-
if (h < 0) {
|
|
1001
|
-
h += 360;
|
|
1002
|
-
}
|
|
1003
|
-
const c = Math.sqrt(a * a + b * b);
|
|
1004
|
-
return [l, c, h];
|
|
1005
|
-
};
|
|
1006
|
-
convert.lch.lab = function(lch) {
|
|
1007
|
-
const l = lch[0];
|
|
1008
|
-
const c = lch[1];
|
|
1009
|
-
const h = lch[2];
|
|
1010
|
-
const hr = h / 360 * 2 * Math.PI;
|
|
1011
|
-
const a = c * Math.cos(hr);
|
|
1012
|
-
const b = c * Math.sin(hr);
|
|
1013
|
-
return [l, a, b];
|
|
1014
|
-
};
|
|
1015
|
-
convert.rgb.ansi16 = function(args, saturation = null) {
|
|
1016
|
-
const [r, g, b] = args;
|
|
1017
|
-
let value = saturation === null ? convert.rgb.hsv(args)[2] : saturation;
|
|
1018
|
-
value = Math.round(value / 50);
|
|
1019
|
-
if (value === 0) {
|
|
1020
|
-
return 30;
|
|
1021
|
-
}
|
|
1022
|
-
let ansi = 30 + (Math.round(b / 255) << 2 | Math.round(g / 255) << 1 | Math.round(r / 255));
|
|
1023
|
-
if (value === 2) {
|
|
1024
|
-
ansi += 60;
|
|
1025
|
-
}
|
|
1026
|
-
return ansi;
|
|
1027
|
-
};
|
|
1028
|
-
convert.hsv.ansi16 = function(args) {
|
|
1029
|
-
return convert.rgb.ansi16(convert.hsv.rgb(args), args[2]);
|
|
1030
|
-
};
|
|
1031
|
-
convert.rgb.ansi256 = function(args) {
|
|
1032
|
-
const r = args[0];
|
|
1033
|
-
const g = args[1];
|
|
1034
|
-
const b = args[2];
|
|
1035
|
-
if (r === g && g === b) {
|
|
1036
|
-
if (r < 8) {
|
|
1037
|
-
return 16;
|
|
1038
|
-
}
|
|
1039
|
-
if (r > 248) {
|
|
1040
|
-
return 231;
|
|
1041
|
-
}
|
|
1042
|
-
return Math.round((r - 8) / 247 * 24) + 232;
|
|
1043
|
-
}
|
|
1044
|
-
const ansi = 16 + 36 * Math.round(r / 255 * 5) + 6 * Math.round(g / 255 * 5) + Math.round(b / 255 * 5);
|
|
1045
|
-
return ansi;
|
|
1046
|
-
};
|
|
1047
|
-
convert.ansi16.rgb = function(args) {
|
|
1048
|
-
let color = args % 10;
|
|
1049
|
-
if (color === 0 || color === 7) {
|
|
1050
|
-
if (args > 50) {
|
|
1051
|
-
color += 3.5;
|
|
1052
|
-
}
|
|
1053
|
-
color = color / 10.5 * 255;
|
|
1054
|
-
return [color, color, color];
|
|
1055
|
-
}
|
|
1056
|
-
const mult = (~~(args > 50) + 1) * 0.5;
|
|
1057
|
-
const r = (color & 1) * mult * 255;
|
|
1058
|
-
const g = (color >> 1 & 1) * mult * 255;
|
|
1059
|
-
const b = (color >> 2 & 1) * mult * 255;
|
|
1060
|
-
return [r, g, b];
|
|
1061
|
-
};
|
|
1062
|
-
convert.ansi256.rgb = function(args) {
|
|
1063
|
-
if (args >= 232) {
|
|
1064
|
-
const c = (args - 232) * 10 + 8;
|
|
1065
|
-
return [c, c, c];
|
|
1066
|
-
}
|
|
1067
|
-
args -= 16;
|
|
1068
|
-
let rem;
|
|
1069
|
-
const r = Math.floor(args / 36) / 5 * 255;
|
|
1070
|
-
const g = Math.floor((rem = args % 36) / 6) / 5 * 255;
|
|
1071
|
-
const b = rem % 6 / 5 * 255;
|
|
1072
|
-
return [r, g, b];
|
|
1073
|
-
};
|
|
1074
|
-
convert.rgb.hex = function(args) {
|
|
1075
|
-
const integer = ((Math.round(args[0]) & 255) << 16) + ((Math.round(args[1]) & 255) << 8) + (Math.round(args[2]) & 255);
|
|
1076
|
-
const string = integer.toString(16).toUpperCase();
|
|
1077
|
-
return "000000".substring(string.length) + string;
|
|
1078
|
-
};
|
|
1079
|
-
convert.hex.rgb = function(args) {
|
|
1080
|
-
const match = args.toString(16).match(/[a-f0-9]{6}|[a-f0-9]{3}/i);
|
|
1081
|
-
if (!match) {
|
|
1082
|
-
return [0, 0, 0];
|
|
1083
|
-
}
|
|
1084
|
-
let colorString = match[0];
|
|
1085
|
-
if (match[0].length === 3) {
|
|
1086
|
-
colorString = colorString.split("").map((char) => {
|
|
1087
|
-
return char + char;
|
|
1088
|
-
}).join("");
|
|
1089
|
-
}
|
|
1090
|
-
const integer = parseInt(colorString, 16);
|
|
1091
|
-
const r = integer >> 16 & 255;
|
|
1092
|
-
const g = integer >> 8 & 255;
|
|
1093
|
-
const b = integer & 255;
|
|
1094
|
-
return [r, g, b];
|
|
1095
|
-
};
|
|
1096
|
-
convert.rgb.hcg = function(rgb) {
|
|
1097
|
-
const r = rgb[0] / 255;
|
|
1098
|
-
const g = rgb[1] / 255;
|
|
1099
|
-
const b = rgb[2] / 255;
|
|
1100
|
-
const max = Math.max(Math.max(r, g), b);
|
|
1101
|
-
const min = Math.min(Math.min(r, g), b);
|
|
1102
|
-
const chroma = max - min;
|
|
1103
|
-
let grayscale;
|
|
1104
|
-
let hue;
|
|
1105
|
-
if (chroma < 1) {
|
|
1106
|
-
grayscale = min / (1 - chroma);
|
|
1107
|
-
} else {
|
|
1108
|
-
grayscale = 0;
|
|
1109
|
-
}
|
|
1110
|
-
if (chroma <= 0) {
|
|
1111
|
-
hue = 0;
|
|
1112
|
-
} else if (max === r) {
|
|
1113
|
-
hue = (g - b) / chroma % 6;
|
|
1114
|
-
} else if (max === g) {
|
|
1115
|
-
hue = 2 + (b - r) / chroma;
|
|
1116
|
-
} else {
|
|
1117
|
-
hue = 4 + (r - g) / chroma;
|
|
1118
|
-
}
|
|
1119
|
-
hue /= 6;
|
|
1120
|
-
hue %= 1;
|
|
1121
|
-
return [hue * 360, chroma * 100, grayscale * 100];
|
|
1122
|
-
};
|
|
1123
|
-
convert.hsl.hcg = function(hsl) {
|
|
1124
|
-
const s = hsl[1] / 100;
|
|
1125
|
-
const l = hsl[2] / 100;
|
|
1126
|
-
const c = l < 0.5 ? 2 * s * l : 2 * s * (1 - l);
|
|
1127
|
-
let f = 0;
|
|
1128
|
-
if (c < 1) {
|
|
1129
|
-
f = (l - 0.5 * c) / (1 - c);
|
|
1130
|
-
}
|
|
1131
|
-
return [hsl[0], c * 100, f * 100];
|
|
1132
|
-
};
|
|
1133
|
-
convert.hsv.hcg = function(hsv) {
|
|
1134
|
-
const s = hsv[1] / 100;
|
|
1135
|
-
const v = hsv[2] / 100;
|
|
1136
|
-
const c = s * v;
|
|
1137
|
-
let f = 0;
|
|
1138
|
-
if (c < 1) {
|
|
1139
|
-
f = (v - c) / (1 - c);
|
|
1140
|
-
}
|
|
1141
|
-
return [hsv[0], c * 100, f * 100];
|
|
1142
|
-
};
|
|
1143
|
-
convert.hcg.rgb = function(hcg) {
|
|
1144
|
-
const h = hcg[0] / 360;
|
|
1145
|
-
const c = hcg[1] / 100;
|
|
1146
|
-
const g = hcg[2] / 100;
|
|
1147
|
-
if (c === 0) {
|
|
1148
|
-
return [g * 255, g * 255, g * 255];
|
|
1149
|
-
}
|
|
1150
|
-
const pure = [0, 0, 0];
|
|
1151
|
-
const hi = h % 1 * 6;
|
|
1152
|
-
const v = hi % 1;
|
|
1153
|
-
const w = 1 - v;
|
|
1154
|
-
let mg = 0;
|
|
1155
|
-
switch (Math.floor(hi)) {
|
|
1156
|
-
case 0:
|
|
1157
|
-
pure[0] = 1;
|
|
1158
|
-
pure[1] = v;
|
|
1159
|
-
pure[2] = 0;
|
|
1160
|
-
break;
|
|
1161
|
-
case 1:
|
|
1162
|
-
pure[0] = w;
|
|
1163
|
-
pure[1] = 1;
|
|
1164
|
-
pure[2] = 0;
|
|
1165
|
-
break;
|
|
1166
|
-
case 2:
|
|
1167
|
-
pure[0] = 0;
|
|
1168
|
-
pure[1] = 1;
|
|
1169
|
-
pure[2] = v;
|
|
1170
|
-
break;
|
|
1171
|
-
case 3:
|
|
1172
|
-
pure[0] = 0;
|
|
1173
|
-
pure[1] = w;
|
|
1174
|
-
pure[2] = 1;
|
|
1175
|
-
break;
|
|
1176
|
-
case 4:
|
|
1177
|
-
pure[0] = v;
|
|
1178
|
-
pure[1] = 0;
|
|
1179
|
-
pure[2] = 1;
|
|
1180
|
-
break;
|
|
1181
|
-
default:
|
|
1182
|
-
pure[0] = 1;
|
|
1183
|
-
pure[1] = 0;
|
|
1184
|
-
pure[2] = w;
|
|
1185
|
-
}
|
|
1186
|
-
mg = (1 - c) * g;
|
|
1187
|
-
return [
|
|
1188
|
-
(c * pure[0] + mg) * 255,
|
|
1189
|
-
(c * pure[1] + mg) * 255,
|
|
1190
|
-
(c * pure[2] + mg) * 255
|
|
1191
|
-
];
|
|
1192
|
-
};
|
|
1193
|
-
convert.hcg.hsv = function(hcg) {
|
|
1194
|
-
const c = hcg[1] / 100;
|
|
1195
|
-
const g = hcg[2] / 100;
|
|
1196
|
-
const v = c + g * (1 - c);
|
|
1197
|
-
let f = 0;
|
|
1198
|
-
if (v > 0) {
|
|
1199
|
-
f = c / v;
|
|
1200
|
-
}
|
|
1201
|
-
return [hcg[0], f * 100, v * 100];
|
|
1202
|
-
};
|
|
1203
|
-
convert.hcg.hsl = function(hcg) {
|
|
1204
|
-
const c = hcg[1] / 100;
|
|
1205
|
-
const g = hcg[2] / 100;
|
|
1206
|
-
const l = g * (1 - c) + 0.5 * c;
|
|
1207
|
-
let s = 0;
|
|
1208
|
-
if (l > 0 && l < 0.5) {
|
|
1209
|
-
s = c / (2 * l);
|
|
1210
|
-
} else if (l >= 0.5 && l < 1) {
|
|
1211
|
-
s = c / (2 * (1 - l));
|
|
1212
|
-
}
|
|
1213
|
-
return [hcg[0], s * 100, l * 100];
|
|
1214
|
-
};
|
|
1215
|
-
convert.hcg.hwb = function(hcg) {
|
|
1216
|
-
const c = hcg[1] / 100;
|
|
1217
|
-
const g = hcg[2] / 100;
|
|
1218
|
-
const v = c + g * (1 - c);
|
|
1219
|
-
return [hcg[0], (v - c) * 100, (1 - v) * 100];
|
|
1220
|
-
};
|
|
1221
|
-
convert.hwb.hcg = function(hwb) {
|
|
1222
|
-
const w = hwb[1] / 100;
|
|
1223
|
-
const b = hwb[2] / 100;
|
|
1224
|
-
const v = 1 - b;
|
|
1225
|
-
const c = v - w;
|
|
1226
|
-
let g = 0;
|
|
1227
|
-
if (c < 1) {
|
|
1228
|
-
g = (v - c) / (1 - c);
|
|
1229
|
-
}
|
|
1230
|
-
return [hwb[0], c * 100, g * 100];
|
|
1231
|
-
};
|
|
1232
|
-
convert.apple.rgb = function(apple) {
|
|
1233
|
-
return [apple[0] / 65535 * 255, apple[1] / 65535 * 255, apple[2] / 65535 * 255];
|
|
1234
|
-
};
|
|
1235
|
-
convert.rgb.apple = function(rgb) {
|
|
1236
|
-
return [rgb[0] / 255 * 65535, rgb[1] / 255 * 65535, rgb[2] / 255 * 65535];
|
|
1237
|
-
};
|
|
1238
|
-
convert.gray.rgb = function(args) {
|
|
1239
|
-
return [args[0] / 100 * 255, args[0] / 100 * 255, args[0] / 100 * 255];
|
|
1240
|
-
};
|
|
1241
|
-
convert.gray.hsl = function(args) {
|
|
1242
|
-
return [0, 0, args[0]];
|
|
1243
|
-
};
|
|
1244
|
-
convert.gray.hsv = convert.gray.hsl;
|
|
1245
|
-
convert.gray.hwb = function(gray) {
|
|
1246
|
-
return [0, 100, gray[0]];
|
|
1247
|
-
};
|
|
1248
|
-
convert.gray.cmyk = function(gray) {
|
|
1249
|
-
return [0, 0, 0, gray[0]];
|
|
1250
|
-
};
|
|
1251
|
-
convert.gray.lab = function(gray) {
|
|
1252
|
-
return [gray[0], 0, 0];
|
|
1253
|
-
};
|
|
1254
|
-
convert.gray.hex = function(gray) {
|
|
1255
|
-
const val = Math.round(gray[0] / 100 * 255) & 255;
|
|
1256
|
-
const integer = (val << 16) + (val << 8) + val;
|
|
1257
|
-
const string = integer.toString(16).toUpperCase();
|
|
1258
|
-
return "000000".substring(string.length) + string;
|
|
1259
|
-
};
|
|
1260
|
-
convert.rgb.gray = function(rgb) {
|
|
1261
|
-
const val = (rgb[0] + rgb[1] + rgb[2]) / 3;
|
|
1262
|
-
return [val / 255 * 100];
|
|
1263
|
-
};
|
|
1264
|
-
return conversions$1;
|
|
1265
|
-
}
|
|
1266
|
-
var route$1;
|
|
1267
|
-
var hasRequiredRoute$1;
|
|
1268
|
-
function requireRoute$1() {
|
|
1269
|
-
if (hasRequiredRoute$1) return route$1;
|
|
1270
|
-
hasRequiredRoute$1 = 1;
|
|
1271
|
-
const conversions2 = requireConversions$1();
|
|
1272
|
-
function buildGraph() {
|
|
1273
|
-
const graph = {};
|
|
1274
|
-
const models = Object.keys(conversions2);
|
|
1275
|
-
for (let len = models.length, i = 0; i < len; i++) {
|
|
1276
|
-
graph[models[i]] = {
|
|
1277
|
-
// http://jsperf.com/1-vs-infinity
|
|
1278
|
-
// micro-opt, but this is simple.
|
|
1279
|
-
distance: -1,
|
|
1280
|
-
parent: null
|
|
1281
|
-
};
|
|
1282
|
-
}
|
|
1283
|
-
return graph;
|
|
1284
|
-
}
|
|
1285
|
-
function deriveBFS(fromModel) {
|
|
1286
|
-
const graph = buildGraph();
|
|
1287
|
-
const queue = [fromModel];
|
|
1288
|
-
graph[fromModel].distance = 0;
|
|
1289
|
-
while (queue.length) {
|
|
1290
|
-
const current = queue.pop();
|
|
1291
|
-
const adjacents = Object.keys(conversions2[current]);
|
|
1292
|
-
for (let len = adjacents.length, i = 0; i < len; i++) {
|
|
1293
|
-
const adjacent = adjacents[i];
|
|
1294
|
-
const node = graph[adjacent];
|
|
1295
|
-
if (node.distance === -1) {
|
|
1296
|
-
node.distance = graph[current].distance + 1;
|
|
1297
|
-
node.parent = current;
|
|
1298
|
-
queue.unshift(adjacent);
|
|
1299
|
-
}
|
|
1300
|
-
}
|
|
1301
|
-
}
|
|
1302
|
-
return graph;
|
|
1303
|
-
}
|
|
1304
|
-
function link(from, to) {
|
|
1305
|
-
return function(args) {
|
|
1306
|
-
return to(from(args));
|
|
1307
|
-
};
|
|
1308
|
-
}
|
|
1309
|
-
function wrapConversion(toModel, graph) {
|
|
1310
|
-
const path2 = [graph[toModel].parent, toModel];
|
|
1311
|
-
let fn = conversions2[graph[toModel].parent][toModel];
|
|
1312
|
-
let cur = graph[toModel].parent;
|
|
1313
|
-
while (graph[cur].parent) {
|
|
1314
|
-
path2.unshift(graph[cur].parent);
|
|
1315
|
-
fn = link(conversions2[graph[cur].parent][cur], fn);
|
|
1316
|
-
cur = graph[cur].parent;
|
|
1317
|
-
}
|
|
1318
|
-
fn.conversion = path2;
|
|
1319
|
-
return fn;
|
|
1320
|
-
}
|
|
1321
|
-
route$1 = function(fromModel) {
|
|
1322
|
-
const graph = deriveBFS(fromModel);
|
|
1323
|
-
const conversion = {};
|
|
1324
|
-
const models = Object.keys(graph);
|
|
1325
|
-
for (let len = models.length, i = 0; i < len; i++) {
|
|
1326
|
-
const toModel = models[i];
|
|
1327
|
-
const node = graph[toModel];
|
|
1328
|
-
if (node.parent === null) {
|
|
1329
|
-
continue;
|
|
1330
|
-
}
|
|
1331
|
-
conversion[toModel] = wrapConversion(toModel, graph);
|
|
1332
|
-
}
|
|
1333
|
-
return conversion;
|
|
1334
|
-
};
|
|
1335
|
-
return route$1;
|
|
1336
|
-
}
|
|
1337
|
-
var colorConvert$1;
|
|
1338
|
-
var hasRequiredColorConvert$1;
|
|
1339
|
-
function requireColorConvert$1() {
|
|
1340
|
-
if (hasRequiredColorConvert$1) return colorConvert$1;
|
|
1341
|
-
hasRequiredColorConvert$1 = 1;
|
|
1342
|
-
const conversions2 = requireConversions$1();
|
|
1343
|
-
const route2 = requireRoute$1();
|
|
1344
|
-
const convert = {};
|
|
1345
|
-
const models = Object.keys(conversions2);
|
|
1346
|
-
function wrapRaw(fn) {
|
|
1347
|
-
const wrappedFn = function(...args) {
|
|
1348
|
-
const arg0 = args[0];
|
|
1349
|
-
if (arg0 === void 0 || arg0 === null) {
|
|
1350
|
-
return arg0;
|
|
1351
|
-
}
|
|
1352
|
-
if (arg0.length > 1) {
|
|
1353
|
-
args = arg0;
|
|
1354
|
-
}
|
|
1355
|
-
return fn(args);
|
|
1356
|
-
};
|
|
1357
|
-
if ("conversion" in fn) {
|
|
1358
|
-
wrappedFn.conversion = fn.conversion;
|
|
1359
|
-
}
|
|
1360
|
-
return wrappedFn;
|
|
1361
|
-
}
|
|
1362
|
-
function wrapRounded(fn) {
|
|
1363
|
-
const wrappedFn = function(...args) {
|
|
1364
|
-
const arg0 = args[0];
|
|
1365
|
-
if (arg0 === void 0 || arg0 === null) {
|
|
1366
|
-
return arg0;
|
|
1367
|
-
}
|
|
1368
|
-
if (arg0.length > 1) {
|
|
1369
|
-
args = arg0;
|
|
1370
|
-
}
|
|
1371
|
-
const result = fn(args);
|
|
1372
|
-
if (typeof result === "object") {
|
|
1373
|
-
for (let len = result.length, i = 0; i < len; i++) {
|
|
1374
|
-
result[i] = Math.round(result[i]);
|
|
1375
|
-
}
|
|
1376
|
-
}
|
|
1377
|
-
return result;
|
|
1378
|
-
};
|
|
1379
|
-
if ("conversion" in fn) {
|
|
1380
|
-
wrappedFn.conversion = fn.conversion;
|
|
1381
|
-
}
|
|
1382
|
-
return wrappedFn;
|
|
1383
|
-
}
|
|
1384
|
-
models.forEach((fromModel) => {
|
|
1385
|
-
convert[fromModel] = {};
|
|
1386
|
-
Object.defineProperty(convert[fromModel], "channels", { value: conversions2[fromModel].channels });
|
|
1387
|
-
Object.defineProperty(convert[fromModel], "labels", { value: conversions2[fromModel].labels });
|
|
1388
|
-
const routes = route2(fromModel);
|
|
1389
|
-
const routeModels = Object.keys(routes);
|
|
1390
|
-
routeModels.forEach((toModel) => {
|
|
1391
|
-
const fn = routes[toModel];
|
|
1392
|
-
convert[fromModel][toModel] = wrapRounded(fn);
|
|
1393
|
-
convert[fromModel][toModel].raw = wrapRaw(fn);
|
|
1394
|
-
});
|
|
1395
|
-
});
|
|
1396
|
-
colorConvert$1 = convert;
|
|
1397
|
-
return colorConvert$1;
|
|
1398
|
-
}
|
|
1399
|
-
ansiStyles$1$1.exports;
|
|
1400
|
-
(function(module) {
|
|
1401
|
-
const wrapAnsi16 = (fn, offset) => (...args) => {
|
|
1402
|
-
const code = fn(...args);
|
|
1403
|
-
return `\x1B[${code + offset}m`;
|
|
1404
|
-
};
|
|
1405
|
-
const wrapAnsi256 = (fn, offset) => (...args) => {
|
|
1406
|
-
const code = fn(...args);
|
|
1407
|
-
return `\x1B[${38 + offset};5;${code}m`;
|
|
1408
|
-
};
|
|
1409
|
-
const wrapAnsi16m = (fn, offset) => (...args) => {
|
|
1410
|
-
const rgb = fn(...args);
|
|
1411
|
-
return `\x1B[${38 + offset};2;${rgb[0]};${rgb[1]};${rgb[2]}m`;
|
|
1412
|
-
};
|
|
1413
|
-
const ansi2ansi = (n) => n;
|
|
1414
|
-
const rgb2rgb = (r, g, b) => [r, g, b];
|
|
1415
|
-
const setLazyProperty = (object, property, get) => {
|
|
1416
|
-
Object.defineProperty(object, property, {
|
|
1417
|
-
get: () => {
|
|
1418
|
-
const value = get();
|
|
1419
|
-
Object.defineProperty(object, property, {
|
|
1420
|
-
value,
|
|
1421
|
-
enumerable: true,
|
|
1422
|
-
configurable: true
|
|
1423
|
-
});
|
|
1424
|
-
return value;
|
|
1425
|
-
},
|
|
1426
|
-
enumerable: true,
|
|
1427
|
-
configurable: true
|
|
1428
|
-
});
|
|
1429
|
-
};
|
|
1430
|
-
let colorConvert2;
|
|
1431
|
-
const makeDynamicStyles = (wrap, targetSpace, identity, isBackground) => {
|
|
1432
|
-
if (colorConvert2 === void 0) {
|
|
1433
|
-
colorConvert2 = requireColorConvert$1();
|
|
1434
|
-
}
|
|
1435
|
-
const offset = isBackground ? 10 : 0;
|
|
1436
|
-
const styles2 = {};
|
|
1437
|
-
for (const [sourceSpace, suite] of Object.entries(colorConvert2)) {
|
|
1438
|
-
const name2 = sourceSpace === "ansi16" ? "ansi" : sourceSpace;
|
|
1439
|
-
if (sourceSpace === targetSpace) {
|
|
1440
|
-
styles2[name2] = wrap(identity, offset);
|
|
1441
|
-
} else if (typeof suite === "object") {
|
|
1442
|
-
styles2[name2] = wrap(suite[targetSpace], offset);
|
|
1443
|
-
}
|
|
1444
|
-
}
|
|
1445
|
-
return styles2;
|
|
1446
|
-
};
|
|
1447
|
-
function assembleStyles() {
|
|
1448
|
-
const codes = /* @__PURE__ */ new Map();
|
|
1449
|
-
const styles2 = {
|
|
1450
|
-
modifier: {
|
|
1451
|
-
reset: [0, 0],
|
|
1452
|
-
// 21 isn't widely supported and 22 does the same thing
|
|
1453
|
-
bold: [1, 22],
|
|
1454
|
-
dim: [2, 22],
|
|
1455
|
-
italic: [3, 23],
|
|
1456
|
-
underline: [4, 24],
|
|
1457
|
-
inverse: [7, 27],
|
|
1458
|
-
hidden: [8, 28],
|
|
1459
|
-
strikethrough: [9, 29]
|
|
1460
|
-
},
|
|
1461
|
-
color: {
|
|
1462
|
-
black: [30, 39],
|
|
1463
|
-
red: [31, 39],
|
|
1464
|
-
green: [32, 39],
|
|
1465
|
-
yellow: [33, 39],
|
|
1466
|
-
blue: [34, 39],
|
|
1467
|
-
magenta: [35, 39],
|
|
1468
|
-
cyan: [36, 39],
|
|
1469
|
-
white: [37, 39],
|
|
1470
|
-
// Bright color
|
|
1471
|
-
blackBright: [90, 39],
|
|
1472
|
-
redBright: [91, 39],
|
|
1473
|
-
greenBright: [92, 39],
|
|
1474
|
-
yellowBright: [93, 39],
|
|
1475
|
-
blueBright: [94, 39],
|
|
1476
|
-
magentaBright: [95, 39],
|
|
1477
|
-
cyanBright: [96, 39],
|
|
1478
|
-
whiteBright: [97, 39]
|
|
1479
|
-
},
|
|
1480
|
-
bgColor: {
|
|
1481
|
-
bgBlack: [40, 49],
|
|
1482
|
-
bgRed: [41, 49],
|
|
1483
|
-
bgGreen: [42, 49],
|
|
1484
|
-
bgYellow: [43, 49],
|
|
1485
|
-
bgBlue: [44, 49],
|
|
1486
|
-
bgMagenta: [45, 49],
|
|
1487
|
-
bgCyan: [46, 49],
|
|
1488
|
-
bgWhite: [47, 49],
|
|
1489
|
-
// Bright color
|
|
1490
|
-
bgBlackBright: [100, 49],
|
|
1491
|
-
bgRedBright: [101, 49],
|
|
1492
|
-
bgGreenBright: [102, 49],
|
|
1493
|
-
bgYellowBright: [103, 49],
|
|
1494
|
-
bgBlueBright: [104, 49],
|
|
1495
|
-
bgMagentaBright: [105, 49],
|
|
1496
|
-
bgCyanBright: [106, 49],
|
|
1497
|
-
bgWhiteBright: [107, 49]
|
|
1498
|
-
}
|
|
1499
|
-
};
|
|
1500
|
-
styles2.color.gray = styles2.color.blackBright;
|
|
1501
|
-
styles2.bgColor.bgGray = styles2.bgColor.bgBlackBright;
|
|
1502
|
-
styles2.color.grey = styles2.color.blackBright;
|
|
1503
|
-
styles2.bgColor.bgGrey = styles2.bgColor.bgBlackBright;
|
|
1504
|
-
for (const [groupName, group] of Object.entries(styles2)) {
|
|
1505
|
-
for (const [styleName, style] of Object.entries(group)) {
|
|
1506
|
-
styles2[styleName] = {
|
|
1507
|
-
open: `\x1B[${style[0]}m`,
|
|
1508
|
-
close: `\x1B[${style[1]}m`
|
|
1509
|
-
};
|
|
1510
|
-
group[styleName] = styles2[styleName];
|
|
1511
|
-
codes.set(style[0], style[1]);
|
|
1512
|
-
}
|
|
1513
|
-
Object.defineProperty(styles2, groupName, {
|
|
1514
|
-
value: group,
|
|
1515
|
-
enumerable: false
|
|
1516
|
-
});
|
|
1517
|
-
}
|
|
1518
|
-
Object.defineProperty(styles2, "codes", {
|
|
1519
|
-
value: codes,
|
|
1520
|
-
enumerable: false
|
|
1521
|
-
});
|
|
1522
|
-
styles2.color.close = "\x1B[39m";
|
|
1523
|
-
styles2.bgColor.close = "\x1B[49m";
|
|
1524
|
-
setLazyProperty(styles2.color, "ansi", () => makeDynamicStyles(wrapAnsi16, "ansi16", ansi2ansi, false));
|
|
1525
|
-
setLazyProperty(styles2.color, "ansi256", () => makeDynamicStyles(wrapAnsi256, "ansi256", ansi2ansi, false));
|
|
1526
|
-
setLazyProperty(styles2.color, "ansi16m", () => makeDynamicStyles(wrapAnsi16m, "rgb", rgb2rgb, false));
|
|
1527
|
-
setLazyProperty(styles2.bgColor, "ansi", () => makeDynamicStyles(wrapAnsi16, "ansi16", ansi2ansi, true));
|
|
1528
|
-
setLazyProperty(styles2.bgColor, "ansi256", () => makeDynamicStyles(wrapAnsi256, "ansi256", ansi2ansi, true));
|
|
1529
|
-
setLazyProperty(styles2.bgColor, "ansi16m", () => makeDynamicStyles(wrapAnsi16m, "rgb", rgb2rgb, true));
|
|
1530
|
-
return styles2;
|
|
1531
|
-
}
|
|
1532
|
-
Object.defineProperty(module, "exports", {
|
|
1533
|
-
enumerable: true,
|
|
1534
|
-
get: assembleStyles
|
|
1535
|
-
});
|
|
1536
|
-
})(ansiStyles$1$1);
|
|
1537
|
-
var ansiStylesExports$1 = ansiStyles$1$1.exports;
|
|
1538
|
-
var browser$1 = {
|
|
1539
|
-
stdout: false,
|
|
1540
|
-
stderr: false
|
|
1541
|
-
};
|
|
1542
|
-
const stringReplaceAll$1$1 = (string, substring, replacer) => {
|
|
1543
|
-
let index = string.indexOf(substring);
|
|
1544
|
-
if (index === -1) {
|
|
1545
|
-
return string;
|
|
1546
|
-
}
|
|
1547
|
-
const substringLength = substring.length;
|
|
1548
|
-
let endIndex = 0;
|
|
1549
|
-
let returnValue = "";
|
|
1550
|
-
do {
|
|
1551
|
-
returnValue += string.substr(endIndex, index - endIndex) + substring + replacer;
|
|
1552
|
-
endIndex = index + substringLength;
|
|
1553
|
-
index = string.indexOf(substring, endIndex);
|
|
1554
|
-
} while (index !== -1);
|
|
1555
|
-
returnValue += string.substr(endIndex);
|
|
1556
|
-
return returnValue;
|
|
1557
|
-
};
|
|
1558
|
-
const stringEncaseCRLFWithFirstIndex$1$1 = (string, prefix, postfix, index) => {
|
|
1559
|
-
let endIndex = 0;
|
|
1560
|
-
let returnValue = "";
|
|
1561
|
-
do {
|
|
1562
|
-
const gotCR = string[index - 1] === "\r";
|
|
1563
|
-
returnValue += string.substr(endIndex, (gotCR ? index - 1 : index) - endIndex) + prefix + (gotCR ? "\r\n" : "\n") + postfix;
|
|
1564
|
-
endIndex = index + 1;
|
|
1565
|
-
index = string.indexOf("\n", endIndex);
|
|
1566
|
-
} while (index !== -1);
|
|
1567
|
-
returnValue += string.substr(endIndex);
|
|
1568
|
-
return returnValue;
|
|
1569
|
-
};
|
|
1570
|
-
var util$1 = {
|
|
1571
|
-
stringReplaceAll: stringReplaceAll$1$1,
|
|
1572
|
-
stringEncaseCRLFWithFirstIndex: stringEncaseCRLFWithFirstIndex$1$1
|
|
1573
|
-
};
|
|
1574
|
-
var templates$1;
|
|
1575
|
-
var hasRequiredTemplates$1;
|
|
1576
|
-
function requireTemplates$1() {
|
|
1577
|
-
if (hasRequiredTemplates$1) return templates$1;
|
|
1578
|
-
hasRequiredTemplates$1 = 1;
|
|
1579
|
-
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;
|
|
1580
|
-
const STYLE_REGEX = /(?:^|\.)(\w+)(?:\(([^)]*)\))?/g;
|
|
1581
|
-
const STRING_REGEX = /^(['"])((?:\\.|(?!\1)[^\\])*)\1$/;
|
|
1582
|
-
const ESCAPE_REGEX = /\\(u(?:[a-f\d]{4}|{[a-f\d]{1,6}})|x[a-f\d]{2}|.)|([^\\])/gi;
|
|
1583
|
-
const ESCAPES = /* @__PURE__ */ new Map([
|
|
1584
|
-
["n", "\n"],
|
|
1585
|
-
["r", "\r"],
|
|
1586
|
-
["t", " "],
|
|
1587
|
-
["b", "\b"],
|
|
1588
|
-
["f", "\f"],
|
|
1589
|
-
["v", "\v"],
|
|
1590
|
-
["0", "\0"],
|
|
1591
|
-
["\\", "\\"],
|
|
1592
|
-
["e", "\x1B"],
|
|
1593
|
-
["a", "\x07"]
|
|
1594
|
-
]);
|
|
1595
|
-
function unescape(c) {
|
|
1596
|
-
const u = c[0] === "u";
|
|
1597
|
-
const bracket = c[1] === "{";
|
|
1598
|
-
if (u && !bracket && c.length === 5 || c[0] === "x" && c.length === 3) {
|
|
1599
|
-
return String.fromCharCode(parseInt(c.slice(1), 16));
|
|
1600
|
-
}
|
|
1601
|
-
if (u && bracket) {
|
|
1602
|
-
return String.fromCodePoint(parseInt(c.slice(2, -1), 16));
|
|
1603
|
-
}
|
|
1604
|
-
return ESCAPES.get(c) || c;
|
|
1605
|
-
}
|
|
1606
|
-
function parseArguments(name2, arguments_) {
|
|
1607
|
-
const results = [];
|
|
1608
|
-
const chunks = arguments_.trim().split(/\s*,\s*/g);
|
|
1609
|
-
let matches;
|
|
1610
|
-
for (const chunk of chunks) {
|
|
1611
|
-
const number = Number(chunk);
|
|
1612
|
-
if (!Number.isNaN(number)) {
|
|
1613
|
-
results.push(number);
|
|
1614
|
-
} else if (matches = chunk.match(STRING_REGEX)) {
|
|
1615
|
-
results.push(matches[2].replace(ESCAPE_REGEX, (m, escape, character) => escape ? unescape(escape) : character));
|
|
1616
|
-
} else {
|
|
1617
|
-
throw new Error(`Invalid Chalk template style argument: ${chunk} (in style '${name2}')`);
|
|
1618
|
-
}
|
|
1619
|
-
}
|
|
1620
|
-
return results;
|
|
1621
|
-
}
|
|
1622
|
-
function parseStyle(style) {
|
|
1623
|
-
STYLE_REGEX.lastIndex = 0;
|
|
1624
|
-
const results = [];
|
|
1625
|
-
let matches;
|
|
1626
|
-
while ((matches = STYLE_REGEX.exec(style)) !== null) {
|
|
1627
|
-
const name2 = matches[1];
|
|
1628
|
-
if (matches[2]) {
|
|
1629
|
-
const args = parseArguments(name2, matches[2]);
|
|
1630
|
-
results.push([name2].concat(args));
|
|
1631
|
-
} else {
|
|
1632
|
-
results.push([name2]);
|
|
1633
|
-
}
|
|
1634
|
-
}
|
|
1635
|
-
return results;
|
|
1636
|
-
}
|
|
1637
|
-
function buildStyle(chalk2, styles2) {
|
|
1638
|
-
const enabled = {};
|
|
1639
|
-
for (const layer of styles2) {
|
|
1640
|
-
for (const style of layer.styles) {
|
|
1641
|
-
enabled[style[0]] = layer.inverse ? null : style.slice(1);
|
|
1642
|
-
}
|
|
1643
|
-
}
|
|
1644
|
-
let current = chalk2;
|
|
1645
|
-
for (const [styleName, styles3] of Object.entries(enabled)) {
|
|
1646
|
-
if (!Array.isArray(styles3)) {
|
|
1647
|
-
continue;
|
|
1648
|
-
}
|
|
1649
|
-
if (!(styleName in current)) {
|
|
1650
|
-
throw new Error(`Unknown Chalk style: ${styleName}`);
|
|
1651
|
-
}
|
|
1652
|
-
current = styles3.length > 0 ? current[styleName](...styles3) : current[styleName];
|
|
1653
|
-
}
|
|
1654
|
-
return current;
|
|
1655
|
-
}
|
|
1656
|
-
templates$1 = (chalk2, temporary) => {
|
|
1657
|
-
const styles2 = [];
|
|
1658
|
-
const chunks = [];
|
|
1659
|
-
let chunk = [];
|
|
1660
|
-
temporary.replace(TEMPLATE_REGEX, (m, escapeCharacter, inverse, style, close, character) => {
|
|
1661
|
-
if (escapeCharacter) {
|
|
1662
|
-
chunk.push(unescape(escapeCharacter));
|
|
1663
|
-
} else if (style) {
|
|
1664
|
-
const string = chunk.join("");
|
|
1665
|
-
chunk = [];
|
|
1666
|
-
chunks.push(styles2.length === 0 ? string : buildStyle(chalk2, styles2)(string));
|
|
1667
|
-
styles2.push({ inverse, styles: parseStyle(style) });
|
|
1668
|
-
} else if (close) {
|
|
1669
|
-
if (styles2.length === 0) {
|
|
1670
|
-
throw new Error("Found extraneous } in Chalk template literal");
|
|
1671
|
-
}
|
|
1672
|
-
chunks.push(buildStyle(chalk2, styles2)(chunk.join("")));
|
|
1673
|
-
chunk = [];
|
|
1674
|
-
styles2.pop();
|
|
1675
|
-
} else {
|
|
1676
|
-
chunk.push(character);
|
|
1677
|
-
}
|
|
1678
|
-
});
|
|
1679
|
-
chunks.push(chunk.join(""));
|
|
1680
|
-
if (styles2.length > 0) {
|
|
1681
|
-
const errMessage = `Chalk template literal is missing ${styles2.length} closing bracket${styles2.length === 1 ? "" : "s"} (\`}\`)`;
|
|
1682
|
-
throw new Error(errMessage);
|
|
1683
|
-
}
|
|
1684
|
-
return chunks.join("");
|
|
1685
|
-
};
|
|
1686
|
-
return templates$1;
|
|
1687
|
-
}
|
|
1688
|
-
const ansiStyles$2 = ansiStylesExports$1;
|
|
1689
|
-
const { stdout: stdoutColor$1, stderr: stderrColor$1 } = browser$1;
|
|
1690
|
-
const {
|
|
1691
|
-
stringReplaceAll: stringReplaceAll$2,
|
|
1692
|
-
stringEncaseCRLFWithFirstIndex: stringEncaseCRLFWithFirstIndex$2
|
|
1693
|
-
} = util$1;
|
|
1694
|
-
const { isArray: isArray$1 } = Array;
|
|
1695
|
-
const levelMapping$1 = [
|
|
1696
|
-
"ansi",
|
|
1697
|
-
"ansi",
|
|
1698
|
-
"ansi256",
|
|
1699
|
-
"ansi16m"
|
|
1700
|
-
];
|
|
1701
|
-
const styles$1 = /* @__PURE__ */ Object.create(null);
|
|
1702
|
-
const applyOptions$1 = (object, options = {}) => {
|
|
1703
|
-
if (options.level && !(Number.isInteger(options.level) && options.level >= 0 && options.level <= 3)) {
|
|
1704
|
-
throw new Error("The `level` option should be an integer from 0 to 3");
|
|
1705
|
-
}
|
|
1706
|
-
const colorLevel = stdoutColor$1 ? stdoutColor$1.level : 0;
|
|
1707
|
-
object.level = options.level === void 0 ? colorLevel : options.level;
|
|
1708
|
-
};
|
|
1709
|
-
let ChalkClass$1 = class ChalkClass {
|
|
1710
|
-
constructor(options) {
|
|
1711
|
-
return chalkFactory$1(options);
|
|
1712
|
-
}
|
|
1713
|
-
};
|
|
1714
|
-
const chalkFactory$1 = (options) => {
|
|
1715
|
-
const chalk2 = {};
|
|
1716
|
-
applyOptions$1(chalk2, options);
|
|
1717
|
-
chalk2.template = (...arguments_) => chalkTag$1(chalk2.template, ...arguments_);
|
|
1718
|
-
Object.setPrototypeOf(chalk2, Chalk$1.prototype);
|
|
1719
|
-
Object.setPrototypeOf(chalk2.template, chalk2);
|
|
1720
|
-
chalk2.template.constructor = () => {
|
|
1721
|
-
throw new Error("`chalk.constructor()` is deprecated. Use `new chalk.Instance()` instead.");
|
|
1722
|
-
};
|
|
1723
|
-
chalk2.template.Instance = ChalkClass$1;
|
|
1724
|
-
return chalk2.template;
|
|
1725
|
-
};
|
|
1726
|
-
function Chalk$1(options) {
|
|
1727
|
-
return chalkFactory$1(options);
|
|
1728
|
-
}
|
|
1729
|
-
for (const [styleName, style] of Object.entries(ansiStyles$2)) {
|
|
1730
|
-
styles$1[styleName] = {
|
|
1731
|
-
get() {
|
|
1732
|
-
const builder = createBuilder$1(this, createStyler$1(style.open, style.close, this._styler), this._isEmpty);
|
|
1733
|
-
Object.defineProperty(this, styleName, { value: builder });
|
|
1734
|
-
return builder;
|
|
1735
|
-
}
|
|
1736
|
-
};
|
|
1737
|
-
}
|
|
1738
|
-
styles$1.visible = {
|
|
1739
|
-
get() {
|
|
1740
|
-
const builder = createBuilder$1(this, this._styler, true);
|
|
1741
|
-
Object.defineProperty(this, "visible", { value: builder });
|
|
1742
|
-
return builder;
|
|
1743
|
-
}
|
|
1744
|
-
};
|
|
1745
|
-
const usedModels$1 = ["rgb", "hex", "keyword", "hsl", "hsv", "hwb", "ansi", "ansi256"];
|
|
1746
|
-
for (const model of usedModels$1) {
|
|
1747
|
-
styles$1[model] = {
|
|
1748
|
-
get() {
|
|
1749
|
-
const { level } = this;
|
|
1750
|
-
return function(...arguments_) {
|
|
1751
|
-
const styler = createStyler$1(ansiStyles$2.color[levelMapping$1[level]][model](...arguments_), ansiStyles$2.color.close, this._styler);
|
|
1752
|
-
return createBuilder$1(this, styler, this._isEmpty);
|
|
1753
|
-
};
|
|
1754
|
-
}
|
|
1755
|
-
};
|
|
1756
|
-
}
|
|
1757
|
-
for (const model of usedModels$1) {
|
|
1758
|
-
const bgModel = "bg" + model[0].toUpperCase() + model.slice(1);
|
|
1759
|
-
styles$1[bgModel] = {
|
|
1760
|
-
get() {
|
|
1761
|
-
const { level } = this;
|
|
1762
|
-
return function(...arguments_) {
|
|
1763
|
-
const styler = createStyler$1(ansiStyles$2.bgColor[levelMapping$1[level]][model](...arguments_), ansiStyles$2.bgColor.close, this._styler);
|
|
1764
|
-
return createBuilder$1(this, styler, this._isEmpty);
|
|
1765
|
-
};
|
|
1766
|
-
}
|
|
1767
|
-
};
|
|
1768
|
-
}
|
|
1769
|
-
const proto$1 = Object.defineProperties(() => {
|
|
1770
|
-
}, {
|
|
1771
|
-
...styles$1,
|
|
1772
|
-
level: {
|
|
1773
|
-
enumerable: true,
|
|
1774
|
-
get() {
|
|
1775
|
-
return this._generator.level;
|
|
1776
|
-
},
|
|
1777
|
-
set(level) {
|
|
1778
|
-
this._generator.level = level;
|
|
1779
|
-
}
|
|
1780
|
-
}
|
|
1781
|
-
});
|
|
1782
|
-
const createStyler$1 = (open, close, parent) => {
|
|
1783
|
-
let openAll;
|
|
1784
|
-
let closeAll;
|
|
1785
|
-
if (parent === void 0) {
|
|
1786
|
-
openAll = open;
|
|
1787
|
-
closeAll = close;
|
|
1788
|
-
} else {
|
|
1789
|
-
openAll = parent.openAll + open;
|
|
1790
|
-
closeAll = close + parent.closeAll;
|
|
1791
|
-
}
|
|
1792
|
-
return {
|
|
1793
|
-
open,
|
|
1794
|
-
close,
|
|
1795
|
-
openAll,
|
|
1796
|
-
closeAll,
|
|
1797
|
-
parent
|
|
1798
|
-
};
|
|
1799
|
-
};
|
|
1800
|
-
const createBuilder$1 = (self, _styler, _isEmpty) => {
|
|
1801
|
-
const builder = (...arguments_) => {
|
|
1802
|
-
if (isArray$1(arguments_[0]) && isArray$1(arguments_[0].raw)) {
|
|
1803
|
-
return applyStyle$1(builder, chalkTag$1(builder, ...arguments_));
|
|
1804
|
-
}
|
|
1805
|
-
return applyStyle$1(builder, arguments_.length === 1 ? "" + arguments_[0] : arguments_.join(" "));
|
|
1806
|
-
};
|
|
1807
|
-
Object.setPrototypeOf(builder, proto$1);
|
|
1808
|
-
builder._generator = self;
|
|
1809
|
-
builder._styler = _styler;
|
|
1810
|
-
builder._isEmpty = _isEmpty;
|
|
1811
|
-
return builder;
|
|
1812
|
-
};
|
|
1813
|
-
const applyStyle$1 = (self, string) => {
|
|
1814
|
-
if (self.level <= 0 || !string) {
|
|
1815
|
-
return self._isEmpty ? "" : string;
|
|
1816
|
-
}
|
|
1817
|
-
let styler = self._styler;
|
|
1818
|
-
if (styler === void 0) {
|
|
1819
|
-
return string;
|
|
1820
|
-
}
|
|
1821
|
-
const { openAll, closeAll } = styler;
|
|
1822
|
-
if (string.indexOf("\x1B") !== -1) {
|
|
1823
|
-
while (styler !== void 0) {
|
|
1824
|
-
string = stringReplaceAll$2(string, styler.close, styler.open);
|
|
1825
|
-
styler = styler.parent;
|
|
1826
|
-
}
|
|
1827
|
-
}
|
|
1828
|
-
const lfIndex = string.indexOf("\n");
|
|
1829
|
-
if (lfIndex !== -1) {
|
|
1830
|
-
string = stringEncaseCRLFWithFirstIndex$2(string, closeAll, openAll, lfIndex);
|
|
1831
|
-
}
|
|
1832
|
-
return openAll + string + closeAll;
|
|
1833
|
-
};
|
|
1834
|
-
let template$1;
|
|
1835
|
-
const chalkTag$1 = (chalk2, ...strings) => {
|
|
1836
|
-
const [firstString] = strings;
|
|
1837
|
-
if (!isArray$1(firstString) || !isArray$1(firstString.raw)) {
|
|
1838
|
-
return strings.join(" ");
|
|
1839
|
-
}
|
|
1840
|
-
const arguments_ = strings.slice(1);
|
|
1841
|
-
const parts = [firstString.raw[0]];
|
|
1842
|
-
for (let i = 1; i < firstString.length; i++) {
|
|
1843
|
-
parts.push(
|
|
1844
|
-
String(arguments_[i - 1]).replace(/[{}\\]/g, "\\$&"),
|
|
1845
|
-
String(firstString.raw[i])
|
|
1846
|
-
);
|
|
1847
|
-
}
|
|
1848
|
-
if (template$1 === void 0) {
|
|
1849
|
-
template$1 = requireTemplates$1();
|
|
1850
|
-
}
|
|
1851
|
-
return template$1(chalk2, parts.join(""));
|
|
1852
|
-
};
|
|
1853
|
-
Object.defineProperties(Chalk$1.prototype, styles$1);
|
|
1854
|
-
const chalk$2 = Chalk$1();
|
|
1855
|
-
chalk$2.supportsColor = stdoutColor$1;
|
|
1856
|
-
chalk$2.stderr = Chalk$1({ level: stderrColor$1 ? stderrColor$1.level : 0 });
|
|
1857
|
-
chalk$2.stderr.supportsColor = stderrColor$1;
|
|
1858
|
-
const { accessSync, constants, readFileSync } = fs;
|
|
1859
|
-
const envOptions = {};
|
|
1860
|
-
function SetupConfig(envOptions2, logger) {
|
|
1861
|
-
const envfile = process.env.STSENVFILE === void 0 ? "/.env" : process.env.STSENVFILE;
|
|
1862
|
-
config_1({ path: envfile });
|
|
1863
|
-
const defconfig = {
|
|
1864
|
-
// Node runtime environment
|
|
1865
|
-
isProduction: process.env.NODE_ENV === void 0 ? false : process.env.NODE_ENV === "production" ? true : false,
|
|
1866
|
-
isTest: process.env.NODE_ENV === void 0 ? false : process.env.NODE_ENV === "test" ? true : false,
|
|
1867
|
-
dbuser: process.env.DB_USER === void 0 ? "postgres" : process.env.DB_USER,
|
|
1868
|
-
dbpassword: process.env.DB_PASSWORD === void 0 ? "postgres" : process.env.DB_PASSWORD,
|
|
1869
|
-
dbpasswordfile: process.env.DB_PASSWORD_FILE,
|
|
1870
|
-
dbhost: process.env.DB_HOST === void 0 ? "localhost:5432" : process.env.DB_HOST,
|
|
1871
|
-
database: process.env.DB_DATABASE === void 0 ? "stsrestmsdb01" : process.env.DB_DATABASE,
|
|
1872
|
-
databaseUrl: process.env.DATABASE_URL,
|
|
1873
|
-
connectionString: "",
|
|
1874
|
-
defaultDatabaseConnectionString: "",
|
|
1875
|
-
logToFile: process.env.LOG_TO_FILE === void 0 ? false : process.env.LOG_TO_FILE === "true" ? true : false,
|
|
1876
|
-
logFilePath: process.env.LOG_FILE_PATH === void 0 ? "/var/lib/sts" : process.env.LOG_FILE_PATH,
|
|
1877
|
-
logFileFormat: process.env.LOG_FILE_FORMAT === void 0 ? "csv" : process.env.LOG_FILE_FORMAT,
|
|
1878
|
-
poolSize: process.env.POOL_SIZE === void 0 ? 500 : parseInt(process.env.POOL_SIZE),
|
|
1879
|
-
useCPUs: process.env.MAX_CPU === void 0 ? -1 : parseFloat(process.env.MAX_CPU),
|
|
1880
|
-
respawnOnFail: process.env.RESPAWN === void 0 ? true : process.env.RESPAWN === "true" ? true : false,
|
|
1881
|
-
defaultDatabaseEntries: process.env.DEFAULT_DB_ENTRIES === void 0 ? 1e4 : parseInt(process.env.DEFAULT_DB_ENTRIES),
|
|
1882
|
-
useRedisDatabaseCache: process.env.USE_REDIS_DATABASE_CACHE === void 0 ? false : process.env.USE_REDIS_DATABASE_CACHE === "true" ? true : false,
|
|
1883
|
-
useSocketIoRedisAdaptor: process.env.USE_SOCKET_IO_REDIS_ADAPTOR === void 0 ? false : process.env.USE_SOCKET_IO_REDIS_ADAPTOR === "true" ? true : false,
|
|
1884
|
-
socketIoRedisAdaptorUrl: process.env.SOCKET_IO_REDIS_ADAPTOR_URL === void 0 ? "redis://localhost:6379" : process.env.SOCKET_IO_REDIS_ADAPTOR_URL,
|
|
1885
|
-
useRedisInstrumentationTransport: process.env.USE_REDIS_INSTRUMENTATION_TRANSPORT === void 0 ? false : process.env.USE_REDIS_INSTRUMENTATION_TRANSPORT === "true" ? true : false,
|
|
1886
|
-
redisInstrumentationTransportUrl: process.env.REDIS_INSTRUMENTATION_TRANSPORT_URL === void 0 ? "redis://localhost:6379" : process.env.REDIS_INSTRUMENTATION_TRANSPORT_URL,
|
|
1887
|
-
redisDatabaseCacheEndFlush: process.env.REDIS_DATABASE_CACHE_END_FLUSH === void 0 ? false : process.env.REDIS_DATABASE_CACHE_END_FLUSH === "true" ? true : false,
|
|
1888
|
-
redisDatabaseCacheUrl: process.env.REDIS_DATABASE_CACHE_URL === void 0 ? "redis://localhost:6379" : process.env.REDIS_DATABASE_CACHE_URL,
|
|
1889
|
-
defaultDatabaseMinExtraDataSize: process.env.DEFAULT_DATABASE_MIN_EXTRA_DATA_SIZE === void 0 ? 0 : parseInt(process.env.DEFAULT_DATABASE_MIN_EXTRA_DATA_SIZE),
|
|
1890
|
-
defaultDatabaseMaxExtraDataSize: process.env.DEFAULT_DATABASE_MAX_EXTRA_DATA_SIZE === void 0 ? 2e3 : parseInt(process.env.DEFAULT_DATABASE_MAX_EXTRA_DATA_SIZE),
|
|
1891
|
-
rest01endpoint: process.env.REST01_ENDPOINT === void 0 ? "https://localhost" : process.env.REST01_ENDPOINT,
|
|
1892
|
-
rest01hostport: process.env.REST01_HOST_PORT === void 0 ? "3003" : process.env.REST01_HOST_PORT,
|
|
1893
|
-
rest01port: process.env.REST01_PORT === void 0 ? "3003" : process.env.REST01_PORT,
|
|
1894
|
-
rest01apiroot: process.env.REST01_APIROOT === void 0 ? "/stsrest01/v1" : process.env.REST01_APIROOT,
|
|
1895
|
-
rest01prometheussupport: process.env.REST01_PROM_SUPPORT === void 0 ? true : process.env.REST01_PROM_SUPPORT === "true" ? true : false,
|
|
1896
|
-
rest01prometheusclusterport: process.env.REST01_PROM_CLUSTER_PORT === void 0 ? "3013" : process.env.REST01_PROM_CLUSTER_PORT,
|
|
1897
|
-
rest01servicename: process.env.REST01_SERVICE_NAME === void 0 ? "STSRest01" : process.env.REST01_SERVICE_NAME,
|
|
1898
|
-
rest01serviceversion: process.env.REST01_SERVICE_VERSION === void 0 ? "1.0.0" : process.env.REST01_SERVICE_VERSION,
|
|
1899
|
-
stsfhirendpoint: process.env.STSFHIR_ENDPOINT === void 0 ? "https://localhost" : process.env.STSFHIR_ENDPOINT,
|
|
1900
|
-
stsfhirhostport: process.env.STSFHIR_HOST_PORT === void 0 ? "3005" : process.env.STSFHIR_HOST_PORT,
|
|
1901
|
-
stsfhirport: process.env.STSFHIR_PORT === void 0 ? "3005" : process.env.STSFHIR_PORT,
|
|
1902
|
-
stsfhirapiroot: process.env.STSFHIR_APIROOT === void 0 ? "/stsfhir/r5" : process.env.STSFHIR_APIROOT,
|
|
1903
|
-
stsfhirprometheussupport: process.env.STSFHIR_PROM_SUPPORT === void 0 ? true : process.env.STSFHIR_PROM_SUPPORT === "true" ? true : false,
|
|
1904
|
-
stsfhirprometheusclusterport: process.env.STSFHIR_PROM_CLUSTER_PORT === void 0 ? "3015" : process.env.STSFHIR_PROM_CLUSTER_PORT,
|
|
1905
|
-
stsfhirservicename: process.env.STSFHIR_SERVICE_NAME === void 0 ? "STSFHIR" : process.env.STSFHIR_SERVICE_NAME,
|
|
1906
|
-
stsfhirserviceversion: process.env.STSFHIR_SERVICE_VERSION === void 0 ? "1.0.0" : process.env.STSFHIR_SERVICE_VERSION,
|
|
1907
|
-
imendpoint: process.env.IM_ENDPOINT === void 0 ? "https://localhost" : process.env.IM_ENDPOINT,
|
|
1908
|
-
imhostport: process.env.IM_HOST_PORT === void 0 ? "3001" : process.env.IM_HOST_PORT,
|
|
1909
|
-
import: process.env.IM_PORT === void 0 ? "3001" : process.env.IM_PORT,
|
|
1910
|
-
imapiroot: process.env.IM_APIROOT === void 0 ? "/stsinstrumentmanager/v1" : process.env.IM_APIROOT,
|
|
1911
|
-
imprometheussupport: process.env.IM_PROM_SUPPORT === void 0 ? true : process.env.IM_PROM_SUPPORT === "true" ? true : false,
|
|
1912
|
-
imprometheusclusterport: process.env.IM_PROM_CLUSTER_PORT === void 0 ? "3011" : process.env.IM_PROM_CLUSTER_PORT,
|
|
1913
|
-
imservicename: process.env.IM_SERVICE_NAME === void 0 ? "STSInstrumentManager" : process.env.IM_SERVICE_NAME,
|
|
1914
|
-
imserviceversion: process.env.IM_SERVICE_VERSION === void 0 ? "1.0.0" : process.env.IM_SERVICE_VERSION,
|
|
1915
|
-
imRedisKeepAliveProcessorUrl: process.env.IM_REDIS_KEEP_ALIVE_PROCESSOR_URL === void 0 ? "redis://localhost:6379" : process.env.IM_REDIS_KEEP_ALIVE_PROCESSOR_URL,
|
|
1916
|
-
imRedisMessageProcessorUrl: process.env.IM_REDIS_MESSAGE_PROCESSOR_URL === void 0 ? "redis://localhost:6379" : process.env.IM_REDIS_MESSAGE_PROCESSOR_URL,
|
|
1917
|
-
asendpoint: process.env.AS_ENDPOINT === void 0 ? "https://localhost" : process.env.AS_ENDPOINT,
|
|
1918
|
-
ashostport: process.env.AS_HOST_PORT === void 0 ? "3002" : process.env.AS_HOST_PORT,
|
|
1919
|
-
asport: process.env.AS_PORT === void 0 ? "3002" : process.env.AS_PORT,
|
|
1920
|
-
asapiroot: process.env.AS_API_ROOT === void 0 ? "/stsauth/v1.0" : process.env.AS_API_ROOT,
|
|
1921
|
-
asoauthapiroot: process.env.AS_OAUTH_API_ROOT === void 0 ? "/oauth2/v2.0" : process.env.AS_OAUTH_API_ROOT,
|
|
1922
|
-
asadminapiroot: process.env.AS_ADMIN_API_ROOT === void 0 ? "/admin/v1.0" : process.env.AS_ADMIN_API_ROOT,
|
|
1923
|
-
asprometheussupport: process.env.AS_PROM_SUPPORT === void 0 ? true : process.env.AS_PROM_SUPPORT === "true" ? true : false,
|
|
1924
|
-
asprometheusclusterport: process.env.AS_PROM_CLUSTER_PORT === void 0 ? "3012" : process.env.AS_PROM_CLUSTER_PORT,
|
|
1925
|
-
asservicename: process.env.AS_SERVICE_NAME === void 0 ? "STSAuth" : process.env.AS_SERVICE_NAME,
|
|
1926
|
-
asserviceversion: process.env.AS_SERVICE_VERSION === void 0 ? "1.0.0" : process.env.AS_SERVICE_VERSION,
|
|
1927
|
-
asjwksjsonpath: process.env.AS_JWKS_JSON_PATH === void 0 ? "/.well-known/jwks.json" : process.env.AS_JWKS_JSON_PATH,
|
|
1928
|
-
asjwkskeyrotationtime: process.env.AS_JWKS_KEY_ROTATION_TIME === void 0 ? 86400 : parseInt(process.env.AS_JWKS_KEY_ROTATION_TIME),
|
|
1929
|
-
asjwkskeypurgetimeoffset: process.env.AS_JWKS_KEY_PURGE_TIME_OFFSET === void 0 ? 300 : parseInt(process.env.AS_JWKS_KEY_PURGE_TIME_OFFSET),
|
|
1930
|
-
asjwkskeycount: process.env.AS_JWKS_KEY_COUNT === void 0 ? 4 : parseInt(process.env.AS_JWKS_KEY_COUNT),
|
|
1931
|
-
asaccesstokenexpire: process.env.AS_ACCESS_TOKEN_EXPIRE === void 0 ? 43200 : parseInt(process.env.AS_ACCESS_TOKEN_EXPIRE),
|
|
1932
|
-
authorizeendpoint: process.env.AUTHORIZE_ENDPOINT === void 0 ? "https://localhost" : process.env.AUTHORIZE_ENDPOINT,
|
|
1933
|
-
authorizeport: process.env.AUTHORIZE_PORT === void 0 ? "3010" : process.env.AUTHORIZE_PORT,
|
|
1934
|
-
authorizeapiroot: process.env.AUTHORIZE_API_ROOT === void 0 ? "/stsa" : process.env.AUTHORIZE_API_ROOT,
|
|
1935
|
-
authorizeapi: process.env.AUTHORIZE_API === void 0 ? "/authorize" : process.env.AUTHORIZE_API,
|
|
1936
|
-
brokerendpoint: process.env.BROKER_ENDPOINT === void 0 ? "https://localhost" : process.env.BROKER_ENDPOINT,
|
|
1937
|
-
brokerhostport: process.env.BROKER_HOST_PORT === void 0 ? "3006" : process.env.BROKER_HOST_PORT,
|
|
1938
|
-
brokerport: process.env.BROKER_PORT === void 0 ? "3006" : process.env.BROKER_PORT,
|
|
1939
|
-
brokerapiroot: process.env.BROKER_APIROOT === void 0 ? "/stsbroker/v1.0" : process.env.BROKER_APIROOT,
|
|
1940
|
-
brokerprometheussupport: process.env.BROKER_PROM_SUPPORT === void 0 ? true : process.env.BROKER_PROM_SUPPORT === "true" ? true : false,
|
|
1941
|
-
brokerprometheusclusterport: process.env.BROKER_PROM_CLUSTER_PORT === void 0 ? "3016" : process.env.BROKER_PROM_CLUSTER_PORT,
|
|
1942
|
-
brokerservicename: process.env.BROKER_SERVICE_NAME === void 0 ? "STSBroker" : process.env.BROKER_SERVICE_NAME,
|
|
1943
|
-
brokerserviceversion: process.env.BROKER_SERVICE_VERSION === void 0 ? "1.0.0" : process.env.BROKER_SERVICE_VERSION,
|
|
1944
|
-
trnendpoint: process.env.TRN_ENDPOINT === void 0 ? "https://localhost" : process.env.TRN_ENDPOINT,
|
|
1945
|
-
trnhostport: process.env.TRN_HOST_PORT === void 0 ? "3007" : process.env.TRN_HOST_PORT,
|
|
1946
|
-
trnport: process.env.TRN_PORT === void 0 ? "3007" : process.env.TRN_PORT,
|
|
1947
|
-
trnapiroot: process.env.TRN_APIROOT === void 0 ? "/ststrn/v1.0" : process.env.TRN_APIROOT,
|
|
1948
|
-
trnprometheussupport: process.env.TRN_PROM_SUPPORT === void 0 ? true : process.env.TRN_PROM_SUPPORT === "true" ? true : false,
|
|
1949
|
-
trnprometheusclusterport: process.env.TRN_PROM_CLUSTER_PORT === void 0 ? "3017" : process.env.TRN_PROM_CLUSTER_PORT,
|
|
1950
|
-
trnservicename: process.env.TRN_SERVICE_NAME === void 0 ? "STSTestRunnerNode" : process.env.TRN_SERVICE_NAME,
|
|
1951
|
-
trnserviceversion: process.env.TRN_SERVICE_VERSION === void 0 ? "1.0.0" : process.env.TRN_SERVICE_VERSION,
|
|
1952
|
-
trnautostartdelay: process.env.TRN_AUTO_START_DELAY === void 0 ? 0 : parseInt(process.env.TRN_AUTO_START_DELAY),
|
|
1953
|
-
trnautostartconfig: process.env.TRN_AUTO_START_CONFIG === void 0 ? "" : process.env.TRN_AUTO_START_CONFIG,
|
|
1954
|
-
trnRedisMessageProcessorUrl: process.env.TRN_REDIS_MESSAGE_PROCESSOR_URL === void 0 ? "redis://localhost:6379" : process.env.TRN_REDIS_MESSAGE_PROCESSOR_URL,
|
|
1955
|
-
lambdaendpoint: process.env.LAMBDA_ENDPOINT === void 0 ? "https://localhost" : process.env.LAMBDA_ENDPOINT,
|
|
1956
|
-
lambdahostport: process.env.LAMBDA_HOST_PORT === void 0 ? "3009" : process.env.LAMBDA_HOST_PORT,
|
|
1957
|
-
lambdaport: process.env.LAMBDA_PORT === void 0 ? "3009" : process.env.LAMBDA_PORT,
|
|
1958
|
-
lambdaapiroot: process.env.LAMBDA_APIROOT === void 0 ? "/stslambda/v1.0" : process.env.LAMBDA_APIROOT,
|
|
1959
|
-
lambdaprometheussupport: process.env.LAMBDA_PROM_SUPPORT === void 0 ? true : process.env.LAMBDA_PROM_SUPPORT === "true" ? true : false,
|
|
1960
|
-
lambdaprometheusclusterport: process.env.LAMBDA_PROM_CLUSTER_PORT === void 0 ? "3019" : process.env.LAMBDA_PROM_CLUSTER_PORT,
|
|
1961
|
-
lambdaservicename: process.env.LAMBDA_SERVICE_NAME === void 0 ? "STSLambda" : process.env.LAMBDA_SERVICE_NAME,
|
|
1962
|
-
lambdaserviceversion: process.env.LAMBDA_SERVICE_VERSION === void 0 ? "1.0.0" : process.env.LAMBDA_SERVICE_VERSION,
|
|
1963
|
-
publishinterval: process.env.PUBLISH_INTERVAL === void 0 ? 1e3 : parseInt(process.env.PUBLISH_INTERVAL),
|
|
1964
|
-
publishtimeout: process.env.PUBLISH_TIMEOUT === void 0 ? 750 : parseInt(process.env.PUBLISH_TIMEOUT),
|
|
1965
|
-
transport: process.env.TRANSPORT === void 0 ? "RESTAPI" : process.env.TRANSPORT,
|
|
1966
|
-
useSecureCookies: process.env.USE_SECURE_COOKIES === void 0 ? false : process.env.USE_SECURE_COOKIES === "true" ? true : false,
|
|
1967
|
-
keepAlive: process.env.KEEP_ALIVE === void 0 ? true : process.env.KEEP_ALIVE === "true" ? true : false,
|
|
1968
|
-
maxSockets: process.env.MAX_SOCKETS === void 0 ? 10 : parseInt(process.env.MAX_SOCKETS),
|
|
1969
|
-
maxTotalSockets: process.env.MAX_TOTAL_SOCKETS === void 0 ? 20 : parseInt(process.env.MAX_TOTAL_SOCKETS),
|
|
1970
|
-
maxFreeSockets: process.env.MAX_FREE_SOCKETS === void 0 ? 256 : parseInt(process.env.MAX_FREE_SOCKETS),
|
|
1971
|
-
timeout: process.env.TIMEOUT === void 0 ? 1e4 : parseInt(process.env.TIMEOUT),
|
|
1972
|
-
maxPayloadSize: process.env.MAX_PAYLOAD_SIZE === void 0 ? "50mb" : process.env.MAX_PAYLOAD_SIZE,
|
|
1973
|
-
instrumentationObservationInterval: process.env.INSTRUMENTATION_OBSERVATION_INTERVAL === void 0 ? 1e3 : parseInt(process.env.INSTRUMENTATION_OBSERVATION_INTERVAL),
|
|
1974
|
-
instrumentationTimeWindow: process.env.INSTRUMENTATION_TIME_WINDOW === void 0 ? 600 : parseInt(process.env.INSTRUMENTATION_TIME_WINDOW),
|
|
1975
|
-
authJWTAccessTokenTimeout: process.env.AUTH_JWT_ACCESS_TOKEN_TIMEOUT === void 0 ? 600 : parseInt(process.env.AUTH_JWT_ACCESS_TOKEN_TIMEOUT),
|
|
1976
|
-
authJWTRefreshTokenTimeout: process.env.AUTH_JWT_REFRESH_TOKEN_TIMEOUT === void 0 ? 3600 * 24 : parseInt(process.env.AUTH_JWT_REFRESH_TOKEN_TIMEOUT),
|
|
1977
|
-
authCookieTimeout: process.env.AUTH_COOKIE_TIMEOUT === void 0 ? 3600 * 24 : parseInt(process.env.AUTH_COOKIE_TIMEOUT),
|
|
1978
|
-
masterProcessExitTime: process.env.MASTER_PROCESS_EXIT_TIME === void 0 ? 500 : parseInt(process.env.MASTER_PROCESS_EXIT_TIME),
|
|
1979
|
-
childProcessExitTime: process.env.CHILD_PROCESS_EXIT_TIME === void 0 ? 500 : parseInt(process.env.CHILD_PROCESS_EXIT_TIME),
|
|
1980
|
-
systemInformationInterval: process.env.SYSTEM_INFORMATION_INTERVAL === void 0 ? 1e3 : parseInt(process.env.SYSTEM_INFORMATION_INTERVAL),
|
|
1981
|
-
ignoresocketio: process.env.IGNORE_SOCKETIO === void 0 ? true : process.env.IGNORE_SOCKETIO === "true" ? true : false,
|
|
1982
|
-
httpsserverkeypath: process.env.HTTPS_SERVER_KEY_PATH === void 0 ? "/var/lib/sts/stsglobalresources/keys/server.key" : process.env.HTTPS_SERVER_KEY_PATH,
|
|
1983
|
-
httpsservercertpath: process.env.HTTPS_SERVER_CERT_PATH === void 0 ? "/var/lib/sts/stsglobalresources/keys/server.cert" : process.env.HTTPS_SERVER_CERT_PATH,
|
|
1984
|
-
tsjwkskeys: process.env.TS_JWKS_KEYS === void 0 ? 3 : parseInt(process.env.TS_JWKS_KEYS),
|
|
1985
|
-
jwksAuthConfigCache: process.env.JWKS_AUTH_CONFIG_CACHE === void 0 ? true : process.env.JWKS_AUTH_CONFIG_CACHE === "true" ? true : false,
|
|
1986
|
-
jwksAuthConfigCacheMaxEntries: process.env.JWKS_AUTH_CONFIG_CACHE_MAX_ENTRIES === void 0 ? 5 : parseInt(process.env.JWKS_AUTH_CONFIG_CACHE_MAX_ENTRIES),
|
|
1987
|
-
jwksAuthConfigCacheMaxAge: process.env.JWKS_AUTH_CONFIG_CACHE_MAX_AGE === void 0 ? 6e5 : parseInt(process.env.JWKS_AUTH_CONFIG_CACHE_MAX_AGE),
|
|
1988
|
-
jwksAuthConfigRateLimit: process.env.JWKS_AUTH_CONFIG_RATE_LIMIT === void 0 ? true : process.env.JWKS_AUTH_CONFIG_RATE_LIMIT === "true" ? true : false,
|
|
1989
|
-
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),
|
|
1990
|
-
jwksAuthConfigTimeout: process.env.JWKS_AUTH_CONFIG_TIMEOUT === void 0 ? 3e4 : parseInt(process.env.JWKS_AUTH_CONFIG_TIMEOUT),
|
|
1991
|
-
influxDB_APIToken: process.env.INFLUXDB_API_TOKEN === void 0 ? "password" : process.env.INFLUXDB_API_TOKEN,
|
|
1992
|
-
influxDB_APITokenFile: process.env.INFLUXDB_API_TOKEN_FILE,
|
|
1993
|
-
influxDB_Url: process.env.INFLUXDB_URL === void 0 ? "http://localhost:8086" : process.env.INFLUXDB_URL,
|
|
1994
|
-
influxDB_Org: process.env.INFLUXDB_ORG === void 0 ? "my-org" : process.env.INFLUXDB_ORG,
|
|
1995
|
-
influxDB_Bucket: process.env.INFLUXDB_BUCKET === void 0 ? "TestBucket01" : process.env.INFLUXDB_BUCKET,
|
|
1996
|
-
influxDB_keepAlive: process.env.INFLUXDB_KEEP_ALIVE === void 0 ? true : process.env.INFLUXDB_KEEP_ALIVE === "true" ? true : false,
|
|
1997
|
-
influxDB_maxSockets: process.env.INFLUXDB_MAX_SOCKETS === void 0 ? 10 : parseInt(process.env.INFLUXDB_MAX_SOCKETS),
|
|
1998
|
-
influxDB_maxTotalSockets: process.env.INFLUXDB_MAX_TOTAL_SOCKETS === void 0 ? 20 : parseInt(process.env.INFLUXDB_MAX_TOTAL_SOCKETS),
|
|
1999
|
-
influxDB_maxFreeSockets: process.env.INFLUXDB_MAX_FREE_SOCKETS === void 0 ? 256 : parseInt(process.env.INFLUXDB_MAX_FREE_SOCKETS),
|
|
2000
|
-
influxDB_timeout: process.env.INFLUXDB_TIMEOUT === void 0 ? 1e4 : parseInt(process.env.INFLUXDB_TIMEOUT),
|
|
2001
|
-
influxDB_rejectUnauthorized: process.env.INFLUXDB_REJECT_UNAUTHORIZED === void 0 ? true : process.env.INFLUXDB_REJECT_UNAUTHORIZED === "true" ? true : false,
|
|
2002
|
-
influxDB_writeDataPointFlushTimeout: process.env.INFLUXDB_WRITE_DATA_POINT_FLUSH_TIMEOUT === void 0 ? 1e3 : parseInt(process.env.INFLUXDB_WRITE_DATA_POINT_FLUSH_TIMEOUT),
|
|
2003
|
-
kafka_clientId: process.env.KAFKA_CLIENT_ID === void 0 ? "myclient" : process.env.KAFKA_CLIENT_ID,
|
|
2004
|
-
kafka_brokers: process.env.KAFKA_BROKERS === void 0 ? "localhost:9092" : process.env.KAFKA_BROKERS,
|
|
2005
|
-
kafka_admin_timeout: process.env.KAFKA_ADMIN_TIMEOUT === void 0 ? 5e3 : parseInt(process.env.KAFKA_ADMIN_TIMEOUT),
|
|
2006
|
-
kafka_connection_timeout: process.env.KAFKA_CONNECTION_TIMEOUT === void 0 ? 5e3 : parseInt(process.env.KAFKA_CONNECTION_TIMEOUT),
|
|
2007
|
-
kafka_request_timeout: process.env.KAFKA_REQUEST_TIMEOUT === void 0 ? 5e3 : parseInt(process.env.KAFKA_REQUEST_TIMEOUT),
|
|
2008
|
-
kafka_log_level: process.env.KAFKA_LOG_LEVEL === void 0 ? "nothing" : process.env.KAFKA_LOG_LEVEL,
|
|
2009
|
-
kafka_keep_alive: process.env.KAFKA_KEEP_ALIVE === void 0 ? 3e4 : parseInt(process.env.KAFKA_KEEP_ALIVE),
|
|
2010
|
-
kafka_use_ssl: process.env.KAFKA_USE_SSL === void 0 ? false : process.env.KAFKA_USE_SSL === "true" ? true : false,
|
|
2011
|
-
kafka_ssl_rejectUnauthorized: process.env.KAFKA_SSL_REJECT_UNAUTHORIZED === void 0 ? true : process.env.KAFKA_SSL_REJECT_UNAUTHORIZED === "true" ? true : false,
|
|
2012
|
-
kafka_ssl_cafile: process.env.KAFKA_SSL_CAFILE === void 0 ? "/my/custom/ca.crt" : process.env.KAFKA_SSL_CAFILE,
|
|
2013
|
-
kafka_ssl_keyfile: process.env.KAFKA_SSL_KEYFILE === void 0 ? "/my/custom/client-key.pem" : process.env.KAFKA_SSL_KEYFILE,
|
|
2014
|
-
kafka_ssl_certfile: process.env.KAFKA_SSL_CERTFILE === void 0 ? "/my/custom/client-cert.pem" : process.env.KAFKA_SSL_CERTFILE,
|
|
2015
|
-
kafka_consume_from_beginning: process.env.KAFKA_CONSUME_FROM_BEGINNING === void 0 ? true : process.env.KAFKA_CONSUME_FROM_BEGINNING === "true" ? true : false,
|
|
2016
|
-
observabilityPublishMode: process.env.OBSERVABILITY_PUBLISH_MODE === void 0 ? "PROXY" : process.env.OBSERVABILITY_PUBLISH_MODE,
|
|
2017
|
-
stsUiTermObservabilityConsumptionMode: process.env.STSUITERM_OBSERVABILITY_CONSUMPTION_MODE === void 0 ? "PROXY" : process.env.STSUITERM_OBSERVABILITY_CONSUMPTION_MODE
|
|
2018
|
-
};
|
|
2019
|
-
const ReadFile = (passwordFile) => {
|
|
2020
|
-
try {
|
|
2021
|
-
accessSync(passwordFile, constants.R_OK);
|
|
2022
|
-
const data = readFileSync(passwordFile, "utf8");
|
|
2023
|
-
if (logger) ;
|
|
2024
|
-
return data;
|
|
2025
|
-
} catch (err) {
|
|
2026
|
-
return "";
|
|
2027
|
-
}
|
|
2028
|
-
};
|
|
2029
|
-
const fileconfig = [
|
|
2030
|
-
{ fileprop: "dbpasswordfile", prop: "dbpassword" },
|
|
2031
|
-
// JWKS secret file processing
|
|
2032
|
-
{ fileprop: "tsjwksstorepathfile", prop: "tsjwksstorepath" },
|
|
2033
|
-
// InfluxDB file processing
|
|
2034
|
-
{ fileprop: "influxDB_APITokenFile", prop: "influxDB_APIToken" }
|
|
2035
|
-
];
|
|
2036
|
-
fileconfig.forEach((v) => {
|
|
2037
|
-
if (defconfig[v.fileprop] !== void 0) {
|
|
2038
|
-
defconfig[v.prop] = ReadFile(defconfig[v.fileprop]);
|
|
2039
|
-
}
|
|
2040
|
-
});
|
|
2041
|
-
for (const [key, val] of Object.entries(defconfig)) {
|
|
2042
|
-
envOptions2[key] = val;
|
|
2043
|
-
}
|
|
2044
|
-
}
|
|
2045
|
-
function $SetupOptions(envOptions2) {
|
|
2046
|
-
SetupConfig(envOptions2);
|
|
2047
|
-
const options = envOptions2;
|
|
2048
|
-
if (options.dbhost) {
|
|
2049
|
-
const hosts = options.dbhost.split(",");
|
|
2050
|
-
envOptions2.connectionString = hosts.map((host) => {
|
|
2051
|
-
return `postgresql://${options.dbuser}:${options.dbpassword}@${host}/${options.database}`;
|
|
2052
|
-
}).join(",");
|
|
2053
|
-
envOptions2.defaultDatabaseConnectionString = hosts.map((host) => {
|
|
2054
|
-
return `postgresql://${options.dbuser}:${options.dbpassword}@${host}/postgres`;
|
|
2055
|
-
}).join(",");
|
|
2056
|
-
}
|
|
2057
|
-
}
|
|
2058
|
-
const envOptionsHandler = {
|
|
2059
|
-
get(target, prop, receiver) {
|
|
2060
|
-
if (Object.keys(target).length === 0) {
|
|
2061
|
-
$SetupOptions(target);
|
|
2062
|
-
}
|
|
2063
|
-
return Reflect.get(target, prop, receiver);
|
|
2064
|
-
}
|
|
2065
|
-
};
|
|
2066
|
-
const goptions = new Proxy(envOptions, envOptionsHandler);
|
|
2067
59
|
var ansiStyles$1 = { exports: {} };
|
|
2068
60
|
var colorName;
|
|
2069
61
|
var hasRequiredColorName;
|
|
@@ -2938,15 +930,15 @@ function requireRoute() {
|
|
|
2938
930
|
};
|
|
2939
931
|
}
|
|
2940
932
|
function wrapConversion(toModel, graph) {
|
|
2941
|
-
const
|
|
933
|
+
const path = [graph[toModel].parent, toModel];
|
|
2942
934
|
let fn = conversions2[graph[toModel].parent][toModel];
|
|
2943
935
|
let cur = graph[toModel].parent;
|
|
2944
936
|
while (graph[cur].parent) {
|
|
2945
|
-
|
|
937
|
+
path.unshift(graph[cur].parent);
|
|
2946
938
|
fn = link(conversions2[graph[cur].parent][cur], fn);
|
|
2947
939
|
cur = graph[cur].parent;
|
|
2948
940
|
}
|
|
2949
|
-
fn.conversion =
|
|
941
|
+
fn.conversion = path;
|
|
2950
942
|
return fn;
|
|
2951
943
|
}
|
|
2952
944
|
route = function(fromModel) {
|
|
@@ -3066,11 +1058,11 @@ ansiStyles$1.exports;
|
|
|
3066
1058
|
const offset = isBackground ? 10 : 0;
|
|
3067
1059
|
const styles2 = {};
|
|
3068
1060
|
for (const [sourceSpace, suite] of Object.entries(colorConvert2)) {
|
|
3069
|
-
const
|
|
1061
|
+
const name = sourceSpace === "ansi16" ? "ansi" : sourceSpace;
|
|
3070
1062
|
if (sourceSpace === targetSpace) {
|
|
3071
|
-
styles2[
|
|
1063
|
+
styles2[name] = wrap(identity, offset);
|
|
3072
1064
|
} else if (typeof suite === "object") {
|
|
3073
|
-
styles2[
|
|
1065
|
+
styles2[name] = wrap(suite[targetSpace], offset);
|
|
3074
1066
|
}
|
|
3075
1067
|
}
|
|
3076
1068
|
return styles2;
|
|
@@ -3234,7 +1226,7 @@ function requireTemplates() {
|
|
|
3234
1226
|
}
|
|
3235
1227
|
return ESCAPES.get(c) || c;
|
|
3236
1228
|
}
|
|
3237
|
-
function parseArguments(
|
|
1229
|
+
function parseArguments(name, arguments_) {
|
|
3238
1230
|
const results = [];
|
|
3239
1231
|
const chunks = arguments_.trim().split(/\s*,\s*/g);
|
|
3240
1232
|
let matches;
|
|
@@ -3245,7 +1237,7 @@ function requireTemplates() {
|
|
|
3245
1237
|
} else if (matches = chunk.match(STRING_REGEX)) {
|
|
3246
1238
|
results.push(matches[2].replace(ESCAPE_REGEX, (m, escape, character) => escape ? unescape(escape) : character));
|
|
3247
1239
|
} else {
|
|
3248
|
-
throw new Error(`Invalid Chalk template style argument: ${chunk} (in style '${
|
|
1240
|
+
throw new Error(`Invalid Chalk template style argument: ${chunk} (in style '${name}')`);
|
|
3249
1241
|
}
|
|
3250
1242
|
}
|
|
3251
1243
|
return results;
|
|
@@ -3255,12 +1247,12 @@ function requireTemplates() {
|
|
|
3255
1247
|
const results = [];
|
|
3256
1248
|
let matches;
|
|
3257
1249
|
while ((matches = STYLE_REGEX.exec(style)) !== null) {
|
|
3258
|
-
const
|
|
1250
|
+
const name = matches[1];
|
|
3259
1251
|
if (matches[2]) {
|
|
3260
|
-
const args = parseArguments(
|
|
3261
|
-
results.push([
|
|
1252
|
+
const args = parseArguments(name, matches[2]);
|
|
1253
|
+
results.push([name].concat(args));
|
|
3262
1254
|
} else {
|
|
3263
|
-
results.push([
|
|
1255
|
+
results.push([name]);
|
|
3264
1256
|
}
|
|
3265
1257
|
}
|
|
3266
1258
|
return results;
|
|
@@ -3337,7 +1329,7 @@ const applyOptions = (object, options = {}) => {
|
|
|
3337
1329
|
const colorLevel = stdoutColor ? stdoutColor.level : 0;
|
|
3338
1330
|
object.level = options.level === void 0 ? colorLevel : options.level;
|
|
3339
1331
|
};
|
|
3340
|
-
class
|
|
1332
|
+
class ChalkClass {
|
|
3341
1333
|
constructor(options) {
|
|
3342
1334
|
return chalkFactory(options);
|
|
3343
1335
|
}
|
|
@@ -3351,7 +1343,7 @@ const chalkFactory = (options) => {
|
|
|
3351
1343
|
chalk2.template.constructor = () => {
|
|
3352
1344
|
throw new Error("`chalk.constructor()` is deprecated. Use `new chalk.Instance()` instead.");
|
|
3353
1345
|
};
|
|
3354
|
-
chalk2.template.Instance =
|
|
1346
|
+
chalk2.template.Instance = ChalkClass;
|
|
3355
1347
|
return chalk2.template;
|
|
3356
1348
|
};
|
|
3357
1349
|
function Chalk(options) {
|
|
@@ -3550,6 +1542,7 @@ var StatusCodes;
|
|
|
3550
1542
|
StatusCodes2[StatusCodes2["NETWORK_AUTHENTICATION_REQUIRED"] = 511] = "NETWORK_AUTHENTICATION_REQUIRED";
|
|
3551
1543
|
})(StatusCodes || (StatusCodes = {}));
|
|
3552
1544
|
class FhirClient {
|
|
1545
|
+
// Default value
|
|
3553
1546
|
constructor(options) {
|
|
3554
1547
|
__privateAdd(this, _options);
|
|
3555
1548
|
__privateAdd(this, _DUMMY_USER, "USR_user01@stsmda.com.au");
|
|
@@ -3562,6 +1555,7 @@ class FhirClient {
|
|
|
3562
1555
|
StatusCodes.NOT_FOUND,
|
|
3563
1556
|
StatusCodes.CONFLICT
|
|
3564
1557
|
]);
|
|
1558
|
+
__privateAdd(this, _stsfhirapiroot, "/stsfhir/r5");
|
|
3565
1559
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
3566
1560
|
__privateAdd(this, _LogDebugMessage, (message) => {
|
|
3567
1561
|
__privateGet(this, _options).logger.debug(message);
|
|
@@ -3572,14 +1566,18 @@ class FhirClient {
|
|
|
3572
1566
|
});
|
|
3573
1567
|
__privateAdd(this, _GetHttpsAgent, () => {
|
|
3574
1568
|
if (__privateGet(this, _httpsAgent) === null) {
|
|
3575
|
-
|
|
3576
|
-
|
|
3577
|
-
|
|
3578
|
-
|
|
3579
|
-
|
|
3580
|
-
|
|
3581
|
-
|
|
3582
|
-
|
|
1569
|
+
if (__privateGet(this, _options).agentOptions) {
|
|
1570
|
+
__privateSet(this, _httpsAgent, new https.Agent({
|
|
1571
|
+
keepAlive: __privateGet(this, _options).agentOptions.keepAlive,
|
|
1572
|
+
maxSockets: __privateGet(this, _options).agentOptions.maxSockets,
|
|
1573
|
+
maxTotalSockets: __privateGet(this, _options).agentOptions.maxTotalSockets,
|
|
1574
|
+
maxFreeSockets: __privateGet(this, _options).agentOptions.maxFreeSockets,
|
|
1575
|
+
timeout: __privateGet(this, _options).agentOptions.timeout,
|
|
1576
|
+
rejectUnauthorized: __privateGet(this, _options).agentOptions.rejectUnauthorized
|
|
1577
|
+
}));
|
|
1578
|
+
} else {
|
|
1579
|
+
__privateSet(this, _httpsAgent, new https.Agent());
|
|
1580
|
+
}
|
|
3583
1581
|
}
|
|
3584
1582
|
return __privateGet(this, _httpsAgent);
|
|
3585
1583
|
});
|
|
@@ -3735,7 +1733,7 @@ class FhirClient {
|
|
|
3735
1733
|
}
|
|
3736
1734
|
});
|
|
3737
1735
|
__publicField(this, "GetResource", async (resource, id, filters, errorCb) => {
|
|
3738
|
-
const url = `${__privateGet(this, _options).fhirEndpoint}${
|
|
1736
|
+
const url = `${__privateGet(this, _options).fhirEndpoint}${__privateGet(this, _stsfhirapiroot)}/${resource}/${id}`;
|
|
3739
1737
|
const response = await __privateGet(this, _InvokeResourceAPI).call(this, url, "get", null, filters, errorCb);
|
|
3740
1738
|
if (response) {
|
|
3741
1739
|
return response.data;
|
|
@@ -3744,7 +1742,7 @@ class FhirClient {
|
|
|
3744
1742
|
}
|
|
3745
1743
|
});
|
|
3746
1744
|
__publicField(this, "GetResources", async (resource, filters, errorCb) => {
|
|
3747
|
-
const url = `${__privateGet(this, _options).fhirEndpoint}${
|
|
1745
|
+
const url = `${__privateGet(this, _options).fhirEndpoint}${__privateGet(this, _stsfhirapiroot)}/${resource}`;
|
|
3748
1746
|
const response = await __privateGet(this, _InvokeResourceAPI).call(this, url, "get", null, filters, errorCb);
|
|
3749
1747
|
if (response) {
|
|
3750
1748
|
return response.data;
|
|
@@ -3753,7 +1751,7 @@ class FhirClient {
|
|
|
3753
1751
|
}
|
|
3754
1752
|
});
|
|
3755
1753
|
__publicField(this, "CreateResource", async (resource, domainResource, errorCb) => {
|
|
3756
|
-
const url = `${__privateGet(this, _options).fhirEndpoint}${
|
|
1754
|
+
const url = `${__privateGet(this, _options).fhirEndpoint}${__privateGet(this, _stsfhirapiroot)}/${resource}`;
|
|
3757
1755
|
const response = await __privateGet(this, _InvokeResourceAPI).call(this, url, "post", domainResource, null, errorCb);
|
|
3758
1756
|
if (response) {
|
|
3759
1757
|
if (response.status === StatusCodes.CREATED) {
|
|
@@ -3767,7 +1765,7 @@ class FhirClient {
|
|
|
3767
1765
|
}
|
|
3768
1766
|
});
|
|
3769
1767
|
__publicField(this, "UpdateResource", async (resource, domainResource, errorCb) => {
|
|
3770
|
-
const url = `${__privateGet(this, _options).fhirEndpoint}${
|
|
1768
|
+
const url = `${__privateGet(this, _options).fhirEndpoint}${__privateGet(this, _stsfhirapiroot)}/${resource}/${domainResource.id}`;
|
|
3771
1769
|
const response = await __privateGet(this, _InvokeResourceAPI).call(this, url, "put", domainResource, null, errorCb);
|
|
3772
1770
|
if (response) {
|
|
3773
1771
|
return response.data;
|
|
@@ -3776,7 +1774,7 @@ class FhirClient {
|
|
|
3776
1774
|
}
|
|
3777
1775
|
});
|
|
3778
1776
|
__publicField(this, "UpdateResources", async (resource, domainResources, errorCb) => {
|
|
3779
|
-
const url = `${__privateGet(this, _options).fhirEndpoint}${
|
|
1777
|
+
const url = `${__privateGet(this, _options).fhirEndpoint}${__privateGet(this, _stsfhirapiroot)}/${resource}`;
|
|
3780
1778
|
const response = await __privateGet(this, _InvokeResourceAPI).call(this, url, "put", domainResources, null, errorCb);
|
|
3781
1779
|
if (response) {
|
|
3782
1780
|
return response.data;
|
|
@@ -3785,7 +1783,7 @@ class FhirClient {
|
|
|
3785
1783
|
}
|
|
3786
1784
|
});
|
|
3787
1785
|
__publicField(this, "PatchResource", async (resource, domainResource, errorCb) => {
|
|
3788
|
-
const url = `${__privateGet(this, _options).fhirEndpoint}${
|
|
1786
|
+
const url = `${__privateGet(this, _options).fhirEndpoint}${__privateGet(this, _stsfhirapiroot)}/${resource}/${domainResource.id}`;
|
|
3789
1787
|
const response = await __privateGet(this, _InvokeResourceAPI).call(this, url, "patch", domainResource, null, errorCb);
|
|
3790
1788
|
if (response) {
|
|
3791
1789
|
return response.data;
|
|
@@ -3794,7 +1792,7 @@ class FhirClient {
|
|
|
3794
1792
|
}
|
|
3795
1793
|
});
|
|
3796
1794
|
__publicField(this, "PatchResources", async (resource, domainResources, errorCb) => {
|
|
3797
|
-
const url = `${__privateGet(this, _options).fhirEndpoint}${
|
|
1795
|
+
const url = `${__privateGet(this, _options).fhirEndpoint}${__privateGet(this, _stsfhirapiroot)}/${resource}`;
|
|
3798
1796
|
const response = await __privateGet(this, _InvokeResourceAPI).call(this, url, "patch", domainResources, null, errorCb);
|
|
3799
1797
|
if (response) {
|
|
3800
1798
|
return response.data;
|
|
@@ -3803,7 +1801,7 @@ class FhirClient {
|
|
|
3803
1801
|
}
|
|
3804
1802
|
});
|
|
3805
1803
|
__publicField(this, "DeleteResource", async (resource, id, errorCb) => {
|
|
3806
|
-
const url = `${__privateGet(this, _options).fhirEndpoint}${
|
|
1804
|
+
const url = `${__privateGet(this, _options).fhirEndpoint}${__privateGet(this, _stsfhirapiroot)}/${resource}/${id}`;
|
|
3807
1805
|
const response = await __privateGet(this, _InvokeResourceAPI).call(this, url, "delete", null, null, errorCb);
|
|
3808
1806
|
if (response) {
|
|
3809
1807
|
return response.data;
|
|
@@ -3812,7 +1810,7 @@ class FhirClient {
|
|
|
3812
1810
|
}
|
|
3813
1811
|
});
|
|
3814
1812
|
__publicField(this, "DeleteResources", async (resource, domainResources, errorCb) => {
|
|
3815
|
-
const url = `${__privateGet(this, _options).fhirEndpoint}${
|
|
1813
|
+
const url = `${__privateGet(this, _options).fhirEndpoint}${__privateGet(this, _stsfhirapiroot)}/${resource}`;
|
|
3816
1814
|
const response = await __privateGet(this, _InvokeResourceAPI).call(this, url, "delete", domainResources, null, errorCb);
|
|
3817
1815
|
if (response) {
|
|
3818
1816
|
return response.data;
|
|
@@ -3821,7 +1819,7 @@ class FhirClient {
|
|
|
3821
1819
|
}
|
|
3822
1820
|
});
|
|
3823
1821
|
__publicField(this, "GetLatency", async () => {
|
|
3824
|
-
const url = `${__privateGet(this, _options).fhirEndpoint}${
|
|
1822
|
+
const url = `${__privateGet(this, _options).fhirEndpoint}${__privateGet(this, _stsfhirapiroot)}/latency`;
|
|
3825
1823
|
try {
|
|
3826
1824
|
const headers = {
|
|
3827
1825
|
"Content-Type": "application/json"
|
|
@@ -3841,6 +1839,9 @@ class FhirClient {
|
|
|
3841
1839
|
}
|
|
3842
1840
|
});
|
|
3843
1841
|
__privateSet(this, _options, options);
|
|
1842
|
+
if (__privateGet(this, _options).stsfhirapiroot !== void 0) {
|
|
1843
|
+
__privateSet(this, _stsfhirapiroot, __privateGet(this, _options).stsfhirapiroot);
|
|
1844
|
+
}
|
|
3844
1845
|
}
|
|
3845
1846
|
get options() {
|
|
3846
1847
|
return __privateGet(this, _options);
|
|
@@ -3853,6 +1854,7 @@ _invokeMethods = new WeakMap();
|
|
|
3853
1854
|
_maxRetries = new WeakMap();
|
|
3854
1855
|
_sleepDuration = new WeakMap();
|
|
3855
1856
|
_NoRetryStatusCodes = new WeakMap();
|
|
1857
|
+
_stsfhirapiroot = new WeakMap();
|
|
3856
1858
|
_LogDebugMessage = new WeakMap();
|
|
3857
1859
|
_LogErrorMessage = new WeakMap();
|
|
3858
1860
|
_GetHttpsAgent = new WeakMap();
|