@hellpig/anarchy-shared 1.4.4 → 1.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.
- package/CHANGELOG.md +1 -0
- package/dist/Constants/CssUnits.d.ts +7 -0
- package/dist/Constants/FallBackFonts.d.ts +1 -0
- package/dist/Constants/FileSizes.d.ts +11 -0
- package/dist/Constants/Json.d.ts +15 -0
- package/dist/Constants/index.d.ts +4 -0
- package/dist/Constants/index.es.js +6 -0
- package/dist/Constants/index.es.js.map +1 -0
- package/dist/Models/TBrowserInfo.d.ts +2 -0
- package/dist/Models/TDeferredPromise.d.ts +5 -0
- package/dist/Models/index.d.ts +2 -0
- package/dist/Models/index.es.js +2 -0
- package/dist/Models/index.es.js.map +1 -0
- package/dist/Plugins/EmitDefineVitePlugin.d.ts +7 -0
- package/dist/Plugins/index.d.ts +1 -0
- package/dist/Plugins/index.es.js +17 -0
- package/dist/Plugins/index.es.js.map +1 -0
- package/dist/Utils/ArrayUtils.d.ts +8 -0
- package/dist/Utils/AsyncUtils.d.ts +2 -0
- package/dist/Utils/CheckUtils.d.ts +6 -0
- package/dist/Utils/CssUtils.d.ts +5 -0
- package/dist/Utils/DetectUtils.d.ts +2 -0
- package/dist/Utils/EnvSchemaUtils.d.ts +2 -0
- package/dist/Utils/FileUtils.d.ts +3 -0
- package/dist/Utils/MapUtils.d.ts +3 -0
- package/dist/Utils/MathUtils.d.ts +1 -0
- package/dist/Utils/ObjectUtils.d.ts +9 -0
- package/dist/Utils/RxJsUtils.d.ts +2 -0
- package/dist/Utils/SanitizeUtils.d.ts +4 -0
- package/dist/Utils/StringUtils.d.ts +2 -0
- package/dist/Utils/TrackingUtils.d.ts +4 -0
- package/dist/Utils/TypesUtils.d.ts +28 -0
- package/dist/Utils/UrlUtils.d.ts +2 -0
- package/dist/Utils/WebGlUtils.d.ts +2 -0
- package/dist/Utils/index.d.ts +17 -0
- package/dist/Utils/index.es.js +3687 -0
- package/dist/Utils/index.es.js.map +1 -0
- package/dist/assets/_constants.scss +18 -0
- package/dist/assets/_utils.scss +6 -0
- package/dist/chunks/Json.js +57 -0
- package/dist/chunks/Json.js.map +1 -0
- package/package.json +28 -2
|
@@ -0,0 +1,3687 @@
|
|
|
1
|
+
import { C as CssUnits, F as FileSizes, D as DefaultBannedInJsonKeys, a as JsonSpecialCharactersUnicode, J as JsonSpecialCharactersAscii } from '../chunks/Json.js';
|
|
2
|
+
import Bowser from 'bowser';
|
|
3
|
+
|
|
4
|
+
function omitInArray(array, item) {
|
|
5
|
+
return array.filter((arrayItem) => arrayItem !== item);
|
|
6
|
+
}
|
|
7
|
+
function forEachEnum(enumType, callback) {
|
|
8
|
+
Object.keys(enumType).forEach((key, index) => callback(enumType[key], key, index));
|
|
9
|
+
}
|
|
10
|
+
function removeDuplicates(array) {
|
|
11
|
+
const uniqueMap = /* @__PURE__ */ new Map();
|
|
12
|
+
for (const item of array) {
|
|
13
|
+
uniqueMap.set(item.id, item);
|
|
14
|
+
}
|
|
15
|
+
return Array.from(uniqueMap.values());
|
|
16
|
+
}
|
|
17
|
+
const removeDuplicatesStr = (arr) => Array.from(new Set(arr));
|
|
18
|
+
function asRecord(key, list) {
|
|
19
|
+
return list.reduce(
|
|
20
|
+
(acc, item) => {
|
|
21
|
+
acc[item[key]] = item;
|
|
22
|
+
return acc;
|
|
23
|
+
},
|
|
24
|
+
{}
|
|
25
|
+
);
|
|
26
|
+
}
|
|
27
|
+
function findDuplicateString(arr) {
|
|
28
|
+
const seen = /* @__PURE__ */ new Set();
|
|
29
|
+
for (const str of arr) {
|
|
30
|
+
if (seen.has(str)) return str;
|
|
31
|
+
seen.add(str);
|
|
32
|
+
}
|
|
33
|
+
return void 0;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
function createDeferredPromise() {
|
|
37
|
+
let resolve;
|
|
38
|
+
let reject;
|
|
39
|
+
const promise = new Promise((res, rej) => {
|
|
40
|
+
resolve = res;
|
|
41
|
+
reject = rej;
|
|
42
|
+
});
|
|
43
|
+
return {
|
|
44
|
+
resolve,
|
|
45
|
+
reject,
|
|
46
|
+
promise
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
const isDefined = (value) => value !== void 0 && value !== null;
|
|
51
|
+
const isAllDefined = (values) => !values.some(isNotDefined);
|
|
52
|
+
const isNotDefined = (value) => !isDefined(value);
|
|
53
|
+
const isAllNotDefined = (values) => values.every(isNotDefined);
|
|
54
|
+
const isString = (value) => typeof value === "string";
|
|
55
|
+
const isBoolean = (value) => typeof value === "boolean";
|
|
56
|
+
|
|
57
|
+
function getBaseTextSize() {
|
|
58
|
+
return parseFloat(getComputedStyle(document.documentElement).fontSize);
|
|
59
|
+
}
|
|
60
|
+
function toPx(value) {
|
|
61
|
+
const defaultBaseTextSize = 16;
|
|
62
|
+
const baseTextSize = getBaseTextSize() || defaultBaseTextSize;
|
|
63
|
+
if (isNotDefined(value)) return `${baseTextSize}px`;
|
|
64
|
+
if (typeof value === "number") return `${value}px`;
|
|
65
|
+
return getSizeInPx(value);
|
|
66
|
+
}
|
|
67
|
+
function toRem(value) {
|
|
68
|
+
const defaultBaseTextSize = 16;
|
|
69
|
+
const baseTextSize = getBaseTextSize() || defaultBaseTextSize;
|
|
70
|
+
if (isNotDefined(value)) return `${baseTextSize / 16}rem`;
|
|
71
|
+
if (typeof value === "number") return `${value / baseTextSize}rem`;
|
|
72
|
+
return getSizeInRem(value);
|
|
73
|
+
}
|
|
74
|
+
const stripUnits = (value) => parseFloat(value);
|
|
75
|
+
function getSizeInPx(size) {
|
|
76
|
+
const units = getUnitsFromCssValue(size);
|
|
77
|
+
const value = stripUnits(size);
|
|
78
|
+
switch (units) {
|
|
79
|
+
case CssUnits.Px:
|
|
80
|
+
return `${value}px`;
|
|
81
|
+
case CssUnits.Em:
|
|
82
|
+
return `${value * getBaseTextSize()}px`;
|
|
83
|
+
case CssUnits.Rem:
|
|
84
|
+
return `${value * getBaseTextSize()}px`;
|
|
85
|
+
case CssUnits.Percent:
|
|
86
|
+
return `${value * getBaseTextSize() / 100}px`;
|
|
87
|
+
case CssUnits.Pt:
|
|
88
|
+
return `${value * 4 / 3}px`;
|
|
89
|
+
// 1pt = 1.3333px
|
|
90
|
+
default:
|
|
91
|
+
return size;
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
function getSizeInRem(size) {
|
|
95
|
+
const units = getUnitsFromCssValue(size);
|
|
96
|
+
const value = stripUnits(size);
|
|
97
|
+
switch (units) {
|
|
98
|
+
case CssUnits.Px:
|
|
99
|
+
return `${value / getBaseTextSize()}rem`;
|
|
100
|
+
case CssUnits.Em:
|
|
101
|
+
return `${value}rem`;
|
|
102
|
+
// Em is relative to the font size of the element, so it remains the same
|
|
103
|
+
case CssUnits.Rem:
|
|
104
|
+
return `${value}rem`;
|
|
105
|
+
case CssUnits.Percent:
|
|
106
|
+
return `${value / 100 * (getBaseTextSize() / 16)}rem`;
|
|
107
|
+
case CssUnits.Pt:
|
|
108
|
+
return `${value * 4 / (3 * getBaseTextSize())}rem`;
|
|
109
|
+
// 1pt = 1.3333px
|
|
110
|
+
default:
|
|
111
|
+
return size;
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
function getUnitsFromCssValue(value) {
|
|
115
|
+
const match = value.match(/([a-zA-Z%]+)$/);
|
|
116
|
+
return match ? match[1] : "";
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
const getBrowserInfo = () => Bowser.parse(window.navigator.userAgent);
|
|
120
|
+
|
|
121
|
+
// src/storages/globalConfig/globalConfig.ts
|
|
122
|
+
var store;
|
|
123
|
+
// @__NO_SIDE_EFFECTS__
|
|
124
|
+
function getGlobalConfig(config2) {
|
|
125
|
+
return {
|
|
126
|
+
lang: config2?.lang ?? store?.lang,
|
|
127
|
+
message: config2?.message,
|
|
128
|
+
abortEarly: config2?.abortEarly ?? store?.abortEarly,
|
|
129
|
+
abortPipeEarly: config2?.abortPipeEarly ?? store?.abortPipeEarly
|
|
130
|
+
};
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
// src/storages/globalMessage/globalMessage.ts
|
|
134
|
+
var store2;
|
|
135
|
+
// @__NO_SIDE_EFFECTS__
|
|
136
|
+
function getGlobalMessage(lang) {
|
|
137
|
+
return store2?.get(lang);
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
// src/storages/schemaMessage/schemaMessage.ts
|
|
141
|
+
var store3;
|
|
142
|
+
// @__NO_SIDE_EFFECTS__
|
|
143
|
+
function getSchemaMessage(lang) {
|
|
144
|
+
return store3?.get(lang);
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
// src/storages/specificMessage/specificMessage.ts
|
|
148
|
+
var store4;
|
|
149
|
+
// @__NO_SIDE_EFFECTS__
|
|
150
|
+
function getSpecificMessage(reference, lang) {
|
|
151
|
+
return store4?.get(reference)?.get(lang);
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
// src/utils/_stringify/_stringify.ts
|
|
155
|
+
// @__NO_SIDE_EFFECTS__
|
|
156
|
+
function _stringify(input) {
|
|
157
|
+
const type = typeof input;
|
|
158
|
+
if (type === "string") {
|
|
159
|
+
return `"${input}"`;
|
|
160
|
+
}
|
|
161
|
+
if (type === "number" || type === "bigint" || type === "boolean") {
|
|
162
|
+
return `${input}`;
|
|
163
|
+
}
|
|
164
|
+
if (type === "object" || type === "function") {
|
|
165
|
+
return (input && Object.getPrototypeOf(input)?.constructor?.name) ?? "null";
|
|
166
|
+
}
|
|
167
|
+
return type;
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
// src/utils/_addIssue/_addIssue.ts
|
|
171
|
+
function _addIssue(context, label, dataset, config2, other) {
|
|
172
|
+
const input = dataset.value;
|
|
173
|
+
const expected = context.expects ?? null;
|
|
174
|
+
const received = _stringify(input);
|
|
175
|
+
const issue = {
|
|
176
|
+
kind: context.kind,
|
|
177
|
+
type: context.type,
|
|
178
|
+
input,
|
|
179
|
+
expected,
|
|
180
|
+
received,
|
|
181
|
+
message: `Invalid ${label}: ${expected ? `Expected ${expected} but r` : "R"}eceived ${received}`,
|
|
182
|
+
requirement: context.requirement,
|
|
183
|
+
path: other?.path,
|
|
184
|
+
issues: other?.issues,
|
|
185
|
+
lang: config2.lang,
|
|
186
|
+
abortEarly: config2.abortEarly,
|
|
187
|
+
abortPipeEarly: config2.abortPipeEarly
|
|
188
|
+
};
|
|
189
|
+
const isSchema = context.kind === "schema";
|
|
190
|
+
const message2 = context.message ?? getSpecificMessage(context.reference, issue.lang) ?? (isSchema ? getSchemaMessage(issue.lang) : null) ?? config2.message ?? getGlobalMessage(issue.lang);
|
|
191
|
+
if (message2 !== void 0) {
|
|
192
|
+
issue.message = typeof message2 === "function" ? (
|
|
193
|
+
// @ts-expect-error
|
|
194
|
+
message2(issue)
|
|
195
|
+
) : message2;
|
|
196
|
+
}
|
|
197
|
+
if (isSchema) {
|
|
198
|
+
dataset.typed = false;
|
|
199
|
+
}
|
|
200
|
+
if (dataset.issues) {
|
|
201
|
+
dataset.issues.push(issue);
|
|
202
|
+
} else {
|
|
203
|
+
dataset.issues = [issue];
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
// src/utils/_getStandardProps/_getStandardProps.ts
|
|
208
|
+
// @__NO_SIDE_EFFECTS__
|
|
209
|
+
function _getStandardProps(context) {
|
|
210
|
+
return {
|
|
211
|
+
version: 1,
|
|
212
|
+
vendor: "valibot",
|
|
213
|
+
validate(value2) {
|
|
214
|
+
return context["~run"]({ value: value2 }, getGlobalConfig());
|
|
215
|
+
}
|
|
216
|
+
};
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
// src/actions/transform/transform.ts
|
|
220
|
+
// @__NO_SIDE_EFFECTS__
|
|
221
|
+
function transform(operation) {
|
|
222
|
+
return {
|
|
223
|
+
kind: "transformation",
|
|
224
|
+
type: "transform",
|
|
225
|
+
reference: transform,
|
|
226
|
+
async: false,
|
|
227
|
+
operation,
|
|
228
|
+
"~run"(dataset) {
|
|
229
|
+
dataset.value = this.operation(dataset.value);
|
|
230
|
+
return dataset;
|
|
231
|
+
}
|
|
232
|
+
};
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
// src/schemas/string/string.ts
|
|
236
|
+
// @__NO_SIDE_EFFECTS__
|
|
237
|
+
function string(message2) {
|
|
238
|
+
return {
|
|
239
|
+
kind: "schema",
|
|
240
|
+
type: "string",
|
|
241
|
+
reference: string,
|
|
242
|
+
expects: "string",
|
|
243
|
+
async: false,
|
|
244
|
+
message: message2,
|
|
245
|
+
get "~standard"() {
|
|
246
|
+
return _getStandardProps(this);
|
|
247
|
+
},
|
|
248
|
+
"~run"(dataset, config2) {
|
|
249
|
+
if (typeof dataset.value === "string") {
|
|
250
|
+
dataset.typed = true;
|
|
251
|
+
} else {
|
|
252
|
+
_addIssue(this, "type", dataset, config2);
|
|
253
|
+
}
|
|
254
|
+
return dataset;
|
|
255
|
+
}
|
|
256
|
+
};
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
// src/methods/pipe/pipe.ts
|
|
260
|
+
// @__NO_SIDE_EFFECTS__
|
|
261
|
+
function pipe(...pipe2) {
|
|
262
|
+
return {
|
|
263
|
+
...pipe2[0],
|
|
264
|
+
pipe: pipe2,
|
|
265
|
+
get "~standard"() {
|
|
266
|
+
return _getStandardProps(this);
|
|
267
|
+
},
|
|
268
|
+
"~run"(dataset, config2) {
|
|
269
|
+
for (const item of pipe2) {
|
|
270
|
+
if (item.kind !== "metadata") {
|
|
271
|
+
if (dataset.issues && (item.kind === "schema" || item.kind === "transformation")) {
|
|
272
|
+
dataset.typed = false;
|
|
273
|
+
break;
|
|
274
|
+
}
|
|
275
|
+
if (!dataset.issues || !config2.abortEarly && !config2.abortPipeEarly) {
|
|
276
|
+
dataset = item["~run"](dataset, config2);
|
|
277
|
+
}
|
|
278
|
+
}
|
|
279
|
+
}
|
|
280
|
+
return dataset;
|
|
281
|
+
}
|
|
282
|
+
};
|
|
283
|
+
}
|
|
284
|
+
|
|
285
|
+
const toBool = pipe(
|
|
286
|
+
string(),
|
|
287
|
+
transform((v) => v === "true")
|
|
288
|
+
);
|
|
289
|
+
const toInt = pipe(
|
|
290
|
+
string(),
|
|
291
|
+
transform((v) => parseInt(v, 10))
|
|
292
|
+
);
|
|
293
|
+
|
|
294
|
+
function getHumanReadableMemorySize(bytes, decimals = 2) {
|
|
295
|
+
if (!+bytes) return "0 Bytes";
|
|
296
|
+
const k = 1024;
|
|
297
|
+
const dm = decimals < 0 ? 0 : decimals;
|
|
298
|
+
const i = Math.floor(Math.log(bytes) / Math.log(k));
|
|
299
|
+
return `${parseFloat((bytes / Math.pow(k, i)).toFixed(dm))} ${Object.values(FileSizes)[i]}`;
|
|
300
|
+
}
|
|
301
|
+
function getFileExtension(name) {
|
|
302
|
+
const extension = /^.+\.([^.]+)$/.exec(name);
|
|
303
|
+
return isDefined(extension) ? extension[1] : void 0;
|
|
304
|
+
}
|
|
305
|
+
const toPosix = (s) => s.replace(/\\/g, "/");
|
|
306
|
+
|
|
307
|
+
function findInMap(map, cb) {
|
|
308
|
+
for (const [key, value] of map) {
|
|
309
|
+
if (cb(value, key)) return map.get(key);
|
|
310
|
+
}
|
|
311
|
+
return void 0;
|
|
312
|
+
}
|
|
313
|
+
function findKeyInMap(map, cb) {
|
|
314
|
+
for (const [key, value] of map) {
|
|
315
|
+
if (cb(value, key)) return key;
|
|
316
|
+
}
|
|
317
|
+
return void 0;
|
|
318
|
+
}
|
|
319
|
+
function findKeyWithValue(map, value) {
|
|
320
|
+
for (const [key, val] of map.entries()) if (val === value) return key;
|
|
321
|
+
return void 0;
|
|
322
|
+
}
|
|
323
|
+
|
|
324
|
+
function clamp(val, minimum, maximum) {
|
|
325
|
+
const min = Math.min(minimum, maximum);
|
|
326
|
+
const max = Math.max(minimum, maximum);
|
|
327
|
+
return Math.max(min, Math.min(max, val));
|
|
328
|
+
}
|
|
329
|
+
|
|
330
|
+
/** Detect free variable `global` from Node.js. */
|
|
331
|
+
var freeGlobal = typeof global == 'object' && global && global.Object === Object && global;
|
|
332
|
+
|
|
333
|
+
/** Detect free variable `self`. */
|
|
334
|
+
var freeSelf = typeof self == 'object' && self && self.Object === Object && self;
|
|
335
|
+
|
|
336
|
+
/** Used as a reference to the global object. */
|
|
337
|
+
var root = freeGlobal || freeSelf || Function('return this')();
|
|
338
|
+
|
|
339
|
+
/** Built-in value references. */
|
|
340
|
+
var Symbol$1 = root.Symbol;
|
|
341
|
+
|
|
342
|
+
/** Used for built-in method references. */
|
|
343
|
+
var objectProto$c = Object.prototype;
|
|
344
|
+
|
|
345
|
+
/** Used to check objects for own properties. */
|
|
346
|
+
var hasOwnProperty$9 = objectProto$c.hasOwnProperty;
|
|
347
|
+
|
|
348
|
+
/**
|
|
349
|
+
* Used to resolve the
|
|
350
|
+
* [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
|
|
351
|
+
* of values.
|
|
352
|
+
*/
|
|
353
|
+
var nativeObjectToString$1 = objectProto$c.toString;
|
|
354
|
+
|
|
355
|
+
/** Built-in value references. */
|
|
356
|
+
var symToStringTag$1 = Symbol$1 ? Symbol$1.toStringTag : undefined;
|
|
357
|
+
|
|
358
|
+
/**
|
|
359
|
+
* A specialized version of `baseGetTag` which ignores `Symbol.toStringTag` values.
|
|
360
|
+
*
|
|
361
|
+
* @private
|
|
362
|
+
* @param {*} value The value to query.
|
|
363
|
+
* @returns {string} Returns the raw `toStringTag`.
|
|
364
|
+
*/
|
|
365
|
+
function getRawTag(value) {
|
|
366
|
+
var isOwn = hasOwnProperty$9.call(value, symToStringTag$1),
|
|
367
|
+
tag = value[symToStringTag$1];
|
|
368
|
+
|
|
369
|
+
try {
|
|
370
|
+
value[symToStringTag$1] = undefined;
|
|
371
|
+
var unmasked = true;
|
|
372
|
+
} catch (e) {}
|
|
373
|
+
|
|
374
|
+
var result = nativeObjectToString$1.call(value);
|
|
375
|
+
if (unmasked) {
|
|
376
|
+
if (isOwn) {
|
|
377
|
+
value[symToStringTag$1] = tag;
|
|
378
|
+
} else {
|
|
379
|
+
delete value[symToStringTag$1];
|
|
380
|
+
}
|
|
381
|
+
}
|
|
382
|
+
return result;
|
|
383
|
+
}
|
|
384
|
+
|
|
385
|
+
/** Used for built-in method references. */
|
|
386
|
+
var objectProto$b = Object.prototype;
|
|
387
|
+
|
|
388
|
+
/**
|
|
389
|
+
* Used to resolve the
|
|
390
|
+
* [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
|
|
391
|
+
* of values.
|
|
392
|
+
*/
|
|
393
|
+
var nativeObjectToString = objectProto$b.toString;
|
|
394
|
+
|
|
395
|
+
/**
|
|
396
|
+
* Converts `value` to a string using `Object.prototype.toString`.
|
|
397
|
+
*
|
|
398
|
+
* @private
|
|
399
|
+
* @param {*} value The value to convert.
|
|
400
|
+
* @returns {string} Returns the converted string.
|
|
401
|
+
*/
|
|
402
|
+
function objectToString(value) {
|
|
403
|
+
return nativeObjectToString.call(value);
|
|
404
|
+
}
|
|
405
|
+
|
|
406
|
+
/** `Object#toString` result references. */
|
|
407
|
+
var nullTag = '[object Null]',
|
|
408
|
+
undefinedTag = '[object Undefined]';
|
|
409
|
+
|
|
410
|
+
/** Built-in value references. */
|
|
411
|
+
var symToStringTag = Symbol$1 ? Symbol$1.toStringTag : undefined;
|
|
412
|
+
|
|
413
|
+
/**
|
|
414
|
+
* The base implementation of `getTag` without fallbacks for buggy environments.
|
|
415
|
+
*
|
|
416
|
+
* @private
|
|
417
|
+
* @param {*} value The value to query.
|
|
418
|
+
* @returns {string} Returns the `toStringTag`.
|
|
419
|
+
*/
|
|
420
|
+
function baseGetTag(value) {
|
|
421
|
+
if (value == null) {
|
|
422
|
+
return value === undefined ? undefinedTag : nullTag;
|
|
423
|
+
}
|
|
424
|
+
return (symToStringTag && symToStringTag in Object(value))
|
|
425
|
+
? getRawTag(value)
|
|
426
|
+
: objectToString(value);
|
|
427
|
+
}
|
|
428
|
+
|
|
429
|
+
/**
|
|
430
|
+
* Checks if `value` is object-like. A value is object-like if it's not `null`
|
|
431
|
+
* and has a `typeof` result of "object".
|
|
432
|
+
*
|
|
433
|
+
* @static
|
|
434
|
+
* @memberOf _
|
|
435
|
+
* @since 4.0.0
|
|
436
|
+
* @category Lang
|
|
437
|
+
* @param {*} value The value to check.
|
|
438
|
+
* @returns {boolean} Returns `true` if `value` is object-like, else `false`.
|
|
439
|
+
* @example
|
|
440
|
+
*
|
|
441
|
+
* _.isObjectLike({});
|
|
442
|
+
* // => true
|
|
443
|
+
*
|
|
444
|
+
* _.isObjectLike([1, 2, 3]);
|
|
445
|
+
* // => true
|
|
446
|
+
*
|
|
447
|
+
* _.isObjectLike(_.noop);
|
|
448
|
+
* // => false
|
|
449
|
+
*
|
|
450
|
+
* _.isObjectLike(null);
|
|
451
|
+
* // => false
|
|
452
|
+
*/
|
|
453
|
+
function isObjectLike(value) {
|
|
454
|
+
return value != null && typeof value == 'object';
|
|
455
|
+
}
|
|
456
|
+
|
|
457
|
+
/**
|
|
458
|
+
* Checks if `value` is classified as an `Array` object.
|
|
459
|
+
*
|
|
460
|
+
* @static
|
|
461
|
+
* @memberOf _
|
|
462
|
+
* @since 0.1.0
|
|
463
|
+
* @category Lang
|
|
464
|
+
* @param {*} value The value to check.
|
|
465
|
+
* @returns {boolean} Returns `true` if `value` is an array, else `false`.
|
|
466
|
+
* @example
|
|
467
|
+
*
|
|
468
|
+
* _.isArray([1, 2, 3]);
|
|
469
|
+
* // => true
|
|
470
|
+
*
|
|
471
|
+
* _.isArray(document.body.children);
|
|
472
|
+
* // => false
|
|
473
|
+
*
|
|
474
|
+
* _.isArray('abc');
|
|
475
|
+
* // => false
|
|
476
|
+
*
|
|
477
|
+
* _.isArray(_.noop);
|
|
478
|
+
* // => false
|
|
479
|
+
*/
|
|
480
|
+
var isArray = Array.isArray;
|
|
481
|
+
|
|
482
|
+
/**
|
|
483
|
+
* Checks if `value` is the
|
|
484
|
+
* [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types)
|
|
485
|
+
* of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)
|
|
486
|
+
*
|
|
487
|
+
* @static
|
|
488
|
+
* @memberOf _
|
|
489
|
+
* @since 0.1.0
|
|
490
|
+
* @category Lang
|
|
491
|
+
* @param {*} value The value to check.
|
|
492
|
+
* @returns {boolean} Returns `true` if `value` is an object, else `false`.
|
|
493
|
+
* @example
|
|
494
|
+
*
|
|
495
|
+
* _.isObject({});
|
|
496
|
+
* // => true
|
|
497
|
+
*
|
|
498
|
+
* _.isObject([1, 2, 3]);
|
|
499
|
+
* // => true
|
|
500
|
+
*
|
|
501
|
+
* _.isObject(_.noop);
|
|
502
|
+
* // => true
|
|
503
|
+
*
|
|
504
|
+
* _.isObject(null);
|
|
505
|
+
* // => false
|
|
506
|
+
*/
|
|
507
|
+
function isObject$1(value) {
|
|
508
|
+
var type = typeof value;
|
|
509
|
+
return value != null && (type == 'object' || type == 'function');
|
|
510
|
+
}
|
|
511
|
+
|
|
512
|
+
/** `Object#toString` result references. */
|
|
513
|
+
var asyncTag = '[object AsyncFunction]',
|
|
514
|
+
funcTag$2 = '[object Function]',
|
|
515
|
+
genTag$1 = '[object GeneratorFunction]',
|
|
516
|
+
proxyTag = '[object Proxy]';
|
|
517
|
+
|
|
518
|
+
/**
|
|
519
|
+
* Checks if `value` is classified as a `Function` object.
|
|
520
|
+
*
|
|
521
|
+
* @static
|
|
522
|
+
* @memberOf _
|
|
523
|
+
* @since 0.1.0
|
|
524
|
+
* @category Lang
|
|
525
|
+
* @param {*} value The value to check.
|
|
526
|
+
* @returns {boolean} Returns `true` if `value` is a function, else `false`.
|
|
527
|
+
* @example
|
|
528
|
+
*
|
|
529
|
+
* _.isFunction(_);
|
|
530
|
+
* // => true
|
|
531
|
+
*
|
|
532
|
+
* _.isFunction(/abc/);
|
|
533
|
+
* // => false
|
|
534
|
+
*/
|
|
535
|
+
function isFunction$1(value) {
|
|
536
|
+
if (!isObject$1(value)) {
|
|
537
|
+
return false;
|
|
538
|
+
}
|
|
539
|
+
// The use of `Object#toString` avoids issues with the `typeof` operator
|
|
540
|
+
// in Safari 9 which returns 'object' for typed arrays and other constructors.
|
|
541
|
+
var tag = baseGetTag(value);
|
|
542
|
+
return tag == funcTag$2 || tag == genTag$1 || tag == asyncTag || tag == proxyTag;
|
|
543
|
+
}
|
|
544
|
+
|
|
545
|
+
/** Used to detect overreaching core-js shims. */
|
|
546
|
+
var coreJsData = root['__core-js_shared__'];
|
|
547
|
+
|
|
548
|
+
/** Used to detect methods masquerading as native. */
|
|
549
|
+
var maskSrcKey = (function() {
|
|
550
|
+
var uid = /[^.]+$/.exec(coreJsData && coreJsData.keys && coreJsData.keys.IE_PROTO || '');
|
|
551
|
+
return uid ? ('Symbol(src)_1.' + uid) : '';
|
|
552
|
+
}());
|
|
553
|
+
|
|
554
|
+
/**
|
|
555
|
+
* Checks if `func` has its source masked.
|
|
556
|
+
*
|
|
557
|
+
* @private
|
|
558
|
+
* @param {Function} func The function to check.
|
|
559
|
+
* @returns {boolean} Returns `true` if `func` is masked, else `false`.
|
|
560
|
+
*/
|
|
561
|
+
function isMasked(func) {
|
|
562
|
+
return !!maskSrcKey && (maskSrcKey in func);
|
|
563
|
+
}
|
|
564
|
+
|
|
565
|
+
/** Used for built-in method references. */
|
|
566
|
+
var funcProto$2 = Function.prototype;
|
|
567
|
+
|
|
568
|
+
/** Used to resolve the decompiled source of functions. */
|
|
569
|
+
var funcToString$2 = funcProto$2.toString;
|
|
570
|
+
|
|
571
|
+
/**
|
|
572
|
+
* Converts `func` to its source code.
|
|
573
|
+
*
|
|
574
|
+
* @private
|
|
575
|
+
* @param {Function} func The function to convert.
|
|
576
|
+
* @returns {string} Returns the source code.
|
|
577
|
+
*/
|
|
578
|
+
function toSource(func) {
|
|
579
|
+
if (func != null) {
|
|
580
|
+
try {
|
|
581
|
+
return funcToString$2.call(func);
|
|
582
|
+
} catch (e) {}
|
|
583
|
+
try {
|
|
584
|
+
return (func + '');
|
|
585
|
+
} catch (e) {}
|
|
586
|
+
}
|
|
587
|
+
return '';
|
|
588
|
+
}
|
|
589
|
+
|
|
590
|
+
/**
|
|
591
|
+
* Used to match `RegExp`
|
|
592
|
+
* [syntax characters](http://ecma-international.org/ecma-262/7.0/#sec-patterns).
|
|
593
|
+
*/
|
|
594
|
+
var reRegExpChar = /[\\^$.*+?()[\]{}|]/g;
|
|
595
|
+
|
|
596
|
+
/** Used to detect host constructors (Safari). */
|
|
597
|
+
var reIsHostCtor = /^\[object .+?Constructor\]$/;
|
|
598
|
+
|
|
599
|
+
/** Used for built-in method references. */
|
|
600
|
+
var funcProto$1 = Function.prototype,
|
|
601
|
+
objectProto$a = Object.prototype;
|
|
602
|
+
|
|
603
|
+
/** Used to resolve the decompiled source of functions. */
|
|
604
|
+
var funcToString$1 = funcProto$1.toString;
|
|
605
|
+
|
|
606
|
+
/** Used to check objects for own properties. */
|
|
607
|
+
var hasOwnProperty$8 = objectProto$a.hasOwnProperty;
|
|
608
|
+
|
|
609
|
+
/** Used to detect if a method is native. */
|
|
610
|
+
var reIsNative = RegExp('^' +
|
|
611
|
+
funcToString$1.call(hasOwnProperty$8).replace(reRegExpChar, '\\$&')
|
|
612
|
+
.replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, '$1.*?') + '$'
|
|
613
|
+
);
|
|
614
|
+
|
|
615
|
+
/**
|
|
616
|
+
* The base implementation of `_.isNative` without bad shim checks.
|
|
617
|
+
*
|
|
618
|
+
* @private
|
|
619
|
+
* @param {*} value The value to check.
|
|
620
|
+
* @returns {boolean} Returns `true` if `value` is a native function,
|
|
621
|
+
* else `false`.
|
|
622
|
+
*/
|
|
623
|
+
function baseIsNative(value) {
|
|
624
|
+
if (!isObject$1(value) || isMasked(value)) {
|
|
625
|
+
return false;
|
|
626
|
+
}
|
|
627
|
+
var pattern = isFunction$1(value) ? reIsNative : reIsHostCtor;
|
|
628
|
+
return pattern.test(toSource(value));
|
|
629
|
+
}
|
|
630
|
+
|
|
631
|
+
/**
|
|
632
|
+
* Gets the value at `key` of `object`.
|
|
633
|
+
*
|
|
634
|
+
* @private
|
|
635
|
+
* @param {Object} [object] The object to query.
|
|
636
|
+
* @param {string} key The key of the property to get.
|
|
637
|
+
* @returns {*} Returns the property value.
|
|
638
|
+
*/
|
|
639
|
+
function getValue(object, key) {
|
|
640
|
+
return object == null ? undefined : object[key];
|
|
641
|
+
}
|
|
642
|
+
|
|
643
|
+
/**
|
|
644
|
+
* Gets the native function at `key` of `object`.
|
|
645
|
+
*
|
|
646
|
+
* @private
|
|
647
|
+
* @param {Object} object The object to query.
|
|
648
|
+
* @param {string} key The key of the method to get.
|
|
649
|
+
* @returns {*} Returns the function if it's native, else `undefined`.
|
|
650
|
+
*/
|
|
651
|
+
function getNative(object, key) {
|
|
652
|
+
var value = getValue(object, key);
|
|
653
|
+
return baseIsNative(value) ? value : undefined;
|
|
654
|
+
}
|
|
655
|
+
|
|
656
|
+
/* Built-in method references that are verified to be native. */
|
|
657
|
+
var WeakMap = getNative(root, 'WeakMap');
|
|
658
|
+
|
|
659
|
+
/** Built-in value references. */
|
|
660
|
+
var objectCreate = Object.create;
|
|
661
|
+
|
|
662
|
+
/**
|
|
663
|
+
* The base implementation of `_.create` without support for assigning
|
|
664
|
+
* properties to the created object.
|
|
665
|
+
*
|
|
666
|
+
* @private
|
|
667
|
+
* @param {Object} proto The object to inherit from.
|
|
668
|
+
* @returns {Object} Returns the new object.
|
|
669
|
+
*/
|
|
670
|
+
var baseCreate = (function() {
|
|
671
|
+
function object() {}
|
|
672
|
+
return function(proto) {
|
|
673
|
+
if (!isObject$1(proto)) {
|
|
674
|
+
return {};
|
|
675
|
+
}
|
|
676
|
+
if (objectCreate) {
|
|
677
|
+
return objectCreate(proto);
|
|
678
|
+
}
|
|
679
|
+
object.prototype = proto;
|
|
680
|
+
var result = new object;
|
|
681
|
+
object.prototype = undefined;
|
|
682
|
+
return result;
|
|
683
|
+
};
|
|
684
|
+
}());
|
|
685
|
+
|
|
686
|
+
var defineProperty = (function() {
|
|
687
|
+
try {
|
|
688
|
+
var func = getNative(Object, 'defineProperty');
|
|
689
|
+
func({}, '', {});
|
|
690
|
+
return func;
|
|
691
|
+
} catch (e) {}
|
|
692
|
+
}());
|
|
693
|
+
|
|
694
|
+
/**
|
|
695
|
+
* A specialized version of `_.forEach` for arrays without support for
|
|
696
|
+
* iteratee shorthands.
|
|
697
|
+
*
|
|
698
|
+
* @private
|
|
699
|
+
* @param {Array} [array] The array to iterate over.
|
|
700
|
+
* @param {Function} iteratee The function invoked per iteration.
|
|
701
|
+
* @returns {Array} Returns `array`.
|
|
702
|
+
*/
|
|
703
|
+
function arrayEach(array, iteratee) {
|
|
704
|
+
var index = -1,
|
|
705
|
+
length = array == null ? 0 : array.length;
|
|
706
|
+
|
|
707
|
+
while (++index < length) {
|
|
708
|
+
if (iteratee(array[index], index, array) === false) {
|
|
709
|
+
break;
|
|
710
|
+
}
|
|
711
|
+
}
|
|
712
|
+
return array;
|
|
713
|
+
}
|
|
714
|
+
|
|
715
|
+
/** Used as references for various `Number` constants. */
|
|
716
|
+
var MAX_SAFE_INTEGER$1 = 9007199254740991;
|
|
717
|
+
|
|
718
|
+
/** Used to detect unsigned integer values. */
|
|
719
|
+
var reIsUint = /^(?:0|[1-9]\d*)$/;
|
|
720
|
+
|
|
721
|
+
/**
|
|
722
|
+
* Checks if `value` is a valid array-like index.
|
|
723
|
+
*
|
|
724
|
+
* @private
|
|
725
|
+
* @param {*} value The value to check.
|
|
726
|
+
* @param {number} [length=MAX_SAFE_INTEGER] The upper bounds of a valid index.
|
|
727
|
+
* @returns {boolean} Returns `true` if `value` is a valid index, else `false`.
|
|
728
|
+
*/
|
|
729
|
+
function isIndex(value, length) {
|
|
730
|
+
var type = typeof value;
|
|
731
|
+
length = length == null ? MAX_SAFE_INTEGER$1 : length;
|
|
732
|
+
|
|
733
|
+
return !!length &&
|
|
734
|
+
(type == 'number' ||
|
|
735
|
+
(type != 'symbol' && reIsUint.test(value))) &&
|
|
736
|
+
(value > -1 && value % 1 == 0 && value < length);
|
|
737
|
+
}
|
|
738
|
+
|
|
739
|
+
/**
|
|
740
|
+
* The base implementation of `assignValue` and `assignMergeValue` without
|
|
741
|
+
* value checks.
|
|
742
|
+
*
|
|
743
|
+
* @private
|
|
744
|
+
* @param {Object} object The object to modify.
|
|
745
|
+
* @param {string} key The key of the property to assign.
|
|
746
|
+
* @param {*} value The value to assign.
|
|
747
|
+
*/
|
|
748
|
+
function baseAssignValue(object, key, value) {
|
|
749
|
+
if (key == '__proto__' && defineProperty) {
|
|
750
|
+
defineProperty(object, key, {
|
|
751
|
+
'configurable': true,
|
|
752
|
+
'enumerable': true,
|
|
753
|
+
'value': value,
|
|
754
|
+
'writable': true
|
|
755
|
+
});
|
|
756
|
+
} else {
|
|
757
|
+
object[key] = value;
|
|
758
|
+
}
|
|
759
|
+
}
|
|
760
|
+
|
|
761
|
+
/**
|
|
762
|
+
* Performs a
|
|
763
|
+
* [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
|
|
764
|
+
* comparison between two values to determine if they are equivalent.
|
|
765
|
+
*
|
|
766
|
+
* @static
|
|
767
|
+
* @memberOf _
|
|
768
|
+
* @since 4.0.0
|
|
769
|
+
* @category Lang
|
|
770
|
+
* @param {*} value The value to compare.
|
|
771
|
+
* @param {*} other The other value to compare.
|
|
772
|
+
* @returns {boolean} Returns `true` if the values are equivalent, else `false`.
|
|
773
|
+
* @example
|
|
774
|
+
*
|
|
775
|
+
* var object = { 'a': 1 };
|
|
776
|
+
* var other = { 'a': 1 };
|
|
777
|
+
*
|
|
778
|
+
* _.eq(object, object);
|
|
779
|
+
* // => true
|
|
780
|
+
*
|
|
781
|
+
* _.eq(object, other);
|
|
782
|
+
* // => false
|
|
783
|
+
*
|
|
784
|
+
* _.eq('a', 'a');
|
|
785
|
+
* // => true
|
|
786
|
+
*
|
|
787
|
+
* _.eq('a', Object('a'));
|
|
788
|
+
* // => false
|
|
789
|
+
*
|
|
790
|
+
* _.eq(NaN, NaN);
|
|
791
|
+
* // => true
|
|
792
|
+
*/
|
|
793
|
+
function eq(value, other) {
|
|
794
|
+
return value === other || (value !== value && other !== other);
|
|
795
|
+
}
|
|
796
|
+
|
|
797
|
+
/** Used for built-in method references. */
|
|
798
|
+
var objectProto$9 = Object.prototype;
|
|
799
|
+
|
|
800
|
+
/** Used to check objects for own properties. */
|
|
801
|
+
var hasOwnProperty$7 = objectProto$9.hasOwnProperty;
|
|
802
|
+
|
|
803
|
+
/**
|
|
804
|
+
* Assigns `value` to `key` of `object` if the existing value is not equivalent
|
|
805
|
+
* using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
|
|
806
|
+
* for equality comparisons.
|
|
807
|
+
*
|
|
808
|
+
* @private
|
|
809
|
+
* @param {Object} object The object to modify.
|
|
810
|
+
* @param {string} key The key of the property to assign.
|
|
811
|
+
* @param {*} value The value to assign.
|
|
812
|
+
*/
|
|
813
|
+
function assignValue(object, key, value) {
|
|
814
|
+
var objValue = object[key];
|
|
815
|
+
if (!(hasOwnProperty$7.call(object, key) && eq(objValue, value)) ||
|
|
816
|
+
(value === undefined && !(key in object))) {
|
|
817
|
+
baseAssignValue(object, key, value);
|
|
818
|
+
}
|
|
819
|
+
}
|
|
820
|
+
|
|
821
|
+
/** Used as references for various `Number` constants. */
|
|
822
|
+
var MAX_SAFE_INTEGER = 9007199254740991;
|
|
823
|
+
|
|
824
|
+
/**
|
|
825
|
+
* Checks if `value` is a valid array-like length.
|
|
826
|
+
*
|
|
827
|
+
* **Note:** This method is loosely based on
|
|
828
|
+
* [`ToLength`](http://ecma-international.org/ecma-262/7.0/#sec-tolength).
|
|
829
|
+
*
|
|
830
|
+
* @static
|
|
831
|
+
* @memberOf _
|
|
832
|
+
* @since 4.0.0
|
|
833
|
+
* @category Lang
|
|
834
|
+
* @param {*} value The value to check.
|
|
835
|
+
* @returns {boolean} Returns `true` if `value` is a valid length, else `false`.
|
|
836
|
+
* @example
|
|
837
|
+
*
|
|
838
|
+
* _.isLength(3);
|
|
839
|
+
* // => true
|
|
840
|
+
*
|
|
841
|
+
* _.isLength(Number.MIN_VALUE);
|
|
842
|
+
* // => false
|
|
843
|
+
*
|
|
844
|
+
* _.isLength(Infinity);
|
|
845
|
+
* // => false
|
|
846
|
+
*
|
|
847
|
+
* _.isLength('3');
|
|
848
|
+
* // => false
|
|
849
|
+
*/
|
|
850
|
+
function isLength(value) {
|
|
851
|
+
return typeof value == 'number' &&
|
|
852
|
+
value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER;
|
|
853
|
+
}
|
|
854
|
+
|
|
855
|
+
/**
|
|
856
|
+
* Checks if `value` is array-like. A value is considered array-like if it's
|
|
857
|
+
* not a function and has a `value.length` that's an integer greater than or
|
|
858
|
+
* equal to `0` and less than or equal to `Number.MAX_SAFE_INTEGER`.
|
|
859
|
+
*
|
|
860
|
+
* @static
|
|
861
|
+
* @memberOf _
|
|
862
|
+
* @since 4.0.0
|
|
863
|
+
* @category Lang
|
|
864
|
+
* @param {*} value The value to check.
|
|
865
|
+
* @returns {boolean} Returns `true` if `value` is array-like, else `false`.
|
|
866
|
+
* @example
|
|
867
|
+
*
|
|
868
|
+
* _.isArrayLike([1, 2, 3]);
|
|
869
|
+
* // => true
|
|
870
|
+
*
|
|
871
|
+
* _.isArrayLike(document.body.children);
|
|
872
|
+
* // => true
|
|
873
|
+
*
|
|
874
|
+
* _.isArrayLike('abc');
|
|
875
|
+
* // => true
|
|
876
|
+
*
|
|
877
|
+
* _.isArrayLike(_.noop);
|
|
878
|
+
* // => false
|
|
879
|
+
*/
|
|
880
|
+
function isArrayLike$1(value) {
|
|
881
|
+
return value != null && isLength(value.length) && !isFunction$1(value);
|
|
882
|
+
}
|
|
883
|
+
|
|
884
|
+
/** Used for built-in method references. */
|
|
885
|
+
var objectProto$8 = Object.prototype;
|
|
886
|
+
|
|
887
|
+
/**
|
|
888
|
+
* Checks if `value` is likely a prototype object.
|
|
889
|
+
*
|
|
890
|
+
* @private
|
|
891
|
+
* @param {*} value The value to check.
|
|
892
|
+
* @returns {boolean} Returns `true` if `value` is a prototype, else `false`.
|
|
893
|
+
*/
|
|
894
|
+
function isPrototype(value) {
|
|
895
|
+
var Ctor = value && value.constructor,
|
|
896
|
+
proto = (typeof Ctor == 'function' && Ctor.prototype) || objectProto$8;
|
|
897
|
+
|
|
898
|
+
return value === proto;
|
|
899
|
+
}
|
|
900
|
+
|
|
901
|
+
/**
|
|
902
|
+
* The base implementation of `_.times` without support for iteratee shorthands
|
|
903
|
+
* or max array length checks.
|
|
904
|
+
*
|
|
905
|
+
* @private
|
|
906
|
+
* @param {number} n The number of times to invoke `iteratee`.
|
|
907
|
+
* @param {Function} iteratee The function invoked per iteration.
|
|
908
|
+
* @returns {Array} Returns the array of results.
|
|
909
|
+
*/
|
|
910
|
+
function baseTimes(n, iteratee) {
|
|
911
|
+
var index = -1,
|
|
912
|
+
result = Array(n);
|
|
913
|
+
|
|
914
|
+
while (++index < n) {
|
|
915
|
+
result[index] = iteratee(index);
|
|
916
|
+
}
|
|
917
|
+
return result;
|
|
918
|
+
}
|
|
919
|
+
|
|
920
|
+
/** `Object#toString` result references. */
|
|
921
|
+
var argsTag$2 = '[object Arguments]';
|
|
922
|
+
|
|
923
|
+
/**
|
|
924
|
+
* The base implementation of `_.isArguments`.
|
|
925
|
+
*
|
|
926
|
+
* @private
|
|
927
|
+
* @param {*} value The value to check.
|
|
928
|
+
* @returns {boolean} Returns `true` if `value` is an `arguments` object,
|
|
929
|
+
*/
|
|
930
|
+
function baseIsArguments(value) {
|
|
931
|
+
return isObjectLike(value) && baseGetTag(value) == argsTag$2;
|
|
932
|
+
}
|
|
933
|
+
|
|
934
|
+
/** Used for built-in method references. */
|
|
935
|
+
var objectProto$7 = Object.prototype;
|
|
936
|
+
|
|
937
|
+
/** Used to check objects for own properties. */
|
|
938
|
+
var hasOwnProperty$6 = objectProto$7.hasOwnProperty;
|
|
939
|
+
|
|
940
|
+
/** Built-in value references. */
|
|
941
|
+
var propertyIsEnumerable$1 = objectProto$7.propertyIsEnumerable;
|
|
942
|
+
|
|
943
|
+
/**
|
|
944
|
+
* Checks if `value` is likely an `arguments` object.
|
|
945
|
+
*
|
|
946
|
+
* @static
|
|
947
|
+
* @memberOf _
|
|
948
|
+
* @since 0.1.0
|
|
949
|
+
* @category Lang
|
|
950
|
+
* @param {*} value The value to check.
|
|
951
|
+
* @returns {boolean} Returns `true` if `value` is an `arguments` object,
|
|
952
|
+
* else `false`.
|
|
953
|
+
* @example
|
|
954
|
+
*
|
|
955
|
+
* _.isArguments(function() { return arguments; }());
|
|
956
|
+
* // => true
|
|
957
|
+
*
|
|
958
|
+
* _.isArguments([1, 2, 3]);
|
|
959
|
+
* // => false
|
|
960
|
+
*/
|
|
961
|
+
var isArguments = baseIsArguments(function() { return arguments; }()) ? baseIsArguments : function(value) {
|
|
962
|
+
return isObjectLike(value) && hasOwnProperty$6.call(value, 'callee') &&
|
|
963
|
+
!propertyIsEnumerable$1.call(value, 'callee');
|
|
964
|
+
};
|
|
965
|
+
|
|
966
|
+
/**
|
|
967
|
+
* This method returns `false`.
|
|
968
|
+
*
|
|
969
|
+
* @static
|
|
970
|
+
* @memberOf _
|
|
971
|
+
* @since 4.13.0
|
|
972
|
+
* @category Util
|
|
973
|
+
* @returns {boolean} Returns `false`.
|
|
974
|
+
* @example
|
|
975
|
+
*
|
|
976
|
+
* _.times(2, _.stubFalse);
|
|
977
|
+
* // => [false, false]
|
|
978
|
+
*/
|
|
979
|
+
function stubFalse() {
|
|
980
|
+
return false;
|
|
981
|
+
}
|
|
982
|
+
|
|
983
|
+
/** Detect free variable `exports`. */
|
|
984
|
+
var freeExports$2 = typeof exports == 'object' && exports && !exports.nodeType && exports;
|
|
985
|
+
|
|
986
|
+
/** Detect free variable `module`. */
|
|
987
|
+
var freeModule$2 = freeExports$2 && typeof module == 'object' && module && !module.nodeType && module;
|
|
988
|
+
|
|
989
|
+
/** Detect the popular CommonJS extension `module.exports`. */
|
|
990
|
+
var moduleExports$2 = freeModule$2 && freeModule$2.exports === freeExports$2;
|
|
991
|
+
|
|
992
|
+
/** Built-in value references. */
|
|
993
|
+
var Buffer$2 = moduleExports$2 ? root.Buffer : undefined;
|
|
994
|
+
|
|
995
|
+
/* Built-in method references for those with the same name as other `lodash` methods. */
|
|
996
|
+
var nativeIsBuffer = Buffer$2 ? Buffer$2.isBuffer : undefined;
|
|
997
|
+
|
|
998
|
+
/**
|
|
999
|
+
* Checks if `value` is a buffer.
|
|
1000
|
+
*
|
|
1001
|
+
* @static
|
|
1002
|
+
* @memberOf _
|
|
1003
|
+
* @since 4.3.0
|
|
1004
|
+
* @category Lang
|
|
1005
|
+
* @param {*} value The value to check.
|
|
1006
|
+
* @returns {boolean} Returns `true` if `value` is a buffer, else `false`.
|
|
1007
|
+
* @example
|
|
1008
|
+
*
|
|
1009
|
+
* _.isBuffer(new Buffer(2));
|
|
1010
|
+
* // => true
|
|
1011
|
+
*
|
|
1012
|
+
* _.isBuffer(new Uint8Array(2));
|
|
1013
|
+
* // => false
|
|
1014
|
+
*/
|
|
1015
|
+
var isBuffer = nativeIsBuffer || stubFalse;
|
|
1016
|
+
|
|
1017
|
+
/** `Object#toString` result references. */
|
|
1018
|
+
var argsTag$1 = '[object Arguments]',
|
|
1019
|
+
arrayTag$1 = '[object Array]',
|
|
1020
|
+
boolTag$2 = '[object Boolean]',
|
|
1021
|
+
dateTag$2 = '[object Date]',
|
|
1022
|
+
errorTag$1 = '[object Error]',
|
|
1023
|
+
funcTag$1 = '[object Function]',
|
|
1024
|
+
mapTag$4 = '[object Map]',
|
|
1025
|
+
numberTag$2 = '[object Number]',
|
|
1026
|
+
objectTag$3 = '[object Object]',
|
|
1027
|
+
regexpTag$2 = '[object RegExp]',
|
|
1028
|
+
setTag$4 = '[object Set]',
|
|
1029
|
+
stringTag$2 = '[object String]',
|
|
1030
|
+
weakMapTag$2 = '[object WeakMap]';
|
|
1031
|
+
|
|
1032
|
+
var arrayBufferTag$2 = '[object ArrayBuffer]',
|
|
1033
|
+
dataViewTag$3 = '[object DataView]',
|
|
1034
|
+
float32Tag$2 = '[object Float32Array]',
|
|
1035
|
+
float64Tag$2 = '[object Float64Array]',
|
|
1036
|
+
int8Tag$2 = '[object Int8Array]',
|
|
1037
|
+
int16Tag$2 = '[object Int16Array]',
|
|
1038
|
+
int32Tag$2 = '[object Int32Array]',
|
|
1039
|
+
uint8Tag$2 = '[object Uint8Array]',
|
|
1040
|
+
uint8ClampedTag$2 = '[object Uint8ClampedArray]',
|
|
1041
|
+
uint16Tag$2 = '[object Uint16Array]',
|
|
1042
|
+
uint32Tag$2 = '[object Uint32Array]';
|
|
1043
|
+
|
|
1044
|
+
/** Used to identify `toStringTag` values of typed arrays. */
|
|
1045
|
+
var typedArrayTags = {};
|
|
1046
|
+
typedArrayTags[float32Tag$2] = typedArrayTags[float64Tag$2] =
|
|
1047
|
+
typedArrayTags[int8Tag$2] = typedArrayTags[int16Tag$2] =
|
|
1048
|
+
typedArrayTags[int32Tag$2] = typedArrayTags[uint8Tag$2] =
|
|
1049
|
+
typedArrayTags[uint8ClampedTag$2] = typedArrayTags[uint16Tag$2] =
|
|
1050
|
+
typedArrayTags[uint32Tag$2] = true;
|
|
1051
|
+
typedArrayTags[argsTag$1] = typedArrayTags[arrayTag$1] =
|
|
1052
|
+
typedArrayTags[arrayBufferTag$2] = typedArrayTags[boolTag$2] =
|
|
1053
|
+
typedArrayTags[dataViewTag$3] = typedArrayTags[dateTag$2] =
|
|
1054
|
+
typedArrayTags[errorTag$1] = typedArrayTags[funcTag$1] =
|
|
1055
|
+
typedArrayTags[mapTag$4] = typedArrayTags[numberTag$2] =
|
|
1056
|
+
typedArrayTags[objectTag$3] = typedArrayTags[regexpTag$2] =
|
|
1057
|
+
typedArrayTags[setTag$4] = typedArrayTags[stringTag$2] =
|
|
1058
|
+
typedArrayTags[weakMapTag$2] = false;
|
|
1059
|
+
|
|
1060
|
+
/**
|
|
1061
|
+
* The base implementation of `_.isTypedArray` without Node.js optimizations.
|
|
1062
|
+
*
|
|
1063
|
+
* @private
|
|
1064
|
+
* @param {*} value The value to check.
|
|
1065
|
+
* @returns {boolean} Returns `true` if `value` is a typed array, else `false`.
|
|
1066
|
+
*/
|
|
1067
|
+
function baseIsTypedArray(value) {
|
|
1068
|
+
return isObjectLike(value) &&
|
|
1069
|
+
isLength(value.length) && !!typedArrayTags[baseGetTag(value)];
|
|
1070
|
+
}
|
|
1071
|
+
|
|
1072
|
+
/**
|
|
1073
|
+
* The base implementation of `_.unary` without support for storing metadata.
|
|
1074
|
+
*
|
|
1075
|
+
* @private
|
|
1076
|
+
* @param {Function} func The function to cap arguments for.
|
|
1077
|
+
* @returns {Function} Returns the new capped function.
|
|
1078
|
+
*/
|
|
1079
|
+
function baseUnary(func) {
|
|
1080
|
+
return function(value) {
|
|
1081
|
+
return func(value);
|
|
1082
|
+
};
|
|
1083
|
+
}
|
|
1084
|
+
|
|
1085
|
+
/** Detect free variable `exports`. */
|
|
1086
|
+
var freeExports$1 = typeof exports == 'object' && exports && !exports.nodeType && exports;
|
|
1087
|
+
|
|
1088
|
+
/** Detect free variable `module`. */
|
|
1089
|
+
var freeModule$1 = freeExports$1 && typeof module == 'object' && module && !module.nodeType && module;
|
|
1090
|
+
|
|
1091
|
+
/** Detect the popular CommonJS extension `module.exports`. */
|
|
1092
|
+
var moduleExports$1 = freeModule$1 && freeModule$1.exports === freeExports$1;
|
|
1093
|
+
|
|
1094
|
+
/** Detect free variable `process` from Node.js. */
|
|
1095
|
+
var freeProcess = moduleExports$1 && freeGlobal.process;
|
|
1096
|
+
|
|
1097
|
+
/** Used to access faster Node.js helpers. */
|
|
1098
|
+
var nodeUtil = (function() {
|
|
1099
|
+
try {
|
|
1100
|
+
// Use `util.types` for Node.js 10+.
|
|
1101
|
+
var types = freeModule$1 && freeModule$1.require && freeModule$1.require('util').types;
|
|
1102
|
+
|
|
1103
|
+
if (types) {
|
|
1104
|
+
return types;
|
|
1105
|
+
}
|
|
1106
|
+
|
|
1107
|
+
// Legacy `process.binding('util')` for Node.js < 10.
|
|
1108
|
+
return freeProcess && freeProcess.binding && freeProcess.binding('util');
|
|
1109
|
+
} catch (e) {}
|
|
1110
|
+
}());
|
|
1111
|
+
|
|
1112
|
+
/* Node.js helper references. */
|
|
1113
|
+
var nodeIsTypedArray = nodeUtil && nodeUtil.isTypedArray;
|
|
1114
|
+
|
|
1115
|
+
/**
|
|
1116
|
+
* Checks if `value` is classified as a typed array.
|
|
1117
|
+
*
|
|
1118
|
+
* @static
|
|
1119
|
+
* @memberOf _
|
|
1120
|
+
* @since 3.0.0
|
|
1121
|
+
* @category Lang
|
|
1122
|
+
* @param {*} value The value to check.
|
|
1123
|
+
* @returns {boolean} Returns `true` if `value` is a typed array, else `false`.
|
|
1124
|
+
* @example
|
|
1125
|
+
*
|
|
1126
|
+
* _.isTypedArray(new Uint8Array);
|
|
1127
|
+
* // => true
|
|
1128
|
+
*
|
|
1129
|
+
* _.isTypedArray([]);
|
|
1130
|
+
* // => false
|
|
1131
|
+
*/
|
|
1132
|
+
var isTypedArray = nodeIsTypedArray ? baseUnary(nodeIsTypedArray) : baseIsTypedArray;
|
|
1133
|
+
|
|
1134
|
+
/** Used for built-in method references. */
|
|
1135
|
+
var objectProto$6 = Object.prototype;
|
|
1136
|
+
|
|
1137
|
+
/** Used to check objects for own properties. */
|
|
1138
|
+
var hasOwnProperty$5 = objectProto$6.hasOwnProperty;
|
|
1139
|
+
|
|
1140
|
+
/**
|
|
1141
|
+
* Creates an array of the enumerable property names of the array-like `value`.
|
|
1142
|
+
*
|
|
1143
|
+
* @private
|
|
1144
|
+
* @param {*} value The value to query.
|
|
1145
|
+
* @param {boolean} inherited Specify returning inherited property names.
|
|
1146
|
+
* @returns {Array} Returns the array of property names.
|
|
1147
|
+
*/
|
|
1148
|
+
function arrayLikeKeys(value, inherited) {
|
|
1149
|
+
var isArr = isArray(value),
|
|
1150
|
+
isArg = !isArr && isArguments(value),
|
|
1151
|
+
isBuff = !isArr && !isArg && isBuffer(value),
|
|
1152
|
+
isType = !isArr && !isArg && !isBuff && isTypedArray(value),
|
|
1153
|
+
skipIndexes = isArr || isArg || isBuff || isType,
|
|
1154
|
+
result = skipIndexes ? baseTimes(value.length, String) : [],
|
|
1155
|
+
length = result.length;
|
|
1156
|
+
|
|
1157
|
+
for (var key in value) {
|
|
1158
|
+
if ((hasOwnProperty$5.call(value, key)) &&
|
|
1159
|
+
!(skipIndexes && (
|
|
1160
|
+
// Safari 9 has enumerable `arguments.length` in strict mode.
|
|
1161
|
+
key == 'length' ||
|
|
1162
|
+
// Node.js 0.10 has enumerable non-index properties on buffers.
|
|
1163
|
+
(isBuff && (key == 'offset' || key == 'parent')) ||
|
|
1164
|
+
// PhantomJS 2 has enumerable non-index properties on typed arrays.
|
|
1165
|
+
(isType && (key == 'buffer' || key == 'byteLength' || key == 'byteOffset')) ||
|
|
1166
|
+
// Skip index properties.
|
|
1167
|
+
isIndex(key, length)
|
|
1168
|
+
))) {
|
|
1169
|
+
result.push(key);
|
|
1170
|
+
}
|
|
1171
|
+
}
|
|
1172
|
+
return result;
|
|
1173
|
+
}
|
|
1174
|
+
|
|
1175
|
+
/**
|
|
1176
|
+
* Creates a unary function that invokes `func` with its argument transformed.
|
|
1177
|
+
*
|
|
1178
|
+
* @private
|
|
1179
|
+
* @param {Function} func The function to wrap.
|
|
1180
|
+
* @param {Function} transform The argument transform.
|
|
1181
|
+
* @returns {Function} Returns the new function.
|
|
1182
|
+
*/
|
|
1183
|
+
function overArg(func, transform) {
|
|
1184
|
+
return function(arg) {
|
|
1185
|
+
return func(transform(arg));
|
|
1186
|
+
};
|
|
1187
|
+
}
|
|
1188
|
+
|
|
1189
|
+
/* Built-in method references for those with the same name as other `lodash` methods. */
|
|
1190
|
+
var nativeKeys = overArg(Object.keys, Object);
|
|
1191
|
+
|
|
1192
|
+
/** Used for built-in method references. */
|
|
1193
|
+
var objectProto$5 = Object.prototype;
|
|
1194
|
+
|
|
1195
|
+
/** Used to check objects for own properties. */
|
|
1196
|
+
var hasOwnProperty$4 = objectProto$5.hasOwnProperty;
|
|
1197
|
+
|
|
1198
|
+
/**
|
|
1199
|
+
* The base implementation of `_.keys` which doesn't treat sparse arrays as dense.
|
|
1200
|
+
*
|
|
1201
|
+
* @private
|
|
1202
|
+
* @param {Object} object The object to query.
|
|
1203
|
+
* @returns {Array} Returns the array of property names.
|
|
1204
|
+
*/
|
|
1205
|
+
function baseKeys(object) {
|
|
1206
|
+
if (!isPrototype(object)) {
|
|
1207
|
+
return nativeKeys(object);
|
|
1208
|
+
}
|
|
1209
|
+
var result = [];
|
|
1210
|
+
for (var key in Object(object)) {
|
|
1211
|
+
if (hasOwnProperty$4.call(object, key) && key != 'constructor') {
|
|
1212
|
+
result.push(key);
|
|
1213
|
+
}
|
|
1214
|
+
}
|
|
1215
|
+
return result;
|
|
1216
|
+
}
|
|
1217
|
+
|
|
1218
|
+
/**
|
|
1219
|
+
* Creates an array of the own enumerable property names of `object`.
|
|
1220
|
+
*
|
|
1221
|
+
* **Note:** Non-object values are coerced to objects. See the
|
|
1222
|
+
* [ES spec](http://ecma-international.org/ecma-262/7.0/#sec-object.keys)
|
|
1223
|
+
* for more details.
|
|
1224
|
+
*
|
|
1225
|
+
* @static
|
|
1226
|
+
* @since 0.1.0
|
|
1227
|
+
* @memberOf _
|
|
1228
|
+
* @category Object
|
|
1229
|
+
* @param {Object} object The object to query.
|
|
1230
|
+
* @returns {Array} Returns the array of property names.
|
|
1231
|
+
* @example
|
|
1232
|
+
*
|
|
1233
|
+
* function Foo() {
|
|
1234
|
+
* this.a = 1;
|
|
1235
|
+
* this.b = 2;
|
|
1236
|
+
* }
|
|
1237
|
+
*
|
|
1238
|
+
* Foo.prototype.c = 3;
|
|
1239
|
+
*
|
|
1240
|
+
* _.keys(new Foo);
|
|
1241
|
+
* // => ['a', 'b'] (iteration order is not guaranteed)
|
|
1242
|
+
*
|
|
1243
|
+
* _.keys('hi');
|
|
1244
|
+
* // => ['0', '1']
|
|
1245
|
+
*/
|
|
1246
|
+
function keys(object) {
|
|
1247
|
+
return isArrayLike$1(object) ? arrayLikeKeys(object) : baseKeys(object);
|
|
1248
|
+
}
|
|
1249
|
+
|
|
1250
|
+
/* Built-in method references that are verified to be native. */
|
|
1251
|
+
var nativeCreate = getNative(Object, 'create');
|
|
1252
|
+
|
|
1253
|
+
/**
|
|
1254
|
+
* Removes all key-value entries from the hash.
|
|
1255
|
+
*
|
|
1256
|
+
* @private
|
|
1257
|
+
* @name clear
|
|
1258
|
+
* @memberOf Hash
|
|
1259
|
+
*/
|
|
1260
|
+
function hashClear() {
|
|
1261
|
+
this.__data__ = nativeCreate ? nativeCreate(null) : {};
|
|
1262
|
+
this.size = 0;
|
|
1263
|
+
}
|
|
1264
|
+
|
|
1265
|
+
/**
|
|
1266
|
+
* Removes `key` and its value from the hash.
|
|
1267
|
+
*
|
|
1268
|
+
* @private
|
|
1269
|
+
* @name delete
|
|
1270
|
+
* @memberOf Hash
|
|
1271
|
+
* @param {Object} hash The hash to modify.
|
|
1272
|
+
* @param {string} key The key of the value to remove.
|
|
1273
|
+
* @returns {boolean} Returns `true` if the entry was removed, else `false`.
|
|
1274
|
+
*/
|
|
1275
|
+
function hashDelete(key) {
|
|
1276
|
+
var result = this.has(key) && delete this.__data__[key];
|
|
1277
|
+
this.size -= result ? 1 : 0;
|
|
1278
|
+
return result;
|
|
1279
|
+
}
|
|
1280
|
+
|
|
1281
|
+
/** Used to stand-in for `undefined` hash values. */
|
|
1282
|
+
var HASH_UNDEFINED$1 = '__lodash_hash_undefined__';
|
|
1283
|
+
|
|
1284
|
+
/** Used for built-in method references. */
|
|
1285
|
+
var objectProto$4 = Object.prototype;
|
|
1286
|
+
|
|
1287
|
+
/** Used to check objects for own properties. */
|
|
1288
|
+
var hasOwnProperty$3 = objectProto$4.hasOwnProperty;
|
|
1289
|
+
|
|
1290
|
+
/**
|
|
1291
|
+
* Gets the hash value for `key`.
|
|
1292
|
+
*
|
|
1293
|
+
* @private
|
|
1294
|
+
* @name get
|
|
1295
|
+
* @memberOf Hash
|
|
1296
|
+
* @param {string} key The key of the value to get.
|
|
1297
|
+
* @returns {*} Returns the entry value.
|
|
1298
|
+
*/
|
|
1299
|
+
function hashGet(key) {
|
|
1300
|
+
var data = this.__data__;
|
|
1301
|
+
if (nativeCreate) {
|
|
1302
|
+
var result = data[key];
|
|
1303
|
+
return result === HASH_UNDEFINED$1 ? undefined : result;
|
|
1304
|
+
}
|
|
1305
|
+
return hasOwnProperty$3.call(data, key) ? data[key] : undefined;
|
|
1306
|
+
}
|
|
1307
|
+
|
|
1308
|
+
/** Used for built-in method references. */
|
|
1309
|
+
var objectProto$3 = Object.prototype;
|
|
1310
|
+
|
|
1311
|
+
/** Used to check objects for own properties. */
|
|
1312
|
+
var hasOwnProperty$2 = objectProto$3.hasOwnProperty;
|
|
1313
|
+
|
|
1314
|
+
/**
|
|
1315
|
+
* Checks if a hash value for `key` exists.
|
|
1316
|
+
*
|
|
1317
|
+
* @private
|
|
1318
|
+
* @name has
|
|
1319
|
+
* @memberOf Hash
|
|
1320
|
+
* @param {string} key The key of the entry to check.
|
|
1321
|
+
* @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
|
|
1322
|
+
*/
|
|
1323
|
+
function hashHas(key) {
|
|
1324
|
+
var data = this.__data__;
|
|
1325
|
+
return nativeCreate ? (data[key] !== undefined) : hasOwnProperty$2.call(data, key);
|
|
1326
|
+
}
|
|
1327
|
+
|
|
1328
|
+
/** Used to stand-in for `undefined` hash values. */
|
|
1329
|
+
var HASH_UNDEFINED = '__lodash_hash_undefined__';
|
|
1330
|
+
|
|
1331
|
+
/**
|
|
1332
|
+
* Sets the hash `key` to `value`.
|
|
1333
|
+
*
|
|
1334
|
+
* @private
|
|
1335
|
+
* @name set
|
|
1336
|
+
* @memberOf Hash
|
|
1337
|
+
* @param {string} key The key of the value to set.
|
|
1338
|
+
* @param {*} value The value to set.
|
|
1339
|
+
* @returns {Object} Returns the hash instance.
|
|
1340
|
+
*/
|
|
1341
|
+
function hashSet(key, value) {
|
|
1342
|
+
var data = this.__data__;
|
|
1343
|
+
this.size += this.has(key) ? 0 : 1;
|
|
1344
|
+
data[key] = (nativeCreate && value === undefined) ? HASH_UNDEFINED : value;
|
|
1345
|
+
return this;
|
|
1346
|
+
}
|
|
1347
|
+
|
|
1348
|
+
/**
|
|
1349
|
+
* Creates a hash object.
|
|
1350
|
+
*
|
|
1351
|
+
* @private
|
|
1352
|
+
* @constructor
|
|
1353
|
+
* @param {Array} [entries] The key-value pairs to cache.
|
|
1354
|
+
*/
|
|
1355
|
+
function Hash(entries) {
|
|
1356
|
+
var index = -1,
|
|
1357
|
+
length = entries == null ? 0 : entries.length;
|
|
1358
|
+
|
|
1359
|
+
this.clear();
|
|
1360
|
+
while (++index < length) {
|
|
1361
|
+
var entry = entries[index];
|
|
1362
|
+
this.set(entry[0], entry[1]);
|
|
1363
|
+
}
|
|
1364
|
+
}
|
|
1365
|
+
|
|
1366
|
+
// Add methods to `Hash`.
|
|
1367
|
+
Hash.prototype.clear = hashClear;
|
|
1368
|
+
Hash.prototype['delete'] = hashDelete;
|
|
1369
|
+
Hash.prototype.get = hashGet;
|
|
1370
|
+
Hash.prototype.has = hashHas;
|
|
1371
|
+
Hash.prototype.set = hashSet;
|
|
1372
|
+
|
|
1373
|
+
/**
|
|
1374
|
+
* Removes all key-value entries from the list cache.
|
|
1375
|
+
*
|
|
1376
|
+
* @private
|
|
1377
|
+
* @name clear
|
|
1378
|
+
* @memberOf ListCache
|
|
1379
|
+
*/
|
|
1380
|
+
function listCacheClear() {
|
|
1381
|
+
this.__data__ = [];
|
|
1382
|
+
this.size = 0;
|
|
1383
|
+
}
|
|
1384
|
+
|
|
1385
|
+
/**
|
|
1386
|
+
* Gets the index at which the `key` is found in `array` of key-value pairs.
|
|
1387
|
+
*
|
|
1388
|
+
* @private
|
|
1389
|
+
* @param {Array} array The array to inspect.
|
|
1390
|
+
* @param {*} key The key to search for.
|
|
1391
|
+
* @returns {number} Returns the index of the matched value, else `-1`.
|
|
1392
|
+
*/
|
|
1393
|
+
function assocIndexOf(array, key) {
|
|
1394
|
+
var length = array.length;
|
|
1395
|
+
while (length--) {
|
|
1396
|
+
if (eq(array[length][0], key)) {
|
|
1397
|
+
return length;
|
|
1398
|
+
}
|
|
1399
|
+
}
|
|
1400
|
+
return -1;
|
|
1401
|
+
}
|
|
1402
|
+
|
|
1403
|
+
/** Used for built-in method references. */
|
|
1404
|
+
var arrayProto = Array.prototype;
|
|
1405
|
+
|
|
1406
|
+
/** Built-in value references. */
|
|
1407
|
+
var splice = arrayProto.splice;
|
|
1408
|
+
|
|
1409
|
+
/**
|
|
1410
|
+
* Removes `key` and its value from the list cache.
|
|
1411
|
+
*
|
|
1412
|
+
* @private
|
|
1413
|
+
* @name delete
|
|
1414
|
+
* @memberOf ListCache
|
|
1415
|
+
* @param {string} key The key of the value to remove.
|
|
1416
|
+
* @returns {boolean} Returns `true` if the entry was removed, else `false`.
|
|
1417
|
+
*/
|
|
1418
|
+
function listCacheDelete(key) {
|
|
1419
|
+
var data = this.__data__,
|
|
1420
|
+
index = assocIndexOf(data, key);
|
|
1421
|
+
|
|
1422
|
+
if (index < 0) {
|
|
1423
|
+
return false;
|
|
1424
|
+
}
|
|
1425
|
+
var lastIndex = data.length - 1;
|
|
1426
|
+
if (index == lastIndex) {
|
|
1427
|
+
data.pop();
|
|
1428
|
+
} else {
|
|
1429
|
+
splice.call(data, index, 1);
|
|
1430
|
+
}
|
|
1431
|
+
--this.size;
|
|
1432
|
+
return true;
|
|
1433
|
+
}
|
|
1434
|
+
|
|
1435
|
+
/**
|
|
1436
|
+
* Gets the list cache value for `key`.
|
|
1437
|
+
*
|
|
1438
|
+
* @private
|
|
1439
|
+
* @name get
|
|
1440
|
+
* @memberOf ListCache
|
|
1441
|
+
* @param {string} key The key of the value to get.
|
|
1442
|
+
* @returns {*} Returns the entry value.
|
|
1443
|
+
*/
|
|
1444
|
+
function listCacheGet(key) {
|
|
1445
|
+
var data = this.__data__,
|
|
1446
|
+
index = assocIndexOf(data, key);
|
|
1447
|
+
|
|
1448
|
+
return index < 0 ? undefined : data[index][1];
|
|
1449
|
+
}
|
|
1450
|
+
|
|
1451
|
+
/**
|
|
1452
|
+
* Checks if a list cache value for `key` exists.
|
|
1453
|
+
*
|
|
1454
|
+
* @private
|
|
1455
|
+
* @name has
|
|
1456
|
+
* @memberOf ListCache
|
|
1457
|
+
* @param {string} key The key of the entry to check.
|
|
1458
|
+
* @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
|
|
1459
|
+
*/
|
|
1460
|
+
function listCacheHas(key) {
|
|
1461
|
+
return assocIndexOf(this.__data__, key) > -1;
|
|
1462
|
+
}
|
|
1463
|
+
|
|
1464
|
+
/**
|
|
1465
|
+
* Sets the list cache `key` to `value`.
|
|
1466
|
+
*
|
|
1467
|
+
* @private
|
|
1468
|
+
* @name set
|
|
1469
|
+
* @memberOf ListCache
|
|
1470
|
+
* @param {string} key The key of the value to set.
|
|
1471
|
+
* @param {*} value The value to set.
|
|
1472
|
+
* @returns {Object} Returns the list cache instance.
|
|
1473
|
+
*/
|
|
1474
|
+
function listCacheSet(key, value) {
|
|
1475
|
+
var data = this.__data__,
|
|
1476
|
+
index = assocIndexOf(data, key);
|
|
1477
|
+
|
|
1478
|
+
if (index < 0) {
|
|
1479
|
+
++this.size;
|
|
1480
|
+
data.push([key, value]);
|
|
1481
|
+
} else {
|
|
1482
|
+
data[index][1] = value;
|
|
1483
|
+
}
|
|
1484
|
+
return this;
|
|
1485
|
+
}
|
|
1486
|
+
|
|
1487
|
+
/**
|
|
1488
|
+
* Creates an list cache object.
|
|
1489
|
+
*
|
|
1490
|
+
* @private
|
|
1491
|
+
* @constructor
|
|
1492
|
+
* @param {Array} [entries] The key-value pairs to cache.
|
|
1493
|
+
*/
|
|
1494
|
+
function ListCache(entries) {
|
|
1495
|
+
var index = -1,
|
|
1496
|
+
length = entries == null ? 0 : entries.length;
|
|
1497
|
+
|
|
1498
|
+
this.clear();
|
|
1499
|
+
while (++index < length) {
|
|
1500
|
+
var entry = entries[index];
|
|
1501
|
+
this.set(entry[0], entry[1]);
|
|
1502
|
+
}
|
|
1503
|
+
}
|
|
1504
|
+
|
|
1505
|
+
// Add methods to `ListCache`.
|
|
1506
|
+
ListCache.prototype.clear = listCacheClear;
|
|
1507
|
+
ListCache.prototype['delete'] = listCacheDelete;
|
|
1508
|
+
ListCache.prototype.get = listCacheGet;
|
|
1509
|
+
ListCache.prototype.has = listCacheHas;
|
|
1510
|
+
ListCache.prototype.set = listCacheSet;
|
|
1511
|
+
|
|
1512
|
+
/* Built-in method references that are verified to be native. */
|
|
1513
|
+
var Map$1 = getNative(root, 'Map');
|
|
1514
|
+
|
|
1515
|
+
/**
|
|
1516
|
+
* Removes all key-value entries from the map.
|
|
1517
|
+
*
|
|
1518
|
+
* @private
|
|
1519
|
+
* @name clear
|
|
1520
|
+
* @memberOf MapCache
|
|
1521
|
+
*/
|
|
1522
|
+
function mapCacheClear() {
|
|
1523
|
+
this.size = 0;
|
|
1524
|
+
this.__data__ = {
|
|
1525
|
+
'hash': new Hash,
|
|
1526
|
+
'map': new (Map$1 || ListCache),
|
|
1527
|
+
'string': new Hash
|
|
1528
|
+
};
|
|
1529
|
+
}
|
|
1530
|
+
|
|
1531
|
+
/**
|
|
1532
|
+
* Checks if `value` is suitable for use as unique object key.
|
|
1533
|
+
*
|
|
1534
|
+
* @private
|
|
1535
|
+
* @param {*} value The value to check.
|
|
1536
|
+
* @returns {boolean} Returns `true` if `value` is suitable, else `false`.
|
|
1537
|
+
*/
|
|
1538
|
+
function isKeyable(value) {
|
|
1539
|
+
var type = typeof value;
|
|
1540
|
+
return (type == 'string' || type == 'number' || type == 'symbol' || type == 'boolean')
|
|
1541
|
+
? (value !== '__proto__')
|
|
1542
|
+
: (value === null);
|
|
1543
|
+
}
|
|
1544
|
+
|
|
1545
|
+
/**
|
|
1546
|
+
* Gets the data for `map`.
|
|
1547
|
+
*
|
|
1548
|
+
* @private
|
|
1549
|
+
* @param {Object} map The map to query.
|
|
1550
|
+
* @param {string} key The reference key.
|
|
1551
|
+
* @returns {*} Returns the map data.
|
|
1552
|
+
*/
|
|
1553
|
+
function getMapData(map, key) {
|
|
1554
|
+
var data = map.__data__;
|
|
1555
|
+
return isKeyable(key)
|
|
1556
|
+
? data[typeof key == 'string' ? 'string' : 'hash']
|
|
1557
|
+
: data.map;
|
|
1558
|
+
}
|
|
1559
|
+
|
|
1560
|
+
/**
|
|
1561
|
+
* Removes `key` and its value from the map.
|
|
1562
|
+
*
|
|
1563
|
+
* @private
|
|
1564
|
+
* @name delete
|
|
1565
|
+
* @memberOf MapCache
|
|
1566
|
+
* @param {string} key The key of the value to remove.
|
|
1567
|
+
* @returns {boolean} Returns `true` if the entry was removed, else `false`.
|
|
1568
|
+
*/
|
|
1569
|
+
function mapCacheDelete(key) {
|
|
1570
|
+
var result = getMapData(this, key)['delete'](key);
|
|
1571
|
+
this.size -= result ? 1 : 0;
|
|
1572
|
+
return result;
|
|
1573
|
+
}
|
|
1574
|
+
|
|
1575
|
+
/**
|
|
1576
|
+
* Gets the map value for `key`.
|
|
1577
|
+
*
|
|
1578
|
+
* @private
|
|
1579
|
+
* @name get
|
|
1580
|
+
* @memberOf MapCache
|
|
1581
|
+
* @param {string} key The key of the value to get.
|
|
1582
|
+
* @returns {*} Returns the entry value.
|
|
1583
|
+
*/
|
|
1584
|
+
function mapCacheGet(key) {
|
|
1585
|
+
return getMapData(this, key).get(key);
|
|
1586
|
+
}
|
|
1587
|
+
|
|
1588
|
+
/**
|
|
1589
|
+
* Checks if a map value for `key` exists.
|
|
1590
|
+
*
|
|
1591
|
+
* @private
|
|
1592
|
+
* @name has
|
|
1593
|
+
* @memberOf MapCache
|
|
1594
|
+
* @param {string} key The key of the entry to check.
|
|
1595
|
+
* @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
|
|
1596
|
+
*/
|
|
1597
|
+
function mapCacheHas(key) {
|
|
1598
|
+
return getMapData(this, key).has(key);
|
|
1599
|
+
}
|
|
1600
|
+
|
|
1601
|
+
/**
|
|
1602
|
+
* Sets the map `key` to `value`.
|
|
1603
|
+
*
|
|
1604
|
+
* @private
|
|
1605
|
+
* @name set
|
|
1606
|
+
* @memberOf MapCache
|
|
1607
|
+
* @param {string} key The key of the value to set.
|
|
1608
|
+
* @param {*} value The value to set.
|
|
1609
|
+
* @returns {Object} Returns the map cache instance.
|
|
1610
|
+
*/
|
|
1611
|
+
function mapCacheSet(key, value) {
|
|
1612
|
+
var data = getMapData(this, key),
|
|
1613
|
+
size = data.size;
|
|
1614
|
+
|
|
1615
|
+
data.set(key, value);
|
|
1616
|
+
this.size += data.size == size ? 0 : 1;
|
|
1617
|
+
return this;
|
|
1618
|
+
}
|
|
1619
|
+
|
|
1620
|
+
/**
|
|
1621
|
+
* Creates a map cache object to store key-value pairs.
|
|
1622
|
+
*
|
|
1623
|
+
* @private
|
|
1624
|
+
* @constructor
|
|
1625
|
+
* @param {Array} [entries] The key-value pairs to cache.
|
|
1626
|
+
*/
|
|
1627
|
+
function MapCache(entries) {
|
|
1628
|
+
var index = -1,
|
|
1629
|
+
length = entries == null ? 0 : entries.length;
|
|
1630
|
+
|
|
1631
|
+
this.clear();
|
|
1632
|
+
while (++index < length) {
|
|
1633
|
+
var entry = entries[index];
|
|
1634
|
+
this.set(entry[0], entry[1]);
|
|
1635
|
+
}
|
|
1636
|
+
}
|
|
1637
|
+
|
|
1638
|
+
// Add methods to `MapCache`.
|
|
1639
|
+
MapCache.prototype.clear = mapCacheClear;
|
|
1640
|
+
MapCache.prototype['delete'] = mapCacheDelete;
|
|
1641
|
+
MapCache.prototype.get = mapCacheGet;
|
|
1642
|
+
MapCache.prototype.has = mapCacheHas;
|
|
1643
|
+
MapCache.prototype.set = mapCacheSet;
|
|
1644
|
+
|
|
1645
|
+
/**
|
|
1646
|
+
* Appends the elements of `values` to `array`.
|
|
1647
|
+
*
|
|
1648
|
+
* @private
|
|
1649
|
+
* @param {Array} array The array to modify.
|
|
1650
|
+
* @param {Array} values The values to append.
|
|
1651
|
+
* @returns {Array} Returns `array`.
|
|
1652
|
+
*/
|
|
1653
|
+
function arrayPush(array, values) {
|
|
1654
|
+
var index = -1,
|
|
1655
|
+
length = values.length,
|
|
1656
|
+
offset = array.length;
|
|
1657
|
+
|
|
1658
|
+
while (++index < length) {
|
|
1659
|
+
array[offset + index] = values[index];
|
|
1660
|
+
}
|
|
1661
|
+
return array;
|
|
1662
|
+
}
|
|
1663
|
+
|
|
1664
|
+
/** Built-in value references. */
|
|
1665
|
+
var getPrototype = overArg(Object.getPrototypeOf, Object);
|
|
1666
|
+
|
|
1667
|
+
/** `Object#toString` result references. */
|
|
1668
|
+
var objectTag$2 = '[object Object]';
|
|
1669
|
+
|
|
1670
|
+
/** Used for built-in method references. */
|
|
1671
|
+
var funcProto = Function.prototype,
|
|
1672
|
+
objectProto$2 = Object.prototype;
|
|
1673
|
+
|
|
1674
|
+
/** Used to resolve the decompiled source of functions. */
|
|
1675
|
+
var funcToString = funcProto.toString;
|
|
1676
|
+
|
|
1677
|
+
/** Used to check objects for own properties. */
|
|
1678
|
+
var hasOwnProperty$1 = objectProto$2.hasOwnProperty;
|
|
1679
|
+
|
|
1680
|
+
/** Used to infer the `Object` constructor. */
|
|
1681
|
+
var objectCtorString = funcToString.call(Object);
|
|
1682
|
+
|
|
1683
|
+
/**
|
|
1684
|
+
* Checks if `value` is a plain object, that is, an object created by the
|
|
1685
|
+
* `Object` constructor or one with a `[[Prototype]]` of `null`.
|
|
1686
|
+
*
|
|
1687
|
+
* @static
|
|
1688
|
+
* @memberOf _
|
|
1689
|
+
* @since 0.8.0
|
|
1690
|
+
* @category Lang
|
|
1691
|
+
* @param {*} value The value to check.
|
|
1692
|
+
* @returns {boolean} Returns `true` if `value` is a plain object, else `false`.
|
|
1693
|
+
* @example
|
|
1694
|
+
*
|
|
1695
|
+
* function Foo() {
|
|
1696
|
+
* this.a = 1;
|
|
1697
|
+
* }
|
|
1698
|
+
*
|
|
1699
|
+
* _.isPlainObject(new Foo);
|
|
1700
|
+
* // => false
|
|
1701
|
+
*
|
|
1702
|
+
* _.isPlainObject([1, 2, 3]);
|
|
1703
|
+
* // => false
|
|
1704
|
+
*
|
|
1705
|
+
* _.isPlainObject({ 'x': 0, 'y': 0 });
|
|
1706
|
+
* // => true
|
|
1707
|
+
*
|
|
1708
|
+
* _.isPlainObject(Object.create(null));
|
|
1709
|
+
* // => true
|
|
1710
|
+
*/
|
|
1711
|
+
function isPlainObject(value) {
|
|
1712
|
+
if (!isObjectLike(value) || baseGetTag(value) != objectTag$2) {
|
|
1713
|
+
return false;
|
|
1714
|
+
}
|
|
1715
|
+
var proto = getPrototype(value);
|
|
1716
|
+
if (proto === null) {
|
|
1717
|
+
return true;
|
|
1718
|
+
}
|
|
1719
|
+
var Ctor = hasOwnProperty$1.call(proto, 'constructor') && proto.constructor;
|
|
1720
|
+
return typeof Ctor == 'function' && Ctor instanceof Ctor &&
|
|
1721
|
+
funcToString.call(Ctor) == objectCtorString;
|
|
1722
|
+
}
|
|
1723
|
+
|
|
1724
|
+
/**
|
|
1725
|
+
* Removes all key-value entries from the stack.
|
|
1726
|
+
*
|
|
1727
|
+
* @private
|
|
1728
|
+
* @name clear
|
|
1729
|
+
* @memberOf Stack
|
|
1730
|
+
*/
|
|
1731
|
+
function stackClear() {
|
|
1732
|
+
this.__data__ = new ListCache;
|
|
1733
|
+
this.size = 0;
|
|
1734
|
+
}
|
|
1735
|
+
|
|
1736
|
+
/**
|
|
1737
|
+
* Removes `key` and its value from the stack.
|
|
1738
|
+
*
|
|
1739
|
+
* @private
|
|
1740
|
+
* @name delete
|
|
1741
|
+
* @memberOf Stack
|
|
1742
|
+
* @param {string} key The key of the value to remove.
|
|
1743
|
+
* @returns {boolean} Returns `true` if the entry was removed, else `false`.
|
|
1744
|
+
*/
|
|
1745
|
+
function stackDelete(key) {
|
|
1746
|
+
var data = this.__data__,
|
|
1747
|
+
result = data['delete'](key);
|
|
1748
|
+
|
|
1749
|
+
this.size = data.size;
|
|
1750
|
+
return result;
|
|
1751
|
+
}
|
|
1752
|
+
|
|
1753
|
+
/**
|
|
1754
|
+
* Gets the stack value for `key`.
|
|
1755
|
+
*
|
|
1756
|
+
* @private
|
|
1757
|
+
* @name get
|
|
1758
|
+
* @memberOf Stack
|
|
1759
|
+
* @param {string} key The key of the value to get.
|
|
1760
|
+
* @returns {*} Returns the entry value.
|
|
1761
|
+
*/
|
|
1762
|
+
function stackGet(key) {
|
|
1763
|
+
return this.__data__.get(key);
|
|
1764
|
+
}
|
|
1765
|
+
|
|
1766
|
+
/**
|
|
1767
|
+
* Checks if a stack value for `key` exists.
|
|
1768
|
+
*
|
|
1769
|
+
* @private
|
|
1770
|
+
* @name has
|
|
1771
|
+
* @memberOf Stack
|
|
1772
|
+
* @param {string} key The key of the entry to check.
|
|
1773
|
+
* @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
|
|
1774
|
+
*/
|
|
1775
|
+
function stackHas(key) {
|
|
1776
|
+
return this.__data__.has(key);
|
|
1777
|
+
}
|
|
1778
|
+
|
|
1779
|
+
/** Used as the size to enable large array optimizations. */
|
|
1780
|
+
var LARGE_ARRAY_SIZE = 200;
|
|
1781
|
+
|
|
1782
|
+
/**
|
|
1783
|
+
* Sets the stack `key` to `value`.
|
|
1784
|
+
*
|
|
1785
|
+
* @private
|
|
1786
|
+
* @name set
|
|
1787
|
+
* @memberOf Stack
|
|
1788
|
+
* @param {string} key The key of the value to set.
|
|
1789
|
+
* @param {*} value The value to set.
|
|
1790
|
+
* @returns {Object} Returns the stack cache instance.
|
|
1791
|
+
*/
|
|
1792
|
+
function stackSet(key, value) {
|
|
1793
|
+
var data = this.__data__;
|
|
1794
|
+
if (data instanceof ListCache) {
|
|
1795
|
+
var pairs = data.__data__;
|
|
1796
|
+
if (!Map$1 || (pairs.length < LARGE_ARRAY_SIZE - 1)) {
|
|
1797
|
+
pairs.push([key, value]);
|
|
1798
|
+
this.size = ++data.size;
|
|
1799
|
+
return this;
|
|
1800
|
+
}
|
|
1801
|
+
data = this.__data__ = new MapCache(pairs);
|
|
1802
|
+
}
|
|
1803
|
+
data.set(key, value);
|
|
1804
|
+
this.size = data.size;
|
|
1805
|
+
return this;
|
|
1806
|
+
}
|
|
1807
|
+
|
|
1808
|
+
/**
|
|
1809
|
+
* Creates a stack cache object to store key-value pairs.
|
|
1810
|
+
*
|
|
1811
|
+
* @private
|
|
1812
|
+
* @constructor
|
|
1813
|
+
* @param {Array} [entries] The key-value pairs to cache.
|
|
1814
|
+
*/
|
|
1815
|
+
function Stack(entries) {
|
|
1816
|
+
var data = this.__data__ = new ListCache(entries);
|
|
1817
|
+
this.size = data.size;
|
|
1818
|
+
}
|
|
1819
|
+
|
|
1820
|
+
// Add methods to `Stack`.
|
|
1821
|
+
Stack.prototype.clear = stackClear;
|
|
1822
|
+
Stack.prototype['delete'] = stackDelete;
|
|
1823
|
+
Stack.prototype.get = stackGet;
|
|
1824
|
+
Stack.prototype.has = stackHas;
|
|
1825
|
+
Stack.prototype.set = stackSet;
|
|
1826
|
+
|
|
1827
|
+
/** Detect free variable `exports`. */
|
|
1828
|
+
var freeExports = typeof exports == 'object' && exports && !exports.nodeType && exports;
|
|
1829
|
+
|
|
1830
|
+
/** Detect free variable `module`. */
|
|
1831
|
+
var freeModule = freeExports && typeof module == 'object' && module && !module.nodeType && module;
|
|
1832
|
+
|
|
1833
|
+
/** Detect the popular CommonJS extension `module.exports`. */
|
|
1834
|
+
var moduleExports = freeModule && freeModule.exports === freeExports;
|
|
1835
|
+
|
|
1836
|
+
/** Built-in value references. */
|
|
1837
|
+
var Buffer$1 = moduleExports ? root.Buffer : undefined;
|
|
1838
|
+
Buffer$1 ? Buffer$1.allocUnsafe : undefined;
|
|
1839
|
+
|
|
1840
|
+
/**
|
|
1841
|
+
* Creates a clone of `buffer`.
|
|
1842
|
+
*
|
|
1843
|
+
* @private
|
|
1844
|
+
* @param {Buffer} buffer The buffer to clone.
|
|
1845
|
+
* @param {boolean} [isDeep] Specify a deep clone.
|
|
1846
|
+
* @returns {Buffer} Returns the cloned buffer.
|
|
1847
|
+
*/
|
|
1848
|
+
function cloneBuffer(buffer, isDeep) {
|
|
1849
|
+
{
|
|
1850
|
+
return buffer.slice();
|
|
1851
|
+
}
|
|
1852
|
+
}
|
|
1853
|
+
|
|
1854
|
+
/**
|
|
1855
|
+
* A specialized version of `_.filter` for arrays without support for
|
|
1856
|
+
* iteratee shorthands.
|
|
1857
|
+
*
|
|
1858
|
+
* @private
|
|
1859
|
+
* @param {Array} [array] The array to iterate over.
|
|
1860
|
+
* @param {Function} predicate The function invoked per iteration.
|
|
1861
|
+
* @returns {Array} Returns the new filtered array.
|
|
1862
|
+
*/
|
|
1863
|
+
function arrayFilter(array, predicate) {
|
|
1864
|
+
var index = -1,
|
|
1865
|
+
length = array == null ? 0 : array.length,
|
|
1866
|
+
resIndex = 0,
|
|
1867
|
+
result = [];
|
|
1868
|
+
|
|
1869
|
+
while (++index < length) {
|
|
1870
|
+
var value = array[index];
|
|
1871
|
+
if (predicate(value, index, array)) {
|
|
1872
|
+
result[resIndex++] = value;
|
|
1873
|
+
}
|
|
1874
|
+
}
|
|
1875
|
+
return result;
|
|
1876
|
+
}
|
|
1877
|
+
|
|
1878
|
+
/**
|
|
1879
|
+
* This method returns a new empty array.
|
|
1880
|
+
*
|
|
1881
|
+
* @static
|
|
1882
|
+
* @memberOf _
|
|
1883
|
+
* @since 4.13.0
|
|
1884
|
+
* @category Util
|
|
1885
|
+
* @returns {Array} Returns the new empty array.
|
|
1886
|
+
* @example
|
|
1887
|
+
*
|
|
1888
|
+
* var arrays = _.times(2, _.stubArray);
|
|
1889
|
+
*
|
|
1890
|
+
* console.log(arrays);
|
|
1891
|
+
* // => [[], []]
|
|
1892
|
+
*
|
|
1893
|
+
* console.log(arrays[0] === arrays[1]);
|
|
1894
|
+
* // => false
|
|
1895
|
+
*/
|
|
1896
|
+
function stubArray() {
|
|
1897
|
+
return [];
|
|
1898
|
+
}
|
|
1899
|
+
|
|
1900
|
+
/** Used for built-in method references. */
|
|
1901
|
+
var objectProto$1 = Object.prototype;
|
|
1902
|
+
|
|
1903
|
+
/** Built-in value references. */
|
|
1904
|
+
var propertyIsEnumerable = objectProto$1.propertyIsEnumerable;
|
|
1905
|
+
|
|
1906
|
+
/* Built-in method references for those with the same name as other `lodash` methods. */
|
|
1907
|
+
var nativeGetSymbols = Object.getOwnPropertySymbols;
|
|
1908
|
+
|
|
1909
|
+
/**
|
|
1910
|
+
* Creates an array of the own enumerable symbols of `object`.
|
|
1911
|
+
*
|
|
1912
|
+
* @private
|
|
1913
|
+
* @param {Object} object The object to query.
|
|
1914
|
+
* @returns {Array} Returns the array of symbols.
|
|
1915
|
+
*/
|
|
1916
|
+
var getSymbols = !nativeGetSymbols ? stubArray : function(object) {
|
|
1917
|
+
if (object == null) {
|
|
1918
|
+
return [];
|
|
1919
|
+
}
|
|
1920
|
+
object = Object(object);
|
|
1921
|
+
return arrayFilter(nativeGetSymbols(object), function(symbol) {
|
|
1922
|
+
return propertyIsEnumerable.call(object, symbol);
|
|
1923
|
+
});
|
|
1924
|
+
};
|
|
1925
|
+
|
|
1926
|
+
/**
|
|
1927
|
+
* The base implementation of `getAllKeys` and `getAllKeysIn` which uses
|
|
1928
|
+
* `keysFunc` and `symbolsFunc` to get the enumerable property names and
|
|
1929
|
+
* symbols of `object`.
|
|
1930
|
+
*
|
|
1931
|
+
* @private
|
|
1932
|
+
* @param {Object} object The object to query.
|
|
1933
|
+
* @param {Function} keysFunc The function to get the keys of `object`.
|
|
1934
|
+
* @param {Function} symbolsFunc The function to get the symbols of `object`.
|
|
1935
|
+
* @returns {Array} Returns the array of property names and symbols.
|
|
1936
|
+
*/
|
|
1937
|
+
function baseGetAllKeys(object, keysFunc, symbolsFunc) {
|
|
1938
|
+
var result = keysFunc(object);
|
|
1939
|
+
return isArray(object) ? result : arrayPush(result, symbolsFunc(object));
|
|
1940
|
+
}
|
|
1941
|
+
|
|
1942
|
+
/**
|
|
1943
|
+
* Creates an array of own enumerable property names and symbols of `object`.
|
|
1944
|
+
*
|
|
1945
|
+
* @private
|
|
1946
|
+
* @param {Object} object The object to query.
|
|
1947
|
+
* @returns {Array} Returns the array of property names and symbols.
|
|
1948
|
+
*/
|
|
1949
|
+
function getAllKeys(object) {
|
|
1950
|
+
return baseGetAllKeys(object, keys, getSymbols);
|
|
1951
|
+
}
|
|
1952
|
+
|
|
1953
|
+
/* Built-in method references that are verified to be native. */
|
|
1954
|
+
var DataView = getNative(root, 'DataView');
|
|
1955
|
+
|
|
1956
|
+
/* Built-in method references that are verified to be native. */
|
|
1957
|
+
var Promise$1 = getNative(root, 'Promise');
|
|
1958
|
+
|
|
1959
|
+
/* Built-in method references that are verified to be native. */
|
|
1960
|
+
var Set$1 = getNative(root, 'Set');
|
|
1961
|
+
|
|
1962
|
+
/** `Object#toString` result references. */
|
|
1963
|
+
var mapTag$3 = '[object Map]',
|
|
1964
|
+
objectTag$1 = '[object Object]',
|
|
1965
|
+
promiseTag = '[object Promise]',
|
|
1966
|
+
setTag$3 = '[object Set]',
|
|
1967
|
+
weakMapTag$1 = '[object WeakMap]';
|
|
1968
|
+
|
|
1969
|
+
var dataViewTag$2 = '[object DataView]';
|
|
1970
|
+
|
|
1971
|
+
/** Used to detect maps, sets, and weakmaps. */
|
|
1972
|
+
var dataViewCtorString = toSource(DataView),
|
|
1973
|
+
mapCtorString = toSource(Map$1),
|
|
1974
|
+
promiseCtorString = toSource(Promise$1),
|
|
1975
|
+
setCtorString = toSource(Set$1),
|
|
1976
|
+
weakMapCtorString = toSource(WeakMap);
|
|
1977
|
+
|
|
1978
|
+
/**
|
|
1979
|
+
* Gets the `toStringTag` of `value`.
|
|
1980
|
+
*
|
|
1981
|
+
* @private
|
|
1982
|
+
* @param {*} value The value to query.
|
|
1983
|
+
* @returns {string} Returns the `toStringTag`.
|
|
1984
|
+
*/
|
|
1985
|
+
var getTag = baseGetTag;
|
|
1986
|
+
|
|
1987
|
+
// Fallback for data views, maps, sets, and weak maps in IE 11 and promises in Node.js < 6.
|
|
1988
|
+
if ((DataView && getTag(new DataView(new ArrayBuffer(1))) != dataViewTag$2) ||
|
|
1989
|
+
(Map$1 && getTag(new Map$1) != mapTag$3) ||
|
|
1990
|
+
(Promise$1 && getTag(Promise$1.resolve()) != promiseTag) ||
|
|
1991
|
+
(Set$1 && getTag(new Set$1) != setTag$3) ||
|
|
1992
|
+
(WeakMap && getTag(new WeakMap) != weakMapTag$1)) {
|
|
1993
|
+
getTag = function(value) {
|
|
1994
|
+
var result = baseGetTag(value),
|
|
1995
|
+
Ctor = result == objectTag$1 ? value.constructor : undefined,
|
|
1996
|
+
ctorString = Ctor ? toSource(Ctor) : '';
|
|
1997
|
+
|
|
1998
|
+
if (ctorString) {
|
|
1999
|
+
switch (ctorString) {
|
|
2000
|
+
case dataViewCtorString: return dataViewTag$2;
|
|
2001
|
+
case mapCtorString: return mapTag$3;
|
|
2002
|
+
case promiseCtorString: return promiseTag;
|
|
2003
|
+
case setCtorString: return setTag$3;
|
|
2004
|
+
case weakMapCtorString: return weakMapTag$1;
|
|
2005
|
+
}
|
|
2006
|
+
}
|
|
2007
|
+
return result;
|
|
2008
|
+
};
|
|
2009
|
+
}
|
|
2010
|
+
|
|
2011
|
+
/** Used for built-in method references. */
|
|
2012
|
+
var objectProto = Object.prototype;
|
|
2013
|
+
|
|
2014
|
+
/** Used to check objects for own properties. */
|
|
2015
|
+
var hasOwnProperty = objectProto.hasOwnProperty;
|
|
2016
|
+
|
|
2017
|
+
/**
|
|
2018
|
+
* Initializes an array clone.
|
|
2019
|
+
*
|
|
2020
|
+
* @private
|
|
2021
|
+
* @param {Array} array The array to clone.
|
|
2022
|
+
* @returns {Array} Returns the initialized clone.
|
|
2023
|
+
*/
|
|
2024
|
+
function initCloneArray(array) {
|
|
2025
|
+
var length = array.length,
|
|
2026
|
+
result = new array.constructor(length);
|
|
2027
|
+
|
|
2028
|
+
// Add properties assigned by `RegExp#exec`.
|
|
2029
|
+
if (length && typeof array[0] == 'string' && hasOwnProperty.call(array, 'index')) {
|
|
2030
|
+
result.index = array.index;
|
|
2031
|
+
result.input = array.input;
|
|
2032
|
+
}
|
|
2033
|
+
return result;
|
|
2034
|
+
}
|
|
2035
|
+
|
|
2036
|
+
/** Built-in value references. */
|
|
2037
|
+
var Uint8Array = root.Uint8Array;
|
|
2038
|
+
|
|
2039
|
+
/**
|
|
2040
|
+
* Creates a clone of `arrayBuffer`.
|
|
2041
|
+
*
|
|
2042
|
+
* @private
|
|
2043
|
+
* @param {ArrayBuffer} arrayBuffer The array buffer to clone.
|
|
2044
|
+
* @returns {ArrayBuffer} Returns the cloned array buffer.
|
|
2045
|
+
*/
|
|
2046
|
+
function cloneArrayBuffer(arrayBuffer) {
|
|
2047
|
+
var result = new arrayBuffer.constructor(arrayBuffer.byteLength);
|
|
2048
|
+
new Uint8Array(result).set(new Uint8Array(arrayBuffer));
|
|
2049
|
+
return result;
|
|
2050
|
+
}
|
|
2051
|
+
|
|
2052
|
+
/**
|
|
2053
|
+
* Creates a clone of `dataView`.
|
|
2054
|
+
*
|
|
2055
|
+
* @private
|
|
2056
|
+
* @param {Object} dataView The data view to clone.
|
|
2057
|
+
* @param {boolean} [isDeep] Specify a deep clone.
|
|
2058
|
+
* @returns {Object} Returns the cloned data view.
|
|
2059
|
+
*/
|
|
2060
|
+
function cloneDataView(dataView, isDeep) {
|
|
2061
|
+
var buffer = cloneArrayBuffer(dataView.buffer) ;
|
|
2062
|
+
return new dataView.constructor(buffer, dataView.byteOffset, dataView.byteLength);
|
|
2063
|
+
}
|
|
2064
|
+
|
|
2065
|
+
/** Used to match `RegExp` flags from their coerced string values. */
|
|
2066
|
+
var reFlags = /\w*$/;
|
|
2067
|
+
|
|
2068
|
+
/**
|
|
2069
|
+
* Creates a clone of `regexp`.
|
|
2070
|
+
*
|
|
2071
|
+
* @private
|
|
2072
|
+
* @param {Object} regexp The regexp to clone.
|
|
2073
|
+
* @returns {Object} Returns the cloned regexp.
|
|
2074
|
+
*/
|
|
2075
|
+
function cloneRegExp(regexp) {
|
|
2076
|
+
var result = new regexp.constructor(regexp.source, reFlags.exec(regexp));
|
|
2077
|
+
result.lastIndex = regexp.lastIndex;
|
|
2078
|
+
return result;
|
|
2079
|
+
}
|
|
2080
|
+
|
|
2081
|
+
/** Used to convert symbols to primitives and strings. */
|
|
2082
|
+
var symbolProto = Symbol$1 ? Symbol$1.prototype : undefined,
|
|
2083
|
+
symbolValueOf = symbolProto ? symbolProto.valueOf : undefined;
|
|
2084
|
+
|
|
2085
|
+
/**
|
|
2086
|
+
* Creates a clone of the `symbol` object.
|
|
2087
|
+
*
|
|
2088
|
+
* @private
|
|
2089
|
+
* @param {Object} symbol The symbol object to clone.
|
|
2090
|
+
* @returns {Object} Returns the cloned symbol object.
|
|
2091
|
+
*/
|
|
2092
|
+
function cloneSymbol(symbol) {
|
|
2093
|
+
return symbolValueOf ? Object(symbolValueOf.call(symbol)) : {};
|
|
2094
|
+
}
|
|
2095
|
+
|
|
2096
|
+
/**
|
|
2097
|
+
* Creates a clone of `typedArray`.
|
|
2098
|
+
*
|
|
2099
|
+
* @private
|
|
2100
|
+
* @param {Object} typedArray The typed array to clone.
|
|
2101
|
+
* @param {boolean} [isDeep] Specify a deep clone.
|
|
2102
|
+
* @returns {Object} Returns the cloned typed array.
|
|
2103
|
+
*/
|
|
2104
|
+
function cloneTypedArray(typedArray, isDeep) {
|
|
2105
|
+
var buffer = cloneArrayBuffer(typedArray.buffer) ;
|
|
2106
|
+
return new typedArray.constructor(buffer, typedArray.byteOffset, typedArray.length);
|
|
2107
|
+
}
|
|
2108
|
+
|
|
2109
|
+
/** `Object#toString` result references. */
|
|
2110
|
+
var boolTag$1 = '[object Boolean]',
|
|
2111
|
+
dateTag$1 = '[object Date]',
|
|
2112
|
+
mapTag$2 = '[object Map]',
|
|
2113
|
+
numberTag$1 = '[object Number]',
|
|
2114
|
+
regexpTag$1 = '[object RegExp]',
|
|
2115
|
+
setTag$2 = '[object Set]',
|
|
2116
|
+
stringTag$1 = '[object String]',
|
|
2117
|
+
symbolTag$1 = '[object Symbol]';
|
|
2118
|
+
|
|
2119
|
+
var arrayBufferTag$1 = '[object ArrayBuffer]',
|
|
2120
|
+
dataViewTag$1 = '[object DataView]',
|
|
2121
|
+
float32Tag$1 = '[object Float32Array]',
|
|
2122
|
+
float64Tag$1 = '[object Float64Array]',
|
|
2123
|
+
int8Tag$1 = '[object Int8Array]',
|
|
2124
|
+
int16Tag$1 = '[object Int16Array]',
|
|
2125
|
+
int32Tag$1 = '[object Int32Array]',
|
|
2126
|
+
uint8Tag$1 = '[object Uint8Array]',
|
|
2127
|
+
uint8ClampedTag$1 = '[object Uint8ClampedArray]',
|
|
2128
|
+
uint16Tag$1 = '[object Uint16Array]',
|
|
2129
|
+
uint32Tag$1 = '[object Uint32Array]';
|
|
2130
|
+
|
|
2131
|
+
/**
|
|
2132
|
+
* Initializes an object clone based on its `toStringTag`.
|
|
2133
|
+
*
|
|
2134
|
+
* **Note:** This function only supports cloning values with tags of
|
|
2135
|
+
* `Boolean`, `Date`, `Error`, `Map`, `Number`, `RegExp`, `Set`, or `String`.
|
|
2136
|
+
*
|
|
2137
|
+
* @private
|
|
2138
|
+
* @param {Object} object The object to clone.
|
|
2139
|
+
* @param {string} tag The `toStringTag` of the object to clone.
|
|
2140
|
+
* @param {boolean} [isDeep] Specify a deep clone.
|
|
2141
|
+
* @returns {Object} Returns the initialized clone.
|
|
2142
|
+
*/
|
|
2143
|
+
function initCloneByTag(object, tag, isDeep) {
|
|
2144
|
+
var Ctor = object.constructor;
|
|
2145
|
+
switch (tag) {
|
|
2146
|
+
case arrayBufferTag$1:
|
|
2147
|
+
return cloneArrayBuffer(object);
|
|
2148
|
+
|
|
2149
|
+
case boolTag$1:
|
|
2150
|
+
case dateTag$1:
|
|
2151
|
+
return new Ctor(+object);
|
|
2152
|
+
|
|
2153
|
+
case dataViewTag$1:
|
|
2154
|
+
return cloneDataView(object);
|
|
2155
|
+
|
|
2156
|
+
case float32Tag$1: case float64Tag$1:
|
|
2157
|
+
case int8Tag$1: case int16Tag$1: case int32Tag$1:
|
|
2158
|
+
case uint8Tag$1: case uint8ClampedTag$1: case uint16Tag$1: case uint32Tag$1:
|
|
2159
|
+
return cloneTypedArray(object);
|
|
2160
|
+
|
|
2161
|
+
case mapTag$2:
|
|
2162
|
+
return new Ctor;
|
|
2163
|
+
|
|
2164
|
+
case numberTag$1:
|
|
2165
|
+
case stringTag$1:
|
|
2166
|
+
return new Ctor(object);
|
|
2167
|
+
|
|
2168
|
+
case regexpTag$1:
|
|
2169
|
+
return cloneRegExp(object);
|
|
2170
|
+
|
|
2171
|
+
case setTag$2:
|
|
2172
|
+
return new Ctor;
|
|
2173
|
+
|
|
2174
|
+
case symbolTag$1:
|
|
2175
|
+
return cloneSymbol(object);
|
|
2176
|
+
}
|
|
2177
|
+
}
|
|
2178
|
+
|
|
2179
|
+
/**
|
|
2180
|
+
* Initializes an object clone.
|
|
2181
|
+
*
|
|
2182
|
+
* @private
|
|
2183
|
+
* @param {Object} object The object to clone.
|
|
2184
|
+
* @returns {Object} Returns the initialized clone.
|
|
2185
|
+
*/
|
|
2186
|
+
function initCloneObject(object) {
|
|
2187
|
+
return (typeof object.constructor == 'function' && !isPrototype(object))
|
|
2188
|
+
? baseCreate(getPrototype(object))
|
|
2189
|
+
: {};
|
|
2190
|
+
}
|
|
2191
|
+
|
|
2192
|
+
/** `Object#toString` result references. */
|
|
2193
|
+
var mapTag$1 = '[object Map]';
|
|
2194
|
+
|
|
2195
|
+
/**
|
|
2196
|
+
* The base implementation of `_.isMap` without Node.js optimizations.
|
|
2197
|
+
*
|
|
2198
|
+
* @private
|
|
2199
|
+
* @param {*} value The value to check.
|
|
2200
|
+
* @returns {boolean} Returns `true` if `value` is a map, else `false`.
|
|
2201
|
+
*/
|
|
2202
|
+
function baseIsMap(value) {
|
|
2203
|
+
return isObjectLike(value) && getTag(value) == mapTag$1;
|
|
2204
|
+
}
|
|
2205
|
+
|
|
2206
|
+
/* Node.js helper references. */
|
|
2207
|
+
var nodeIsMap = nodeUtil && nodeUtil.isMap;
|
|
2208
|
+
|
|
2209
|
+
/**
|
|
2210
|
+
* Checks if `value` is classified as a `Map` object.
|
|
2211
|
+
*
|
|
2212
|
+
* @static
|
|
2213
|
+
* @memberOf _
|
|
2214
|
+
* @since 4.3.0
|
|
2215
|
+
* @category Lang
|
|
2216
|
+
* @param {*} value The value to check.
|
|
2217
|
+
* @returns {boolean} Returns `true` if `value` is a map, else `false`.
|
|
2218
|
+
* @example
|
|
2219
|
+
*
|
|
2220
|
+
* _.isMap(new Map);
|
|
2221
|
+
* // => true
|
|
2222
|
+
*
|
|
2223
|
+
* _.isMap(new WeakMap);
|
|
2224
|
+
* // => false
|
|
2225
|
+
*/
|
|
2226
|
+
var isMap = nodeIsMap ? baseUnary(nodeIsMap) : baseIsMap;
|
|
2227
|
+
|
|
2228
|
+
/** `Object#toString` result references. */
|
|
2229
|
+
var setTag$1 = '[object Set]';
|
|
2230
|
+
|
|
2231
|
+
/**
|
|
2232
|
+
* The base implementation of `_.isSet` without Node.js optimizations.
|
|
2233
|
+
*
|
|
2234
|
+
* @private
|
|
2235
|
+
* @param {*} value The value to check.
|
|
2236
|
+
* @returns {boolean} Returns `true` if `value` is a set, else `false`.
|
|
2237
|
+
*/
|
|
2238
|
+
function baseIsSet(value) {
|
|
2239
|
+
return isObjectLike(value) && getTag(value) == setTag$1;
|
|
2240
|
+
}
|
|
2241
|
+
|
|
2242
|
+
/* Node.js helper references. */
|
|
2243
|
+
var nodeIsSet = nodeUtil && nodeUtil.isSet;
|
|
2244
|
+
|
|
2245
|
+
/**
|
|
2246
|
+
* Checks if `value` is classified as a `Set` object.
|
|
2247
|
+
*
|
|
2248
|
+
* @static
|
|
2249
|
+
* @memberOf _
|
|
2250
|
+
* @since 4.3.0
|
|
2251
|
+
* @category Lang
|
|
2252
|
+
* @param {*} value The value to check.
|
|
2253
|
+
* @returns {boolean} Returns `true` if `value` is a set, else `false`.
|
|
2254
|
+
* @example
|
|
2255
|
+
*
|
|
2256
|
+
* _.isSet(new Set);
|
|
2257
|
+
* // => true
|
|
2258
|
+
*
|
|
2259
|
+
* _.isSet(new WeakSet);
|
|
2260
|
+
* // => false
|
|
2261
|
+
*/
|
|
2262
|
+
var isSet = nodeIsSet ? baseUnary(nodeIsSet) : baseIsSet;
|
|
2263
|
+
|
|
2264
|
+
/** `Object#toString` result references. */
|
|
2265
|
+
var argsTag = '[object Arguments]',
|
|
2266
|
+
arrayTag = '[object Array]',
|
|
2267
|
+
boolTag = '[object Boolean]',
|
|
2268
|
+
dateTag = '[object Date]',
|
|
2269
|
+
errorTag = '[object Error]',
|
|
2270
|
+
funcTag = '[object Function]',
|
|
2271
|
+
genTag = '[object GeneratorFunction]',
|
|
2272
|
+
mapTag = '[object Map]',
|
|
2273
|
+
numberTag = '[object Number]',
|
|
2274
|
+
objectTag = '[object Object]',
|
|
2275
|
+
regexpTag = '[object RegExp]',
|
|
2276
|
+
setTag = '[object Set]',
|
|
2277
|
+
stringTag = '[object String]',
|
|
2278
|
+
symbolTag = '[object Symbol]',
|
|
2279
|
+
weakMapTag = '[object WeakMap]';
|
|
2280
|
+
|
|
2281
|
+
var arrayBufferTag = '[object ArrayBuffer]',
|
|
2282
|
+
dataViewTag = '[object DataView]',
|
|
2283
|
+
float32Tag = '[object Float32Array]',
|
|
2284
|
+
float64Tag = '[object Float64Array]',
|
|
2285
|
+
int8Tag = '[object Int8Array]',
|
|
2286
|
+
int16Tag = '[object Int16Array]',
|
|
2287
|
+
int32Tag = '[object Int32Array]',
|
|
2288
|
+
uint8Tag = '[object Uint8Array]',
|
|
2289
|
+
uint8ClampedTag = '[object Uint8ClampedArray]',
|
|
2290
|
+
uint16Tag = '[object Uint16Array]',
|
|
2291
|
+
uint32Tag = '[object Uint32Array]';
|
|
2292
|
+
|
|
2293
|
+
/** Used to identify `toStringTag` values supported by `_.clone`. */
|
|
2294
|
+
var cloneableTags = {};
|
|
2295
|
+
cloneableTags[argsTag] = cloneableTags[arrayTag] =
|
|
2296
|
+
cloneableTags[arrayBufferTag] = cloneableTags[dataViewTag] =
|
|
2297
|
+
cloneableTags[boolTag] = cloneableTags[dateTag] =
|
|
2298
|
+
cloneableTags[float32Tag] = cloneableTags[float64Tag] =
|
|
2299
|
+
cloneableTags[int8Tag] = cloneableTags[int16Tag] =
|
|
2300
|
+
cloneableTags[int32Tag] = cloneableTags[mapTag] =
|
|
2301
|
+
cloneableTags[numberTag] = cloneableTags[objectTag] =
|
|
2302
|
+
cloneableTags[regexpTag] = cloneableTags[setTag] =
|
|
2303
|
+
cloneableTags[stringTag] = cloneableTags[symbolTag] =
|
|
2304
|
+
cloneableTags[uint8Tag] = cloneableTags[uint8ClampedTag] =
|
|
2305
|
+
cloneableTags[uint16Tag] = cloneableTags[uint32Tag] = true;
|
|
2306
|
+
cloneableTags[errorTag] = cloneableTags[funcTag] =
|
|
2307
|
+
cloneableTags[weakMapTag] = false;
|
|
2308
|
+
|
|
2309
|
+
/**
|
|
2310
|
+
* The base implementation of `_.clone` and `_.cloneDeep` which tracks
|
|
2311
|
+
* traversed objects.
|
|
2312
|
+
*
|
|
2313
|
+
* @private
|
|
2314
|
+
* @param {*} value The value to clone.
|
|
2315
|
+
* @param {boolean} bitmask The bitmask flags.
|
|
2316
|
+
* 1 - Deep clone
|
|
2317
|
+
* 2 - Flatten inherited properties
|
|
2318
|
+
* 4 - Clone symbols
|
|
2319
|
+
* @param {Function} [customizer] The function to customize cloning.
|
|
2320
|
+
* @param {string} [key] The key of `value`.
|
|
2321
|
+
* @param {Object} [object] The parent object of `value`.
|
|
2322
|
+
* @param {Object} [stack] Tracks traversed objects and their clone counterparts.
|
|
2323
|
+
* @returns {*} Returns the cloned value.
|
|
2324
|
+
*/
|
|
2325
|
+
function baseClone(value, bitmask, customizer, key, object, stack) {
|
|
2326
|
+
var result;
|
|
2327
|
+
|
|
2328
|
+
if (customizer) {
|
|
2329
|
+
result = object ? customizer(value, key, object, stack) : customizer(value);
|
|
2330
|
+
}
|
|
2331
|
+
if (result !== undefined) {
|
|
2332
|
+
return result;
|
|
2333
|
+
}
|
|
2334
|
+
if (!isObject$1(value)) {
|
|
2335
|
+
return value;
|
|
2336
|
+
}
|
|
2337
|
+
var isArr = isArray(value);
|
|
2338
|
+
if (isArr) {
|
|
2339
|
+
result = initCloneArray(value);
|
|
2340
|
+
} else {
|
|
2341
|
+
var tag = getTag(value),
|
|
2342
|
+
isFunc = tag == funcTag || tag == genTag;
|
|
2343
|
+
|
|
2344
|
+
if (isBuffer(value)) {
|
|
2345
|
+
return cloneBuffer(value);
|
|
2346
|
+
}
|
|
2347
|
+
if (tag == objectTag || tag == argsTag || (isFunc && !object)) {
|
|
2348
|
+
result = (isFunc) ? {} : initCloneObject(value);
|
|
2349
|
+
} else {
|
|
2350
|
+
if (!cloneableTags[tag]) {
|
|
2351
|
+
return object ? value : {};
|
|
2352
|
+
}
|
|
2353
|
+
result = initCloneByTag(value, tag);
|
|
2354
|
+
}
|
|
2355
|
+
}
|
|
2356
|
+
// Check for circular references and return its corresponding clone.
|
|
2357
|
+
stack || (stack = new Stack);
|
|
2358
|
+
var stacked = stack.get(value);
|
|
2359
|
+
if (stacked) {
|
|
2360
|
+
return stacked;
|
|
2361
|
+
}
|
|
2362
|
+
stack.set(value, result);
|
|
2363
|
+
|
|
2364
|
+
if (isSet(value)) {
|
|
2365
|
+
value.forEach(function(subValue) {
|
|
2366
|
+
result.add(baseClone(subValue, bitmask, customizer, subValue, value, stack));
|
|
2367
|
+
});
|
|
2368
|
+
} else if (isMap(value)) {
|
|
2369
|
+
value.forEach(function(subValue, key) {
|
|
2370
|
+
result.set(key, baseClone(subValue, bitmask, customizer, key, value, stack));
|
|
2371
|
+
});
|
|
2372
|
+
}
|
|
2373
|
+
|
|
2374
|
+
var keysFunc = (getAllKeys)
|
|
2375
|
+
;
|
|
2376
|
+
|
|
2377
|
+
var props = isArr ? undefined : keysFunc(value);
|
|
2378
|
+
arrayEach(props || value, function(subValue, key) {
|
|
2379
|
+
if (props) {
|
|
2380
|
+
key = subValue;
|
|
2381
|
+
subValue = value[key];
|
|
2382
|
+
}
|
|
2383
|
+
// Recursively populate clone (susceptible to call stack limits).
|
|
2384
|
+
assignValue(result, key, baseClone(subValue, bitmask, customizer, key, value, stack));
|
|
2385
|
+
});
|
|
2386
|
+
return result;
|
|
2387
|
+
}
|
|
2388
|
+
|
|
2389
|
+
/** Used to compose bitmasks for cloning. */
|
|
2390
|
+
var CLONE_DEEP_FLAG = 1,
|
|
2391
|
+
CLONE_SYMBOLS_FLAG = 4;
|
|
2392
|
+
|
|
2393
|
+
/**
|
|
2394
|
+
* This method is like `_.cloneWith` except that it recursively clones `value`.
|
|
2395
|
+
*
|
|
2396
|
+
* @static
|
|
2397
|
+
* @memberOf _
|
|
2398
|
+
* @since 4.0.0
|
|
2399
|
+
* @category Lang
|
|
2400
|
+
* @param {*} value The value to recursively clone.
|
|
2401
|
+
* @param {Function} [customizer] The function to customize cloning.
|
|
2402
|
+
* @returns {*} Returns the deep cloned value.
|
|
2403
|
+
* @see _.cloneWith
|
|
2404
|
+
* @example
|
|
2405
|
+
*
|
|
2406
|
+
* function customizer(value) {
|
|
2407
|
+
* if (_.isElement(value)) {
|
|
2408
|
+
* return value.cloneNode(true);
|
|
2409
|
+
* }
|
|
2410
|
+
* }
|
|
2411
|
+
*
|
|
2412
|
+
* var el = _.cloneDeepWith(document.body, customizer);
|
|
2413
|
+
*
|
|
2414
|
+
* console.log(el === document.body);
|
|
2415
|
+
* // => false
|
|
2416
|
+
* console.log(el.nodeName);
|
|
2417
|
+
* // => 'BODY'
|
|
2418
|
+
* console.log(el.childNodes.length);
|
|
2419
|
+
* // => 20
|
|
2420
|
+
*/
|
|
2421
|
+
function cloneDeepWith(value, customizer) {
|
|
2422
|
+
customizer = typeof customizer == 'function' ? customizer : undefined;
|
|
2423
|
+
return baseClone(value, CLONE_DEEP_FLAG | CLONE_SYMBOLS_FLAG, customizer);
|
|
2424
|
+
}
|
|
2425
|
+
|
|
2426
|
+
function cleanObject(obj) {
|
|
2427
|
+
Object.keys(obj).forEach((key) => {
|
|
2428
|
+
obj[key] = null;
|
|
2429
|
+
delete obj[key];
|
|
2430
|
+
});
|
|
2431
|
+
}
|
|
2432
|
+
function isObject(obj, shouldAllowCustomObjects = false) {
|
|
2433
|
+
if (!obj) return false;
|
|
2434
|
+
const hasConstructor = shouldAllowCustomObjects ? true : obj.constructor === Object;
|
|
2435
|
+
return typeof obj === "object" && !Array.isArray(obj) && hasConstructor;
|
|
2436
|
+
}
|
|
2437
|
+
const isEmptyObject = (obj) => Object.keys(obj).length === 0 && isObject(obj);
|
|
2438
|
+
const omitInObjectWithoutMutation = (obj, keys) => {
|
|
2439
|
+
let result = {};
|
|
2440
|
+
Object.keys(obj).forEach((key) => {
|
|
2441
|
+
if (!keys.includes(key)) {
|
|
2442
|
+
result = { ...result, [key]: obj[key] };
|
|
2443
|
+
}
|
|
2444
|
+
});
|
|
2445
|
+
return result;
|
|
2446
|
+
};
|
|
2447
|
+
const omitInObjectWithMutation = (obj, keys) => {
|
|
2448
|
+
keys.forEach((key) => delete obj[key]);
|
|
2449
|
+
return obj;
|
|
2450
|
+
};
|
|
2451
|
+
const filterValues = (value) => value !== void 0 && value !== null && value !== Infinity && value !== -Infinity;
|
|
2452
|
+
function filterOutEmptyFields(item) {
|
|
2453
|
+
if (Array.isArray(item)) return item.filter(filterValues);
|
|
2454
|
+
return Object.fromEntries(Object.entries(item).filter(([, value]) => filterValues(value)));
|
|
2455
|
+
}
|
|
2456
|
+
function filterOutEmptyFieldsRecursive(input) {
|
|
2457
|
+
const customizer = (value) => {
|
|
2458
|
+
if (value === null || typeof value !== "object" || value instanceof Date || value instanceof RegExp || value instanceof Map || value instanceof Set || typeof ArrayBuffer !== "undefined" && ArrayBuffer.isView(value))
|
|
2459
|
+
return void 0;
|
|
2460
|
+
if (Array.isArray(value)) {
|
|
2461
|
+
const cleaned = value.map((v) => cloneDeepWith(v, customizer));
|
|
2462
|
+
return cleaned.filter((v) => v !== void 0);
|
|
2463
|
+
}
|
|
2464
|
+
if (isPlainObject(value)) {
|
|
2465
|
+
const src = value;
|
|
2466
|
+
return Object.entries(src).filter(([, v]) => v !== void 0).map(([k, v]) => [k, cloneDeepWith(v, customizer)]).filter(([, cleanedValue]) => cleanedValue !== void 0).reduce((acc, [k, cleanedValue]) => ({ ...acc, [k]: cleanedValue }), {});
|
|
2467
|
+
}
|
|
2468
|
+
return void 0;
|
|
2469
|
+
};
|
|
2470
|
+
return cloneDeepWith(input, customizer);
|
|
2471
|
+
}
|
|
2472
|
+
function patchObject(base, patch) {
|
|
2473
|
+
if (patch === void 0) return base;
|
|
2474
|
+
if (!isObject(base) || Array.isArray(patch)) return patch;
|
|
2475
|
+
const out = { ...base };
|
|
2476
|
+
Object.entries(patch).forEach(([key, patchVal]) => {
|
|
2477
|
+
if (patchVal === void 0) return;
|
|
2478
|
+
const baseVal = base[key];
|
|
2479
|
+
out[key] = Array.isArray(patchVal) ? patchVal.slice() : isObject(patchVal) && isObject(baseVal) ? patchObject(baseVal, patchVal) : patchVal;
|
|
2480
|
+
});
|
|
2481
|
+
return out;
|
|
2482
|
+
}
|
|
2483
|
+
|
|
2484
|
+
/******************************************************************************
|
|
2485
|
+
Copyright (c) Microsoft Corporation.
|
|
2486
|
+
|
|
2487
|
+
Permission to use, copy, modify, and/or distribute this software for any
|
|
2488
|
+
purpose with or without fee is hereby granted.
|
|
2489
|
+
|
|
2490
|
+
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
2491
|
+
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
2492
|
+
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
2493
|
+
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
2494
|
+
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
2495
|
+
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
2496
|
+
PERFORMANCE OF THIS SOFTWARE.
|
|
2497
|
+
***************************************************************************** */
|
|
2498
|
+
/* global Reflect, Promise, SuppressedError, Symbol, Iterator */
|
|
2499
|
+
|
|
2500
|
+
var extendStatics = function(d, b) {
|
|
2501
|
+
extendStatics = Object.setPrototypeOf ||
|
|
2502
|
+
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
2503
|
+
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
|
2504
|
+
return extendStatics(d, b);
|
|
2505
|
+
};
|
|
2506
|
+
|
|
2507
|
+
function __extends(d, b) {
|
|
2508
|
+
if (typeof b !== "function" && b !== null)
|
|
2509
|
+
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
2510
|
+
extendStatics(d, b);
|
|
2511
|
+
function __() { this.constructor = d; }
|
|
2512
|
+
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
2513
|
+
}
|
|
2514
|
+
|
|
2515
|
+
function __awaiter(thisArg, _arguments, P, generator) {
|
|
2516
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
2517
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
2518
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
2519
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
2520
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
2521
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
2522
|
+
});
|
|
2523
|
+
}
|
|
2524
|
+
|
|
2525
|
+
function __generator(thisArg, body) {
|
|
2526
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
|
|
2527
|
+
return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
2528
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
2529
|
+
function step(op) {
|
|
2530
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
2531
|
+
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
2532
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
2533
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
2534
|
+
switch (op[0]) {
|
|
2535
|
+
case 0: case 1: t = op; break;
|
|
2536
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
2537
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
2538
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
2539
|
+
default:
|
|
2540
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
2541
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
2542
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
2543
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
2544
|
+
if (t[2]) _.ops.pop();
|
|
2545
|
+
_.trys.pop(); continue;
|
|
2546
|
+
}
|
|
2547
|
+
op = body.call(thisArg, _);
|
|
2548
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
2549
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
2550
|
+
}
|
|
2551
|
+
}
|
|
2552
|
+
|
|
2553
|
+
function __values(o) {
|
|
2554
|
+
var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
|
|
2555
|
+
if (m) return m.call(o);
|
|
2556
|
+
if (o && typeof o.length === "number") return {
|
|
2557
|
+
next: function () {
|
|
2558
|
+
if (o && i >= o.length) o = void 0;
|
|
2559
|
+
return { value: o && o[i++], done: !o };
|
|
2560
|
+
}
|
|
2561
|
+
};
|
|
2562
|
+
throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
|
|
2563
|
+
}
|
|
2564
|
+
|
|
2565
|
+
function __read(o, n) {
|
|
2566
|
+
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
|
2567
|
+
if (!m) return o;
|
|
2568
|
+
var i = m.call(o), r, ar = [], e;
|
|
2569
|
+
try {
|
|
2570
|
+
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
|
|
2571
|
+
}
|
|
2572
|
+
catch (error) { e = { error: error }; }
|
|
2573
|
+
finally {
|
|
2574
|
+
try {
|
|
2575
|
+
if (r && !r.done && (m = i["return"])) m.call(i);
|
|
2576
|
+
}
|
|
2577
|
+
finally { if (e) throw e.error; }
|
|
2578
|
+
}
|
|
2579
|
+
return ar;
|
|
2580
|
+
}
|
|
2581
|
+
|
|
2582
|
+
function __spreadArray(to, from, pack) {
|
|
2583
|
+
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
2584
|
+
if (ar || !(i in from)) {
|
|
2585
|
+
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
2586
|
+
ar[i] = from[i];
|
|
2587
|
+
}
|
|
2588
|
+
}
|
|
2589
|
+
return to.concat(ar || Array.prototype.slice.call(from));
|
|
2590
|
+
}
|
|
2591
|
+
|
|
2592
|
+
function __await(v) {
|
|
2593
|
+
return this instanceof __await ? (this.v = v, this) : new __await(v);
|
|
2594
|
+
}
|
|
2595
|
+
|
|
2596
|
+
function __asyncGenerator(thisArg, _arguments, generator) {
|
|
2597
|
+
if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
|
|
2598
|
+
var g = generator.apply(thisArg, _arguments || []), i, q = [];
|
|
2599
|
+
return i = Object.create((typeof AsyncIterator === "function" ? AsyncIterator : Object).prototype), verb("next"), verb("throw"), verb("return", awaitReturn), i[Symbol.asyncIterator] = function () { return this; }, i;
|
|
2600
|
+
function awaitReturn(f) { return function (v) { return Promise.resolve(v).then(f, reject); }; }
|
|
2601
|
+
function verb(n, f) { if (g[n]) { i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; if (f) i[n] = f(i[n]); } }
|
|
2602
|
+
function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } }
|
|
2603
|
+
function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }
|
|
2604
|
+
function fulfill(value) { resume("next", value); }
|
|
2605
|
+
function reject(value) { resume("throw", value); }
|
|
2606
|
+
function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); }
|
|
2607
|
+
}
|
|
2608
|
+
|
|
2609
|
+
function __asyncValues(o) {
|
|
2610
|
+
if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
|
|
2611
|
+
var m = o[Symbol.asyncIterator], i;
|
|
2612
|
+
return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i);
|
|
2613
|
+
function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }
|
|
2614
|
+
function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }
|
|
2615
|
+
}
|
|
2616
|
+
|
|
2617
|
+
typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
|
|
2618
|
+
var e = new Error(message);
|
|
2619
|
+
return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
|
|
2620
|
+
};
|
|
2621
|
+
|
|
2622
|
+
function isFunction(value) {
|
|
2623
|
+
return typeof value === 'function';
|
|
2624
|
+
}
|
|
2625
|
+
|
|
2626
|
+
function createErrorClass(createImpl) {
|
|
2627
|
+
var _super = function (instance) {
|
|
2628
|
+
Error.call(instance);
|
|
2629
|
+
instance.stack = new Error().stack;
|
|
2630
|
+
};
|
|
2631
|
+
var ctorFunc = createImpl(_super);
|
|
2632
|
+
ctorFunc.prototype = Object.create(Error.prototype);
|
|
2633
|
+
ctorFunc.prototype.constructor = ctorFunc;
|
|
2634
|
+
return ctorFunc;
|
|
2635
|
+
}
|
|
2636
|
+
|
|
2637
|
+
var UnsubscriptionError = createErrorClass(function (_super) {
|
|
2638
|
+
return function UnsubscriptionErrorImpl(errors) {
|
|
2639
|
+
_super(this);
|
|
2640
|
+
this.message = errors
|
|
2641
|
+
? errors.length + " errors occurred during unsubscription:\n" + errors.map(function (err, i) { return i + 1 + ") " + err.toString(); }).join('\n ')
|
|
2642
|
+
: '';
|
|
2643
|
+
this.name = 'UnsubscriptionError';
|
|
2644
|
+
this.errors = errors;
|
|
2645
|
+
};
|
|
2646
|
+
});
|
|
2647
|
+
|
|
2648
|
+
function arrRemove(arr, item) {
|
|
2649
|
+
if (arr) {
|
|
2650
|
+
var index = arr.indexOf(item);
|
|
2651
|
+
0 <= index && arr.splice(index, 1);
|
|
2652
|
+
}
|
|
2653
|
+
}
|
|
2654
|
+
|
|
2655
|
+
var Subscription = (function () {
|
|
2656
|
+
function Subscription(initialTeardown) {
|
|
2657
|
+
this.initialTeardown = initialTeardown;
|
|
2658
|
+
this.closed = false;
|
|
2659
|
+
this._parentage = null;
|
|
2660
|
+
this._finalizers = null;
|
|
2661
|
+
}
|
|
2662
|
+
Subscription.prototype.unsubscribe = function () {
|
|
2663
|
+
var e_1, _a, e_2, _b;
|
|
2664
|
+
var errors;
|
|
2665
|
+
if (!this.closed) {
|
|
2666
|
+
this.closed = true;
|
|
2667
|
+
var _parentage = this._parentage;
|
|
2668
|
+
if (_parentage) {
|
|
2669
|
+
this._parentage = null;
|
|
2670
|
+
if (Array.isArray(_parentage)) {
|
|
2671
|
+
try {
|
|
2672
|
+
for (var _parentage_1 = __values(_parentage), _parentage_1_1 = _parentage_1.next(); !_parentage_1_1.done; _parentage_1_1 = _parentage_1.next()) {
|
|
2673
|
+
var parent_1 = _parentage_1_1.value;
|
|
2674
|
+
parent_1.remove(this);
|
|
2675
|
+
}
|
|
2676
|
+
}
|
|
2677
|
+
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
2678
|
+
finally {
|
|
2679
|
+
try {
|
|
2680
|
+
if (_parentage_1_1 && !_parentage_1_1.done && (_a = _parentage_1.return)) _a.call(_parentage_1);
|
|
2681
|
+
}
|
|
2682
|
+
finally { if (e_1) throw e_1.error; }
|
|
2683
|
+
}
|
|
2684
|
+
}
|
|
2685
|
+
else {
|
|
2686
|
+
_parentage.remove(this);
|
|
2687
|
+
}
|
|
2688
|
+
}
|
|
2689
|
+
var initialFinalizer = this.initialTeardown;
|
|
2690
|
+
if (isFunction(initialFinalizer)) {
|
|
2691
|
+
try {
|
|
2692
|
+
initialFinalizer();
|
|
2693
|
+
}
|
|
2694
|
+
catch (e) {
|
|
2695
|
+
errors = e instanceof UnsubscriptionError ? e.errors : [e];
|
|
2696
|
+
}
|
|
2697
|
+
}
|
|
2698
|
+
var _finalizers = this._finalizers;
|
|
2699
|
+
if (_finalizers) {
|
|
2700
|
+
this._finalizers = null;
|
|
2701
|
+
try {
|
|
2702
|
+
for (var _finalizers_1 = __values(_finalizers), _finalizers_1_1 = _finalizers_1.next(); !_finalizers_1_1.done; _finalizers_1_1 = _finalizers_1.next()) {
|
|
2703
|
+
var finalizer = _finalizers_1_1.value;
|
|
2704
|
+
try {
|
|
2705
|
+
execFinalizer(finalizer);
|
|
2706
|
+
}
|
|
2707
|
+
catch (err) {
|
|
2708
|
+
errors = errors !== null && errors !== void 0 ? errors : [];
|
|
2709
|
+
if (err instanceof UnsubscriptionError) {
|
|
2710
|
+
errors = __spreadArray(__spreadArray([], __read(errors)), __read(err.errors));
|
|
2711
|
+
}
|
|
2712
|
+
else {
|
|
2713
|
+
errors.push(err);
|
|
2714
|
+
}
|
|
2715
|
+
}
|
|
2716
|
+
}
|
|
2717
|
+
}
|
|
2718
|
+
catch (e_2_1) { e_2 = { error: e_2_1 }; }
|
|
2719
|
+
finally {
|
|
2720
|
+
try {
|
|
2721
|
+
if (_finalizers_1_1 && !_finalizers_1_1.done && (_b = _finalizers_1.return)) _b.call(_finalizers_1);
|
|
2722
|
+
}
|
|
2723
|
+
finally { if (e_2) throw e_2.error; }
|
|
2724
|
+
}
|
|
2725
|
+
}
|
|
2726
|
+
if (errors) {
|
|
2727
|
+
throw new UnsubscriptionError(errors);
|
|
2728
|
+
}
|
|
2729
|
+
}
|
|
2730
|
+
};
|
|
2731
|
+
Subscription.prototype.add = function (teardown) {
|
|
2732
|
+
var _a;
|
|
2733
|
+
if (teardown && teardown !== this) {
|
|
2734
|
+
if (this.closed) {
|
|
2735
|
+
execFinalizer(teardown);
|
|
2736
|
+
}
|
|
2737
|
+
else {
|
|
2738
|
+
if (teardown instanceof Subscription) {
|
|
2739
|
+
if (teardown.closed || teardown._hasParent(this)) {
|
|
2740
|
+
return;
|
|
2741
|
+
}
|
|
2742
|
+
teardown._addParent(this);
|
|
2743
|
+
}
|
|
2744
|
+
(this._finalizers = (_a = this._finalizers) !== null && _a !== void 0 ? _a : []).push(teardown);
|
|
2745
|
+
}
|
|
2746
|
+
}
|
|
2747
|
+
};
|
|
2748
|
+
Subscription.prototype._hasParent = function (parent) {
|
|
2749
|
+
var _parentage = this._parentage;
|
|
2750
|
+
return _parentage === parent || (Array.isArray(_parentage) && _parentage.includes(parent));
|
|
2751
|
+
};
|
|
2752
|
+
Subscription.prototype._addParent = function (parent) {
|
|
2753
|
+
var _parentage = this._parentage;
|
|
2754
|
+
this._parentage = Array.isArray(_parentage) ? (_parentage.push(parent), _parentage) : _parentage ? [_parentage, parent] : parent;
|
|
2755
|
+
};
|
|
2756
|
+
Subscription.prototype._removeParent = function (parent) {
|
|
2757
|
+
var _parentage = this._parentage;
|
|
2758
|
+
if (_parentage === parent) {
|
|
2759
|
+
this._parentage = null;
|
|
2760
|
+
}
|
|
2761
|
+
else if (Array.isArray(_parentage)) {
|
|
2762
|
+
arrRemove(_parentage, parent);
|
|
2763
|
+
}
|
|
2764
|
+
};
|
|
2765
|
+
Subscription.prototype.remove = function (teardown) {
|
|
2766
|
+
var _finalizers = this._finalizers;
|
|
2767
|
+
_finalizers && arrRemove(_finalizers, teardown);
|
|
2768
|
+
if (teardown instanceof Subscription) {
|
|
2769
|
+
teardown._removeParent(this);
|
|
2770
|
+
}
|
|
2771
|
+
};
|
|
2772
|
+
Subscription.EMPTY = (function () {
|
|
2773
|
+
var empty = new Subscription();
|
|
2774
|
+
empty.closed = true;
|
|
2775
|
+
return empty;
|
|
2776
|
+
})();
|
|
2777
|
+
return Subscription;
|
|
2778
|
+
}());
|
|
2779
|
+
Subscription.EMPTY;
|
|
2780
|
+
function isSubscription(value) {
|
|
2781
|
+
return (value instanceof Subscription ||
|
|
2782
|
+
(value && 'closed' in value && isFunction(value.remove) && isFunction(value.add) && isFunction(value.unsubscribe)));
|
|
2783
|
+
}
|
|
2784
|
+
function execFinalizer(finalizer) {
|
|
2785
|
+
if (isFunction(finalizer)) {
|
|
2786
|
+
finalizer();
|
|
2787
|
+
}
|
|
2788
|
+
else {
|
|
2789
|
+
finalizer.unsubscribe();
|
|
2790
|
+
}
|
|
2791
|
+
}
|
|
2792
|
+
|
|
2793
|
+
var config = {
|
|
2794
|
+
Promise: undefined};
|
|
2795
|
+
|
|
2796
|
+
var timeoutProvider = {
|
|
2797
|
+
setTimeout: function (handler, timeout) {
|
|
2798
|
+
var args = [];
|
|
2799
|
+
for (var _i = 2; _i < arguments.length; _i++) {
|
|
2800
|
+
args[_i - 2] = arguments[_i];
|
|
2801
|
+
}
|
|
2802
|
+
return setTimeout.apply(void 0, __spreadArray([handler, timeout], __read(args)));
|
|
2803
|
+
},
|
|
2804
|
+
clearTimeout: function (handle) {
|
|
2805
|
+
return (clearTimeout)(handle);
|
|
2806
|
+
},
|
|
2807
|
+
delegate: undefined,
|
|
2808
|
+
};
|
|
2809
|
+
|
|
2810
|
+
function reportUnhandledError(err) {
|
|
2811
|
+
timeoutProvider.setTimeout(function () {
|
|
2812
|
+
{
|
|
2813
|
+
throw err;
|
|
2814
|
+
}
|
|
2815
|
+
});
|
|
2816
|
+
}
|
|
2817
|
+
|
|
2818
|
+
function noop() { }
|
|
2819
|
+
|
|
2820
|
+
function errorContext(cb) {
|
|
2821
|
+
{
|
|
2822
|
+
cb();
|
|
2823
|
+
}
|
|
2824
|
+
}
|
|
2825
|
+
|
|
2826
|
+
var Subscriber = (function (_super) {
|
|
2827
|
+
__extends(Subscriber, _super);
|
|
2828
|
+
function Subscriber(destination) {
|
|
2829
|
+
var _this = _super.call(this) || this;
|
|
2830
|
+
_this.isStopped = false;
|
|
2831
|
+
if (destination) {
|
|
2832
|
+
_this.destination = destination;
|
|
2833
|
+
if (isSubscription(destination)) {
|
|
2834
|
+
destination.add(_this);
|
|
2835
|
+
}
|
|
2836
|
+
}
|
|
2837
|
+
else {
|
|
2838
|
+
_this.destination = EMPTY_OBSERVER;
|
|
2839
|
+
}
|
|
2840
|
+
return _this;
|
|
2841
|
+
}
|
|
2842
|
+
Subscriber.create = function (next, error, complete) {
|
|
2843
|
+
return new SafeSubscriber(next, error, complete);
|
|
2844
|
+
};
|
|
2845
|
+
Subscriber.prototype.next = function (value) {
|
|
2846
|
+
if (this.isStopped) ;
|
|
2847
|
+
else {
|
|
2848
|
+
this._next(value);
|
|
2849
|
+
}
|
|
2850
|
+
};
|
|
2851
|
+
Subscriber.prototype.error = function (err) {
|
|
2852
|
+
if (this.isStopped) ;
|
|
2853
|
+
else {
|
|
2854
|
+
this.isStopped = true;
|
|
2855
|
+
this._error(err);
|
|
2856
|
+
}
|
|
2857
|
+
};
|
|
2858
|
+
Subscriber.prototype.complete = function () {
|
|
2859
|
+
if (this.isStopped) ;
|
|
2860
|
+
else {
|
|
2861
|
+
this.isStopped = true;
|
|
2862
|
+
this._complete();
|
|
2863
|
+
}
|
|
2864
|
+
};
|
|
2865
|
+
Subscriber.prototype.unsubscribe = function () {
|
|
2866
|
+
if (!this.closed) {
|
|
2867
|
+
this.isStopped = true;
|
|
2868
|
+
_super.prototype.unsubscribe.call(this);
|
|
2869
|
+
this.destination = null;
|
|
2870
|
+
}
|
|
2871
|
+
};
|
|
2872
|
+
Subscriber.prototype._next = function (value) {
|
|
2873
|
+
this.destination.next(value);
|
|
2874
|
+
};
|
|
2875
|
+
Subscriber.prototype._error = function (err) {
|
|
2876
|
+
try {
|
|
2877
|
+
this.destination.error(err);
|
|
2878
|
+
}
|
|
2879
|
+
finally {
|
|
2880
|
+
this.unsubscribe();
|
|
2881
|
+
}
|
|
2882
|
+
};
|
|
2883
|
+
Subscriber.prototype._complete = function () {
|
|
2884
|
+
try {
|
|
2885
|
+
this.destination.complete();
|
|
2886
|
+
}
|
|
2887
|
+
finally {
|
|
2888
|
+
this.unsubscribe();
|
|
2889
|
+
}
|
|
2890
|
+
};
|
|
2891
|
+
return Subscriber;
|
|
2892
|
+
}(Subscription));
|
|
2893
|
+
var ConsumerObserver = (function () {
|
|
2894
|
+
function ConsumerObserver(partialObserver) {
|
|
2895
|
+
this.partialObserver = partialObserver;
|
|
2896
|
+
}
|
|
2897
|
+
ConsumerObserver.prototype.next = function (value) {
|
|
2898
|
+
var partialObserver = this.partialObserver;
|
|
2899
|
+
if (partialObserver.next) {
|
|
2900
|
+
try {
|
|
2901
|
+
partialObserver.next(value);
|
|
2902
|
+
}
|
|
2903
|
+
catch (error) {
|
|
2904
|
+
handleUnhandledError(error);
|
|
2905
|
+
}
|
|
2906
|
+
}
|
|
2907
|
+
};
|
|
2908
|
+
ConsumerObserver.prototype.error = function (err) {
|
|
2909
|
+
var partialObserver = this.partialObserver;
|
|
2910
|
+
if (partialObserver.error) {
|
|
2911
|
+
try {
|
|
2912
|
+
partialObserver.error(err);
|
|
2913
|
+
}
|
|
2914
|
+
catch (error) {
|
|
2915
|
+
handleUnhandledError(error);
|
|
2916
|
+
}
|
|
2917
|
+
}
|
|
2918
|
+
else {
|
|
2919
|
+
handleUnhandledError(err);
|
|
2920
|
+
}
|
|
2921
|
+
};
|
|
2922
|
+
ConsumerObserver.prototype.complete = function () {
|
|
2923
|
+
var partialObserver = this.partialObserver;
|
|
2924
|
+
if (partialObserver.complete) {
|
|
2925
|
+
try {
|
|
2926
|
+
partialObserver.complete();
|
|
2927
|
+
}
|
|
2928
|
+
catch (error) {
|
|
2929
|
+
handleUnhandledError(error);
|
|
2930
|
+
}
|
|
2931
|
+
}
|
|
2932
|
+
};
|
|
2933
|
+
return ConsumerObserver;
|
|
2934
|
+
}());
|
|
2935
|
+
var SafeSubscriber = (function (_super) {
|
|
2936
|
+
__extends(SafeSubscriber, _super);
|
|
2937
|
+
function SafeSubscriber(observerOrNext, error, complete) {
|
|
2938
|
+
var _this = _super.call(this) || this;
|
|
2939
|
+
var partialObserver;
|
|
2940
|
+
if (isFunction(observerOrNext) || !observerOrNext) {
|
|
2941
|
+
partialObserver = {
|
|
2942
|
+
next: (observerOrNext !== null && observerOrNext !== void 0 ? observerOrNext : undefined),
|
|
2943
|
+
error: error !== null && error !== void 0 ? error : undefined,
|
|
2944
|
+
complete: complete !== null && complete !== void 0 ? complete : undefined,
|
|
2945
|
+
};
|
|
2946
|
+
}
|
|
2947
|
+
else {
|
|
2948
|
+
{
|
|
2949
|
+
partialObserver = observerOrNext;
|
|
2950
|
+
}
|
|
2951
|
+
}
|
|
2952
|
+
_this.destination = new ConsumerObserver(partialObserver);
|
|
2953
|
+
return _this;
|
|
2954
|
+
}
|
|
2955
|
+
return SafeSubscriber;
|
|
2956
|
+
}(Subscriber));
|
|
2957
|
+
function handleUnhandledError(error) {
|
|
2958
|
+
{
|
|
2959
|
+
reportUnhandledError(error);
|
|
2960
|
+
}
|
|
2961
|
+
}
|
|
2962
|
+
function defaultErrorHandler(err) {
|
|
2963
|
+
throw err;
|
|
2964
|
+
}
|
|
2965
|
+
var EMPTY_OBSERVER = {
|
|
2966
|
+
closed: true,
|
|
2967
|
+
next: noop,
|
|
2968
|
+
error: defaultErrorHandler,
|
|
2969
|
+
complete: noop,
|
|
2970
|
+
};
|
|
2971
|
+
|
|
2972
|
+
var observable = (function () { return (typeof Symbol === 'function' && Symbol.observable) || '@@observable'; })();
|
|
2973
|
+
|
|
2974
|
+
function identity(x) {
|
|
2975
|
+
return x;
|
|
2976
|
+
}
|
|
2977
|
+
|
|
2978
|
+
function pipeFromArray(fns) {
|
|
2979
|
+
if (fns.length === 0) {
|
|
2980
|
+
return identity;
|
|
2981
|
+
}
|
|
2982
|
+
if (fns.length === 1) {
|
|
2983
|
+
return fns[0];
|
|
2984
|
+
}
|
|
2985
|
+
return function piped(input) {
|
|
2986
|
+
return fns.reduce(function (prev, fn) { return fn(prev); }, input);
|
|
2987
|
+
};
|
|
2988
|
+
}
|
|
2989
|
+
|
|
2990
|
+
var Observable = (function () {
|
|
2991
|
+
function Observable(subscribe) {
|
|
2992
|
+
if (subscribe) {
|
|
2993
|
+
this._subscribe = subscribe;
|
|
2994
|
+
}
|
|
2995
|
+
}
|
|
2996
|
+
Observable.prototype.lift = function (operator) {
|
|
2997
|
+
var observable = new Observable();
|
|
2998
|
+
observable.source = this;
|
|
2999
|
+
observable.operator = operator;
|
|
3000
|
+
return observable;
|
|
3001
|
+
};
|
|
3002
|
+
Observable.prototype.subscribe = function (observerOrNext, error, complete) {
|
|
3003
|
+
var _this = this;
|
|
3004
|
+
var subscriber = isSubscriber(observerOrNext) ? observerOrNext : new SafeSubscriber(observerOrNext, error, complete);
|
|
3005
|
+
errorContext(function () {
|
|
3006
|
+
var _a = _this, operator = _a.operator, source = _a.source;
|
|
3007
|
+
subscriber.add(operator
|
|
3008
|
+
?
|
|
3009
|
+
operator.call(subscriber, source)
|
|
3010
|
+
: source
|
|
3011
|
+
?
|
|
3012
|
+
_this._subscribe(subscriber)
|
|
3013
|
+
:
|
|
3014
|
+
_this._trySubscribe(subscriber));
|
|
3015
|
+
});
|
|
3016
|
+
return subscriber;
|
|
3017
|
+
};
|
|
3018
|
+
Observable.prototype._trySubscribe = function (sink) {
|
|
3019
|
+
try {
|
|
3020
|
+
return this._subscribe(sink);
|
|
3021
|
+
}
|
|
3022
|
+
catch (err) {
|
|
3023
|
+
sink.error(err);
|
|
3024
|
+
}
|
|
3025
|
+
};
|
|
3026
|
+
Observable.prototype.forEach = function (next, promiseCtor) {
|
|
3027
|
+
var _this = this;
|
|
3028
|
+
promiseCtor = getPromiseCtor(promiseCtor);
|
|
3029
|
+
return new promiseCtor(function (resolve, reject) {
|
|
3030
|
+
var subscriber = new SafeSubscriber({
|
|
3031
|
+
next: function (value) {
|
|
3032
|
+
try {
|
|
3033
|
+
next(value);
|
|
3034
|
+
}
|
|
3035
|
+
catch (err) {
|
|
3036
|
+
reject(err);
|
|
3037
|
+
subscriber.unsubscribe();
|
|
3038
|
+
}
|
|
3039
|
+
},
|
|
3040
|
+
error: reject,
|
|
3041
|
+
complete: resolve,
|
|
3042
|
+
});
|
|
3043
|
+
_this.subscribe(subscriber);
|
|
3044
|
+
});
|
|
3045
|
+
};
|
|
3046
|
+
Observable.prototype._subscribe = function (subscriber) {
|
|
3047
|
+
var _a;
|
|
3048
|
+
return (_a = this.source) === null || _a === void 0 ? void 0 : _a.subscribe(subscriber);
|
|
3049
|
+
};
|
|
3050
|
+
Observable.prototype[observable] = function () {
|
|
3051
|
+
return this;
|
|
3052
|
+
};
|
|
3053
|
+
Observable.prototype.pipe = function () {
|
|
3054
|
+
var operations = [];
|
|
3055
|
+
for (var _i = 0; _i < arguments.length; _i++) {
|
|
3056
|
+
operations[_i] = arguments[_i];
|
|
3057
|
+
}
|
|
3058
|
+
return pipeFromArray(operations)(this);
|
|
3059
|
+
};
|
|
3060
|
+
Observable.prototype.toPromise = function (promiseCtor) {
|
|
3061
|
+
var _this = this;
|
|
3062
|
+
promiseCtor = getPromiseCtor(promiseCtor);
|
|
3063
|
+
return new promiseCtor(function (resolve, reject) {
|
|
3064
|
+
var value;
|
|
3065
|
+
_this.subscribe(function (x) { return (value = x); }, function (err) { return reject(err); }, function () { return resolve(value); });
|
|
3066
|
+
});
|
|
3067
|
+
};
|
|
3068
|
+
Observable.create = function (subscribe) {
|
|
3069
|
+
return new Observable(subscribe);
|
|
3070
|
+
};
|
|
3071
|
+
return Observable;
|
|
3072
|
+
}());
|
|
3073
|
+
function getPromiseCtor(promiseCtor) {
|
|
3074
|
+
var _a;
|
|
3075
|
+
return (_a = promiseCtor !== null && promiseCtor !== void 0 ? promiseCtor : config.Promise) !== null && _a !== void 0 ? _a : Promise;
|
|
3076
|
+
}
|
|
3077
|
+
function isObserver(value) {
|
|
3078
|
+
return value && isFunction(value.next) && isFunction(value.error) && isFunction(value.complete);
|
|
3079
|
+
}
|
|
3080
|
+
function isSubscriber(value) {
|
|
3081
|
+
return (value && value instanceof Subscriber) || (isObserver(value) && isSubscription(value));
|
|
3082
|
+
}
|
|
3083
|
+
|
|
3084
|
+
function hasLift(source) {
|
|
3085
|
+
return isFunction(source === null || source === void 0 ? void 0 : source.lift);
|
|
3086
|
+
}
|
|
3087
|
+
function operate(init) {
|
|
3088
|
+
return function (source) {
|
|
3089
|
+
if (hasLift(source)) {
|
|
3090
|
+
return source.lift(function (liftedSource) {
|
|
3091
|
+
try {
|
|
3092
|
+
return init(liftedSource, this);
|
|
3093
|
+
}
|
|
3094
|
+
catch (err) {
|
|
3095
|
+
this.error(err);
|
|
3096
|
+
}
|
|
3097
|
+
});
|
|
3098
|
+
}
|
|
3099
|
+
throw new TypeError('Unable to lift unknown Observable type');
|
|
3100
|
+
};
|
|
3101
|
+
}
|
|
3102
|
+
|
|
3103
|
+
function createOperatorSubscriber(destination, onNext, onComplete, onError, onFinalize) {
|
|
3104
|
+
return new OperatorSubscriber(destination, onNext, onComplete, onError, onFinalize);
|
|
3105
|
+
}
|
|
3106
|
+
var OperatorSubscriber = (function (_super) {
|
|
3107
|
+
__extends(OperatorSubscriber, _super);
|
|
3108
|
+
function OperatorSubscriber(destination, onNext, onComplete, onError, onFinalize, shouldUnsubscribe) {
|
|
3109
|
+
var _this = _super.call(this, destination) || this;
|
|
3110
|
+
_this.onFinalize = onFinalize;
|
|
3111
|
+
_this.shouldUnsubscribe = shouldUnsubscribe;
|
|
3112
|
+
_this._next = onNext
|
|
3113
|
+
? function (value) {
|
|
3114
|
+
try {
|
|
3115
|
+
onNext(value);
|
|
3116
|
+
}
|
|
3117
|
+
catch (err) {
|
|
3118
|
+
destination.error(err);
|
|
3119
|
+
}
|
|
3120
|
+
}
|
|
3121
|
+
: _super.prototype._next;
|
|
3122
|
+
_this._error = onError
|
|
3123
|
+
? function (err) {
|
|
3124
|
+
try {
|
|
3125
|
+
onError(err);
|
|
3126
|
+
}
|
|
3127
|
+
catch (err) {
|
|
3128
|
+
destination.error(err);
|
|
3129
|
+
}
|
|
3130
|
+
finally {
|
|
3131
|
+
this.unsubscribe();
|
|
3132
|
+
}
|
|
3133
|
+
}
|
|
3134
|
+
: _super.prototype._error;
|
|
3135
|
+
_this._complete = onComplete
|
|
3136
|
+
? function () {
|
|
3137
|
+
try {
|
|
3138
|
+
onComplete();
|
|
3139
|
+
}
|
|
3140
|
+
catch (err) {
|
|
3141
|
+
destination.error(err);
|
|
3142
|
+
}
|
|
3143
|
+
finally {
|
|
3144
|
+
this.unsubscribe();
|
|
3145
|
+
}
|
|
3146
|
+
}
|
|
3147
|
+
: _super.prototype._complete;
|
|
3148
|
+
return _this;
|
|
3149
|
+
}
|
|
3150
|
+
OperatorSubscriber.prototype.unsubscribe = function () {
|
|
3151
|
+
var _a;
|
|
3152
|
+
if (!this.shouldUnsubscribe || this.shouldUnsubscribe()) {
|
|
3153
|
+
var closed_1 = this.closed;
|
|
3154
|
+
_super.prototype.unsubscribe.call(this);
|
|
3155
|
+
!closed_1 && ((_a = this.onFinalize) === null || _a === void 0 ? void 0 : _a.call(this));
|
|
3156
|
+
}
|
|
3157
|
+
};
|
|
3158
|
+
return OperatorSubscriber;
|
|
3159
|
+
}(Subscriber));
|
|
3160
|
+
|
|
3161
|
+
function isScheduler(value) {
|
|
3162
|
+
return value && isFunction(value.schedule);
|
|
3163
|
+
}
|
|
3164
|
+
|
|
3165
|
+
function last(arr) {
|
|
3166
|
+
return arr[arr.length - 1];
|
|
3167
|
+
}
|
|
3168
|
+
function popScheduler(args) {
|
|
3169
|
+
return isScheduler(last(args)) ? args.pop() : undefined;
|
|
3170
|
+
}
|
|
3171
|
+
|
|
3172
|
+
var isArrayLike = (function (x) { return x && typeof x.length === 'number' && typeof x !== 'function'; });
|
|
3173
|
+
|
|
3174
|
+
function isPromise(value) {
|
|
3175
|
+
return isFunction(value === null || value === void 0 ? void 0 : value.then);
|
|
3176
|
+
}
|
|
3177
|
+
|
|
3178
|
+
function isInteropObservable(input) {
|
|
3179
|
+
return isFunction(input[observable]);
|
|
3180
|
+
}
|
|
3181
|
+
|
|
3182
|
+
function isAsyncIterable(obj) {
|
|
3183
|
+
return Symbol.asyncIterator && isFunction(obj === null || obj === void 0 ? void 0 : obj[Symbol.asyncIterator]);
|
|
3184
|
+
}
|
|
3185
|
+
|
|
3186
|
+
function createInvalidObservableTypeError(input) {
|
|
3187
|
+
return new TypeError("You provided " + (input !== null && typeof input === 'object' ? 'an invalid object' : "'" + input + "'") + " where a stream was expected. You can provide an Observable, Promise, ReadableStream, Array, AsyncIterable, or Iterable.");
|
|
3188
|
+
}
|
|
3189
|
+
|
|
3190
|
+
function getSymbolIterator() {
|
|
3191
|
+
if (typeof Symbol !== 'function' || !Symbol.iterator) {
|
|
3192
|
+
return '@@iterator';
|
|
3193
|
+
}
|
|
3194
|
+
return Symbol.iterator;
|
|
3195
|
+
}
|
|
3196
|
+
var iterator = getSymbolIterator();
|
|
3197
|
+
|
|
3198
|
+
function isIterable(input) {
|
|
3199
|
+
return isFunction(input === null || input === void 0 ? void 0 : input[iterator]);
|
|
3200
|
+
}
|
|
3201
|
+
|
|
3202
|
+
function readableStreamLikeToAsyncGenerator(readableStream) {
|
|
3203
|
+
return __asyncGenerator(this, arguments, function readableStreamLikeToAsyncGenerator_1() {
|
|
3204
|
+
var reader, _a, value, done;
|
|
3205
|
+
return __generator(this, function (_b) {
|
|
3206
|
+
switch (_b.label) {
|
|
3207
|
+
case 0:
|
|
3208
|
+
reader = readableStream.getReader();
|
|
3209
|
+
_b.label = 1;
|
|
3210
|
+
case 1:
|
|
3211
|
+
_b.trys.push([1, , 9, 10]);
|
|
3212
|
+
_b.label = 2;
|
|
3213
|
+
case 2:
|
|
3214
|
+
return [4, __await(reader.read())];
|
|
3215
|
+
case 3:
|
|
3216
|
+
_a = _b.sent(), value = _a.value, done = _a.done;
|
|
3217
|
+
if (!done) return [3, 5];
|
|
3218
|
+
return [4, __await(void 0)];
|
|
3219
|
+
case 4: return [2, _b.sent()];
|
|
3220
|
+
case 5: return [4, __await(value)];
|
|
3221
|
+
case 6: return [4, _b.sent()];
|
|
3222
|
+
case 7:
|
|
3223
|
+
_b.sent();
|
|
3224
|
+
return [3, 2];
|
|
3225
|
+
case 8: return [3, 10];
|
|
3226
|
+
case 9:
|
|
3227
|
+
reader.releaseLock();
|
|
3228
|
+
return [7];
|
|
3229
|
+
case 10: return [2];
|
|
3230
|
+
}
|
|
3231
|
+
});
|
|
3232
|
+
});
|
|
3233
|
+
}
|
|
3234
|
+
function isReadableStreamLike(obj) {
|
|
3235
|
+
return isFunction(obj === null || obj === void 0 ? void 0 : obj.getReader);
|
|
3236
|
+
}
|
|
3237
|
+
|
|
3238
|
+
function innerFrom(input) {
|
|
3239
|
+
if (input instanceof Observable) {
|
|
3240
|
+
return input;
|
|
3241
|
+
}
|
|
3242
|
+
if (input != null) {
|
|
3243
|
+
if (isInteropObservable(input)) {
|
|
3244
|
+
return fromInteropObservable(input);
|
|
3245
|
+
}
|
|
3246
|
+
if (isArrayLike(input)) {
|
|
3247
|
+
return fromArrayLike(input);
|
|
3248
|
+
}
|
|
3249
|
+
if (isPromise(input)) {
|
|
3250
|
+
return fromPromise(input);
|
|
3251
|
+
}
|
|
3252
|
+
if (isAsyncIterable(input)) {
|
|
3253
|
+
return fromAsyncIterable(input);
|
|
3254
|
+
}
|
|
3255
|
+
if (isIterable(input)) {
|
|
3256
|
+
return fromIterable(input);
|
|
3257
|
+
}
|
|
3258
|
+
if (isReadableStreamLike(input)) {
|
|
3259
|
+
return fromReadableStreamLike(input);
|
|
3260
|
+
}
|
|
3261
|
+
}
|
|
3262
|
+
throw createInvalidObservableTypeError(input);
|
|
3263
|
+
}
|
|
3264
|
+
function fromInteropObservable(obj) {
|
|
3265
|
+
return new Observable(function (subscriber) {
|
|
3266
|
+
var obs = obj[observable]();
|
|
3267
|
+
if (isFunction(obs.subscribe)) {
|
|
3268
|
+
return obs.subscribe(subscriber);
|
|
3269
|
+
}
|
|
3270
|
+
throw new TypeError('Provided object does not correctly implement Symbol.observable');
|
|
3271
|
+
});
|
|
3272
|
+
}
|
|
3273
|
+
function fromArrayLike(array) {
|
|
3274
|
+
return new Observable(function (subscriber) {
|
|
3275
|
+
for (var i = 0; i < array.length && !subscriber.closed; i++) {
|
|
3276
|
+
subscriber.next(array[i]);
|
|
3277
|
+
}
|
|
3278
|
+
subscriber.complete();
|
|
3279
|
+
});
|
|
3280
|
+
}
|
|
3281
|
+
function fromPromise(promise) {
|
|
3282
|
+
return new Observable(function (subscriber) {
|
|
3283
|
+
promise
|
|
3284
|
+
.then(function (value) {
|
|
3285
|
+
if (!subscriber.closed) {
|
|
3286
|
+
subscriber.next(value);
|
|
3287
|
+
subscriber.complete();
|
|
3288
|
+
}
|
|
3289
|
+
}, function (err) { return subscriber.error(err); })
|
|
3290
|
+
.then(null, reportUnhandledError);
|
|
3291
|
+
});
|
|
3292
|
+
}
|
|
3293
|
+
function fromIterable(iterable) {
|
|
3294
|
+
return new Observable(function (subscriber) {
|
|
3295
|
+
var e_1, _a;
|
|
3296
|
+
try {
|
|
3297
|
+
for (var iterable_1 = __values(iterable), iterable_1_1 = iterable_1.next(); !iterable_1_1.done; iterable_1_1 = iterable_1.next()) {
|
|
3298
|
+
var value = iterable_1_1.value;
|
|
3299
|
+
subscriber.next(value);
|
|
3300
|
+
if (subscriber.closed) {
|
|
3301
|
+
return;
|
|
3302
|
+
}
|
|
3303
|
+
}
|
|
3304
|
+
}
|
|
3305
|
+
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
3306
|
+
finally {
|
|
3307
|
+
try {
|
|
3308
|
+
if (iterable_1_1 && !iterable_1_1.done && (_a = iterable_1.return)) _a.call(iterable_1);
|
|
3309
|
+
}
|
|
3310
|
+
finally { if (e_1) throw e_1.error; }
|
|
3311
|
+
}
|
|
3312
|
+
subscriber.complete();
|
|
3313
|
+
});
|
|
3314
|
+
}
|
|
3315
|
+
function fromAsyncIterable(asyncIterable) {
|
|
3316
|
+
return new Observable(function (subscriber) {
|
|
3317
|
+
process(asyncIterable, subscriber).catch(function (err) { return subscriber.error(err); });
|
|
3318
|
+
});
|
|
3319
|
+
}
|
|
3320
|
+
function fromReadableStreamLike(readableStream) {
|
|
3321
|
+
return fromAsyncIterable(readableStreamLikeToAsyncGenerator(readableStream));
|
|
3322
|
+
}
|
|
3323
|
+
function process(asyncIterable, subscriber) {
|
|
3324
|
+
var asyncIterable_1, asyncIterable_1_1;
|
|
3325
|
+
var e_2, _a;
|
|
3326
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
3327
|
+
var value, e_2_1;
|
|
3328
|
+
return __generator(this, function (_b) {
|
|
3329
|
+
switch (_b.label) {
|
|
3330
|
+
case 0:
|
|
3331
|
+
_b.trys.push([0, 5, 6, 11]);
|
|
3332
|
+
asyncIterable_1 = __asyncValues(asyncIterable);
|
|
3333
|
+
_b.label = 1;
|
|
3334
|
+
case 1: return [4, asyncIterable_1.next()];
|
|
3335
|
+
case 2:
|
|
3336
|
+
if (!(asyncIterable_1_1 = _b.sent(), !asyncIterable_1_1.done)) return [3, 4];
|
|
3337
|
+
value = asyncIterable_1_1.value;
|
|
3338
|
+
subscriber.next(value);
|
|
3339
|
+
if (subscriber.closed) {
|
|
3340
|
+
return [2];
|
|
3341
|
+
}
|
|
3342
|
+
_b.label = 3;
|
|
3343
|
+
case 3: return [3, 1];
|
|
3344
|
+
case 4: return [3, 11];
|
|
3345
|
+
case 5:
|
|
3346
|
+
e_2_1 = _b.sent();
|
|
3347
|
+
e_2 = { error: e_2_1 };
|
|
3348
|
+
return [3, 11];
|
|
3349
|
+
case 6:
|
|
3350
|
+
_b.trys.push([6, , 9, 10]);
|
|
3351
|
+
if (!(asyncIterable_1_1 && !asyncIterable_1_1.done && (_a = asyncIterable_1.return))) return [3, 8];
|
|
3352
|
+
return [4, _a.call(asyncIterable_1)];
|
|
3353
|
+
case 7:
|
|
3354
|
+
_b.sent();
|
|
3355
|
+
_b.label = 8;
|
|
3356
|
+
case 8: return [3, 10];
|
|
3357
|
+
case 9:
|
|
3358
|
+
if (e_2) throw e_2.error;
|
|
3359
|
+
return [7];
|
|
3360
|
+
case 10: return [7];
|
|
3361
|
+
case 11:
|
|
3362
|
+
subscriber.complete();
|
|
3363
|
+
return [2];
|
|
3364
|
+
}
|
|
3365
|
+
});
|
|
3366
|
+
});
|
|
3367
|
+
}
|
|
3368
|
+
|
|
3369
|
+
function executeSchedule(parentSubscription, scheduler, work, delay, repeat) {
|
|
3370
|
+
if (delay === void 0) { delay = 0; }
|
|
3371
|
+
if (repeat === void 0) { repeat = false; }
|
|
3372
|
+
var scheduleSubscription = scheduler.schedule(function () {
|
|
3373
|
+
work();
|
|
3374
|
+
if (repeat) {
|
|
3375
|
+
parentSubscription.add(this.schedule(null, delay));
|
|
3376
|
+
}
|
|
3377
|
+
else {
|
|
3378
|
+
this.unsubscribe();
|
|
3379
|
+
}
|
|
3380
|
+
}, delay);
|
|
3381
|
+
parentSubscription.add(scheduleSubscription);
|
|
3382
|
+
if (!repeat) {
|
|
3383
|
+
return scheduleSubscription;
|
|
3384
|
+
}
|
|
3385
|
+
}
|
|
3386
|
+
|
|
3387
|
+
function observeOn(scheduler, delay) {
|
|
3388
|
+
if (delay === void 0) { delay = 0; }
|
|
3389
|
+
return operate(function (source, subscriber) {
|
|
3390
|
+
source.subscribe(createOperatorSubscriber(subscriber, function (value) { return executeSchedule(subscriber, scheduler, function () { return subscriber.next(value); }, delay); }, function () { return executeSchedule(subscriber, scheduler, function () { return subscriber.complete(); }, delay); }, function (err) { return executeSchedule(subscriber, scheduler, function () { return subscriber.error(err); }, delay); }));
|
|
3391
|
+
});
|
|
3392
|
+
}
|
|
3393
|
+
|
|
3394
|
+
function subscribeOn(scheduler, delay) {
|
|
3395
|
+
if (delay === void 0) { delay = 0; }
|
|
3396
|
+
return operate(function (source, subscriber) {
|
|
3397
|
+
subscriber.add(scheduler.schedule(function () { return source.subscribe(subscriber); }, delay));
|
|
3398
|
+
});
|
|
3399
|
+
}
|
|
3400
|
+
|
|
3401
|
+
function scheduleObservable(input, scheduler) {
|
|
3402
|
+
return innerFrom(input).pipe(subscribeOn(scheduler), observeOn(scheduler));
|
|
3403
|
+
}
|
|
3404
|
+
|
|
3405
|
+
function schedulePromise(input, scheduler) {
|
|
3406
|
+
return innerFrom(input).pipe(subscribeOn(scheduler), observeOn(scheduler));
|
|
3407
|
+
}
|
|
3408
|
+
|
|
3409
|
+
function scheduleArray(input, scheduler) {
|
|
3410
|
+
return new Observable(function (subscriber) {
|
|
3411
|
+
var i = 0;
|
|
3412
|
+
return scheduler.schedule(function () {
|
|
3413
|
+
if (i === input.length) {
|
|
3414
|
+
subscriber.complete();
|
|
3415
|
+
}
|
|
3416
|
+
else {
|
|
3417
|
+
subscriber.next(input[i++]);
|
|
3418
|
+
if (!subscriber.closed) {
|
|
3419
|
+
this.schedule();
|
|
3420
|
+
}
|
|
3421
|
+
}
|
|
3422
|
+
});
|
|
3423
|
+
});
|
|
3424
|
+
}
|
|
3425
|
+
|
|
3426
|
+
function scheduleIterable(input, scheduler) {
|
|
3427
|
+
return new Observable(function (subscriber) {
|
|
3428
|
+
var iterator$1;
|
|
3429
|
+
executeSchedule(subscriber, scheduler, function () {
|
|
3430
|
+
iterator$1 = input[iterator]();
|
|
3431
|
+
executeSchedule(subscriber, scheduler, function () {
|
|
3432
|
+
var _a;
|
|
3433
|
+
var value;
|
|
3434
|
+
var done;
|
|
3435
|
+
try {
|
|
3436
|
+
(_a = iterator$1.next(), value = _a.value, done = _a.done);
|
|
3437
|
+
}
|
|
3438
|
+
catch (err) {
|
|
3439
|
+
subscriber.error(err);
|
|
3440
|
+
return;
|
|
3441
|
+
}
|
|
3442
|
+
if (done) {
|
|
3443
|
+
subscriber.complete();
|
|
3444
|
+
}
|
|
3445
|
+
else {
|
|
3446
|
+
subscriber.next(value);
|
|
3447
|
+
}
|
|
3448
|
+
}, 0, true);
|
|
3449
|
+
});
|
|
3450
|
+
return function () { return isFunction(iterator$1 === null || iterator$1 === void 0 ? void 0 : iterator$1.return) && iterator$1.return(); };
|
|
3451
|
+
});
|
|
3452
|
+
}
|
|
3453
|
+
|
|
3454
|
+
function scheduleAsyncIterable(input, scheduler) {
|
|
3455
|
+
if (!input) {
|
|
3456
|
+
throw new Error('Iterable cannot be null');
|
|
3457
|
+
}
|
|
3458
|
+
return new Observable(function (subscriber) {
|
|
3459
|
+
executeSchedule(subscriber, scheduler, function () {
|
|
3460
|
+
var iterator = input[Symbol.asyncIterator]();
|
|
3461
|
+
executeSchedule(subscriber, scheduler, function () {
|
|
3462
|
+
iterator.next().then(function (result) {
|
|
3463
|
+
if (result.done) {
|
|
3464
|
+
subscriber.complete();
|
|
3465
|
+
}
|
|
3466
|
+
else {
|
|
3467
|
+
subscriber.next(result.value);
|
|
3468
|
+
}
|
|
3469
|
+
});
|
|
3470
|
+
}, 0, true);
|
|
3471
|
+
});
|
|
3472
|
+
});
|
|
3473
|
+
}
|
|
3474
|
+
|
|
3475
|
+
function scheduleReadableStreamLike(input, scheduler) {
|
|
3476
|
+
return scheduleAsyncIterable(readableStreamLikeToAsyncGenerator(input), scheduler);
|
|
3477
|
+
}
|
|
3478
|
+
|
|
3479
|
+
function scheduled(input, scheduler) {
|
|
3480
|
+
if (input != null) {
|
|
3481
|
+
if (isInteropObservable(input)) {
|
|
3482
|
+
return scheduleObservable(input, scheduler);
|
|
3483
|
+
}
|
|
3484
|
+
if (isArrayLike(input)) {
|
|
3485
|
+
return scheduleArray(input, scheduler);
|
|
3486
|
+
}
|
|
3487
|
+
if (isPromise(input)) {
|
|
3488
|
+
return schedulePromise(input, scheduler);
|
|
3489
|
+
}
|
|
3490
|
+
if (isAsyncIterable(input)) {
|
|
3491
|
+
return scheduleAsyncIterable(input, scheduler);
|
|
3492
|
+
}
|
|
3493
|
+
if (isIterable(input)) {
|
|
3494
|
+
return scheduleIterable(input, scheduler);
|
|
3495
|
+
}
|
|
3496
|
+
if (isReadableStreamLike(input)) {
|
|
3497
|
+
return scheduleReadableStreamLike(input, scheduler);
|
|
3498
|
+
}
|
|
3499
|
+
}
|
|
3500
|
+
throw createInvalidObservableTypeError(input);
|
|
3501
|
+
}
|
|
3502
|
+
|
|
3503
|
+
function from(input, scheduler) {
|
|
3504
|
+
return scheduler ? scheduled(input, scheduler) : innerFrom(input);
|
|
3505
|
+
}
|
|
3506
|
+
|
|
3507
|
+
function of() {
|
|
3508
|
+
var args = [];
|
|
3509
|
+
for (var _i = 0; _i < arguments.length; _i++) {
|
|
3510
|
+
args[_i] = arguments[_i];
|
|
3511
|
+
}
|
|
3512
|
+
var scheduler = popScheduler(args);
|
|
3513
|
+
return from(args, scheduler);
|
|
3514
|
+
}
|
|
3515
|
+
|
|
3516
|
+
function isObservable(obj) {
|
|
3517
|
+
return !!obj && (obj instanceof Observable || (isFunction(obj.lift) && isFunction(obj.subscribe)));
|
|
3518
|
+
}
|
|
3519
|
+
|
|
3520
|
+
const toObservable$ = (x) => isObservable(x) ? x : of(x);
|
|
3521
|
+
|
|
3522
|
+
const { TAB, DEL, LF, CR, MAX_CONTROL } = JsonSpecialCharactersAscii;
|
|
3523
|
+
const { BOM, QUOTE, LINE_SEPARATOR, PARAGRAPH_SEPARATOR, BACKSLASH } = JsonSpecialCharactersUnicode;
|
|
3524
|
+
function validateJson(json, dangerousKeys = DefaultBannedInJsonKeys, options = {}) {
|
|
3525
|
+
if (typeof json !== "string" || json.length === 0) throw new Error("[JSON] Invalid input: JSON must be a non-empty string");
|
|
3526
|
+
const maxBytes = options.maxBytes ?? 5 * 1024 * 1024;
|
|
3527
|
+
const maxDepth = options.maxDepth ?? 200;
|
|
3528
|
+
const byteSize = Buffer.byteLength(json, "utf8");
|
|
3529
|
+
if (byteSize > maxBytes) throw new Error(`[JSON] The size is too large: ${byteSize} bytes (limit ${maxBytes})`);
|
|
3530
|
+
scanText(json);
|
|
3531
|
+
let parsedData;
|
|
3532
|
+
try {
|
|
3533
|
+
parsedData = JSON.parse(json);
|
|
3534
|
+
} catch (error) {
|
|
3535
|
+
throw new Error(`[JSON] Parse failed: ${error.message}`);
|
|
3536
|
+
}
|
|
3537
|
+
assertTree(parsedData, maxDepth, dangerousKeys);
|
|
3538
|
+
return parsedData;
|
|
3539
|
+
}
|
|
3540
|
+
function getContext(text, index, radius = 24) {
|
|
3541
|
+
const start = Math.max(0, index - radius);
|
|
3542
|
+
const end = Math.min(text.length, index + radius);
|
|
3543
|
+
const char = text[index] ?? "";
|
|
3544
|
+
return text.slice(start, index) + "⟦" + char + "⟧" + text.slice(index + 1, end);
|
|
3545
|
+
}
|
|
3546
|
+
function isAllowedControlCharacter(charCode) {
|
|
3547
|
+
return charCode === TAB || charCode === LF || charCode === CR;
|
|
3548
|
+
}
|
|
3549
|
+
function isControlCharacter(charCode) {
|
|
3550
|
+
return charCode <= MAX_CONTROL || charCode === DEL;
|
|
3551
|
+
}
|
|
3552
|
+
function validateCharacterOutsideString(charCode, index, text) {
|
|
3553
|
+
if (isControlCharacter(charCode) && !isAllowedControlCharacter(charCode)) {
|
|
3554
|
+
const hexCode = charCode.toString(16).padStart(4, "0").toUpperCase();
|
|
3555
|
+
throw new Error(`[JSON] Invalid control outside string at index ${index} (U+${hexCode}).
|
|
3556
|
+
${getContext(text, index)}`);
|
|
3557
|
+
}
|
|
3558
|
+
if (charCode === LINE_SEPARATOR || charCode === PARAGRAPH_SEPARATOR) {
|
|
3559
|
+
const hexCode = charCode.toString(16).toUpperCase();
|
|
3560
|
+
throw new Error(`[JSON] Disallowed U+${hexCode} outside string at index ${index}.
|
|
3561
|
+
${getContext(text, index)}`);
|
|
3562
|
+
}
|
|
3563
|
+
}
|
|
3564
|
+
function validateCharacterInsideString(charCode, index, text) {
|
|
3565
|
+
if (isControlCharacter(charCode)) {
|
|
3566
|
+
const hexCode = charCode.toString(16).padStart(4, "0").toUpperCase();
|
|
3567
|
+
throw new Error(`[JSON] Unescaped control in string at index ${index} (U+${hexCode}).
|
|
3568
|
+
Controls must be escaped as \\n, \\t, \\r or \\u00XX.
|
|
3569
|
+
${getContext(text, index)}`);
|
|
3570
|
+
}
|
|
3571
|
+
}
|
|
3572
|
+
function scanText(raw) {
|
|
3573
|
+
if (raw.charCodeAt(0) === BOM) throw new Error(`[JSON] Invalid JSON text: BOM U+FEFF at start.
|
|
3574
|
+
${getContext(raw, 0)}`);
|
|
3575
|
+
let inString = false;
|
|
3576
|
+
let isEscaped = false;
|
|
3577
|
+
Array.from(raw).forEach((_char, index) => {
|
|
3578
|
+
const charCode = raw.charCodeAt(index);
|
|
3579
|
+
if (!inString) {
|
|
3580
|
+
validateCharacterOutsideString(charCode, index, raw);
|
|
3581
|
+
if (charCode === QUOTE) {
|
|
3582
|
+
inString = true;
|
|
3583
|
+
isEscaped = false;
|
|
3584
|
+
}
|
|
3585
|
+
return;
|
|
3586
|
+
}
|
|
3587
|
+
if (isEscaped) {
|
|
3588
|
+
isEscaped = false;
|
|
3589
|
+
return;
|
|
3590
|
+
}
|
|
3591
|
+
if (charCode === BACKSLASH) {
|
|
3592
|
+
isEscaped = true;
|
|
3593
|
+
return;
|
|
3594
|
+
}
|
|
3595
|
+
if (charCode === QUOTE) {
|
|
3596
|
+
inString = false;
|
|
3597
|
+
return;
|
|
3598
|
+
}
|
|
3599
|
+
validateCharacterInsideString(charCode, index, raw);
|
|
3600
|
+
});
|
|
3601
|
+
}
|
|
3602
|
+
function assertTree(value, maxDepth, dangerousKeys, path = "", depth = 0) {
|
|
3603
|
+
if (depth > maxDepth) {
|
|
3604
|
+
const location = path || "<root>";
|
|
3605
|
+
throw new Error(`[JSON] Max depth exceeded at ${location} (> ${maxDepth})`);
|
|
3606
|
+
}
|
|
3607
|
+
if (value === null || typeof value !== "object") return;
|
|
3608
|
+
if (Array.isArray(value)) {
|
|
3609
|
+
value.forEach((item, index) => {
|
|
3610
|
+
const itemPath = `${path}[${index}]`;
|
|
3611
|
+
assertTree(item, maxDepth, dangerousKeys, itemPath, depth + 1);
|
|
3612
|
+
});
|
|
3613
|
+
return;
|
|
3614
|
+
}
|
|
3615
|
+
const obj = value;
|
|
3616
|
+
Object.keys(obj).forEach((key) => {
|
|
3617
|
+
if (dangerousKeys.includes(key)) {
|
|
3618
|
+
const keyPath2 = path ? `${path}.${key}` : key;
|
|
3619
|
+
throw new Error(`[JSON] Dangerous key "${key}" at ${keyPath2}`);
|
|
3620
|
+
}
|
|
3621
|
+
const keyPath = path ? `${path}.${key}` : key;
|
|
3622
|
+
assertTree(obj[key], maxDepth, dangerousKeys, keyPath, depth + 1);
|
|
3623
|
+
});
|
|
3624
|
+
}
|
|
3625
|
+
|
|
3626
|
+
function camelToKebab(str) {
|
|
3627
|
+
return str.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase();
|
|
3628
|
+
}
|
|
3629
|
+
function kebabToCamel(input) {
|
|
3630
|
+
if (!input.includes("-")) return input;
|
|
3631
|
+
return input.toLowerCase().split("-").map((part, index) => index === 0 ? part : part.charAt(0).toUpperCase() + part.slice(1)).join("");
|
|
3632
|
+
}
|
|
3633
|
+
|
|
3634
|
+
function parseDistName(distName) {
|
|
3635
|
+
if (!distName) return { platform: "unknown", arch: "unknown" };
|
|
3636
|
+
const parts = distName.toLowerCase().trim().split("-");
|
|
3637
|
+
const [platform, arch] = parts;
|
|
3638
|
+
return { platform: platform || "unknown", arch: arch || "unknown" };
|
|
3639
|
+
}
|
|
3640
|
+
|
|
3641
|
+
function nullsToUndefined(obj) {
|
|
3642
|
+
const result = {};
|
|
3643
|
+
for (const key in obj) {
|
|
3644
|
+
const value = obj[key];
|
|
3645
|
+
result[key] = value === null ? void 0 : value;
|
|
3646
|
+
}
|
|
3647
|
+
return result;
|
|
3648
|
+
}
|
|
3649
|
+
|
|
3650
|
+
const getQueryParams = (urlString = window.location.href) => {
|
|
3651
|
+
const url = new URL(urlString);
|
|
3652
|
+
const entries = Array.from(url.searchParams.entries());
|
|
3653
|
+
return Object.fromEntries(entries);
|
|
3654
|
+
};
|
|
3655
|
+
function buildPublicUrl(baseUrl, relPath) {
|
|
3656
|
+
const base = new URL(baseUrl, window.location.origin);
|
|
3657
|
+
const clean = relPath.replace(/^\/+/, "");
|
|
3658
|
+
return new URL(clean, base).toString();
|
|
3659
|
+
}
|
|
3660
|
+
|
|
3661
|
+
function isWebGLAvailable() {
|
|
3662
|
+
let canvas = void 0;
|
|
3663
|
+
try {
|
|
3664
|
+
if (!window || !document) return false;
|
|
3665
|
+
canvas = document.createElement("canvas");
|
|
3666
|
+
if (!canvas) return false;
|
|
3667
|
+
return !!(window.WebGLRenderingContext && (canvas.getContext("webgl") || canvas.getContext("experimental-webgl")));
|
|
3668
|
+
} catch {
|
|
3669
|
+
return false;
|
|
3670
|
+
} finally {
|
|
3671
|
+
canvas = void 0;
|
|
3672
|
+
}
|
|
3673
|
+
}
|
|
3674
|
+
function isWebGL2Available() {
|
|
3675
|
+
let canvas = void 0;
|
|
3676
|
+
try {
|
|
3677
|
+
if (!window || !document) return false;
|
|
3678
|
+
canvas = document.createElement("canvas");
|
|
3679
|
+
if (!canvas) return false;
|
|
3680
|
+
return !!(window.WebGL2RenderingContext && canvas.getContext("webgl2"));
|
|
3681
|
+
} finally {
|
|
3682
|
+
canvas = void 0;
|
|
3683
|
+
}
|
|
3684
|
+
}
|
|
3685
|
+
|
|
3686
|
+
export { asRecord, buildPublicUrl, camelToKebab, clamp, cleanObject, createDeferredPromise, filterOutEmptyFields, filterOutEmptyFieldsRecursive, findDuplicateString, findInMap, findKeyInMap, findKeyWithValue, forEachEnum, getBaseTextSize, getBrowserInfo, getFileExtension, getHumanReadableMemorySize, getQueryParams, getUnitsFromCssValue, isAllDefined, isAllNotDefined, isBoolean, isDefined, isEmptyObject, isNotDefined, isObject, isString, isWebGL2Available, isWebGLAvailable, kebabToCamel, nullsToUndefined, omitInArray, omitInObjectWithMutation, omitInObjectWithoutMutation, parseDistName, patchObject, removeDuplicates, removeDuplicatesStr, stripUnits, toBool, toInt, toObservable$, toPosix, toPx, toRem, validateJson };
|
|
3687
|
+
//# sourceMappingURL=index.es.js.map
|