hpke 0.4.0 → 0.5.0

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.
@@ -1,4625 +0,0 @@
1
- var __create = Object.create;
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __getProtoOf = Object.getPrototypeOf;
6
- var __hasOwnProp = Object.prototype.hasOwnProperty;
7
- var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
8
- get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
9
- }) : x)(function(x) {
10
- if (typeof require !== "undefined")
11
- return require.apply(this, arguments);
12
- throw new Error('Dynamic require of "' + x + '" is not supported');
13
- });
14
- var __commonJS = (cb, mod) => function __require2() {
15
- return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
16
- };
17
- var __copyProps = (to, from, except, desc) => {
18
- if (from && typeof from === "object" || typeof from === "function") {
19
- for (let key of __getOwnPropNames(from))
20
- if (!__hasOwnProp.call(to, key) && key !== except)
21
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
22
- }
23
- return to;
24
- };
25
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target, mod));
26
-
27
- // node_modules/assertion-error/index.js
28
- var require_assertion_error = __commonJS({
29
- "node_modules/assertion-error/index.js"(exports, module) {
30
- function exclude() {
31
- var excludes = [].slice.call(arguments);
32
- function excludeProps(res, obj) {
33
- Object.keys(obj).forEach(function(key) {
34
- if (!~excludes.indexOf(key))
35
- res[key] = obj[key];
36
- });
37
- }
38
- return function extendExclude() {
39
- var args = [].slice.call(arguments), i = 0, res = {};
40
- for (; i < args.length; i++) {
41
- excludeProps(res, args[i]);
42
- }
43
- return res;
44
- };
45
- }
46
- module.exports = AssertionError2;
47
- function AssertionError2(message, _props, ssf) {
48
- var extend = exclude("name", "message", "stack", "constructor", "toJSON"), props = extend(_props || {});
49
- this.message = message || "Unspecified AssertionError";
50
- this.showDiff = false;
51
- for (var key in props) {
52
- this[key] = props[key];
53
- }
54
- ssf = ssf || AssertionError2;
55
- if (Error.captureStackTrace) {
56
- Error.captureStackTrace(this, ssf);
57
- } else {
58
- try {
59
- throw new Error();
60
- } catch (e) {
61
- this.stack = e.stack;
62
- }
63
- }
64
- }
65
- AssertionError2.prototype = Object.create(Error.prototype);
66
- AssertionError2.prototype.name = "AssertionError";
67
- AssertionError2.prototype.constructor = AssertionError2;
68
- AssertionError2.prototype.toJSON = function(stack) {
69
- var extend = exclude("constructor", "toJSON", "stack"), props = extend({ name: this.name }, this);
70
- if (false !== stack && this.stack) {
71
- props.stack = this.stack;
72
- }
73
- return props;
74
- };
75
- }
76
- });
77
-
78
- // node_modules/pathval/index.js
79
- var require_pathval = __commonJS({
80
- "node_modules/pathval/index.js"(exports, module) {
81
- "use strict";
82
- function hasProperty(obj, name) {
83
- if (typeof obj === "undefined" || obj === null) {
84
- return false;
85
- }
86
- return name in Object(obj);
87
- }
88
- function parsePath(path) {
89
- var str = path.replace(/([^\\])\[/g, "$1.[");
90
- var parts = str.match(/(\\\.|[^.]+?)+/g);
91
- return parts.map(function mapMatches(value) {
92
- if (value === "constructor" || value === "__proto__" || value === "prototype") {
93
- return {};
94
- }
95
- var regexp = /^\[(\d+)\]$/;
96
- var mArr = regexp.exec(value);
97
- var parsed = null;
98
- if (mArr) {
99
- parsed = { i: parseFloat(mArr[1]) };
100
- } else {
101
- parsed = { p: value.replace(/\\([.[\]])/g, "$1") };
102
- }
103
- return parsed;
104
- });
105
- }
106
- function internalGetPathValue(obj, parsed, pathDepth) {
107
- var temporaryValue = obj;
108
- var res = null;
109
- pathDepth = typeof pathDepth === "undefined" ? parsed.length : pathDepth;
110
- for (var i = 0; i < pathDepth; i++) {
111
- var part = parsed[i];
112
- if (temporaryValue) {
113
- if (typeof part.p === "undefined") {
114
- temporaryValue = temporaryValue[part.i];
115
- } else {
116
- temporaryValue = temporaryValue[part.p];
117
- }
118
- if (i === pathDepth - 1) {
119
- res = temporaryValue;
120
- }
121
- }
122
- }
123
- return res;
124
- }
125
- function internalSetPathValue(obj, val, parsed) {
126
- var tempObj = obj;
127
- var pathDepth = parsed.length;
128
- var part = null;
129
- for (var i = 0; i < pathDepth; i++) {
130
- var propName = null;
131
- var propVal = null;
132
- part = parsed[i];
133
- if (i === pathDepth - 1) {
134
- propName = typeof part.p === "undefined" ? part.i : part.p;
135
- tempObj[propName] = val;
136
- } else if (typeof part.p !== "undefined" && tempObj[part.p]) {
137
- tempObj = tempObj[part.p];
138
- } else if (typeof part.i !== "undefined" && tempObj[part.i]) {
139
- tempObj = tempObj[part.i];
140
- } else {
141
- var next = parsed[i + 1];
142
- propName = typeof part.p === "undefined" ? part.i : part.p;
143
- propVal = typeof next.p === "undefined" ? [] : {};
144
- tempObj[propName] = propVal;
145
- tempObj = tempObj[propName];
146
- }
147
- }
148
- }
149
- function getPathInfo(obj, path) {
150
- var parsed = parsePath(path);
151
- var last = parsed[parsed.length - 1];
152
- var info = {
153
- parent: parsed.length > 1 ? internalGetPathValue(obj, parsed, parsed.length - 1) : obj,
154
- name: last.p || last.i,
155
- value: internalGetPathValue(obj, parsed)
156
- };
157
- info.exists = hasProperty(info.parent, info.name);
158
- return info;
159
- }
160
- function getPathValue(obj, path) {
161
- var info = getPathInfo(obj, path);
162
- return info.value;
163
- }
164
- function setPathValue(obj, path, val) {
165
- var parsed = parsePath(path);
166
- internalSetPathValue(obj, val, parsed);
167
- return obj;
168
- }
169
- module.exports = {
170
- hasProperty,
171
- getPathInfo,
172
- getPathValue,
173
- setPathValue
174
- };
175
- }
176
- });
177
-
178
- // node_modules/chai/lib/chai/utils/flag.js
179
- var require_flag = __commonJS({
180
- "node_modules/chai/lib/chai/utils/flag.js"(exports, module) {
181
- module.exports = function flag(obj, key, value) {
182
- var flags = obj.__flags || (obj.__flags = /* @__PURE__ */ Object.create(null));
183
- if (arguments.length === 3) {
184
- flags[key] = value;
185
- } else {
186
- return flags[key];
187
- }
188
- };
189
- }
190
- });
191
-
192
- // node_modules/chai/lib/chai/utils/test.js
193
- var require_test = __commonJS({
194
- "node_modules/chai/lib/chai/utils/test.js"(exports, module) {
195
- var flag = require_flag();
196
- module.exports = function test(obj, args) {
197
- var negate = flag(obj, "negate"), expr = args[0];
198
- return negate ? !expr : expr;
199
- };
200
- }
201
- });
202
-
203
- // node_modules/type-detect/type-detect.js
204
- var require_type_detect = __commonJS({
205
- "node_modules/type-detect/type-detect.js"(exports, module) {
206
- (function(global2, factory) {
207
- typeof exports === "object" && typeof module !== "undefined" ? module.exports = factory() : typeof define === "function" && define.amd ? define(factory) : global2.typeDetect = factory();
208
- })(exports, function() {
209
- "use strict";
210
- var promiseExists = typeof Promise === "function";
211
- var globalObject = typeof self === "object" ? self : global;
212
- var symbolExists = typeof Symbol !== "undefined";
213
- var mapExists = typeof Map !== "undefined";
214
- var setExists = typeof Set !== "undefined";
215
- var weakMapExists = typeof WeakMap !== "undefined";
216
- var weakSetExists = typeof WeakSet !== "undefined";
217
- var dataViewExists = typeof DataView !== "undefined";
218
- var symbolIteratorExists = symbolExists && typeof Symbol.iterator !== "undefined";
219
- var symbolToStringTagExists = symbolExists && typeof Symbol.toStringTag !== "undefined";
220
- var setEntriesExists = setExists && typeof Set.prototype.entries === "function";
221
- var mapEntriesExists = mapExists && typeof Map.prototype.entries === "function";
222
- var setIteratorPrototype = setEntriesExists && Object.getPrototypeOf((/* @__PURE__ */ new Set()).entries());
223
- var mapIteratorPrototype = mapEntriesExists && Object.getPrototypeOf((/* @__PURE__ */ new Map()).entries());
224
- var arrayIteratorExists = symbolIteratorExists && typeof Array.prototype[Symbol.iterator] === "function";
225
- var arrayIteratorPrototype = arrayIteratorExists && Object.getPrototypeOf([][Symbol.iterator]());
226
- var stringIteratorExists = symbolIteratorExists && typeof String.prototype[Symbol.iterator] === "function";
227
- var stringIteratorPrototype = stringIteratorExists && Object.getPrototypeOf(""[Symbol.iterator]());
228
- var toStringLeftSliceLength = 8;
229
- var toStringRightSliceLength = -1;
230
- function typeDetect(obj) {
231
- var typeofObj = typeof obj;
232
- if (typeofObj !== "object") {
233
- return typeofObj;
234
- }
235
- if (obj === null) {
236
- return "null";
237
- }
238
- if (obj === globalObject) {
239
- return "global";
240
- }
241
- if (Array.isArray(obj) && (symbolToStringTagExists === false || !(Symbol.toStringTag in obj))) {
242
- return "Array";
243
- }
244
- if (typeof window === "object" && window !== null) {
245
- if (typeof window.location === "object" && obj === window.location) {
246
- return "Location";
247
- }
248
- if (typeof window.document === "object" && obj === window.document) {
249
- return "Document";
250
- }
251
- if (typeof window.navigator === "object") {
252
- if (typeof window.navigator.mimeTypes === "object" && obj === window.navigator.mimeTypes) {
253
- return "MimeTypeArray";
254
- }
255
- if (typeof window.navigator.plugins === "object" && obj === window.navigator.plugins) {
256
- return "PluginArray";
257
- }
258
- }
259
- if ((typeof window.HTMLElement === "function" || typeof window.HTMLElement === "object") && obj instanceof window.HTMLElement) {
260
- if (obj.tagName === "BLOCKQUOTE") {
261
- return "HTMLQuoteElement";
262
- }
263
- if (obj.tagName === "TD") {
264
- return "HTMLTableDataCellElement";
265
- }
266
- if (obj.tagName === "TH") {
267
- return "HTMLTableHeaderCellElement";
268
- }
269
- }
270
- }
271
- var stringTag = symbolToStringTagExists && obj[Symbol.toStringTag];
272
- if (typeof stringTag === "string") {
273
- return stringTag;
274
- }
275
- var objPrototype = Object.getPrototypeOf(obj);
276
- if (objPrototype === RegExp.prototype) {
277
- return "RegExp";
278
- }
279
- if (objPrototype === Date.prototype) {
280
- return "Date";
281
- }
282
- if (promiseExists && objPrototype === Promise.prototype) {
283
- return "Promise";
284
- }
285
- if (setExists && objPrototype === Set.prototype) {
286
- return "Set";
287
- }
288
- if (mapExists && objPrototype === Map.prototype) {
289
- return "Map";
290
- }
291
- if (weakSetExists && objPrototype === WeakSet.prototype) {
292
- return "WeakSet";
293
- }
294
- if (weakMapExists && objPrototype === WeakMap.prototype) {
295
- return "WeakMap";
296
- }
297
- if (dataViewExists && objPrototype === DataView.prototype) {
298
- return "DataView";
299
- }
300
- if (mapExists && objPrototype === mapIteratorPrototype) {
301
- return "Map Iterator";
302
- }
303
- if (setExists && objPrototype === setIteratorPrototype) {
304
- return "Set Iterator";
305
- }
306
- if (arrayIteratorExists && objPrototype === arrayIteratorPrototype) {
307
- return "Array Iterator";
308
- }
309
- if (stringIteratorExists && objPrototype === stringIteratorPrototype) {
310
- return "String Iterator";
311
- }
312
- if (objPrototype === null) {
313
- return "Object";
314
- }
315
- return Object.prototype.toString.call(obj).slice(toStringLeftSliceLength, toStringRightSliceLength);
316
- }
317
- return typeDetect;
318
- });
319
- }
320
- });
321
-
322
- // node_modules/chai/lib/chai/utils/expectTypes.js
323
- var require_expectTypes = __commonJS({
324
- "node_modules/chai/lib/chai/utils/expectTypes.js"(exports, module) {
325
- var AssertionError2 = require_assertion_error();
326
- var flag = require_flag();
327
- var type = require_type_detect();
328
- module.exports = function expectTypes(obj, types) {
329
- var flagMsg = flag(obj, "message");
330
- var ssfi = flag(obj, "ssfi");
331
- flagMsg = flagMsg ? flagMsg + ": " : "";
332
- obj = flag(obj, "object");
333
- types = types.map(function(t) {
334
- return t.toLowerCase();
335
- });
336
- types.sort();
337
- var str = types.map(function(t, index) {
338
- var art = ~["a", "e", "i", "o", "u"].indexOf(t.charAt(0)) ? "an" : "a";
339
- var or = types.length > 1 && index === types.length - 1 ? "or " : "";
340
- return or + art + " " + t;
341
- }).join(", ");
342
- var objType = type(obj).toLowerCase();
343
- if (!types.some(function(expected) {
344
- return objType === expected;
345
- })) {
346
- throw new AssertionError2(flagMsg + "object tested must be " + str + ", but " + objType + " given", void 0, ssfi);
347
- }
348
- };
349
- }
350
- });
351
-
352
- // node_modules/chai/lib/chai/utils/getActual.js
353
- var require_getActual = __commonJS({
354
- "node_modules/chai/lib/chai/utils/getActual.js"(exports, module) {
355
- module.exports = function getActual(obj, args) {
356
- return args.length > 4 ? args[4] : obj._obj;
357
- };
358
- }
359
- });
360
-
361
- // node_modules/get-func-name/index.js
362
- var require_get_func_name = __commonJS({
363
- "node_modules/get-func-name/index.js"(exports, module) {
364
- "use strict";
365
- var toString = Function.prototype.toString;
366
- var functionNameMatch = /\s*function(?:\s|\s*\/\*[^(?:*\/)]+\*\/\s*)*([^\s\(\/]+)/;
367
- function getFuncName(aFunc) {
368
- if (typeof aFunc !== "function") {
369
- return null;
370
- }
371
- var name = "";
372
- if (typeof Function.prototype.name === "undefined" && typeof aFunc.name === "undefined") {
373
- var match = toString.call(aFunc).match(functionNameMatch);
374
- if (match) {
375
- name = match[1];
376
- }
377
- } else {
378
- name = aFunc.name;
379
- }
380
- return name;
381
- }
382
- module.exports = getFuncName;
383
- }
384
- });
385
-
386
- // node_modules/loupe/loupe.js
387
- var require_loupe = __commonJS({
388
- "node_modules/loupe/loupe.js"(exports, module) {
389
- (function(global2, factory) {
390
- typeof exports === "object" && typeof module !== "undefined" ? factory(exports) : typeof define === "function" && define.amd ? define(["exports"], factory) : (global2 = typeof globalThis !== "undefined" ? globalThis : global2 || self, factory(global2.loupe = {}));
391
- })(exports, function(exports2) {
392
- "use strict";
393
- function _typeof(obj) {
394
- "@babel/helpers - typeof";
395
- if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
396
- _typeof = function(obj2) {
397
- return typeof obj2;
398
- };
399
- } else {
400
- _typeof = function(obj2) {
401
- return obj2 && typeof Symbol === "function" && obj2.constructor === Symbol && obj2 !== Symbol.prototype ? "symbol" : typeof obj2;
402
- };
403
- }
404
- return _typeof(obj);
405
- }
406
- function _slicedToArray(arr, i) {
407
- return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest();
408
- }
409
- function _arrayWithHoles(arr) {
410
- if (Array.isArray(arr))
411
- return arr;
412
- }
413
- function _iterableToArrayLimit(arr, i) {
414
- if (typeof Symbol === "undefined" || !(Symbol.iterator in Object(arr)))
415
- return;
416
- var _arr = [];
417
- var _n = true;
418
- var _d = false;
419
- var _e = void 0;
420
- try {
421
- for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) {
422
- _arr.push(_s.value);
423
- if (i && _arr.length === i)
424
- break;
425
- }
426
- } catch (err) {
427
- _d = true;
428
- _e = err;
429
- } finally {
430
- try {
431
- if (!_n && _i["return"] != null)
432
- _i["return"]();
433
- } finally {
434
- if (_d)
435
- throw _e;
436
- }
437
- }
438
- return _arr;
439
- }
440
- function _unsupportedIterableToArray(o, minLen) {
441
- if (!o)
442
- return;
443
- if (typeof o === "string")
444
- return _arrayLikeToArray(o, minLen);
445
- var n = Object.prototype.toString.call(o).slice(8, -1);
446
- if (n === "Object" && o.constructor)
447
- n = o.constructor.name;
448
- if (n === "Map" || n === "Set")
449
- return Array.from(o);
450
- if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))
451
- return _arrayLikeToArray(o, minLen);
452
- }
453
- function _arrayLikeToArray(arr, len) {
454
- if (len == null || len > arr.length)
455
- len = arr.length;
456
- for (var i = 0, arr2 = new Array(len); i < len; i++)
457
- arr2[i] = arr[i];
458
- return arr2;
459
- }
460
- function _nonIterableRest() {
461
- throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
462
- }
463
- var ansiColors = {
464
- bold: ["1", "22"],
465
- dim: ["2", "22"],
466
- italic: ["3", "23"],
467
- underline: ["4", "24"],
468
- inverse: ["7", "27"],
469
- hidden: ["8", "28"],
470
- strike: ["9", "29"],
471
- black: ["30", "39"],
472
- red: ["31", "39"],
473
- green: ["32", "39"],
474
- yellow: ["33", "39"],
475
- blue: ["34", "39"],
476
- magenta: ["35", "39"],
477
- cyan: ["36", "39"],
478
- white: ["37", "39"],
479
- brightblack: ["30;1", "39"],
480
- brightred: ["31;1", "39"],
481
- brightgreen: ["32;1", "39"],
482
- brightyellow: ["33;1", "39"],
483
- brightblue: ["34;1", "39"],
484
- brightmagenta: ["35;1", "39"],
485
- brightcyan: ["36;1", "39"],
486
- brightwhite: ["37;1", "39"],
487
- grey: ["90", "39"]
488
- };
489
- var styles = {
490
- special: "cyan",
491
- number: "yellow",
492
- bigint: "yellow",
493
- boolean: "yellow",
494
- undefined: "grey",
495
- null: "bold",
496
- string: "green",
497
- symbol: "green",
498
- date: "magenta",
499
- regexp: "red"
500
- };
501
- var truncator = "\u2026";
502
- function colorise(value, styleType) {
503
- var color = ansiColors[styles[styleType]] || ansiColors[styleType];
504
- if (!color) {
505
- return String(value);
506
- }
507
- return "\x1B[".concat(color[0], "m").concat(String(value), "\x1B[").concat(color[1], "m");
508
- }
509
- function normaliseOptions() {
510
- var _ref = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {}, _ref$showHidden = _ref.showHidden, showHidden = _ref$showHidden === void 0 ? false : _ref$showHidden, _ref$depth = _ref.depth, depth = _ref$depth === void 0 ? 2 : _ref$depth, _ref$colors = _ref.colors, colors = _ref$colors === void 0 ? false : _ref$colors, _ref$customInspect = _ref.customInspect, customInspect = _ref$customInspect === void 0 ? true : _ref$customInspect, _ref$showProxy = _ref.showProxy, showProxy = _ref$showProxy === void 0 ? false : _ref$showProxy, _ref$maxArrayLength = _ref.maxArrayLength, maxArrayLength = _ref$maxArrayLength === void 0 ? Infinity : _ref$maxArrayLength, _ref$breakLength = _ref.breakLength, breakLength = _ref$breakLength === void 0 ? Infinity : _ref$breakLength, _ref$seen = _ref.seen, seen = _ref$seen === void 0 ? [] : _ref$seen, _ref$truncate = _ref.truncate, truncate2 = _ref$truncate === void 0 ? Infinity : _ref$truncate, _ref$stylize = _ref.stylize, stylize = _ref$stylize === void 0 ? String : _ref$stylize;
511
- var options = {
512
- showHidden: Boolean(showHidden),
513
- depth: Number(depth),
514
- colors: Boolean(colors),
515
- customInspect: Boolean(customInspect),
516
- showProxy: Boolean(showProxy),
517
- maxArrayLength: Number(maxArrayLength),
518
- breakLength: Number(breakLength),
519
- truncate: Number(truncate2),
520
- seen,
521
- stylize
522
- };
523
- if (options.colors) {
524
- options.stylize = colorise;
525
- }
526
- return options;
527
- }
528
- function truncate(string, length) {
529
- var tail = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : truncator;
530
- string = String(string);
531
- var tailLength = tail.length;
532
- var stringLength = string.length;
533
- if (tailLength > length && stringLength > tailLength) {
534
- return tail;
535
- }
536
- if (stringLength > length && stringLength > tailLength) {
537
- return "".concat(string.slice(0, length - tailLength)).concat(tail);
538
- }
539
- return string;
540
- }
541
- function inspectList(list, options, inspectItem) {
542
- var separator = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : ", ";
543
- inspectItem = inspectItem || options.inspect;
544
- var size = list.length;
545
- if (size === 0)
546
- return "";
547
- var originalLength = options.truncate;
548
- var output = "";
549
- var peek = "";
550
- var truncated = "";
551
- for (var i = 0; i < size; i += 1) {
552
- var last = i + 1 === list.length;
553
- var secondToLast = i + 2 === list.length;
554
- truncated = "".concat(truncator, "(").concat(list.length - i, ")");
555
- var value = list[i];
556
- options.truncate = originalLength - output.length - (last ? 0 : separator.length);
557
- var string = peek || inspectItem(value, options) + (last ? "" : separator);
558
- var nextLength = output.length + string.length;
559
- var truncatedLength = nextLength + truncated.length;
560
- if (last && nextLength > originalLength && output.length + truncated.length <= originalLength) {
561
- break;
562
- }
563
- if (!last && !secondToLast && truncatedLength > originalLength) {
564
- break;
565
- }
566
- peek = last ? "" : inspectItem(list[i + 1], options) + (secondToLast ? "" : separator);
567
- if (!last && secondToLast && truncatedLength > originalLength && nextLength + peek.length > originalLength) {
568
- break;
569
- }
570
- output += string;
571
- if (!last && !secondToLast && nextLength + peek.length >= originalLength) {
572
- truncated = "".concat(truncator, "(").concat(list.length - i - 1, ")");
573
- break;
574
- }
575
- truncated = "";
576
- }
577
- return "".concat(output).concat(truncated);
578
- }
579
- function quoteComplexKey(key) {
580
- if (key.match(/^[a-zA-Z_][a-zA-Z_0-9]*$/)) {
581
- return key;
582
- }
583
- return JSON.stringify(key).replace(/'/g, "\\'").replace(/\\"/g, '"').replace(/(^"|"$)/g, "'");
584
- }
585
- function inspectProperty(_ref2, options) {
586
- var _ref3 = _slicedToArray(_ref2, 2), key = _ref3[0], value = _ref3[1];
587
- options.truncate -= 2;
588
- if (typeof key === "string") {
589
- key = quoteComplexKey(key);
590
- } else if (typeof key !== "number") {
591
- key = "[".concat(options.inspect(key, options), "]");
592
- }
593
- options.truncate -= key.length;
594
- value = options.inspect(value, options);
595
- return "".concat(key, ": ").concat(value);
596
- }
597
- function inspectArray(array, options) {
598
- var nonIndexProperties = Object.keys(array).slice(array.length);
599
- if (!array.length && !nonIndexProperties.length)
600
- return "[]";
601
- options.truncate -= 4;
602
- var listContents = inspectList(array, options);
603
- options.truncate -= listContents.length;
604
- var propertyContents = "";
605
- if (nonIndexProperties.length) {
606
- propertyContents = inspectList(nonIndexProperties.map(function(key) {
607
- return [key, array[key]];
608
- }), options, inspectProperty);
609
- }
610
- return "[ ".concat(listContents).concat(propertyContents ? ", ".concat(propertyContents) : "", " ]");
611
- }
612
- var toString = Function.prototype.toString;
613
- var functionNameMatch = /\s*function(?:\s|\s*\/\*[^(?:*\/)]+\*\/\s*)*([^\s\(\/]+)/;
614
- function getFuncName(aFunc) {
615
- if (typeof aFunc !== "function") {
616
- return null;
617
- }
618
- var name = "";
619
- if (typeof Function.prototype.name === "undefined" && typeof aFunc.name === "undefined") {
620
- var match = toString.call(aFunc).match(functionNameMatch);
621
- if (match) {
622
- name = match[1];
623
- }
624
- } else {
625
- name = aFunc.name;
626
- }
627
- return name;
628
- }
629
- var getFuncName_1 = getFuncName;
630
- var getArrayName = function getArrayName2(array) {
631
- if (typeof Buffer === "function" && array instanceof Buffer) {
632
- return "Buffer";
633
- }
634
- if (array[Symbol.toStringTag]) {
635
- return array[Symbol.toStringTag];
636
- }
637
- return getFuncName_1(array.constructor);
638
- };
639
- function inspectTypedArray(array, options) {
640
- var name = getArrayName(array);
641
- options.truncate -= name.length + 4;
642
- var nonIndexProperties = Object.keys(array).slice(array.length);
643
- if (!array.length && !nonIndexProperties.length)
644
- return "".concat(name, "[]");
645
- var output = "";
646
- for (var i = 0; i < array.length; i++) {
647
- var string = "".concat(options.stylize(truncate(array[i], options.truncate), "number")).concat(i === array.length - 1 ? "" : ", ");
648
- options.truncate -= string.length;
649
- if (array[i] !== array.length && options.truncate <= 3) {
650
- output += "".concat(truncator, "(").concat(array.length - array[i] + 1, ")");
651
- break;
652
- }
653
- output += string;
654
- }
655
- var propertyContents = "";
656
- if (nonIndexProperties.length) {
657
- propertyContents = inspectList(nonIndexProperties.map(function(key) {
658
- return [key, array[key]];
659
- }), options, inspectProperty);
660
- }
661
- return "".concat(name, "[ ").concat(output).concat(propertyContents ? ", ".concat(propertyContents) : "", " ]");
662
- }
663
- function inspectDate(dateObject, options) {
664
- var split = dateObject.toJSON().split("T");
665
- var date = split[0];
666
- return options.stylize("".concat(date, "T").concat(truncate(split[1], options.truncate - date.length - 1)), "date");
667
- }
668
- function inspectFunction(func, options) {
669
- var name = getFuncName_1(func);
670
- if (!name) {
671
- return options.stylize("[Function]", "special");
672
- }
673
- return options.stylize("[Function ".concat(truncate(name, options.truncate - 11), "]"), "special");
674
- }
675
- function inspectMapEntry(_ref, options) {
676
- var _ref2 = _slicedToArray(_ref, 2), key = _ref2[0], value = _ref2[1];
677
- options.truncate -= 4;
678
- key = options.inspect(key, options);
679
- options.truncate -= key.length;
680
- value = options.inspect(value, options);
681
- return "".concat(key, " => ").concat(value);
682
- }
683
- function mapToEntries(map) {
684
- var entries = [];
685
- map.forEach(function(value, key) {
686
- entries.push([key, value]);
687
- });
688
- return entries;
689
- }
690
- function inspectMap(map, options) {
691
- var size = map.size - 1;
692
- if (size <= 0) {
693
- return "Map{}";
694
- }
695
- options.truncate -= 7;
696
- return "Map{ ".concat(inspectList(mapToEntries(map), options, inspectMapEntry), " }");
697
- }
698
- var isNaN = Number.isNaN || function(i) {
699
- return i !== i;
700
- };
701
- function inspectNumber(number, options) {
702
- if (isNaN(number)) {
703
- return options.stylize("NaN", "number");
704
- }
705
- if (number === Infinity) {
706
- return options.stylize("Infinity", "number");
707
- }
708
- if (number === -Infinity) {
709
- return options.stylize("-Infinity", "number");
710
- }
711
- if (number === 0) {
712
- return options.stylize(1 / number === Infinity ? "+0" : "-0", "number");
713
- }
714
- return options.stylize(truncate(number, options.truncate), "number");
715
- }
716
- function inspectBigInt(number, options) {
717
- var nums = truncate(number.toString(), options.truncate - 1);
718
- if (nums !== truncator)
719
- nums += "n";
720
- return options.stylize(nums, "bigint");
721
- }
722
- function inspectRegExp(value, options) {
723
- var flags = value.toString().split("/")[2];
724
- var sourceLength = options.truncate - (2 + flags.length);
725
- var source = value.source;
726
- return options.stylize("/".concat(truncate(source, sourceLength), "/").concat(flags), "regexp");
727
- }
728
- function arrayFromSet(set) {
729
- var values = [];
730
- set.forEach(function(value) {
731
- values.push(value);
732
- });
733
- return values;
734
- }
735
- function inspectSet(set, options) {
736
- if (set.size === 0)
737
- return "Set{}";
738
- options.truncate -= 7;
739
- return "Set{ ".concat(inspectList(arrayFromSet(set), options), " }");
740
- }
741
- var stringEscapeChars = new RegExp("['\\u0000-\\u001f\\u007f-\\u009f\\u00ad\\u0600-\\u0604\\u070f\\u17b4\\u17b5\\u200c-\\u200f\\u2028-\\u202f\\u2060-\\u206f\\ufeff\\ufff0-\\uffff]", "g");
742
- var escapeCharacters = {
743
- "\b": "\\b",
744
- " ": "\\t",
745
- "\n": "\\n",
746
- "\f": "\\f",
747
- "\r": "\\r",
748
- "'": "\\'",
749
- "\\": "\\\\"
750
- };
751
- var hex = 16;
752
- var unicodeLength = 4;
753
- function escape(char) {
754
- return escapeCharacters[char] || "\\u".concat("0000".concat(char.charCodeAt(0).toString(hex)).slice(-unicodeLength));
755
- }
756
- function inspectString(string, options) {
757
- if (stringEscapeChars.test(string)) {
758
- string = string.replace(stringEscapeChars, escape);
759
- }
760
- return options.stylize("'".concat(truncate(string, options.truncate - 2), "'"), "string");
761
- }
762
- function inspectSymbol(value) {
763
- if ("description" in Symbol.prototype) {
764
- return value.description ? "Symbol(".concat(value.description, ")") : "Symbol()";
765
- }
766
- return value.toString();
767
- }
768
- var getPromiseValue = function getPromiseValue2() {
769
- return "Promise{\u2026}";
770
- };
771
- try {
772
- var _process$binding = process.binding("util"), getPromiseDetails = _process$binding.getPromiseDetails, kPending = _process$binding.kPending, kRejected = _process$binding.kRejected;
773
- if (Array.isArray(getPromiseDetails(Promise.resolve()))) {
774
- getPromiseValue = function getPromiseValue2(value, options) {
775
- var _getPromiseDetails = getPromiseDetails(value), _getPromiseDetails2 = _slicedToArray(_getPromiseDetails, 2), state = _getPromiseDetails2[0], innerValue = _getPromiseDetails2[1];
776
- if (state === kPending) {
777
- return "Promise{<pending>}";
778
- }
779
- return "Promise".concat(state === kRejected ? "!" : "", "{").concat(options.inspect(innerValue, options), "}");
780
- };
781
- }
782
- } catch (notNode) {
783
- }
784
- var inspectPromise = getPromiseValue;
785
- function inspectObject(object, options) {
786
- var properties = Object.getOwnPropertyNames(object);
787
- var symbols = Object.getOwnPropertySymbols ? Object.getOwnPropertySymbols(object) : [];
788
- if (properties.length === 0 && symbols.length === 0) {
789
- return "{}";
790
- }
791
- options.truncate -= 4;
792
- options.seen = options.seen || [];
793
- if (options.seen.indexOf(object) >= 0) {
794
- return "[Circular]";
795
- }
796
- options.seen.push(object);
797
- var propertyContents = inspectList(properties.map(function(key) {
798
- return [key, object[key]];
799
- }), options, inspectProperty);
800
- var symbolContents = inspectList(symbols.map(function(key) {
801
- return [key, object[key]];
802
- }), options, inspectProperty);
803
- options.seen.pop();
804
- var sep = "";
805
- if (propertyContents && symbolContents) {
806
- sep = ", ";
807
- }
808
- return "{ ".concat(propertyContents).concat(sep).concat(symbolContents, " }");
809
- }
810
- var toStringTag = typeof Symbol !== "undefined" && Symbol.toStringTag ? Symbol.toStringTag : false;
811
- function inspectClass(value, options) {
812
- var name = "";
813
- if (toStringTag && toStringTag in value) {
814
- name = value[toStringTag];
815
- }
816
- name = name || getFuncName_1(value.constructor);
817
- if (!name || name === "_class") {
818
- name = "<Anonymous Class>";
819
- }
820
- options.truncate -= name.length;
821
- return "".concat(name).concat(inspectObject(value, options));
822
- }
823
- function inspectArguments(args, options) {
824
- if (args.length === 0)
825
- return "Arguments[]";
826
- options.truncate -= 13;
827
- return "Arguments[ ".concat(inspectList(args, options), " ]");
828
- }
829
- var errorKeys = ["stack", "line", "column", "name", "message", "fileName", "lineNumber", "columnNumber", "number", "description"];
830
- function inspectObject$1(error, options) {
831
- var properties = Object.getOwnPropertyNames(error).filter(function(key) {
832
- return errorKeys.indexOf(key) === -1;
833
- });
834
- var name = error.name;
835
- options.truncate -= name.length;
836
- var message = "";
837
- if (typeof error.message === "string") {
838
- message = truncate(error.message, options.truncate);
839
- } else {
840
- properties.unshift("message");
841
- }
842
- message = message ? ": ".concat(message) : "";
843
- options.truncate -= message.length + 5;
844
- var propertyContents = inspectList(properties.map(function(key) {
845
- return [key, error[key]];
846
- }), options, inspectProperty);
847
- return "".concat(name).concat(message).concat(propertyContents ? " { ".concat(propertyContents, " }") : "");
848
- }
849
- function inspectAttribute(_ref, options) {
850
- var _ref2 = _slicedToArray(_ref, 2), key = _ref2[0], value = _ref2[1];
851
- options.truncate -= 3;
852
- if (!value) {
853
- return "".concat(options.stylize(key, "yellow"));
854
- }
855
- return "".concat(options.stylize(key, "yellow"), "=").concat(options.stylize('"'.concat(value, '"'), "string"));
856
- }
857
- function inspectHTMLCollection(collection, options) {
858
- return inspectList(collection, options, inspectHTML, "\n");
859
- }
860
- function inspectHTML(element, options) {
861
- var properties = element.getAttributeNames();
862
- var name = element.tagName.toLowerCase();
863
- var head = options.stylize("<".concat(name), "special");
864
- var headClose = options.stylize(">", "special");
865
- var tail = options.stylize("</".concat(name, ">"), "special");
866
- options.truncate -= name.length * 2 + 5;
867
- var propertyContents = "";
868
- if (properties.length > 0) {
869
- propertyContents += " ";
870
- propertyContents += inspectList(properties.map(function(key) {
871
- return [key, element.getAttribute(key)];
872
- }), options, inspectAttribute, " ");
873
- }
874
- options.truncate -= propertyContents.length;
875
- var truncate2 = options.truncate;
876
- var children = inspectHTMLCollection(element.children, options);
877
- if (children && children.length > truncate2) {
878
- children = "".concat(truncator, "(").concat(element.children.length, ")");
879
- }
880
- return "".concat(head).concat(propertyContents).concat(headClose).concat(children).concat(tail);
881
- }
882
- var symbolsSupported = typeof Symbol === "function" && typeof Symbol.for === "function";
883
- var chaiInspect = symbolsSupported ? Symbol.for("chai/inspect") : "@@chai/inspect";
884
- var nodeInspect = false;
885
- try {
886
- var nodeUtil = __require("util");
887
- nodeInspect = nodeUtil.inspect ? nodeUtil.inspect.custom : false;
888
- } catch (noNodeInspect) {
889
- nodeInspect = false;
890
- }
891
- var constructorMap = /* @__PURE__ */ new WeakMap();
892
- var stringTagMap = {};
893
- var baseTypesMap = {
894
- undefined: function undefined$1(value, options) {
895
- return options.stylize("undefined", "undefined");
896
- },
897
- null: function _null(value, options) {
898
- return options.stylize(null, "null");
899
- },
900
- boolean: function boolean(value, options) {
901
- return options.stylize(value, "boolean");
902
- },
903
- Boolean: function Boolean2(value, options) {
904
- return options.stylize(value, "boolean");
905
- },
906
- number: inspectNumber,
907
- Number: inspectNumber,
908
- bigint: inspectBigInt,
909
- BigInt: inspectBigInt,
910
- string: inspectString,
911
- String: inspectString,
912
- function: inspectFunction,
913
- Function: inspectFunction,
914
- symbol: inspectSymbol,
915
- Symbol: inspectSymbol,
916
- Array: inspectArray,
917
- Date: inspectDate,
918
- Map: inspectMap,
919
- Set: inspectSet,
920
- RegExp: inspectRegExp,
921
- Promise: inspectPromise,
922
- WeakSet: function WeakSet2(value, options) {
923
- return options.stylize("WeakSet{\u2026}", "special");
924
- },
925
- WeakMap: function WeakMap2(value, options) {
926
- return options.stylize("WeakMap{\u2026}", "special");
927
- },
928
- Arguments: inspectArguments,
929
- Int8Array: inspectTypedArray,
930
- Uint8Array: inspectTypedArray,
931
- Uint8ClampedArray: inspectTypedArray,
932
- Int16Array: inspectTypedArray,
933
- Uint16Array: inspectTypedArray,
934
- Int32Array: inspectTypedArray,
935
- Uint32Array: inspectTypedArray,
936
- Float32Array: inspectTypedArray,
937
- Float64Array: inspectTypedArray,
938
- Generator: function Generator() {
939
- return "";
940
- },
941
- DataView: function DataView2() {
942
- return "";
943
- },
944
- ArrayBuffer: function ArrayBuffer() {
945
- return "";
946
- },
947
- Error: inspectObject$1,
948
- HTMLCollection: inspectHTMLCollection,
949
- NodeList: inspectHTMLCollection
950
- };
951
- var inspectCustom = function inspectCustom2(value, options, type) {
952
- if (chaiInspect in value && typeof value[chaiInspect] === "function") {
953
- return value[chaiInspect](options);
954
- }
955
- if (nodeInspect && nodeInspect in value && typeof value[nodeInspect] === "function") {
956
- return value[nodeInspect](options.depth, options);
957
- }
958
- if ("inspect" in value && typeof value.inspect === "function") {
959
- return value.inspect(options.depth, options);
960
- }
961
- if ("constructor" in value && constructorMap.has(value.constructor)) {
962
- return constructorMap.get(value.constructor)(value, options);
963
- }
964
- if (stringTagMap[type]) {
965
- return stringTagMap[type](value, options);
966
- }
967
- return "";
968
- };
969
- var toString$1 = Object.prototype.toString;
970
- function inspect(value, options) {
971
- options = normaliseOptions(options);
972
- options.inspect = inspect;
973
- var _options = options, customInspect = _options.customInspect;
974
- var type = value === null ? "null" : _typeof(value);
975
- if (type === "object") {
976
- type = toString$1.call(value).slice(8, -1);
977
- }
978
- if (baseTypesMap[type]) {
979
- return baseTypesMap[type](value, options);
980
- }
981
- if (customInspect && value) {
982
- var output = inspectCustom(value, options, type);
983
- if (output) {
984
- if (typeof output === "string")
985
- return output;
986
- return inspect(output, options);
987
- }
988
- }
989
- var proto = value ? Object.getPrototypeOf(value) : false;
990
- if (proto === Object.prototype || proto === null) {
991
- return inspectObject(value, options);
992
- }
993
- if (value && typeof HTMLElement === "function" && value instanceof HTMLElement) {
994
- return inspectHTML(value, options);
995
- }
996
- if ("constructor" in value) {
997
- if (value.constructor !== Object) {
998
- return inspectClass(value, options);
999
- }
1000
- return inspectObject(value, options);
1001
- }
1002
- if (value === Object(value)) {
1003
- return inspectObject(value, options);
1004
- }
1005
- return options.stylize(String(value), type);
1006
- }
1007
- function registerConstructor(constructor, inspector) {
1008
- if (constructorMap.has(constructor)) {
1009
- return false;
1010
- }
1011
- constructorMap.add(constructor, inspector);
1012
- return true;
1013
- }
1014
- function registerStringTag(stringTag, inspector) {
1015
- if (stringTag in stringTagMap) {
1016
- return false;
1017
- }
1018
- stringTagMap[stringTag] = inspector;
1019
- return true;
1020
- }
1021
- var custom = chaiInspect;
1022
- exports2.custom = custom;
1023
- exports2.default = inspect;
1024
- exports2.inspect = inspect;
1025
- exports2.registerConstructor = registerConstructor;
1026
- exports2.registerStringTag = registerStringTag;
1027
- Object.defineProperty(exports2, "__esModule", { value: true });
1028
- });
1029
- }
1030
- });
1031
-
1032
- // node_modules/chai/lib/chai/config.js
1033
- var require_config = __commonJS({
1034
- "node_modules/chai/lib/chai/config.js"(exports, module) {
1035
- module.exports = {
1036
- includeStack: false,
1037
- showDiff: true,
1038
- truncateThreshold: 40,
1039
- useProxy: true,
1040
- proxyExcludedKeys: ["then", "catch", "inspect", "toJSON"]
1041
- };
1042
- }
1043
- });
1044
-
1045
- // node_modules/chai/lib/chai/utils/inspect.js
1046
- var require_inspect = __commonJS({
1047
- "node_modules/chai/lib/chai/utils/inspect.js"(exports, module) {
1048
- var getName = require_get_func_name();
1049
- var loupe = require_loupe();
1050
- var config2 = require_config();
1051
- module.exports = inspect;
1052
- function inspect(obj, showHidden, depth, colors) {
1053
- var options = {
1054
- colors,
1055
- depth: typeof depth === "undefined" ? 2 : depth,
1056
- showHidden,
1057
- truncate: config2.truncateThreshold ? config2.truncateThreshold : Infinity
1058
- };
1059
- return loupe.inspect(obj, options);
1060
- }
1061
- }
1062
- });
1063
-
1064
- // node_modules/chai/lib/chai/utils/objDisplay.js
1065
- var require_objDisplay = __commonJS({
1066
- "node_modules/chai/lib/chai/utils/objDisplay.js"(exports, module) {
1067
- var inspect = require_inspect();
1068
- var config2 = require_config();
1069
- module.exports = function objDisplay(obj) {
1070
- var str = inspect(obj), type = Object.prototype.toString.call(obj);
1071
- if (config2.truncateThreshold && str.length >= config2.truncateThreshold) {
1072
- if (type === "[object Function]") {
1073
- return !obj.name || obj.name === "" ? "[Function]" : "[Function: " + obj.name + "]";
1074
- } else if (type === "[object Array]") {
1075
- return "[ Array(" + obj.length + ") ]";
1076
- } else if (type === "[object Object]") {
1077
- var keys = Object.keys(obj), kstr = keys.length > 2 ? keys.splice(0, 2).join(", ") + ", ..." : keys.join(", ");
1078
- return "{ Object (" + kstr + ") }";
1079
- } else {
1080
- return str;
1081
- }
1082
- } else {
1083
- return str;
1084
- }
1085
- };
1086
- }
1087
- });
1088
-
1089
- // node_modules/chai/lib/chai/utils/getMessage.js
1090
- var require_getMessage = __commonJS({
1091
- "node_modules/chai/lib/chai/utils/getMessage.js"(exports, module) {
1092
- var flag = require_flag();
1093
- var getActual = require_getActual();
1094
- var objDisplay = require_objDisplay();
1095
- module.exports = function getMessage(obj, args) {
1096
- var negate = flag(obj, "negate"), val = flag(obj, "object"), expected = args[3], actual = getActual(obj, args), msg = negate ? args[2] : args[1], flagMsg = flag(obj, "message");
1097
- if (typeof msg === "function")
1098
- msg = msg();
1099
- msg = msg || "";
1100
- msg = msg.replace(/#\{this\}/g, function() {
1101
- return objDisplay(val);
1102
- }).replace(/#\{act\}/g, function() {
1103
- return objDisplay(actual);
1104
- }).replace(/#\{exp\}/g, function() {
1105
- return objDisplay(expected);
1106
- });
1107
- return flagMsg ? flagMsg + ": " + msg : msg;
1108
- };
1109
- }
1110
- });
1111
-
1112
- // node_modules/chai/lib/chai/utils/transferFlags.js
1113
- var require_transferFlags = __commonJS({
1114
- "node_modules/chai/lib/chai/utils/transferFlags.js"(exports, module) {
1115
- module.exports = function transferFlags(assertion, object, includeAll) {
1116
- var flags = assertion.__flags || (assertion.__flags = /* @__PURE__ */ Object.create(null));
1117
- if (!object.__flags) {
1118
- object.__flags = /* @__PURE__ */ Object.create(null);
1119
- }
1120
- includeAll = arguments.length === 3 ? includeAll : true;
1121
- for (var flag in flags) {
1122
- if (includeAll || flag !== "object" && flag !== "ssfi" && flag !== "lockSsfi" && flag != "message") {
1123
- object.__flags[flag] = flags[flag];
1124
- }
1125
- }
1126
- };
1127
- }
1128
- });
1129
-
1130
- // node_modules/deep-eql/index.js
1131
- var require_deep_eql = __commonJS({
1132
- "node_modules/deep-eql/index.js"(exports, module) {
1133
- "use strict";
1134
- var type = require_type_detect();
1135
- function FakeMap() {
1136
- this._key = "chai/deep-eql__" + Math.random() + Date.now();
1137
- }
1138
- FakeMap.prototype = {
1139
- get: function getMap(key) {
1140
- return key[this._key];
1141
- },
1142
- set: function setMap(key, value) {
1143
- if (Object.isExtensible(key)) {
1144
- Object.defineProperty(key, this._key, {
1145
- value,
1146
- configurable: true
1147
- });
1148
- }
1149
- }
1150
- };
1151
- var MemoizeMap = typeof WeakMap === "function" ? WeakMap : FakeMap;
1152
- function memoizeCompare(leftHandOperand, rightHandOperand, memoizeMap) {
1153
- if (!memoizeMap || isPrimitive(leftHandOperand) || isPrimitive(rightHandOperand)) {
1154
- return null;
1155
- }
1156
- var leftHandMap = memoizeMap.get(leftHandOperand);
1157
- if (leftHandMap) {
1158
- var result = leftHandMap.get(rightHandOperand);
1159
- if (typeof result === "boolean") {
1160
- return result;
1161
- }
1162
- }
1163
- return null;
1164
- }
1165
- function memoizeSet(leftHandOperand, rightHandOperand, memoizeMap, result) {
1166
- if (!memoizeMap || isPrimitive(leftHandOperand) || isPrimitive(rightHandOperand)) {
1167
- return;
1168
- }
1169
- var leftHandMap = memoizeMap.get(leftHandOperand);
1170
- if (leftHandMap) {
1171
- leftHandMap.set(rightHandOperand, result);
1172
- } else {
1173
- leftHandMap = new MemoizeMap();
1174
- leftHandMap.set(rightHandOperand, result);
1175
- memoizeMap.set(leftHandOperand, leftHandMap);
1176
- }
1177
- }
1178
- module.exports = deepEqual;
1179
- module.exports.MemoizeMap = MemoizeMap;
1180
- function deepEqual(leftHandOperand, rightHandOperand, options) {
1181
- if (options && options.comparator) {
1182
- return extensiveDeepEqual(leftHandOperand, rightHandOperand, options);
1183
- }
1184
- var simpleResult = simpleEqual(leftHandOperand, rightHandOperand);
1185
- if (simpleResult !== null) {
1186
- return simpleResult;
1187
- }
1188
- return extensiveDeepEqual(leftHandOperand, rightHandOperand, options);
1189
- }
1190
- function simpleEqual(leftHandOperand, rightHandOperand) {
1191
- if (leftHandOperand === rightHandOperand) {
1192
- return leftHandOperand !== 0 || 1 / leftHandOperand === 1 / rightHandOperand;
1193
- }
1194
- if (leftHandOperand !== leftHandOperand && rightHandOperand !== rightHandOperand) {
1195
- return true;
1196
- }
1197
- if (isPrimitive(leftHandOperand) || isPrimitive(rightHandOperand)) {
1198
- return false;
1199
- }
1200
- return null;
1201
- }
1202
- function extensiveDeepEqual(leftHandOperand, rightHandOperand, options) {
1203
- options = options || {};
1204
- options.memoize = options.memoize === false ? false : options.memoize || new MemoizeMap();
1205
- var comparator = options && options.comparator;
1206
- var memoizeResultLeft = memoizeCompare(leftHandOperand, rightHandOperand, options.memoize);
1207
- if (memoizeResultLeft !== null) {
1208
- return memoizeResultLeft;
1209
- }
1210
- var memoizeResultRight = memoizeCompare(rightHandOperand, leftHandOperand, options.memoize);
1211
- if (memoizeResultRight !== null) {
1212
- return memoizeResultRight;
1213
- }
1214
- if (comparator) {
1215
- var comparatorResult = comparator(leftHandOperand, rightHandOperand);
1216
- if (comparatorResult === false || comparatorResult === true) {
1217
- memoizeSet(leftHandOperand, rightHandOperand, options.memoize, comparatorResult);
1218
- return comparatorResult;
1219
- }
1220
- var simpleResult = simpleEqual(leftHandOperand, rightHandOperand);
1221
- if (simpleResult !== null) {
1222
- return simpleResult;
1223
- }
1224
- }
1225
- var leftHandType = type(leftHandOperand);
1226
- if (leftHandType !== type(rightHandOperand)) {
1227
- memoizeSet(leftHandOperand, rightHandOperand, options.memoize, false);
1228
- return false;
1229
- }
1230
- memoizeSet(leftHandOperand, rightHandOperand, options.memoize, true);
1231
- var result = extensiveDeepEqualByType(leftHandOperand, rightHandOperand, leftHandType, options);
1232
- memoizeSet(leftHandOperand, rightHandOperand, options.memoize, result);
1233
- return result;
1234
- }
1235
- function extensiveDeepEqualByType(leftHandOperand, rightHandOperand, leftHandType, options) {
1236
- switch (leftHandType) {
1237
- case "String":
1238
- case "Number":
1239
- case "Boolean":
1240
- case "Date":
1241
- return deepEqual(leftHandOperand.valueOf(), rightHandOperand.valueOf());
1242
- case "Promise":
1243
- case "Symbol":
1244
- case "function":
1245
- case "WeakMap":
1246
- case "WeakSet":
1247
- case "Error":
1248
- return leftHandOperand === rightHandOperand;
1249
- case "Arguments":
1250
- case "Int8Array":
1251
- case "Uint8Array":
1252
- case "Uint8ClampedArray":
1253
- case "Int16Array":
1254
- case "Uint16Array":
1255
- case "Int32Array":
1256
- case "Uint32Array":
1257
- case "Float32Array":
1258
- case "Float64Array":
1259
- case "Array":
1260
- return iterableEqual(leftHandOperand, rightHandOperand, options);
1261
- case "RegExp":
1262
- return regexpEqual(leftHandOperand, rightHandOperand);
1263
- case "Generator":
1264
- return generatorEqual(leftHandOperand, rightHandOperand, options);
1265
- case "DataView":
1266
- return iterableEqual(new Uint8Array(leftHandOperand.buffer), new Uint8Array(rightHandOperand.buffer), options);
1267
- case "ArrayBuffer":
1268
- return iterableEqual(new Uint8Array(leftHandOperand), new Uint8Array(rightHandOperand), options);
1269
- case "Set":
1270
- return entriesEqual(leftHandOperand, rightHandOperand, options);
1271
- case "Map":
1272
- return entriesEqual(leftHandOperand, rightHandOperand, options);
1273
- default:
1274
- return objectEqual(leftHandOperand, rightHandOperand, options);
1275
- }
1276
- }
1277
- function regexpEqual(leftHandOperand, rightHandOperand) {
1278
- return leftHandOperand.toString() === rightHandOperand.toString();
1279
- }
1280
- function entriesEqual(leftHandOperand, rightHandOperand, options) {
1281
- if (leftHandOperand.size !== rightHandOperand.size) {
1282
- return false;
1283
- }
1284
- if (leftHandOperand.size === 0) {
1285
- return true;
1286
- }
1287
- var leftHandItems = [];
1288
- var rightHandItems = [];
1289
- leftHandOperand.forEach(function gatherEntries(key, value) {
1290
- leftHandItems.push([key, value]);
1291
- });
1292
- rightHandOperand.forEach(function gatherEntries(key, value) {
1293
- rightHandItems.push([key, value]);
1294
- });
1295
- return iterableEqual(leftHandItems.sort(), rightHandItems.sort(), options);
1296
- }
1297
- function iterableEqual(leftHandOperand, rightHandOperand, options) {
1298
- var length = leftHandOperand.length;
1299
- if (length !== rightHandOperand.length) {
1300
- return false;
1301
- }
1302
- if (length === 0) {
1303
- return true;
1304
- }
1305
- var index = -1;
1306
- while (++index < length) {
1307
- if (deepEqual(leftHandOperand[index], rightHandOperand[index], options) === false) {
1308
- return false;
1309
- }
1310
- }
1311
- return true;
1312
- }
1313
- function generatorEqual(leftHandOperand, rightHandOperand, options) {
1314
- return iterableEqual(getGeneratorEntries(leftHandOperand), getGeneratorEntries(rightHandOperand), options);
1315
- }
1316
- function hasIteratorFunction(target) {
1317
- return typeof Symbol !== "undefined" && typeof target === "object" && typeof Symbol.iterator !== "undefined" && typeof target[Symbol.iterator] === "function";
1318
- }
1319
- function getIteratorEntries(target) {
1320
- if (hasIteratorFunction(target)) {
1321
- try {
1322
- return getGeneratorEntries(target[Symbol.iterator]());
1323
- } catch (iteratorError) {
1324
- return [];
1325
- }
1326
- }
1327
- return [];
1328
- }
1329
- function getGeneratorEntries(generator) {
1330
- var generatorResult = generator.next();
1331
- var accumulator = [generatorResult.value];
1332
- while (generatorResult.done === false) {
1333
- generatorResult = generator.next();
1334
- accumulator.push(generatorResult.value);
1335
- }
1336
- return accumulator;
1337
- }
1338
- function getEnumerableKeys(target) {
1339
- var keys = [];
1340
- for (var key in target) {
1341
- keys.push(key);
1342
- }
1343
- return keys;
1344
- }
1345
- function keysEqual(leftHandOperand, rightHandOperand, keys, options) {
1346
- var length = keys.length;
1347
- if (length === 0) {
1348
- return true;
1349
- }
1350
- for (var i = 0; i < length; i += 1) {
1351
- if (deepEqual(leftHandOperand[keys[i]], rightHandOperand[keys[i]], options) === false) {
1352
- return false;
1353
- }
1354
- }
1355
- return true;
1356
- }
1357
- function objectEqual(leftHandOperand, rightHandOperand, options) {
1358
- var leftHandKeys = getEnumerableKeys(leftHandOperand);
1359
- var rightHandKeys = getEnumerableKeys(rightHandOperand);
1360
- if (leftHandKeys.length && leftHandKeys.length === rightHandKeys.length) {
1361
- leftHandKeys.sort();
1362
- rightHandKeys.sort();
1363
- if (iterableEqual(leftHandKeys, rightHandKeys) === false) {
1364
- return false;
1365
- }
1366
- return keysEqual(leftHandOperand, rightHandOperand, leftHandKeys, options);
1367
- }
1368
- var leftHandEntries = getIteratorEntries(leftHandOperand);
1369
- var rightHandEntries = getIteratorEntries(rightHandOperand);
1370
- if (leftHandEntries.length && leftHandEntries.length === rightHandEntries.length) {
1371
- leftHandEntries.sort();
1372
- rightHandEntries.sort();
1373
- return iterableEqual(leftHandEntries, rightHandEntries, options);
1374
- }
1375
- if (leftHandKeys.length === 0 && leftHandEntries.length === 0 && rightHandKeys.length === 0 && rightHandEntries.length === 0) {
1376
- return true;
1377
- }
1378
- return false;
1379
- }
1380
- function isPrimitive(value) {
1381
- return value === null || typeof value !== "object";
1382
- }
1383
- }
1384
- });
1385
-
1386
- // node_modules/chai/lib/chai/utils/isProxyEnabled.js
1387
- var require_isProxyEnabled = __commonJS({
1388
- "node_modules/chai/lib/chai/utils/isProxyEnabled.js"(exports, module) {
1389
- var config2 = require_config();
1390
- module.exports = function isProxyEnabled() {
1391
- return config2.useProxy && typeof Proxy !== "undefined" && typeof Reflect !== "undefined";
1392
- };
1393
- }
1394
- });
1395
-
1396
- // node_modules/chai/lib/chai/utils/addProperty.js
1397
- var require_addProperty = __commonJS({
1398
- "node_modules/chai/lib/chai/utils/addProperty.js"(exports, module) {
1399
- var chai2 = require_chai();
1400
- var flag = require_flag();
1401
- var isProxyEnabled = require_isProxyEnabled();
1402
- var transferFlags = require_transferFlags();
1403
- module.exports = function addProperty(ctx, name, getter) {
1404
- getter = getter === void 0 ? function() {
1405
- } : getter;
1406
- Object.defineProperty(ctx, name, {
1407
- get: function propertyGetter() {
1408
- if (!isProxyEnabled() && !flag(this, "lockSsfi")) {
1409
- flag(this, "ssfi", propertyGetter);
1410
- }
1411
- var result = getter.call(this);
1412
- if (result !== void 0)
1413
- return result;
1414
- var newAssertion = new chai2.Assertion();
1415
- transferFlags(this, newAssertion);
1416
- return newAssertion;
1417
- },
1418
- configurable: true
1419
- });
1420
- };
1421
- }
1422
- });
1423
-
1424
- // node_modules/chai/lib/chai/utils/addLengthGuard.js
1425
- var require_addLengthGuard = __commonJS({
1426
- "node_modules/chai/lib/chai/utils/addLengthGuard.js"(exports, module) {
1427
- var fnLengthDesc = Object.getOwnPropertyDescriptor(function() {
1428
- }, "length");
1429
- module.exports = function addLengthGuard(fn, assertionName, isChainable) {
1430
- if (!fnLengthDesc.configurable)
1431
- return fn;
1432
- Object.defineProperty(fn, "length", {
1433
- get: function() {
1434
- if (isChainable) {
1435
- throw Error("Invalid Chai property: " + assertionName + '.length. Due to a compatibility issue, "length" cannot directly follow "' + assertionName + '". Use "' + assertionName + '.lengthOf" instead.');
1436
- }
1437
- throw Error("Invalid Chai property: " + assertionName + '.length. See docs for proper usage of "' + assertionName + '".');
1438
- }
1439
- });
1440
- return fn;
1441
- };
1442
- }
1443
- });
1444
-
1445
- // node_modules/chai/lib/chai/utils/getProperties.js
1446
- var require_getProperties = __commonJS({
1447
- "node_modules/chai/lib/chai/utils/getProperties.js"(exports, module) {
1448
- module.exports = function getProperties(object) {
1449
- var result = Object.getOwnPropertyNames(object);
1450
- function addProperty(property) {
1451
- if (result.indexOf(property) === -1) {
1452
- result.push(property);
1453
- }
1454
- }
1455
- var proto = Object.getPrototypeOf(object);
1456
- while (proto !== null) {
1457
- Object.getOwnPropertyNames(proto).forEach(addProperty);
1458
- proto = Object.getPrototypeOf(proto);
1459
- }
1460
- return result;
1461
- };
1462
- }
1463
- });
1464
-
1465
- // node_modules/chai/lib/chai/utils/proxify.js
1466
- var require_proxify = __commonJS({
1467
- "node_modules/chai/lib/chai/utils/proxify.js"(exports, module) {
1468
- var config2 = require_config();
1469
- var flag = require_flag();
1470
- var getProperties = require_getProperties();
1471
- var isProxyEnabled = require_isProxyEnabled();
1472
- var builtins = ["__flags", "__methods", "_obj", "assert"];
1473
- module.exports = function proxify(obj, nonChainableMethodName) {
1474
- if (!isProxyEnabled())
1475
- return obj;
1476
- return new Proxy(obj, {
1477
- get: function proxyGetter(target, property) {
1478
- if (typeof property === "string" && config2.proxyExcludedKeys.indexOf(property) === -1 && !Reflect.has(target, property)) {
1479
- if (nonChainableMethodName) {
1480
- throw Error("Invalid Chai property: " + nonChainableMethodName + "." + property + '. See docs for proper usage of "' + nonChainableMethodName + '".');
1481
- }
1482
- var suggestion = null;
1483
- var suggestionDistance = 4;
1484
- getProperties(target).forEach(function(prop) {
1485
- if (!Object.prototype.hasOwnProperty(prop) && builtins.indexOf(prop) === -1) {
1486
- var dist = stringDistanceCapped(property, prop, suggestionDistance);
1487
- if (dist < suggestionDistance) {
1488
- suggestion = prop;
1489
- suggestionDistance = dist;
1490
- }
1491
- }
1492
- });
1493
- if (suggestion !== null) {
1494
- throw Error("Invalid Chai property: " + property + '. Did you mean "' + suggestion + '"?');
1495
- } else {
1496
- throw Error("Invalid Chai property: " + property);
1497
- }
1498
- }
1499
- if (builtins.indexOf(property) === -1 && !flag(target, "lockSsfi")) {
1500
- flag(target, "ssfi", proxyGetter);
1501
- }
1502
- return Reflect.get(target, property);
1503
- }
1504
- });
1505
- };
1506
- function stringDistanceCapped(strA, strB, cap) {
1507
- if (Math.abs(strA.length - strB.length) >= cap) {
1508
- return cap;
1509
- }
1510
- var memo = [];
1511
- for (var i = 0; i <= strA.length; i++) {
1512
- memo[i] = Array(strB.length + 1).fill(0);
1513
- memo[i][0] = i;
1514
- }
1515
- for (var j = 0; j < strB.length; j++) {
1516
- memo[0][j] = j;
1517
- }
1518
- for (var i = 1; i <= strA.length; i++) {
1519
- var ch = strA.charCodeAt(i - 1);
1520
- for (var j = 1; j <= strB.length; j++) {
1521
- if (Math.abs(i - j) >= cap) {
1522
- memo[i][j] = cap;
1523
- continue;
1524
- }
1525
- memo[i][j] = Math.min(memo[i - 1][j] + 1, memo[i][j - 1] + 1, memo[i - 1][j - 1] + (ch === strB.charCodeAt(j - 1) ? 0 : 1));
1526
- }
1527
- }
1528
- return memo[strA.length][strB.length];
1529
- }
1530
- }
1531
- });
1532
-
1533
- // node_modules/chai/lib/chai/utils/addMethod.js
1534
- var require_addMethod = __commonJS({
1535
- "node_modules/chai/lib/chai/utils/addMethod.js"(exports, module) {
1536
- var addLengthGuard = require_addLengthGuard();
1537
- var chai2 = require_chai();
1538
- var flag = require_flag();
1539
- var proxify = require_proxify();
1540
- var transferFlags = require_transferFlags();
1541
- module.exports = function addMethod(ctx, name, method) {
1542
- var methodWrapper = function() {
1543
- if (!flag(this, "lockSsfi")) {
1544
- flag(this, "ssfi", methodWrapper);
1545
- }
1546
- var result = method.apply(this, arguments);
1547
- if (result !== void 0)
1548
- return result;
1549
- var newAssertion = new chai2.Assertion();
1550
- transferFlags(this, newAssertion);
1551
- return newAssertion;
1552
- };
1553
- addLengthGuard(methodWrapper, name, false);
1554
- ctx[name] = proxify(methodWrapper, name);
1555
- };
1556
- }
1557
- });
1558
-
1559
- // node_modules/chai/lib/chai/utils/overwriteProperty.js
1560
- var require_overwriteProperty = __commonJS({
1561
- "node_modules/chai/lib/chai/utils/overwriteProperty.js"(exports, module) {
1562
- var chai2 = require_chai();
1563
- var flag = require_flag();
1564
- var isProxyEnabled = require_isProxyEnabled();
1565
- var transferFlags = require_transferFlags();
1566
- module.exports = function overwriteProperty(ctx, name, getter) {
1567
- var _get = Object.getOwnPropertyDescriptor(ctx, name), _super = function() {
1568
- };
1569
- if (_get && "function" === typeof _get.get)
1570
- _super = _get.get;
1571
- Object.defineProperty(ctx, name, {
1572
- get: function overwritingPropertyGetter() {
1573
- if (!isProxyEnabled() && !flag(this, "lockSsfi")) {
1574
- flag(this, "ssfi", overwritingPropertyGetter);
1575
- }
1576
- var origLockSsfi = flag(this, "lockSsfi");
1577
- flag(this, "lockSsfi", true);
1578
- var result = getter(_super).call(this);
1579
- flag(this, "lockSsfi", origLockSsfi);
1580
- if (result !== void 0) {
1581
- return result;
1582
- }
1583
- var newAssertion = new chai2.Assertion();
1584
- transferFlags(this, newAssertion);
1585
- return newAssertion;
1586
- },
1587
- configurable: true
1588
- });
1589
- };
1590
- }
1591
- });
1592
-
1593
- // node_modules/chai/lib/chai/utils/overwriteMethod.js
1594
- var require_overwriteMethod = __commonJS({
1595
- "node_modules/chai/lib/chai/utils/overwriteMethod.js"(exports, module) {
1596
- var addLengthGuard = require_addLengthGuard();
1597
- var chai2 = require_chai();
1598
- var flag = require_flag();
1599
- var proxify = require_proxify();
1600
- var transferFlags = require_transferFlags();
1601
- module.exports = function overwriteMethod(ctx, name, method) {
1602
- var _method = ctx[name], _super = function() {
1603
- throw new Error(name + " is not a function");
1604
- };
1605
- if (_method && "function" === typeof _method)
1606
- _super = _method;
1607
- var overwritingMethodWrapper = function() {
1608
- if (!flag(this, "lockSsfi")) {
1609
- flag(this, "ssfi", overwritingMethodWrapper);
1610
- }
1611
- var origLockSsfi = flag(this, "lockSsfi");
1612
- flag(this, "lockSsfi", true);
1613
- var result = method(_super).apply(this, arguments);
1614
- flag(this, "lockSsfi", origLockSsfi);
1615
- if (result !== void 0) {
1616
- return result;
1617
- }
1618
- var newAssertion = new chai2.Assertion();
1619
- transferFlags(this, newAssertion);
1620
- return newAssertion;
1621
- };
1622
- addLengthGuard(overwritingMethodWrapper, name, false);
1623
- ctx[name] = proxify(overwritingMethodWrapper, name);
1624
- };
1625
- }
1626
- });
1627
-
1628
- // node_modules/chai/lib/chai/utils/addChainableMethod.js
1629
- var require_addChainableMethod = __commonJS({
1630
- "node_modules/chai/lib/chai/utils/addChainableMethod.js"(exports, module) {
1631
- var addLengthGuard = require_addLengthGuard();
1632
- var chai2 = require_chai();
1633
- var flag = require_flag();
1634
- var proxify = require_proxify();
1635
- var transferFlags = require_transferFlags();
1636
- var canSetPrototype = typeof Object.setPrototypeOf === "function";
1637
- var testFn = function() {
1638
- };
1639
- var excludeNames = Object.getOwnPropertyNames(testFn).filter(function(name) {
1640
- var propDesc = Object.getOwnPropertyDescriptor(testFn, name);
1641
- if (typeof propDesc !== "object")
1642
- return true;
1643
- return !propDesc.configurable;
1644
- });
1645
- var call = Function.prototype.call;
1646
- var apply = Function.prototype.apply;
1647
- module.exports = function addChainableMethod(ctx, name, method, chainingBehavior) {
1648
- if (typeof chainingBehavior !== "function") {
1649
- chainingBehavior = function() {
1650
- };
1651
- }
1652
- var chainableBehavior = {
1653
- method,
1654
- chainingBehavior
1655
- };
1656
- if (!ctx.__methods) {
1657
- ctx.__methods = {};
1658
- }
1659
- ctx.__methods[name] = chainableBehavior;
1660
- Object.defineProperty(ctx, name, {
1661
- get: function chainableMethodGetter() {
1662
- chainableBehavior.chainingBehavior.call(this);
1663
- var chainableMethodWrapper = function() {
1664
- if (!flag(this, "lockSsfi")) {
1665
- flag(this, "ssfi", chainableMethodWrapper);
1666
- }
1667
- var result = chainableBehavior.method.apply(this, arguments);
1668
- if (result !== void 0) {
1669
- return result;
1670
- }
1671
- var newAssertion = new chai2.Assertion();
1672
- transferFlags(this, newAssertion);
1673
- return newAssertion;
1674
- };
1675
- addLengthGuard(chainableMethodWrapper, name, true);
1676
- if (canSetPrototype) {
1677
- var prototype = Object.create(this);
1678
- prototype.call = call;
1679
- prototype.apply = apply;
1680
- Object.setPrototypeOf(chainableMethodWrapper, prototype);
1681
- } else {
1682
- var asserterNames = Object.getOwnPropertyNames(ctx);
1683
- asserterNames.forEach(function(asserterName) {
1684
- if (excludeNames.indexOf(asserterName) !== -1) {
1685
- return;
1686
- }
1687
- var pd = Object.getOwnPropertyDescriptor(ctx, asserterName);
1688
- Object.defineProperty(chainableMethodWrapper, asserterName, pd);
1689
- });
1690
- }
1691
- transferFlags(this, chainableMethodWrapper);
1692
- return proxify(chainableMethodWrapper);
1693
- },
1694
- configurable: true
1695
- });
1696
- };
1697
- }
1698
- });
1699
-
1700
- // node_modules/chai/lib/chai/utils/overwriteChainableMethod.js
1701
- var require_overwriteChainableMethod = __commonJS({
1702
- "node_modules/chai/lib/chai/utils/overwriteChainableMethod.js"(exports, module) {
1703
- var chai2 = require_chai();
1704
- var transferFlags = require_transferFlags();
1705
- module.exports = function overwriteChainableMethod(ctx, name, method, chainingBehavior) {
1706
- var chainableBehavior = ctx.__methods[name];
1707
- var _chainingBehavior = chainableBehavior.chainingBehavior;
1708
- chainableBehavior.chainingBehavior = function overwritingChainableMethodGetter() {
1709
- var result = chainingBehavior(_chainingBehavior).call(this);
1710
- if (result !== void 0) {
1711
- return result;
1712
- }
1713
- var newAssertion = new chai2.Assertion();
1714
- transferFlags(this, newAssertion);
1715
- return newAssertion;
1716
- };
1717
- var _method = chainableBehavior.method;
1718
- chainableBehavior.method = function overwritingChainableMethodWrapper() {
1719
- var result = method(_method).apply(this, arguments);
1720
- if (result !== void 0) {
1721
- return result;
1722
- }
1723
- var newAssertion = new chai2.Assertion();
1724
- transferFlags(this, newAssertion);
1725
- return newAssertion;
1726
- };
1727
- };
1728
- }
1729
- });
1730
-
1731
- // node_modules/chai/lib/chai/utils/compareByInspect.js
1732
- var require_compareByInspect = __commonJS({
1733
- "node_modules/chai/lib/chai/utils/compareByInspect.js"(exports, module) {
1734
- var inspect = require_inspect();
1735
- module.exports = function compareByInspect(a, b) {
1736
- return inspect(a) < inspect(b) ? -1 : 1;
1737
- };
1738
- }
1739
- });
1740
-
1741
- // node_modules/chai/lib/chai/utils/getOwnEnumerablePropertySymbols.js
1742
- var require_getOwnEnumerablePropertySymbols = __commonJS({
1743
- "node_modules/chai/lib/chai/utils/getOwnEnumerablePropertySymbols.js"(exports, module) {
1744
- module.exports = function getOwnEnumerablePropertySymbols(obj) {
1745
- if (typeof Object.getOwnPropertySymbols !== "function")
1746
- return [];
1747
- return Object.getOwnPropertySymbols(obj).filter(function(sym) {
1748
- return Object.getOwnPropertyDescriptor(obj, sym).enumerable;
1749
- });
1750
- };
1751
- }
1752
- });
1753
-
1754
- // node_modules/chai/lib/chai/utils/getOwnEnumerableProperties.js
1755
- var require_getOwnEnumerableProperties = __commonJS({
1756
- "node_modules/chai/lib/chai/utils/getOwnEnumerableProperties.js"(exports, module) {
1757
- var getOwnEnumerablePropertySymbols = require_getOwnEnumerablePropertySymbols();
1758
- module.exports = function getOwnEnumerableProperties(obj) {
1759
- return Object.keys(obj).concat(getOwnEnumerablePropertySymbols(obj));
1760
- };
1761
- }
1762
- });
1763
-
1764
- // node_modules/check-error/index.js
1765
- var require_check_error = __commonJS({
1766
- "node_modules/check-error/index.js"(exports, module) {
1767
- "use strict";
1768
- function compatibleInstance(thrown, errorLike) {
1769
- return errorLike instanceof Error && thrown === errorLike;
1770
- }
1771
- function compatibleConstructor(thrown, errorLike) {
1772
- if (errorLike instanceof Error) {
1773
- return thrown.constructor === errorLike.constructor || thrown instanceof errorLike.constructor;
1774
- } else if (errorLike.prototype instanceof Error || errorLike === Error) {
1775
- return thrown.constructor === errorLike || thrown instanceof errorLike;
1776
- }
1777
- return false;
1778
- }
1779
- function compatibleMessage(thrown, errMatcher) {
1780
- var comparisonString = typeof thrown === "string" ? thrown : thrown.message;
1781
- if (errMatcher instanceof RegExp) {
1782
- return errMatcher.test(comparisonString);
1783
- } else if (typeof errMatcher === "string") {
1784
- return comparisonString.indexOf(errMatcher) !== -1;
1785
- }
1786
- return false;
1787
- }
1788
- var functionNameMatch = /\s*function(?:\s|\s*\/\*[^(?:*\/)]+\*\/\s*)*([^\(\/]+)/;
1789
- function getFunctionName(constructorFn) {
1790
- var name = "";
1791
- if (typeof constructorFn.name === "undefined") {
1792
- var match = String(constructorFn).match(functionNameMatch);
1793
- if (match) {
1794
- name = match[1];
1795
- }
1796
- } else {
1797
- name = constructorFn.name;
1798
- }
1799
- return name;
1800
- }
1801
- function getConstructorName(errorLike) {
1802
- var constructorName = errorLike;
1803
- if (errorLike instanceof Error) {
1804
- constructorName = getFunctionName(errorLike.constructor);
1805
- } else if (typeof errorLike === "function") {
1806
- constructorName = getFunctionName(errorLike).trim() || getFunctionName(new errorLike());
1807
- }
1808
- return constructorName;
1809
- }
1810
- function getMessage(errorLike) {
1811
- var msg = "";
1812
- if (errorLike && errorLike.message) {
1813
- msg = errorLike.message;
1814
- } else if (typeof errorLike === "string") {
1815
- msg = errorLike;
1816
- }
1817
- return msg;
1818
- }
1819
- module.exports = {
1820
- compatibleInstance,
1821
- compatibleConstructor,
1822
- compatibleMessage,
1823
- getMessage,
1824
- getConstructorName
1825
- };
1826
- }
1827
- });
1828
-
1829
- // node_modules/chai/lib/chai/utils/isNaN.js
1830
- var require_isNaN = __commonJS({
1831
- "node_modules/chai/lib/chai/utils/isNaN.js"(exports, module) {
1832
- function isNaN(value) {
1833
- return value !== value;
1834
- }
1835
- module.exports = Number.isNaN || isNaN;
1836
- }
1837
- });
1838
-
1839
- // node_modules/chai/lib/chai/utils/getOperator.js
1840
- var require_getOperator = __commonJS({
1841
- "node_modules/chai/lib/chai/utils/getOperator.js"(exports, module) {
1842
- var type = require_type_detect();
1843
- var flag = require_flag();
1844
- function isObjectType(obj) {
1845
- var objectType = type(obj);
1846
- var objectTypes = ["Array", "Object", "function"];
1847
- return objectTypes.indexOf(objectType) !== -1;
1848
- }
1849
- module.exports = function getOperator(obj, args) {
1850
- var operator = flag(obj, "operator");
1851
- var negate = flag(obj, "negate");
1852
- var expected = args[3];
1853
- var msg = negate ? args[2] : args[1];
1854
- if (operator) {
1855
- return operator;
1856
- }
1857
- if (typeof msg === "function")
1858
- msg = msg();
1859
- msg = msg || "";
1860
- if (!msg) {
1861
- return void 0;
1862
- }
1863
- if (/\shave\s/.test(msg)) {
1864
- return void 0;
1865
- }
1866
- var isObject = isObjectType(expected);
1867
- if (/\snot\s/.test(msg)) {
1868
- return isObject ? "notDeepStrictEqual" : "notStrictEqual";
1869
- }
1870
- return isObject ? "deepStrictEqual" : "strictEqual";
1871
- };
1872
- }
1873
- });
1874
-
1875
- // node_modules/chai/lib/chai/utils/index.js
1876
- var require_utils = __commonJS({
1877
- "node_modules/chai/lib/chai/utils/index.js"(exports) {
1878
- var pathval = require_pathval();
1879
- exports.test = require_test();
1880
- exports.type = require_type_detect();
1881
- exports.expectTypes = require_expectTypes();
1882
- exports.getMessage = require_getMessage();
1883
- exports.getActual = require_getActual();
1884
- exports.inspect = require_inspect();
1885
- exports.objDisplay = require_objDisplay();
1886
- exports.flag = require_flag();
1887
- exports.transferFlags = require_transferFlags();
1888
- exports.eql = require_deep_eql();
1889
- exports.getPathInfo = pathval.getPathInfo;
1890
- exports.hasProperty = pathval.hasProperty;
1891
- exports.getName = require_get_func_name();
1892
- exports.addProperty = require_addProperty();
1893
- exports.addMethod = require_addMethod();
1894
- exports.overwriteProperty = require_overwriteProperty();
1895
- exports.overwriteMethod = require_overwriteMethod();
1896
- exports.addChainableMethod = require_addChainableMethod();
1897
- exports.overwriteChainableMethod = require_overwriteChainableMethod();
1898
- exports.compareByInspect = require_compareByInspect();
1899
- exports.getOwnEnumerablePropertySymbols = require_getOwnEnumerablePropertySymbols();
1900
- exports.getOwnEnumerableProperties = require_getOwnEnumerableProperties();
1901
- exports.checkError = require_check_error();
1902
- exports.proxify = require_proxify();
1903
- exports.addLengthGuard = require_addLengthGuard();
1904
- exports.isProxyEnabled = require_isProxyEnabled();
1905
- exports.isNaN = require_isNaN();
1906
- exports.getOperator = require_getOperator();
1907
- }
1908
- });
1909
-
1910
- // node_modules/chai/lib/chai/assertion.js
1911
- var require_assertion = __commonJS({
1912
- "node_modules/chai/lib/chai/assertion.js"(exports, module) {
1913
- var config2 = require_config();
1914
- module.exports = function(_chai, util2) {
1915
- var AssertionError2 = _chai.AssertionError, flag = util2.flag;
1916
- _chai.Assertion = Assertion2;
1917
- function Assertion2(obj, msg, ssfi, lockSsfi) {
1918
- flag(this, "ssfi", ssfi || Assertion2);
1919
- flag(this, "lockSsfi", lockSsfi);
1920
- flag(this, "object", obj);
1921
- flag(this, "message", msg);
1922
- return util2.proxify(this);
1923
- }
1924
- Object.defineProperty(Assertion2, "includeStack", {
1925
- get: function() {
1926
- console.warn("Assertion.includeStack is deprecated, use chai.config.includeStack instead.");
1927
- return config2.includeStack;
1928
- },
1929
- set: function(value) {
1930
- console.warn("Assertion.includeStack is deprecated, use chai.config.includeStack instead.");
1931
- config2.includeStack = value;
1932
- }
1933
- });
1934
- Object.defineProperty(Assertion2, "showDiff", {
1935
- get: function() {
1936
- console.warn("Assertion.showDiff is deprecated, use chai.config.showDiff instead.");
1937
- return config2.showDiff;
1938
- },
1939
- set: function(value) {
1940
- console.warn("Assertion.showDiff is deprecated, use chai.config.showDiff instead.");
1941
- config2.showDiff = value;
1942
- }
1943
- });
1944
- Assertion2.addProperty = function(name, fn) {
1945
- util2.addProperty(this.prototype, name, fn);
1946
- };
1947
- Assertion2.addMethod = function(name, fn) {
1948
- util2.addMethod(this.prototype, name, fn);
1949
- };
1950
- Assertion2.addChainableMethod = function(name, fn, chainingBehavior) {
1951
- util2.addChainableMethod(this.prototype, name, fn, chainingBehavior);
1952
- };
1953
- Assertion2.overwriteProperty = function(name, fn) {
1954
- util2.overwriteProperty(this.prototype, name, fn);
1955
- };
1956
- Assertion2.overwriteMethod = function(name, fn) {
1957
- util2.overwriteMethod(this.prototype, name, fn);
1958
- };
1959
- Assertion2.overwriteChainableMethod = function(name, fn, chainingBehavior) {
1960
- util2.overwriteChainableMethod(this.prototype, name, fn, chainingBehavior);
1961
- };
1962
- Assertion2.prototype.assert = function(expr, msg, negateMsg, expected, _actual, showDiff) {
1963
- var ok = util2.test(this, arguments);
1964
- if (false !== showDiff)
1965
- showDiff = true;
1966
- if (void 0 === expected && void 0 === _actual)
1967
- showDiff = false;
1968
- if (true !== config2.showDiff)
1969
- showDiff = false;
1970
- if (!ok) {
1971
- msg = util2.getMessage(this, arguments);
1972
- var actual = util2.getActual(this, arguments);
1973
- var assertionErrorObjectProperties = {
1974
- actual,
1975
- expected,
1976
- showDiff
1977
- };
1978
- var operator = util2.getOperator(this, arguments);
1979
- if (operator) {
1980
- assertionErrorObjectProperties.operator = operator;
1981
- }
1982
- throw new AssertionError2(msg, assertionErrorObjectProperties, config2.includeStack ? this.assert : flag(this, "ssfi"));
1983
- }
1984
- };
1985
- Object.defineProperty(Assertion2.prototype, "_obj", {
1986
- get: function() {
1987
- return flag(this, "object");
1988
- },
1989
- set: function(val) {
1990
- flag(this, "object", val);
1991
- }
1992
- });
1993
- };
1994
- }
1995
- });
1996
-
1997
- // node_modules/chai/lib/chai/core/assertions.js
1998
- var require_assertions = __commonJS({
1999
- "node_modules/chai/lib/chai/core/assertions.js"(exports, module) {
2000
- module.exports = function(chai2, _) {
2001
- var Assertion2 = chai2.Assertion, AssertionError2 = chai2.AssertionError, flag = _.flag;
2002
- [
2003
- "to",
2004
- "be",
2005
- "been",
2006
- "is",
2007
- "and",
2008
- "has",
2009
- "have",
2010
- "with",
2011
- "that",
2012
- "which",
2013
- "at",
2014
- "of",
2015
- "same",
2016
- "but",
2017
- "does",
2018
- "still",
2019
- "also"
2020
- ].forEach(function(chain) {
2021
- Assertion2.addProperty(chain);
2022
- });
2023
- Assertion2.addProperty("not", function() {
2024
- flag(this, "negate", true);
2025
- });
2026
- Assertion2.addProperty("deep", function() {
2027
- flag(this, "deep", true);
2028
- });
2029
- Assertion2.addProperty("nested", function() {
2030
- flag(this, "nested", true);
2031
- });
2032
- Assertion2.addProperty("own", function() {
2033
- flag(this, "own", true);
2034
- });
2035
- Assertion2.addProperty("ordered", function() {
2036
- flag(this, "ordered", true);
2037
- });
2038
- Assertion2.addProperty("any", function() {
2039
- flag(this, "any", true);
2040
- flag(this, "all", false);
2041
- });
2042
- Assertion2.addProperty("all", function() {
2043
- flag(this, "all", true);
2044
- flag(this, "any", false);
2045
- });
2046
- function an(type, msg) {
2047
- if (msg)
2048
- flag(this, "message", msg);
2049
- type = type.toLowerCase();
2050
- var obj = flag(this, "object"), article = ~["a", "e", "i", "o", "u"].indexOf(type.charAt(0)) ? "an " : "a ";
2051
- this.assert(type === _.type(obj).toLowerCase(), "expected #{this} to be " + article + type, "expected #{this} not to be " + article + type);
2052
- }
2053
- Assertion2.addChainableMethod("an", an);
2054
- Assertion2.addChainableMethod("a", an);
2055
- function SameValueZero(a, b) {
2056
- return _.isNaN(a) && _.isNaN(b) || a === b;
2057
- }
2058
- function includeChainingBehavior() {
2059
- flag(this, "contains", true);
2060
- }
2061
- function include(val, msg) {
2062
- if (msg)
2063
- flag(this, "message", msg);
2064
- var obj = flag(this, "object"), objType = _.type(obj).toLowerCase(), flagMsg = flag(this, "message"), negate = flag(this, "negate"), ssfi = flag(this, "ssfi"), isDeep = flag(this, "deep"), descriptor = isDeep ? "deep " : "";
2065
- flagMsg = flagMsg ? flagMsg + ": " : "";
2066
- var included = false;
2067
- switch (objType) {
2068
- case "string":
2069
- included = obj.indexOf(val) !== -1;
2070
- break;
2071
- case "weakset":
2072
- if (isDeep) {
2073
- throw new AssertionError2(flagMsg + "unable to use .deep.include with WeakSet", void 0, ssfi);
2074
- }
2075
- included = obj.has(val);
2076
- break;
2077
- case "map":
2078
- var isEql = isDeep ? _.eql : SameValueZero;
2079
- obj.forEach(function(item) {
2080
- included = included || isEql(item, val);
2081
- });
2082
- break;
2083
- case "set":
2084
- if (isDeep) {
2085
- obj.forEach(function(item) {
2086
- included = included || _.eql(item, val);
2087
- });
2088
- } else {
2089
- included = obj.has(val);
2090
- }
2091
- break;
2092
- case "array":
2093
- if (isDeep) {
2094
- included = obj.some(function(item) {
2095
- return _.eql(item, val);
2096
- });
2097
- } else {
2098
- included = obj.indexOf(val) !== -1;
2099
- }
2100
- break;
2101
- default:
2102
- if (val !== Object(val)) {
2103
- throw new AssertionError2(flagMsg + "the given combination of arguments (" + objType + " and " + _.type(val).toLowerCase() + ") is invalid for this assertion. You can use an array, a map, an object, a set, a string, or a weakset instead of a " + _.type(val).toLowerCase(), void 0, ssfi);
2104
- }
2105
- var props = Object.keys(val), firstErr = null, numErrs = 0;
2106
- props.forEach(function(prop) {
2107
- var propAssertion = new Assertion2(obj);
2108
- _.transferFlags(this, propAssertion, true);
2109
- flag(propAssertion, "lockSsfi", true);
2110
- if (!negate || props.length === 1) {
2111
- propAssertion.property(prop, val[prop]);
2112
- return;
2113
- }
2114
- try {
2115
- propAssertion.property(prop, val[prop]);
2116
- } catch (err) {
2117
- if (!_.checkError.compatibleConstructor(err, AssertionError2)) {
2118
- throw err;
2119
- }
2120
- if (firstErr === null)
2121
- firstErr = err;
2122
- numErrs++;
2123
- }
2124
- }, this);
2125
- if (negate && props.length > 1 && numErrs === props.length) {
2126
- throw firstErr;
2127
- }
2128
- return;
2129
- }
2130
- this.assert(included, "expected #{this} to " + descriptor + "include " + _.inspect(val), "expected #{this} to not " + descriptor + "include " + _.inspect(val));
2131
- }
2132
- Assertion2.addChainableMethod("include", include, includeChainingBehavior);
2133
- Assertion2.addChainableMethod("contain", include, includeChainingBehavior);
2134
- Assertion2.addChainableMethod("contains", include, includeChainingBehavior);
2135
- Assertion2.addChainableMethod("includes", include, includeChainingBehavior);
2136
- Assertion2.addProperty("ok", function() {
2137
- this.assert(flag(this, "object"), "expected #{this} to be truthy", "expected #{this} to be falsy");
2138
- });
2139
- Assertion2.addProperty("true", function() {
2140
- this.assert(true === flag(this, "object"), "expected #{this} to be true", "expected #{this} to be false", flag(this, "negate") ? false : true);
2141
- });
2142
- Assertion2.addProperty("false", function() {
2143
- this.assert(false === flag(this, "object"), "expected #{this} to be false", "expected #{this} to be true", flag(this, "negate") ? true : false);
2144
- });
2145
- Assertion2.addProperty("null", function() {
2146
- this.assert(null === flag(this, "object"), "expected #{this} to be null", "expected #{this} not to be null");
2147
- });
2148
- Assertion2.addProperty("undefined", function() {
2149
- this.assert(void 0 === flag(this, "object"), "expected #{this} to be undefined", "expected #{this} not to be undefined");
2150
- });
2151
- Assertion2.addProperty("NaN", function() {
2152
- this.assert(_.isNaN(flag(this, "object")), "expected #{this} to be NaN", "expected #{this} not to be NaN");
2153
- });
2154
- function assertExist() {
2155
- var val = flag(this, "object");
2156
- this.assert(val !== null && val !== void 0, "expected #{this} to exist", "expected #{this} to not exist");
2157
- }
2158
- Assertion2.addProperty("exist", assertExist);
2159
- Assertion2.addProperty("exists", assertExist);
2160
- Assertion2.addProperty("empty", function() {
2161
- var val = flag(this, "object"), ssfi = flag(this, "ssfi"), flagMsg = flag(this, "message"), itemsCount;
2162
- flagMsg = flagMsg ? flagMsg + ": " : "";
2163
- switch (_.type(val).toLowerCase()) {
2164
- case "array":
2165
- case "string":
2166
- itemsCount = val.length;
2167
- break;
2168
- case "map":
2169
- case "set":
2170
- itemsCount = val.size;
2171
- break;
2172
- case "weakmap":
2173
- case "weakset":
2174
- throw new AssertionError2(flagMsg + ".empty was passed a weak collection", void 0, ssfi);
2175
- case "function":
2176
- var msg = flagMsg + ".empty was passed a function " + _.getName(val);
2177
- throw new AssertionError2(msg.trim(), void 0, ssfi);
2178
- default:
2179
- if (val !== Object(val)) {
2180
- throw new AssertionError2(flagMsg + ".empty was passed non-string primitive " + _.inspect(val), void 0, ssfi);
2181
- }
2182
- itemsCount = Object.keys(val).length;
2183
- }
2184
- this.assert(0 === itemsCount, "expected #{this} to be empty", "expected #{this} not to be empty");
2185
- });
2186
- function checkArguments() {
2187
- var obj = flag(this, "object"), type = _.type(obj);
2188
- this.assert("Arguments" === type, "expected #{this} to be arguments but got " + type, "expected #{this} to not be arguments");
2189
- }
2190
- Assertion2.addProperty("arguments", checkArguments);
2191
- Assertion2.addProperty("Arguments", checkArguments);
2192
- function assertEqual(val, msg) {
2193
- if (msg)
2194
- flag(this, "message", msg);
2195
- var obj = flag(this, "object");
2196
- if (flag(this, "deep")) {
2197
- var prevLockSsfi = flag(this, "lockSsfi");
2198
- flag(this, "lockSsfi", true);
2199
- this.eql(val);
2200
- flag(this, "lockSsfi", prevLockSsfi);
2201
- } else {
2202
- this.assert(val === obj, "expected #{this} to equal #{exp}", "expected #{this} to not equal #{exp}", val, this._obj, true);
2203
- }
2204
- }
2205
- Assertion2.addMethod("equal", assertEqual);
2206
- Assertion2.addMethod("equals", assertEqual);
2207
- Assertion2.addMethod("eq", assertEqual);
2208
- function assertEql(obj, msg) {
2209
- if (msg)
2210
- flag(this, "message", msg);
2211
- this.assert(_.eql(obj, flag(this, "object")), "expected #{this} to deeply equal #{exp}", "expected #{this} to not deeply equal #{exp}", obj, this._obj, true);
2212
- }
2213
- Assertion2.addMethod("eql", assertEql);
2214
- Assertion2.addMethod("eqls", assertEql);
2215
- function assertAbove(n, msg) {
2216
- if (msg)
2217
- flag(this, "message", msg);
2218
- var obj = flag(this, "object"), doLength = flag(this, "doLength"), flagMsg = flag(this, "message"), msgPrefix = flagMsg ? flagMsg + ": " : "", ssfi = flag(this, "ssfi"), objType = _.type(obj).toLowerCase(), nType = _.type(n).toLowerCase(), errorMessage, shouldThrow = true;
2219
- if (doLength && objType !== "map" && objType !== "set") {
2220
- new Assertion2(obj, flagMsg, ssfi, true).to.have.property("length");
2221
- }
2222
- if (!doLength && (objType === "date" && nType !== "date")) {
2223
- errorMessage = msgPrefix + "the argument to above must be a date";
2224
- } else if (nType !== "number" && (doLength || objType === "number")) {
2225
- errorMessage = msgPrefix + "the argument to above must be a number";
2226
- } else if (!doLength && (objType !== "date" && objType !== "number")) {
2227
- var printObj = objType === "string" ? "'" + obj + "'" : obj;
2228
- errorMessage = msgPrefix + "expected " + printObj + " to be a number or a date";
2229
- } else {
2230
- shouldThrow = false;
2231
- }
2232
- if (shouldThrow) {
2233
- throw new AssertionError2(errorMessage, void 0, ssfi);
2234
- }
2235
- if (doLength) {
2236
- var descriptor = "length", itemsCount;
2237
- if (objType === "map" || objType === "set") {
2238
- descriptor = "size";
2239
- itemsCount = obj.size;
2240
- } else {
2241
- itemsCount = obj.length;
2242
- }
2243
- this.assert(itemsCount > n, "expected #{this} to have a " + descriptor + " above #{exp} but got #{act}", "expected #{this} to not have a " + descriptor + " above #{exp}", n, itemsCount);
2244
- } else {
2245
- this.assert(obj > n, "expected #{this} to be above #{exp}", "expected #{this} to be at most #{exp}", n);
2246
- }
2247
- }
2248
- Assertion2.addMethod("above", assertAbove);
2249
- Assertion2.addMethod("gt", assertAbove);
2250
- Assertion2.addMethod("greaterThan", assertAbove);
2251
- function assertLeast(n, msg) {
2252
- if (msg)
2253
- flag(this, "message", msg);
2254
- var obj = flag(this, "object"), doLength = flag(this, "doLength"), flagMsg = flag(this, "message"), msgPrefix = flagMsg ? flagMsg + ": " : "", ssfi = flag(this, "ssfi"), objType = _.type(obj).toLowerCase(), nType = _.type(n).toLowerCase(), errorMessage, shouldThrow = true;
2255
- if (doLength && objType !== "map" && objType !== "set") {
2256
- new Assertion2(obj, flagMsg, ssfi, true).to.have.property("length");
2257
- }
2258
- if (!doLength && (objType === "date" && nType !== "date")) {
2259
- errorMessage = msgPrefix + "the argument to least must be a date";
2260
- } else if (nType !== "number" && (doLength || objType === "number")) {
2261
- errorMessage = msgPrefix + "the argument to least must be a number";
2262
- } else if (!doLength && (objType !== "date" && objType !== "number")) {
2263
- var printObj = objType === "string" ? "'" + obj + "'" : obj;
2264
- errorMessage = msgPrefix + "expected " + printObj + " to be a number or a date";
2265
- } else {
2266
- shouldThrow = false;
2267
- }
2268
- if (shouldThrow) {
2269
- throw new AssertionError2(errorMessage, void 0, ssfi);
2270
- }
2271
- if (doLength) {
2272
- var descriptor = "length", itemsCount;
2273
- if (objType === "map" || objType === "set") {
2274
- descriptor = "size";
2275
- itemsCount = obj.size;
2276
- } else {
2277
- itemsCount = obj.length;
2278
- }
2279
- this.assert(itemsCount >= n, "expected #{this} to have a " + descriptor + " at least #{exp} but got #{act}", "expected #{this} to have a " + descriptor + " below #{exp}", n, itemsCount);
2280
- } else {
2281
- this.assert(obj >= n, "expected #{this} to be at least #{exp}", "expected #{this} to be below #{exp}", n);
2282
- }
2283
- }
2284
- Assertion2.addMethod("least", assertLeast);
2285
- Assertion2.addMethod("gte", assertLeast);
2286
- Assertion2.addMethod("greaterThanOrEqual", assertLeast);
2287
- function assertBelow(n, msg) {
2288
- if (msg)
2289
- flag(this, "message", msg);
2290
- var obj = flag(this, "object"), doLength = flag(this, "doLength"), flagMsg = flag(this, "message"), msgPrefix = flagMsg ? flagMsg + ": " : "", ssfi = flag(this, "ssfi"), objType = _.type(obj).toLowerCase(), nType = _.type(n).toLowerCase(), errorMessage, shouldThrow = true;
2291
- if (doLength && objType !== "map" && objType !== "set") {
2292
- new Assertion2(obj, flagMsg, ssfi, true).to.have.property("length");
2293
- }
2294
- if (!doLength && (objType === "date" && nType !== "date")) {
2295
- errorMessage = msgPrefix + "the argument to below must be a date";
2296
- } else if (nType !== "number" && (doLength || objType === "number")) {
2297
- errorMessage = msgPrefix + "the argument to below must be a number";
2298
- } else if (!doLength && (objType !== "date" && objType !== "number")) {
2299
- var printObj = objType === "string" ? "'" + obj + "'" : obj;
2300
- errorMessage = msgPrefix + "expected " + printObj + " to be a number or a date";
2301
- } else {
2302
- shouldThrow = false;
2303
- }
2304
- if (shouldThrow) {
2305
- throw new AssertionError2(errorMessage, void 0, ssfi);
2306
- }
2307
- if (doLength) {
2308
- var descriptor = "length", itemsCount;
2309
- if (objType === "map" || objType === "set") {
2310
- descriptor = "size";
2311
- itemsCount = obj.size;
2312
- } else {
2313
- itemsCount = obj.length;
2314
- }
2315
- this.assert(itemsCount < n, "expected #{this} to have a " + descriptor + " below #{exp} but got #{act}", "expected #{this} to not have a " + descriptor + " below #{exp}", n, itemsCount);
2316
- } else {
2317
- this.assert(obj < n, "expected #{this} to be below #{exp}", "expected #{this} to be at least #{exp}", n);
2318
- }
2319
- }
2320
- Assertion2.addMethod("below", assertBelow);
2321
- Assertion2.addMethod("lt", assertBelow);
2322
- Assertion2.addMethod("lessThan", assertBelow);
2323
- function assertMost(n, msg) {
2324
- if (msg)
2325
- flag(this, "message", msg);
2326
- var obj = flag(this, "object"), doLength = flag(this, "doLength"), flagMsg = flag(this, "message"), msgPrefix = flagMsg ? flagMsg + ": " : "", ssfi = flag(this, "ssfi"), objType = _.type(obj).toLowerCase(), nType = _.type(n).toLowerCase(), errorMessage, shouldThrow = true;
2327
- if (doLength && objType !== "map" && objType !== "set") {
2328
- new Assertion2(obj, flagMsg, ssfi, true).to.have.property("length");
2329
- }
2330
- if (!doLength && (objType === "date" && nType !== "date")) {
2331
- errorMessage = msgPrefix + "the argument to most must be a date";
2332
- } else if (nType !== "number" && (doLength || objType === "number")) {
2333
- errorMessage = msgPrefix + "the argument to most must be a number";
2334
- } else if (!doLength && (objType !== "date" && objType !== "number")) {
2335
- var printObj = objType === "string" ? "'" + obj + "'" : obj;
2336
- errorMessage = msgPrefix + "expected " + printObj + " to be a number or a date";
2337
- } else {
2338
- shouldThrow = false;
2339
- }
2340
- if (shouldThrow) {
2341
- throw new AssertionError2(errorMessage, void 0, ssfi);
2342
- }
2343
- if (doLength) {
2344
- var descriptor = "length", itemsCount;
2345
- if (objType === "map" || objType === "set") {
2346
- descriptor = "size";
2347
- itemsCount = obj.size;
2348
- } else {
2349
- itemsCount = obj.length;
2350
- }
2351
- this.assert(itemsCount <= n, "expected #{this} to have a " + descriptor + " at most #{exp} but got #{act}", "expected #{this} to have a " + descriptor + " above #{exp}", n, itemsCount);
2352
- } else {
2353
- this.assert(obj <= n, "expected #{this} to be at most #{exp}", "expected #{this} to be above #{exp}", n);
2354
- }
2355
- }
2356
- Assertion2.addMethod("most", assertMost);
2357
- Assertion2.addMethod("lte", assertMost);
2358
- Assertion2.addMethod("lessThanOrEqual", assertMost);
2359
- Assertion2.addMethod("within", function(start, finish, msg) {
2360
- if (msg)
2361
- flag(this, "message", msg);
2362
- var obj = flag(this, "object"), doLength = flag(this, "doLength"), flagMsg = flag(this, "message"), msgPrefix = flagMsg ? flagMsg + ": " : "", ssfi = flag(this, "ssfi"), objType = _.type(obj).toLowerCase(), startType = _.type(start).toLowerCase(), finishType = _.type(finish).toLowerCase(), errorMessage, shouldThrow = true, range = startType === "date" && finishType === "date" ? start.toISOString() + ".." + finish.toISOString() : start + ".." + finish;
2363
- if (doLength && objType !== "map" && objType !== "set") {
2364
- new Assertion2(obj, flagMsg, ssfi, true).to.have.property("length");
2365
- }
2366
- if (!doLength && (objType === "date" && (startType !== "date" || finishType !== "date"))) {
2367
- errorMessage = msgPrefix + "the arguments to within must be dates";
2368
- } else if ((startType !== "number" || finishType !== "number") && (doLength || objType === "number")) {
2369
- errorMessage = msgPrefix + "the arguments to within must be numbers";
2370
- } else if (!doLength && (objType !== "date" && objType !== "number")) {
2371
- var printObj = objType === "string" ? "'" + obj + "'" : obj;
2372
- errorMessage = msgPrefix + "expected " + printObj + " to be a number or a date";
2373
- } else {
2374
- shouldThrow = false;
2375
- }
2376
- if (shouldThrow) {
2377
- throw new AssertionError2(errorMessage, void 0, ssfi);
2378
- }
2379
- if (doLength) {
2380
- var descriptor = "length", itemsCount;
2381
- if (objType === "map" || objType === "set") {
2382
- descriptor = "size";
2383
- itemsCount = obj.size;
2384
- } else {
2385
- itemsCount = obj.length;
2386
- }
2387
- this.assert(itemsCount >= start && itemsCount <= finish, "expected #{this} to have a " + descriptor + " within " + range, "expected #{this} to not have a " + descriptor + " within " + range);
2388
- } else {
2389
- this.assert(obj >= start && obj <= finish, "expected #{this} to be within " + range, "expected #{this} to not be within " + range);
2390
- }
2391
- });
2392
- function assertInstanceOf(constructor, msg) {
2393
- if (msg)
2394
- flag(this, "message", msg);
2395
- var target = flag(this, "object");
2396
- var ssfi = flag(this, "ssfi");
2397
- var flagMsg = flag(this, "message");
2398
- try {
2399
- var isInstanceOf = target instanceof constructor;
2400
- } catch (err) {
2401
- if (err instanceof TypeError) {
2402
- flagMsg = flagMsg ? flagMsg + ": " : "";
2403
- throw new AssertionError2(flagMsg + "The instanceof assertion needs a constructor but " + _.type(constructor) + " was given.", void 0, ssfi);
2404
- }
2405
- throw err;
2406
- }
2407
- var name = _.getName(constructor);
2408
- if (name === null) {
2409
- name = "an unnamed constructor";
2410
- }
2411
- this.assert(isInstanceOf, "expected #{this} to be an instance of " + name, "expected #{this} to not be an instance of " + name);
2412
- }
2413
- ;
2414
- Assertion2.addMethod("instanceof", assertInstanceOf);
2415
- Assertion2.addMethod("instanceOf", assertInstanceOf);
2416
- function assertProperty(name, val, msg) {
2417
- if (msg)
2418
- flag(this, "message", msg);
2419
- var isNested = flag(this, "nested"), isOwn = flag(this, "own"), flagMsg = flag(this, "message"), obj = flag(this, "object"), ssfi = flag(this, "ssfi"), nameType = typeof name;
2420
- flagMsg = flagMsg ? flagMsg + ": " : "";
2421
- if (isNested) {
2422
- if (nameType !== "string") {
2423
- throw new AssertionError2(flagMsg + "the argument to property must be a string when using nested syntax", void 0, ssfi);
2424
- }
2425
- } else {
2426
- if (nameType !== "string" && nameType !== "number" && nameType !== "symbol") {
2427
- throw new AssertionError2(flagMsg + "the argument to property must be a string, number, or symbol", void 0, ssfi);
2428
- }
2429
- }
2430
- if (isNested && isOwn) {
2431
- throw new AssertionError2(flagMsg + 'The "nested" and "own" flags cannot be combined.', void 0, ssfi);
2432
- }
2433
- if (obj === null || obj === void 0) {
2434
- throw new AssertionError2(flagMsg + "Target cannot be null or undefined.", void 0, ssfi);
2435
- }
2436
- var isDeep = flag(this, "deep"), negate = flag(this, "negate"), pathInfo = isNested ? _.getPathInfo(obj, name) : null, value = isNested ? pathInfo.value : obj[name];
2437
- var descriptor = "";
2438
- if (isDeep)
2439
- descriptor += "deep ";
2440
- if (isOwn)
2441
- descriptor += "own ";
2442
- if (isNested)
2443
- descriptor += "nested ";
2444
- descriptor += "property ";
2445
- var hasProperty;
2446
- if (isOwn)
2447
- hasProperty = Object.prototype.hasOwnProperty.call(obj, name);
2448
- else if (isNested)
2449
- hasProperty = pathInfo.exists;
2450
- else
2451
- hasProperty = _.hasProperty(obj, name);
2452
- if (!negate || arguments.length === 1) {
2453
- this.assert(hasProperty, "expected #{this} to have " + descriptor + _.inspect(name), "expected #{this} to not have " + descriptor + _.inspect(name));
2454
- }
2455
- if (arguments.length > 1) {
2456
- this.assert(hasProperty && (isDeep ? _.eql(val, value) : val === value), "expected #{this} to have " + descriptor + _.inspect(name) + " of #{exp}, but got #{act}", "expected #{this} to not have " + descriptor + _.inspect(name) + " of #{act}", val, value);
2457
- }
2458
- flag(this, "object", value);
2459
- }
2460
- Assertion2.addMethod("property", assertProperty);
2461
- function assertOwnProperty(name, value, msg) {
2462
- flag(this, "own", true);
2463
- assertProperty.apply(this, arguments);
2464
- }
2465
- Assertion2.addMethod("ownProperty", assertOwnProperty);
2466
- Assertion2.addMethod("haveOwnProperty", assertOwnProperty);
2467
- function assertOwnPropertyDescriptor(name, descriptor, msg) {
2468
- if (typeof descriptor === "string") {
2469
- msg = descriptor;
2470
- descriptor = null;
2471
- }
2472
- if (msg)
2473
- flag(this, "message", msg);
2474
- var obj = flag(this, "object");
2475
- var actualDescriptor = Object.getOwnPropertyDescriptor(Object(obj), name);
2476
- if (actualDescriptor && descriptor) {
2477
- this.assert(_.eql(descriptor, actualDescriptor), "expected the own property descriptor for " + _.inspect(name) + " on #{this} to match " + _.inspect(descriptor) + ", got " + _.inspect(actualDescriptor), "expected the own property descriptor for " + _.inspect(name) + " on #{this} to not match " + _.inspect(descriptor), descriptor, actualDescriptor, true);
2478
- } else {
2479
- this.assert(actualDescriptor, "expected #{this} to have an own property descriptor for " + _.inspect(name), "expected #{this} to not have an own property descriptor for " + _.inspect(name));
2480
- }
2481
- flag(this, "object", actualDescriptor);
2482
- }
2483
- Assertion2.addMethod("ownPropertyDescriptor", assertOwnPropertyDescriptor);
2484
- Assertion2.addMethod("haveOwnPropertyDescriptor", assertOwnPropertyDescriptor);
2485
- function assertLengthChain() {
2486
- flag(this, "doLength", true);
2487
- }
2488
- function assertLength(n, msg) {
2489
- if (msg)
2490
- flag(this, "message", msg);
2491
- var obj = flag(this, "object"), objType = _.type(obj).toLowerCase(), flagMsg = flag(this, "message"), ssfi = flag(this, "ssfi"), descriptor = "length", itemsCount;
2492
- switch (objType) {
2493
- case "map":
2494
- case "set":
2495
- descriptor = "size";
2496
- itemsCount = obj.size;
2497
- break;
2498
- default:
2499
- new Assertion2(obj, flagMsg, ssfi, true).to.have.property("length");
2500
- itemsCount = obj.length;
2501
- }
2502
- this.assert(itemsCount == n, "expected #{this} to have a " + descriptor + " of #{exp} but got #{act}", "expected #{this} to not have a " + descriptor + " of #{act}", n, itemsCount);
2503
- }
2504
- Assertion2.addChainableMethod("length", assertLength, assertLengthChain);
2505
- Assertion2.addChainableMethod("lengthOf", assertLength, assertLengthChain);
2506
- function assertMatch(re, msg) {
2507
- if (msg)
2508
- flag(this, "message", msg);
2509
- var obj = flag(this, "object");
2510
- this.assert(re.exec(obj), "expected #{this} to match " + re, "expected #{this} not to match " + re);
2511
- }
2512
- Assertion2.addMethod("match", assertMatch);
2513
- Assertion2.addMethod("matches", assertMatch);
2514
- Assertion2.addMethod("string", function(str, msg) {
2515
- if (msg)
2516
- flag(this, "message", msg);
2517
- var obj = flag(this, "object"), flagMsg = flag(this, "message"), ssfi = flag(this, "ssfi");
2518
- new Assertion2(obj, flagMsg, ssfi, true).is.a("string");
2519
- this.assert(~obj.indexOf(str), "expected #{this} to contain " + _.inspect(str), "expected #{this} to not contain " + _.inspect(str));
2520
- });
2521
- function assertKeys(keys) {
2522
- var obj = flag(this, "object"), objType = _.type(obj), keysType = _.type(keys), ssfi = flag(this, "ssfi"), isDeep = flag(this, "deep"), str, deepStr = "", actual, ok = true, flagMsg = flag(this, "message");
2523
- flagMsg = flagMsg ? flagMsg + ": " : "";
2524
- var mixedArgsMsg = flagMsg + "when testing keys against an object or an array you must give a single Array|Object|String argument or multiple String arguments";
2525
- if (objType === "Map" || objType === "Set") {
2526
- deepStr = isDeep ? "deeply " : "";
2527
- actual = [];
2528
- obj.forEach(function(val, key) {
2529
- actual.push(key);
2530
- });
2531
- if (keysType !== "Array") {
2532
- keys = Array.prototype.slice.call(arguments);
2533
- }
2534
- } else {
2535
- actual = _.getOwnEnumerableProperties(obj);
2536
- switch (keysType) {
2537
- case "Array":
2538
- if (arguments.length > 1) {
2539
- throw new AssertionError2(mixedArgsMsg, void 0, ssfi);
2540
- }
2541
- break;
2542
- case "Object":
2543
- if (arguments.length > 1) {
2544
- throw new AssertionError2(mixedArgsMsg, void 0, ssfi);
2545
- }
2546
- keys = Object.keys(keys);
2547
- break;
2548
- default:
2549
- keys = Array.prototype.slice.call(arguments);
2550
- }
2551
- keys = keys.map(function(val) {
2552
- return typeof val === "symbol" ? val : String(val);
2553
- });
2554
- }
2555
- if (!keys.length) {
2556
- throw new AssertionError2(flagMsg + "keys required", void 0, ssfi);
2557
- }
2558
- var len = keys.length, any = flag(this, "any"), all = flag(this, "all"), expected = keys;
2559
- if (!any && !all) {
2560
- all = true;
2561
- }
2562
- if (any) {
2563
- ok = expected.some(function(expectedKey) {
2564
- return actual.some(function(actualKey) {
2565
- if (isDeep) {
2566
- return _.eql(expectedKey, actualKey);
2567
- } else {
2568
- return expectedKey === actualKey;
2569
- }
2570
- });
2571
- });
2572
- }
2573
- if (all) {
2574
- ok = expected.every(function(expectedKey) {
2575
- return actual.some(function(actualKey) {
2576
- if (isDeep) {
2577
- return _.eql(expectedKey, actualKey);
2578
- } else {
2579
- return expectedKey === actualKey;
2580
- }
2581
- });
2582
- });
2583
- if (!flag(this, "contains")) {
2584
- ok = ok && keys.length == actual.length;
2585
- }
2586
- }
2587
- if (len > 1) {
2588
- keys = keys.map(function(key) {
2589
- return _.inspect(key);
2590
- });
2591
- var last = keys.pop();
2592
- if (all) {
2593
- str = keys.join(", ") + ", and " + last;
2594
- }
2595
- if (any) {
2596
- str = keys.join(", ") + ", or " + last;
2597
- }
2598
- } else {
2599
- str = _.inspect(keys[0]);
2600
- }
2601
- str = (len > 1 ? "keys " : "key ") + str;
2602
- str = (flag(this, "contains") ? "contain " : "have ") + str;
2603
- this.assert(ok, "expected #{this} to " + deepStr + str, "expected #{this} to not " + deepStr + str, expected.slice(0).sort(_.compareByInspect), actual.sort(_.compareByInspect), true);
2604
- }
2605
- Assertion2.addMethod("keys", assertKeys);
2606
- Assertion2.addMethod("key", assertKeys);
2607
- function assertThrows(errorLike, errMsgMatcher, msg) {
2608
- if (msg)
2609
- flag(this, "message", msg);
2610
- var obj = flag(this, "object"), ssfi = flag(this, "ssfi"), flagMsg = flag(this, "message"), negate = flag(this, "negate") || false;
2611
- new Assertion2(obj, flagMsg, ssfi, true).is.a("function");
2612
- if (errorLike instanceof RegExp || typeof errorLike === "string") {
2613
- errMsgMatcher = errorLike;
2614
- errorLike = null;
2615
- }
2616
- var caughtErr;
2617
- try {
2618
- obj();
2619
- } catch (err) {
2620
- caughtErr = err;
2621
- }
2622
- var everyArgIsUndefined = errorLike === void 0 && errMsgMatcher === void 0;
2623
- var everyArgIsDefined = Boolean(errorLike && errMsgMatcher);
2624
- var errorLikeFail = false;
2625
- var errMsgMatcherFail = false;
2626
- if (everyArgIsUndefined || !everyArgIsUndefined && !negate) {
2627
- var errorLikeString = "an error";
2628
- if (errorLike instanceof Error) {
2629
- errorLikeString = "#{exp}";
2630
- } else if (errorLike) {
2631
- errorLikeString = _.checkError.getConstructorName(errorLike);
2632
- }
2633
- this.assert(caughtErr, "expected #{this} to throw " + errorLikeString, "expected #{this} to not throw an error but #{act} was thrown", errorLike && errorLike.toString(), caughtErr instanceof Error ? caughtErr.toString() : typeof caughtErr === "string" ? caughtErr : caughtErr && _.checkError.getConstructorName(caughtErr));
2634
- }
2635
- if (errorLike && caughtErr) {
2636
- if (errorLike instanceof Error) {
2637
- var isCompatibleInstance = _.checkError.compatibleInstance(caughtErr, errorLike);
2638
- if (isCompatibleInstance === negate) {
2639
- if (everyArgIsDefined && negate) {
2640
- errorLikeFail = true;
2641
- } else {
2642
- this.assert(negate, "expected #{this} to throw #{exp} but #{act} was thrown", "expected #{this} to not throw #{exp}" + (caughtErr && !negate ? " but #{act} was thrown" : ""), errorLike.toString(), caughtErr.toString());
2643
- }
2644
- }
2645
- }
2646
- var isCompatibleConstructor = _.checkError.compatibleConstructor(caughtErr, errorLike);
2647
- if (isCompatibleConstructor === negate) {
2648
- if (everyArgIsDefined && negate) {
2649
- errorLikeFail = true;
2650
- } else {
2651
- this.assert(negate, "expected #{this} to throw #{exp} but #{act} was thrown", "expected #{this} to not throw #{exp}" + (caughtErr ? " but #{act} was thrown" : ""), errorLike instanceof Error ? errorLike.toString() : errorLike && _.checkError.getConstructorName(errorLike), caughtErr instanceof Error ? caughtErr.toString() : caughtErr && _.checkError.getConstructorName(caughtErr));
2652
- }
2653
- }
2654
- }
2655
- if (caughtErr && errMsgMatcher !== void 0 && errMsgMatcher !== null) {
2656
- var placeholder = "including";
2657
- if (errMsgMatcher instanceof RegExp) {
2658
- placeholder = "matching";
2659
- }
2660
- var isCompatibleMessage = _.checkError.compatibleMessage(caughtErr, errMsgMatcher);
2661
- if (isCompatibleMessage === negate) {
2662
- if (everyArgIsDefined && negate) {
2663
- errMsgMatcherFail = true;
2664
- } else {
2665
- this.assert(negate, "expected #{this} to throw error " + placeholder + " #{exp} but got #{act}", "expected #{this} to throw error not " + placeholder + " #{exp}", errMsgMatcher, _.checkError.getMessage(caughtErr));
2666
- }
2667
- }
2668
- }
2669
- if (errorLikeFail && errMsgMatcherFail) {
2670
- this.assert(negate, "expected #{this} to throw #{exp} but #{act} was thrown", "expected #{this} to not throw #{exp}" + (caughtErr ? " but #{act} was thrown" : ""), errorLike instanceof Error ? errorLike.toString() : errorLike && _.checkError.getConstructorName(errorLike), caughtErr instanceof Error ? caughtErr.toString() : caughtErr && _.checkError.getConstructorName(caughtErr));
2671
- }
2672
- flag(this, "object", caughtErr);
2673
- }
2674
- ;
2675
- Assertion2.addMethod("throw", assertThrows);
2676
- Assertion2.addMethod("throws", assertThrows);
2677
- Assertion2.addMethod("Throw", assertThrows);
2678
- function respondTo(method, msg) {
2679
- if (msg)
2680
- flag(this, "message", msg);
2681
- var obj = flag(this, "object"), itself = flag(this, "itself"), context = "function" === typeof obj && !itself ? obj.prototype[method] : obj[method];
2682
- this.assert("function" === typeof context, "expected #{this} to respond to " + _.inspect(method), "expected #{this} to not respond to " + _.inspect(method));
2683
- }
2684
- Assertion2.addMethod("respondTo", respondTo);
2685
- Assertion2.addMethod("respondsTo", respondTo);
2686
- Assertion2.addProperty("itself", function() {
2687
- flag(this, "itself", true);
2688
- });
2689
- function satisfy(matcher, msg) {
2690
- if (msg)
2691
- flag(this, "message", msg);
2692
- var obj = flag(this, "object");
2693
- var result = matcher(obj);
2694
- this.assert(result, "expected #{this} to satisfy " + _.objDisplay(matcher), "expected #{this} to not satisfy" + _.objDisplay(matcher), flag(this, "negate") ? false : true, result);
2695
- }
2696
- Assertion2.addMethod("satisfy", satisfy);
2697
- Assertion2.addMethod("satisfies", satisfy);
2698
- function closeTo(expected, delta, msg) {
2699
- if (msg)
2700
- flag(this, "message", msg);
2701
- var obj = flag(this, "object"), flagMsg = flag(this, "message"), ssfi = flag(this, "ssfi");
2702
- new Assertion2(obj, flagMsg, ssfi, true).is.a("number");
2703
- if (typeof expected !== "number" || typeof delta !== "number") {
2704
- flagMsg = flagMsg ? flagMsg + ": " : "";
2705
- var deltaMessage = delta === void 0 ? ", and a delta is required" : "";
2706
- throw new AssertionError2(flagMsg + "the arguments to closeTo or approximately must be numbers" + deltaMessage, void 0, ssfi);
2707
- }
2708
- this.assert(Math.abs(obj - expected) <= delta, "expected #{this} to be close to " + expected + " +/- " + delta, "expected #{this} not to be close to " + expected + " +/- " + delta);
2709
- }
2710
- Assertion2.addMethod("closeTo", closeTo);
2711
- Assertion2.addMethod("approximately", closeTo);
2712
- function isSubsetOf(subset, superset, cmp, contains, ordered) {
2713
- if (!contains) {
2714
- if (subset.length !== superset.length)
2715
- return false;
2716
- superset = superset.slice();
2717
- }
2718
- return subset.every(function(elem, idx) {
2719
- if (ordered)
2720
- return cmp ? cmp(elem, superset[idx]) : elem === superset[idx];
2721
- if (!cmp) {
2722
- var matchIdx = superset.indexOf(elem);
2723
- if (matchIdx === -1)
2724
- return false;
2725
- if (!contains)
2726
- superset.splice(matchIdx, 1);
2727
- return true;
2728
- }
2729
- return superset.some(function(elem2, matchIdx2) {
2730
- if (!cmp(elem, elem2))
2731
- return false;
2732
- if (!contains)
2733
- superset.splice(matchIdx2, 1);
2734
- return true;
2735
- });
2736
- });
2737
- }
2738
- Assertion2.addMethod("members", function(subset, msg) {
2739
- if (msg)
2740
- flag(this, "message", msg);
2741
- var obj = flag(this, "object"), flagMsg = flag(this, "message"), ssfi = flag(this, "ssfi");
2742
- new Assertion2(obj, flagMsg, ssfi, true).to.be.an("array");
2743
- new Assertion2(subset, flagMsg, ssfi, true).to.be.an("array");
2744
- var contains = flag(this, "contains");
2745
- var ordered = flag(this, "ordered");
2746
- var subject, failMsg, failNegateMsg;
2747
- if (contains) {
2748
- subject = ordered ? "an ordered superset" : "a superset";
2749
- failMsg = "expected #{this} to be " + subject + " of #{exp}";
2750
- failNegateMsg = "expected #{this} to not be " + subject + " of #{exp}";
2751
- } else {
2752
- subject = ordered ? "ordered members" : "members";
2753
- failMsg = "expected #{this} to have the same " + subject + " as #{exp}";
2754
- failNegateMsg = "expected #{this} to not have the same " + subject + " as #{exp}";
2755
- }
2756
- var cmp = flag(this, "deep") ? _.eql : void 0;
2757
- this.assert(isSubsetOf(subset, obj, cmp, contains, ordered), failMsg, failNegateMsg, subset, obj, true);
2758
- });
2759
- function oneOf(list, msg) {
2760
- if (msg)
2761
- flag(this, "message", msg);
2762
- var expected = flag(this, "object"), flagMsg = flag(this, "message"), ssfi = flag(this, "ssfi"), contains = flag(this, "contains"), isDeep = flag(this, "deep");
2763
- new Assertion2(list, flagMsg, ssfi, true).to.be.an("array");
2764
- if (contains) {
2765
- this.assert(list.some(function(possibility) {
2766
- return expected.indexOf(possibility) > -1;
2767
- }), "expected #{this} to contain one of #{exp}", "expected #{this} to not contain one of #{exp}", list, expected);
2768
- } else {
2769
- if (isDeep) {
2770
- this.assert(list.some(function(possibility) {
2771
- return _.eql(expected, possibility);
2772
- }), "expected #{this} to deeply equal one of #{exp}", "expected #{this} to deeply equal one of #{exp}", list, expected);
2773
- } else {
2774
- this.assert(list.indexOf(expected) > -1, "expected #{this} to be one of #{exp}", "expected #{this} to not be one of #{exp}", list, expected);
2775
- }
2776
- }
2777
- }
2778
- Assertion2.addMethod("oneOf", oneOf);
2779
- function assertChanges(subject, prop, msg) {
2780
- if (msg)
2781
- flag(this, "message", msg);
2782
- var fn = flag(this, "object"), flagMsg = flag(this, "message"), ssfi = flag(this, "ssfi");
2783
- new Assertion2(fn, flagMsg, ssfi, true).is.a("function");
2784
- var initial;
2785
- if (!prop) {
2786
- new Assertion2(subject, flagMsg, ssfi, true).is.a("function");
2787
- initial = subject();
2788
- } else {
2789
- new Assertion2(subject, flagMsg, ssfi, true).to.have.property(prop);
2790
- initial = subject[prop];
2791
- }
2792
- fn();
2793
- var final = prop === void 0 || prop === null ? subject() : subject[prop];
2794
- var msgObj = prop === void 0 || prop === null ? initial : "." + prop;
2795
- flag(this, "deltaMsgObj", msgObj);
2796
- flag(this, "initialDeltaValue", initial);
2797
- flag(this, "finalDeltaValue", final);
2798
- flag(this, "deltaBehavior", "change");
2799
- flag(this, "realDelta", final !== initial);
2800
- this.assert(initial !== final, "expected " + msgObj + " to change", "expected " + msgObj + " to not change");
2801
- }
2802
- Assertion2.addMethod("change", assertChanges);
2803
- Assertion2.addMethod("changes", assertChanges);
2804
- function assertIncreases(subject, prop, msg) {
2805
- if (msg)
2806
- flag(this, "message", msg);
2807
- var fn = flag(this, "object"), flagMsg = flag(this, "message"), ssfi = flag(this, "ssfi");
2808
- new Assertion2(fn, flagMsg, ssfi, true).is.a("function");
2809
- var initial;
2810
- if (!prop) {
2811
- new Assertion2(subject, flagMsg, ssfi, true).is.a("function");
2812
- initial = subject();
2813
- } else {
2814
- new Assertion2(subject, flagMsg, ssfi, true).to.have.property(prop);
2815
- initial = subject[prop];
2816
- }
2817
- new Assertion2(initial, flagMsg, ssfi, true).is.a("number");
2818
- fn();
2819
- var final = prop === void 0 || prop === null ? subject() : subject[prop];
2820
- var msgObj = prop === void 0 || prop === null ? initial : "." + prop;
2821
- flag(this, "deltaMsgObj", msgObj);
2822
- flag(this, "initialDeltaValue", initial);
2823
- flag(this, "finalDeltaValue", final);
2824
- flag(this, "deltaBehavior", "increase");
2825
- flag(this, "realDelta", final - initial);
2826
- this.assert(final - initial > 0, "expected " + msgObj + " to increase", "expected " + msgObj + " to not increase");
2827
- }
2828
- Assertion2.addMethod("increase", assertIncreases);
2829
- Assertion2.addMethod("increases", assertIncreases);
2830
- function assertDecreases(subject, prop, msg) {
2831
- if (msg)
2832
- flag(this, "message", msg);
2833
- var fn = flag(this, "object"), flagMsg = flag(this, "message"), ssfi = flag(this, "ssfi");
2834
- new Assertion2(fn, flagMsg, ssfi, true).is.a("function");
2835
- var initial;
2836
- if (!prop) {
2837
- new Assertion2(subject, flagMsg, ssfi, true).is.a("function");
2838
- initial = subject();
2839
- } else {
2840
- new Assertion2(subject, flagMsg, ssfi, true).to.have.property(prop);
2841
- initial = subject[prop];
2842
- }
2843
- new Assertion2(initial, flagMsg, ssfi, true).is.a("number");
2844
- fn();
2845
- var final = prop === void 0 || prop === null ? subject() : subject[prop];
2846
- var msgObj = prop === void 0 || prop === null ? initial : "." + prop;
2847
- flag(this, "deltaMsgObj", msgObj);
2848
- flag(this, "initialDeltaValue", initial);
2849
- flag(this, "finalDeltaValue", final);
2850
- flag(this, "deltaBehavior", "decrease");
2851
- flag(this, "realDelta", initial - final);
2852
- this.assert(final - initial < 0, "expected " + msgObj + " to decrease", "expected " + msgObj + " to not decrease");
2853
- }
2854
- Assertion2.addMethod("decrease", assertDecreases);
2855
- Assertion2.addMethod("decreases", assertDecreases);
2856
- function assertDelta(delta, msg) {
2857
- if (msg)
2858
- flag(this, "message", msg);
2859
- var msgObj = flag(this, "deltaMsgObj");
2860
- var initial = flag(this, "initialDeltaValue");
2861
- var final = flag(this, "finalDeltaValue");
2862
- var behavior = flag(this, "deltaBehavior");
2863
- var realDelta = flag(this, "realDelta");
2864
- var expression;
2865
- if (behavior === "change") {
2866
- expression = Math.abs(final - initial) === Math.abs(delta);
2867
- } else {
2868
- expression = realDelta === Math.abs(delta);
2869
- }
2870
- this.assert(expression, "expected " + msgObj + " to " + behavior + " by " + delta, "expected " + msgObj + " to not " + behavior + " by " + delta);
2871
- }
2872
- Assertion2.addMethod("by", assertDelta);
2873
- Assertion2.addProperty("extensible", function() {
2874
- var obj = flag(this, "object");
2875
- var isExtensible = obj === Object(obj) && Object.isExtensible(obj);
2876
- this.assert(isExtensible, "expected #{this} to be extensible", "expected #{this} to not be extensible");
2877
- });
2878
- Assertion2.addProperty("sealed", function() {
2879
- var obj = flag(this, "object");
2880
- var isSealed = obj === Object(obj) ? Object.isSealed(obj) : true;
2881
- this.assert(isSealed, "expected #{this} to be sealed", "expected #{this} to not be sealed");
2882
- });
2883
- Assertion2.addProperty("frozen", function() {
2884
- var obj = flag(this, "object");
2885
- var isFrozen = obj === Object(obj) ? Object.isFrozen(obj) : true;
2886
- this.assert(isFrozen, "expected #{this} to be frozen", "expected #{this} to not be frozen");
2887
- });
2888
- Assertion2.addProperty("finite", function(msg) {
2889
- var obj = flag(this, "object");
2890
- this.assert(typeof obj === "number" && isFinite(obj), "expected #{this} to be a finite number", "expected #{this} to not be a finite number");
2891
- });
2892
- };
2893
- }
2894
- });
2895
-
2896
- // node_modules/chai/lib/chai/interface/expect.js
2897
- var require_expect = __commonJS({
2898
- "node_modules/chai/lib/chai/interface/expect.js"(exports, module) {
2899
- module.exports = function(chai2, util2) {
2900
- chai2.expect = function(val, message) {
2901
- return new chai2.Assertion(val, message);
2902
- };
2903
- chai2.expect.fail = function(actual, expected, message, operator) {
2904
- if (arguments.length < 2) {
2905
- message = actual;
2906
- actual = void 0;
2907
- }
2908
- message = message || "expect.fail()";
2909
- throw new chai2.AssertionError(message, {
2910
- actual,
2911
- expected,
2912
- operator
2913
- }, chai2.expect.fail);
2914
- };
2915
- };
2916
- }
2917
- });
2918
-
2919
- // node_modules/chai/lib/chai/interface/should.js
2920
- var require_should = __commonJS({
2921
- "node_modules/chai/lib/chai/interface/should.js"(exports, module) {
2922
- module.exports = function(chai2, util2) {
2923
- var Assertion2 = chai2.Assertion;
2924
- function loadShould() {
2925
- function shouldGetter() {
2926
- if (this instanceof String || this instanceof Number || this instanceof Boolean || typeof Symbol === "function" && this instanceof Symbol || typeof BigInt === "function" && this instanceof BigInt) {
2927
- return new Assertion2(this.valueOf(), null, shouldGetter);
2928
- }
2929
- return new Assertion2(this, null, shouldGetter);
2930
- }
2931
- function shouldSetter(value) {
2932
- Object.defineProperty(this, "should", {
2933
- value,
2934
- enumerable: true,
2935
- configurable: true,
2936
- writable: true
2937
- });
2938
- }
2939
- Object.defineProperty(Object.prototype, "should", {
2940
- set: shouldSetter,
2941
- get: shouldGetter,
2942
- configurable: true
2943
- });
2944
- var should2 = {};
2945
- should2.fail = function(actual, expected, message, operator) {
2946
- if (arguments.length < 2) {
2947
- message = actual;
2948
- actual = void 0;
2949
- }
2950
- message = message || "should.fail()";
2951
- throw new chai2.AssertionError(message, {
2952
- actual,
2953
- expected,
2954
- operator
2955
- }, should2.fail);
2956
- };
2957
- should2.equal = function(val1, val2, msg) {
2958
- new Assertion2(val1, msg).to.equal(val2);
2959
- };
2960
- should2.Throw = function(fn, errt, errs, msg) {
2961
- new Assertion2(fn, msg).to.Throw(errt, errs);
2962
- };
2963
- should2.exist = function(val, msg) {
2964
- new Assertion2(val, msg).to.exist;
2965
- };
2966
- should2.not = {};
2967
- should2.not.equal = function(val1, val2, msg) {
2968
- new Assertion2(val1, msg).to.not.equal(val2);
2969
- };
2970
- should2.not.Throw = function(fn, errt, errs, msg) {
2971
- new Assertion2(fn, msg).to.not.Throw(errt, errs);
2972
- };
2973
- should2.not.exist = function(val, msg) {
2974
- new Assertion2(val, msg).to.not.exist;
2975
- };
2976
- should2["throw"] = should2["Throw"];
2977
- should2.not["throw"] = should2.not["Throw"];
2978
- return should2;
2979
- }
2980
- ;
2981
- chai2.should = loadShould;
2982
- chai2.Should = loadShould;
2983
- };
2984
- }
2985
- });
2986
-
2987
- // node_modules/chai/lib/chai/interface/assert.js
2988
- var require_assert = __commonJS({
2989
- "node_modules/chai/lib/chai/interface/assert.js"(exports, module) {
2990
- module.exports = function(chai2, util2) {
2991
- var Assertion2 = chai2.Assertion, flag = util2.flag;
2992
- var assert2 = chai2.assert = function(express, errmsg) {
2993
- var test = new Assertion2(null, null, chai2.assert, true);
2994
- test.assert(express, errmsg, "[ negation message unavailable ]");
2995
- };
2996
- assert2.fail = function(actual, expected, message, operator) {
2997
- if (arguments.length < 2) {
2998
- message = actual;
2999
- actual = void 0;
3000
- }
3001
- message = message || "assert.fail()";
3002
- throw new chai2.AssertionError(message, {
3003
- actual,
3004
- expected,
3005
- operator
3006
- }, assert2.fail);
3007
- };
3008
- assert2.isOk = function(val, msg) {
3009
- new Assertion2(val, msg, assert2.isOk, true).is.ok;
3010
- };
3011
- assert2.isNotOk = function(val, msg) {
3012
- new Assertion2(val, msg, assert2.isNotOk, true).is.not.ok;
3013
- };
3014
- assert2.equal = function(act, exp, msg) {
3015
- var test = new Assertion2(act, msg, assert2.equal, true);
3016
- test.assert(exp == flag(test, "object"), "expected #{this} to equal #{exp}", "expected #{this} to not equal #{act}", exp, act, true);
3017
- };
3018
- assert2.notEqual = function(act, exp, msg) {
3019
- var test = new Assertion2(act, msg, assert2.notEqual, true);
3020
- test.assert(exp != flag(test, "object"), "expected #{this} to not equal #{exp}", "expected #{this} to equal #{act}", exp, act, true);
3021
- };
3022
- assert2.strictEqual = function(act, exp, msg) {
3023
- new Assertion2(act, msg, assert2.strictEqual, true).to.equal(exp);
3024
- };
3025
- assert2.notStrictEqual = function(act, exp, msg) {
3026
- new Assertion2(act, msg, assert2.notStrictEqual, true).to.not.equal(exp);
3027
- };
3028
- assert2.deepEqual = assert2.deepStrictEqual = function(act, exp, msg) {
3029
- new Assertion2(act, msg, assert2.deepEqual, true).to.eql(exp);
3030
- };
3031
- assert2.notDeepEqual = function(act, exp, msg) {
3032
- new Assertion2(act, msg, assert2.notDeepEqual, true).to.not.eql(exp);
3033
- };
3034
- assert2.isAbove = function(val, abv, msg) {
3035
- new Assertion2(val, msg, assert2.isAbove, true).to.be.above(abv);
3036
- };
3037
- assert2.isAtLeast = function(val, atlst, msg) {
3038
- new Assertion2(val, msg, assert2.isAtLeast, true).to.be.least(atlst);
3039
- };
3040
- assert2.isBelow = function(val, blw, msg) {
3041
- new Assertion2(val, msg, assert2.isBelow, true).to.be.below(blw);
3042
- };
3043
- assert2.isAtMost = function(val, atmst, msg) {
3044
- new Assertion2(val, msg, assert2.isAtMost, true).to.be.most(atmst);
3045
- };
3046
- assert2.isTrue = function(val, msg) {
3047
- new Assertion2(val, msg, assert2.isTrue, true).is["true"];
3048
- };
3049
- assert2.isNotTrue = function(val, msg) {
3050
- new Assertion2(val, msg, assert2.isNotTrue, true).to.not.equal(true);
3051
- };
3052
- assert2.isFalse = function(val, msg) {
3053
- new Assertion2(val, msg, assert2.isFalse, true).is["false"];
3054
- };
3055
- assert2.isNotFalse = function(val, msg) {
3056
- new Assertion2(val, msg, assert2.isNotFalse, true).to.not.equal(false);
3057
- };
3058
- assert2.isNull = function(val, msg) {
3059
- new Assertion2(val, msg, assert2.isNull, true).to.equal(null);
3060
- };
3061
- assert2.isNotNull = function(val, msg) {
3062
- new Assertion2(val, msg, assert2.isNotNull, true).to.not.equal(null);
3063
- };
3064
- assert2.isNaN = function(val, msg) {
3065
- new Assertion2(val, msg, assert2.isNaN, true).to.be.NaN;
3066
- };
3067
- assert2.isNotNaN = function(val, msg) {
3068
- new Assertion2(val, msg, assert2.isNotNaN, true).not.to.be.NaN;
3069
- };
3070
- assert2.exists = function(val, msg) {
3071
- new Assertion2(val, msg, assert2.exists, true).to.exist;
3072
- };
3073
- assert2.notExists = function(val, msg) {
3074
- new Assertion2(val, msg, assert2.notExists, true).to.not.exist;
3075
- };
3076
- assert2.isUndefined = function(val, msg) {
3077
- new Assertion2(val, msg, assert2.isUndefined, true).to.equal(void 0);
3078
- };
3079
- assert2.isDefined = function(val, msg) {
3080
- new Assertion2(val, msg, assert2.isDefined, true).to.not.equal(void 0);
3081
- };
3082
- assert2.isFunction = function(val, msg) {
3083
- new Assertion2(val, msg, assert2.isFunction, true).to.be.a("function");
3084
- };
3085
- assert2.isNotFunction = function(val, msg) {
3086
- new Assertion2(val, msg, assert2.isNotFunction, true).to.not.be.a("function");
3087
- };
3088
- assert2.isObject = function(val, msg) {
3089
- new Assertion2(val, msg, assert2.isObject, true).to.be.a("object");
3090
- };
3091
- assert2.isNotObject = function(val, msg) {
3092
- new Assertion2(val, msg, assert2.isNotObject, true).to.not.be.a("object");
3093
- };
3094
- assert2.isArray = function(val, msg) {
3095
- new Assertion2(val, msg, assert2.isArray, true).to.be.an("array");
3096
- };
3097
- assert2.isNotArray = function(val, msg) {
3098
- new Assertion2(val, msg, assert2.isNotArray, true).to.not.be.an("array");
3099
- };
3100
- assert2.isString = function(val, msg) {
3101
- new Assertion2(val, msg, assert2.isString, true).to.be.a("string");
3102
- };
3103
- assert2.isNotString = function(val, msg) {
3104
- new Assertion2(val, msg, assert2.isNotString, true).to.not.be.a("string");
3105
- };
3106
- assert2.isNumber = function(val, msg) {
3107
- new Assertion2(val, msg, assert2.isNumber, true).to.be.a("number");
3108
- };
3109
- assert2.isNotNumber = function(val, msg) {
3110
- new Assertion2(val, msg, assert2.isNotNumber, true).to.not.be.a("number");
3111
- };
3112
- assert2.isFinite = function(val, msg) {
3113
- new Assertion2(val, msg, assert2.isFinite, true).to.be.finite;
3114
- };
3115
- assert2.isBoolean = function(val, msg) {
3116
- new Assertion2(val, msg, assert2.isBoolean, true).to.be.a("boolean");
3117
- };
3118
- assert2.isNotBoolean = function(val, msg) {
3119
- new Assertion2(val, msg, assert2.isNotBoolean, true).to.not.be.a("boolean");
3120
- };
3121
- assert2.typeOf = function(val, type, msg) {
3122
- new Assertion2(val, msg, assert2.typeOf, true).to.be.a(type);
3123
- };
3124
- assert2.notTypeOf = function(val, type, msg) {
3125
- new Assertion2(val, msg, assert2.notTypeOf, true).to.not.be.a(type);
3126
- };
3127
- assert2.instanceOf = function(val, type, msg) {
3128
- new Assertion2(val, msg, assert2.instanceOf, true).to.be.instanceOf(type);
3129
- };
3130
- assert2.notInstanceOf = function(val, type, msg) {
3131
- new Assertion2(val, msg, assert2.notInstanceOf, true).to.not.be.instanceOf(type);
3132
- };
3133
- assert2.include = function(exp, inc, msg) {
3134
- new Assertion2(exp, msg, assert2.include, true).include(inc);
3135
- };
3136
- assert2.notInclude = function(exp, inc, msg) {
3137
- new Assertion2(exp, msg, assert2.notInclude, true).not.include(inc);
3138
- };
3139
- assert2.deepInclude = function(exp, inc, msg) {
3140
- new Assertion2(exp, msg, assert2.deepInclude, true).deep.include(inc);
3141
- };
3142
- assert2.notDeepInclude = function(exp, inc, msg) {
3143
- new Assertion2(exp, msg, assert2.notDeepInclude, true).not.deep.include(inc);
3144
- };
3145
- assert2.nestedInclude = function(exp, inc, msg) {
3146
- new Assertion2(exp, msg, assert2.nestedInclude, true).nested.include(inc);
3147
- };
3148
- assert2.notNestedInclude = function(exp, inc, msg) {
3149
- new Assertion2(exp, msg, assert2.notNestedInclude, true).not.nested.include(inc);
3150
- };
3151
- assert2.deepNestedInclude = function(exp, inc, msg) {
3152
- new Assertion2(exp, msg, assert2.deepNestedInclude, true).deep.nested.include(inc);
3153
- };
3154
- assert2.notDeepNestedInclude = function(exp, inc, msg) {
3155
- new Assertion2(exp, msg, assert2.notDeepNestedInclude, true).not.deep.nested.include(inc);
3156
- };
3157
- assert2.ownInclude = function(exp, inc, msg) {
3158
- new Assertion2(exp, msg, assert2.ownInclude, true).own.include(inc);
3159
- };
3160
- assert2.notOwnInclude = function(exp, inc, msg) {
3161
- new Assertion2(exp, msg, assert2.notOwnInclude, true).not.own.include(inc);
3162
- };
3163
- assert2.deepOwnInclude = function(exp, inc, msg) {
3164
- new Assertion2(exp, msg, assert2.deepOwnInclude, true).deep.own.include(inc);
3165
- };
3166
- assert2.notDeepOwnInclude = function(exp, inc, msg) {
3167
- new Assertion2(exp, msg, assert2.notDeepOwnInclude, true).not.deep.own.include(inc);
3168
- };
3169
- assert2.match = function(exp, re, msg) {
3170
- new Assertion2(exp, msg, assert2.match, true).to.match(re);
3171
- };
3172
- assert2.notMatch = function(exp, re, msg) {
3173
- new Assertion2(exp, msg, assert2.notMatch, true).to.not.match(re);
3174
- };
3175
- assert2.property = function(obj, prop, msg) {
3176
- new Assertion2(obj, msg, assert2.property, true).to.have.property(prop);
3177
- };
3178
- assert2.notProperty = function(obj, prop, msg) {
3179
- new Assertion2(obj, msg, assert2.notProperty, true).to.not.have.property(prop);
3180
- };
3181
- assert2.propertyVal = function(obj, prop, val, msg) {
3182
- new Assertion2(obj, msg, assert2.propertyVal, true).to.have.property(prop, val);
3183
- };
3184
- assert2.notPropertyVal = function(obj, prop, val, msg) {
3185
- new Assertion2(obj, msg, assert2.notPropertyVal, true).to.not.have.property(prop, val);
3186
- };
3187
- assert2.deepPropertyVal = function(obj, prop, val, msg) {
3188
- new Assertion2(obj, msg, assert2.deepPropertyVal, true).to.have.deep.property(prop, val);
3189
- };
3190
- assert2.notDeepPropertyVal = function(obj, prop, val, msg) {
3191
- new Assertion2(obj, msg, assert2.notDeepPropertyVal, true).to.not.have.deep.property(prop, val);
3192
- };
3193
- assert2.ownProperty = function(obj, prop, msg) {
3194
- new Assertion2(obj, msg, assert2.ownProperty, true).to.have.own.property(prop);
3195
- };
3196
- assert2.notOwnProperty = function(obj, prop, msg) {
3197
- new Assertion2(obj, msg, assert2.notOwnProperty, true).to.not.have.own.property(prop);
3198
- };
3199
- assert2.ownPropertyVal = function(obj, prop, value, msg) {
3200
- new Assertion2(obj, msg, assert2.ownPropertyVal, true).to.have.own.property(prop, value);
3201
- };
3202
- assert2.notOwnPropertyVal = function(obj, prop, value, msg) {
3203
- new Assertion2(obj, msg, assert2.notOwnPropertyVal, true).to.not.have.own.property(prop, value);
3204
- };
3205
- assert2.deepOwnPropertyVal = function(obj, prop, value, msg) {
3206
- new Assertion2(obj, msg, assert2.deepOwnPropertyVal, true).to.have.deep.own.property(prop, value);
3207
- };
3208
- assert2.notDeepOwnPropertyVal = function(obj, prop, value, msg) {
3209
- new Assertion2(obj, msg, assert2.notDeepOwnPropertyVal, true).to.not.have.deep.own.property(prop, value);
3210
- };
3211
- assert2.nestedProperty = function(obj, prop, msg) {
3212
- new Assertion2(obj, msg, assert2.nestedProperty, true).to.have.nested.property(prop);
3213
- };
3214
- assert2.notNestedProperty = function(obj, prop, msg) {
3215
- new Assertion2(obj, msg, assert2.notNestedProperty, true).to.not.have.nested.property(prop);
3216
- };
3217
- assert2.nestedPropertyVal = function(obj, prop, val, msg) {
3218
- new Assertion2(obj, msg, assert2.nestedPropertyVal, true).to.have.nested.property(prop, val);
3219
- };
3220
- assert2.notNestedPropertyVal = function(obj, prop, val, msg) {
3221
- new Assertion2(obj, msg, assert2.notNestedPropertyVal, true).to.not.have.nested.property(prop, val);
3222
- };
3223
- assert2.deepNestedPropertyVal = function(obj, prop, val, msg) {
3224
- new Assertion2(obj, msg, assert2.deepNestedPropertyVal, true).to.have.deep.nested.property(prop, val);
3225
- };
3226
- assert2.notDeepNestedPropertyVal = function(obj, prop, val, msg) {
3227
- new Assertion2(obj, msg, assert2.notDeepNestedPropertyVal, true).to.not.have.deep.nested.property(prop, val);
3228
- };
3229
- assert2.lengthOf = function(exp, len, msg) {
3230
- new Assertion2(exp, msg, assert2.lengthOf, true).to.have.lengthOf(len);
3231
- };
3232
- assert2.hasAnyKeys = function(obj, keys, msg) {
3233
- new Assertion2(obj, msg, assert2.hasAnyKeys, true).to.have.any.keys(keys);
3234
- };
3235
- assert2.hasAllKeys = function(obj, keys, msg) {
3236
- new Assertion2(obj, msg, assert2.hasAllKeys, true).to.have.all.keys(keys);
3237
- };
3238
- assert2.containsAllKeys = function(obj, keys, msg) {
3239
- new Assertion2(obj, msg, assert2.containsAllKeys, true).to.contain.all.keys(keys);
3240
- };
3241
- assert2.doesNotHaveAnyKeys = function(obj, keys, msg) {
3242
- new Assertion2(obj, msg, assert2.doesNotHaveAnyKeys, true).to.not.have.any.keys(keys);
3243
- };
3244
- assert2.doesNotHaveAllKeys = function(obj, keys, msg) {
3245
- new Assertion2(obj, msg, assert2.doesNotHaveAllKeys, true).to.not.have.all.keys(keys);
3246
- };
3247
- assert2.hasAnyDeepKeys = function(obj, keys, msg) {
3248
- new Assertion2(obj, msg, assert2.hasAnyDeepKeys, true).to.have.any.deep.keys(keys);
3249
- };
3250
- assert2.hasAllDeepKeys = function(obj, keys, msg) {
3251
- new Assertion2(obj, msg, assert2.hasAllDeepKeys, true).to.have.all.deep.keys(keys);
3252
- };
3253
- assert2.containsAllDeepKeys = function(obj, keys, msg) {
3254
- new Assertion2(obj, msg, assert2.containsAllDeepKeys, true).to.contain.all.deep.keys(keys);
3255
- };
3256
- assert2.doesNotHaveAnyDeepKeys = function(obj, keys, msg) {
3257
- new Assertion2(obj, msg, assert2.doesNotHaveAnyDeepKeys, true).to.not.have.any.deep.keys(keys);
3258
- };
3259
- assert2.doesNotHaveAllDeepKeys = function(obj, keys, msg) {
3260
- new Assertion2(obj, msg, assert2.doesNotHaveAllDeepKeys, true).to.not.have.all.deep.keys(keys);
3261
- };
3262
- assert2.throws = function(fn, errorLike, errMsgMatcher, msg) {
3263
- if ("string" === typeof errorLike || errorLike instanceof RegExp) {
3264
- errMsgMatcher = errorLike;
3265
- errorLike = null;
3266
- }
3267
- var assertErr = new Assertion2(fn, msg, assert2.throws, true).to.throw(errorLike, errMsgMatcher);
3268
- return flag(assertErr, "object");
3269
- };
3270
- assert2.doesNotThrow = function(fn, errorLike, errMsgMatcher, msg) {
3271
- if ("string" === typeof errorLike || errorLike instanceof RegExp) {
3272
- errMsgMatcher = errorLike;
3273
- errorLike = null;
3274
- }
3275
- new Assertion2(fn, msg, assert2.doesNotThrow, true).to.not.throw(errorLike, errMsgMatcher);
3276
- };
3277
- assert2.operator = function(val, operator, val2, msg) {
3278
- var ok;
3279
- switch (operator) {
3280
- case "==":
3281
- ok = val == val2;
3282
- break;
3283
- case "===":
3284
- ok = val === val2;
3285
- break;
3286
- case ">":
3287
- ok = val > val2;
3288
- break;
3289
- case ">=":
3290
- ok = val >= val2;
3291
- break;
3292
- case "<":
3293
- ok = val < val2;
3294
- break;
3295
- case "<=":
3296
- ok = val <= val2;
3297
- break;
3298
- case "!=":
3299
- ok = val != val2;
3300
- break;
3301
- case "!==":
3302
- ok = val !== val2;
3303
- break;
3304
- default:
3305
- msg = msg ? msg + ": " : msg;
3306
- throw new chai2.AssertionError(msg + 'Invalid operator "' + operator + '"', void 0, assert2.operator);
3307
- }
3308
- var test = new Assertion2(ok, msg, assert2.operator, true);
3309
- test.assert(true === flag(test, "object"), "expected " + util2.inspect(val) + " to be " + operator + " " + util2.inspect(val2), "expected " + util2.inspect(val) + " to not be " + operator + " " + util2.inspect(val2));
3310
- };
3311
- assert2.closeTo = function(act, exp, delta, msg) {
3312
- new Assertion2(act, msg, assert2.closeTo, true).to.be.closeTo(exp, delta);
3313
- };
3314
- assert2.approximately = function(act, exp, delta, msg) {
3315
- new Assertion2(act, msg, assert2.approximately, true).to.be.approximately(exp, delta);
3316
- };
3317
- assert2.sameMembers = function(set1, set2, msg) {
3318
- new Assertion2(set1, msg, assert2.sameMembers, true).to.have.same.members(set2);
3319
- };
3320
- assert2.notSameMembers = function(set1, set2, msg) {
3321
- new Assertion2(set1, msg, assert2.notSameMembers, true).to.not.have.same.members(set2);
3322
- };
3323
- assert2.sameDeepMembers = function(set1, set2, msg) {
3324
- new Assertion2(set1, msg, assert2.sameDeepMembers, true).to.have.same.deep.members(set2);
3325
- };
3326
- assert2.notSameDeepMembers = function(set1, set2, msg) {
3327
- new Assertion2(set1, msg, assert2.notSameDeepMembers, true).to.not.have.same.deep.members(set2);
3328
- };
3329
- assert2.sameOrderedMembers = function(set1, set2, msg) {
3330
- new Assertion2(set1, msg, assert2.sameOrderedMembers, true).to.have.same.ordered.members(set2);
3331
- };
3332
- assert2.notSameOrderedMembers = function(set1, set2, msg) {
3333
- new Assertion2(set1, msg, assert2.notSameOrderedMembers, true).to.not.have.same.ordered.members(set2);
3334
- };
3335
- assert2.sameDeepOrderedMembers = function(set1, set2, msg) {
3336
- new Assertion2(set1, msg, assert2.sameDeepOrderedMembers, true).to.have.same.deep.ordered.members(set2);
3337
- };
3338
- assert2.notSameDeepOrderedMembers = function(set1, set2, msg) {
3339
- new Assertion2(set1, msg, assert2.notSameDeepOrderedMembers, true).to.not.have.same.deep.ordered.members(set2);
3340
- };
3341
- assert2.includeMembers = function(superset, subset, msg) {
3342
- new Assertion2(superset, msg, assert2.includeMembers, true).to.include.members(subset);
3343
- };
3344
- assert2.notIncludeMembers = function(superset, subset, msg) {
3345
- new Assertion2(superset, msg, assert2.notIncludeMembers, true).to.not.include.members(subset);
3346
- };
3347
- assert2.includeDeepMembers = function(superset, subset, msg) {
3348
- new Assertion2(superset, msg, assert2.includeDeepMembers, true).to.include.deep.members(subset);
3349
- };
3350
- assert2.notIncludeDeepMembers = function(superset, subset, msg) {
3351
- new Assertion2(superset, msg, assert2.notIncludeDeepMembers, true).to.not.include.deep.members(subset);
3352
- };
3353
- assert2.includeOrderedMembers = function(superset, subset, msg) {
3354
- new Assertion2(superset, msg, assert2.includeOrderedMembers, true).to.include.ordered.members(subset);
3355
- };
3356
- assert2.notIncludeOrderedMembers = function(superset, subset, msg) {
3357
- new Assertion2(superset, msg, assert2.notIncludeOrderedMembers, true).to.not.include.ordered.members(subset);
3358
- };
3359
- assert2.includeDeepOrderedMembers = function(superset, subset, msg) {
3360
- new Assertion2(superset, msg, assert2.includeDeepOrderedMembers, true).to.include.deep.ordered.members(subset);
3361
- };
3362
- assert2.notIncludeDeepOrderedMembers = function(superset, subset, msg) {
3363
- new Assertion2(superset, msg, assert2.notIncludeDeepOrderedMembers, true).to.not.include.deep.ordered.members(subset);
3364
- };
3365
- assert2.oneOf = function(inList, list, msg) {
3366
- new Assertion2(inList, msg, assert2.oneOf, true).to.be.oneOf(list);
3367
- };
3368
- assert2.changes = function(fn, obj, prop, msg) {
3369
- if (arguments.length === 3 && typeof obj === "function") {
3370
- msg = prop;
3371
- prop = null;
3372
- }
3373
- new Assertion2(fn, msg, assert2.changes, true).to.change(obj, prop);
3374
- };
3375
- assert2.changesBy = function(fn, obj, prop, delta, msg) {
3376
- if (arguments.length === 4 && typeof obj === "function") {
3377
- var tmpMsg = delta;
3378
- delta = prop;
3379
- msg = tmpMsg;
3380
- } else if (arguments.length === 3) {
3381
- delta = prop;
3382
- prop = null;
3383
- }
3384
- new Assertion2(fn, msg, assert2.changesBy, true).to.change(obj, prop).by(delta);
3385
- };
3386
- assert2.doesNotChange = function(fn, obj, prop, msg) {
3387
- if (arguments.length === 3 && typeof obj === "function") {
3388
- msg = prop;
3389
- prop = null;
3390
- }
3391
- return new Assertion2(fn, msg, assert2.doesNotChange, true).to.not.change(obj, prop);
3392
- };
3393
- assert2.changesButNotBy = function(fn, obj, prop, delta, msg) {
3394
- if (arguments.length === 4 && typeof obj === "function") {
3395
- var tmpMsg = delta;
3396
- delta = prop;
3397
- msg = tmpMsg;
3398
- } else if (arguments.length === 3) {
3399
- delta = prop;
3400
- prop = null;
3401
- }
3402
- new Assertion2(fn, msg, assert2.changesButNotBy, true).to.change(obj, prop).but.not.by(delta);
3403
- };
3404
- assert2.increases = function(fn, obj, prop, msg) {
3405
- if (arguments.length === 3 && typeof obj === "function") {
3406
- msg = prop;
3407
- prop = null;
3408
- }
3409
- return new Assertion2(fn, msg, assert2.increases, true).to.increase(obj, prop);
3410
- };
3411
- assert2.increasesBy = function(fn, obj, prop, delta, msg) {
3412
- if (arguments.length === 4 && typeof obj === "function") {
3413
- var tmpMsg = delta;
3414
- delta = prop;
3415
- msg = tmpMsg;
3416
- } else if (arguments.length === 3) {
3417
- delta = prop;
3418
- prop = null;
3419
- }
3420
- new Assertion2(fn, msg, assert2.increasesBy, true).to.increase(obj, prop).by(delta);
3421
- };
3422
- assert2.doesNotIncrease = function(fn, obj, prop, msg) {
3423
- if (arguments.length === 3 && typeof obj === "function") {
3424
- msg = prop;
3425
- prop = null;
3426
- }
3427
- return new Assertion2(fn, msg, assert2.doesNotIncrease, true).to.not.increase(obj, prop);
3428
- };
3429
- assert2.increasesButNotBy = function(fn, obj, prop, delta, msg) {
3430
- if (arguments.length === 4 && typeof obj === "function") {
3431
- var tmpMsg = delta;
3432
- delta = prop;
3433
- msg = tmpMsg;
3434
- } else if (arguments.length === 3) {
3435
- delta = prop;
3436
- prop = null;
3437
- }
3438
- new Assertion2(fn, msg, assert2.increasesButNotBy, true).to.increase(obj, prop).but.not.by(delta);
3439
- };
3440
- assert2.decreases = function(fn, obj, prop, msg) {
3441
- if (arguments.length === 3 && typeof obj === "function") {
3442
- msg = prop;
3443
- prop = null;
3444
- }
3445
- return new Assertion2(fn, msg, assert2.decreases, true).to.decrease(obj, prop);
3446
- };
3447
- assert2.decreasesBy = function(fn, obj, prop, delta, msg) {
3448
- if (arguments.length === 4 && typeof obj === "function") {
3449
- var tmpMsg = delta;
3450
- delta = prop;
3451
- msg = tmpMsg;
3452
- } else if (arguments.length === 3) {
3453
- delta = prop;
3454
- prop = null;
3455
- }
3456
- new Assertion2(fn, msg, assert2.decreasesBy, true).to.decrease(obj, prop).by(delta);
3457
- };
3458
- assert2.doesNotDecrease = function(fn, obj, prop, msg) {
3459
- if (arguments.length === 3 && typeof obj === "function") {
3460
- msg = prop;
3461
- prop = null;
3462
- }
3463
- return new Assertion2(fn, msg, assert2.doesNotDecrease, true).to.not.decrease(obj, prop);
3464
- };
3465
- assert2.doesNotDecreaseBy = function(fn, obj, prop, delta, msg) {
3466
- if (arguments.length === 4 && typeof obj === "function") {
3467
- var tmpMsg = delta;
3468
- delta = prop;
3469
- msg = tmpMsg;
3470
- } else if (arguments.length === 3) {
3471
- delta = prop;
3472
- prop = null;
3473
- }
3474
- return new Assertion2(fn, msg, assert2.doesNotDecreaseBy, true).to.not.decrease(obj, prop).by(delta);
3475
- };
3476
- assert2.decreasesButNotBy = function(fn, obj, prop, delta, msg) {
3477
- if (arguments.length === 4 && typeof obj === "function") {
3478
- var tmpMsg = delta;
3479
- delta = prop;
3480
- msg = tmpMsg;
3481
- } else if (arguments.length === 3) {
3482
- delta = prop;
3483
- prop = null;
3484
- }
3485
- new Assertion2(fn, msg, assert2.decreasesButNotBy, true).to.decrease(obj, prop).but.not.by(delta);
3486
- };
3487
- assert2.ifError = function(val) {
3488
- if (val) {
3489
- throw val;
3490
- }
3491
- };
3492
- assert2.isExtensible = function(obj, msg) {
3493
- new Assertion2(obj, msg, assert2.isExtensible, true).to.be.extensible;
3494
- };
3495
- assert2.isNotExtensible = function(obj, msg) {
3496
- new Assertion2(obj, msg, assert2.isNotExtensible, true).to.not.be.extensible;
3497
- };
3498
- assert2.isSealed = function(obj, msg) {
3499
- new Assertion2(obj, msg, assert2.isSealed, true).to.be.sealed;
3500
- };
3501
- assert2.isNotSealed = function(obj, msg) {
3502
- new Assertion2(obj, msg, assert2.isNotSealed, true).to.not.be.sealed;
3503
- };
3504
- assert2.isFrozen = function(obj, msg) {
3505
- new Assertion2(obj, msg, assert2.isFrozen, true).to.be.frozen;
3506
- };
3507
- assert2.isNotFrozen = function(obj, msg) {
3508
- new Assertion2(obj, msg, assert2.isNotFrozen, true).to.not.be.frozen;
3509
- };
3510
- assert2.isEmpty = function(val, msg) {
3511
- new Assertion2(val, msg, assert2.isEmpty, true).to.be.empty;
3512
- };
3513
- assert2.isNotEmpty = function(val, msg) {
3514
- new Assertion2(val, msg, assert2.isNotEmpty, true).to.not.be.empty;
3515
- };
3516
- (function alias(name, as) {
3517
- assert2[as] = assert2[name];
3518
- return alias;
3519
- })("isOk", "ok")("isNotOk", "notOk")("throws", "throw")("throws", "Throw")("isExtensible", "extensible")("isNotExtensible", "notExtensible")("isSealed", "sealed")("isNotSealed", "notSealed")("isFrozen", "frozen")("isNotFrozen", "notFrozen")("isEmpty", "empty")("isNotEmpty", "notEmpty");
3520
- };
3521
- }
3522
- });
3523
-
3524
- // node_modules/chai/lib/chai.js
3525
- var require_chai = __commonJS({
3526
- "node_modules/chai/lib/chai.js"(exports) {
3527
- var used = [];
3528
- exports.version = "4.3.3";
3529
- exports.AssertionError = require_assertion_error();
3530
- var util2 = require_utils();
3531
- exports.use = function(fn) {
3532
- if (!~used.indexOf(fn)) {
3533
- fn(exports, util2);
3534
- used.push(fn);
3535
- }
3536
- return exports;
3537
- };
3538
- exports.util = util2;
3539
- var config2 = require_config();
3540
- exports.config = config2;
3541
- var assertion = require_assertion();
3542
- exports.use(assertion);
3543
- var core2 = require_assertions();
3544
- exports.use(core2);
3545
- var expect2 = require_expect();
3546
- exports.use(expect2);
3547
- var should2 = require_should();
3548
- exports.use(should2);
3549
- var assert2 = require_assert();
3550
- exports.use(assert2);
3551
- }
3552
- });
3553
-
3554
- // node_modules/chai/index.js
3555
- var require_chai2 = __commonJS({
3556
- "node_modules/chai/index.js"(exports, module) {
3557
- module.exports = require_chai();
3558
- }
3559
- });
3560
-
3561
- // pkg/node/hpke_dispatch.js
3562
- var require_hpke_dispatch = __commonJS({
3563
- "pkg/node/hpke_dispatch.js"(exports, module) {
3564
- "use strict";
3565
- var imports = {};
3566
- imports["__wbindgen_placeholder__"] = module.exports;
3567
- var wasm;
3568
- var { TextDecoder: TextDecoder2 } = __require("util");
3569
- var heap = new Array(32).fill(void 0);
3570
- heap.push(void 0, null, true, false);
3571
- function getObject(idx) {
3572
- return heap[idx];
3573
- }
3574
- var heap_next = heap.length;
3575
- function dropObject(idx) {
3576
- if (idx < 36)
3577
- return;
3578
- heap[idx] = heap_next;
3579
- heap_next = idx;
3580
- }
3581
- function takeObject(idx) {
3582
- const ret = getObject(idx);
3583
- dropObject(idx);
3584
- return ret;
3585
- }
3586
- function addHeapObject(obj) {
3587
- if (heap_next === heap.length)
3588
- heap.push(heap.length + 1);
3589
- const idx = heap_next;
3590
- heap_next = heap[idx];
3591
- heap[idx] = obj;
3592
- return idx;
3593
- }
3594
- var cachedTextDecoder = new TextDecoder2("utf-8", { ignoreBOM: true, fatal: true });
3595
- cachedTextDecoder.decode();
3596
- var cachegetUint8Memory0 = null;
3597
- function getUint8Memory0() {
3598
- if (cachegetUint8Memory0 === null || cachegetUint8Memory0.buffer !== wasm.memory.buffer) {
3599
- cachegetUint8Memory0 = new Uint8Array(wasm.memory.buffer);
3600
- }
3601
- return cachegetUint8Memory0;
3602
- }
3603
- function getStringFromWasm0(ptr, len) {
3604
- return cachedTextDecoder.decode(getUint8Memory0().subarray(ptr, ptr + len));
3605
- }
3606
- function _assertClass(instance, klass) {
3607
- if (!(instance instanceof klass)) {
3608
- throw new Error(`expected instance of ${klass.name}`);
3609
- }
3610
- return instance.ptr;
3611
- }
3612
- var WASM_VECTOR_LEN = 0;
3613
- function passArray8ToWasm0(arg, malloc) {
3614
- const ptr = malloc(arg.length * 1);
3615
- getUint8Memory0().set(arg, ptr / 1);
3616
- WASM_VECTOR_LEN = arg.length;
3617
- return ptr;
3618
- }
3619
- var cachegetInt32Memory0 = null;
3620
- function getInt32Memory0() {
3621
- if (cachegetInt32Memory0 === null || cachegetInt32Memory0.buffer !== wasm.memory.buffer) {
3622
- cachegetInt32Memory0 = new Int32Array(wasm.memory.buffer);
3623
- }
3624
- return cachegetInt32Memory0;
3625
- }
3626
- function getArrayU8FromWasm0(ptr, len) {
3627
- return getUint8Memory0().subarray(ptr / 1, ptr / 1 + len);
3628
- }
3629
- module.exports.base_mode_open = function(config2, private_key, encapped_key, info, ciphertext, aad) {
3630
- try {
3631
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
3632
- _assertClass(config2, Config2);
3633
- const ptr0 = passArray8ToWasm0(private_key, wasm.__wbindgen_malloc);
3634
- const len0 = WASM_VECTOR_LEN;
3635
- const ptr1 = passArray8ToWasm0(encapped_key, wasm.__wbindgen_malloc);
3636
- const len1 = WASM_VECTOR_LEN;
3637
- const ptr2 = passArray8ToWasm0(info, wasm.__wbindgen_malloc);
3638
- const len2 = WASM_VECTOR_LEN;
3639
- const ptr3 = passArray8ToWasm0(ciphertext, wasm.__wbindgen_malloc);
3640
- const len3 = WASM_VECTOR_LEN;
3641
- const ptr4 = passArray8ToWasm0(aad, wasm.__wbindgen_malloc);
3642
- const len4 = WASM_VECTOR_LEN;
3643
- wasm.base_mode_open(retptr, config2.ptr, ptr0, len0, ptr1, len1, ptr2, len2, ptr3, len3, ptr4, len4);
3644
- var r0 = getInt32Memory0()[retptr / 4 + 0];
3645
- var r1 = getInt32Memory0()[retptr / 4 + 1];
3646
- var r2 = getInt32Memory0()[retptr / 4 + 2];
3647
- var r3 = getInt32Memory0()[retptr / 4 + 3];
3648
- if (r3) {
3649
- throw takeObject(r2);
3650
- }
3651
- var v5 = getArrayU8FromWasm0(r0, r1).slice();
3652
- wasm.__wbindgen_free(r0, r1 * 1);
3653
- return v5;
3654
- } finally {
3655
- wasm.__wbindgen_add_to_stack_pointer(16);
3656
- }
3657
- };
3658
- module.exports.base_mode_seal = function(config2, recipient_public_key, info, plaintext, aad) {
3659
- try {
3660
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
3661
- _assertClass(config2, Config2);
3662
- const ptr0 = passArray8ToWasm0(recipient_public_key, wasm.__wbindgen_malloc);
3663
- const len0 = WASM_VECTOR_LEN;
3664
- const ptr1 = passArray8ToWasm0(info, wasm.__wbindgen_malloc);
3665
- const len1 = WASM_VECTOR_LEN;
3666
- const ptr2 = passArray8ToWasm0(plaintext, wasm.__wbindgen_malloc);
3667
- const len2 = WASM_VECTOR_LEN;
3668
- const ptr3 = passArray8ToWasm0(aad, wasm.__wbindgen_malloc);
3669
- const len3 = WASM_VECTOR_LEN;
3670
- wasm.base_mode_seal(retptr, config2.ptr, ptr0, len0, ptr1, len1, ptr2, len2, ptr3, len3);
3671
- var r0 = getInt32Memory0()[retptr / 4 + 0];
3672
- var r1 = getInt32Memory0()[retptr / 4 + 1];
3673
- var r2 = getInt32Memory0()[retptr / 4 + 2];
3674
- if (r2) {
3675
- throw takeObject(r1);
3676
- }
3677
- return EncappedKeyAndCiphertext.__wrap(r0);
3678
- } finally {
3679
- wasm.__wbindgen_add_to_stack_pointer(16);
3680
- }
3681
- };
3682
- function handleError(f, args) {
3683
- try {
3684
- return f.apply(this, args);
3685
- } catch (e) {
3686
- wasm.__wbindgen_exn_store(addHeapObject(e));
3687
- }
3688
- }
3689
- module.exports.Aead = Object.freeze({
3690
- AesGcm128: 1,
3691
- "1": "AesGcm128",
3692
- AesGcm256: 2,
3693
- "2": "AesGcm256",
3694
- ChaCha20Poly1305: 3,
3695
- "3": "ChaCha20Poly1305"
3696
- });
3697
- module.exports.Kdf = Object.freeze({
3698
- Sha256: 1,
3699
- "1": "Sha256",
3700
- Sha384: 2,
3701
- "2": "Sha384",
3702
- Sha512: 3,
3703
- "3": "Sha512"
3704
- });
3705
- module.exports.Kem = Object.freeze({
3706
- DhP256HkdfSha256: 16,
3707
- "16": "DhP256HkdfSha256",
3708
- X25519HkdfSha256: 32,
3709
- "32": "X25519HkdfSha256"
3710
- });
3711
- var Config2 = class {
3712
- static __wrap(ptr) {
3713
- const obj = Object.create(Config2.prototype);
3714
- obj.ptr = ptr;
3715
- return obj;
3716
- }
3717
- __destroy_into_raw() {
3718
- const ptr = this.ptr;
3719
- this.ptr = 0;
3720
- return ptr;
3721
- }
3722
- free() {
3723
- const ptr = this.__destroy_into_raw();
3724
- wasm.__wbg_config_free(ptr);
3725
- }
3726
- get aead() {
3727
- const ret = wasm.__wbg_get_config_aead(this.ptr);
3728
- return ret >>> 0;
3729
- }
3730
- set aead(arg0) {
3731
- wasm.__wbg_set_config_aead(this.ptr, arg0);
3732
- }
3733
- get kdf() {
3734
- const ret = wasm.__wbg_get_config_kdf(this.ptr);
3735
- return ret >>> 0;
3736
- }
3737
- set kdf(arg0) {
3738
- wasm.__wbg_set_config_kdf(this.ptr, arg0);
3739
- }
3740
- get kem() {
3741
- const ret = wasm.__wbg_get_config_kem(this.ptr);
3742
- return ret >>> 0;
3743
- }
3744
- set kem(arg0) {
3745
- wasm.__wbg_set_config_kem(this.ptr, arg0);
3746
- }
3747
- base_mode_seal(recipient_public_key, info, plaintext, aad) {
3748
- try {
3749
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
3750
- const ptr0 = passArray8ToWasm0(recipient_public_key, wasm.__wbindgen_malloc);
3751
- const len0 = WASM_VECTOR_LEN;
3752
- const ptr1 = passArray8ToWasm0(info, wasm.__wbindgen_malloc);
3753
- const len1 = WASM_VECTOR_LEN;
3754
- const ptr2 = passArray8ToWasm0(plaintext, wasm.__wbindgen_malloc);
3755
- const len2 = WASM_VECTOR_LEN;
3756
- const ptr3 = passArray8ToWasm0(aad, wasm.__wbindgen_malloc);
3757
- const len3 = WASM_VECTOR_LEN;
3758
- wasm.config_base_mode_seal(retptr, this.ptr, ptr0, len0, ptr1, len1, ptr2, len2, ptr3, len3);
3759
- var r0 = getInt32Memory0()[retptr / 4 + 0];
3760
- var r1 = getInt32Memory0()[retptr / 4 + 1];
3761
- var r2 = getInt32Memory0()[retptr / 4 + 2];
3762
- if (r2) {
3763
- throw takeObject(r1);
3764
- }
3765
- return EncappedKeyAndCiphertext.__wrap(r0);
3766
- } finally {
3767
- wasm.__wbindgen_add_to_stack_pointer(16);
3768
- }
3769
- }
3770
- base_mode_open(private_key, encapped_key, info, ciphertext, aad) {
3771
- try {
3772
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
3773
- const ptr0 = passArray8ToWasm0(private_key, wasm.__wbindgen_malloc);
3774
- const len0 = WASM_VECTOR_LEN;
3775
- const ptr1 = passArray8ToWasm0(encapped_key, wasm.__wbindgen_malloc);
3776
- const len1 = WASM_VECTOR_LEN;
3777
- const ptr2 = passArray8ToWasm0(info, wasm.__wbindgen_malloc);
3778
- const len2 = WASM_VECTOR_LEN;
3779
- const ptr3 = passArray8ToWasm0(ciphertext, wasm.__wbindgen_malloc);
3780
- const len3 = WASM_VECTOR_LEN;
3781
- const ptr4 = passArray8ToWasm0(aad, wasm.__wbindgen_malloc);
3782
- const len4 = WASM_VECTOR_LEN;
3783
- wasm.config_base_mode_open(retptr, this.ptr, ptr0, len0, ptr1, len1, ptr2, len2, ptr3, len3, ptr4, len4);
3784
- var r0 = getInt32Memory0()[retptr / 4 + 0];
3785
- var r1 = getInt32Memory0()[retptr / 4 + 1];
3786
- var r2 = getInt32Memory0()[retptr / 4 + 2];
3787
- var r3 = getInt32Memory0()[retptr / 4 + 3];
3788
- if (r3) {
3789
- throw takeObject(r2);
3790
- }
3791
- var v5 = getArrayU8FromWasm0(r0, r1).slice();
3792
- wasm.__wbindgen_free(r0, r1 * 1);
3793
- return v5;
3794
- } finally {
3795
- wasm.__wbindgen_add_to_stack_pointer(16);
3796
- }
3797
- }
3798
- static try_from_ids(aead_id, kdf_id, kem_id) {
3799
- try {
3800
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
3801
- wasm.config_try_from_ids(retptr, aead_id, kdf_id, kem_id);
3802
- var r0 = getInt32Memory0()[retptr / 4 + 0];
3803
- var r1 = getInt32Memory0()[retptr / 4 + 1];
3804
- var r2 = getInt32Memory0()[retptr / 4 + 2];
3805
- if (r2) {
3806
- throw takeObject(r1);
3807
- }
3808
- return Config2.__wrap(r0);
3809
- } finally {
3810
- wasm.__wbindgen_add_to_stack_pointer(16);
3811
- }
3812
- }
3813
- };
3814
- module.exports.Config = Config2;
3815
- var EncappedKeyAndCiphertext = class {
3816
- static __wrap(ptr) {
3817
- const obj = Object.create(EncappedKeyAndCiphertext.prototype);
3818
- obj.ptr = ptr;
3819
- return obj;
3820
- }
3821
- __destroy_into_raw() {
3822
- const ptr = this.ptr;
3823
- this.ptr = 0;
3824
- return ptr;
3825
- }
3826
- free() {
3827
- const ptr = this.__destroy_into_raw();
3828
- wasm.__wbg_encappedkeyandciphertext_free(ptr);
3829
- }
3830
- get encapped_key() {
3831
- try {
3832
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
3833
- wasm.__wbg_get_encappedkeyandciphertext_encapped_key(retptr, this.ptr);
3834
- var r0 = getInt32Memory0()[retptr / 4 + 0];
3835
- var r1 = getInt32Memory0()[retptr / 4 + 1];
3836
- var v0 = getArrayU8FromWasm0(r0, r1).slice();
3837
- wasm.__wbindgen_free(r0, r1 * 1);
3838
- return v0;
3839
- } finally {
3840
- wasm.__wbindgen_add_to_stack_pointer(16);
3841
- }
3842
- }
3843
- set encapped_key(arg0) {
3844
- const ptr0 = passArray8ToWasm0(arg0, wasm.__wbindgen_malloc);
3845
- const len0 = WASM_VECTOR_LEN;
3846
- wasm.__wbg_set_encappedkeyandciphertext_encapped_key(this.ptr, ptr0, len0);
3847
- }
3848
- get ciphertext() {
3849
- try {
3850
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
3851
- wasm.__wbg_get_encappedkeyandciphertext_ciphertext(retptr, this.ptr);
3852
- var r0 = getInt32Memory0()[retptr / 4 + 0];
3853
- var r1 = getInt32Memory0()[retptr / 4 + 1];
3854
- var v0 = getArrayU8FromWasm0(r0, r1).slice();
3855
- wasm.__wbindgen_free(r0, r1 * 1);
3856
- return v0;
3857
- } finally {
3858
- wasm.__wbindgen_add_to_stack_pointer(16);
3859
- }
3860
- }
3861
- set ciphertext(arg0) {
3862
- const ptr0 = passArray8ToWasm0(arg0, wasm.__wbindgen_malloc);
3863
- const len0 = WASM_VECTOR_LEN;
3864
- wasm.__wbg_set_encappedkeyandciphertext_ciphertext(this.ptr, ptr0, len0);
3865
- }
3866
- };
3867
- module.exports.EncappedKeyAndCiphertext = EncappedKeyAndCiphertext;
3868
- var HpkeError = class {
3869
- static __wrap(ptr) {
3870
- const obj = Object.create(HpkeError.prototype);
3871
- obj.ptr = ptr;
3872
- return obj;
3873
- }
3874
- __destroy_into_raw() {
3875
- const ptr = this.ptr;
3876
- this.ptr = 0;
3877
- return ptr;
3878
- }
3879
- free() {
3880
- const ptr = this.__destroy_into_raw();
3881
- wasm.__wbg_hpkeerror_free(ptr);
3882
- }
3883
- };
3884
- module.exports.HpkeError = HpkeError;
3885
- var IdLookupError = class {
3886
- static __wrap(ptr) {
3887
- const obj = Object.create(IdLookupError.prototype);
3888
- obj.ptr = ptr;
3889
- return obj;
3890
- }
3891
- __destroy_into_raw() {
3892
- const ptr = this.ptr;
3893
- this.ptr = 0;
3894
- return ptr;
3895
- }
3896
- free() {
3897
- const ptr = this.__destroy_into_raw();
3898
- wasm.__wbg_idlookuperror_free(ptr);
3899
- }
3900
- };
3901
- module.exports.IdLookupError = IdLookupError;
3902
- var Keypair2 = class {
3903
- static __wrap(ptr) {
3904
- const obj = Object.create(Keypair2.prototype);
3905
- obj.ptr = ptr;
3906
- return obj;
3907
- }
3908
- __destroy_into_raw() {
3909
- const ptr = this.ptr;
3910
- this.ptr = 0;
3911
- return ptr;
3912
- }
3913
- free() {
3914
- const ptr = this.__destroy_into_raw();
3915
- wasm.__wbg_keypair_free(ptr);
3916
- }
3917
- get public_key() {
3918
- try {
3919
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
3920
- wasm.__wbg_get_keypair_public_key(retptr, this.ptr);
3921
- var r0 = getInt32Memory0()[retptr / 4 + 0];
3922
- var r1 = getInt32Memory0()[retptr / 4 + 1];
3923
- var v0 = getArrayU8FromWasm0(r0, r1).slice();
3924
- wasm.__wbindgen_free(r0, r1 * 1);
3925
- return v0;
3926
- } finally {
3927
- wasm.__wbindgen_add_to_stack_pointer(16);
3928
- }
3929
- }
3930
- set public_key(arg0) {
3931
- const ptr0 = passArray8ToWasm0(arg0, wasm.__wbindgen_malloc);
3932
- const len0 = WASM_VECTOR_LEN;
3933
- wasm.__wbg_set_keypair_public_key(this.ptr, ptr0, len0);
3934
- }
3935
- get private_key() {
3936
- try {
3937
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
3938
- wasm.__wbg_get_keypair_private_key(retptr, this.ptr);
3939
- var r0 = getInt32Memory0()[retptr / 4 + 0];
3940
- var r1 = getInt32Memory0()[retptr / 4 + 1];
3941
- var v0 = getArrayU8FromWasm0(r0, r1).slice();
3942
- wasm.__wbindgen_free(r0, r1 * 1);
3943
- return v0;
3944
- } finally {
3945
- wasm.__wbindgen_add_to_stack_pointer(16);
3946
- }
3947
- }
3948
- set private_key(arg0) {
3949
- const ptr0 = passArray8ToWasm0(arg0, wasm.__wbindgen_malloc);
3950
- const len0 = WASM_VECTOR_LEN;
3951
- wasm.__wbg_set_keypair_private_key(this.ptr, ptr0, len0);
3952
- }
3953
- constructor(kem) {
3954
- const ret = wasm.keypair_new(kem);
3955
- return Keypair2.__wrap(ret);
3956
- }
3957
- };
3958
- module.exports.Keypair = Keypair2;
3959
- module.exports.__wbg_hpkeerror_new = function(arg0) {
3960
- const ret = HpkeError.__wrap(arg0);
3961
- return addHeapObject(ret);
3962
- };
3963
- module.exports.__wbg_idlookuperror_new = function(arg0) {
3964
- const ret = IdLookupError.__wrap(arg0);
3965
- return addHeapObject(ret);
3966
- };
3967
- module.exports.__wbg_randomFillSync_654a7797990fb8db = function() {
3968
- return handleError(function(arg0, arg1, arg2) {
3969
- getObject(arg0).randomFillSync(getArrayU8FromWasm0(arg1, arg2));
3970
- }, arguments);
3971
- };
3972
- module.exports.__wbindgen_object_drop_ref = function(arg0) {
3973
- takeObject(arg0);
3974
- };
3975
- module.exports.__wbg_getRandomValues_fb6b088efb6bead2 = function() {
3976
- return handleError(function(arg0, arg1) {
3977
- getObject(arg0).getRandomValues(getObject(arg1));
3978
- }, arguments);
3979
- };
3980
- module.exports.__wbg_process_70251ed1291754d5 = function(arg0) {
3981
- const ret = getObject(arg0).process;
3982
- return addHeapObject(ret);
3983
- };
3984
- module.exports.__wbindgen_is_object = function(arg0) {
3985
- const val = getObject(arg0);
3986
- const ret = typeof val === "object" && val !== null;
3987
- return ret;
3988
- };
3989
- module.exports.__wbg_versions_b23f2588cdb2ddbb = function(arg0) {
3990
- const ret = getObject(arg0).versions;
3991
- return addHeapObject(ret);
3992
- };
3993
- module.exports.__wbg_node_61b8c9a82499895d = function(arg0) {
3994
- const ret = getObject(arg0).node;
3995
- return addHeapObject(ret);
3996
- };
3997
- module.exports.__wbindgen_is_string = function(arg0) {
3998
- const ret = typeof getObject(arg0) === "string";
3999
- return ret;
4000
- };
4001
- module.exports.__wbg_crypto_2f56257a38275dbd = function(arg0) {
4002
- const ret = getObject(arg0).crypto;
4003
- return addHeapObject(ret);
4004
- };
4005
- module.exports.__wbg_msCrypto_d07655bf62361f21 = function(arg0) {
4006
- const ret = getObject(arg0).msCrypto;
4007
- return addHeapObject(ret);
4008
- };
4009
- module.exports.__wbg_static_accessor_NODE_MODULE_33b45247c55045b0 = function() {
4010
- const ret = module;
4011
- return addHeapObject(ret);
4012
- };
4013
- module.exports.__wbg_require_2a93bc09fee45aca = function() {
4014
- return handleError(function(arg0, arg1, arg2) {
4015
- const ret = getObject(arg0).require(getStringFromWasm0(arg1, arg2));
4016
- return addHeapObject(ret);
4017
- }, arguments);
4018
- };
4019
- module.exports.__wbg_newnoargs_e23b458e372830de = function(arg0, arg1) {
4020
- const ret = new Function(getStringFromWasm0(arg0, arg1));
4021
- return addHeapObject(ret);
4022
- };
4023
- module.exports.__wbg_call_ae78342adc33730a = function() {
4024
- return handleError(function(arg0, arg1) {
4025
- const ret = getObject(arg0).call(getObject(arg1));
4026
- return addHeapObject(ret);
4027
- }, arguments);
4028
- };
4029
- module.exports.__wbindgen_object_clone_ref = function(arg0) {
4030
- const ret = getObject(arg0);
4031
- return addHeapObject(ret);
4032
- };
4033
- module.exports.__wbg_self_99737b4dcdf6f0d8 = function() {
4034
- return handleError(function() {
4035
- const ret = self.self;
4036
- return addHeapObject(ret);
4037
- }, arguments);
4038
- };
4039
- module.exports.__wbg_window_9b61fbbf3564c4fb = function() {
4040
- return handleError(function() {
4041
- const ret = window.window;
4042
- return addHeapObject(ret);
4043
- }, arguments);
4044
- };
4045
- module.exports.__wbg_globalThis_8e275ef40caea3a3 = function() {
4046
- return handleError(function() {
4047
- const ret = globalThis.globalThis;
4048
- return addHeapObject(ret);
4049
- }, arguments);
4050
- };
4051
- module.exports.__wbg_global_5de1e0f82bddcd27 = function() {
4052
- return handleError(function() {
4053
- const ret = global.global;
4054
- return addHeapObject(ret);
4055
- }, arguments);
4056
- };
4057
- module.exports.__wbindgen_is_undefined = function(arg0) {
4058
- const ret = getObject(arg0) === void 0;
4059
- return ret;
4060
- };
4061
- module.exports.__wbg_buffer_7af23f65f6c64548 = function(arg0) {
4062
- const ret = getObject(arg0).buffer;
4063
- return addHeapObject(ret);
4064
- };
4065
- module.exports.__wbg_new_cc9018bd6f283b6f = function(arg0) {
4066
- const ret = new Uint8Array(getObject(arg0));
4067
- return addHeapObject(ret);
4068
- };
4069
- module.exports.__wbg_set_f25e869e4565d2a2 = function(arg0, arg1, arg2) {
4070
- getObject(arg0).set(getObject(arg1), arg2 >>> 0);
4071
- };
4072
- module.exports.__wbg_length_0acb1cf9bbaf8519 = function(arg0) {
4073
- const ret = getObject(arg0).length;
4074
- return ret;
4075
- };
4076
- module.exports.__wbg_newwithlength_8f0657faca9f1422 = function(arg0) {
4077
- const ret = new Uint8Array(arg0 >>> 0);
4078
- return addHeapObject(ret);
4079
- };
4080
- module.exports.__wbg_subarray_da527dbd24eafb6b = function(arg0, arg1, arg2) {
4081
- const ret = getObject(arg0).subarray(arg1 >>> 0, arg2 >>> 0);
4082
- return addHeapObject(ret);
4083
- };
4084
- module.exports.__wbindgen_throw = function(arg0, arg1) {
4085
- throw new Error(getStringFromWasm0(arg0, arg1));
4086
- };
4087
- module.exports.__wbindgen_memory = function() {
4088
- const ret = wasm.memory;
4089
- return addHeapObject(ret);
4090
- };
4091
- var path = __require("path").join(__dirname, "hpke_dispatch_bg.wasm");
4092
- var bytes = __require("fs").readFileSync(path);
4093
- var wasmModule = new WebAssembly.Module(bytes);
4094
- var wasmInstance = new WebAssembly.Instance(wasmModule, imports);
4095
- wasm = wasmInstance.exports;
4096
- module.exports.__wasm = wasm;
4097
- }
4098
- });
4099
-
4100
- // node_modules/chai/index.mjs
4101
- var import_index = __toESM(require_chai2(), 1);
4102
- var expect = import_index.default.expect;
4103
- var version = import_index.default.version;
4104
- var Assertion = import_index.default.Assertion;
4105
- var AssertionError = import_index.default.AssertionError;
4106
- var util = import_index.default.util;
4107
- var config = import_index.default.config;
4108
- var use = import_index.default.use;
4109
- var should = import_index.default.should;
4110
- var assert = import_index.default.assert;
4111
- var core = import_index.default.core;
4112
-
4113
- // pkg/node/index.spec.ts
4114
- var import__ = __toESM(require_hpke_dispatch());
4115
- import { TextEncoder, TextDecoder } from "util";
4116
- describe("HPKE", () => {
4117
- describe("Config", () => {
4118
- it("throws when the algorithms specified are invalid", () => {
4119
- const [aead, kdf, kem] = [100, 100, 100];
4120
- assert(!(aead in import__.Aead));
4121
- assert(!(kdf in import__.Kdf));
4122
- assert(!(kem in import__.Kem));
4123
- assert.throws(() => import__.Config.try_from_ids(aead, kdf, kem));
4124
- });
4125
- });
4126
- describe("Keypair", () => {
4127
- it("generates a (65, 32)-byte keypair for Kem.DhP256HkdfSha256", () => {
4128
- const keypair = new import__.Keypair(import__.Kem.DhP256HkdfSha256);
4129
- assert.equal(keypair.public_key.length, 65);
4130
- assert.equal(keypair.private_key.length, 32);
4131
- });
4132
- it("generates a (32, 32)-byte keypair for Kem.X25519HkdfSha256", () => {
4133
- const keypair = new import__.Keypair(import__.Kem.X25519HkdfSha256);
4134
- assert.equal(keypair.public_key.length, 32);
4135
- assert.equal(keypair.private_key.length, 32);
4136
- });
4137
- it("throws when provided an invalid Kem", () => {
4138
- assert.throws(() => new import__.Keypair(1e3));
4139
- });
4140
- });
4141
- describe("Round trips", () => {
4142
- const decoder = new TextDecoder();
4143
- const encoder = new TextEncoder();
4144
- const startMessage = "plaintext message text";
4145
- const plaintext = encoder.encode(startMessage);
4146
- const info = encoder.encode("app info");
4147
- const aad = encoder.encode("associated data");
4148
- for (const aead of [
4149
- import__.Aead.AesGcm128,
4150
- import__.Aead.AesGcm256,
4151
- import__.Aead.ChaCha20Poly1305
4152
- ]) {
4153
- for (const kdf of [import__.Kdf.Sha256, import__.Kdf.Sha384, import__.Kdf.Sha512]) {
4154
- for (const kem of [import__.Kem.DhP256HkdfSha256, import__.Kem.X25519HkdfSha256]) {
4155
- it(`succeeds for ${import__.Aead[aead]}, ${import__.Kdf[kdf]}, ${import__.Kem[kem]}`, () => {
4156
- const config2 = import__.Config.try_from_ids(aead, kdf, kem);
4157
- assert.equal(config2.aead, aead);
4158
- assert.equal(config2.kem, kem);
4159
- assert.equal(config2.kdf, kdf);
4160
- const keypair = new import__.Keypair(config2.kem);
4161
- const keyAndCiphertext = config2.base_mode_seal(keypair.public_key, info, plaintext, aad);
4162
- const roundTrip = config2.base_mode_open(keypair.private_key, keyAndCiphertext.encapped_key, info, keyAndCiphertext.ciphertext, aad);
4163
- assert.equal(startMessage, decoder.decode(roundTrip));
4164
- });
4165
- }
4166
- }
4167
- }
4168
- });
4169
- });
4170
- /*!
4171
- * ### ._obj
4172
- *
4173
- * Quick reference to stored `actual` value for plugin developers.
4174
- *
4175
- * @api private
4176
- */
4177
- /*!
4178
- * ### .ifError(object)
4179
- *
4180
- * Asserts if value is not a false value, and throws if it is a true value.
4181
- * This is added to allow for chai to be a drop-in replacement for Node's
4182
- * assert class.
4183
- *
4184
- * var err = new Error('I am a custom error');
4185
- * assert.ifError(err); // Rethrows err!
4186
- *
4187
- * @name ifError
4188
- * @param {Object} object
4189
- * @namespace Assert
4190
- * @api public
4191
- */
4192
- /*!
4193
- * Add a chainable method
4194
- */
4195
- /*!
4196
- * Aliases.
4197
- */
4198
- /*!
4199
- * Assert interface
4200
- */
4201
- /*!
4202
- * Assertion Constructor
4203
- *
4204
- * Creates object for chaining.
4205
- *
4206
- * `Assertion` objects contain metadata in the form of flags. Three flags can
4207
- * be assigned during instantiation by passing arguments to this constructor:
4208
- *
4209
- * - `object`: This flag contains the target of the assertion. For example, in
4210
- * the assertion `expect(numKittens).to.equal(7);`, the `object` flag will
4211
- * contain `numKittens` so that the `equal` assertion can reference it when
4212
- * needed.
4213
- *
4214
- * - `message`: This flag contains an optional custom error message to be
4215
- * prepended to the error message that's generated by the assertion when it
4216
- * fails.
4217
- *
4218
- * - `ssfi`: This flag stands for "start stack function indicator". It
4219
- * contains a function reference that serves as the starting point for
4220
- * removing frames from the stack trace of the error that's created by the
4221
- * assertion when it fails. The goal is to provide a cleaner stack trace to
4222
- * end users by removing Chai's internal functions. Note that it only works
4223
- * in environments that support `Error.captureStackTrace`, and only when
4224
- * `Chai.config.includeStack` hasn't been set to `false`.
4225
- *
4226
- * - `lockSsfi`: This flag controls whether or not the given `ssfi` flag
4227
- * should retain its current value, even as assertions are chained off of
4228
- * this object. This is usually set to `true` when creating a new assertion
4229
- * from within another assertion. It's also temporarily set to `true` before
4230
- * an overwritten assertion gets called by the overwriting assertion.
4231
- *
4232
- * @param {Mixed} obj target of the assertion
4233
- * @param {String} msg (optional) custom error message
4234
- * @param {Function} ssfi (optional) starting point for removing stack frames
4235
- * @param {Boolean} lockSsfi (optional) whether or not the ssfi flag is locked
4236
- * @api private
4237
- */
4238
- /*!
4239
- * Assertion Error
4240
- */
4241
- /*!
4242
- * Chai - addChainingMethod utility
4243
- * Copyright(c) 2012-2014 Jake Luer <jake@alogicalparadox.com>
4244
- * MIT Licensed
4245
- */
4246
- /*!
4247
- * Chai - addLengthGuard utility
4248
- * Copyright(c) 2012-2014 Jake Luer <jake@alogicalparadox.com>
4249
- * MIT Licensed
4250
- */
4251
- /*!
4252
- * Chai - addMethod utility
4253
- * Copyright(c) 2012-2014 Jake Luer <jake@alogicalparadox.com>
4254
- * MIT Licensed
4255
- */
4256
- /*!
4257
- * Chai - addProperty utility
4258
- * Copyright(c) 2012-2014 Jake Luer <jake@alogicalparadox.com>
4259
- * MIT Licensed
4260
- */
4261
- /*!
4262
- * Chai - compareByInspect utility
4263
- * Copyright(c) 2011-2016 Jake Luer <jake@alogicalparadox.com>
4264
- * MIT Licensed
4265
- */
4266
- /*!
4267
- * Chai - expectTypes utility
4268
- * Copyright(c) 2012-2014 Jake Luer <jake@alogicalparadox.com>
4269
- * MIT Licensed
4270
- */
4271
- /*!
4272
- * Chai - flag utility
4273
- * Copyright(c) 2012-2014 Jake Luer <jake@alogicalparadox.com>
4274
- * MIT Licensed
4275
- */
4276
- /*!
4277
- * Chai - getActual utility
4278
- * Copyright(c) 2012-2014 Jake Luer <jake@alogicalparadox.com>
4279
- * MIT Licensed
4280
- */
4281
- /*!
4282
- * Chai - getOwnEnumerableProperties utility
4283
- * Copyright(c) 2011-2016 Jake Luer <jake@alogicalparadox.com>
4284
- * MIT Licensed
4285
- */
4286
- /*!
4287
- * Chai - getOwnEnumerablePropertySymbols utility
4288
- * Copyright(c) 2011-2016 Jake Luer <jake@alogicalparadox.com>
4289
- * MIT Licensed
4290
- */
4291
- /*!
4292
- * Chai - getProperties utility
4293
- * Copyright(c) 2012-2014 Jake Luer <jake@alogicalparadox.com>
4294
- * MIT Licensed
4295
- */
4296
- /*!
4297
- * Chai - isNaN utility
4298
- * Copyright(c) 2012-2015 Sakthipriyan Vairamani <thechargingvolcano@gmail.com>
4299
- * MIT Licensed
4300
- */
4301
- /*!
4302
- * Chai - isProxyEnabled helper
4303
- * Copyright(c) 2012-2014 Jake Luer <jake@alogicalparadox.com>
4304
- * MIT Licensed
4305
- */
4306
- /*!
4307
- * Chai - message composition utility
4308
- * Copyright(c) 2012-2014 Jake Luer <jake@alogicalparadox.com>
4309
- * MIT Licensed
4310
- */
4311
- /*!
4312
- * Chai - overwriteChainableMethod utility
4313
- * Copyright(c) 2012-2014 Jake Luer <jake@alogicalparadox.com>
4314
- * MIT Licensed
4315
- */
4316
- /*!
4317
- * Chai - overwriteMethod utility
4318
- * Copyright(c) 2012-2014 Jake Luer <jake@alogicalparadox.com>
4319
- * MIT Licensed
4320
- */
4321
- /*!
4322
- * Chai - overwriteProperty utility
4323
- * Copyright(c) 2012-2014 Jake Luer <jake@alogicalparadox.com>
4324
- * MIT Licensed
4325
- */
4326
- /*!
4327
- * Chai - proxify utility
4328
- * Copyright(c) 2012-2014 Jake Luer <jake@alogicalparadox.com>
4329
- * MIT Licensed
4330
- */
4331
- /*!
4332
- * Chai - test utility
4333
- * Copyright(c) 2012-2014 Jake Luer <jake@alogicalparadox.com>
4334
- * MIT Licensed
4335
- */
4336
- /*!
4337
- * Chai - transferFlags utility
4338
- * Copyright(c) 2012-2014 Jake Luer <jake@alogicalparadox.com>
4339
- * MIT Licensed
4340
- */
4341
- /*!
4342
- * Chai dependencies.
4343
- */
4344
- /*!
4345
- * Chai version
4346
- */
4347
- /*!
4348
- * Check if a property exists
4349
- */
4350
- /*!
4351
- * Check to see if the MemoizeMap has recorded a result of the two operands
4352
- *
4353
- * @param {Mixed} leftHandOperand
4354
- * @param {Mixed} rightHandOperand
4355
- * @param {MemoizeMap} memoizeMap
4356
- * @returns {Boolean|null} result
4357
- */
4358
- /*!
4359
- * Checks error against a given set of criteria
4360
- */
4361
- /*!
4362
- * Compare by inspect method
4363
- */
4364
- /*!
4365
- * Compare two Regular Expressions for equality.
4366
- *
4367
- * @param {RegExp} leftHandOperand
4368
- * @param {RegExp} rightHandOperand
4369
- * @return {Boolean} result
4370
- */
4371
- /*!
4372
- * Compare two Sets/Maps for equality. Faster than other equality functions.
4373
- *
4374
- * @param {Set} leftHandOperand
4375
- * @param {Set} rightHandOperand
4376
- * @param {Object} [options] (Optional)
4377
- * @return {Boolean} result
4378
- */
4379
- /*!
4380
- * Configuration
4381
- */
4382
- /*!
4383
- * Core Assertions
4384
- */
4385
- /*!
4386
- * Deep equal utility
4387
- */
4388
- /*!
4389
- * Deep path info
4390
- */
4391
- /*!
4392
- * Dependencies that are used for multiple exports are required here only once
4393
- */
4394
- /*!
4395
- * Determine if the given object has an @@iterator function.
4396
- *
4397
- * @param {Object} target
4398
- * @return {Boolean} `true` if the object has an @@iterator function.
4399
- */
4400
- /*!
4401
- * Determines if two objects have matching values, given a set of keys. Defers to deepEqual for the equality check of
4402
- * each key. If any value of the given key is not equal, the function will return false (early).
4403
- *
4404
- * @param {Mixed} leftHandOperand
4405
- * @param {Mixed} rightHandOperand
4406
- * @param {Array} keys An array of keys to compare the values of leftHandOperand and rightHandOperand against
4407
- * @param {Object} [options] (Optional)
4408
- * @return {Boolean} result
4409
- */
4410
- /*!
4411
- * Ensure correct constructor
4412
- */
4413
- /*!
4414
- * Expect interface
4415
- */
4416
- /*!
4417
- * Flag transferring utility
4418
- */
4419
- /*!
4420
- * Flag utility
4421
- */
4422
- /*!
4423
- * Function name
4424
- */
4425
- /*!
4426
- * Get own enumerable properties method
4427
- */
4428
- /*!
4429
- * Get own enumerable property symbols method
4430
- */
4431
- /*!
4432
- * Gets all entries from a Generator. This will consume the generator - which could have side effects.
4433
- *
4434
- * @param {Generator} target
4435
- * @returns {Array} an array of entries from the Generator.
4436
- */
4437
- /*!
4438
- * Gets all iterator entries from the given Object. If the Object has no @@iterator function, returns an empty array.
4439
- * This will consume the iterator - which could have side effects depending on the @@iterator implementation.
4440
- *
4441
- * @param {Object} target
4442
- * @returns {Array} an array of entries from the @@iterator function
4443
- */
4444
- /*!
4445
- * Gets all own and inherited enumerable keys from a target.
4446
- *
4447
- * @param {Object} target
4448
- * @returns {Array} an array of own and inherited enumerable keys from the target.
4449
- */
4450
- /*!
4451
- * Inherit from Error.prototype
4452
- */
4453
- /*!
4454
- * Inspect util
4455
- */
4456
- /*!
4457
- * Module dependencies
4458
- */
4459
- /*!
4460
- * Module dependencies.
4461
- */
4462
- /*!
4463
- * Module export.
4464
- */
4465
- /*!
4466
- * Module variables
4467
- */
4468
- /*!
4469
- * Object Display util
4470
- */
4471
- /*!
4472
- * Overwrite chainable method
4473
- */
4474
- /*!
4475
- * Primary Export
4476
- */
4477
- /*!
4478
- * Primary Exports
4479
- */
4480
- /*!
4481
- * Primary `Assertion` prototype
4482
- */
4483
- /*!
4484
- * Proxify util
4485
- */
4486
- /*!
4487
- * Recursively check the equality of two Objects. Once basic sameness has been established it will defer to `deepEqual`
4488
- * for each enumerable key in the object.
4489
- *
4490
- * @param {Mixed} leftHandOperand
4491
- * @param {Mixed} rightHandOperand
4492
- * @param {Object} [options] (Optional)
4493
- * @return {Boolean} result
4494
- */
4495
- /*!
4496
- * Return a function that will copy properties from
4497
- * one object to another excluding any originally
4498
- * listed. Returned function will create a new `{}`.
4499
- *
4500
- * @param {String} excluded properties ...
4501
- * @return {Function}
4502
- */
4503
- /*!
4504
- * Returns true if the argument is a primitive.
4505
- *
4506
- * This intentionally returns true for all objects that can be compared by reference,
4507
- * including functions and symbols.
4508
- *
4509
- * @param {Mixed} value
4510
- * @return {Boolean} result
4511
- */
4512
- /*!
4513
- * Set the result of the equality into the MemoizeMap
4514
- *
4515
- * @param {Mixed} leftHandOperand
4516
- * @param {Mixed} rightHandOperand
4517
- * @param {MemoizeMap} memoizeMap
4518
- * @param {Boolean} result
4519
- */
4520
- /*!
4521
- * Should interface
4522
- */
4523
- /*!
4524
- * Simple equality for flat iterable objects such as Arrays, TypedArrays or Node.js buffers.
4525
- *
4526
- * @param {Iterable} leftHandOperand
4527
- * @param {Iterable} rightHandOperand
4528
- * @param {Object} [options] (Optional)
4529
- * @return {Boolean} result
4530
- */
4531
- /*!
4532
- * Simple equality for generator objects such as those returned by generator functions.
4533
- *
4534
- * @param {Iterable} leftHandOperand
4535
- * @param {Iterable} rightHandOperand
4536
- * @param {Object} [options] (Optional)
4537
- * @return {Boolean} result
4538
- */
4539
- /*!
4540
- * Statically set name
4541
- */
4542
- /*!
4543
- * The main logic of the `deepEqual` function.
4544
- *
4545
- * @param {Mixed} leftHandOperand
4546
- * @param {Mixed} rightHandOperand
4547
- * @param {Object} [options] (optional) Additional options
4548
- * @param {Array} [options.comparator] (optional) Override default algorithm, determining custom equality.
4549
- * @param {Array} [options.memoize] (optional) Provide a custom memoization object which will cache the results of
4550
- complex objects for a speed boost. By passing `false` you can disable memoization, but this will cause circular
4551
- references to blow the stack.
4552
- * @return {Boolean} equal match
4553
- */
4554
- /*!
4555
- * Utility Functions
4556
- */
4557
- /*!
4558
- * Utils for plugins (not exported)
4559
- */
4560
- /*!
4561
- * actual utility
4562
- */
4563
- /*!
4564
- * add Method
4565
- */
4566
- /*!
4567
- * add Property
4568
- */
4569
- /*!
4570
- * addLengthGuard util
4571
- */
4572
- /*!
4573
- * assertion-error
4574
- * Copyright(c) 2013 Jake Luer <jake@qualiancy.com>
4575
- * MIT Licensed
4576
- */
4577
- /*!
4578
- * chai
4579
- * Copyright(c) 2011 Jake Luer <jake@alogicalparadox.com>
4580
- * MIT Licensed
4581
- */
4582
- /*!
4583
- * chai
4584
- * Copyright(c) 2011-2014 Jake Luer <jake@alogicalparadox.com>
4585
- * MIT Licensed
4586
- */
4587
- /*!
4588
- * chai
4589
- * http://chaijs.com
4590
- * Copyright(c) 2011-2014 Jake Luer <jake@alogicalparadox.com>
4591
- * MIT Licensed
4592
- */
4593
- /*!
4594
- * deep-eql
4595
- * Copyright(c) 2013 Jake Luer <jake@alogicalparadox.com>
4596
- * MIT Licensed
4597
- */
4598
- /*!
4599
- * expectTypes utility
4600
- */
4601
- /*!
4602
- * getOperator method
4603
- */
4604
- /*!
4605
- * isNaN method
4606
- */
4607
- /*!
4608
- * isProxyEnabled helper
4609
- */
4610
- /*!
4611
- * message utility
4612
- */
4613
- /*!
4614
- * overwrite Method
4615
- */
4616
- /*!
4617
- * overwrite Property
4618
- */
4619
- /*!
4620
- * test utility
4621
- */
4622
- /*!
4623
- * type utility
4624
- */
4625
- //# sourceMappingURL=index.spec.mjs.map