@kne/form-info 0.1.0-alpha.0 → 0.1.0-alpha.2
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/README.md +143 -4
- package/dist/index.css +26 -1
- package/dist/index.css.map +1 -1
- package/dist/index.js +3976 -45
- package/dist/index.js.map +1 -1
- package/dist/index.modern.js +3989 -72
- package/dist/index.modern.js.map +1 -1
- package/package.json +8 -4
package/dist/index.js
CHANGED
|
@@ -6,11 +6,15 @@ var InfoPage = require('@kne/info-page');
|
|
|
6
6
|
var flexBox = require('@kne/flex-box');
|
|
7
7
|
var reactFormPlus = require('@kne/react-form-plus');
|
|
8
8
|
var antd = require('antd');
|
|
9
|
+
var icons = require('@ant-design/icons');
|
|
10
|
+
var globalContext = require('@kne/global-context');
|
|
11
|
+
var useControlValue = require('@kne/use-control-value');
|
|
9
12
|
|
|
10
13
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
11
14
|
|
|
12
15
|
var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
13
16
|
var InfoPage__default = /*#__PURE__*/_interopDefaultLegacy(InfoPage);
|
|
17
|
+
var useControlValue__default = /*#__PURE__*/_interopDefaultLegacy(useControlValue);
|
|
14
18
|
|
|
15
19
|
function _extends() {
|
|
16
20
|
return _extends = Object.assign ? Object.assign.bind() : function (n) {
|
|
@@ -22,6 +26,8 @@ function _extends() {
|
|
|
22
26
|
}, _extends.apply(null, arguments);
|
|
23
27
|
}
|
|
24
28
|
|
|
29
|
+
var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
|
|
30
|
+
|
|
25
31
|
function createCommonjsModule(fn) {
|
|
26
32
|
var module = { exports: {} };
|
|
27
33
|
return fn(module, module.exports), module.exports;
|
|
@@ -102,7 +108,7 @@ var classnames = createCommonjsModule(function (module) {
|
|
|
102
108
|
}());
|
|
103
109
|
});
|
|
104
110
|
|
|
105
|
-
var style = {"form-outer":"_ZQNNL","form-info":"_GW4Xx","extra-btn":"_eY4qR","list-part":"_SL3dC","list-item":"_PNnMa","is-important":"_Xkp38","list-item-part":"_HiB5Q","table-list-inner":"_Uw-3T","multi-field-item":"_uogqr","
|
|
111
|
+
var style = {"form-outer":"_ZQNNL","form-info":"_GW4Xx","extra-btn":"_eY4qR","list-part":"_SL3dC","list-item":"_PNnMa","is-important":"_Xkp38","list-item-part":"_HiB5Q","table-list-inner":"_Uw-3T","multi-field-item":"_uogqr","react-form__field-label":"_UGjS9","multi-field-add-btn":"_rjVPh","table-list":"_r8-bn","table-list-field":"_Qkutm","table-list-header":"_9WdfD","is-req":"_CsPaL","table-options":"_8smwK","steps":"_IOdkE","steps-form-inner":"_uc1HZ","steps-modal":"_vWPQO"};
|
|
106
112
|
|
|
107
113
|
const FormInfo = props => {
|
|
108
114
|
const {
|
|
@@ -161,26 +167,37 @@ const FormInfo = props => {
|
|
|
161
167
|
}), renderColumn());
|
|
162
168
|
};
|
|
163
169
|
|
|
164
|
-
const List =
|
|
170
|
+
const List = p => {
|
|
171
|
+
const {
|
|
172
|
+
locale: contextLocale
|
|
173
|
+
} = globalContext.useContext();
|
|
174
|
+
const locale = Object.assign({}, {
|
|
175
|
+
添加: '添加',
|
|
176
|
+
删除: '删除'
|
|
177
|
+
}, contextLocale, p.locale);
|
|
165
178
|
const {
|
|
166
179
|
className,
|
|
180
|
+
itemClassName,
|
|
167
181
|
removeIcon,
|
|
168
182
|
removeText,
|
|
169
183
|
addText,
|
|
170
184
|
addIcon,
|
|
171
185
|
important,
|
|
186
|
+
title,
|
|
172
187
|
...others
|
|
173
188
|
} = Object.assign({}, {
|
|
174
|
-
addText: '添加',
|
|
175
|
-
addIcon: null,
|
|
176
|
-
removeText: '删除',
|
|
177
|
-
removeIcon: null,
|
|
189
|
+
addText: locale['添加'],
|
|
190
|
+
addIcon: /*#__PURE__*/React__default["default"].createElement(icons.PlusOutlined, null),
|
|
191
|
+
removeText: locale['删除'],
|
|
192
|
+
removeIcon: /*#__PURE__*/React__default["default"].createElement(icons.DeleteOutlined, null),
|
|
178
193
|
empty: /*#__PURE__*/React__default["default"].createElement(antd.Empty, {
|
|
179
194
|
description: false
|
|
180
195
|
})
|
|
181
|
-
},
|
|
196
|
+
}, p, {
|
|
197
|
+
locale
|
|
198
|
+
});
|
|
182
199
|
return /*#__PURE__*/React__default["default"].createElement(reactFormPlus.SubList, _extends({}, others, {
|
|
183
|
-
className: classnames(className, style[
|
|
200
|
+
className: classnames(className, style['list-part']),
|
|
184
201
|
listRender: _ref => {
|
|
185
202
|
let {
|
|
186
203
|
id,
|
|
@@ -192,11 +209,11 @@ const List = props => {
|
|
|
192
209
|
} = _ref;
|
|
193
210
|
return /*#__PURE__*/React__default["default"].createElement("div", {
|
|
194
211
|
key: id,
|
|
195
|
-
className: classnames(style[
|
|
196
|
-
[style[
|
|
212
|
+
className: classnames(style['list-item'], {
|
|
213
|
+
[style['is-important']]: important
|
|
197
214
|
})
|
|
198
215
|
}, /*#__PURE__*/React__default["default"].createElement(FormInfo, _extends({}, props, {
|
|
199
|
-
className: style[
|
|
216
|
+
className: style['list-item-part'],
|
|
200
217
|
gap: 16,
|
|
201
218
|
extra: allowRemove && /*#__PURE__*/React__default["default"].createElement(antd.Button, {
|
|
202
219
|
type: "link",
|
|
@@ -210,21 +227,27 @@ const List = props => {
|
|
|
210
227
|
}), (children, _ref2) => {
|
|
211
228
|
let {
|
|
212
229
|
allowAdd,
|
|
213
|
-
onAdd
|
|
214
|
-
isUnshift,
|
|
215
|
-
...others
|
|
230
|
+
onAdd
|
|
216
231
|
} = _ref2;
|
|
217
|
-
return /*#__PURE__*/React__default["default"].createElement(InfoPage__default["default"].Part,
|
|
232
|
+
return /*#__PURE__*/React__default["default"].createElement(InfoPage__default["default"].Part, {
|
|
233
|
+
className: itemClassName,
|
|
234
|
+
title: title,
|
|
218
235
|
extra: allowAdd && /*#__PURE__*/React__default["default"].createElement(antd.Button, {
|
|
219
236
|
className: style['extra-btn'],
|
|
220
237
|
icon: addIcon,
|
|
221
238
|
onClick: onAdd
|
|
222
239
|
}, addText)
|
|
223
|
-
}
|
|
240
|
+
}, children);
|
|
224
241
|
});
|
|
225
242
|
};
|
|
226
243
|
|
|
227
|
-
const MultiField =
|
|
244
|
+
const MultiField = p => {
|
|
245
|
+
const {
|
|
246
|
+
locale: contextLocale
|
|
247
|
+
} = globalContext.useContext();
|
|
248
|
+
const locale = Object.assign({}, {
|
|
249
|
+
添加: '添加'
|
|
250
|
+
}, contextLocale, p.locale);
|
|
228
251
|
const {
|
|
229
252
|
className,
|
|
230
253
|
addText,
|
|
@@ -233,35 +256,33 @@ const MultiField = props => {
|
|
|
233
256
|
removeText,
|
|
234
257
|
...others
|
|
235
258
|
} = Object.assign({}, {
|
|
236
|
-
addText: '添加',
|
|
237
|
-
addIcon: null,
|
|
238
|
-
removeIcon: null,
|
|
239
|
-
removeText:
|
|
259
|
+
addText: locale['添加'],
|
|
260
|
+
addIcon: /*#__PURE__*/React__default["default"].createElement(icons.PlusOutlined, null),
|
|
261
|
+
removeIcon: /*#__PURE__*/React__default["default"].createElement(icons.DeleteOutlined, null),
|
|
262
|
+
removeText: null,
|
|
240
263
|
empty: /*#__PURE__*/React__default["default"].createElement(antd.Empty, {
|
|
241
264
|
description: false
|
|
242
265
|
})
|
|
243
|
-
},
|
|
266
|
+
}, p, {
|
|
267
|
+
locale
|
|
268
|
+
});
|
|
244
269
|
return /*#__PURE__*/React__default["default"].createElement(reactFormPlus.MultiField, _extends({}, others, {
|
|
245
270
|
itemRender: (children, _ref) => {
|
|
246
271
|
let {
|
|
247
272
|
id,
|
|
248
|
-
index,
|
|
249
273
|
allowRemove,
|
|
250
274
|
onRemove
|
|
251
275
|
} = _ref;
|
|
252
276
|
return /*#__PURE__*/React__default["default"].createElement("div", {
|
|
253
277
|
key: id,
|
|
254
|
-
className: classnames(
|
|
255
|
-
[style["first-item"]]: index === 0
|
|
256
|
-
})
|
|
278
|
+
className: classnames('multi-field-item', style['multi-field-item'])
|
|
257
279
|
}, children, /*#__PURE__*/React__default["default"].createElement("div", null, /*#__PURE__*/React__default["default"].createElement("div", {
|
|
258
|
-
className: classnames(style[
|
|
280
|
+
className: classnames(style['react-form__field-label'], 'react-form__field-label', 'multi-field-delete-label')
|
|
259
281
|
}), /*#__PURE__*/React__default["default"].createElement(antd.Button, {
|
|
260
|
-
danger: true,
|
|
261
282
|
icon: removeIcon,
|
|
262
283
|
onClick: onRemove,
|
|
263
284
|
disabled: !allowRemove
|
|
264
|
-
}, removeText)));
|
|
285
|
+
}, typeof removeText === 'function' ? removeText(others.label) : removeText)));
|
|
265
286
|
}
|
|
266
287
|
}), (children, _ref2) => {
|
|
267
288
|
let {
|
|
@@ -271,7 +292,7 @@ const MultiField = props => {
|
|
|
271
292
|
return /*#__PURE__*/React__default["default"].createElement("div", {
|
|
272
293
|
className: classnames(className, 'multi-field', style['multi-field'])
|
|
273
294
|
}, children, allowAdd && /*#__PURE__*/React__default["default"].createElement(antd.Button, {
|
|
274
|
-
className: classnames(
|
|
295
|
+
className: classnames('multi-field-add-btn', style['multi-field-add-btn']),
|
|
275
296
|
type: "dashed",
|
|
276
297
|
onClick: onAdd,
|
|
277
298
|
icon: addIcon
|
|
@@ -279,23 +300,33 @@ const MultiField = props => {
|
|
|
279
300
|
});
|
|
280
301
|
};
|
|
281
302
|
|
|
282
|
-
const TableList =
|
|
303
|
+
const TableList = p => {
|
|
304
|
+
const {
|
|
305
|
+
locale: contextLocale
|
|
306
|
+
} = globalContext.useContext();
|
|
307
|
+
const locale = Object.assign({}, {
|
|
308
|
+
添加: '添加',
|
|
309
|
+
删除: '删除'
|
|
310
|
+
}, contextLocale, p.locale);
|
|
283
311
|
const {
|
|
284
312
|
className,
|
|
285
313
|
addIcon,
|
|
286
314
|
addText,
|
|
287
315
|
removeIcon,
|
|
288
316
|
removeText,
|
|
317
|
+
title,
|
|
289
318
|
...others
|
|
290
319
|
} = Object.assign({}, {
|
|
291
320
|
empty: /*#__PURE__*/React__default["default"].createElement(antd.Empty, {
|
|
292
321
|
description: false
|
|
293
322
|
}),
|
|
294
|
-
addIcon: null,
|
|
295
|
-
addText: '添加',
|
|
296
|
-
removeIcon: null,
|
|
297
|
-
removeText: '删除'
|
|
298
|
-
},
|
|
323
|
+
addIcon: /*#__PURE__*/React__default["default"].createElement(icons.PlusOutlined, null),
|
|
324
|
+
addText: locale['添加'],
|
|
325
|
+
removeIcon: /*#__PURE__*/React__default["default"].createElement(icons.DeleteOutlined, null),
|
|
326
|
+
removeText: locale['删除']
|
|
327
|
+
}, p, {
|
|
328
|
+
locale
|
|
329
|
+
});
|
|
299
330
|
return /*#__PURE__*/React__default["default"].createElement(reactFormPlus.TableList, _extends({}, others, {
|
|
300
331
|
headerRender: (children, _ref) => {
|
|
301
332
|
let {
|
|
@@ -305,7 +336,7 @@ const TableList = props => {
|
|
|
305
336
|
className: style['table-list-header'],
|
|
306
337
|
wrap: false,
|
|
307
338
|
style: {
|
|
308
|
-
|
|
339
|
+
'--col-width': width
|
|
309
340
|
}
|
|
310
341
|
}, children, /*#__PURE__*/React__default["default"].createElement(antd.Col, {
|
|
311
342
|
className: style['table-options']
|
|
@@ -318,7 +349,7 @@ const TableList = props => {
|
|
|
318
349
|
} = _ref2;
|
|
319
350
|
return /*#__PURE__*/React__default["default"].createElement(antd.Col, {
|
|
320
351
|
className: classnames({
|
|
321
|
-
[style[
|
|
352
|
+
[style['is-req']]: isReq
|
|
322
353
|
}),
|
|
323
354
|
key: id
|
|
324
355
|
}, children);
|
|
@@ -341,7 +372,7 @@ const TableList = props => {
|
|
|
341
372
|
wrap: false,
|
|
342
373
|
align: "top",
|
|
343
374
|
style: {
|
|
344
|
-
|
|
375
|
+
'--col-width': width
|
|
345
376
|
}
|
|
346
377
|
}, children, /*#__PURE__*/React__default["default"].createElement(antd.Col, {
|
|
347
378
|
className: style['table-options']
|
|
@@ -356,17 +387,17 @@ const TableList = props => {
|
|
|
356
387
|
}), (children, _ref4) => {
|
|
357
388
|
let {
|
|
358
389
|
onAdd,
|
|
359
|
-
allowAdd
|
|
360
|
-
...others
|
|
390
|
+
allowAdd
|
|
361
391
|
} = _ref4;
|
|
362
|
-
return /*#__PURE__*/React__default["default"].createElement(InfoPage__default["default"].Part,
|
|
363
|
-
|
|
392
|
+
return /*#__PURE__*/React__default["default"].createElement(InfoPage__default["default"].Part, {
|
|
393
|
+
title: title,
|
|
394
|
+
className: classnames(className, style['table-list']),
|
|
364
395
|
extra: allowAdd && /*#__PURE__*/React__default["default"].createElement(antd.Button, {
|
|
365
396
|
className: style['extra-btn'],
|
|
366
397
|
icon: addIcon,
|
|
367
398
|
onClick: onAdd
|
|
368
399
|
}, addText)
|
|
369
|
-
}
|
|
400
|
+
}, /*#__PURE__*/React__default["default"].createElement("div", {
|
|
370
401
|
className: style['table-list-inner']
|
|
371
402
|
}, children));
|
|
372
403
|
});
|
|
@@ -382,11 +413,3911 @@ const Form = React.forwardRef((props, ref) => {
|
|
|
382
413
|
}, props);
|
|
383
414
|
return /*#__PURE__*/React__default["default"].createElement(reactFormAntd.FormAntd, _extends({}, others, {
|
|
384
415
|
ref: ref,
|
|
385
|
-
className: classnames(className, style[
|
|
416
|
+
className: classnames(className, style['form-outer'])
|
|
386
417
|
}), /*#__PURE__*/React__default["default"].createElement(InfoPage__default["default"], null, children));
|
|
387
418
|
});
|
|
388
419
|
|
|
420
|
+
/**
|
|
421
|
+
* A specialized version of `_.map` for arrays without support for iteratee
|
|
422
|
+
* shorthands.
|
|
423
|
+
*
|
|
424
|
+
* @private
|
|
425
|
+
* @param {Array} [array] The array to iterate over.
|
|
426
|
+
* @param {Function} iteratee The function invoked per iteration.
|
|
427
|
+
* @returns {Array} Returns the new mapped array.
|
|
428
|
+
*/
|
|
429
|
+
function arrayMap(array, iteratee) {
|
|
430
|
+
var index = -1,
|
|
431
|
+
length = array == null ? 0 : array.length,
|
|
432
|
+
result = Array(length);
|
|
433
|
+
|
|
434
|
+
while (++index < length) {
|
|
435
|
+
result[index] = iteratee(array[index], index, array);
|
|
436
|
+
}
|
|
437
|
+
return result;
|
|
438
|
+
}
|
|
439
|
+
|
|
440
|
+
var _arrayMap = arrayMap;
|
|
441
|
+
|
|
442
|
+
/**
|
|
443
|
+
* Removes all key-value entries from the list cache.
|
|
444
|
+
*
|
|
445
|
+
* @private
|
|
446
|
+
* @name clear
|
|
447
|
+
* @memberOf ListCache
|
|
448
|
+
*/
|
|
449
|
+
function listCacheClear() {
|
|
450
|
+
this.__data__ = [];
|
|
451
|
+
this.size = 0;
|
|
452
|
+
}
|
|
453
|
+
|
|
454
|
+
var _listCacheClear = listCacheClear;
|
|
455
|
+
|
|
456
|
+
/**
|
|
457
|
+
* Performs a
|
|
458
|
+
* [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
|
|
459
|
+
* comparison between two values to determine if they are equivalent.
|
|
460
|
+
*
|
|
461
|
+
* @static
|
|
462
|
+
* @memberOf _
|
|
463
|
+
* @since 4.0.0
|
|
464
|
+
* @category Lang
|
|
465
|
+
* @param {*} value The value to compare.
|
|
466
|
+
* @param {*} other The other value to compare.
|
|
467
|
+
* @returns {boolean} Returns `true` if the values are equivalent, else `false`.
|
|
468
|
+
* @example
|
|
469
|
+
*
|
|
470
|
+
* var object = { 'a': 1 };
|
|
471
|
+
* var other = { 'a': 1 };
|
|
472
|
+
*
|
|
473
|
+
* _.eq(object, object);
|
|
474
|
+
* // => true
|
|
475
|
+
*
|
|
476
|
+
* _.eq(object, other);
|
|
477
|
+
* // => false
|
|
478
|
+
*
|
|
479
|
+
* _.eq('a', 'a');
|
|
480
|
+
* // => true
|
|
481
|
+
*
|
|
482
|
+
* _.eq('a', Object('a'));
|
|
483
|
+
* // => false
|
|
484
|
+
*
|
|
485
|
+
* _.eq(NaN, NaN);
|
|
486
|
+
* // => true
|
|
487
|
+
*/
|
|
488
|
+
function eq(value, other) {
|
|
489
|
+
return value === other || (value !== value && other !== other);
|
|
490
|
+
}
|
|
491
|
+
|
|
492
|
+
var eq_1 = eq;
|
|
493
|
+
|
|
494
|
+
/**
|
|
495
|
+
* Gets the index at which the `key` is found in `array` of key-value pairs.
|
|
496
|
+
*
|
|
497
|
+
* @private
|
|
498
|
+
* @param {Array} array The array to inspect.
|
|
499
|
+
* @param {*} key The key to search for.
|
|
500
|
+
* @returns {number} Returns the index of the matched value, else `-1`.
|
|
501
|
+
*/
|
|
502
|
+
function assocIndexOf(array, key) {
|
|
503
|
+
var length = array.length;
|
|
504
|
+
while (length--) {
|
|
505
|
+
if (eq_1(array[length][0], key)) {
|
|
506
|
+
return length;
|
|
507
|
+
}
|
|
508
|
+
}
|
|
509
|
+
return -1;
|
|
510
|
+
}
|
|
511
|
+
|
|
512
|
+
var _assocIndexOf = assocIndexOf;
|
|
513
|
+
|
|
514
|
+
/** Used for built-in method references. */
|
|
515
|
+
var arrayProto = Array.prototype;
|
|
516
|
+
|
|
517
|
+
/** Built-in value references. */
|
|
518
|
+
var splice = arrayProto.splice;
|
|
519
|
+
|
|
520
|
+
/**
|
|
521
|
+
* Removes `key` and its value from the list cache.
|
|
522
|
+
*
|
|
523
|
+
* @private
|
|
524
|
+
* @name delete
|
|
525
|
+
* @memberOf ListCache
|
|
526
|
+
* @param {string} key The key of the value to remove.
|
|
527
|
+
* @returns {boolean} Returns `true` if the entry was removed, else `false`.
|
|
528
|
+
*/
|
|
529
|
+
function listCacheDelete(key) {
|
|
530
|
+
var data = this.__data__,
|
|
531
|
+
index = _assocIndexOf(data, key);
|
|
532
|
+
|
|
533
|
+
if (index < 0) {
|
|
534
|
+
return false;
|
|
535
|
+
}
|
|
536
|
+
var lastIndex = data.length - 1;
|
|
537
|
+
if (index == lastIndex) {
|
|
538
|
+
data.pop();
|
|
539
|
+
} else {
|
|
540
|
+
splice.call(data, index, 1);
|
|
541
|
+
}
|
|
542
|
+
--this.size;
|
|
543
|
+
return true;
|
|
544
|
+
}
|
|
545
|
+
|
|
546
|
+
var _listCacheDelete = listCacheDelete;
|
|
547
|
+
|
|
548
|
+
/**
|
|
549
|
+
* Gets the list cache value for `key`.
|
|
550
|
+
*
|
|
551
|
+
* @private
|
|
552
|
+
* @name get
|
|
553
|
+
* @memberOf ListCache
|
|
554
|
+
* @param {string} key The key of the value to get.
|
|
555
|
+
* @returns {*} Returns the entry value.
|
|
556
|
+
*/
|
|
557
|
+
function listCacheGet(key) {
|
|
558
|
+
var data = this.__data__,
|
|
559
|
+
index = _assocIndexOf(data, key);
|
|
560
|
+
|
|
561
|
+
return index < 0 ? undefined : data[index][1];
|
|
562
|
+
}
|
|
563
|
+
|
|
564
|
+
var _listCacheGet = listCacheGet;
|
|
565
|
+
|
|
566
|
+
/**
|
|
567
|
+
* Checks if a list cache value for `key` exists.
|
|
568
|
+
*
|
|
569
|
+
* @private
|
|
570
|
+
* @name has
|
|
571
|
+
* @memberOf ListCache
|
|
572
|
+
* @param {string} key The key of the entry to check.
|
|
573
|
+
* @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
|
|
574
|
+
*/
|
|
575
|
+
function listCacheHas(key) {
|
|
576
|
+
return _assocIndexOf(this.__data__, key) > -1;
|
|
577
|
+
}
|
|
578
|
+
|
|
579
|
+
var _listCacheHas = listCacheHas;
|
|
580
|
+
|
|
581
|
+
/**
|
|
582
|
+
* Sets the list cache `key` to `value`.
|
|
583
|
+
*
|
|
584
|
+
* @private
|
|
585
|
+
* @name set
|
|
586
|
+
* @memberOf ListCache
|
|
587
|
+
* @param {string} key The key of the value to set.
|
|
588
|
+
* @param {*} value The value to set.
|
|
589
|
+
* @returns {Object} Returns the list cache instance.
|
|
590
|
+
*/
|
|
591
|
+
function listCacheSet(key, value) {
|
|
592
|
+
var data = this.__data__,
|
|
593
|
+
index = _assocIndexOf(data, key);
|
|
594
|
+
|
|
595
|
+
if (index < 0) {
|
|
596
|
+
++this.size;
|
|
597
|
+
data.push([key, value]);
|
|
598
|
+
} else {
|
|
599
|
+
data[index][1] = value;
|
|
600
|
+
}
|
|
601
|
+
return this;
|
|
602
|
+
}
|
|
603
|
+
|
|
604
|
+
var _listCacheSet = listCacheSet;
|
|
605
|
+
|
|
606
|
+
/**
|
|
607
|
+
* Creates an list cache object.
|
|
608
|
+
*
|
|
609
|
+
* @private
|
|
610
|
+
* @constructor
|
|
611
|
+
* @param {Array} [entries] The key-value pairs to cache.
|
|
612
|
+
*/
|
|
613
|
+
function ListCache(entries) {
|
|
614
|
+
var index = -1,
|
|
615
|
+
length = entries == null ? 0 : entries.length;
|
|
616
|
+
|
|
617
|
+
this.clear();
|
|
618
|
+
while (++index < length) {
|
|
619
|
+
var entry = entries[index];
|
|
620
|
+
this.set(entry[0], entry[1]);
|
|
621
|
+
}
|
|
622
|
+
}
|
|
623
|
+
|
|
624
|
+
// Add methods to `ListCache`.
|
|
625
|
+
ListCache.prototype.clear = _listCacheClear;
|
|
626
|
+
ListCache.prototype['delete'] = _listCacheDelete;
|
|
627
|
+
ListCache.prototype.get = _listCacheGet;
|
|
628
|
+
ListCache.prototype.has = _listCacheHas;
|
|
629
|
+
ListCache.prototype.set = _listCacheSet;
|
|
630
|
+
|
|
631
|
+
var _ListCache = ListCache;
|
|
632
|
+
|
|
633
|
+
/**
|
|
634
|
+
* Removes all key-value entries from the stack.
|
|
635
|
+
*
|
|
636
|
+
* @private
|
|
637
|
+
* @name clear
|
|
638
|
+
* @memberOf Stack
|
|
639
|
+
*/
|
|
640
|
+
function stackClear() {
|
|
641
|
+
this.__data__ = new _ListCache;
|
|
642
|
+
this.size = 0;
|
|
643
|
+
}
|
|
644
|
+
|
|
645
|
+
var _stackClear = stackClear;
|
|
646
|
+
|
|
647
|
+
/**
|
|
648
|
+
* Removes `key` and its value from the stack.
|
|
649
|
+
*
|
|
650
|
+
* @private
|
|
651
|
+
* @name delete
|
|
652
|
+
* @memberOf Stack
|
|
653
|
+
* @param {string} key The key of the value to remove.
|
|
654
|
+
* @returns {boolean} Returns `true` if the entry was removed, else `false`.
|
|
655
|
+
*/
|
|
656
|
+
function stackDelete(key) {
|
|
657
|
+
var data = this.__data__,
|
|
658
|
+
result = data['delete'](key);
|
|
659
|
+
|
|
660
|
+
this.size = data.size;
|
|
661
|
+
return result;
|
|
662
|
+
}
|
|
663
|
+
|
|
664
|
+
var _stackDelete = stackDelete;
|
|
665
|
+
|
|
666
|
+
/**
|
|
667
|
+
* Gets the stack value for `key`.
|
|
668
|
+
*
|
|
669
|
+
* @private
|
|
670
|
+
* @name get
|
|
671
|
+
* @memberOf Stack
|
|
672
|
+
* @param {string} key The key of the value to get.
|
|
673
|
+
* @returns {*} Returns the entry value.
|
|
674
|
+
*/
|
|
675
|
+
function stackGet(key) {
|
|
676
|
+
return this.__data__.get(key);
|
|
677
|
+
}
|
|
678
|
+
|
|
679
|
+
var _stackGet = stackGet;
|
|
680
|
+
|
|
681
|
+
/**
|
|
682
|
+
* Checks if a stack value for `key` exists.
|
|
683
|
+
*
|
|
684
|
+
* @private
|
|
685
|
+
* @name has
|
|
686
|
+
* @memberOf Stack
|
|
687
|
+
* @param {string} key The key of the entry to check.
|
|
688
|
+
* @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
|
|
689
|
+
*/
|
|
690
|
+
function stackHas(key) {
|
|
691
|
+
return this.__data__.has(key);
|
|
692
|
+
}
|
|
693
|
+
|
|
694
|
+
var _stackHas = stackHas;
|
|
695
|
+
|
|
696
|
+
/** Detect free variable `global` from Node.js. */
|
|
697
|
+
|
|
698
|
+
var freeGlobal = typeof commonjsGlobal == 'object' && commonjsGlobal && commonjsGlobal.Object === Object && commonjsGlobal;
|
|
699
|
+
|
|
700
|
+
var _freeGlobal = freeGlobal;
|
|
701
|
+
|
|
702
|
+
/** Detect free variable `self`. */
|
|
703
|
+
var freeSelf = typeof self == 'object' && self && self.Object === Object && self;
|
|
704
|
+
|
|
705
|
+
/** Used as a reference to the global object. */
|
|
706
|
+
var root = _freeGlobal || freeSelf || Function('return this')();
|
|
707
|
+
|
|
708
|
+
var _root = root;
|
|
709
|
+
|
|
710
|
+
/** Built-in value references. */
|
|
711
|
+
var Symbol = _root.Symbol;
|
|
712
|
+
|
|
713
|
+
var _Symbol = Symbol;
|
|
714
|
+
|
|
715
|
+
/** Used for built-in method references. */
|
|
716
|
+
var objectProto$d = Object.prototype;
|
|
717
|
+
|
|
718
|
+
/** Used to check objects for own properties. */
|
|
719
|
+
var hasOwnProperty$a = objectProto$d.hasOwnProperty;
|
|
720
|
+
|
|
721
|
+
/**
|
|
722
|
+
* Used to resolve the
|
|
723
|
+
* [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
|
|
724
|
+
* of values.
|
|
725
|
+
*/
|
|
726
|
+
var nativeObjectToString$1 = objectProto$d.toString;
|
|
727
|
+
|
|
728
|
+
/** Built-in value references. */
|
|
729
|
+
var symToStringTag$1 = _Symbol ? _Symbol.toStringTag : undefined;
|
|
730
|
+
|
|
731
|
+
/**
|
|
732
|
+
* A specialized version of `baseGetTag` which ignores `Symbol.toStringTag` values.
|
|
733
|
+
*
|
|
734
|
+
* @private
|
|
735
|
+
* @param {*} value The value to query.
|
|
736
|
+
* @returns {string} Returns the raw `toStringTag`.
|
|
737
|
+
*/
|
|
738
|
+
function getRawTag(value) {
|
|
739
|
+
var isOwn = hasOwnProperty$a.call(value, symToStringTag$1),
|
|
740
|
+
tag = value[symToStringTag$1];
|
|
741
|
+
|
|
742
|
+
try {
|
|
743
|
+
value[symToStringTag$1] = undefined;
|
|
744
|
+
var unmasked = true;
|
|
745
|
+
} catch (e) {}
|
|
746
|
+
|
|
747
|
+
var result = nativeObjectToString$1.call(value);
|
|
748
|
+
if (unmasked) {
|
|
749
|
+
if (isOwn) {
|
|
750
|
+
value[symToStringTag$1] = tag;
|
|
751
|
+
} else {
|
|
752
|
+
delete value[symToStringTag$1];
|
|
753
|
+
}
|
|
754
|
+
}
|
|
755
|
+
return result;
|
|
756
|
+
}
|
|
757
|
+
|
|
758
|
+
var _getRawTag = getRawTag;
|
|
759
|
+
|
|
760
|
+
/** Used for built-in method references. */
|
|
761
|
+
var objectProto$c = Object.prototype;
|
|
762
|
+
|
|
763
|
+
/**
|
|
764
|
+
* Used to resolve the
|
|
765
|
+
* [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
|
|
766
|
+
* of values.
|
|
767
|
+
*/
|
|
768
|
+
var nativeObjectToString = objectProto$c.toString;
|
|
769
|
+
|
|
770
|
+
/**
|
|
771
|
+
* Converts `value` to a string using `Object.prototype.toString`.
|
|
772
|
+
*
|
|
773
|
+
* @private
|
|
774
|
+
* @param {*} value The value to convert.
|
|
775
|
+
* @returns {string} Returns the converted string.
|
|
776
|
+
*/
|
|
777
|
+
function objectToString(value) {
|
|
778
|
+
return nativeObjectToString.call(value);
|
|
779
|
+
}
|
|
780
|
+
|
|
781
|
+
var _objectToString = objectToString;
|
|
782
|
+
|
|
783
|
+
/** `Object#toString` result references. */
|
|
784
|
+
var nullTag = '[object Null]',
|
|
785
|
+
undefinedTag = '[object Undefined]';
|
|
786
|
+
|
|
787
|
+
/** Built-in value references. */
|
|
788
|
+
var symToStringTag = _Symbol ? _Symbol.toStringTag : undefined;
|
|
789
|
+
|
|
790
|
+
/**
|
|
791
|
+
* The base implementation of `getTag` without fallbacks for buggy environments.
|
|
792
|
+
*
|
|
793
|
+
* @private
|
|
794
|
+
* @param {*} value The value to query.
|
|
795
|
+
* @returns {string} Returns the `toStringTag`.
|
|
796
|
+
*/
|
|
797
|
+
function baseGetTag(value) {
|
|
798
|
+
if (value == null) {
|
|
799
|
+
return value === undefined ? undefinedTag : nullTag;
|
|
800
|
+
}
|
|
801
|
+
return (symToStringTag && symToStringTag in Object(value))
|
|
802
|
+
? _getRawTag(value)
|
|
803
|
+
: _objectToString(value);
|
|
804
|
+
}
|
|
805
|
+
|
|
806
|
+
var _baseGetTag = baseGetTag;
|
|
807
|
+
|
|
808
|
+
/**
|
|
809
|
+
* Checks if `value` is the
|
|
810
|
+
* [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types)
|
|
811
|
+
* of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)
|
|
812
|
+
*
|
|
813
|
+
* @static
|
|
814
|
+
* @memberOf _
|
|
815
|
+
* @since 0.1.0
|
|
816
|
+
* @category Lang
|
|
817
|
+
* @param {*} value The value to check.
|
|
818
|
+
* @returns {boolean} Returns `true` if `value` is an object, else `false`.
|
|
819
|
+
* @example
|
|
820
|
+
*
|
|
821
|
+
* _.isObject({});
|
|
822
|
+
* // => true
|
|
823
|
+
*
|
|
824
|
+
* _.isObject([1, 2, 3]);
|
|
825
|
+
* // => true
|
|
826
|
+
*
|
|
827
|
+
* _.isObject(_.noop);
|
|
828
|
+
* // => true
|
|
829
|
+
*
|
|
830
|
+
* _.isObject(null);
|
|
831
|
+
* // => false
|
|
832
|
+
*/
|
|
833
|
+
function isObject(value) {
|
|
834
|
+
var type = typeof value;
|
|
835
|
+
return value != null && (type == 'object' || type == 'function');
|
|
836
|
+
}
|
|
837
|
+
|
|
838
|
+
var isObject_1 = isObject;
|
|
839
|
+
|
|
840
|
+
/** `Object#toString` result references. */
|
|
841
|
+
var asyncTag = '[object AsyncFunction]',
|
|
842
|
+
funcTag$2 = '[object Function]',
|
|
843
|
+
genTag$1 = '[object GeneratorFunction]',
|
|
844
|
+
proxyTag = '[object Proxy]';
|
|
845
|
+
|
|
846
|
+
/**
|
|
847
|
+
* Checks if `value` is classified as a `Function` object.
|
|
848
|
+
*
|
|
849
|
+
* @static
|
|
850
|
+
* @memberOf _
|
|
851
|
+
* @since 0.1.0
|
|
852
|
+
* @category Lang
|
|
853
|
+
* @param {*} value The value to check.
|
|
854
|
+
* @returns {boolean} Returns `true` if `value` is a function, else `false`.
|
|
855
|
+
* @example
|
|
856
|
+
*
|
|
857
|
+
* _.isFunction(_);
|
|
858
|
+
* // => true
|
|
859
|
+
*
|
|
860
|
+
* _.isFunction(/abc/);
|
|
861
|
+
* // => false
|
|
862
|
+
*/
|
|
863
|
+
function isFunction(value) {
|
|
864
|
+
if (!isObject_1(value)) {
|
|
865
|
+
return false;
|
|
866
|
+
}
|
|
867
|
+
// The use of `Object#toString` avoids issues with the `typeof` operator
|
|
868
|
+
// in Safari 9 which returns 'object' for typed arrays and other constructors.
|
|
869
|
+
var tag = _baseGetTag(value);
|
|
870
|
+
return tag == funcTag$2 || tag == genTag$1 || tag == asyncTag || tag == proxyTag;
|
|
871
|
+
}
|
|
872
|
+
|
|
873
|
+
var isFunction_1 = isFunction;
|
|
874
|
+
|
|
875
|
+
/** Used to detect overreaching core-js shims. */
|
|
876
|
+
var coreJsData = _root['__core-js_shared__'];
|
|
877
|
+
|
|
878
|
+
var _coreJsData = coreJsData;
|
|
879
|
+
|
|
880
|
+
/** Used to detect methods masquerading as native. */
|
|
881
|
+
var maskSrcKey = (function() {
|
|
882
|
+
var uid = /[^.]+$/.exec(_coreJsData && _coreJsData.keys && _coreJsData.keys.IE_PROTO || '');
|
|
883
|
+
return uid ? ('Symbol(src)_1.' + uid) : '';
|
|
884
|
+
}());
|
|
885
|
+
|
|
886
|
+
/**
|
|
887
|
+
* Checks if `func` has its source masked.
|
|
888
|
+
*
|
|
889
|
+
* @private
|
|
890
|
+
* @param {Function} func The function to check.
|
|
891
|
+
* @returns {boolean} Returns `true` if `func` is masked, else `false`.
|
|
892
|
+
*/
|
|
893
|
+
function isMasked(func) {
|
|
894
|
+
return !!maskSrcKey && (maskSrcKey in func);
|
|
895
|
+
}
|
|
896
|
+
|
|
897
|
+
var _isMasked = isMasked;
|
|
898
|
+
|
|
899
|
+
/** Used for built-in method references. */
|
|
900
|
+
var funcProto$2 = Function.prototype;
|
|
901
|
+
|
|
902
|
+
/** Used to resolve the decompiled source of functions. */
|
|
903
|
+
var funcToString$2 = funcProto$2.toString;
|
|
904
|
+
|
|
905
|
+
/**
|
|
906
|
+
* Converts `func` to its source code.
|
|
907
|
+
*
|
|
908
|
+
* @private
|
|
909
|
+
* @param {Function} func The function to convert.
|
|
910
|
+
* @returns {string} Returns the source code.
|
|
911
|
+
*/
|
|
912
|
+
function toSource(func) {
|
|
913
|
+
if (func != null) {
|
|
914
|
+
try {
|
|
915
|
+
return funcToString$2.call(func);
|
|
916
|
+
} catch (e) {}
|
|
917
|
+
try {
|
|
918
|
+
return (func + '');
|
|
919
|
+
} catch (e) {}
|
|
920
|
+
}
|
|
921
|
+
return '';
|
|
922
|
+
}
|
|
923
|
+
|
|
924
|
+
var _toSource = toSource;
|
|
925
|
+
|
|
926
|
+
/**
|
|
927
|
+
* Used to match `RegExp`
|
|
928
|
+
* [syntax characters](http://ecma-international.org/ecma-262/7.0/#sec-patterns).
|
|
929
|
+
*/
|
|
930
|
+
var reRegExpChar = /[\\^$.*+?()[\]{}|]/g;
|
|
931
|
+
|
|
932
|
+
/** Used to detect host constructors (Safari). */
|
|
933
|
+
var reIsHostCtor = /^\[object .+?Constructor\]$/;
|
|
934
|
+
|
|
935
|
+
/** Used for built-in method references. */
|
|
936
|
+
var funcProto$1 = Function.prototype,
|
|
937
|
+
objectProto$b = Object.prototype;
|
|
938
|
+
|
|
939
|
+
/** Used to resolve the decompiled source of functions. */
|
|
940
|
+
var funcToString$1 = funcProto$1.toString;
|
|
941
|
+
|
|
942
|
+
/** Used to check objects for own properties. */
|
|
943
|
+
var hasOwnProperty$9 = objectProto$b.hasOwnProperty;
|
|
944
|
+
|
|
945
|
+
/** Used to detect if a method is native. */
|
|
946
|
+
var reIsNative = RegExp('^' +
|
|
947
|
+
funcToString$1.call(hasOwnProperty$9).replace(reRegExpChar, '\\$&')
|
|
948
|
+
.replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, '$1.*?') + '$'
|
|
949
|
+
);
|
|
950
|
+
|
|
951
|
+
/**
|
|
952
|
+
* The base implementation of `_.isNative` without bad shim checks.
|
|
953
|
+
*
|
|
954
|
+
* @private
|
|
955
|
+
* @param {*} value The value to check.
|
|
956
|
+
* @returns {boolean} Returns `true` if `value` is a native function,
|
|
957
|
+
* else `false`.
|
|
958
|
+
*/
|
|
959
|
+
function baseIsNative(value) {
|
|
960
|
+
if (!isObject_1(value) || _isMasked(value)) {
|
|
961
|
+
return false;
|
|
962
|
+
}
|
|
963
|
+
var pattern = isFunction_1(value) ? reIsNative : reIsHostCtor;
|
|
964
|
+
return pattern.test(_toSource(value));
|
|
965
|
+
}
|
|
966
|
+
|
|
967
|
+
var _baseIsNative = baseIsNative;
|
|
968
|
+
|
|
969
|
+
/**
|
|
970
|
+
* Gets the value at `key` of `object`.
|
|
971
|
+
*
|
|
972
|
+
* @private
|
|
973
|
+
* @param {Object} [object] The object to query.
|
|
974
|
+
* @param {string} key The key of the property to get.
|
|
975
|
+
* @returns {*} Returns the property value.
|
|
976
|
+
*/
|
|
977
|
+
function getValue(object, key) {
|
|
978
|
+
return object == null ? undefined : object[key];
|
|
979
|
+
}
|
|
980
|
+
|
|
981
|
+
var _getValue = getValue;
|
|
982
|
+
|
|
983
|
+
/**
|
|
984
|
+
* Gets the native function at `key` of `object`.
|
|
985
|
+
*
|
|
986
|
+
* @private
|
|
987
|
+
* @param {Object} object The object to query.
|
|
988
|
+
* @param {string} key The key of the method to get.
|
|
989
|
+
* @returns {*} Returns the function if it's native, else `undefined`.
|
|
990
|
+
*/
|
|
991
|
+
function getNative(object, key) {
|
|
992
|
+
var value = _getValue(object, key);
|
|
993
|
+
return _baseIsNative(value) ? value : undefined;
|
|
994
|
+
}
|
|
995
|
+
|
|
996
|
+
var _getNative = getNative;
|
|
997
|
+
|
|
998
|
+
/* Built-in method references that are verified to be native. */
|
|
999
|
+
var Map = _getNative(_root, 'Map');
|
|
1000
|
+
|
|
1001
|
+
var _Map = Map;
|
|
1002
|
+
|
|
1003
|
+
/* Built-in method references that are verified to be native. */
|
|
1004
|
+
var nativeCreate = _getNative(Object, 'create');
|
|
1005
|
+
|
|
1006
|
+
var _nativeCreate = nativeCreate;
|
|
1007
|
+
|
|
1008
|
+
/**
|
|
1009
|
+
* Removes all key-value entries from the hash.
|
|
1010
|
+
*
|
|
1011
|
+
* @private
|
|
1012
|
+
* @name clear
|
|
1013
|
+
* @memberOf Hash
|
|
1014
|
+
*/
|
|
1015
|
+
function hashClear() {
|
|
1016
|
+
this.__data__ = _nativeCreate ? _nativeCreate(null) : {};
|
|
1017
|
+
this.size = 0;
|
|
1018
|
+
}
|
|
1019
|
+
|
|
1020
|
+
var _hashClear = hashClear;
|
|
1021
|
+
|
|
1022
|
+
/**
|
|
1023
|
+
* Removes `key` and its value from the hash.
|
|
1024
|
+
*
|
|
1025
|
+
* @private
|
|
1026
|
+
* @name delete
|
|
1027
|
+
* @memberOf Hash
|
|
1028
|
+
* @param {Object} hash The hash to modify.
|
|
1029
|
+
* @param {string} key The key of the value to remove.
|
|
1030
|
+
* @returns {boolean} Returns `true` if the entry was removed, else `false`.
|
|
1031
|
+
*/
|
|
1032
|
+
function hashDelete(key) {
|
|
1033
|
+
var result = this.has(key) && delete this.__data__[key];
|
|
1034
|
+
this.size -= result ? 1 : 0;
|
|
1035
|
+
return result;
|
|
1036
|
+
}
|
|
1037
|
+
|
|
1038
|
+
var _hashDelete = hashDelete;
|
|
1039
|
+
|
|
1040
|
+
/** Used to stand-in for `undefined` hash values. */
|
|
1041
|
+
var HASH_UNDEFINED$1 = '__lodash_hash_undefined__';
|
|
1042
|
+
|
|
1043
|
+
/** Used for built-in method references. */
|
|
1044
|
+
var objectProto$a = Object.prototype;
|
|
1045
|
+
|
|
1046
|
+
/** Used to check objects for own properties. */
|
|
1047
|
+
var hasOwnProperty$8 = objectProto$a.hasOwnProperty;
|
|
1048
|
+
|
|
1049
|
+
/**
|
|
1050
|
+
* Gets the hash value for `key`.
|
|
1051
|
+
*
|
|
1052
|
+
* @private
|
|
1053
|
+
* @name get
|
|
1054
|
+
* @memberOf Hash
|
|
1055
|
+
* @param {string} key The key of the value to get.
|
|
1056
|
+
* @returns {*} Returns the entry value.
|
|
1057
|
+
*/
|
|
1058
|
+
function hashGet(key) {
|
|
1059
|
+
var data = this.__data__;
|
|
1060
|
+
if (_nativeCreate) {
|
|
1061
|
+
var result = data[key];
|
|
1062
|
+
return result === HASH_UNDEFINED$1 ? undefined : result;
|
|
1063
|
+
}
|
|
1064
|
+
return hasOwnProperty$8.call(data, key) ? data[key] : undefined;
|
|
1065
|
+
}
|
|
1066
|
+
|
|
1067
|
+
var _hashGet = hashGet;
|
|
1068
|
+
|
|
1069
|
+
/** Used for built-in method references. */
|
|
1070
|
+
var objectProto$9 = Object.prototype;
|
|
1071
|
+
|
|
1072
|
+
/** Used to check objects for own properties. */
|
|
1073
|
+
var hasOwnProperty$7 = objectProto$9.hasOwnProperty;
|
|
1074
|
+
|
|
1075
|
+
/**
|
|
1076
|
+
* Checks if a hash value for `key` exists.
|
|
1077
|
+
*
|
|
1078
|
+
* @private
|
|
1079
|
+
* @name has
|
|
1080
|
+
* @memberOf Hash
|
|
1081
|
+
* @param {string} key The key of the entry to check.
|
|
1082
|
+
* @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
|
|
1083
|
+
*/
|
|
1084
|
+
function hashHas(key) {
|
|
1085
|
+
var data = this.__data__;
|
|
1086
|
+
return _nativeCreate ? (data[key] !== undefined) : hasOwnProperty$7.call(data, key);
|
|
1087
|
+
}
|
|
1088
|
+
|
|
1089
|
+
var _hashHas = hashHas;
|
|
1090
|
+
|
|
1091
|
+
/** Used to stand-in for `undefined` hash values. */
|
|
1092
|
+
var HASH_UNDEFINED = '__lodash_hash_undefined__';
|
|
1093
|
+
|
|
1094
|
+
/**
|
|
1095
|
+
* Sets the hash `key` to `value`.
|
|
1096
|
+
*
|
|
1097
|
+
* @private
|
|
1098
|
+
* @name set
|
|
1099
|
+
* @memberOf Hash
|
|
1100
|
+
* @param {string} key The key of the value to set.
|
|
1101
|
+
* @param {*} value The value to set.
|
|
1102
|
+
* @returns {Object} Returns the hash instance.
|
|
1103
|
+
*/
|
|
1104
|
+
function hashSet(key, value) {
|
|
1105
|
+
var data = this.__data__;
|
|
1106
|
+
this.size += this.has(key) ? 0 : 1;
|
|
1107
|
+
data[key] = (_nativeCreate && value === undefined) ? HASH_UNDEFINED : value;
|
|
1108
|
+
return this;
|
|
1109
|
+
}
|
|
1110
|
+
|
|
1111
|
+
var _hashSet = hashSet;
|
|
1112
|
+
|
|
1113
|
+
/**
|
|
1114
|
+
* Creates a hash object.
|
|
1115
|
+
*
|
|
1116
|
+
* @private
|
|
1117
|
+
* @constructor
|
|
1118
|
+
* @param {Array} [entries] The key-value pairs to cache.
|
|
1119
|
+
*/
|
|
1120
|
+
function Hash(entries) {
|
|
1121
|
+
var index = -1,
|
|
1122
|
+
length = entries == null ? 0 : entries.length;
|
|
1123
|
+
|
|
1124
|
+
this.clear();
|
|
1125
|
+
while (++index < length) {
|
|
1126
|
+
var entry = entries[index];
|
|
1127
|
+
this.set(entry[0], entry[1]);
|
|
1128
|
+
}
|
|
1129
|
+
}
|
|
1130
|
+
|
|
1131
|
+
// Add methods to `Hash`.
|
|
1132
|
+
Hash.prototype.clear = _hashClear;
|
|
1133
|
+
Hash.prototype['delete'] = _hashDelete;
|
|
1134
|
+
Hash.prototype.get = _hashGet;
|
|
1135
|
+
Hash.prototype.has = _hashHas;
|
|
1136
|
+
Hash.prototype.set = _hashSet;
|
|
1137
|
+
|
|
1138
|
+
var _Hash = Hash;
|
|
1139
|
+
|
|
1140
|
+
/**
|
|
1141
|
+
* Removes all key-value entries from the map.
|
|
1142
|
+
*
|
|
1143
|
+
* @private
|
|
1144
|
+
* @name clear
|
|
1145
|
+
* @memberOf MapCache
|
|
1146
|
+
*/
|
|
1147
|
+
function mapCacheClear() {
|
|
1148
|
+
this.size = 0;
|
|
1149
|
+
this.__data__ = {
|
|
1150
|
+
'hash': new _Hash,
|
|
1151
|
+
'map': new (_Map || _ListCache),
|
|
1152
|
+
'string': new _Hash
|
|
1153
|
+
};
|
|
1154
|
+
}
|
|
1155
|
+
|
|
1156
|
+
var _mapCacheClear = mapCacheClear;
|
|
1157
|
+
|
|
1158
|
+
/**
|
|
1159
|
+
* Checks if `value` is suitable for use as unique object key.
|
|
1160
|
+
*
|
|
1161
|
+
* @private
|
|
1162
|
+
* @param {*} value The value to check.
|
|
1163
|
+
* @returns {boolean} Returns `true` if `value` is suitable, else `false`.
|
|
1164
|
+
*/
|
|
1165
|
+
function isKeyable(value) {
|
|
1166
|
+
var type = typeof value;
|
|
1167
|
+
return (type == 'string' || type == 'number' || type == 'symbol' || type == 'boolean')
|
|
1168
|
+
? (value !== '__proto__')
|
|
1169
|
+
: (value === null);
|
|
1170
|
+
}
|
|
1171
|
+
|
|
1172
|
+
var _isKeyable = isKeyable;
|
|
1173
|
+
|
|
1174
|
+
/**
|
|
1175
|
+
* Gets the data for `map`.
|
|
1176
|
+
*
|
|
1177
|
+
* @private
|
|
1178
|
+
* @param {Object} map The map to query.
|
|
1179
|
+
* @param {string} key The reference key.
|
|
1180
|
+
* @returns {*} Returns the map data.
|
|
1181
|
+
*/
|
|
1182
|
+
function getMapData(map, key) {
|
|
1183
|
+
var data = map.__data__;
|
|
1184
|
+
return _isKeyable(key)
|
|
1185
|
+
? data[typeof key == 'string' ? 'string' : 'hash']
|
|
1186
|
+
: data.map;
|
|
1187
|
+
}
|
|
1188
|
+
|
|
1189
|
+
var _getMapData = getMapData;
|
|
1190
|
+
|
|
1191
|
+
/**
|
|
1192
|
+
* Removes `key` and its value from the map.
|
|
1193
|
+
*
|
|
1194
|
+
* @private
|
|
1195
|
+
* @name delete
|
|
1196
|
+
* @memberOf MapCache
|
|
1197
|
+
* @param {string} key The key of the value to remove.
|
|
1198
|
+
* @returns {boolean} Returns `true` if the entry was removed, else `false`.
|
|
1199
|
+
*/
|
|
1200
|
+
function mapCacheDelete(key) {
|
|
1201
|
+
var result = _getMapData(this, key)['delete'](key);
|
|
1202
|
+
this.size -= result ? 1 : 0;
|
|
1203
|
+
return result;
|
|
1204
|
+
}
|
|
1205
|
+
|
|
1206
|
+
var _mapCacheDelete = mapCacheDelete;
|
|
1207
|
+
|
|
1208
|
+
/**
|
|
1209
|
+
* Gets the map value for `key`.
|
|
1210
|
+
*
|
|
1211
|
+
* @private
|
|
1212
|
+
* @name get
|
|
1213
|
+
* @memberOf MapCache
|
|
1214
|
+
* @param {string} key The key of the value to get.
|
|
1215
|
+
* @returns {*} Returns the entry value.
|
|
1216
|
+
*/
|
|
1217
|
+
function mapCacheGet(key) {
|
|
1218
|
+
return _getMapData(this, key).get(key);
|
|
1219
|
+
}
|
|
1220
|
+
|
|
1221
|
+
var _mapCacheGet = mapCacheGet;
|
|
1222
|
+
|
|
1223
|
+
/**
|
|
1224
|
+
* Checks if a map value for `key` exists.
|
|
1225
|
+
*
|
|
1226
|
+
* @private
|
|
1227
|
+
* @name has
|
|
1228
|
+
* @memberOf MapCache
|
|
1229
|
+
* @param {string} key The key of the entry to check.
|
|
1230
|
+
* @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
|
|
1231
|
+
*/
|
|
1232
|
+
function mapCacheHas(key) {
|
|
1233
|
+
return _getMapData(this, key).has(key);
|
|
1234
|
+
}
|
|
1235
|
+
|
|
1236
|
+
var _mapCacheHas = mapCacheHas;
|
|
1237
|
+
|
|
1238
|
+
/**
|
|
1239
|
+
* Sets the map `key` to `value`.
|
|
1240
|
+
*
|
|
1241
|
+
* @private
|
|
1242
|
+
* @name set
|
|
1243
|
+
* @memberOf MapCache
|
|
1244
|
+
* @param {string} key The key of the value to set.
|
|
1245
|
+
* @param {*} value The value to set.
|
|
1246
|
+
* @returns {Object} Returns the map cache instance.
|
|
1247
|
+
*/
|
|
1248
|
+
function mapCacheSet(key, value) {
|
|
1249
|
+
var data = _getMapData(this, key),
|
|
1250
|
+
size = data.size;
|
|
1251
|
+
|
|
1252
|
+
data.set(key, value);
|
|
1253
|
+
this.size += data.size == size ? 0 : 1;
|
|
1254
|
+
return this;
|
|
1255
|
+
}
|
|
1256
|
+
|
|
1257
|
+
var _mapCacheSet = mapCacheSet;
|
|
1258
|
+
|
|
1259
|
+
/**
|
|
1260
|
+
* Creates a map cache object to store key-value pairs.
|
|
1261
|
+
*
|
|
1262
|
+
* @private
|
|
1263
|
+
* @constructor
|
|
1264
|
+
* @param {Array} [entries] The key-value pairs to cache.
|
|
1265
|
+
*/
|
|
1266
|
+
function MapCache(entries) {
|
|
1267
|
+
var index = -1,
|
|
1268
|
+
length = entries == null ? 0 : entries.length;
|
|
1269
|
+
|
|
1270
|
+
this.clear();
|
|
1271
|
+
while (++index < length) {
|
|
1272
|
+
var entry = entries[index];
|
|
1273
|
+
this.set(entry[0], entry[1]);
|
|
1274
|
+
}
|
|
1275
|
+
}
|
|
1276
|
+
|
|
1277
|
+
// Add methods to `MapCache`.
|
|
1278
|
+
MapCache.prototype.clear = _mapCacheClear;
|
|
1279
|
+
MapCache.prototype['delete'] = _mapCacheDelete;
|
|
1280
|
+
MapCache.prototype.get = _mapCacheGet;
|
|
1281
|
+
MapCache.prototype.has = _mapCacheHas;
|
|
1282
|
+
MapCache.prototype.set = _mapCacheSet;
|
|
1283
|
+
|
|
1284
|
+
var _MapCache = MapCache;
|
|
1285
|
+
|
|
1286
|
+
/** Used as the size to enable large array optimizations. */
|
|
1287
|
+
var LARGE_ARRAY_SIZE = 200;
|
|
1288
|
+
|
|
1289
|
+
/**
|
|
1290
|
+
* Sets the stack `key` to `value`.
|
|
1291
|
+
*
|
|
1292
|
+
* @private
|
|
1293
|
+
* @name set
|
|
1294
|
+
* @memberOf Stack
|
|
1295
|
+
* @param {string} key The key of the value to set.
|
|
1296
|
+
* @param {*} value The value to set.
|
|
1297
|
+
* @returns {Object} Returns the stack cache instance.
|
|
1298
|
+
*/
|
|
1299
|
+
function stackSet(key, value) {
|
|
1300
|
+
var data = this.__data__;
|
|
1301
|
+
if (data instanceof _ListCache) {
|
|
1302
|
+
var pairs = data.__data__;
|
|
1303
|
+
if (!_Map || (pairs.length < LARGE_ARRAY_SIZE - 1)) {
|
|
1304
|
+
pairs.push([key, value]);
|
|
1305
|
+
this.size = ++data.size;
|
|
1306
|
+
return this;
|
|
1307
|
+
}
|
|
1308
|
+
data = this.__data__ = new _MapCache(pairs);
|
|
1309
|
+
}
|
|
1310
|
+
data.set(key, value);
|
|
1311
|
+
this.size = data.size;
|
|
1312
|
+
return this;
|
|
1313
|
+
}
|
|
1314
|
+
|
|
1315
|
+
var _stackSet = stackSet;
|
|
1316
|
+
|
|
1317
|
+
/**
|
|
1318
|
+
* Creates a stack cache object to store key-value pairs.
|
|
1319
|
+
*
|
|
1320
|
+
* @private
|
|
1321
|
+
* @constructor
|
|
1322
|
+
* @param {Array} [entries] The key-value pairs to cache.
|
|
1323
|
+
*/
|
|
1324
|
+
function Stack(entries) {
|
|
1325
|
+
var data = this.__data__ = new _ListCache(entries);
|
|
1326
|
+
this.size = data.size;
|
|
1327
|
+
}
|
|
1328
|
+
|
|
1329
|
+
// Add methods to `Stack`.
|
|
1330
|
+
Stack.prototype.clear = _stackClear;
|
|
1331
|
+
Stack.prototype['delete'] = _stackDelete;
|
|
1332
|
+
Stack.prototype.get = _stackGet;
|
|
1333
|
+
Stack.prototype.has = _stackHas;
|
|
1334
|
+
Stack.prototype.set = _stackSet;
|
|
1335
|
+
|
|
1336
|
+
var _Stack = Stack;
|
|
1337
|
+
|
|
1338
|
+
/**
|
|
1339
|
+
* A specialized version of `_.forEach` for arrays without support for
|
|
1340
|
+
* iteratee shorthands.
|
|
1341
|
+
*
|
|
1342
|
+
* @private
|
|
1343
|
+
* @param {Array} [array] The array to iterate over.
|
|
1344
|
+
* @param {Function} iteratee The function invoked per iteration.
|
|
1345
|
+
* @returns {Array} Returns `array`.
|
|
1346
|
+
*/
|
|
1347
|
+
function arrayEach(array, iteratee) {
|
|
1348
|
+
var index = -1,
|
|
1349
|
+
length = array == null ? 0 : array.length;
|
|
1350
|
+
|
|
1351
|
+
while (++index < length) {
|
|
1352
|
+
if (iteratee(array[index], index, array) === false) {
|
|
1353
|
+
break;
|
|
1354
|
+
}
|
|
1355
|
+
}
|
|
1356
|
+
return array;
|
|
1357
|
+
}
|
|
1358
|
+
|
|
1359
|
+
var _arrayEach = arrayEach;
|
|
1360
|
+
|
|
1361
|
+
var defineProperty = (function() {
|
|
1362
|
+
try {
|
|
1363
|
+
var func = _getNative(Object, 'defineProperty');
|
|
1364
|
+
func({}, '', {});
|
|
1365
|
+
return func;
|
|
1366
|
+
} catch (e) {}
|
|
1367
|
+
}());
|
|
1368
|
+
|
|
1369
|
+
var _defineProperty = defineProperty;
|
|
1370
|
+
|
|
1371
|
+
/**
|
|
1372
|
+
* The base implementation of `assignValue` and `assignMergeValue` without
|
|
1373
|
+
* value checks.
|
|
1374
|
+
*
|
|
1375
|
+
* @private
|
|
1376
|
+
* @param {Object} object The object to modify.
|
|
1377
|
+
* @param {string} key The key of the property to assign.
|
|
1378
|
+
* @param {*} value The value to assign.
|
|
1379
|
+
*/
|
|
1380
|
+
function baseAssignValue(object, key, value) {
|
|
1381
|
+
if (key == '__proto__' && _defineProperty) {
|
|
1382
|
+
_defineProperty(object, key, {
|
|
1383
|
+
'configurable': true,
|
|
1384
|
+
'enumerable': true,
|
|
1385
|
+
'value': value,
|
|
1386
|
+
'writable': true
|
|
1387
|
+
});
|
|
1388
|
+
} else {
|
|
1389
|
+
object[key] = value;
|
|
1390
|
+
}
|
|
1391
|
+
}
|
|
1392
|
+
|
|
1393
|
+
var _baseAssignValue = baseAssignValue;
|
|
1394
|
+
|
|
1395
|
+
/** Used for built-in method references. */
|
|
1396
|
+
var objectProto$8 = Object.prototype;
|
|
1397
|
+
|
|
1398
|
+
/** Used to check objects for own properties. */
|
|
1399
|
+
var hasOwnProperty$6 = objectProto$8.hasOwnProperty;
|
|
1400
|
+
|
|
1401
|
+
/**
|
|
1402
|
+
* Assigns `value` to `key` of `object` if the existing value is not equivalent
|
|
1403
|
+
* using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
|
|
1404
|
+
* for equality comparisons.
|
|
1405
|
+
*
|
|
1406
|
+
* @private
|
|
1407
|
+
* @param {Object} object The object to modify.
|
|
1408
|
+
* @param {string} key The key of the property to assign.
|
|
1409
|
+
* @param {*} value The value to assign.
|
|
1410
|
+
*/
|
|
1411
|
+
function assignValue(object, key, value) {
|
|
1412
|
+
var objValue = object[key];
|
|
1413
|
+
if (!(hasOwnProperty$6.call(object, key) && eq_1(objValue, value)) ||
|
|
1414
|
+
(value === undefined && !(key in object))) {
|
|
1415
|
+
_baseAssignValue(object, key, value);
|
|
1416
|
+
}
|
|
1417
|
+
}
|
|
1418
|
+
|
|
1419
|
+
var _assignValue = assignValue;
|
|
1420
|
+
|
|
1421
|
+
/**
|
|
1422
|
+
* Copies properties of `source` to `object`.
|
|
1423
|
+
*
|
|
1424
|
+
* @private
|
|
1425
|
+
* @param {Object} source The object to copy properties from.
|
|
1426
|
+
* @param {Array} props The property identifiers to copy.
|
|
1427
|
+
* @param {Object} [object={}] The object to copy properties to.
|
|
1428
|
+
* @param {Function} [customizer] The function to customize copied values.
|
|
1429
|
+
* @returns {Object} Returns `object`.
|
|
1430
|
+
*/
|
|
1431
|
+
function copyObject(source, props, object, customizer) {
|
|
1432
|
+
var isNew = !object;
|
|
1433
|
+
object || (object = {});
|
|
1434
|
+
|
|
1435
|
+
var index = -1,
|
|
1436
|
+
length = props.length;
|
|
1437
|
+
|
|
1438
|
+
while (++index < length) {
|
|
1439
|
+
var key = props[index];
|
|
1440
|
+
|
|
1441
|
+
var newValue = customizer
|
|
1442
|
+
? customizer(object[key], source[key], key, object, source)
|
|
1443
|
+
: undefined;
|
|
1444
|
+
|
|
1445
|
+
if (newValue === undefined) {
|
|
1446
|
+
newValue = source[key];
|
|
1447
|
+
}
|
|
1448
|
+
if (isNew) {
|
|
1449
|
+
_baseAssignValue(object, key, newValue);
|
|
1450
|
+
} else {
|
|
1451
|
+
_assignValue(object, key, newValue);
|
|
1452
|
+
}
|
|
1453
|
+
}
|
|
1454
|
+
return object;
|
|
1455
|
+
}
|
|
1456
|
+
|
|
1457
|
+
var _copyObject = copyObject;
|
|
1458
|
+
|
|
1459
|
+
/**
|
|
1460
|
+
* The base implementation of `_.times` without support for iteratee shorthands
|
|
1461
|
+
* or max array length checks.
|
|
1462
|
+
*
|
|
1463
|
+
* @private
|
|
1464
|
+
* @param {number} n The number of times to invoke `iteratee`.
|
|
1465
|
+
* @param {Function} iteratee The function invoked per iteration.
|
|
1466
|
+
* @returns {Array} Returns the array of results.
|
|
1467
|
+
*/
|
|
1468
|
+
function baseTimes(n, iteratee) {
|
|
1469
|
+
var index = -1,
|
|
1470
|
+
result = Array(n);
|
|
1471
|
+
|
|
1472
|
+
while (++index < n) {
|
|
1473
|
+
result[index] = iteratee(index);
|
|
1474
|
+
}
|
|
1475
|
+
return result;
|
|
1476
|
+
}
|
|
1477
|
+
|
|
1478
|
+
var _baseTimes = baseTimes;
|
|
1479
|
+
|
|
1480
|
+
/**
|
|
1481
|
+
* Checks if `value` is object-like. A value is object-like if it's not `null`
|
|
1482
|
+
* and has a `typeof` result of "object".
|
|
1483
|
+
*
|
|
1484
|
+
* @static
|
|
1485
|
+
* @memberOf _
|
|
1486
|
+
* @since 4.0.0
|
|
1487
|
+
* @category Lang
|
|
1488
|
+
* @param {*} value The value to check.
|
|
1489
|
+
* @returns {boolean} Returns `true` if `value` is object-like, else `false`.
|
|
1490
|
+
* @example
|
|
1491
|
+
*
|
|
1492
|
+
* _.isObjectLike({});
|
|
1493
|
+
* // => true
|
|
1494
|
+
*
|
|
1495
|
+
* _.isObjectLike([1, 2, 3]);
|
|
1496
|
+
* // => true
|
|
1497
|
+
*
|
|
1498
|
+
* _.isObjectLike(_.noop);
|
|
1499
|
+
* // => false
|
|
1500
|
+
*
|
|
1501
|
+
* _.isObjectLike(null);
|
|
1502
|
+
* // => false
|
|
1503
|
+
*/
|
|
1504
|
+
function isObjectLike(value) {
|
|
1505
|
+
return value != null && typeof value == 'object';
|
|
1506
|
+
}
|
|
1507
|
+
|
|
1508
|
+
var isObjectLike_1 = isObjectLike;
|
|
1509
|
+
|
|
1510
|
+
/** `Object#toString` result references. */
|
|
1511
|
+
var argsTag$2 = '[object Arguments]';
|
|
1512
|
+
|
|
1513
|
+
/**
|
|
1514
|
+
* The base implementation of `_.isArguments`.
|
|
1515
|
+
*
|
|
1516
|
+
* @private
|
|
1517
|
+
* @param {*} value The value to check.
|
|
1518
|
+
* @returns {boolean} Returns `true` if `value` is an `arguments` object,
|
|
1519
|
+
*/
|
|
1520
|
+
function baseIsArguments(value) {
|
|
1521
|
+
return isObjectLike_1(value) && _baseGetTag(value) == argsTag$2;
|
|
1522
|
+
}
|
|
1523
|
+
|
|
1524
|
+
var _baseIsArguments = baseIsArguments;
|
|
1525
|
+
|
|
1526
|
+
/** Used for built-in method references. */
|
|
1527
|
+
var objectProto$7 = Object.prototype;
|
|
1528
|
+
|
|
1529
|
+
/** Used to check objects for own properties. */
|
|
1530
|
+
var hasOwnProperty$5 = objectProto$7.hasOwnProperty;
|
|
1531
|
+
|
|
1532
|
+
/** Built-in value references. */
|
|
1533
|
+
var propertyIsEnumerable$1 = objectProto$7.propertyIsEnumerable;
|
|
1534
|
+
|
|
1535
|
+
/**
|
|
1536
|
+
* Checks if `value` is likely an `arguments` object.
|
|
1537
|
+
*
|
|
1538
|
+
* @static
|
|
1539
|
+
* @memberOf _
|
|
1540
|
+
* @since 0.1.0
|
|
1541
|
+
* @category Lang
|
|
1542
|
+
* @param {*} value The value to check.
|
|
1543
|
+
* @returns {boolean} Returns `true` if `value` is an `arguments` object,
|
|
1544
|
+
* else `false`.
|
|
1545
|
+
* @example
|
|
1546
|
+
*
|
|
1547
|
+
* _.isArguments(function() { return arguments; }());
|
|
1548
|
+
* // => true
|
|
1549
|
+
*
|
|
1550
|
+
* _.isArguments([1, 2, 3]);
|
|
1551
|
+
* // => false
|
|
1552
|
+
*/
|
|
1553
|
+
var isArguments = _baseIsArguments(function() { return arguments; }()) ? _baseIsArguments : function(value) {
|
|
1554
|
+
return isObjectLike_1(value) && hasOwnProperty$5.call(value, 'callee') &&
|
|
1555
|
+
!propertyIsEnumerable$1.call(value, 'callee');
|
|
1556
|
+
};
|
|
1557
|
+
|
|
1558
|
+
var isArguments_1 = isArguments;
|
|
1559
|
+
|
|
1560
|
+
/**
|
|
1561
|
+
* Checks if `value` is classified as an `Array` object.
|
|
1562
|
+
*
|
|
1563
|
+
* @static
|
|
1564
|
+
* @memberOf _
|
|
1565
|
+
* @since 0.1.0
|
|
1566
|
+
* @category Lang
|
|
1567
|
+
* @param {*} value The value to check.
|
|
1568
|
+
* @returns {boolean} Returns `true` if `value` is an array, else `false`.
|
|
1569
|
+
* @example
|
|
1570
|
+
*
|
|
1571
|
+
* _.isArray([1, 2, 3]);
|
|
1572
|
+
* // => true
|
|
1573
|
+
*
|
|
1574
|
+
* _.isArray(document.body.children);
|
|
1575
|
+
* // => false
|
|
1576
|
+
*
|
|
1577
|
+
* _.isArray('abc');
|
|
1578
|
+
* // => false
|
|
1579
|
+
*
|
|
1580
|
+
* _.isArray(_.noop);
|
|
1581
|
+
* // => false
|
|
1582
|
+
*/
|
|
1583
|
+
var isArray = Array.isArray;
|
|
1584
|
+
|
|
1585
|
+
var isArray_1 = isArray;
|
|
1586
|
+
|
|
1587
|
+
/**
|
|
1588
|
+
* This method returns `false`.
|
|
1589
|
+
*
|
|
1590
|
+
* @static
|
|
1591
|
+
* @memberOf _
|
|
1592
|
+
* @since 4.13.0
|
|
1593
|
+
* @category Util
|
|
1594
|
+
* @returns {boolean} Returns `false`.
|
|
1595
|
+
* @example
|
|
1596
|
+
*
|
|
1597
|
+
* _.times(2, _.stubFalse);
|
|
1598
|
+
* // => [false, false]
|
|
1599
|
+
*/
|
|
1600
|
+
function stubFalse() {
|
|
1601
|
+
return false;
|
|
1602
|
+
}
|
|
1603
|
+
|
|
1604
|
+
var stubFalse_1 = stubFalse;
|
|
1605
|
+
|
|
1606
|
+
var isBuffer_1 = createCommonjsModule(function (module, exports) {
|
|
1607
|
+
/** Detect free variable `exports`. */
|
|
1608
|
+
var freeExports = exports && !exports.nodeType && exports;
|
|
1609
|
+
|
|
1610
|
+
/** Detect free variable `module`. */
|
|
1611
|
+
var freeModule = freeExports && 'object' == 'object' && module && !module.nodeType && module;
|
|
1612
|
+
|
|
1613
|
+
/** Detect the popular CommonJS extension `module.exports`. */
|
|
1614
|
+
var moduleExports = freeModule && freeModule.exports === freeExports;
|
|
1615
|
+
|
|
1616
|
+
/** Built-in value references. */
|
|
1617
|
+
var Buffer = moduleExports ? _root.Buffer : undefined;
|
|
1618
|
+
|
|
1619
|
+
/* Built-in method references for those with the same name as other `lodash` methods. */
|
|
1620
|
+
var nativeIsBuffer = Buffer ? Buffer.isBuffer : undefined;
|
|
1621
|
+
|
|
1622
|
+
/**
|
|
1623
|
+
* Checks if `value` is a buffer.
|
|
1624
|
+
*
|
|
1625
|
+
* @static
|
|
1626
|
+
* @memberOf _
|
|
1627
|
+
* @since 4.3.0
|
|
1628
|
+
* @category Lang
|
|
1629
|
+
* @param {*} value The value to check.
|
|
1630
|
+
* @returns {boolean} Returns `true` if `value` is a buffer, else `false`.
|
|
1631
|
+
* @example
|
|
1632
|
+
*
|
|
1633
|
+
* _.isBuffer(new Buffer(2));
|
|
1634
|
+
* // => true
|
|
1635
|
+
*
|
|
1636
|
+
* _.isBuffer(new Uint8Array(2));
|
|
1637
|
+
* // => false
|
|
1638
|
+
*/
|
|
1639
|
+
var isBuffer = nativeIsBuffer || stubFalse_1;
|
|
1640
|
+
|
|
1641
|
+
module.exports = isBuffer;
|
|
1642
|
+
});
|
|
1643
|
+
|
|
1644
|
+
/** Used as references for various `Number` constants. */
|
|
1645
|
+
var MAX_SAFE_INTEGER$1 = 9007199254740991;
|
|
1646
|
+
|
|
1647
|
+
/** Used to detect unsigned integer values. */
|
|
1648
|
+
var reIsUint = /^(?:0|[1-9]\d*)$/;
|
|
1649
|
+
|
|
1650
|
+
/**
|
|
1651
|
+
* Checks if `value` is a valid array-like index.
|
|
1652
|
+
*
|
|
1653
|
+
* @private
|
|
1654
|
+
* @param {*} value The value to check.
|
|
1655
|
+
* @param {number} [length=MAX_SAFE_INTEGER] The upper bounds of a valid index.
|
|
1656
|
+
* @returns {boolean} Returns `true` if `value` is a valid index, else `false`.
|
|
1657
|
+
*/
|
|
1658
|
+
function isIndex(value, length) {
|
|
1659
|
+
var type = typeof value;
|
|
1660
|
+
length = length == null ? MAX_SAFE_INTEGER$1 : length;
|
|
1661
|
+
|
|
1662
|
+
return !!length &&
|
|
1663
|
+
(type == 'number' ||
|
|
1664
|
+
(type != 'symbol' && reIsUint.test(value))) &&
|
|
1665
|
+
(value > -1 && value % 1 == 0 && value < length);
|
|
1666
|
+
}
|
|
1667
|
+
|
|
1668
|
+
var _isIndex = isIndex;
|
|
1669
|
+
|
|
1670
|
+
/** Used as references for various `Number` constants. */
|
|
1671
|
+
var MAX_SAFE_INTEGER = 9007199254740991;
|
|
1672
|
+
|
|
1673
|
+
/**
|
|
1674
|
+
* Checks if `value` is a valid array-like length.
|
|
1675
|
+
*
|
|
1676
|
+
* **Note:** This method is loosely based on
|
|
1677
|
+
* [`ToLength`](http://ecma-international.org/ecma-262/7.0/#sec-tolength).
|
|
1678
|
+
*
|
|
1679
|
+
* @static
|
|
1680
|
+
* @memberOf _
|
|
1681
|
+
* @since 4.0.0
|
|
1682
|
+
* @category Lang
|
|
1683
|
+
* @param {*} value The value to check.
|
|
1684
|
+
* @returns {boolean} Returns `true` if `value` is a valid length, else `false`.
|
|
1685
|
+
* @example
|
|
1686
|
+
*
|
|
1687
|
+
* _.isLength(3);
|
|
1688
|
+
* // => true
|
|
1689
|
+
*
|
|
1690
|
+
* _.isLength(Number.MIN_VALUE);
|
|
1691
|
+
* // => false
|
|
1692
|
+
*
|
|
1693
|
+
* _.isLength(Infinity);
|
|
1694
|
+
* // => false
|
|
1695
|
+
*
|
|
1696
|
+
* _.isLength('3');
|
|
1697
|
+
* // => false
|
|
1698
|
+
*/
|
|
1699
|
+
function isLength(value) {
|
|
1700
|
+
return typeof value == 'number' &&
|
|
1701
|
+
value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER;
|
|
1702
|
+
}
|
|
1703
|
+
|
|
1704
|
+
var isLength_1 = isLength;
|
|
1705
|
+
|
|
1706
|
+
/** `Object#toString` result references. */
|
|
1707
|
+
var argsTag$1 = '[object Arguments]',
|
|
1708
|
+
arrayTag$1 = '[object Array]',
|
|
1709
|
+
boolTag$2 = '[object Boolean]',
|
|
1710
|
+
dateTag$2 = '[object Date]',
|
|
1711
|
+
errorTag$1 = '[object Error]',
|
|
1712
|
+
funcTag$1 = '[object Function]',
|
|
1713
|
+
mapTag$4 = '[object Map]',
|
|
1714
|
+
numberTag$2 = '[object Number]',
|
|
1715
|
+
objectTag$3 = '[object Object]',
|
|
1716
|
+
regexpTag$2 = '[object RegExp]',
|
|
1717
|
+
setTag$4 = '[object Set]',
|
|
1718
|
+
stringTag$2 = '[object String]',
|
|
1719
|
+
weakMapTag$2 = '[object WeakMap]';
|
|
1720
|
+
|
|
1721
|
+
var arrayBufferTag$2 = '[object ArrayBuffer]',
|
|
1722
|
+
dataViewTag$3 = '[object DataView]',
|
|
1723
|
+
float32Tag$2 = '[object Float32Array]',
|
|
1724
|
+
float64Tag$2 = '[object Float64Array]',
|
|
1725
|
+
int8Tag$2 = '[object Int8Array]',
|
|
1726
|
+
int16Tag$2 = '[object Int16Array]',
|
|
1727
|
+
int32Tag$2 = '[object Int32Array]',
|
|
1728
|
+
uint8Tag$2 = '[object Uint8Array]',
|
|
1729
|
+
uint8ClampedTag$2 = '[object Uint8ClampedArray]',
|
|
1730
|
+
uint16Tag$2 = '[object Uint16Array]',
|
|
1731
|
+
uint32Tag$2 = '[object Uint32Array]';
|
|
1732
|
+
|
|
1733
|
+
/** Used to identify `toStringTag` values of typed arrays. */
|
|
1734
|
+
var typedArrayTags = {};
|
|
1735
|
+
typedArrayTags[float32Tag$2] = typedArrayTags[float64Tag$2] =
|
|
1736
|
+
typedArrayTags[int8Tag$2] = typedArrayTags[int16Tag$2] =
|
|
1737
|
+
typedArrayTags[int32Tag$2] = typedArrayTags[uint8Tag$2] =
|
|
1738
|
+
typedArrayTags[uint8ClampedTag$2] = typedArrayTags[uint16Tag$2] =
|
|
1739
|
+
typedArrayTags[uint32Tag$2] = true;
|
|
1740
|
+
typedArrayTags[argsTag$1] = typedArrayTags[arrayTag$1] =
|
|
1741
|
+
typedArrayTags[arrayBufferTag$2] = typedArrayTags[boolTag$2] =
|
|
1742
|
+
typedArrayTags[dataViewTag$3] = typedArrayTags[dateTag$2] =
|
|
1743
|
+
typedArrayTags[errorTag$1] = typedArrayTags[funcTag$1] =
|
|
1744
|
+
typedArrayTags[mapTag$4] = typedArrayTags[numberTag$2] =
|
|
1745
|
+
typedArrayTags[objectTag$3] = typedArrayTags[regexpTag$2] =
|
|
1746
|
+
typedArrayTags[setTag$4] = typedArrayTags[stringTag$2] =
|
|
1747
|
+
typedArrayTags[weakMapTag$2] = false;
|
|
1748
|
+
|
|
1749
|
+
/**
|
|
1750
|
+
* The base implementation of `_.isTypedArray` without Node.js optimizations.
|
|
1751
|
+
*
|
|
1752
|
+
* @private
|
|
1753
|
+
* @param {*} value The value to check.
|
|
1754
|
+
* @returns {boolean} Returns `true` if `value` is a typed array, else `false`.
|
|
1755
|
+
*/
|
|
1756
|
+
function baseIsTypedArray(value) {
|
|
1757
|
+
return isObjectLike_1(value) &&
|
|
1758
|
+
isLength_1(value.length) && !!typedArrayTags[_baseGetTag(value)];
|
|
1759
|
+
}
|
|
1760
|
+
|
|
1761
|
+
var _baseIsTypedArray = baseIsTypedArray;
|
|
1762
|
+
|
|
1763
|
+
/**
|
|
1764
|
+
* The base implementation of `_.unary` without support for storing metadata.
|
|
1765
|
+
*
|
|
1766
|
+
* @private
|
|
1767
|
+
* @param {Function} func The function to cap arguments for.
|
|
1768
|
+
* @returns {Function} Returns the new capped function.
|
|
1769
|
+
*/
|
|
1770
|
+
function baseUnary(func) {
|
|
1771
|
+
return function(value) {
|
|
1772
|
+
return func(value);
|
|
1773
|
+
};
|
|
1774
|
+
}
|
|
1775
|
+
|
|
1776
|
+
var _baseUnary = baseUnary;
|
|
1777
|
+
|
|
1778
|
+
var _nodeUtil = createCommonjsModule(function (module, exports) {
|
|
1779
|
+
/** Detect free variable `exports`. */
|
|
1780
|
+
var freeExports = exports && !exports.nodeType && exports;
|
|
1781
|
+
|
|
1782
|
+
/** Detect free variable `module`. */
|
|
1783
|
+
var freeModule = freeExports && 'object' == 'object' && module && !module.nodeType && module;
|
|
1784
|
+
|
|
1785
|
+
/** Detect the popular CommonJS extension `module.exports`. */
|
|
1786
|
+
var moduleExports = freeModule && freeModule.exports === freeExports;
|
|
1787
|
+
|
|
1788
|
+
/** Detect free variable `process` from Node.js. */
|
|
1789
|
+
var freeProcess = moduleExports && _freeGlobal.process;
|
|
1790
|
+
|
|
1791
|
+
/** Used to access faster Node.js helpers. */
|
|
1792
|
+
var nodeUtil = (function() {
|
|
1793
|
+
try {
|
|
1794
|
+
// Use `util.types` for Node.js 10+.
|
|
1795
|
+
var types = freeModule && freeModule.require && freeModule.require('util').types;
|
|
1796
|
+
|
|
1797
|
+
if (types) {
|
|
1798
|
+
return types;
|
|
1799
|
+
}
|
|
1800
|
+
|
|
1801
|
+
// Legacy `process.binding('util')` for Node.js < 10.
|
|
1802
|
+
return freeProcess && freeProcess.binding && freeProcess.binding('util');
|
|
1803
|
+
} catch (e) {}
|
|
1804
|
+
}());
|
|
1805
|
+
|
|
1806
|
+
module.exports = nodeUtil;
|
|
1807
|
+
});
|
|
1808
|
+
|
|
1809
|
+
/* Node.js helper references. */
|
|
1810
|
+
var nodeIsTypedArray = _nodeUtil && _nodeUtil.isTypedArray;
|
|
1811
|
+
|
|
1812
|
+
/**
|
|
1813
|
+
* Checks if `value` is classified as a typed array.
|
|
1814
|
+
*
|
|
1815
|
+
* @static
|
|
1816
|
+
* @memberOf _
|
|
1817
|
+
* @since 3.0.0
|
|
1818
|
+
* @category Lang
|
|
1819
|
+
* @param {*} value The value to check.
|
|
1820
|
+
* @returns {boolean} Returns `true` if `value` is a typed array, else `false`.
|
|
1821
|
+
* @example
|
|
1822
|
+
*
|
|
1823
|
+
* _.isTypedArray(new Uint8Array);
|
|
1824
|
+
* // => true
|
|
1825
|
+
*
|
|
1826
|
+
* _.isTypedArray([]);
|
|
1827
|
+
* // => false
|
|
1828
|
+
*/
|
|
1829
|
+
var isTypedArray = nodeIsTypedArray ? _baseUnary(nodeIsTypedArray) : _baseIsTypedArray;
|
|
1830
|
+
|
|
1831
|
+
var isTypedArray_1 = isTypedArray;
|
|
1832
|
+
|
|
1833
|
+
/** Used for built-in method references. */
|
|
1834
|
+
var objectProto$6 = Object.prototype;
|
|
1835
|
+
|
|
1836
|
+
/** Used to check objects for own properties. */
|
|
1837
|
+
var hasOwnProperty$4 = objectProto$6.hasOwnProperty;
|
|
1838
|
+
|
|
1839
|
+
/**
|
|
1840
|
+
* Creates an array of the enumerable property names of the array-like `value`.
|
|
1841
|
+
*
|
|
1842
|
+
* @private
|
|
1843
|
+
* @param {*} value The value to query.
|
|
1844
|
+
* @param {boolean} inherited Specify returning inherited property names.
|
|
1845
|
+
* @returns {Array} Returns the array of property names.
|
|
1846
|
+
*/
|
|
1847
|
+
function arrayLikeKeys(value, inherited) {
|
|
1848
|
+
var isArr = isArray_1(value),
|
|
1849
|
+
isArg = !isArr && isArguments_1(value),
|
|
1850
|
+
isBuff = !isArr && !isArg && isBuffer_1(value),
|
|
1851
|
+
isType = !isArr && !isArg && !isBuff && isTypedArray_1(value),
|
|
1852
|
+
skipIndexes = isArr || isArg || isBuff || isType,
|
|
1853
|
+
result = skipIndexes ? _baseTimes(value.length, String) : [],
|
|
1854
|
+
length = result.length;
|
|
1855
|
+
|
|
1856
|
+
for (var key in value) {
|
|
1857
|
+
if ((inherited || hasOwnProperty$4.call(value, key)) &&
|
|
1858
|
+
!(skipIndexes && (
|
|
1859
|
+
// Safari 9 has enumerable `arguments.length` in strict mode.
|
|
1860
|
+
key == 'length' ||
|
|
1861
|
+
// Node.js 0.10 has enumerable non-index properties on buffers.
|
|
1862
|
+
(isBuff && (key == 'offset' || key == 'parent')) ||
|
|
1863
|
+
// PhantomJS 2 has enumerable non-index properties on typed arrays.
|
|
1864
|
+
(isType && (key == 'buffer' || key == 'byteLength' || key == 'byteOffset')) ||
|
|
1865
|
+
// Skip index properties.
|
|
1866
|
+
_isIndex(key, length)
|
|
1867
|
+
))) {
|
|
1868
|
+
result.push(key);
|
|
1869
|
+
}
|
|
1870
|
+
}
|
|
1871
|
+
return result;
|
|
1872
|
+
}
|
|
1873
|
+
|
|
1874
|
+
var _arrayLikeKeys = arrayLikeKeys;
|
|
1875
|
+
|
|
1876
|
+
/** Used for built-in method references. */
|
|
1877
|
+
var objectProto$5 = Object.prototype;
|
|
1878
|
+
|
|
1879
|
+
/**
|
|
1880
|
+
* Checks if `value` is likely a prototype object.
|
|
1881
|
+
*
|
|
1882
|
+
* @private
|
|
1883
|
+
* @param {*} value The value to check.
|
|
1884
|
+
* @returns {boolean} Returns `true` if `value` is a prototype, else `false`.
|
|
1885
|
+
*/
|
|
1886
|
+
function isPrototype(value) {
|
|
1887
|
+
var Ctor = value && value.constructor,
|
|
1888
|
+
proto = (typeof Ctor == 'function' && Ctor.prototype) || objectProto$5;
|
|
1889
|
+
|
|
1890
|
+
return value === proto;
|
|
1891
|
+
}
|
|
1892
|
+
|
|
1893
|
+
var _isPrototype = isPrototype;
|
|
1894
|
+
|
|
1895
|
+
/**
|
|
1896
|
+
* Creates a unary function that invokes `func` with its argument transformed.
|
|
1897
|
+
*
|
|
1898
|
+
* @private
|
|
1899
|
+
* @param {Function} func The function to wrap.
|
|
1900
|
+
* @param {Function} transform The argument transform.
|
|
1901
|
+
* @returns {Function} Returns the new function.
|
|
1902
|
+
*/
|
|
1903
|
+
function overArg(func, transform) {
|
|
1904
|
+
return function(arg) {
|
|
1905
|
+
return func(transform(arg));
|
|
1906
|
+
};
|
|
1907
|
+
}
|
|
1908
|
+
|
|
1909
|
+
var _overArg = overArg;
|
|
1910
|
+
|
|
1911
|
+
/* Built-in method references for those with the same name as other `lodash` methods. */
|
|
1912
|
+
var nativeKeys = _overArg(Object.keys, Object);
|
|
1913
|
+
|
|
1914
|
+
var _nativeKeys = nativeKeys;
|
|
1915
|
+
|
|
1916
|
+
/** Used for built-in method references. */
|
|
1917
|
+
var objectProto$4 = Object.prototype;
|
|
1918
|
+
|
|
1919
|
+
/** Used to check objects for own properties. */
|
|
1920
|
+
var hasOwnProperty$3 = objectProto$4.hasOwnProperty;
|
|
1921
|
+
|
|
1922
|
+
/**
|
|
1923
|
+
* The base implementation of `_.keys` which doesn't treat sparse arrays as dense.
|
|
1924
|
+
*
|
|
1925
|
+
* @private
|
|
1926
|
+
* @param {Object} object The object to query.
|
|
1927
|
+
* @returns {Array} Returns the array of property names.
|
|
1928
|
+
*/
|
|
1929
|
+
function baseKeys(object) {
|
|
1930
|
+
if (!_isPrototype(object)) {
|
|
1931
|
+
return _nativeKeys(object);
|
|
1932
|
+
}
|
|
1933
|
+
var result = [];
|
|
1934
|
+
for (var key in Object(object)) {
|
|
1935
|
+
if (hasOwnProperty$3.call(object, key) && key != 'constructor') {
|
|
1936
|
+
result.push(key);
|
|
1937
|
+
}
|
|
1938
|
+
}
|
|
1939
|
+
return result;
|
|
1940
|
+
}
|
|
1941
|
+
|
|
1942
|
+
var _baseKeys = baseKeys;
|
|
1943
|
+
|
|
1944
|
+
/**
|
|
1945
|
+
* Checks if `value` is array-like. A value is considered array-like if it's
|
|
1946
|
+
* not a function and has a `value.length` that's an integer greater than or
|
|
1947
|
+
* equal to `0` and less than or equal to `Number.MAX_SAFE_INTEGER`.
|
|
1948
|
+
*
|
|
1949
|
+
* @static
|
|
1950
|
+
* @memberOf _
|
|
1951
|
+
* @since 4.0.0
|
|
1952
|
+
* @category Lang
|
|
1953
|
+
* @param {*} value The value to check.
|
|
1954
|
+
* @returns {boolean} Returns `true` if `value` is array-like, else `false`.
|
|
1955
|
+
* @example
|
|
1956
|
+
*
|
|
1957
|
+
* _.isArrayLike([1, 2, 3]);
|
|
1958
|
+
* // => true
|
|
1959
|
+
*
|
|
1960
|
+
* _.isArrayLike(document.body.children);
|
|
1961
|
+
* // => true
|
|
1962
|
+
*
|
|
1963
|
+
* _.isArrayLike('abc');
|
|
1964
|
+
* // => true
|
|
1965
|
+
*
|
|
1966
|
+
* _.isArrayLike(_.noop);
|
|
1967
|
+
* // => false
|
|
1968
|
+
*/
|
|
1969
|
+
function isArrayLike(value) {
|
|
1970
|
+
return value != null && isLength_1(value.length) && !isFunction_1(value);
|
|
1971
|
+
}
|
|
1972
|
+
|
|
1973
|
+
var isArrayLike_1 = isArrayLike;
|
|
1974
|
+
|
|
1975
|
+
/**
|
|
1976
|
+
* Creates an array of the own enumerable property names of `object`.
|
|
1977
|
+
*
|
|
1978
|
+
* **Note:** Non-object values are coerced to objects. See the
|
|
1979
|
+
* [ES spec](http://ecma-international.org/ecma-262/7.0/#sec-object.keys)
|
|
1980
|
+
* for more details.
|
|
1981
|
+
*
|
|
1982
|
+
* @static
|
|
1983
|
+
* @since 0.1.0
|
|
1984
|
+
* @memberOf _
|
|
1985
|
+
* @category Object
|
|
1986
|
+
* @param {Object} object The object to query.
|
|
1987
|
+
* @returns {Array} Returns the array of property names.
|
|
1988
|
+
* @example
|
|
1989
|
+
*
|
|
1990
|
+
* function Foo() {
|
|
1991
|
+
* this.a = 1;
|
|
1992
|
+
* this.b = 2;
|
|
1993
|
+
* }
|
|
1994
|
+
*
|
|
1995
|
+
* Foo.prototype.c = 3;
|
|
1996
|
+
*
|
|
1997
|
+
* _.keys(new Foo);
|
|
1998
|
+
* // => ['a', 'b'] (iteration order is not guaranteed)
|
|
1999
|
+
*
|
|
2000
|
+
* _.keys('hi');
|
|
2001
|
+
* // => ['0', '1']
|
|
2002
|
+
*/
|
|
2003
|
+
function keys(object) {
|
|
2004
|
+
return isArrayLike_1(object) ? _arrayLikeKeys(object) : _baseKeys(object);
|
|
2005
|
+
}
|
|
2006
|
+
|
|
2007
|
+
var keys_1 = keys;
|
|
2008
|
+
|
|
2009
|
+
/**
|
|
2010
|
+
* The base implementation of `_.assign` without support for multiple sources
|
|
2011
|
+
* or `customizer` functions.
|
|
2012
|
+
*
|
|
2013
|
+
* @private
|
|
2014
|
+
* @param {Object} object The destination object.
|
|
2015
|
+
* @param {Object} source The source object.
|
|
2016
|
+
* @returns {Object} Returns `object`.
|
|
2017
|
+
*/
|
|
2018
|
+
function baseAssign(object, source) {
|
|
2019
|
+
return object && _copyObject(source, keys_1(source), object);
|
|
2020
|
+
}
|
|
2021
|
+
|
|
2022
|
+
var _baseAssign = baseAssign;
|
|
2023
|
+
|
|
2024
|
+
/**
|
|
2025
|
+
* This function is like
|
|
2026
|
+
* [`Object.keys`](http://ecma-international.org/ecma-262/7.0/#sec-object.keys)
|
|
2027
|
+
* except that it includes inherited enumerable properties.
|
|
2028
|
+
*
|
|
2029
|
+
* @private
|
|
2030
|
+
* @param {Object} object The object to query.
|
|
2031
|
+
* @returns {Array} Returns the array of property names.
|
|
2032
|
+
*/
|
|
2033
|
+
function nativeKeysIn(object) {
|
|
2034
|
+
var result = [];
|
|
2035
|
+
if (object != null) {
|
|
2036
|
+
for (var key in Object(object)) {
|
|
2037
|
+
result.push(key);
|
|
2038
|
+
}
|
|
2039
|
+
}
|
|
2040
|
+
return result;
|
|
2041
|
+
}
|
|
2042
|
+
|
|
2043
|
+
var _nativeKeysIn = nativeKeysIn;
|
|
2044
|
+
|
|
2045
|
+
/** Used for built-in method references. */
|
|
2046
|
+
var objectProto$3 = Object.prototype;
|
|
2047
|
+
|
|
2048
|
+
/** Used to check objects for own properties. */
|
|
2049
|
+
var hasOwnProperty$2 = objectProto$3.hasOwnProperty;
|
|
2050
|
+
|
|
2051
|
+
/**
|
|
2052
|
+
* The base implementation of `_.keysIn` which doesn't treat sparse arrays as dense.
|
|
2053
|
+
*
|
|
2054
|
+
* @private
|
|
2055
|
+
* @param {Object} object The object to query.
|
|
2056
|
+
* @returns {Array} Returns the array of property names.
|
|
2057
|
+
*/
|
|
2058
|
+
function baseKeysIn(object) {
|
|
2059
|
+
if (!isObject_1(object)) {
|
|
2060
|
+
return _nativeKeysIn(object);
|
|
2061
|
+
}
|
|
2062
|
+
var isProto = _isPrototype(object),
|
|
2063
|
+
result = [];
|
|
2064
|
+
|
|
2065
|
+
for (var key in object) {
|
|
2066
|
+
if (!(key == 'constructor' && (isProto || !hasOwnProperty$2.call(object, key)))) {
|
|
2067
|
+
result.push(key);
|
|
2068
|
+
}
|
|
2069
|
+
}
|
|
2070
|
+
return result;
|
|
2071
|
+
}
|
|
2072
|
+
|
|
2073
|
+
var _baseKeysIn = baseKeysIn;
|
|
2074
|
+
|
|
2075
|
+
/**
|
|
2076
|
+
* Creates an array of the own and inherited enumerable property names of `object`.
|
|
2077
|
+
*
|
|
2078
|
+
* **Note:** Non-object values are coerced to objects.
|
|
2079
|
+
*
|
|
2080
|
+
* @static
|
|
2081
|
+
* @memberOf _
|
|
2082
|
+
* @since 3.0.0
|
|
2083
|
+
* @category Object
|
|
2084
|
+
* @param {Object} object The object to query.
|
|
2085
|
+
* @returns {Array} Returns the array of property names.
|
|
2086
|
+
* @example
|
|
2087
|
+
*
|
|
2088
|
+
* function Foo() {
|
|
2089
|
+
* this.a = 1;
|
|
2090
|
+
* this.b = 2;
|
|
2091
|
+
* }
|
|
2092
|
+
*
|
|
2093
|
+
* Foo.prototype.c = 3;
|
|
2094
|
+
*
|
|
2095
|
+
* _.keysIn(new Foo);
|
|
2096
|
+
* // => ['a', 'b', 'c'] (iteration order is not guaranteed)
|
|
2097
|
+
*/
|
|
2098
|
+
function keysIn(object) {
|
|
2099
|
+
return isArrayLike_1(object) ? _arrayLikeKeys(object, true) : _baseKeysIn(object);
|
|
2100
|
+
}
|
|
2101
|
+
|
|
2102
|
+
var keysIn_1 = keysIn;
|
|
2103
|
+
|
|
2104
|
+
/**
|
|
2105
|
+
* The base implementation of `_.assignIn` without support for multiple sources
|
|
2106
|
+
* or `customizer` functions.
|
|
2107
|
+
*
|
|
2108
|
+
* @private
|
|
2109
|
+
* @param {Object} object The destination object.
|
|
2110
|
+
* @param {Object} source The source object.
|
|
2111
|
+
* @returns {Object} Returns `object`.
|
|
2112
|
+
*/
|
|
2113
|
+
function baseAssignIn(object, source) {
|
|
2114
|
+
return object && _copyObject(source, keysIn_1(source), object);
|
|
2115
|
+
}
|
|
2116
|
+
|
|
2117
|
+
var _baseAssignIn = baseAssignIn;
|
|
2118
|
+
|
|
2119
|
+
var _cloneBuffer = createCommonjsModule(function (module, exports) {
|
|
2120
|
+
/** Detect free variable `exports`. */
|
|
2121
|
+
var freeExports = exports && !exports.nodeType && exports;
|
|
2122
|
+
|
|
2123
|
+
/** Detect free variable `module`. */
|
|
2124
|
+
var freeModule = freeExports && 'object' == 'object' && module && !module.nodeType && module;
|
|
2125
|
+
|
|
2126
|
+
/** Detect the popular CommonJS extension `module.exports`. */
|
|
2127
|
+
var moduleExports = freeModule && freeModule.exports === freeExports;
|
|
2128
|
+
|
|
2129
|
+
/** Built-in value references. */
|
|
2130
|
+
var Buffer = moduleExports ? _root.Buffer : undefined,
|
|
2131
|
+
allocUnsafe = Buffer ? Buffer.allocUnsafe : undefined;
|
|
2132
|
+
|
|
2133
|
+
/**
|
|
2134
|
+
* Creates a clone of `buffer`.
|
|
2135
|
+
*
|
|
2136
|
+
* @private
|
|
2137
|
+
* @param {Buffer} buffer The buffer to clone.
|
|
2138
|
+
* @param {boolean} [isDeep] Specify a deep clone.
|
|
2139
|
+
* @returns {Buffer} Returns the cloned buffer.
|
|
2140
|
+
*/
|
|
2141
|
+
function cloneBuffer(buffer, isDeep) {
|
|
2142
|
+
if (isDeep) {
|
|
2143
|
+
return buffer.slice();
|
|
2144
|
+
}
|
|
2145
|
+
var length = buffer.length,
|
|
2146
|
+
result = allocUnsafe ? allocUnsafe(length) : new buffer.constructor(length);
|
|
2147
|
+
|
|
2148
|
+
buffer.copy(result);
|
|
2149
|
+
return result;
|
|
2150
|
+
}
|
|
2151
|
+
|
|
2152
|
+
module.exports = cloneBuffer;
|
|
2153
|
+
});
|
|
2154
|
+
|
|
2155
|
+
/**
|
|
2156
|
+
* Copies the values of `source` to `array`.
|
|
2157
|
+
*
|
|
2158
|
+
* @private
|
|
2159
|
+
* @param {Array} source The array to copy values from.
|
|
2160
|
+
* @param {Array} [array=[]] The array to copy values to.
|
|
2161
|
+
* @returns {Array} Returns `array`.
|
|
2162
|
+
*/
|
|
2163
|
+
function copyArray(source, array) {
|
|
2164
|
+
var index = -1,
|
|
2165
|
+
length = source.length;
|
|
2166
|
+
|
|
2167
|
+
array || (array = Array(length));
|
|
2168
|
+
while (++index < length) {
|
|
2169
|
+
array[index] = source[index];
|
|
2170
|
+
}
|
|
2171
|
+
return array;
|
|
2172
|
+
}
|
|
2173
|
+
|
|
2174
|
+
var _copyArray = copyArray;
|
|
2175
|
+
|
|
2176
|
+
/**
|
|
2177
|
+
* A specialized version of `_.filter` for arrays without support for
|
|
2178
|
+
* iteratee shorthands.
|
|
2179
|
+
*
|
|
2180
|
+
* @private
|
|
2181
|
+
* @param {Array} [array] The array to iterate over.
|
|
2182
|
+
* @param {Function} predicate The function invoked per iteration.
|
|
2183
|
+
* @returns {Array} Returns the new filtered array.
|
|
2184
|
+
*/
|
|
2185
|
+
function arrayFilter(array, predicate) {
|
|
2186
|
+
var index = -1,
|
|
2187
|
+
length = array == null ? 0 : array.length,
|
|
2188
|
+
resIndex = 0,
|
|
2189
|
+
result = [];
|
|
2190
|
+
|
|
2191
|
+
while (++index < length) {
|
|
2192
|
+
var value = array[index];
|
|
2193
|
+
if (predicate(value, index, array)) {
|
|
2194
|
+
result[resIndex++] = value;
|
|
2195
|
+
}
|
|
2196
|
+
}
|
|
2197
|
+
return result;
|
|
2198
|
+
}
|
|
2199
|
+
|
|
2200
|
+
var _arrayFilter = arrayFilter;
|
|
2201
|
+
|
|
2202
|
+
/**
|
|
2203
|
+
* This method returns a new empty array.
|
|
2204
|
+
*
|
|
2205
|
+
* @static
|
|
2206
|
+
* @memberOf _
|
|
2207
|
+
* @since 4.13.0
|
|
2208
|
+
* @category Util
|
|
2209
|
+
* @returns {Array} Returns the new empty array.
|
|
2210
|
+
* @example
|
|
2211
|
+
*
|
|
2212
|
+
* var arrays = _.times(2, _.stubArray);
|
|
2213
|
+
*
|
|
2214
|
+
* console.log(arrays);
|
|
2215
|
+
* // => [[], []]
|
|
2216
|
+
*
|
|
2217
|
+
* console.log(arrays[0] === arrays[1]);
|
|
2218
|
+
* // => false
|
|
2219
|
+
*/
|
|
2220
|
+
function stubArray() {
|
|
2221
|
+
return [];
|
|
2222
|
+
}
|
|
2223
|
+
|
|
2224
|
+
var stubArray_1 = stubArray;
|
|
2225
|
+
|
|
2226
|
+
/** Used for built-in method references. */
|
|
2227
|
+
var objectProto$2 = Object.prototype;
|
|
2228
|
+
|
|
2229
|
+
/** Built-in value references. */
|
|
2230
|
+
var propertyIsEnumerable = objectProto$2.propertyIsEnumerable;
|
|
2231
|
+
|
|
2232
|
+
/* Built-in method references for those with the same name as other `lodash` methods. */
|
|
2233
|
+
var nativeGetSymbols$1 = Object.getOwnPropertySymbols;
|
|
2234
|
+
|
|
2235
|
+
/**
|
|
2236
|
+
* Creates an array of the own enumerable symbols of `object`.
|
|
2237
|
+
*
|
|
2238
|
+
* @private
|
|
2239
|
+
* @param {Object} object The object to query.
|
|
2240
|
+
* @returns {Array} Returns the array of symbols.
|
|
2241
|
+
*/
|
|
2242
|
+
var getSymbols = !nativeGetSymbols$1 ? stubArray_1 : function(object) {
|
|
2243
|
+
if (object == null) {
|
|
2244
|
+
return [];
|
|
2245
|
+
}
|
|
2246
|
+
object = Object(object);
|
|
2247
|
+
return _arrayFilter(nativeGetSymbols$1(object), function(symbol) {
|
|
2248
|
+
return propertyIsEnumerable.call(object, symbol);
|
|
2249
|
+
});
|
|
2250
|
+
};
|
|
2251
|
+
|
|
2252
|
+
var _getSymbols = getSymbols;
|
|
2253
|
+
|
|
2254
|
+
/**
|
|
2255
|
+
* Copies own symbols of `source` to `object`.
|
|
2256
|
+
*
|
|
2257
|
+
* @private
|
|
2258
|
+
* @param {Object} source The object to copy symbols from.
|
|
2259
|
+
* @param {Object} [object={}] The object to copy symbols to.
|
|
2260
|
+
* @returns {Object} Returns `object`.
|
|
2261
|
+
*/
|
|
2262
|
+
function copySymbols(source, object) {
|
|
2263
|
+
return _copyObject(source, _getSymbols(source), object);
|
|
2264
|
+
}
|
|
2265
|
+
|
|
2266
|
+
var _copySymbols = copySymbols;
|
|
2267
|
+
|
|
2268
|
+
/**
|
|
2269
|
+
* Appends the elements of `values` to `array`.
|
|
2270
|
+
*
|
|
2271
|
+
* @private
|
|
2272
|
+
* @param {Array} array The array to modify.
|
|
2273
|
+
* @param {Array} values The values to append.
|
|
2274
|
+
* @returns {Array} Returns `array`.
|
|
2275
|
+
*/
|
|
2276
|
+
function arrayPush(array, values) {
|
|
2277
|
+
var index = -1,
|
|
2278
|
+
length = values.length,
|
|
2279
|
+
offset = array.length;
|
|
2280
|
+
|
|
2281
|
+
while (++index < length) {
|
|
2282
|
+
array[offset + index] = values[index];
|
|
2283
|
+
}
|
|
2284
|
+
return array;
|
|
2285
|
+
}
|
|
2286
|
+
|
|
2287
|
+
var _arrayPush = arrayPush;
|
|
2288
|
+
|
|
2289
|
+
/** Built-in value references. */
|
|
2290
|
+
var getPrototype = _overArg(Object.getPrototypeOf, Object);
|
|
2291
|
+
|
|
2292
|
+
var _getPrototype = getPrototype;
|
|
2293
|
+
|
|
2294
|
+
/* Built-in method references for those with the same name as other `lodash` methods. */
|
|
2295
|
+
var nativeGetSymbols = Object.getOwnPropertySymbols;
|
|
2296
|
+
|
|
2297
|
+
/**
|
|
2298
|
+
* Creates an array of the own and inherited enumerable symbols of `object`.
|
|
2299
|
+
*
|
|
2300
|
+
* @private
|
|
2301
|
+
* @param {Object} object The object to query.
|
|
2302
|
+
* @returns {Array} Returns the array of symbols.
|
|
2303
|
+
*/
|
|
2304
|
+
var getSymbolsIn = !nativeGetSymbols ? stubArray_1 : function(object) {
|
|
2305
|
+
var result = [];
|
|
2306
|
+
while (object) {
|
|
2307
|
+
_arrayPush(result, _getSymbols(object));
|
|
2308
|
+
object = _getPrototype(object);
|
|
2309
|
+
}
|
|
2310
|
+
return result;
|
|
2311
|
+
};
|
|
2312
|
+
|
|
2313
|
+
var _getSymbolsIn = getSymbolsIn;
|
|
2314
|
+
|
|
2315
|
+
/**
|
|
2316
|
+
* Copies own and inherited symbols of `source` to `object`.
|
|
2317
|
+
*
|
|
2318
|
+
* @private
|
|
2319
|
+
* @param {Object} source The object to copy symbols from.
|
|
2320
|
+
* @param {Object} [object={}] The object to copy symbols to.
|
|
2321
|
+
* @returns {Object} Returns `object`.
|
|
2322
|
+
*/
|
|
2323
|
+
function copySymbolsIn(source, object) {
|
|
2324
|
+
return _copyObject(source, _getSymbolsIn(source), object);
|
|
2325
|
+
}
|
|
2326
|
+
|
|
2327
|
+
var _copySymbolsIn = copySymbolsIn;
|
|
2328
|
+
|
|
2329
|
+
/**
|
|
2330
|
+
* The base implementation of `getAllKeys` and `getAllKeysIn` which uses
|
|
2331
|
+
* `keysFunc` and `symbolsFunc` to get the enumerable property names and
|
|
2332
|
+
* symbols of `object`.
|
|
2333
|
+
*
|
|
2334
|
+
* @private
|
|
2335
|
+
* @param {Object} object The object to query.
|
|
2336
|
+
* @param {Function} keysFunc The function to get the keys of `object`.
|
|
2337
|
+
* @param {Function} symbolsFunc The function to get the symbols of `object`.
|
|
2338
|
+
* @returns {Array} Returns the array of property names and symbols.
|
|
2339
|
+
*/
|
|
2340
|
+
function baseGetAllKeys(object, keysFunc, symbolsFunc) {
|
|
2341
|
+
var result = keysFunc(object);
|
|
2342
|
+
return isArray_1(object) ? result : _arrayPush(result, symbolsFunc(object));
|
|
2343
|
+
}
|
|
2344
|
+
|
|
2345
|
+
var _baseGetAllKeys = baseGetAllKeys;
|
|
2346
|
+
|
|
2347
|
+
/**
|
|
2348
|
+
* Creates an array of own enumerable property names and symbols of `object`.
|
|
2349
|
+
*
|
|
2350
|
+
* @private
|
|
2351
|
+
* @param {Object} object The object to query.
|
|
2352
|
+
* @returns {Array} Returns the array of property names and symbols.
|
|
2353
|
+
*/
|
|
2354
|
+
function getAllKeys(object) {
|
|
2355
|
+
return _baseGetAllKeys(object, keys_1, _getSymbols);
|
|
2356
|
+
}
|
|
2357
|
+
|
|
2358
|
+
var _getAllKeys = getAllKeys;
|
|
2359
|
+
|
|
2360
|
+
/**
|
|
2361
|
+
* Creates an array of own and inherited enumerable property names and
|
|
2362
|
+
* symbols of `object`.
|
|
2363
|
+
*
|
|
2364
|
+
* @private
|
|
2365
|
+
* @param {Object} object The object to query.
|
|
2366
|
+
* @returns {Array} Returns the array of property names and symbols.
|
|
2367
|
+
*/
|
|
2368
|
+
function getAllKeysIn(object) {
|
|
2369
|
+
return _baseGetAllKeys(object, keysIn_1, _getSymbolsIn);
|
|
2370
|
+
}
|
|
2371
|
+
|
|
2372
|
+
var _getAllKeysIn = getAllKeysIn;
|
|
2373
|
+
|
|
2374
|
+
/* Built-in method references that are verified to be native. */
|
|
2375
|
+
var DataView = _getNative(_root, 'DataView');
|
|
2376
|
+
|
|
2377
|
+
var _DataView = DataView;
|
|
2378
|
+
|
|
2379
|
+
/* Built-in method references that are verified to be native. */
|
|
2380
|
+
var Promise$1 = _getNative(_root, 'Promise');
|
|
2381
|
+
|
|
2382
|
+
var _Promise = Promise$1;
|
|
2383
|
+
|
|
2384
|
+
/* Built-in method references that are verified to be native. */
|
|
2385
|
+
var Set = _getNative(_root, 'Set');
|
|
2386
|
+
|
|
2387
|
+
var _Set = Set;
|
|
2388
|
+
|
|
2389
|
+
/* Built-in method references that are verified to be native. */
|
|
2390
|
+
var WeakMap = _getNative(_root, 'WeakMap');
|
|
2391
|
+
|
|
2392
|
+
var _WeakMap = WeakMap;
|
|
2393
|
+
|
|
2394
|
+
/** `Object#toString` result references. */
|
|
2395
|
+
var mapTag$3 = '[object Map]',
|
|
2396
|
+
objectTag$2 = '[object Object]',
|
|
2397
|
+
promiseTag = '[object Promise]',
|
|
2398
|
+
setTag$3 = '[object Set]',
|
|
2399
|
+
weakMapTag$1 = '[object WeakMap]';
|
|
2400
|
+
|
|
2401
|
+
var dataViewTag$2 = '[object DataView]';
|
|
2402
|
+
|
|
2403
|
+
/** Used to detect maps, sets, and weakmaps. */
|
|
2404
|
+
var dataViewCtorString = _toSource(_DataView),
|
|
2405
|
+
mapCtorString = _toSource(_Map),
|
|
2406
|
+
promiseCtorString = _toSource(_Promise),
|
|
2407
|
+
setCtorString = _toSource(_Set),
|
|
2408
|
+
weakMapCtorString = _toSource(_WeakMap);
|
|
2409
|
+
|
|
2410
|
+
/**
|
|
2411
|
+
* Gets the `toStringTag` of `value`.
|
|
2412
|
+
*
|
|
2413
|
+
* @private
|
|
2414
|
+
* @param {*} value The value to query.
|
|
2415
|
+
* @returns {string} Returns the `toStringTag`.
|
|
2416
|
+
*/
|
|
2417
|
+
var getTag = _baseGetTag;
|
|
2418
|
+
|
|
2419
|
+
// Fallback for data views, maps, sets, and weak maps in IE 11 and promises in Node.js < 6.
|
|
2420
|
+
if ((_DataView && getTag(new _DataView(new ArrayBuffer(1))) != dataViewTag$2) ||
|
|
2421
|
+
(_Map && getTag(new _Map) != mapTag$3) ||
|
|
2422
|
+
(_Promise && getTag(_Promise.resolve()) != promiseTag) ||
|
|
2423
|
+
(_Set && getTag(new _Set) != setTag$3) ||
|
|
2424
|
+
(_WeakMap && getTag(new _WeakMap) != weakMapTag$1)) {
|
|
2425
|
+
getTag = function(value) {
|
|
2426
|
+
var result = _baseGetTag(value),
|
|
2427
|
+
Ctor = result == objectTag$2 ? value.constructor : undefined,
|
|
2428
|
+
ctorString = Ctor ? _toSource(Ctor) : '';
|
|
2429
|
+
|
|
2430
|
+
if (ctorString) {
|
|
2431
|
+
switch (ctorString) {
|
|
2432
|
+
case dataViewCtorString: return dataViewTag$2;
|
|
2433
|
+
case mapCtorString: return mapTag$3;
|
|
2434
|
+
case promiseCtorString: return promiseTag;
|
|
2435
|
+
case setCtorString: return setTag$3;
|
|
2436
|
+
case weakMapCtorString: return weakMapTag$1;
|
|
2437
|
+
}
|
|
2438
|
+
}
|
|
2439
|
+
return result;
|
|
2440
|
+
};
|
|
2441
|
+
}
|
|
2442
|
+
|
|
2443
|
+
var _getTag = getTag;
|
|
2444
|
+
|
|
2445
|
+
/** Used for built-in method references. */
|
|
2446
|
+
var objectProto$1 = Object.prototype;
|
|
2447
|
+
|
|
2448
|
+
/** Used to check objects for own properties. */
|
|
2449
|
+
var hasOwnProperty$1 = objectProto$1.hasOwnProperty;
|
|
2450
|
+
|
|
2451
|
+
/**
|
|
2452
|
+
* Initializes an array clone.
|
|
2453
|
+
*
|
|
2454
|
+
* @private
|
|
2455
|
+
* @param {Array} array The array to clone.
|
|
2456
|
+
* @returns {Array} Returns the initialized clone.
|
|
2457
|
+
*/
|
|
2458
|
+
function initCloneArray(array) {
|
|
2459
|
+
var length = array.length,
|
|
2460
|
+
result = new array.constructor(length);
|
|
2461
|
+
|
|
2462
|
+
// Add properties assigned by `RegExp#exec`.
|
|
2463
|
+
if (length && typeof array[0] == 'string' && hasOwnProperty$1.call(array, 'index')) {
|
|
2464
|
+
result.index = array.index;
|
|
2465
|
+
result.input = array.input;
|
|
2466
|
+
}
|
|
2467
|
+
return result;
|
|
2468
|
+
}
|
|
2469
|
+
|
|
2470
|
+
var _initCloneArray = initCloneArray;
|
|
2471
|
+
|
|
2472
|
+
/** Built-in value references. */
|
|
2473
|
+
var Uint8Array = _root.Uint8Array;
|
|
2474
|
+
|
|
2475
|
+
var _Uint8Array = Uint8Array;
|
|
2476
|
+
|
|
2477
|
+
/**
|
|
2478
|
+
* Creates a clone of `arrayBuffer`.
|
|
2479
|
+
*
|
|
2480
|
+
* @private
|
|
2481
|
+
* @param {ArrayBuffer} arrayBuffer The array buffer to clone.
|
|
2482
|
+
* @returns {ArrayBuffer} Returns the cloned array buffer.
|
|
2483
|
+
*/
|
|
2484
|
+
function cloneArrayBuffer(arrayBuffer) {
|
|
2485
|
+
var result = new arrayBuffer.constructor(arrayBuffer.byteLength);
|
|
2486
|
+
new _Uint8Array(result).set(new _Uint8Array(arrayBuffer));
|
|
2487
|
+
return result;
|
|
2488
|
+
}
|
|
2489
|
+
|
|
2490
|
+
var _cloneArrayBuffer = cloneArrayBuffer;
|
|
2491
|
+
|
|
2492
|
+
/**
|
|
2493
|
+
* Creates a clone of `dataView`.
|
|
2494
|
+
*
|
|
2495
|
+
* @private
|
|
2496
|
+
* @param {Object} dataView The data view to clone.
|
|
2497
|
+
* @param {boolean} [isDeep] Specify a deep clone.
|
|
2498
|
+
* @returns {Object} Returns the cloned data view.
|
|
2499
|
+
*/
|
|
2500
|
+
function cloneDataView(dataView, isDeep) {
|
|
2501
|
+
var buffer = isDeep ? _cloneArrayBuffer(dataView.buffer) : dataView.buffer;
|
|
2502
|
+
return new dataView.constructor(buffer, dataView.byteOffset, dataView.byteLength);
|
|
2503
|
+
}
|
|
2504
|
+
|
|
2505
|
+
var _cloneDataView = cloneDataView;
|
|
2506
|
+
|
|
2507
|
+
/** Used to match `RegExp` flags from their coerced string values. */
|
|
2508
|
+
var reFlags = /\w*$/;
|
|
2509
|
+
|
|
2510
|
+
/**
|
|
2511
|
+
* Creates a clone of `regexp`.
|
|
2512
|
+
*
|
|
2513
|
+
* @private
|
|
2514
|
+
* @param {Object} regexp The regexp to clone.
|
|
2515
|
+
* @returns {Object} Returns the cloned regexp.
|
|
2516
|
+
*/
|
|
2517
|
+
function cloneRegExp(regexp) {
|
|
2518
|
+
var result = new regexp.constructor(regexp.source, reFlags.exec(regexp));
|
|
2519
|
+
result.lastIndex = regexp.lastIndex;
|
|
2520
|
+
return result;
|
|
2521
|
+
}
|
|
2522
|
+
|
|
2523
|
+
var _cloneRegExp = cloneRegExp;
|
|
2524
|
+
|
|
2525
|
+
/** Used to convert symbols to primitives and strings. */
|
|
2526
|
+
var symbolProto$1 = _Symbol ? _Symbol.prototype : undefined,
|
|
2527
|
+
symbolValueOf = symbolProto$1 ? symbolProto$1.valueOf : undefined;
|
|
2528
|
+
|
|
2529
|
+
/**
|
|
2530
|
+
* Creates a clone of the `symbol` object.
|
|
2531
|
+
*
|
|
2532
|
+
* @private
|
|
2533
|
+
* @param {Object} symbol The symbol object to clone.
|
|
2534
|
+
* @returns {Object} Returns the cloned symbol object.
|
|
2535
|
+
*/
|
|
2536
|
+
function cloneSymbol(symbol) {
|
|
2537
|
+
return symbolValueOf ? Object(symbolValueOf.call(symbol)) : {};
|
|
2538
|
+
}
|
|
2539
|
+
|
|
2540
|
+
var _cloneSymbol = cloneSymbol;
|
|
2541
|
+
|
|
2542
|
+
/**
|
|
2543
|
+
* Creates a clone of `typedArray`.
|
|
2544
|
+
*
|
|
2545
|
+
* @private
|
|
2546
|
+
* @param {Object} typedArray The typed array to clone.
|
|
2547
|
+
* @param {boolean} [isDeep] Specify a deep clone.
|
|
2548
|
+
* @returns {Object} Returns the cloned typed array.
|
|
2549
|
+
*/
|
|
2550
|
+
function cloneTypedArray(typedArray, isDeep) {
|
|
2551
|
+
var buffer = isDeep ? _cloneArrayBuffer(typedArray.buffer) : typedArray.buffer;
|
|
2552
|
+
return new typedArray.constructor(buffer, typedArray.byteOffset, typedArray.length);
|
|
2553
|
+
}
|
|
2554
|
+
|
|
2555
|
+
var _cloneTypedArray = cloneTypedArray;
|
|
2556
|
+
|
|
2557
|
+
/** `Object#toString` result references. */
|
|
2558
|
+
var boolTag$1 = '[object Boolean]',
|
|
2559
|
+
dateTag$1 = '[object Date]',
|
|
2560
|
+
mapTag$2 = '[object Map]',
|
|
2561
|
+
numberTag$1 = '[object Number]',
|
|
2562
|
+
regexpTag$1 = '[object RegExp]',
|
|
2563
|
+
setTag$2 = '[object Set]',
|
|
2564
|
+
stringTag$1 = '[object String]',
|
|
2565
|
+
symbolTag$2 = '[object Symbol]';
|
|
2566
|
+
|
|
2567
|
+
var arrayBufferTag$1 = '[object ArrayBuffer]',
|
|
2568
|
+
dataViewTag$1 = '[object DataView]',
|
|
2569
|
+
float32Tag$1 = '[object Float32Array]',
|
|
2570
|
+
float64Tag$1 = '[object Float64Array]',
|
|
2571
|
+
int8Tag$1 = '[object Int8Array]',
|
|
2572
|
+
int16Tag$1 = '[object Int16Array]',
|
|
2573
|
+
int32Tag$1 = '[object Int32Array]',
|
|
2574
|
+
uint8Tag$1 = '[object Uint8Array]',
|
|
2575
|
+
uint8ClampedTag$1 = '[object Uint8ClampedArray]',
|
|
2576
|
+
uint16Tag$1 = '[object Uint16Array]',
|
|
2577
|
+
uint32Tag$1 = '[object Uint32Array]';
|
|
2578
|
+
|
|
2579
|
+
/**
|
|
2580
|
+
* Initializes an object clone based on its `toStringTag`.
|
|
2581
|
+
*
|
|
2582
|
+
* **Note:** This function only supports cloning values with tags of
|
|
2583
|
+
* `Boolean`, `Date`, `Error`, `Map`, `Number`, `RegExp`, `Set`, or `String`.
|
|
2584
|
+
*
|
|
2585
|
+
* @private
|
|
2586
|
+
* @param {Object} object The object to clone.
|
|
2587
|
+
* @param {string} tag The `toStringTag` of the object to clone.
|
|
2588
|
+
* @param {boolean} [isDeep] Specify a deep clone.
|
|
2589
|
+
* @returns {Object} Returns the initialized clone.
|
|
2590
|
+
*/
|
|
2591
|
+
function initCloneByTag(object, tag, isDeep) {
|
|
2592
|
+
var Ctor = object.constructor;
|
|
2593
|
+
switch (tag) {
|
|
2594
|
+
case arrayBufferTag$1:
|
|
2595
|
+
return _cloneArrayBuffer(object);
|
|
2596
|
+
|
|
2597
|
+
case boolTag$1:
|
|
2598
|
+
case dateTag$1:
|
|
2599
|
+
return new Ctor(+object);
|
|
2600
|
+
|
|
2601
|
+
case dataViewTag$1:
|
|
2602
|
+
return _cloneDataView(object, isDeep);
|
|
2603
|
+
|
|
2604
|
+
case float32Tag$1: case float64Tag$1:
|
|
2605
|
+
case int8Tag$1: case int16Tag$1: case int32Tag$1:
|
|
2606
|
+
case uint8Tag$1: case uint8ClampedTag$1: case uint16Tag$1: case uint32Tag$1:
|
|
2607
|
+
return _cloneTypedArray(object, isDeep);
|
|
2608
|
+
|
|
2609
|
+
case mapTag$2:
|
|
2610
|
+
return new Ctor;
|
|
2611
|
+
|
|
2612
|
+
case numberTag$1:
|
|
2613
|
+
case stringTag$1:
|
|
2614
|
+
return new Ctor(object);
|
|
2615
|
+
|
|
2616
|
+
case regexpTag$1:
|
|
2617
|
+
return _cloneRegExp(object);
|
|
2618
|
+
|
|
2619
|
+
case setTag$2:
|
|
2620
|
+
return new Ctor;
|
|
2621
|
+
|
|
2622
|
+
case symbolTag$2:
|
|
2623
|
+
return _cloneSymbol(object);
|
|
2624
|
+
}
|
|
2625
|
+
}
|
|
2626
|
+
|
|
2627
|
+
var _initCloneByTag = initCloneByTag;
|
|
2628
|
+
|
|
2629
|
+
/** Built-in value references. */
|
|
2630
|
+
var objectCreate = Object.create;
|
|
2631
|
+
|
|
2632
|
+
/**
|
|
2633
|
+
* The base implementation of `_.create` without support for assigning
|
|
2634
|
+
* properties to the created object.
|
|
2635
|
+
*
|
|
2636
|
+
* @private
|
|
2637
|
+
* @param {Object} proto The object to inherit from.
|
|
2638
|
+
* @returns {Object} Returns the new object.
|
|
2639
|
+
*/
|
|
2640
|
+
var baseCreate = (function() {
|
|
2641
|
+
function object() {}
|
|
2642
|
+
return function(proto) {
|
|
2643
|
+
if (!isObject_1(proto)) {
|
|
2644
|
+
return {};
|
|
2645
|
+
}
|
|
2646
|
+
if (objectCreate) {
|
|
2647
|
+
return objectCreate(proto);
|
|
2648
|
+
}
|
|
2649
|
+
object.prototype = proto;
|
|
2650
|
+
var result = new object;
|
|
2651
|
+
object.prototype = undefined;
|
|
2652
|
+
return result;
|
|
2653
|
+
};
|
|
2654
|
+
}());
|
|
2655
|
+
|
|
2656
|
+
var _baseCreate = baseCreate;
|
|
2657
|
+
|
|
2658
|
+
/**
|
|
2659
|
+
* Initializes an object clone.
|
|
2660
|
+
*
|
|
2661
|
+
* @private
|
|
2662
|
+
* @param {Object} object The object to clone.
|
|
2663
|
+
* @returns {Object} Returns the initialized clone.
|
|
2664
|
+
*/
|
|
2665
|
+
function initCloneObject(object) {
|
|
2666
|
+
return (typeof object.constructor == 'function' && !_isPrototype(object))
|
|
2667
|
+
? _baseCreate(_getPrototype(object))
|
|
2668
|
+
: {};
|
|
2669
|
+
}
|
|
2670
|
+
|
|
2671
|
+
var _initCloneObject = initCloneObject;
|
|
2672
|
+
|
|
2673
|
+
/** `Object#toString` result references. */
|
|
2674
|
+
var mapTag$1 = '[object Map]';
|
|
2675
|
+
|
|
2676
|
+
/**
|
|
2677
|
+
* The base implementation of `_.isMap` without Node.js optimizations.
|
|
2678
|
+
*
|
|
2679
|
+
* @private
|
|
2680
|
+
* @param {*} value The value to check.
|
|
2681
|
+
* @returns {boolean} Returns `true` if `value` is a map, else `false`.
|
|
2682
|
+
*/
|
|
2683
|
+
function baseIsMap(value) {
|
|
2684
|
+
return isObjectLike_1(value) && _getTag(value) == mapTag$1;
|
|
2685
|
+
}
|
|
2686
|
+
|
|
2687
|
+
var _baseIsMap = baseIsMap;
|
|
2688
|
+
|
|
2689
|
+
/* Node.js helper references. */
|
|
2690
|
+
var nodeIsMap = _nodeUtil && _nodeUtil.isMap;
|
|
2691
|
+
|
|
2692
|
+
/**
|
|
2693
|
+
* Checks if `value` is classified as a `Map` object.
|
|
2694
|
+
*
|
|
2695
|
+
* @static
|
|
2696
|
+
* @memberOf _
|
|
2697
|
+
* @since 4.3.0
|
|
2698
|
+
* @category Lang
|
|
2699
|
+
* @param {*} value The value to check.
|
|
2700
|
+
* @returns {boolean} Returns `true` if `value` is a map, else `false`.
|
|
2701
|
+
* @example
|
|
2702
|
+
*
|
|
2703
|
+
* _.isMap(new Map);
|
|
2704
|
+
* // => true
|
|
2705
|
+
*
|
|
2706
|
+
* _.isMap(new WeakMap);
|
|
2707
|
+
* // => false
|
|
2708
|
+
*/
|
|
2709
|
+
var isMap = nodeIsMap ? _baseUnary(nodeIsMap) : _baseIsMap;
|
|
2710
|
+
|
|
2711
|
+
var isMap_1 = isMap;
|
|
2712
|
+
|
|
2713
|
+
/** `Object#toString` result references. */
|
|
2714
|
+
var setTag$1 = '[object Set]';
|
|
2715
|
+
|
|
2716
|
+
/**
|
|
2717
|
+
* The base implementation of `_.isSet` without Node.js optimizations.
|
|
2718
|
+
*
|
|
2719
|
+
* @private
|
|
2720
|
+
* @param {*} value The value to check.
|
|
2721
|
+
* @returns {boolean} Returns `true` if `value` is a set, else `false`.
|
|
2722
|
+
*/
|
|
2723
|
+
function baseIsSet(value) {
|
|
2724
|
+
return isObjectLike_1(value) && _getTag(value) == setTag$1;
|
|
2725
|
+
}
|
|
2726
|
+
|
|
2727
|
+
var _baseIsSet = baseIsSet;
|
|
2728
|
+
|
|
2729
|
+
/* Node.js helper references. */
|
|
2730
|
+
var nodeIsSet = _nodeUtil && _nodeUtil.isSet;
|
|
2731
|
+
|
|
2732
|
+
/**
|
|
2733
|
+
* Checks if `value` is classified as a `Set` object.
|
|
2734
|
+
*
|
|
2735
|
+
* @static
|
|
2736
|
+
* @memberOf _
|
|
2737
|
+
* @since 4.3.0
|
|
2738
|
+
* @category Lang
|
|
2739
|
+
* @param {*} value The value to check.
|
|
2740
|
+
* @returns {boolean} Returns `true` if `value` is a set, else `false`.
|
|
2741
|
+
* @example
|
|
2742
|
+
*
|
|
2743
|
+
* _.isSet(new Set);
|
|
2744
|
+
* // => true
|
|
2745
|
+
*
|
|
2746
|
+
* _.isSet(new WeakSet);
|
|
2747
|
+
* // => false
|
|
2748
|
+
*/
|
|
2749
|
+
var isSet = nodeIsSet ? _baseUnary(nodeIsSet) : _baseIsSet;
|
|
2750
|
+
|
|
2751
|
+
var isSet_1 = isSet;
|
|
2752
|
+
|
|
2753
|
+
/** Used to compose bitmasks for cloning. */
|
|
2754
|
+
var CLONE_DEEP_FLAG$1 = 1,
|
|
2755
|
+
CLONE_FLAT_FLAG$1 = 2,
|
|
2756
|
+
CLONE_SYMBOLS_FLAG$1 = 4;
|
|
2757
|
+
|
|
2758
|
+
/** `Object#toString` result references. */
|
|
2759
|
+
var argsTag = '[object Arguments]',
|
|
2760
|
+
arrayTag = '[object Array]',
|
|
2761
|
+
boolTag = '[object Boolean]',
|
|
2762
|
+
dateTag = '[object Date]',
|
|
2763
|
+
errorTag = '[object Error]',
|
|
2764
|
+
funcTag = '[object Function]',
|
|
2765
|
+
genTag = '[object GeneratorFunction]',
|
|
2766
|
+
mapTag = '[object Map]',
|
|
2767
|
+
numberTag = '[object Number]',
|
|
2768
|
+
objectTag$1 = '[object Object]',
|
|
2769
|
+
regexpTag = '[object RegExp]',
|
|
2770
|
+
setTag = '[object Set]',
|
|
2771
|
+
stringTag = '[object String]',
|
|
2772
|
+
symbolTag$1 = '[object Symbol]',
|
|
2773
|
+
weakMapTag = '[object WeakMap]';
|
|
2774
|
+
|
|
2775
|
+
var arrayBufferTag = '[object ArrayBuffer]',
|
|
2776
|
+
dataViewTag = '[object DataView]',
|
|
2777
|
+
float32Tag = '[object Float32Array]',
|
|
2778
|
+
float64Tag = '[object Float64Array]',
|
|
2779
|
+
int8Tag = '[object Int8Array]',
|
|
2780
|
+
int16Tag = '[object Int16Array]',
|
|
2781
|
+
int32Tag = '[object Int32Array]',
|
|
2782
|
+
uint8Tag = '[object Uint8Array]',
|
|
2783
|
+
uint8ClampedTag = '[object Uint8ClampedArray]',
|
|
2784
|
+
uint16Tag = '[object Uint16Array]',
|
|
2785
|
+
uint32Tag = '[object Uint32Array]';
|
|
2786
|
+
|
|
2787
|
+
/** Used to identify `toStringTag` values supported by `_.clone`. */
|
|
2788
|
+
var cloneableTags = {};
|
|
2789
|
+
cloneableTags[argsTag] = cloneableTags[arrayTag] =
|
|
2790
|
+
cloneableTags[arrayBufferTag] = cloneableTags[dataViewTag] =
|
|
2791
|
+
cloneableTags[boolTag] = cloneableTags[dateTag] =
|
|
2792
|
+
cloneableTags[float32Tag] = cloneableTags[float64Tag] =
|
|
2793
|
+
cloneableTags[int8Tag] = cloneableTags[int16Tag] =
|
|
2794
|
+
cloneableTags[int32Tag] = cloneableTags[mapTag] =
|
|
2795
|
+
cloneableTags[numberTag] = cloneableTags[objectTag$1] =
|
|
2796
|
+
cloneableTags[regexpTag] = cloneableTags[setTag] =
|
|
2797
|
+
cloneableTags[stringTag] = cloneableTags[symbolTag$1] =
|
|
2798
|
+
cloneableTags[uint8Tag] = cloneableTags[uint8ClampedTag] =
|
|
2799
|
+
cloneableTags[uint16Tag] = cloneableTags[uint32Tag] = true;
|
|
2800
|
+
cloneableTags[errorTag] = cloneableTags[funcTag] =
|
|
2801
|
+
cloneableTags[weakMapTag] = false;
|
|
2802
|
+
|
|
2803
|
+
/**
|
|
2804
|
+
* The base implementation of `_.clone` and `_.cloneDeep` which tracks
|
|
2805
|
+
* traversed objects.
|
|
2806
|
+
*
|
|
2807
|
+
* @private
|
|
2808
|
+
* @param {*} value The value to clone.
|
|
2809
|
+
* @param {boolean} bitmask The bitmask flags.
|
|
2810
|
+
* 1 - Deep clone
|
|
2811
|
+
* 2 - Flatten inherited properties
|
|
2812
|
+
* 4 - Clone symbols
|
|
2813
|
+
* @param {Function} [customizer] The function to customize cloning.
|
|
2814
|
+
* @param {string} [key] The key of `value`.
|
|
2815
|
+
* @param {Object} [object] The parent object of `value`.
|
|
2816
|
+
* @param {Object} [stack] Tracks traversed objects and their clone counterparts.
|
|
2817
|
+
* @returns {*} Returns the cloned value.
|
|
2818
|
+
*/
|
|
2819
|
+
function baseClone(value, bitmask, customizer, key, object, stack) {
|
|
2820
|
+
var result,
|
|
2821
|
+
isDeep = bitmask & CLONE_DEEP_FLAG$1,
|
|
2822
|
+
isFlat = bitmask & CLONE_FLAT_FLAG$1,
|
|
2823
|
+
isFull = bitmask & CLONE_SYMBOLS_FLAG$1;
|
|
2824
|
+
|
|
2825
|
+
if (customizer) {
|
|
2826
|
+
result = object ? customizer(value, key, object, stack) : customizer(value);
|
|
2827
|
+
}
|
|
2828
|
+
if (result !== undefined) {
|
|
2829
|
+
return result;
|
|
2830
|
+
}
|
|
2831
|
+
if (!isObject_1(value)) {
|
|
2832
|
+
return value;
|
|
2833
|
+
}
|
|
2834
|
+
var isArr = isArray_1(value);
|
|
2835
|
+
if (isArr) {
|
|
2836
|
+
result = _initCloneArray(value);
|
|
2837
|
+
if (!isDeep) {
|
|
2838
|
+
return _copyArray(value, result);
|
|
2839
|
+
}
|
|
2840
|
+
} else {
|
|
2841
|
+
var tag = _getTag(value),
|
|
2842
|
+
isFunc = tag == funcTag || tag == genTag;
|
|
2843
|
+
|
|
2844
|
+
if (isBuffer_1(value)) {
|
|
2845
|
+
return _cloneBuffer(value, isDeep);
|
|
2846
|
+
}
|
|
2847
|
+
if (tag == objectTag$1 || tag == argsTag || (isFunc && !object)) {
|
|
2848
|
+
result = (isFlat || isFunc) ? {} : _initCloneObject(value);
|
|
2849
|
+
if (!isDeep) {
|
|
2850
|
+
return isFlat
|
|
2851
|
+
? _copySymbolsIn(value, _baseAssignIn(result, value))
|
|
2852
|
+
: _copySymbols(value, _baseAssign(result, value));
|
|
2853
|
+
}
|
|
2854
|
+
} else {
|
|
2855
|
+
if (!cloneableTags[tag]) {
|
|
2856
|
+
return object ? value : {};
|
|
2857
|
+
}
|
|
2858
|
+
result = _initCloneByTag(value, tag, isDeep);
|
|
2859
|
+
}
|
|
2860
|
+
}
|
|
2861
|
+
// Check for circular references and return its corresponding clone.
|
|
2862
|
+
stack || (stack = new _Stack);
|
|
2863
|
+
var stacked = stack.get(value);
|
|
2864
|
+
if (stacked) {
|
|
2865
|
+
return stacked;
|
|
2866
|
+
}
|
|
2867
|
+
stack.set(value, result);
|
|
2868
|
+
|
|
2869
|
+
if (isSet_1(value)) {
|
|
2870
|
+
value.forEach(function(subValue) {
|
|
2871
|
+
result.add(baseClone(subValue, bitmask, customizer, subValue, value, stack));
|
|
2872
|
+
});
|
|
2873
|
+
} else if (isMap_1(value)) {
|
|
2874
|
+
value.forEach(function(subValue, key) {
|
|
2875
|
+
result.set(key, baseClone(subValue, bitmask, customizer, key, value, stack));
|
|
2876
|
+
});
|
|
2877
|
+
}
|
|
2878
|
+
|
|
2879
|
+
var keysFunc = isFull
|
|
2880
|
+
? (isFlat ? _getAllKeysIn : _getAllKeys)
|
|
2881
|
+
: (isFlat ? keysIn_1 : keys_1);
|
|
2882
|
+
|
|
2883
|
+
var props = isArr ? undefined : keysFunc(value);
|
|
2884
|
+
_arrayEach(props || value, function(subValue, key) {
|
|
2885
|
+
if (props) {
|
|
2886
|
+
key = subValue;
|
|
2887
|
+
subValue = value[key];
|
|
2888
|
+
}
|
|
2889
|
+
// Recursively populate clone (susceptible to call stack limits).
|
|
2890
|
+
_assignValue(result, key, baseClone(subValue, bitmask, customizer, key, value, stack));
|
|
2891
|
+
});
|
|
2892
|
+
return result;
|
|
2893
|
+
}
|
|
2894
|
+
|
|
2895
|
+
var _baseClone = baseClone;
|
|
2896
|
+
|
|
2897
|
+
/** `Object#toString` result references. */
|
|
2898
|
+
var symbolTag = '[object Symbol]';
|
|
2899
|
+
|
|
2900
|
+
/**
|
|
2901
|
+
* Checks if `value` is classified as a `Symbol` primitive or object.
|
|
2902
|
+
*
|
|
2903
|
+
* @static
|
|
2904
|
+
* @memberOf _
|
|
2905
|
+
* @since 4.0.0
|
|
2906
|
+
* @category Lang
|
|
2907
|
+
* @param {*} value The value to check.
|
|
2908
|
+
* @returns {boolean} Returns `true` if `value` is a symbol, else `false`.
|
|
2909
|
+
* @example
|
|
2910
|
+
*
|
|
2911
|
+
* _.isSymbol(Symbol.iterator);
|
|
2912
|
+
* // => true
|
|
2913
|
+
*
|
|
2914
|
+
* _.isSymbol('abc');
|
|
2915
|
+
* // => false
|
|
2916
|
+
*/
|
|
2917
|
+
function isSymbol(value) {
|
|
2918
|
+
return typeof value == 'symbol' ||
|
|
2919
|
+
(isObjectLike_1(value) && _baseGetTag(value) == symbolTag);
|
|
2920
|
+
}
|
|
2921
|
+
|
|
2922
|
+
var isSymbol_1 = isSymbol;
|
|
2923
|
+
|
|
2924
|
+
/** Used to match property names within property paths. */
|
|
2925
|
+
var reIsDeepProp = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,
|
|
2926
|
+
reIsPlainProp = /^\w*$/;
|
|
2927
|
+
|
|
2928
|
+
/**
|
|
2929
|
+
* Checks if `value` is a property name and not a property path.
|
|
2930
|
+
*
|
|
2931
|
+
* @private
|
|
2932
|
+
* @param {*} value The value to check.
|
|
2933
|
+
* @param {Object} [object] The object to query keys on.
|
|
2934
|
+
* @returns {boolean} Returns `true` if `value` is a property name, else `false`.
|
|
2935
|
+
*/
|
|
2936
|
+
function isKey(value, object) {
|
|
2937
|
+
if (isArray_1(value)) {
|
|
2938
|
+
return false;
|
|
2939
|
+
}
|
|
2940
|
+
var type = typeof value;
|
|
2941
|
+
if (type == 'number' || type == 'symbol' || type == 'boolean' ||
|
|
2942
|
+
value == null || isSymbol_1(value)) {
|
|
2943
|
+
return true;
|
|
2944
|
+
}
|
|
2945
|
+
return reIsPlainProp.test(value) || !reIsDeepProp.test(value) ||
|
|
2946
|
+
(object != null && value in Object(object));
|
|
2947
|
+
}
|
|
2948
|
+
|
|
2949
|
+
var _isKey = isKey;
|
|
2950
|
+
|
|
2951
|
+
/** Error message constants. */
|
|
2952
|
+
var FUNC_ERROR_TEXT = 'Expected a function';
|
|
2953
|
+
|
|
2954
|
+
/**
|
|
2955
|
+
* Creates a function that memoizes the result of `func`. If `resolver` is
|
|
2956
|
+
* provided, it determines the cache key for storing the result based on the
|
|
2957
|
+
* arguments provided to the memoized function. By default, the first argument
|
|
2958
|
+
* provided to the memoized function is used as the map cache key. The `func`
|
|
2959
|
+
* is invoked with the `this` binding of the memoized function.
|
|
2960
|
+
*
|
|
2961
|
+
* **Note:** The cache is exposed as the `cache` property on the memoized
|
|
2962
|
+
* function. Its creation may be customized by replacing the `_.memoize.Cache`
|
|
2963
|
+
* constructor with one whose instances implement the
|
|
2964
|
+
* [`Map`](http://ecma-international.org/ecma-262/7.0/#sec-properties-of-the-map-prototype-object)
|
|
2965
|
+
* method interface of `clear`, `delete`, `get`, `has`, and `set`.
|
|
2966
|
+
*
|
|
2967
|
+
* @static
|
|
2968
|
+
* @memberOf _
|
|
2969
|
+
* @since 0.1.0
|
|
2970
|
+
* @category Function
|
|
2971
|
+
* @param {Function} func The function to have its output memoized.
|
|
2972
|
+
* @param {Function} [resolver] The function to resolve the cache key.
|
|
2973
|
+
* @returns {Function} Returns the new memoized function.
|
|
2974
|
+
* @example
|
|
2975
|
+
*
|
|
2976
|
+
* var object = { 'a': 1, 'b': 2 };
|
|
2977
|
+
* var other = { 'c': 3, 'd': 4 };
|
|
2978
|
+
*
|
|
2979
|
+
* var values = _.memoize(_.values);
|
|
2980
|
+
* values(object);
|
|
2981
|
+
* // => [1, 2]
|
|
2982
|
+
*
|
|
2983
|
+
* values(other);
|
|
2984
|
+
* // => [3, 4]
|
|
2985
|
+
*
|
|
2986
|
+
* object.a = 2;
|
|
2987
|
+
* values(object);
|
|
2988
|
+
* // => [1, 2]
|
|
2989
|
+
*
|
|
2990
|
+
* // Modify the result cache.
|
|
2991
|
+
* values.cache.set(object, ['a', 'b']);
|
|
2992
|
+
* values(object);
|
|
2993
|
+
* // => ['a', 'b']
|
|
2994
|
+
*
|
|
2995
|
+
* // Replace `_.memoize.Cache`.
|
|
2996
|
+
* _.memoize.Cache = WeakMap;
|
|
2997
|
+
*/
|
|
2998
|
+
function memoize(func, resolver) {
|
|
2999
|
+
if (typeof func != 'function' || (resolver != null && typeof resolver != 'function')) {
|
|
3000
|
+
throw new TypeError(FUNC_ERROR_TEXT);
|
|
3001
|
+
}
|
|
3002
|
+
var memoized = function() {
|
|
3003
|
+
var args = arguments,
|
|
3004
|
+
key = resolver ? resolver.apply(this, args) : args[0],
|
|
3005
|
+
cache = memoized.cache;
|
|
3006
|
+
|
|
3007
|
+
if (cache.has(key)) {
|
|
3008
|
+
return cache.get(key);
|
|
3009
|
+
}
|
|
3010
|
+
var result = func.apply(this, args);
|
|
3011
|
+
memoized.cache = cache.set(key, result) || cache;
|
|
3012
|
+
return result;
|
|
3013
|
+
};
|
|
3014
|
+
memoized.cache = new (memoize.Cache || _MapCache);
|
|
3015
|
+
return memoized;
|
|
3016
|
+
}
|
|
3017
|
+
|
|
3018
|
+
// Expose `MapCache`.
|
|
3019
|
+
memoize.Cache = _MapCache;
|
|
3020
|
+
|
|
3021
|
+
var memoize_1 = memoize;
|
|
3022
|
+
|
|
3023
|
+
/** Used as the maximum memoize cache size. */
|
|
3024
|
+
var MAX_MEMOIZE_SIZE = 500;
|
|
3025
|
+
|
|
3026
|
+
/**
|
|
3027
|
+
* A specialized version of `_.memoize` which clears the memoized function's
|
|
3028
|
+
* cache when it exceeds `MAX_MEMOIZE_SIZE`.
|
|
3029
|
+
*
|
|
3030
|
+
* @private
|
|
3031
|
+
* @param {Function} func The function to have its output memoized.
|
|
3032
|
+
* @returns {Function} Returns the new memoized function.
|
|
3033
|
+
*/
|
|
3034
|
+
function memoizeCapped(func) {
|
|
3035
|
+
var result = memoize_1(func, function(key) {
|
|
3036
|
+
if (cache.size === MAX_MEMOIZE_SIZE) {
|
|
3037
|
+
cache.clear();
|
|
3038
|
+
}
|
|
3039
|
+
return key;
|
|
3040
|
+
});
|
|
3041
|
+
|
|
3042
|
+
var cache = result.cache;
|
|
3043
|
+
return result;
|
|
3044
|
+
}
|
|
3045
|
+
|
|
3046
|
+
var _memoizeCapped = memoizeCapped;
|
|
3047
|
+
|
|
3048
|
+
/** Used to match property names within property paths. */
|
|
3049
|
+
var rePropName = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g;
|
|
3050
|
+
|
|
3051
|
+
/** Used to match backslashes in property paths. */
|
|
3052
|
+
var reEscapeChar = /\\(\\)?/g;
|
|
3053
|
+
|
|
3054
|
+
/**
|
|
3055
|
+
* Converts `string` to a property path array.
|
|
3056
|
+
*
|
|
3057
|
+
* @private
|
|
3058
|
+
* @param {string} string The string to convert.
|
|
3059
|
+
* @returns {Array} Returns the property path array.
|
|
3060
|
+
*/
|
|
3061
|
+
var stringToPath = _memoizeCapped(function(string) {
|
|
3062
|
+
var result = [];
|
|
3063
|
+
if (string.charCodeAt(0) === 46 /* . */) {
|
|
3064
|
+
result.push('');
|
|
3065
|
+
}
|
|
3066
|
+
string.replace(rePropName, function(match, number, quote, subString) {
|
|
3067
|
+
result.push(quote ? subString.replace(reEscapeChar, '$1') : (number || match));
|
|
3068
|
+
});
|
|
3069
|
+
return result;
|
|
3070
|
+
});
|
|
3071
|
+
|
|
3072
|
+
var _stringToPath = stringToPath;
|
|
3073
|
+
|
|
3074
|
+
/** Used as references for various `Number` constants. */
|
|
3075
|
+
var INFINITY$1 = 1 / 0;
|
|
3076
|
+
|
|
3077
|
+
/** Used to convert symbols to primitives and strings. */
|
|
3078
|
+
var symbolProto = _Symbol ? _Symbol.prototype : undefined,
|
|
3079
|
+
symbolToString = symbolProto ? symbolProto.toString : undefined;
|
|
3080
|
+
|
|
3081
|
+
/**
|
|
3082
|
+
* The base implementation of `_.toString` which doesn't convert nullish
|
|
3083
|
+
* values to empty strings.
|
|
3084
|
+
*
|
|
3085
|
+
* @private
|
|
3086
|
+
* @param {*} value The value to process.
|
|
3087
|
+
* @returns {string} Returns the string.
|
|
3088
|
+
*/
|
|
3089
|
+
function baseToString(value) {
|
|
3090
|
+
// Exit early for strings to avoid a performance hit in some environments.
|
|
3091
|
+
if (typeof value == 'string') {
|
|
3092
|
+
return value;
|
|
3093
|
+
}
|
|
3094
|
+
if (isArray_1(value)) {
|
|
3095
|
+
// Recursively convert values (susceptible to call stack limits).
|
|
3096
|
+
return _arrayMap(value, baseToString) + '';
|
|
3097
|
+
}
|
|
3098
|
+
if (isSymbol_1(value)) {
|
|
3099
|
+
return symbolToString ? symbolToString.call(value) : '';
|
|
3100
|
+
}
|
|
3101
|
+
var result = (value + '');
|
|
3102
|
+
return (result == '0' && (1 / value) == -INFINITY$1) ? '-0' : result;
|
|
3103
|
+
}
|
|
3104
|
+
|
|
3105
|
+
var _baseToString = baseToString;
|
|
3106
|
+
|
|
3107
|
+
/**
|
|
3108
|
+
* Converts `value` to a string. An empty string is returned for `null`
|
|
3109
|
+
* and `undefined` values. The sign of `-0` is preserved.
|
|
3110
|
+
*
|
|
3111
|
+
* @static
|
|
3112
|
+
* @memberOf _
|
|
3113
|
+
* @since 4.0.0
|
|
3114
|
+
* @category Lang
|
|
3115
|
+
* @param {*} value The value to convert.
|
|
3116
|
+
* @returns {string} Returns the converted string.
|
|
3117
|
+
* @example
|
|
3118
|
+
*
|
|
3119
|
+
* _.toString(null);
|
|
3120
|
+
* // => ''
|
|
3121
|
+
*
|
|
3122
|
+
* _.toString(-0);
|
|
3123
|
+
* // => '-0'
|
|
3124
|
+
*
|
|
3125
|
+
* _.toString([1, 2, 3]);
|
|
3126
|
+
* // => '1,2,3'
|
|
3127
|
+
*/
|
|
3128
|
+
function toString(value) {
|
|
3129
|
+
return value == null ? '' : _baseToString(value);
|
|
3130
|
+
}
|
|
3131
|
+
|
|
3132
|
+
var toString_1 = toString;
|
|
3133
|
+
|
|
3134
|
+
/**
|
|
3135
|
+
* Casts `value` to a path array if it's not one.
|
|
3136
|
+
*
|
|
3137
|
+
* @private
|
|
3138
|
+
* @param {*} value The value to inspect.
|
|
3139
|
+
* @param {Object} [object] The object to query keys on.
|
|
3140
|
+
* @returns {Array} Returns the cast property path array.
|
|
3141
|
+
*/
|
|
3142
|
+
function castPath(value, object) {
|
|
3143
|
+
if (isArray_1(value)) {
|
|
3144
|
+
return value;
|
|
3145
|
+
}
|
|
3146
|
+
return _isKey(value, object) ? [value] : _stringToPath(toString_1(value));
|
|
3147
|
+
}
|
|
3148
|
+
|
|
3149
|
+
var _castPath = castPath;
|
|
3150
|
+
|
|
3151
|
+
/**
|
|
3152
|
+
* Gets the last element of `array`.
|
|
3153
|
+
*
|
|
3154
|
+
* @static
|
|
3155
|
+
* @memberOf _
|
|
3156
|
+
* @since 0.1.0
|
|
3157
|
+
* @category Array
|
|
3158
|
+
* @param {Array} array The array to query.
|
|
3159
|
+
* @returns {*} Returns the last element of `array`.
|
|
3160
|
+
* @example
|
|
3161
|
+
*
|
|
3162
|
+
* _.last([1, 2, 3]);
|
|
3163
|
+
* // => 3
|
|
3164
|
+
*/
|
|
3165
|
+
function last(array) {
|
|
3166
|
+
var length = array == null ? 0 : array.length;
|
|
3167
|
+
return length ? array[length - 1] : undefined;
|
|
3168
|
+
}
|
|
3169
|
+
|
|
3170
|
+
var last_1 = last;
|
|
3171
|
+
|
|
3172
|
+
/** Used as references for various `Number` constants. */
|
|
3173
|
+
var INFINITY = 1 / 0;
|
|
3174
|
+
|
|
3175
|
+
/**
|
|
3176
|
+
* Converts `value` to a string key if it's not a string or symbol.
|
|
3177
|
+
*
|
|
3178
|
+
* @private
|
|
3179
|
+
* @param {*} value The value to inspect.
|
|
3180
|
+
* @returns {string|symbol} Returns the key.
|
|
3181
|
+
*/
|
|
3182
|
+
function toKey(value) {
|
|
3183
|
+
if (typeof value == 'string' || isSymbol_1(value)) {
|
|
3184
|
+
return value;
|
|
3185
|
+
}
|
|
3186
|
+
var result = (value + '');
|
|
3187
|
+
return (result == '0' && (1 / value) == -INFINITY) ? '-0' : result;
|
|
3188
|
+
}
|
|
3189
|
+
|
|
3190
|
+
var _toKey = toKey;
|
|
3191
|
+
|
|
3192
|
+
/**
|
|
3193
|
+
* The base implementation of `_.get` without support for default values.
|
|
3194
|
+
*
|
|
3195
|
+
* @private
|
|
3196
|
+
* @param {Object} object The object to query.
|
|
3197
|
+
* @param {Array|string} path The path of the property to get.
|
|
3198
|
+
* @returns {*} Returns the resolved value.
|
|
3199
|
+
*/
|
|
3200
|
+
function baseGet(object, path) {
|
|
3201
|
+
path = _castPath(path, object);
|
|
3202
|
+
|
|
3203
|
+
var index = 0,
|
|
3204
|
+
length = path.length;
|
|
3205
|
+
|
|
3206
|
+
while (object != null && index < length) {
|
|
3207
|
+
object = object[_toKey(path[index++])];
|
|
3208
|
+
}
|
|
3209
|
+
return (index && index == length) ? object : undefined;
|
|
3210
|
+
}
|
|
3211
|
+
|
|
3212
|
+
var _baseGet = baseGet;
|
|
3213
|
+
|
|
3214
|
+
/**
|
|
3215
|
+
* The base implementation of `_.slice` without an iteratee call guard.
|
|
3216
|
+
*
|
|
3217
|
+
* @private
|
|
3218
|
+
* @param {Array} array The array to slice.
|
|
3219
|
+
* @param {number} [start=0] The start position.
|
|
3220
|
+
* @param {number} [end=array.length] The end position.
|
|
3221
|
+
* @returns {Array} Returns the slice of `array`.
|
|
3222
|
+
*/
|
|
3223
|
+
function baseSlice(array, start, end) {
|
|
3224
|
+
var index = -1,
|
|
3225
|
+
length = array.length;
|
|
3226
|
+
|
|
3227
|
+
if (start < 0) {
|
|
3228
|
+
start = -start > length ? 0 : (length + start);
|
|
3229
|
+
}
|
|
3230
|
+
end = end > length ? length : end;
|
|
3231
|
+
if (end < 0) {
|
|
3232
|
+
end += length;
|
|
3233
|
+
}
|
|
3234
|
+
length = start > end ? 0 : ((end - start) >>> 0);
|
|
3235
|
+
start >>>= 0;
|
|
3236
|
+
|
|
3237
|
+
var result = Array(length);
|
|
3238
|
+
while (++index < length) {
|
|
3239
|
+
result[index] = array[index + start];
|
|
3240
|
+
}
|
|
3241
|
+
return result;
|
|
3242
|
+
}
|
|
3243
|
+
|
|
3244
|
+
var _baseSlice = baseSlice;
|
|
3245
|
+
|
|
3246
|
+
/**
|
|
3247
|
+
* Gets the parent value at `path` of `object`.
|
|
3248
|
+
*
|
|
3249
|
+
* @private
|
|
3250
|
+
* @param {Object} object The object to query.
|
|
3251
|
+
* @param {Array} path The path to get the parent value of.
|
|
3252
|
+
* @returns {*} Returns the parent value.
|
|
3253
|
+
*/
|
|
3254
|
+
function parent(object, path) {
|
|
3255
|
+
return path.length < 2 ? object : _baseGet(object, _baseSlice(path, 0, -1));
|
|
3256
|
+
}
|
|
3257
|
+
|
|
3258
|
+
var _parent = parent;
|
|
3259
|
+
|
|
3260
|
+
/**
|
|
3261
|
+
* The base implementation of `_.unset`.
|
|
3262
|
+
*
|
|
3263
|
+
* @private
|
|
3264
|
+
* @param {Object} object The object to modify.
|
|
3265
|
+
* @param {Array|string} path The property path to unset.
|
|
3266
|
+
* @returns {boolean} Returns `true` if the property is deleted, else `false`.
|
|
3267
|
+
*/
|
|
3268
|
+
function baseUnset(object, path) {
|
|
3269
|
+
path = _castPath(path, object);
|
|
3270
|
+
object = _parent(object, path);
|
|
3271
|
+
return object == null || delete object[_toKey(last_1(path))];
|
|
3272
|
+
}
|
|
3273
|
+
|
|
3274
|
+
var _baseUnset = baseUnset;
|
|
3275
|
+
|
|
3276
|
+
/** `Object#toString` result references. */
|
|
3277
|
+
var objectTag = '[object Object]';
|
|
3278
|
+
|
|
3279
|
+
/** Used for built-in method references. */
|
|
3280
|
+
var funcProto = Function.prototype,
|
|
3281
|
+
objectProto = Object.prototype;
|
|
3282
|
+
|
|
3283
|
+
/** Used to resolve the decompiled source of functions. */
|
|
3284
|
+
var funcToString = funcProto.toString;
|
|
3285
|
+
|
|
3286
|
+
/** Used to check objects for own properties. */
|
|
3287
|
+
var hasOwnProperty = objectProto.hasOwnProperty;
|
|
3288
|
+
|
|
3289
|
+
/** Used to infer the `Object` constructor. */
|
|
3290
|
+
var objectCtorString = funcToString.call(Object);
|
|
3291
|
+
|
|
3292
|
+
/**
|
|
3293
|
+
* Checks if `value` is a plain object, that is, an object created by the
|
|
3294
|
+
* `Object` constructor or one with a `[[Prototype]]` of `null`.
|
|
3295
|
+
*
|
|
3296
|
+
* @static
|
|
3297
|
+
* @memberOf _
|
|
3298
|
+
* @since 0.8.0
|
|
3299
|
+
* @category Lang
|
|
3300
|
+
* @param {*} value The value to check.
|
|
3301
|
+
* @returns {boolean} Returns `true` if `value` is a plain object, else `false`.
|
|
3302
|
+
* @example
|
|
3303
|
+
*
|
|
3304
|
+
* function Foo() {
|
|
3305
|
+
* this.a = 1;
|
|
3306
|
+
* }
|
|
3307
|
+
*
|
|
3308
|
+
* _.isPlainObject(new Foo);
|
|
3309
|
+
* // => false
|
|
3310
|
+
*
|
|
3311
|
+
* _.isPlainObject([1, 2, 3]);
|
|
3312
|
+
* // => false
|
|
3313
|
+
*
|
|
3314
|
+
* _.isPlainObject({ 'x': 0, 'y': 0 });
|
|
3315
|
+
* // => true
|
|
3316
|
+
*
|
|
3317
|
+
* _.isPlainObject(Object.create(null));
|
|
3318
|
+
* // => true
|
|
3319
|
+
*/
|
|
3320
|
+
function isPlainObject(value) {
|
|
3321
|
+
if (!isObjectLike_1(value) || _baseGetTag(value) != objectTag) {
|
|
3322
|
+
return false;
|
|
3323
|
+
}
|
|
3324
|
+
var proto = _getPrototype(value);
|
|
3325
|
+
if (proto === null) {
|
|
3326
|
+
return true;
|
|
3327
|
+
}
|
|
3328
|
+
var Ctor = hasOwnProperty.call(proto, 'constructor') && proto.constructor;
|
|
3329
|
+
return typeof Ctor == 'function' && Ctor instanceof Ctor &&
|
|
3330
|
+
funcToString.call(Ctor) == objectCtorString;
|
|
3331
|
+
}
|
|
3332
|
+
|
|
3333
|
+
var isPlainObject_1 = isPlainObject;
|
|
3334
|
+
|
|
3335
|
+
/**
|
|
3336
|
+
* Used by `_.omit` to customize its `_.cloneDeep` use to only clone plain
|
|
3337
|
+
* objects.
|
|
3338
|
+
*
|
|
3339
|
+
* @private
|
|
3340
|
+
* @param {*} value The value to inspect.
|
|
3341
|
+
* @param {string} key The key of the property to inspect.
|
|
3342
|
+
* @returns {*} Returns the uncloned value or `undefined` to defer cloning to `_.cloneDeep`.
|
|
3343
|
+
*/
|
|
3344
|
+
function customOmitClone(value) {
|
|
3345
|
+
return isPlainObject_1(value) ? undefined : value;
|
|
3346
|
+
}
|
|
3347
|
+
|
|
3348
|
+
var _customOmitClone = customOmitClone;
|
|
3349
|
+
|
|
3350
|
+
/** Built-in value references. */
|
|
3351
|
+
var spreadableSymbol = _Symbol ? _Symbol.isConcatSpreadable : undefined;
|
|
3352
|
+
|
|
3353
|
+
/**
|
|
3354
|
+
* Checks if `value` is a flattenable `arguments` object or array.
|
|
3355
|
+
*
|
|
3356
|
+
* @private
|
|
3357
|
+
* @param {*} value The value to check.
|
|
3358
|
+
* @returns {boolean} Returns `true` if `value` is flattenable, else `false`.
|
|
3359
|
+
*/
|
|
3360
|
+
function isFlattenable(value) {
|
|
3361
|
+
return isArray_1(value) || isArguments_1(value) ||
|
|
3362
|
+
!!(spreadableSymbol && value && value[spreadableSymbol]);
|
|
3363
|
+
}
|
|
3364
|
+
|
|
3365
|
+
var _isFlattenable = isFlattenable;
|
|
3366
|
+
|
|
3367
|
+
/**
|
|
3368
|
+
* The base implementation of `_.flatten` with support for restricting flattening.
|
|
3369
|
+
*
|
|
3370
|
+
* @private
|
|
3371
|
+
* @param {Array} array The array to flatten.
|
|
3372
|
+
* @param {number} depth The maximum recursion depth.
|
|
3373
|
+
* @param {boolean} [predicate=isFlattenable] The function invoked per iteration.
|
|
3374
|
+
* @param {boolean} [isStrict] Restrict to values that pass `predicate` checks.
|
|
3375
|
+
* @param {Array} [result=[]] The initial result value.
|
|
3376
|
+
* @returns {Array} Returns the new flattened array.
|
|
3377
|
+
*/
|
|
3378
|
+
function baseFlatten(array, depth, predicate, isStrict, result) {
|
|
3379
|
+
var index = -1,
|
|
3380
|
+
length = array.length;
|
|
3381
|
+
|
|
3382
|
+
predicate || (predicate = _isFlattenable);
|
|
3383
|
+
result || (result = []);
|
|
3384
|
+
|
|
3385
|
+
while (++index < length) {
|
|
3386
|
+
var value = array[index];
|
|
3387
|
+
if (depth > 0 && predicate(value)) {
|
|
3388
|
+
if (depth > 1) {
|
|
3389
|
+
// Recursively flatten arrays (susceptible to call stack limits).
|
|
3390
|
+
baseFlatten(value, depth - 1, predicate, isStrict, result);
|
|
3391
|
+
} else {
|
|
3392
|
+
_arrayPush(result, value);
|
|
3393
|
+
}
|
|
3394
|
+
} else if (!isStrict) {
|
|
3395
|
+
result[result.length] = value;
|
|
3396
|
+
}
|
|
3397
|
+
}
|
|
3398
|
+
return result;
|
|
3399
|
+
}
|
|
3400
|
+
|
|
3401
|
+
var _baseFlatten = baseFlatten;
|
|
3402
|
+
|
|
3403
|
+
/**
|
|
3404
|
+
* Flattens `array` a single level deep.
|
|
3405
|
+
*
|
|
3406
|
+
* @static
|
|
3407
|
+
* @memberOf _
|
|
3408
|
+
* @since 0.1.0
|
|
3409
|
+
* @category Array
|
|
3410
|
+
* @param {Array} array The array to flatten.
|
|
3411
|
+
* @returns {Array} Returns the new flattened array.
|
|
3412
|
+
* @example
|
|
3413
|
+
*
|
|
3414
|
+
* _.flatten([1, [2, [3, [4]], 5]]);
|
|
3415
|
+
* // => [1, 2, [3, [4]], 5]
|
|
3416
|
+
*/
|
|
3417
|
+
function flatten(array) {
|
|
3418
|
+
var length = array == null ? 0 : array.length;
|
|
3419
|
+
return length ? _baseFlatten(array, 1) : [];
|
|
3420
|
+
}
|
|
3421
|
+
|
|
3422
|
+
var flatten_1 = flatten;
|
|
3423
|
+
|
|
3424
|
+
/**
|
|
3425
|
+
* A faster alternative to `Function#apply`, this function invokes `func`
|
|
3426
|
+
* with the `this` binding of `thisArg` and the arguments of `args`.
|
|
3427
|
+
*
|
|
3428
|
+
* @private
|
|
3429
|
+
* @param {Function} func The function to invoke.
|
|
3430
|
+
* @param {*} thisArg The `this` binding of `func`.
|
|
3431
|
+
* @param {Array} args The arguments to invoke `func` with.
|
|
3432
|
+
* @returns {*} Returns the result of `func`.
|
|
3433
|
+
*/
|
|
3434
|
+
function apply(func, thisArg, args) {
|
|
3435
|
+
switch (args.length) {
|
|
3436
|
+
case 0: return func.call(thisArg);
|
|
3437
|
+
case 1: return func.call(thisArg, args[0]);
|
|
3438
|
+
case 2: return func.call(thisArg, args[0], args[1]);
|
|
3439
|
+
case 3: return func.call(thisArg, args[0], args[1], args[2]);
|
|
3440
|
+
}
|
|
3441
|
+
return func.apply(thisArg, args);
|
|
3442
|
+
}
|
|
3443
|
+
|
|
3444
|
+
var _apply = apply;
|
|
3445
|
+
|
|
3446
|
+
/* Built-in method references for those with the same name as other `lodash` methods. */
|
|
3447
|
+
var nativeMax = Math.max;
|
|
3448
|
+
|
|
3449
|
+
/**
|
|
3450
|
+
* A specialized version of `baseRest` which transforms the rest array.
|
|
3451
|
+
*
|
|
3452
|
+
* @private
|
|
3453
|
+
* @param {Function} func The function to apply a rest parameter to.
|
|
3454
|
+
* @param {number} [start=func.length-1] The start position of the rest parameter.
|
|
3455
|
+
* @param {Function} transform The rest array transform.
|
|
3456
|
+
* @returns {Function} Returns the new function.
|
|
3457
|
+
*/
|
|
3458
|
+
function overRest(func, start, transform) {
|
|
3459
|
+
start = nativeMax(start === undefined ? (func.length - 1) : start, 0);
|
|
3460
|
+
return function() {
|
|
3461
|
+
var args = arguments,
|
|
3462
|
+
index = -1,
|
|
3463
|
+
length = nativeMax(args.length - start, 0),
|
|
3464
|
+
array = Array(length);
|
|
3465
|
+
|
|
3466
|
+
while (++index < length) {
|
|
3467
|
+
array[index] = args[start + index];
|
|
3468
|
+
}
|
|
3469
|
+
index = -1;
|
|
3470
|
+
var otherArgs = Array(start + 1);
|
|
3471
|
+
while (++index < start) {
|
|
3472
|
+
otherArgs[index] = args[index];
|
|
3473
|
+
}
|
|
3474
|
+
otherArgs[start] = transform(array);
|
|
3475
|
+
return _apply(func, this, otherArgs);
|
|
3476
|
+
};
|
|
3477
|
+
}
|
|
3478
|
+
|
|
3479
|
+
var _overRest = overRest;
|
|
3480
|
+
|
|
3481
|
+
/**
|
|
3482
|
+
* Creates a function that returns `value`.
|
|
3483
|
+
*
|
|
3484
|
+
* @static
|
|
3485
|
+
* @memberOf _
|
|
3486
|
+
* @since 2.4.0
|
|
3487
|
+
* @category Util
|
|
3488
|
+
* @param {*} value The value to return from the new function.
|
|
3489
|
+
* @returns {Function} Returns the new constant function.
|
|
3490
|
+
* @example
|
|
3491
|
+
*
|
|
3492
|
+
* var objects = _.times(2, _.constant({ 'a': 1 }));
|
|
3493
|
+
*
|
|
3494
|
+
* console.log(objects);
|
|
3495
|
+
* // => [{ 'a': 1 }, { 'a': 1 }]
|
|
3496
|
+
*
|
|
3497
|
+
* console.log(objects[0] === objects[1]);
|
|
3498
|
+
* // => true
|
|
3499
|
+
*/
|
|
3500
|
+
function constant(value) {
|
|
3501
|
+
return function() {
|
|
3502
|
+
return value;
|
|
3503
|
+
};
|
|
3504
|
+
}
|
|
3505
|
+
|
|
3506
|
+
var constant_1 = constant;
|
|
3507
|
+
|
|
3508
|
+
/**
|
|
3509
|
+
* This method returns the first argument it receives.
|
|
3510
|
+
*
|
|
3511
|
+
* @static
|
|
3512
|
+
* @since 0.1.0
|
|
3513
|
+
* @memberOf _
|
|
3514
|
+
* @category Util
|
|
3515
|
+
* @param {*} value Any value.
|
|
3516
|
+
* @returns {*} Returns `value`.
|
|
3517
|
+
* @example
|
|
3518
|
+
*
|
|
3519
|
+
* var object = { 'a': 1 };
|
|
3520
|
+
*
|
|
3521
|
+
* console.log(_.identity(object) === object);
|
|
3522
|
+
* // => true
|
|
3523
|
+
*/
|
|
3524
|
+
function identity(value) {
|
|
3525
|
+
return value;
|
|
3526
|
+
}
|
|
3527
|
+
|
|
3528
|
+
var identity_1 = identity;
|
|
3529
|
+
|
|
3530
|
+
/**
|
|
3531
|
+
* The base implementation of `setToString` without support for hot loop shorting.
|
|
3532
|
+
*
|
|
3533
|
+
* @private
|
|
3534
|
+
* @param {Function} func The function to modify.
|
|
3535
|
+
* @param {Function} string The `toString` result.
|
|
3536
|
+
* @returns {Function} Returns `func`.
|
|
3537
|
+
*/
|
|
3538
|
+
var baseSetToString = !_defineProperty ? identity_1 : function(func, string) {
|
|
3539
|
+
return _defineProperty(func, 'toString', {
|
|
3540
|
+
'configurable': true,
|
|
3541
|
+
'enumerable': false,
|
|
3542
|
+
'value': constant_1(string),
|
|
3543
|
+
'writable': true
|
|
3544
|
+
});
|
|
3545
|
+
};
|
|
3546
|
+
|
|
3547
|
+
var _baseSetToString = baseSetToString;
|
|
3548
|
+
|
|
3549
|
+
/** Used to detect hot functions by number of calls within a span of milliseconds. */
|
|
3550
|
+
var HOT_COUNT = 800,
|
|
3551
|
+
HOT_SPAN = 16;
|
|
3552
|
+
|
|
3553
|
+
/* Built-in method references for those with the same name as other `lodash` methods. */
|
|
3554
|
+
var nativeNow = Date.now;
|
|
3555
|
+
|
|
3556
|
+
/**
|
|
3557
|
+
* Creates a function that'll short out and invoke `identity` instead
|
|
3558
|
+
* of `func` when it's called `HOT_COUNT` or more times in `HOT_SPAN`
|
|
3559
|
+
* milliseconds.
|
|
3560
|
+
*
|
|
3561
|
+
* @private
|
|
3562
|
+
* @param {Function} func The function to restrict.
|
|
3563
|
+
* @returns {Function} Returns the new shortable function.
|
|
3564
|
+
*/
|
|
3565
|
+
function shortOut(func) {
|
|
3566
|
+
var count = 0,
|
|
3567
|
+
lastCalled = 0;
|
|
3568
|
+
|
|
3569
|
+
return function() {
|
|
3570
|
+
var stamp = nativeNow(),
|
|
3571
|
+
remaining = HOT_SPAN - (stamp - lastCalled);
|
|
3572
|
+
|
|
3573
|
+
lastCalled = stamp;
|
|
3574
|
+
if (remaining > 0) {
|
|
3575
|
+
if (++count >= HOT_COUNT) {
|
|
3576
|
+
return arguments[0];
|
|
3577
|
+
}
|
|
3578
|
+
} else {
|
|
3579
|
+
count = 0;
|
|
3580
|
+
}
|
|
3581
|
+
return func.apply(undefined, arguments);
|
|
3582
|
+
};
|
|
3583
|
+
}
|
|
3584
|
+
|
|
3585
|
+
var _shortOut = shortOut;
|
|
3586
|
+
|
|
3587
|
+
/**
|
|
3588
|
+
* Sets the `toString` method of `func` to return `string`.
|
|
3589
|
+
*
|
|
3590
|
+
* @private
|
|
3591
|
+
* @param {Function} func The function to modify.
|
|
3592
|
+
* @param {Function} string The `toString` result.
|
|
3593
|
+
* @returns {Function} Returns `func`.
|
|
3594
|
+
*/
|
|
3595
|
+
var setToString = _shortOut(_baseSetToString);
|
|
3596
|
+
|
|
3597
|
+
var _setToString = setToString;
|
|
3598
|
+
|
|
3599
|
+
/**
|
|
3600
|
+
* A specialized version of `baseRest` which flattens the rest array.
|
|
3601
|
+
*
|
|
3602
|
+
* @private
|
|
3603
|
+
* @param {Function} func The function to apply a rest parameter to.
|
|
3604
|
+
* @returns {Function} Returns the new function.
|
|
3605
|
+
*/
|
|
3606
|
+
function flatRest(func) {
|
|
3607
|
+
return _setToString(_overRest(func, undefined, flatten_1), func + '');
|
|
3608
|
+
}
|
|
3609
|
+
|
|
3610
|
+
var _flatRest = flatRest;
|
|
3611
|
+
|
|
3612
|
+
/** Used to compose bitmasks for cloning. */
|
|
3613
|
+
var CLONE_DEEP_FLAG = 1,
|
|
3614
|
+
CLONE_FLAT_FLAG = 2,
|
|
3615
|
+
CLONE_SYMBOLS_FLAG = 4;
|
|
3616
|
+
|
|
3617
|
+
/**
|
|
3618
|
+
* The opposite of `_.pick`; this method creates an object composed of the
|
|
3619
|
+
* own and inherited enumerable property paths of `object` that are not omitted.
|
|
3620
|
+
*
|
|
3621
|
+
* **Note:** This method is considerably slower than `_.pick`.
|
|
3622
|
+
*
|
|
3623
|
+
* @static
|
|
3624
|
+
* @since 0.1.0
|
|
3625
|
+
* @memberOf _
|
|
3626
|
+
* @category Object
|
|
3627
|
+
* @param {Object} object The source object.
|
|
3628
|
+
* @param {...(string|string[])} [paths] The property paths to omit.
|
|
3629
|
+
* @returns {Object} Returns the new object.
|
|
3630
|
+
* @example
|
|
3631
|
+
*
|
|
3632
|
+
* var object = { 'a': 1, 'b': '2', 'c': 3 };
|
|
3633
|
+
*
|
|
3634
|
+
* _.omit(object, ['a', 'c']);
|
|
3635
|
+
* // => { 'b': '2' }
|
|
3636
|
+
*/
|
|
3637
|
+
var omit = _flatRest(function(object, paths) {
|
|
3638
|
+
var result = {};
|
|
3639
|
+
if (object == null) {
|
|
3640
|
+
return result;
|
|
3641
|
+
}
|
|
3642
|
+
var isDeep = false;
|
|
3643
|
+
paths = _arrayMap(paths, function(path) {
|
|
3644
|
+
path = _castPath(path, object);
|
|
3645
|
+
isDeep || (isDeep = path.length > 1);
|
|
3646
|
+
return path;
|
|
3647
|
+
});
|
|
3648
|
+
_copyObject(object, _getAllKeysIn(object), result);
|
|
3649
|
+
if (isDeep) {
|
|
3650
|
+
result = _baseClone(result, CLONE_DEEP_FLAG | CLONE_FLAT_FLAG | CLONE_SYMBOLS_FLAG, _customOmitClone);
|
|
3651
|
+
}
|
|
3652
|
+
var length = paths.length;
|
|
3653
|
+
while (length--) {
|
|
3654
|
+
_baseUnset(result, paths[length]);
|
|
3655
|
+
}
|
|
3656
|
+
return result;
|
|
3657
|
+
});
|
|
3658
|
+
|
|
3659
|
+
var omit_1 = omit;
|
|
3660
|
+
|
|
3661
|
+
const ModalFooter = props => {
|
|
3662
|
+
const {
|
|
3663
|
+
children,
|
|
3664
|
+
cancelText,
|
|
3665
|
+
cancelButtonProps,
|
|
3666
|
+
okButtonProps,
|
|
3667
|
+
okType,
|
|
3668
|
+
onOk,
|
|
3669
|
+
okText,
|
|
3670
|
+
...others
|
|
3671
|
+
} = props;
|
|
3672
|
+
const defaultFooter = /*#__PURE__*/React__default["default"].createElement(antd.Flex, {
|
|
3673
|
+
justify: "space-between",
|
|
3674
|
+
gap: 8
|
|
3675
|
+
}, /*#__PURE__*/React__default["default"].createElement("div", null), /*#__PURE__*/React__default["default"].createElement(antd.Flex, {
|
|
3676
|
+
gap: 8
|
|
3677
|
+
}, /*#__PURE__*/React__default["default"].createElement(reactFormAntd.CancelButton, Object.assign({}, cancelButtonProps, {
|
|
3678
|
+
onClick: others.onCancel
|
|
3679
|
+
}), cancelText), /*#__PURE__*/React__default["default"].createElement(reactFormAntd.SubmitButton, Object.assign({}, okButtonProps, {
|
|
3680
|
+
type: okType,
|
|
3681
|
+
onClick: onOk
|
|
3682
|
+
}), okText)));
|
|
3683
|
+
if (typeof children === 'function') {
|
|
3684
|
+
return children({
|
|
3685
|
+
defaultFooter,
|
|
3686
|
+
props: omit_1(props, ['children'])
|
|
3687
|
+
});
|
|
3688
|
+
}
|
|
3689
|
+
if (React.isValidElement(children) || children === null) {
|
|
3690
|
+
return children;
|
|
3691
|
+
}
|
|
3692
|
+
return defaultFooter;
|
|
3693
|
+
};
|
|
3694
|
+
const ModalForm = props => {
|
|
3695
|
+
const {
|
|
3696
|
+
formProps,
|
|
3697
|
+
autoClose,
|
|
3698
|
+
children,
|
|
3699
|
+
modalRender,
|
|
3700
|
+
...others
|
|
3701
|
+
} = props;
|
|
3702
|
+
const formChildren = /*#__PURE__*/React__default["default"].createElement(Form, Object.assign({}, formProps, {
|
|
3703
|
+
onSubmit: function (data) {
|
|
3704
|
+
try {
|
|
3705
|
+
const _arguments = arguments;
|
|
3706
|
+
return Promise.resolve(formProps.onSubmit?.(data, {
|
|
3707
|
+
close: others.onCancel
|
|
3708
|
+
}, ...[].slice.call(_arguments, 1))).then(function (res) {
|
|
3709
|
+
if (res === false) {
|
|
3710
|
+
return;
|
|
3711
|
+
}
|
|
3712
|
+
autoClose && others.onCancel && others.onCancel();
|
|
3713
|
+
});
|
|
3714
|
+
} catch (e) {
|
|
3715
|
+
return Promise.reject(e);
|
|
3716
|
+
}
|
|
3717
|
+
}
|
|
3718
|
+
}), children);
|
|
3719
|
+
return typeof modalRender === 'function' ? modalRender({
|
|
3720
|
+
formChildren,
|
|
3721
|
+
defaultChildren: children,
|
|
3722
|
+
props: omit_1(props, ['children'])
|
|
3723
|
+
}) : formChildren;
|
|
3724
|
+
};
|
|
3725
|
+
const FormModal = p => {
|
|
3726
|
+
const {
|
|
3727
|
+
locale: contextLocale
|
|
3728
|
+
} = globalContext.useContext();
|
|
3729
|
+
const locale = Object.assign({}, {
|
|
3730
|
+
提交: '提交',
|
|
3731
|
+
取消: '取消'
|
|
3732
|
+
}, contextLocale, p.locale);
|
|
3733
|
+
const {
|
|
3734
|
+
formProps,
|
|
3735
|
+
okType,
|
|
3736
|
+
okButtonProps,
|
|
3737
|
+
okText,
|
|
3738
|
+
onOk,
|
|
3739
|
+
cancelButtonProps,
|
|
3740
|
+
cancelText,
|
|
3741
|
+
footer,
|
|
3742
|
+
renderModal,
|
|
3743
|
+
modalRender,
|
|
3744
|
+
autoClose,
|
|
3745
|
+
...others
|
|
3746
|
+
} = Object.assign({}, {
|
|
3747
|
+
formProps: {},
|
|
3748
|
+
autoClose: true,
|
|
3749
|
+
okType: 'primary',
|
|
3750
|
+
okText: locale['提交'],
|
|
3751
|
+
cancelText: locale['取消'],
|
|
3752
|
+
renderModal: props => /*#__PURE__*/React__default["default"].createElement(antd.Modal, props)
|
|
3753
|
+
}, p, {
|
|
3754
|
+
locale
|
|
3755
|
+
});
|
|
3756
|
+
return renderModal(Object.assign({}, others, {
|
|
3757
|
+
modalRender: children => /*#__PURE__*/React__default["default"].createElement(ModalForm, Object.assign({}, others, {
|
|
3758
|
+
formProps,
|
|
3759
|
+
autoClose,
|
|
3760
|
+
children,
|
|
3761
|
+
modalRender
|
|
3762
|
+
})),
|
|
3763
|
+
footer: () => {
|
|
3764
|
+
return /*#__PURE__*/React__default["default"].createElement(ModalFooter, Object.assign({}, others, {
|
|
3765
|
+
children: footer,
|
|
3766
|
+
cancelText,
|
|
3767
|
+
cancelButtonProps,
|
|
3768
|
+
okButtonProps,
|
|
3769
|
+
okType,
|
|
3770
|
+
onOk,
|
|
3771
|
+
okText
|
|
3772
|
+
}));
|
|
3773
|
+
}
|
|
3774
|
+
}));
|
|
3775
|
+
};
|
|
3776
|
+
|
|
3777
|
+
const FormSteps = p => {
|
|
3778
|
+
const {
|
|
3779
|
+
className,
|
|
3780
|
+
stepsClassName,
|
|
3781
|
+
autoStep,
|
|
3782
|
+
onComplete,
|
|
3783
|
+
children,
|
|
3784
|
+
...stepProps
|
|
3785
|
+
} = Object.assign({}, {
|
|
3786
|
+
autoStep: true,
|
|
3787
|
+
defaultCurrent: 0,
|
|
3788
|
+
items: [],
|
|
3789
|
+
onComplete: () => {}
|
|
3790
|
+
}, p);
|
|
3791
|
+
const [currentStep, onStepChange] = useControlValue__default["default"](stepProps, {
|
|
3792
|
+
value: 'current',
|
|
3793
|
+
defaultValue: 'defaultCurrent'
|
|
3794
|
+
});
|
|
3795
|
+
const stepCacheRef = React.useRef([]);
|
|
3796
|
+
const isLastStep = currentStep === stepProps.items.length - 1;
|
|
3797
|
+
const currentFormProps = Object.assign({}, stepProps.items[currentStep]?.formProps);
|
|
3798
|
+
const inner = /*#__PURE__*/React__default["default"].createElement(antd.Flex, {
|
|
3799
|
+
className: className,
|
|
3800
|
+
vertical: stepProps.direction !== 'vertical',
|
|
3801
|
+
gap: 24
|
|
3802
|
+
}, /*#__PURE__*/React__default["default"].createElement(antd.Steps, _extends({}, omit_1(stepProps, ['current', 'defaultCurrent', 'onChange']), {
|
|
3803
|
+
className: classnames(stepsClassName, style['steps']),
|
|
3804
|
+
items: stepProps.items.map(item => omit_1(item, ['formProps'])),
|
|
3805
|
+
current: currentStep
|
|
3806
|
+
})), /*#__PURE__*/React__default["default"].createElement("div", {
|
|
3807
|
+
className: style['steps-form-inner']
|
|
3808
|
+
}, stepProps.items[currentStep]?.children));
|
|
3809
|
+
return /*#__PURE__*/React__default["default"].createElement(Form, Object.assign({}, currentFormProps, {
|
|
3810
|
+
onSubmit: function (data) {
|
|
3811
|
+
try {
|
|
3812
|
+
const _arguments = arguments;
|
|
3813
|
+
if (!stepCacheRef.current[currentStep]) {
|
|
3814
|
+
stepCacheRef.current[currentStep] = {};
|
|
3815
|
+
}
|
|
3816
|
+
stepCacheRef.current[currentStep].formData = data;
|
|
3817
|
+
return Promise.resolve(currentFormProps.onSubmit?.(data, {
|
|
3818
|
+
currentStep,
|
|
3819
|
+
onStepChange,
|
|
3820
|
+
stepCache: stepCacheRef.current,
|
|
3821
|
+
isLastStep
|
|
3822
|
+
}, ...[].slice.call(_arguments, 1))).then(function (res) {
|
|
3823
|
+
stepCacheRef.current[currentStep].submitData = res;
|
|
3824
|
+
if (autoStep && res !== false && !isLastStep) {
|
|
3825
|
+
onStepChange(currentStep + 1);
|
|
3826
|
+
return res;
|
|
3827
|
+
}
|
|
3828
|
+
if (autoStep && res !== false) {
|
|
3829
|
+
onComplete(stepCacheRef.current);
|
|
3830
|
+
return res;
|
|
3831
|
+
}
|
|
3832
|
+
return res;
|
|
3833
|
+
});
|
|
3834
|
+
} catch (e) {
|
|
3835
|
+
return Promise.reject(e);
|
|
3836
|
+
}
|
|
3837
|
+
}
|
|
3838
|
+
}), typeof children === 'function' ? children({
|
|
3839
|
+
children: inner,
|
|
3840
|
+
isLastStep,
|
|
3841
|
+
currentStep,
|
|
3842
|
+
onStepChange,
|
|
3843
|
+
getStepCache: () => {
|
|
3844
|
+
return stepCacheRef.current;
|
|
3845
|
+
}
|
|
3846
|
+
}) : inner);
|
|
3847
|
+
};
|
|
3848
|
+
|
|
3849
|
+
/**
|
|
3850
|
+
* This function is like `assignValue` except that it doesn't assign
|
|
3851
|
+
* `undefined` values.
|
|
3852
|
+
*
|
|
3853
|
+
* @private
|
|
3854
|
+
* @param {Object} object The object to modify.
|
|
3855
|
+
* @param {string} key The key of the property to assign.
|
|
3856
|
+
* @param {*} value The value to assign.
|
|
3857
|
+
*/
|
|
3858
|
+
function assignMergeValue(object, key, value) {
|
|
3859
|
+
if ((value !== undefined && !eq_1(object[key], value)) ||
|
|
3860
|
+
(value === undefined && !(key in object))) {
|
|
3861
|
+
_baseAssignValue(object, key, value);
|
|
3862
|
+
}
|
|
3863
|
+
}
|
|
3864
|
+
|
|
3865
|
+
var _assignMergeValue = assignMergeValue;
|
|
3866
|
+
|
|
3867
|
+
/**
|
|
3868
|
+
* Creates a base function for methods like `_.forIn` and `_.forOwn`.
|
|
3869
|
+
*
|
|
3870
|
+
* @private
|
|
3871
|
+
* @param {boolean} [fromRight] Specify iterating from right to left.
|
|
3872
|
+
* @returns {Function} Returns the new base function.
|
|
3873
|
+
*/
|
|
3874
|
+
function createBaseFor(fromRight) {
|
|
3875
|
+
return function(object, iteratee, keysFunc) {
|
|
3876
|
+
var index = -1,
|
|
3877
|
+
iterable = Object(object),
|
|
3878
|
+
props = keysFunc(object),
|
|
3879
|
+
length = props.length;
|
|
3880
|
+
|
|
3881
|
+
while (length--) {
|
|
3882
|
+
var key = props[fromRight ? length : ++index];
|
|
3883
|
+
if (iteratee(iterable[key], key, iterable) === false) {
|
|
3884
|
+
break;
|
|
3885
|
+
}
|
|
3886
|
+
}
|
|
3887
|
+
return object;
|
|
3888
|
+
};
|
|
3889
|
+
}
|
|
3890
|
+
|
|
3891
|
+
var _createBaseFor = createBaseFor;
|
|
3892
|
+
|
|
3893
|
+
/**
|
|
3894
|
+
* The base implementation of `baseForOwn` which iterates over `object`
|
|
3895
|
+
* properties returned by `keysFunc` and invokes `iteratee` for each property.
|
|
3896
|
+
* Iteratee functions may exit iteration early by explicitly returning `false`.
|
|
3897
|
+
*
|
|
3898
|
+
* @private
|
|
3899
|
+
* @param {Object} object The object to iterate over.
|
|
3900
|
+
* @param {Function} iteratee The function invoked per iteration.
|
|
3901
|
+
* @param {Function} keysFunc The function to get the keys of `object`.
|
|
3902
|
+
* @returns {Object} Returns `object`.
|
|
3903
|
+
*/
|
|
3904
|
+
var baseFor = _createBaseFor();
|
|
3905
|
+
|
|
3906
|
+
var _baseFor = baseFor;
|
|
3907
|
+
|
|
3908
|
+
/**
|
|
3909
|
+
* This method is like `_.isArrayLike` except that it also checks if `value`
|
|
3910
|
+
* is an object.
|
|
3911
|
+
*
|
|
3912
|
+
* @static
|
|
3913
|
+
* @memberOf _
|
|
3914
|
+
* @since 4.0.0
|
|
3915
|
+
* @category Lang
|
|
3916
|
+
* @param {*} value The value to check.
|
|
3917
|
+
* @returns {boolean} Returns `true` if `value` is an array-like object,
|
|
3918
|
+
* else `false`.
|
|
3919
|
+
* @example
|
|
3920
|
+
*
|
|
3921
|
+
* _.isArrayLikeObject([1, 2, 3]);
|
|
3922
|
+
* // => true
|
|
3923
|
+
*
|
|
3924
|
+
* _.isArrayLikeObject(document.body.children);
|
|
3925
|
+
* // => true
|
|
3926
|
+
*
|
|
3927
|
+
* _.isArrayLikeObject('abc');
|
|
3928
|
+
* // => false
|
|
3929
|
+
*
|
|
3930
|
+
* _.isArrayLikeObject(_.noop);
|
|
3931
|
+
* // => false
|
|
3932
|
+
*/
|
|
3933
|
+
function isArrayLikeObject(value) {
|
|
3934
|
+
return isObjectLike_1(value) && isArrayLike_1(value);
|
|
3935
|
+
}
|
|
3936
|
+
|
|
3937
|
+
var isArrayLikeObject_1 = isArrayLikeObject;
|
|
3938
|
+
|
|
3939
|
+
/**
|
|
3940
|
+
* Gets the value at `key`, unless `key` is "__proto__" or "constructor".
|
|
3941
|
+
*
|
|
3942
|
+
* @private
|
|
3943
|
+
* @param {Object} object The object to query.
|
|
3944
|
+
* @param {string} key The key of the property to get.
|
|
3945
|
+
* @returns {*} Returns the property value.
|
|
3946
|
+
*/
|
|
3947
|
+
function safeGet(object, key) {
|
|
3948
|
+
if (key === 'constructor' && typeof object[key] === 'function') {
|
|
3949
|
+
return;
|
|
3950
|
+
}
|
|
3951
|
+
|
|
3952
|
+
if (key == '__proto__') {
|
|
3953
|
+
return;
|
|
3954
|
+
}
|
|
3955
|
+
|
|
3956
|
+
return object[key];
|
|
3957
|
+
}
|
|
3958
|
+
|
|
3959
|
+
var _safeGet = safeGet;
|
|
3960
|
+
|
|
3961
|
+
/**
|
|
3962
|
+
* Converts `value` to a plain object flattening inherited enumerable string
|
|
3963
|
+
* keyed properties of `value` to own properties of the plain object.
|
|
3964
|
+
*
|
|
3965
|
+
* @static
|
|
3966
|
+
* @memberOf _
|
|
3967
|
+
* @since 3.0.0
|
|
3968
|
+
* @category Lang
|
|
3969
|
+
* @param {*} value The value to convert.
|
|
3970
|
+
* @returns {Object} Returns the converted plain object.
|
|
3971
|
+
* @example
|
|
3972
|
+
*
|
|
3973
|
+
* function Foo() {
|
|
3974
|
+
* this.b = 2;
|
|
3975
|
+
* }
|
|
3976
|
+
*
|
|
3977
|
+
* Foo.prototype.c = 3;
|
|
3978
|
+
*
|
|
3979
|
+
* _.assign({ 'a': 1 }, new Foo);
|
|
3980
|
+
* // => { 'a': 1, 'b': 2 }
|
|
3981
|
+
*
|
|
3982
|
+
* _.assign({ 'a': 1 }, _.toPlainObject(new Foo));
|
|
3983
|
+
* // => { 'a': 1, 'b': 2, 'c': 3 }
|
|
3984
|
+
*/
|
|
3985
|
+
function toPlainObject(value) {
|
|
3986
|
+
return _copyObject(value, keysIn_1(value));
|
|
3987
|
+
}
|
|
3988
|
+
|
|
3989
|
+
var toPlainObject_1 = toPlainObject;
|
|
3990
|
+
|
|
3991
|
+
/**
|
|
3992
|
+
* A specialized version of `baseMerge` for arrays and objects which performs
|
|
3993
|
+
* deep merges and tracks traversed objects enabling objects with circular
|
|
3994
|
+
* references to be merged.
|
|
3995
|
+
*
|
|
3996
|
+
* @private
|
|
3997
|
+
* @param {Object} object The destination object.
|
|
3998
|
+
* @param {Object} source The source object.
|
|
3999
|
+
* @param {string} key The key of the value to merge.
|
|
4000
|
+
* @param {number} srcIndex The index of `source`.
|
|
4001
|
+
* @param {Function} mergeFunc The function to merge values.
|
|
4002
|
+
* @param {Function} [customizer] The function to customize assigned values.
|
|
4003
|
+
* @param {Object} [stack] Tracks traversed source values and their merged
|
|
4004
|
+
* counterparts.
|
|
4005
|
+
*/
|
|
4006
|
+
function baseMergeDeep(object, source, key, srcIndex, mergeFunc, customizer, stack) {
|
|
4007
|
+
var objValue = _safeGet(object, key),
|
|
4008
|
+
srcValue = _safeGet(source, key),
|
|
4009
|
+
stacked = stack.get(srcValue);
|
|
4010
|
+
|
|
4011
|
+
if (stacked) {
|
|
4012
|
+
_assignMergeValue(object, key, stacked);
|
|
4013
|
+
return;
|
|
4014
|
+
}
|
|
4015
|
+
var newValue = customizer
|
|
4016
|
+
? customizer(objValue, srcValue, (key + ''), object, source, stack)
|
|
4017
|
+
: undefined;
|
|
4018
|
+
|
|
4019
|
+
var isCommon = newValue === undefined;
|
|
4020
|
+
|
|
4021
|
+
if (isCommon) {
|
|
4022
|
+
var isArr = isArray_1(srcValue),
|
|
4023
|
+
isBuff = !isArr && isBuffer_1(srcValue),
|
|
4024
|
+
isTyped = !isArr && !isBuff && isTypedArray_1(srcValue);
|
|
4025
|
+
|
|
4026
|
+
newValue = srcValue;
|
|
4027
|
+
if (isArr || isBuff || isTyped) {
|
|
4028
|
+
if (isArray_1(objValue)) {
|
|
4029
|
+
newValue = objValue;
|
|
4030
|
+
}
|
|
4031
|
+
else if (isArrayLikeObject_1(objValue)) {
|
|
4032
|
+
newValue = _copyArray(objValue);
|
|
4033
|
+
}
|
|
4034
|
+
else if (isBuff) {
|
|
4035
|
+
isCommon = false;
|
|
4036
|
+
newValue = _cloneBuffer(srcValue, true);
|
|
4037
|
+
}
|
|
4038
|
+
else if (isTyped) {
|
|
4039
|
+
isCommon = false;
|
|
4040
|
+
newValue = _cloneTypedArray(srcValue, true);
|
|
4041
|
+
}
|
|
4042
|
+
else {
|
|
4043
|
+
newValue = [];
|
|
4044
|
+
}
|
|
4045
|
+
}
|
|
4046
|
+
else if (isPlainObject_1(srcValue) || isArguments_1(srcValue)) {
|
|
4047
|
+
newValue = objValue;
|
|
4048
|
+
if (isArguments_1(objValue)) {
|
|
4049
|
+
newValue = toPlainObject_1(objValue);
|
|
4050
|
+
}
|
|
4051
|
+
else if (!isObject_1(objValue) || isFunction_1(objValue)) {
|
|
4052
|
+
newValue = _initCloneObject(srcValue);
|
|
4053
|
+
}
|
|
4054
|
+
}
|
|
4055
|
+
else {
|
|
4056
|
+
isCommon = false;
|
|
4057
|
+
}
|
|
4058
|
+
}
|
|
4059
|
+
if (isCommon) {
|
|
4060
|
+
// Recursively merge objects and arrays (susceptible to call stack limits).
|
|
4061
|
+
stack.set(srcValue, newValue);
|
|
4062
|
+
mergeFunc(newValue, srcValue, srcIndex, customizer, stack);
|
|
4063
|
+
stack['delete'](srcValue);
|
|
4064
|
+
}
|
|
4065
|
+
_assignMergeValue(object, key, newValue);
|
|
4066
|
+
}
|
|
4067
|
+
|
|
4068
|
+
var _baseMergeDeep = baseMergeDeep;
|
|
4069
|
+
|
|
4070
|
+
/**
|
|
4071
|
+
* The base implementation of `_.merge` without support for multiple sources.
|
|
4072
|
+
*
|
|
4073
|
+
* @private
|
|
4074
|
+
* @param {Object} object The destination object.
|
|
4075
|
+
* @param {Object} source The source object.
|
|
4076
|
+
* @param {number} srcIndex The index of `source`.
|
|
4077
|
+
* @param {Function} [customizer] The function to customize merged values.
|
|
4078
|
+
* @param {Object} [stack] Tracks traversed source values and their merged
|
|
4079
|
+
* counterparts.
|
|
4080
|
+
*/
|
|
4081
|
+
function baseMerge(object, source, srcIndex, customizer, stack) {
|
|
4082
|
+
if (object === source) {
|
|
4083
|
+
return;
|
|
4084
|
+
}
|
|
4085
|
+
_baseFor(source, function(srcValue, key) {
|
|
4086
|
+
stack || (stack = new _Stack);
|
|
4087
|
+
if (isObject_1(srcValue)) {
|
|
4088
|
+
_baseMergeDeep(object, source, key, srcIndex, baseMerge, customizer, stack);
|
|
4089
|
+
}
|
|
4090
|
+
else {
|
|
4091
|
+
var newValue = customizer
|
|
4092
|
+
? customizer(_safeGet(object, key), srcValue, (key + ''), object, source, stack)
|
|
4093
|
+
: undefined;
|
|
4094
|
+
|
|
4095
|
+
if (newValue === undefined) {
|
|
4096
|
+
newValue = srcValue;
|
|
4097
|
+
}
|
|
4098
|
+
_assignMergeValue(object, key, newValue);
|
|
4099
|
+
}
|
|
4100
|
+
}, keysIn_1);
|
|
4101
|
+
}
|
|
4102
|
+
|
|
4103
|
+
var _baseMerge = baseMerge;
|
|
4104
|
+
|
|
4105
|
+
/**
|
|
4106
|
+
* The base implementation of `_.rest` which doesn't validate or coerce arguments.
|
|
4107
|
+
*
|
|
4108
|
+
* @private
|
|
4109
|
+
* @param {Function} func The function to apply a rest parameter to.
|
|
4110
|
+
* @param {number} [start=func.length-1] The start position of the rest parameter.
|
|
4111
|
+
* @returns {Function} Returns the new function.
|
|
4112
|
+
*/
|
|
4113
|
+
function baseRest(func, start) {
|
|
4114
|
+
return _setToString(_overRest(func, start, identity_1), func + '');
|
|
4115
|
+
}
|
|
4116
|
+
|
|
4117
|
+
var _baseRest = baseRest;
|
|
4118
|
+
|
|
4119
|
+
/**
|
|
4120
|
+
* Checks if the given arguments are from an iteratee call.
|
|
4121
|
+
*
|
|
4122
|
+
* @private
|
|
4123
|
+
* @param {*} value The potential iteratee value argument.
|
|
4124
|
+
* @param {*} index The potential iteratee index or key argument.
|
|
4125
|
+
* @param {*} object The potential iteratee object argument.
|
|
4126
|
+
* @returns {boolean} Returns `true` if the arguments are from an iteratee call,
|
|
4127
|
+
* else `false`.
|
|
4128
|
+
*/
|
|
4129
|
+
function isIterateeCall(value, index, object) {
|
|
4130
|
+
if (!isObject_1(object)) {
|
|
4131
|
+
return false;
|
|
4132
|
+
}
|
|
4133
|
+
var type = typeof index;
|
|
4134
|
+
if (type == 'number'
|
|
4135
|
+
? (isArrayLike_1(object) && _isIndex(index, object.length))
|
|
4136
|
+
: (type == 'string' && index in object)
|
|
4137
|
+
) {
|
|
4138
|
+
return eq_1(object[index], value);
|
|
4139
|
+
}
|
|
4140
|
+
return false;
|
|
4141
|
+
}
|
|
4142
|
+
|
|
4143
|
+
var _isIterateeCall = isIterateeCall;
|
|
4144
|
+
|
|
4145
|
+
/**
|
|
4146
|
+
* Creates a function like `_.assign`.
|
|
4147
|
+
*
|
|
4148
|
+
* @private
|
|
4149
|
+
* @param {Function} assigner The function to assign values.
|
|
4150
|
+
* @returns {Function} Returns the new assigner function.
|
|
4151
|
+
*/
|
|
4152
|
+
function createAssigner(assigner) {
|
|
4153
|
+
return _baseRest(function(object, sources) {
|
|
4154
|
+
var index = -1,
|
|
4155
|
+
length = sources.length,
|
|
4156
|
+
customizer = length > 1 ? sources[length - 1] : undefined,
|
|
4157
|
+
guard = length > 2 ? sources[2] : undefined;
|
|
4158
|
+
|
|
4159
|
+
customizer = (assigner.length > 3 && typeof customizer == 'function')
|
|
4160
|
+
? (length--, customizer)
|
|
4161
|
+
: undefined;
|
|
4162
|
+
|
|
4163
|
+
if (guard && _isIterateeCall(sources[0], sources[1], guard)) {
|
|
4164
|
+
customizer = length < 3 ? undefined : customizer;
|
|
4165
|
+
length = 1;
|
|
4166
|
+
}
|
|
4167
|
+
object = Object(object);
|
|
4168
|
+
while (++index < length) {
|
|
4169
|
+
var source = sources[index];
|
|
4170
|
+
if (source) {
|
|
4171
|
+
assigner(object, source, index, customizer);
|
|
4172
|
+
}
|
|
4173
|
+
}
|
|
4174
|
+
return object;
|
|
4175
|
+
});
|
|
4176
|
+
}
|
|
4177
|
+
|
|
4178
|
+
var _createAssigner = createAssigner;
|
|
4179
|
+
|
|
4180
|
+
/**
|
|
4181
|
+
* This method is like `_.assign` except that it recursively merges own and
|
|
4182
|
+
* inherited enumerable string keyed properties of source objects into the
|
|
4183
|
+
* destination object. Source properties that resolve to `undefined` are
|
|
4184
|
+
* skipped if a destination value exists. Array and plain object properties
|
|
4185
|
+
* are merged recursively. Other objects and value types are overridden by
|
|
4186
|
+
* assignment. Source objects are applied from left to right. Subsequent
|
|
4187
|
+
* sources overwrite property assignments of previous sources.
|
|
4188
|
+
*
|
|
4189
|
+
* **Note:** This method mutates `object`.
|
|
4190
|
+
*
|
|
4191
|
+
* @static
|
|
4192
|
+
* @memberOf _
|
|
4193
|
+
* @since 0.5.0
|
|
4194
|
+
* @category Object
|
|
4195
|
+
* @param {Object} object The destination object.
|
|
4196
|
+
* @param {...Object} [sources] The source objects.
|
|
4197
|
+
* @returns {Object} Returns `object`.
|
|
4198
|
+
* @example
|
|
4199
|
+
*
|
|
4200
|
+
* var object = {
|
|
4201
|
+
* 'a': [{ 'b': 2 }, { 'd': 4 }]
|
|
4202
|
+
* };
|
|
4203
|
+
*
|
|
4204
|
+
* var other = {
|
|
4205
|
+
* 'a': [{ 'c': 3 }, { 'e': 5 }]
|
|
4206
|
+
* };
|
|
4207
|
+
*
|
|
4208
|
+
* _.merge(object, other);
|
|
4209
|
+
* // => { 'a': [{ 'b': 2, 'c': 3 }, { 'd': 4, 'e': 5 }] }
|
|
4210
|
+
*/
|
|
4211
|
+
var merge = _createAssigner(function(object, source, srcIndex) {
|
|
4212
|
+
_baseMerge(object, source, srcIndex);
|
|
4213
|
+
});
|
|
4214
|
+
|
|
4215
|
+
var merge_1 = merge;
|
|
4216
|
+
|
|
4217
|
+
const childrenContext = React.createContext({});
|
|
4218
|
+
const {
|
|
4219
|
+
Provider
|
|
4220
|
+
} = childrenContext;
|
|
4221
|
+
const useChildrenContext = () => {
|
|
4222
|
+
return React.useContext(childrenContext);
|
|
4223
|
+
};
|
|
4224
|
+
const StepChildren = () => {
|
|
4225
|
+
const {
|
|
4226
|
+
stepChildren
|
|
4227
|
+
} = useChildrenContext();
|
|
4228
|
+
return stepChildren;
|
|
4229
|
+
};
|
|
4230
|
+
const StepFormFooter = p => {
|
|
4231
|
+
const {
|
|
4232
|
+
completeText,
|
|
4233
|
+
nextText,
|
|
4234
|
+
...props
|
|
4235
|
+
} = Object.assign({}, p);
|
|
4236
|
+
const {
|
|
4237
|
+
isLastStep
|
|
4238
|
+
} = useChildrenContext();
|
|
4239
|
+
return /*#__PURE__*/React__default["default"].createElement(ModalFooter, _extends({}, props, {
|
|
4240
|
+
okText: isLastStep ? completeText : nextText
|
|
4241
|
+
}));
|
|
4242
|
+
};
|
|
4243
|
+
const FormStepsModal = p => {
|
|
4244
|
+
const locale = Object.assign({}, {
|
|
4245
|
+
完成: '完成',
|
|
4246
|
+
下一步: '下一步'
|
|
4247
|
+
}, p.locale);
|
|
4248
|
+
const {
|
|
4249
|
+
modalProps,
|
|
4250
|
+
completeText,
|
|
4251
|
+
nextText,
|
|
4252
|
+
className,
|
|
4253
|
+
...others
|
|
4254
|
+
} = merge_1({}, {
|
|
4255
|
+
autoStep: true,
|
|
4256
|
+
modalProps: {
|
|
4257
|
+
autoClose: true
|
|
4258
|
+
},
|
|
4259
|
+
completeText: locale['完成'],
|
|
4260
|
+
nextText: locale['下一步']
|
|
4261
|
+
}, p, {
|
|
4262
|
+
locale
|
|
4263
|
+
});
|
|
4264
|
+
return /*#__PURE__*/React__default["default"].createElement(FormModal, _extends({}, modalProps, {
|
|
4265
|
+
modalRender: _ref => {
|
|
4266
|
+
let {
|
|
4267
|
+
defaultChildren
|
|
4268
|
+
} = _ref;
|
|
4269
|
+
return /*#__PURE__*/React__default["default"].createElement(FormSteps, _extends({}, Object.assign({}, others, {
|
|
4270
|
+
items: others.items.map(item => {
|
|
4271
|
+
return Object.assign({}, item, {
|
|
4272
|
+
formProps: Object.assign({}, item.formProps, {
|
|
4273
|
+
onSubmit: function (data, context) {
|
|
4274
|
+
return item.formProps?.onSubmit?.(data, Object.assign({}, context, {
|
|
4275
|
+
close: modalProps.onCancel
|
|
4276
|
+
}), ...[].slice.call(arguments, 2));
|
|
4277
|
+
}
|
|
4278
|
+
})
|
|
4279
|
+
});
|
|
4280
|
+
})
|
|
4281
|
+
}), {
|
|
4282
|
+
className: classnames(className, style['steps-modal']),
|
|
4283
|
+
onComplete: function (data) {
|
|
4284
|
+
try {
|
|
4285
|
+
return Promise.resolve(others.onComplete?.(data)).then(function (res) {
|
|
4286
|
+
modalProps.autoClose && res !== false && modalProps.onCancel?.();
|
|
4287
|
+
});
|
|
4288
|
+
} catch (e) {
|
|
4289
|
+
return Promise.reject(e);
|
|
4290
|
+
}
|
|
4291
|
+
}
|
|
4292
|
+
}), _ref2 => {
|
|
4293
|
+
let {
|
|
4294
|
+
children: stepChildren,
|
|
4295
|
+
...props
|
|
4296
|
+
} = _ref2;
|
|
4297
|
+
return /*#__PURE__*/React__default["default"].createElement(Provider, {
|
|
4298
|
+
value: {
|
|
4299
|
+
stepChildren,
|
|
4300
|
+
...props
|
|
4301
|
+
}
|
|
4302
|
+
}, defaultChildren);
|
|
4303
|
+
});
|
|
4304
|
+
},
|
|
4305
|
+
footer: _ref3 => {
|
|
4306
|
+
let {
|
|
4307
|
+
props
|
|
4308
|
+
} = _ref3;
|
|
4309
|
+
return /*#__PURE__*/React__default["default"].createElement(StepFormFooter, _extends({}, props, {
|
|
4310
|
+
completeText: completeText,
|
|
4311
|
+
nextText: nextText
|
|
4312
|
+
}));
|
|
4313
|
+
}
|
|
4314
|
+
}), /*#__PURE__*/React__default["default"].createElement(StepChildren, null));
|
|
4315
|
+
};
|
|
4316
|
+
|
|
389
4317
|
exports.Form = Form;
|
|
4318
|
+
exports.FormModal = FormModal;
|
|
4319
|
+
exports.FormSteps = FormSteps;
|
|
4320
|
+
exports.FormStepsModal = FormStepsModal;
|
|
390
4321
|
exports.List = List;
|
|
391
4322
|
exports.MultiField = MultiField;
|
|
392
4323
|
exports.SubList = List;
|