@kne/react-pdf-sign 1.0.6 → 1.1.1

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