@sanity/assist 1.2.0 → 1.2.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.esm.js +25 -3506
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +3 -3487
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/schemas/assistDocumentSchema.tsx +1 -1
package/dist/index.esm.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
2
2
|
import { useClient, typed, useSchema, useDocumentStore, useDocumentPresence, createPatchChannel, FormBuilder, fromMutationPatches, pathToString, isObjectSchemaType, stringToPath, isKeySegment, useEditState, useCurrentUser, useValidationStatus, StatusButton, FormFieldHeaderText, PatchEvent, unset, set, useFormCallbacks, FormCallbacksProvider, FormInput, setIfMissing, insert, PresenceOverlay, VirtualizerScrollInstanceProvider, useColorSchemeValue, isArraySchemaType, ObjectInputMember, defineType, defineField, defineArrayMember, getPublishedId, definePlugin } from 'sanity';
|
|
3
|
-
import { Card, Stack
|
|
3
|
+
import { Card, Stack, Box, Button, Spinner, Flex, Label, focusFirstDescendant, Text, useClickOutside, Popover, useLayer, useGlobalKeyDown, useToast, Dialog, Tooltip, TextArea, Container, Autocomplete, Breadcrumbs, Badge, useTheme, rgba, ThemeProvider, ErrorBoundary, Switch, MenuButton, Menu, MenuItem } from '@sanity/ui';
|
|
4
4
|
import { useState, useRef, useEffect, useMemo, useCallback, createContext, useReducer, forwardRef, createElement, useContext, useId } from 'react';
|
|
5
5
|
import { SyncIcon, DocumentIcon, LinkIcon, ImageIcon, BlockContentIcon, OlistIcon, BlockquoteIcon, StringIcon, ErrorOutlineIcon, CheckmarkCircleIcon, CloseCircleIcon, ClockIcon, PlayIcon, SparklesIcon, ArrowLeftIcon, SearchIcon, RetryIcon, ArrowRightIcon, CloseIcon, CheckmarkIcon, icons, TokenIcon, DocumentTextIcon, ThListIcon, CodeIcon, ComposeIcon, LockIcon, ControlsIcon } from '@sanity/icons';
|
|
6
6
|
import { mergeMap, share, take, filter, distinctUntilChanged, catchError, tap } from 'rxjs/operators';
|
|
@@ -8,9 +8,7 @@ import isEqual from 'react-fast-compare';
|
|
|
8
8
|
import { throwError, of, partition, merge, switchMap, delay, defer } from 'rxjs';
|
|
9
9
|
import { exhaustMapToWithTrailing } from 'rxjs-exhaustmap-with-trailing';
|
|
10
10
|
import { useDocumentPane, usePaneRouter, DocumentInspectorHeader, DocumentPaneProvider } from 'sanity/desk';
|
|
11
|
-
import
|
|
12
|
-
import require$$1$1 from 'util';
|
|
13
|
-
import require$$0 from 'os';
|
|
11
|
+
import { extractWithPath } from '@sanity/mutator';
|
|
14
12
|
import styled, { keyframes } from 'styled-components';
|
|
15
13
|
import { minutesToMilliseconds, isAfter, addSeconds } from 'date-fns';
|
|
16
14
|
import formatDistanceToNow from 'date-fns/formatDistanceToNow';
|
|
@@ -308,7 +306,7 @@ function SchemaTypeTool() {
|
|
|
308
306
|
style: {
|
|
309
307
|
height: "calc(100vh - 81px)"
|
|
310
308
|
},
|
|
311
|
-
children: /* @__PURE__ */jsxs(Stack
|
|
309
|
+
children: /* @__PURE__ */jsxs(Stack, {
|
|
312
310
|
space: 4,
|
|
313
311
|
children: [/* @__PURE__ */jsx(Box, {
|
|
314
312
|
children: /* @__PURE__ */jsx(Button, {
|
|
@@ -323,7 +321,7 @@ function SchemaTypeTool() {
|
|
|
323
321
|
})
|
|
324
322
|
}), /* @__PURE__ */jsxs(Flex, {
|
|
325
323
|
gap: 2,
|
|
326
|
-
children: [/* @__PURE__ */jsxs(Stack
|
|
324
|
+
children: [/* @__PURE__ */jsxs(Stack, {
|
|
327
325
|
space: 2,
|
|
328
326
|
children: [/* @__PURE__ */jsx(Label, {
|
|
329
327
|
children: "Studio schema"
|
|
@@ -334,7 +332,7 @@ function SchemaTypeTool() {
|
|
|
334
332
|
})
|
|
335
333
|
}, type.name))
|
|
336
334
|
})]
|
|
337
|
-
}), /* @__PURE__ */jsxs(Stack
|
|
335
|
+
}), /* @__PURE__ */jsxs(Stack, {
|
|
338
336
|
space: 2,
|
|
339
337
|
children: [/* @__PURE__ */jsx(Label, {
|
|
340
338
|
children: "Stored schema"
|
|
@@ -509,3485 +507,6 @@ function prepareRebaseEvent(event) {
|
|
|
509
507
|
}
|
|
510
508
|
const SelectedFieldContext = createContext(void 0);
|
|
511
509
|
const SelectedFieldContextProvider = SelectedFieldContext.Provider;
|
|
512
|
-
var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
|
|
513
|
-
function getDefaultExportFromCjs(x) {
|
|
514
|
-
return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
|
|
515
|
-
}
|
|
516
|
-
|
|
517
|
-
/**
|
|
518
|
-
* Appends the elements of `values` to `array`.
|
|
519
|
-
*
|
|
520
|
-
* @private
|
|
521
|
-
* @param {Array} array The array to modify.
|
|
522
|
-
* @param {Array} values The values to append.
|
|
523
|
-
* @returns {Array} Returns `array`.
|
|
524
|
-
*/
|
|
525
|
-
|
|
526
|
-
function arrayPush$1(array, values) {
|
|
527
|
-
var index = -1,
|
|
528
|
-
length = values.length,
|
|
529
|
-
offset = array.length;
|
|
530
|
-
while (++index < length) {
|
|
531
|
-
array[offset + index] = values[index];
|
|
532
|
-
}
|
|
533
|
-
return array;
|
|
534
|
-
}
|
|
535
|
-
var _arrayPush = arrayPush$1;
|
|
536
|
-
|
|
537
|
-
/** Detect free variable `global` from Node.js. */
|
|
538
|
-
|
|
539
|
-
var freeGlobal$1 = typeof commonjsGlobal == 'object' && commonjsGlobal && commonjsGlobal.Object === Object && commonjsGlobal;
|
|
540
|
-
var _freeGlobal = freeGlobal$1;
|
|
541
|
-
var freeGlobal = _freeGlobal;
|
|
542
|
-
|
|
543
|
-
/** Detect free variable `self`. */
|
|
544
|
-
var freeSelf = typeof self == 'object' && self && self.Object === Object && self;
|
|
545
|
-
|
|
546
|
-
/** Used as a reference to the global object. */
|
|
547
|
-
var root$7 = freeGlobal || freeSelf || Function('return this')();
|
|
548
|
-
var _root = root$7;
|
|
549
|
-
var root$6 = _root;
|
|
550
|
-
|
|
551
|
-
/** Built-in value references. */
|
|
552
|
-
var Symbol$4 = root$6.Symbol;
|
|
553
|
-
var _Symbol = Symbol$4;
|
|
554
|
-
var Symbol$3 = _Symbol;
|
|
555
|
-
|
|
556
|
-
/** Used for built-in method references. */
|
|
557
|
-
var objectProto$5 = Object.prototype;
|
|
558
|
-
|
|
559
|
-
/** Used to check objects for own properties. */
|
|
560
|
-
var hasOwnProperty$4 = objectProto$5.hasOwnProperty;
|
|
561
|
-
|
|
562
|
-
/**
|
|
563
|
-
* Used to resolve the
|
|
564
|
-
* [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
|
|
565
|
-
* of values.
|
|
566
|
-
*/
|
|
567
|
-
var nativeObjectToString$1 = objectProto$5.toString;
|
|
568
|
-
|
|
569
|
-
/** Built-in value references. */
|
|
570
|
-
var symToStringTag$1 = Symbol$3 ? Symbol$3.toStringTag : undefined;
|
|
571
|
-
|
|
572
|
-
/**
|
|
573
|
-
* A specialized version of `baseGetTag` which ignores `Symbol.toStringTag` values.
|
|
574
|
-
*
|
|
575
|
-
* @private
|
|
576
|
-
* @param {*} value The value to query.
|
|
577
|
-
* @returns {string} Returns the raw `toStringTag`.
|
|
578
|
-
*/
|
|
579
|
-
function getRawTag$1(value) {
|
|
580
|
-
var isOwn = hasOwnProperty$4.call(value, symToStringTag$1),
|
|
581
|
-
tag = value[symToStringTag$1];
|
|
582
|
-
try {
|
|
583
|
-
value[symToStringTag$1] = undefined;
|
|
584
|
-
var unmasked = true;
|
|
585
|
-
} catch (e) {}
|
|
586
|
-
var result = nativeObjectToString$1.call(value);
|
|
587
|
-
if (unmasked) {
|
|
588
|
-
if (isOwn) {
|
|
589
|
-
value[symToStringTag$1] = tag;
|
|
590
|
-
} else {
|
|
591
|
-
delete value[symToStringTag$1];
|
|
592
|
-
}
|
|
593
|
-
}
|
|
594
|
-
return result;
|
|
595
|
-
}
|
|
596
|
-
var _getRawTag = getRawTag$1;
|
|
597
|
-
|
|
598
|
-
/** Used for built-in method references. */
|
|
599
|
-
|
|
600
|
-
var objectProto$4 = Object.prototype;
|
|
601
|
-
|
|
602
|
-
/**
|
|
603
|
-
* Used to resolve the
|
|
604
|
-
* [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
|
|
605
|
-
* of values.
|
|
606
|
-
*/
|
|
607
|
-
var nativeObjectToString = objectProto$4.toString;
|
|
608
|
-
|
|
609
|
-
/**
|
|
610
|
-
* Converts `value` to a string using `Object.prototype.toString`.
|
|
611
|
-
*
|
|
612
|
-
* @private
|
|
613
|
-
* @param {*} value The value to convert.
|
|
614
|
-
* @returns {string} Returns the converted string.
|
|
615
|
-
*/
|
|
616
|
-
function objectToString$1(value) {
|
|
617
|
-
return nativeObjectToString.call(value);
|
|
618
|
-
}
|
|
619
|
-
var _objectToString = objectToString$1;
|
|
620
|
-
var Symbol$2 = _Symbol,
|
|
621
|
-
getRawTag = _getRawTag,
|
|
622
|
-
objectToString = _objectToString;
|
|
623
|
-
|
|
624
|
-
/** `Object#toString` result references. */
|
|
625
|
-
var nullTag = '[object Null]',
|
|
626
|
-
undefinedTag = '[object Undefined]';
|
|
627
|
-
|
|
628
|
-
/** Built-in value references. */
|
|
629
|
-
var symToStringTag = Symbol$2 ? Symbol$2.toStringTag : undefined;
|
|
630
|
-
|
|
631
|
-
/**
|
|
632
|
-
* The base implementation of `getTag` without fallbacks for buggy environments.
|
|
633
|
-
*
|
|
634
|
-
* @private
|
|
635
|
-
* @param {*} value The value to query.
|
|
636
|
-
* @returns {string} Returns the `toStringTag`.
|
|
637
|
-
*/
|
|
638
|
-
function baseGetTag$3(value) {
|
|
639
|
-
if (value == null) {
|
|
640
|
-
return value === undefined ? undefinedTag : nullTag;
|
|
641
|
-
}
|
|
642
|
-
return symToStringTag && symToStringTag in Object(value) ? getRawTag(value) : objectToString(value);
|
|
643
|
-
}
|
|
644
|
-
var _baseGetTag = baseGetTag$3;
|
|
645
|
-
|
|
646
|
-
/**
|
|
647
|
-
* Checks if `value` is object-like. A value is object-like if it's not `null`
|
|
648
|
-
* and has a `typeof` result of "object".
|
|
649
|
-
*
|
|
650
|
-
* @static
|
|
651
|
-
* @memberOf _
|
|
652
|
-
* @since 4.0.0
|
|
653
|
-
* @category Lang
|
|
654
|
-
* @param {*} value The value to check.
|
|
655
|
-
* @returns {boolean} Returns `true` if `value` is object-like, else `false`.
|
|
656
|
-
* @example
|
|
657
|
-
*
|
|
658
|
-
* _.isObjectLike({});
|
|
659
|
-
* // => true
|
|
660
|
-
*
|
|
661
|
-
* _.isObjectLike([1, 2, 3]);
|
|
662
|
-
* // => true
|
|
663
|
-
*
|
|
664
|
-
* _.isObjectLike(_.noop);
|
|
665
|
-
* // => false
|
|
666
|
-
*
|
|
667
|
-
* _.isObjectLike(null);
|
|
668
|
-
* // => false
|
|
669
|
-
*/
|
|
670
|
-
|
|
671
|
-
function isObjectLike$2(value) {
|
|
672
|
-
return value != null && typeof value == 'object';
|
|
673
|
-
}
|
|
674
|
-
var isObjectLike_1 = isObjectLike$2;
|
|
675
|
-
var baseGetTag$2 = _baseGetTag,
|
|
676
|
-
isObjectLike$1 = isObjectLike_1;
|
|
677
|
-
|
|
678
|
-
/** `Object#toString` result references. */
|
|
679
|
-
var argsTag = '[object Arguments]';
|
|
680
|
-
|
|
681
|
-
/**
|
|
682
|
-
* The base implementation of `_.isArguments`.
|
|
683
|
-
*
|
|
684
|
-
* @private
|
|
685
|
-
* @param {*} value The value to check.
|
|
686
|
-
* @returns {boolean} Returns `true` if `value` is an `arguments` object,
|
|
687
|
-
*/
|
|
688
|
-
function baseIsArguments$1(value) {
|
|
689
|
-
return isObjectLike$1(value) && baseGetTag$2(value) == argsTag;
|
|
690
|
-
}
|
|
691
|
-
var _baseIsArguments = baseIsArguments$1;
|
|
692
|
-
var baseIsArguments = _baseIsArguments,
|
|
693
|
-
isObjectLike = isObjectLike_1;
|
|
694
|
-
|
|
695
|
-
/** Used for built-in method references. */
|
|
696
|
-
var objectProto$3 = Object.prototype;
|
|
697
|
-
|
|
698
|
-
/** Used to check objects for own properties. */
|
|
699
|
-
var hasOwnProperty$3 = objectProto$3.hasOwnProperty;
|
|
700
|
-
|
|
701
|
-
/** Built-in value references. */
|
|
702
|
-
var propertyIsEnumerable = objectProto$3.propertyIsEnumerable;
|
|
703
|
-
|
|
704
|
-
/**
|
|
705
|
-
* Checks if `value` is likely an `arguments` object.
|
|
706
|
-
*
|
|
707
|
-
* @static
|
|
708
|
-
* @memberOf _
|
|
709
|
-
* @since 0.1.0
|
|
710
|
-
* @category Lang
|
|
711
|
-
* @param {*} value The value to check.
|
|
712
|
-
* @returns {boolean} Returns `true` if `value` is an `arguments` object,
|
|
713
|
-
* else `false`.
|
|
714
|
-
* @example
|
|
715
|
-
*
|
|
716
|
-
* _.isArguments(function() { return arguments; }());
|
|
717
|
-
* // => true
|
|
718
|
-
*
|
|
719
|
-
* _.isArguments([1, 2, 3]);
|
|
720
|
-
* // => false
|
|
721
|
-
*/
|
|
722
|
-
var isArguments$1 = baseIsArguments(function () {
|
|
723
|
-
return arguments;
|
|
724
|
-
}()) ? baseIsArguments : function (value) {
|
|
725
|
-
return isObjectLike(value) && hasOwnProperty$3.call(value, 'callee') && !propertyIsEnumerable.call(value, 'callee');
|
|
726
|
-
};
|
|
727
|
-
var isArguments_1 = isArguments$1;
|
|
728
|
-
|
|
729
|
-
/**
|
|
730
|
-
* Checks if `value` is classified as an `Array` object.
|
|
731
|
-
*
|
|
732
|
-
* @static
|
|
733
|
-
* @memberOf _
|
|
734
|
-
* @since 0.1.0
|
|
735
|
-
* @category Lang
|
|
736
|
-
* @param {*} value The value to check.
|
|
737
|
-
* @returns {boolean} Returns `true` if `value` is an array, else `false`.
|
|
738
|
-
* @example
|
|
739
|
-
*
|
|
740
|
-
* _.isArray([1, 2, 3]);
|
|
741
|
-
* // => true
|
|
742
|
-
*
|
|
743
|
-
* _.isArray(document.body.children);
|
|
744
|
-
* // => false
|
|
745
|
-
*
|
|
746
|
-
* _.isArray('abc');
|
|
747
|
-
* // => false
|
|
748
|
-
*
|
|
749
|
-
* _.isArray(_.noop);
|
|
750
|
-
* // => false
|
|
751
|
-
*/
|
|
752
|
-
|
|
753
|
-
var isArray$1 = Array.isArray;
|
|
754
|
-
var isArray_1 = isArray$1;
|
|
755
|
-
var Symbol$1 = _Symbol,
|
|
756
|
-
isArguments = isArguments_1,
|
|
757
|
-
isArray = isArray_1;
|
|
758
|
-
|
|
759
|
-
/** Built-in value references. */
|
|
760
|
-
var spreadableSymbol = Symbol$1 ? Symbol$1.isConcatSpreadable : undefined;
|
|
761
|
-
|
|
762
|
-
/**
|
|
763
|
-
* Checks if `value` is a flattenable `arguments` object or array.
|
|
764
|
-
*
|
|
765
|
-
* @private
|
|
766
|
-
* @param {*} value The value to check.
|
|
767
|
-
* @returns {boolean} Returns `true` if `value` is flattenable, else `false`.
|
|
768
|
-
*/
|
|
769
|
-
function isFlattenable$1(value) {
|
|
770
|
-
return isArray(value) || isArguments(value) || !!(spreadableSymbol && value && value[spreadableSymbol]);
|
|
771
|
-
}
|
|
772
|
-
var _isFlattenable = isFlattenable$1;
|
|
773
|
-
var arrayPush = _arrayPush,
|
|
774
|
-
isFlattenable = _isFlattenable;
|
|
775
|
-
|
|
776
|
-
/**
|
|
777
|
-
* The base implementation of `_.flatten` with support for restricting flattening.
|
|
778
|
-
*
|
|
779
|
-
* @private
|
|
780
|
-
* @param {Array} array The array to flatten.
|
|
781
|
-
* @param {number} depth The maximum recursion depth.
|
|
782
|
-
* @param {boolean} [predicate=isFlattenable] The function invoked per iteration.
|
|
783
|
-
* @param {boolean} [isStrict] Restrict to values that pass `predicate` checks.
|
|
784
|
-
* @param {Array} [result=[]] The initial result value.
|
|
785
|
-
* @returns {Array} Returns the new flattened array.
|
|
786
|
-
*/
|
|
787
|
-
function baseFlatten$1(array, depth, predicate, isStrict, result) {
|
|
788
|
-
var index = -1,
|
|
789
|
-
length = array.length;
|
|
790
|
-
predicate || (predicate = isFlattenable);
|
|
791
|
-
result || (result = []);
|
|
792
|
-
while (++index < length) {
|
|
793
|
-
var value = array[index];
|
|
794
|
-
if (depth > 0 && predicate(value)) {
|
|
795
|
-
if (depth > 1) {
|
|
796
|
-
// Recursively flatten arrays (susceptible to call stack limits).
|
|
797
|
-
baseFlatten$1(value, depth - 1, predicate, isStrict, result);
|
|
798
|
-
} else {
|
|
799
|
-
arrayPush(result, value);
|
|
800
|
-
}
|
|
801
|
-
} else if (!isStrict) {
|
|
802
|
-
result[result.length] = value;
|
|
803
|
-
}
|
|
804
|
-
}
|
|
805
|
-
return result;
|
|
806
|
-
}
|
|
807
|
-
var _baseFlatten = baseFlatten$1;
|
|
808
|
-
var baseFlatten = _baseFlatten;
|
|
809
|
-
|
|
810
|
-
/**
|
|
811
|
-
* Flattens `array` a single level deep.
|
|
812
|
-
*
|
|
813
|
-
* @static
|
|
814
|
-
* @memberOf _
|
|
815
|
-
* @since 0.1.0
|
|
816
|
-
* @category Array
|
|
817
|
-
* @param {Array} array The array to flatten.
|
|
818
|
-
* @returns {Array} Returns the new flattened array.
|
|
819
|
-
* @example
|
|
820
|
-
*
|
|
821
|
-
* _.flatten([1, [2, [3, [4]], 5]]);
|
|
822
|
-
* // => [1, 2, [3, [4]], 5]
|
|
823
|
-
*/
|
|
824
|
-
function flatten(array) {
|
|
825
|
-
var length = array == null ? 0 : array.length;
|
|
826
|
-
return length ? baseFlatten(array, 1) : [];
|
|
827
|
-
}
|
|
828
|
-
var flatten_1 = flatten;
|
|
829
|
-
var flatten$1 = /*@__PURE__*/getDefaultExportFromCjs(flatten_1);
|
|
830
|
-
|
|
831
|
-
/**
|
|
832
|
-
* Creates an array with all falsey values removed. The values `false`, `null`,
|
|
833
|
-
* `0`, `""`, `undefined`, and `NaN` are falsey.
|
|
834
|
-
*
|
|
835
|
-
* @static
|
|
836
|
-
* @memberOf _
|
|
837
|
-
* @since 0.1.0
|
|
838
|
-
* @category Array
|
|
839
|
-
* @param {Array} array The array to compact.
|
|
840
|
-
* @returns {Array} Returns the new array of filtered values.
|
|
841
|
-
* @example
|
|
842
|
-
*
|
|
843
|
-
* _.compact([0, 1, false, 2, '', 3]);
|
|
844
|
-
* // => [1, 2, 3]
|
|
845
|
-
*/
|
|
846
|
-
|
|
847
|
-
function compact(array) {
|
|
848
|
-
var index = -1,
|
|
849
|
-
length = array == null ? 0 : array.length,
|
|
850
|
-
resIndex = 0,
|
|
851
|
-
result = [];
|
|
852
|
-
while (++index < length) {
|
|
853
|
-
var value = array[index];
|
|
854
|
-
if (value) {
|
|
855
|
-
result[resIndex++] = value;
|
|
856
|
-
}
|
|
857
|
-
}
|
|
858
|
-
return result;
|
|
859
|
-
}
|
|
860
|
-
var compact_1 = compact;
|
|
861
|
-
var compact$1 = /*@__PURE__*/getDefaultExportFromCjs(compact_1);
|
|
862
|
-
|
|
863
|
-
/**
|
|
864
|
-
* Removes all key-value entries from the list cache.
|
|
865
|
-
*
|
|
866
|
-
* @private
|
|
867
|
-
* @name clear
|
|
868
|
-
* @memberOf ListCache
|
|
869
|
-
*/
|
|
870
|
-
|
|
871
|
-
function listCacheClear$1() {
|
|
872
|
-
this.__data__ = [];
|
|
873
|
-
this.size = 0;
|
|
874
|
-
}
|
|
875
|
-
var _listCacheClear = listCacheClear$1;
|
|
876
|
-
|
|
877
|
-
/**
|
|
878
|
-
* Performs a
|
|
879
|
-
* [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
|
|
880
|
-
* comparison between two values to determine if they are equivalent.
|
|
881
|
-
*
|
|
882
|
-
* @static
|
|
883
|
-
* @memberOf _
|
|
884
|
-
* @since 4.0.0
|
|
885
|
-
* @category Lang
|
|
886
|
-
* @param {*} value The value to compare.
|
|
887
|
-
* @param {*} other The other value to compare.
|
|
888
|
-
* @returns {boolean} Returns `true` if the values are equivalent, else `false`.
|
|
889
|
-
* @example
|
|
890
|
-
*
|
|
891
|
-
* var object = { 'a': 1 };
|
|
892
|
-
* var other = { 'a': 1 };
|
|
893
|
-
*
|
|
894
|
-
* _.eq(object, object);
|
|
895
|
-
* // => true
|
|
896
|
-
*
|
|
897
|
-
* _.eq(object, other);
|
|
898
|
-
* // => false
|
|
899
|
-
*
|
|
900
|
-
* _.eq('a', 'a');
|
|
901
|
-
* // => true
|
|
902
|
-
*
|
|
903
|
-
* _.eq('a', Object('a'));
|
|
904
|
-
* // => false
|
|
905
|
-
*
|
|
906
|
-
* _.eq(NaN, NaN);
|
|
907
|
-
* // => true
|
|
908
|
-
*/
|
|
909
|
-
|
|
910
|
-
function eq$1(value, other) {
|
|
911
|
-
return value === other || value !== value && other !== other;
|
|
912
|
-
}
|
|
913
|
-
var eq_1 = eq$1;
|
|
914
|
-
var eq = eq_1;
|
|
915
|
-
|
|
916
|
-
/**
|
|
917
|
-
* Gets the index at which the `key` is found in `array` of key-value pairs.
|
|
918
|
-
*
|
|
919
|
-
* @private
|
|
920
|
-
* @param {Array} array The array to inspect.
|
|
921
|
-
* @param {*} key The key to search for.
|
|
922
|
-
* @returns {number} Returns the index of the matched value, else `-1`.
|
|
923
|
-
*/
|
|
924
|
-
function assocIndexOf$4(array, key) {
|
|
925
|
-
var length = array.length;
|
|
926
|
-
while (length--) {
|
|
927
|
-
if (eq(array[length][0], key)) {
|
|
928
|
-
return length;
|
|
929
|
-
}
|
|
930
|
-
}
|
|
931
|
-
return -1;
|
|
932
|
-
}
|
|
933
|
-
var _assocIndexOf = assocIndexOf$4;
|
|
934
|
-
var assocIndexOf$3 = _assocIndexOf;
|
|
935
|
-
|
|
936
|
-
/** Used for built-in method references. */
|
|
937
|
-
var arrayProto = Array.prototype;
|
|
938
|
-
|
|
939
|
-
/** Built-in value references. */
|
|
940
|
-
var splice = arrayProto.splice;
|
|
941
|
-
|
|
942
|
-
/**
|
|
943
|
-
* Removes `key` and its value from the list cache.
|
|
944
|
-
*
|
|
945
|
-
* @private
|
|
946
|
-
* @name delete
|
|
947
|
-
* @memberOf ListCache
|
|
948
|
-
* @param {string} key The key of the value to remove.
|
|
949
|
-
* @returns {boolean} Returns `true` if the entry was removed, else `false`.
|
|
950
|
-
*/
|
|
951
|
-
function listCacheDelete$1(key) {
|
|
952
|
-
var data = this.__data__,
|
|
953
|
-
index = assocIndexOf$3(data, key);
|
|
954
|
-
if (index < 0) {
|
|
955
|
-
return false;
|
|
956
|
-
}
|
|
957
|
-
var lastIndex = data.length - 1;
|
|
958
|
-
if (index == lastIndex) {
|
|
959
|
-
data.pop();
|
|
960
|
-
} else {
|
|
961
|
-
splice.call(data, index, 1);
|
|
962
|
-
}
|
|
963
|
-
--this.size;
|
|
964
|
-
return true;
|
|
965
|
-
}
|
|
966
|
-
var _listCacheDelete = listCacheDelete$1;
|
|
967
|
-
var assocIndexOf$2 = _assocIndexOf;
|
|
968
|
-
|
|
969
|
-
/**
|
|
970
|
-
* Gets the list cache value for `key`.
|
|
971
|
-
*
|
|
972
|
-
* @private
|
|
973
|
-
* @name get
|
|
974
|
-
* @memberOf ListCache
|
|
975
|
-
* @param {string} key The key of the value to get.
|
|
976
|
-
* @returns {*} Returns the entry value.
|
|
977
|
-
*/
|
|
978
|
-
function listCacheGet$1(key) {
|
|
979
|
-
var data = this.__data__,
|
|
980
|
-
index = assocIndexOf$2(data, key);
|
|
981
|
-
return index < 0 ? undefined : data[index][1];
|
|
982
|
-
}
|
|
983
|
-
var _listCacheGet = listCacheGet$1;
|
|
984
|
-
var assocIndexOf$1 = _assocIndexOf;
|
|
985
|
-
|
|
986
|
-
/**
|
|
987
|
-
* Checks if a list cache value for `key` exists.
|
|
988
|
-
*
|
|
989
|
-
* @private
|
|
990
|
-
* @name has
|
|
991
|
-
* @memberOf ListCache
|
|
992
|
-
* @param {string} key The key of the entry to check.
|
|
993
|
-
* @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
|
|
994
|
-
*/
|
|
995
|
-
function listCacheHas$1(key) {
|
|
996
|
-
return assocIndexOf$1(this.__data__, key) > -1;
|
|
997
|
-
}
|
|
998
|
-
var _listCacheHas = listCacheHas$1;
|
|
999
|
-
var assocIndexOf = _assocIndexOf;
|
|
1000
|
-
|
|
1001
|
-
/**
|
|
1002
|
-
* Sets the list cache `key` to `value`.
|
|
1003
|
-
*
|
|
1004
|
-
* @private
|
|
1005
|
-
* @name set
|
|
1006
|
-
* @memberOf ListCache
|
|
1007
|
-
* @param {string} key The key of the value to set.
|
|
1008
|
-
* @param {*} value The value to set.
|
|
1009
|
-
* @returns {Object} Returns the list cache instance.
|
|
1010
|
-
*/
|
|
1011
|
-
function listCacheSet$1(key, value) {
|
|
1012
|
-
var data = this.__data__,
|
|
1013
|
-
index = assocIndexOf(data, key);
|
|
1014
|
-
if (index < 0) {
|
|
1015
|
-
++this.size;
|
|
1016
|
-
data.push([key, value]);
|
|
1017
|
-
} else {
|
|
1018
|
-
data[index][1] = value;
|
|
1019
|
-
}
|
|
1020
|
-
return this;
|
|
1021
|
-
}
|
|
1022
|
-
var _listCacheSet = listCacheSet$1;
|
|
1023
|
-
var listCacheClear = _listCacheClear,
|
|
1024
|
-
listCacheDelete = _listCacheDelete,
|
|
1025
|
-
listCacheGet = _listCacheGet,
|
|
1026
|
-
listCacheHas = _listCacheHas,
|
|
1027
|
-
listCacheSet = _listCacheSet;
|
|
1028
|
-
|
|
1029
|
-
/**
|
|
1030
|
-
* Creates an list cache object.
|
|
1031
|
-
*
|
|
1032
|
-
* @private
|
|
1033
|
-
* @constructor
|
|
1034
|
-
* @param {Array} [entries] The key-value pairs to cache.
|
|
1035
|
-
*/
|
|
1036
|
-
function ListCache$4(entries) {
|
|
1037
|
-
var index = -1,
|
|
1038
|
-
length = entries == null ? 0 : entries.length;
|
|
1039
|
-
this.clear();
|
|
1040
|
-
while (++index < length) {
|
|
1041
|
-
var entry = entries[index];
|
|
1042
|
-
this.set(entry[0], entry[1]);
|
|
1043
|
-
}
|
|
1044
|
-
}
|
|
1045
|
-
|
|
1046
|
-
// Add methods to `ListCache`.
|
|
1047
|
-
ListCache$4.prototype.clear = listCacheClear;
|
|
1048
|
-
ListCache$4.prototype['delete'] = listCacheDelete;
|
|
1049
|
-
ListCache$4.prototype.get = listCacheGet;
|
|
1050
|
-
ListCache$4.prototype.has = listCacheHas;
|
|
1051
|
-
ListCache$4.prototype.set = listCacheSet;
|
|
1052
|
-
var _ListCache = ListCache$4;
|
|
1053
|
-
var ListCache$3 = _ListCache;
|
|
1054
|
-
|
|
1055
|
-
/**
|
|
1056
|
-
* Removes all key-value entries from the stack.
|
|
1057
|
-
*
|
|
1058
|
-
* @private
|
|
1059
|
-
* @name clear
|
|
1060
|
-
* @memberOf Stack
|
|
1061
|
-
*/
|
|
1062
|
-
function stackClear$1() {
|
|
1063
|
-
this.__data__ = new ListCache$3();
|
|
1064
|
-
this.size = 0;
|
|
1065
|
-
}
|
|
1066
|
-
var _stackClear = stackClear$1;
|
|
1067
|
-
|
|
1068
|
-
/**
|
|
1069
|
-
* Removes `key` and its value from the stack.
|
|
1070
|
-
*
|
|
1071
|
-
* @private
|
|
1072
|
-
* @name delete
|
|
1073
|
-
* @memberOf Stack
|
|
1074
|
-
* @param {string} key The key of the value to remove.
|
|
1075
|
-
* @returns {boolean} Returns `true` if the entry was removed, else `false`.
|
|
1076
|
-
*/
|
|
1077
|
-
|
|
1078
|
-
function stackDelete$1(key) {
|
|
1079
|
-
var data = this.__data__,
|
|
1080
|
-
result = data['delete'](key);
|
|
1081
|
-
this.size = data.size;
|
|
1082
|
-
return result;
|
|
1083
|
-
}
|
|
1084
|
-
var _stackDelete = stackDelete$1;
|
|
1085
|
-
|
|
1086
|
-
/**
|
|
1087
|
-
* Gets the stack value for `key`.
|
|
1088
|
-
*
|
|
1089
|
-
* @private
|
|
1090
|
-
* @name get
|
|
1091
|
-
* @memberOf Stack
|
|
1092
|
-
* @param {string} key The key of the value to get.
|
|
1093
|
-
* @returns {*} Returns the entry value.
|
|
1094
|
-
*/
|
|
1095
|
-
|
|
1096
|
-
function stackGet$1(key) {
|
|
1097
|
-
return this.__data__.get(key);
|
|
1098
|
-
}
|
|
1099
|
-
var _stackGet = stackGet$1;
|
|
1100
|
-
|
|
1101
|
-
/**
|
|
1102
|
-
* Checks if a stack value for `key` exists.
|
|
1103
|
-
*
|
|
1104
|
-
* @private
|
|
1105
|
-
* @name has
|
|
1106
|
-
* @memberOf Stack
|
|
1107
|
-
* @param {string} key The key of the entry to check.
|
|
1108
|
-
* @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
|
|
1109
|
-
*/
|
|
1110
|
-
|
|
1111
|
-
function stackHas$1(key) {
|
|
1112
|
-
return this.__data__.has(key);
|
|
1113
|
-
}
|
|
1114
|
-
var _stackHas = stackHas$1;
|
|
1115
|
-
|
|
1116
|
-
/**
|
|
1117
|
-
* Checks if `value` is the
|
|
1118
|
-
* [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types)
|
|
1119
|
-
* of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)
|
|
1120
|
-
*
|
|
1121
|
-
* @static
|
|
1122
|
-
* @memberOf _
|
|
1123
|
-
* @since 0.1.0
|
|
1124
|
-
* @category Lang
|
|
1125
|
-
* @param {*} value The value to check.
|
|
1126
|
-
* @returns {boolean} Returns `true` if `value` is an object, else `false`.
|
|
1127
|
-
* @example
|
|
1128
|
-
*
|
|
1129
|
-
* _.isObject({});
|
|
1130
|
-
* // => true
|
|
1131
|
-
*
|
|
1132
|
-
* _.isObject([1, 2, 3]);
|
|
1133
|
-
* // => true
|
|
1134
|
-
*
|
|
1135
|
-
* _.isObject(_.noop);
|
|
1136
|
-
* // => true
|
|
1137
|
-
*
|
|
1138
|
-
* _.isObject(null);
|
|
1139
|
-
* // => false
|
|
1140
|
-
*/
|
|
1141
|
-
|
|
1142
|
-
function isObject$2(value) {
|
|
1143
|
-
var type = typeof value;
|
|
1144
|
-
return value != null && (type == 'object' || type == 'function');
|
|
1145
|
-
}
|
|
1146
|
-
var isObject_1 = isObject$2;
|
|
1147
|
-
var baseGetTag$1 = _baseGetTag,
|
|
1148
|
-
isObject$1 = isObject_1;
|
|
1149
|
-
|
|
1150
|
-
/** `Object#toString` result references. */
|
|
1151
|
-
var asyncTag = '[object AsyncFunction]',
|
|
1152
|
-
funcTag = '[object Function]',
|
|
1153
|
-
genTag = '[object GeneratorFunction]',
|
|
1154
|
-
proxyTag = '[object Proxy]';
|
|
1155
|
-
|
|
1156
|
-
/**
|
|
1157
|
-
* Checks if `value` is classified as a `Function` object.
|
|
1158
|
-
*
|
|
1159
|
-
* @static
|
|
1160
|
-
* @memberOf _
|
|
1161
|
-
* @since 0.1.0
|
|
1162
|
-
* @category Lang
|
|
1163
|
-
* @param {*} value The value to check.
|
|
1164
|
-
* @returns {boolean} Returns `true` if `value` is a function, else `false`.
|
|
1165
|
-
* @example
|
|
1166
|
-
*
|
|
1167
|
-
* _.isFunction(_);
|
|
1168
|
-
* // => true
|
|
1169
|
-
*
|
|
1170
|
-
* _.isFunction(/abc/);
|
|
1171
|
-
* // => false
|
|
1172
|
-
*/
|
|
1173
|
-
function isFunction$1(value) {
|
|
1174
|
-
if (!isObject$1(value)) {
|
|
1175
|
-
return false;
|
|
1176
|
-
}
|
|
1177
|
-
// The use of `Object#toString` avoids issues with the `typeof` operator
|
|
1178
|
-
// in Safari 9 which returns 'object' for typed arrays and other constructors.
|
|
1179
|
-
var tag = baseGetTag$1(value);
|
|
1180
|
-
return tag == funcTag || tag == genTag || tag == asyncTag || tag == proxyTag;
|
|
1181
|
-
}
|
|
1182
|
-
var isFunction_1 = isFunction$1;
|
|
1183
|
-
var root$5 = _root;
|
|
1184
|
-
|
|
1185
|
-
/** Used to detect overreaching core-js shims. */
|
|
1186
|
-
var coreJsData$1 = root$5['__core-js_shared__'];
|
|
1187
|
-
var _coreJsData = coreJsData$1;
|
|
1188
|
-
var coreJsData = _coreJsData;
|
|
1189
|
-
|
|
1190
|
-
/** Used to detect methods masquerading as native. */
|
|
1191
|
-
var maskSrcKey = function () {
|
|
1192
|
-
var uid = /[^.]+$/.exec(coreJsData && coreJsData.keys && coreJsData.keys.IE_PROTO || '');
|
|
1193
|
-
return uid ? 'Symbol(src)_1.' + uid : '';
|
|
1194
|
-
}();
|
|
1195
|
-
|
|
1196
|
-
/**
|
|
1197
|
-
* Checks if `func` has its source masked.
|
|
1198
|
-
*
|
|
1199
|
-
* @private
|
|
1200
|
-
* @param {Function} func The function to check.
|
|
1201
|
-
* @returns {boolean} Returns `true` if `func` is masked, else `false`.
|
|
1202
|
-
*/
|
|
1203
|
-
function isMasked$1(func) {
|
|
1204
|
-
return !!maskSrcKey && maskSrcKey in func;
|
|
1205
|
-
}
|
|
1206
|
-
var _isMasked = isMasked$1;
|
|
1207
|
-
|
|
1208
|
-
/** Used for built-in method references. */
|
|
1209
|
-
|
|
1210
|
-
var funcProto$1 = Function.prototype;
|
|
1211
|
-
|
|
1212
|
-
/** Used to resolve the decompiled source of functions. */
|
|
1213
|
-
var funcToString$1 = funcProto$1.toString;
|
|
1214
|
-
|
|
1215
|
-
/**
|
|
1216
|
-
* Converts `func` to its source code.
|
|
1217
|
-
*
|
|
1218
|
-
* @private
|
|
1219
|
-
* @param {Function} func The function to convert.
|
|
1220
|
-
* @returns {string} Returns the source code.
|
|
1221
|
-
*/
|
|
1222
|
-
function toSource$2(func) {
|
|
1223
|
-
if (func != null) {
|
|
1224
|
-
try {
|
|
1225
|
-
return funcToString$1.call(func);
|
|
1226
|
-
} catch (e) {}
|
|
1227
|
-
try {
|
|
1228
|
-
return func + '';
|
|
1229
|
-
} catch (e) {}
|
|
1230
|
-
}
|
|
1231
|
-
return '';
|
|
1232
|
-
}
|
|
1233
|
-
var _toSource = toSource$2;
|
|
1234
|
-
var isFunction = isFunction_1,
|
|
1235
|
-
isMasked = _isMasked,
|
|
1236
|
-
isObject = isObject_1,
|
|
1237
|
-
toSource$1 = _toSource;
|
|
1238
|
-
|
|
1239
|
-
/**
|
|
1240
|
-
* Used to match `RegExp`
|
|
1241
|
-
* [syntax characters](http://ecma-international.org/ecma-262/7.0/#sec-patterns).
|
|
1242
|
-
*/
|
|
1243
|
-
var reRegExpChar = /[\\^$.*+?()[\]{}|]/g;
|
|
1244
|
-
|
|
1245
|
-
/** Used to detect host constructors (Safari). */
|
|
1246
|
-
var reIsHostCtor = /^\[object .+?Constructor\]$/;
|
|
1247
|
-
|
|
1248
|
-
/** Used for built-in method references. */
|
|
1249
|
-
var funcProto = Function.prototype,
|
|
1250
|
-
objectProto$2 = Object.prototype;
|
|
1251
|
-
|
|
1252
|
-
/** Used to resolve the decompiled source of functions. */
|
|
1253
|
-
var funcToString = funcProto.toString;
|
|
1254
|
-
|
|
1255
|
-
/** Used to check objects for own properties. */
|
|
1256
|
-
var hasOwnProperty$2 = objectProto$2.hasOwnProperty;
|
|
1257
|
-
|
|
1258
|
-
/** Used to detect if a method is native. */
|
|
1259
|
-
var reIsNative = RegExp('^' + funcToString.call(hasOwnProperty$2).replace(reRegExpChar, '\\$&').replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, '$1.*?') + '$');
|
|
1260
|
-
|
|
1261
|
-
/**
|
|
1262
|
-
* The base implementation of `_.isNative` without bad shim checks.
|
|
1263
|
-
*
|
|
1264
|
-
* @private
|
|
1265
|
-
* @param {*} value The value to check.
|
|
1266
|
-
* @returns {boolean} Returns `true` if `value` is a native function,
|
|
1267
|
-
* else `false`.
|
|
1268
|
-
*/
|
|
1269
|
-
function baseIsNative$1(value) {
|
|
1270
|
-
if (!isObject(value) || isMasked(value)) {
|
|
1271
|
-
return false;
|
|
1272
|
-
}
|
|
1273
|
-
var pattern = isFunction(value) ? reIsNative : reIsHostCtor;
|
|
1274
|
-
return pattern.test(toSource$1(value));
|
|
1275
|
-
}
|
|
1276
|
-
var _baseIsNative = baseIsNative$1;
|
|
1277
|
-
|
|
1278
|
-
/**
|
|
1279
|
-
* Gets the value at `key` of `object`.
|
|
1280
|
-
*
|
|
1281
|
-
* @private
|
|
1282
|
-
* @param {Object} [object] The object to query.
|
|
1283
|
-
* @param {string} key The key of the property to get.
|
|
1284
|
-
* @returns {*} Returns the property value.
|
|
1285
|
-
*/
|
|
1286
|
-
|
|
1287
|
-
function getValue$1(object, key) {
|
|
1288
|
-
return object == null ? undefined : object[key];
|
|
1289
|
-
}
|
|
1290
|
-
var _getValue = getValue$1;
|
|
1291
|
-
var baseIsNative = _baseIsNative,
|
|
1292
|
-
getValue = _getValue;
|
|
1293
|
-
|
|
1294
|
-
/**
|
|
1295
|
-
* Gets the native function at `key` of `object`.
|
|
1296
|
-
*
|
|
1297
|
-
* @private
|
|
1298
|
-
* @param {Object} object The object to query.
|
|
1299
|
-
* @param {string} key The key of the method to get.
|
|
1300
|
-
* @returns {*} Returns the function if it's native, else `undefined`.
|
|
1301
|
-
*/
|
|
1302
|
-
function getNative$6(object, key) {
|
|
1303
|
-
var value = getValue(object, key);
|
|
1304
|
-
return baseIsNative(value) ? value : undefined;
|
|
1305
|
-
}
|
|
1306
|
-
var _getNative = getNative$6;
|
|
1307
|
-
var getNative$5 = _getNative,
|
|
1308
|
-
root$4 = _root;
|
|
1309
|
-
|
|
1310
|
-
/* Built-in method references that are verified to be native. */
|
|
1311
|
-
var Map$4 = getNative$5(root$4, 'Map');
|
|
1312
|
-
var _Map = Map$4;
|
|
1313
|
-
var getNative$4 = _getNative;
|
|
1314
|
-
|
|
1315
|
-
/* Built-in method references that are verified to be native. */
|
|
1316
|
-
var nativeCreate$4 = getNative$4(Object, 'create');
|
|
1317
|
-
var _nativeCreate = nativeCreate$4;
|
|
1318
|
-
var nativeCreate$3 = _nativeCreate;
|
|
1319
|
-
|
|
1320
|
-
/**
|
|
1321
|
-
* Removes all key-value entries from the hash.
|
|
1322
|
-
*
|
|
1323
|
-
* @private
|
|
1324
|
-
* @name clear
|
|
1325
|
-
* @memberOf Hash
|
|
1326
|
-
*/
|
|
1327
|
-
function hashClear$1() {
|
|
1328
|
-
this.__data__ = nativeCreate$3 ? nativeCreate$3(null) : {};
|
|
1329
|
-
this.size = 0;
|
|
1330
|
-
}
|
|
1331
|
-
var _hashClear = hashClear$1;
|
|
1332
|
-
|
|
1333
|
-
/**
|
|
1334
|
-
* Removes `key` and its value from the hash.
|
|
1335
|
-
*
|
|
1336
|
-
* @private
|
|
1337
|
-
* @name delete
|
|
1338
|
-
* @memberOf Hash
|
|
1339
|
-
* @param {Object} hash The hash to modify.
|
|
1340
|
-
* @param {string} key The key of the value to remove.
|
|
1341
|
-
* @returns {boolean} Returns `true` if the entry was removed, else `false`.
|
|
1342
|
-
*/
|
|
1343
|
-
|
|
1344
|
-
function hashDelete$1(key) {
|
|
1345
|
-
var result = this.has(key) && delete this.__data__[key];
|
|
1346
|
-
this.size -= result ? 1 : 0;
|
|
1347
|
-
return result;
|
|
1348
|
-
}
|
|
1349
|
-
var _hashDelete = hashDelete$1;
|
|
1350
|
-
var nativeCreate$2 = _nativeCreate;
|
|
1351
|
-
|
|
1352
|
-
/** Used to stand-in for `undefined` hash values. */
|
|
1353
|
-
var HASH_UNDEFINED$2 = '__lodash_hash_undefined__';
|
|
1354
|
-
|
|
1355
|
-
/** Used for built-in method references. */
|
|
1356
|
-
var objectProto$1 = Object.prototype;
|
|
1357
|
-
|
|
1358
|
-
/** Used to check objects for own properties. */
|
|
1359
|
-
var hasOwnProperty$1 = objectProto$1.hasOwnProperty;
|
|
1360
|
-
|
|
1361
|
-
/**
|
|
1362
|
-
* Gets the hash value for `key`.
|
|
1363
|
-
*
|
|
1364
|
-
* @private
|
|
1365
|
-
* @name get
|
|
1366
|
-
* @memberOf Hash
|
|
1367
|
-
* @param {string} key The key of the value to get.
|
|
1368
|
-
* @returns {*} Returns the entry value.
|
|
1369
|
-
*/
|
|
1370
|
-
function hashGet$1(key) {
|
|
1371
|
-
var data = this.__data__;
|
|
1372
|
-
if (nativeCreate$2) {
|
|
1373
|
-
var result = data[key];
|
|
1374
|
-
return result === HASH_UNDEFINED$2 ? undefined : result;
|
|
1375
|
-
}
|
|
1376
|
-
return hasOwnProperty$1.call(data, key) ? data[key] : undefined;
|
|
1377
|
-
}
|
|
1378
|
-
var _hashGet = hashGet$1;
|
|
1379
|
-
var nativeCreate$1 = _nativeCreate;
|
|
1380
|
-
|
|
1381
|
-
/** Used for built-in method references. */
|
|
1382
|
-
var objectProto = Object.prototype;
|
|
1383
|
-
|
|
1384
|
-
/** Used to check objects for own properties. */
|
|
1385
|
-
var hasOwnProperty = objectProto.hasOwnProperty;
|
|
1386
|
-
|
|
1387
|
-
/**
|
|
1388
|
-
* Checks if a hash value for `key` exists.
|
|
1389
|
-
*
|
|
1390
|
-
* @private
|
|
1391
|
-
* @name has
|
|
1392
|
-
* @memberOf Hash
|
|
1393
|
-
* @param {string} key The key of the entry to check.
|
|
1394
|
-
* @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
|
|
1395
|
-
*/
|
|
1396
|
-
function hashHas$1(key) {
|
|
1397
|
-
var data = this.__data__;
|
|
1398
|
-
return nativeCreate$1 ? data[key] !== undefined : hasOwnProperty.call(data, key);
|
|
1399
|
-
}
|
|
1400
|
-
var _hashHas = hashHas$1;
|
|
1401
|
-
var nativeCreate = _nativeCreate;
|
|
1402
|
-
|
|
1403
|
-
/** Used to stand-in for `undefined` hash values. */
|
|
1404
|
-
var HASH_UNDEFINED$1 = '__lodash_hash_undefined__';
|
|
1405
|
-
|
|
1406
|
-
/**
|
|
1407
|
-
* Sets the hash `key` to `value`.
|
|
1408
|
-
*
|
|
1409
|
-
* @private
|
|
1410
|
-
* @name set
|
|
1411
|
-
* @memberOf Hash
|
|
1412
|
-
* @param {string} key The key of the value to set.
|
|
1413
|
-
* @param {*} value The value to set.
|
|
1414
|
-
* @returns {Object} Returns the hash instance.
|
|
1415
|
-
*/
|
|
1416
|
-
function hashSet$1(key, value) {
|
|
1417
|
-
var data = this.__data__;
|
|
1418
|
-
this.size += this.has(key) ? 0 : 1;
|
|
1419
|
-
data[key] = nativeCreate && value === undefined ? HASH_UNDEFINED$1 : value;
|
|
1420
|
-
return this;
|
|
1421
|
-
}
|
|
1422
|
-
var _hashSet = hashSet$1;
|
|
1423
|
-
var hashClear = _hashClear,
|
|
1424
|
-
hashDelete = _hashDelete,
|
|
1425
|
-
hashGet = _hashGet,
|
|
1426
|
-
hashHas = _hashHas,
|
|
1427
|
-
hashSet = _hashSet;
|
|
1428
|
-
|
|
1429
|
-
/**
|
|
1430
|
-
* Creates a hash object.
|
|
1431
|
-
*
|
|
1432
|
-
* @private
|
|
1433
|
-
* @constructor
|
|
1434
|
-
* @param {Array} [entries] The key-value pairs to cache.
|
|
1435
|
-
*/
|
|
1436
|
-
function Hash$1(entries) {
|
|
1437
|
-
var index = -1,
|
|
1438
|
-
length = entries == null ? 0 : entries.length;
|
|
1439
|
-
this.clear();
|
|
1440
|
-
while (++index < length) {
|
|
1441
|
-
var entry = entries[index];
|
|
1442
|
-
this.set(entry[0], entry[1]);
|
|
1443
|
-
}
|
|
1444
|
-
}
|
|
1445
|
-
|
|
1446
|
-
// Add methods to `Hash`.
|
|
1447
|
-
Hash$1.prototype.clear = hashClear;
|
|
1448
|
-
Hash$1.prototype['delete'] = hashDelete;
|
|
1449
|
-
Hash$1.prototype.get = hashGet;
|
|
1450
|
-
Hash$1.prototype.has = hashHas;
|
|
1451
|
-
Hash$1.prototype.set = hashSet;
|
|
1452
|
-
var _Hash = Hash$1;
|
|
1453
|
-
var Hash = _Hash,
|
|
1454
|
-
ListCache$2 = _ListCache,
|
|
1455
|
-
Map$3 = _Map;
|
|
1456
|
-
|
|
1457
|
-
/**
|
|
1458
|
-
* Removes all key-value entries from the map.
|
|
1459
|
-
*
|
|
1460
|
-
* @private
|
|
1461
|
-
* @name clear
|
|
1462
|
-
* @memberOf MapCache
|
|
1463
|
-
*/
|
|
1464
|
-
function mapCacheClear$1() {
|
|
1465
|
-
this.size = 0;
|
|
1466
|
-
this.__data__ = {
|
|
1467
|
-
'hash': new Hash(),
|
|
1468
|
-
'map': new (Map$3 || ListCache$2)(),
|
|
1469
|
-
'string': new Hash()
|
|
1470
|
-
};
|
|
1471
|
-
}
|
|
1472
|
-
var _mapCacheClear = mapCacheClear$1;
|
|
1473
|
-
|
|
1474
|
-
/**
|
|
1475
|
-
* Checks if `value` is suitable for use as unique object key.
|
|
1476
|
-
*
|
|
1477
|
-
* @private
|
|
1478
|
-
* @param {*} value The value to check.
|
|
1479
|
-
* @returns {boolean} Returns `true` if `value` is suitable, else `false`.
|
|
1480
|
-
*/
|
|
1481
|
-
|
|
1482
|
-
function isKeyable$1(value) {
|
|
1483
|
-
var type = typeof value;
|
|
1484
|
-
return type == 'string' || type == 'number' || type == 'symbol' || type == 'boolean' ? value !== '__proto__' : value === null;
|
|
1485
|
-
}
|
|
1486
|
-
var _isKeyable = isKeyable$1;
|
|
1487
|
-
var isKeyable = _isKeyable;
|
|
1488
|
-
|
|
1489
|
-
/**
|
|
1490
|
-
* Gets the data for `map`.
|
|
1491
|
-
*
|
|
1492
|
-
* @private
|
|
1493
|
-
* @param {Object} map The map to query.
|
|
1494
|
-
* @param {string} key The reference key.
|
|
1495
|
-
* @returns {*} Returns the map data.
|
|
1496
|
-
*/
|
|
1497
|
-
function getMapData$4(map, key) {
|
|
1498
|
-
var data = map.__data__;
|
|
1499
|
-
return isKeyable(key) ? data[typeof key == 'string' ? 'string' : 'hash'] : data.map;
|
|
1500
|
-
}
|
|
1501
|
-
var _getMapData = getMapData$4;
|
|
1502
|
-
var getMapData$3 = _getMapData;
|
|
1503
|
-
|
|
1504
|
-
/**
|
|
1505
|
-
* Removes `key` and its value from the map.
|
|
1506
|
-
*
|
|
1507
|
-
* @private
|
|
1508
|
-
* @name delete
|
|
1509
|
-
* @memberOf MapCache
|
|
1510
|
-
* @param {string} key The key of the value to remove.
|
|
1511
|
-
* @returns {boolean} Returns `true` if the entry was removed, else `false`.
|
|
1512
|
-
*/
|
|
1513
|
-
function mapCacheDelete$1(key) {
|
|
1514
|
-
var result = getMapData$3(this, key)['delete'](key);
|
|
1515
|
-
this.size -= result ? 1 : 0;
|
|
1516
|
-
return result;
|
|
1517
|
-
}
|
|
1518
|
-
var _mapCacheDelete = mapCacheDelete$1;
|
|
1519
|
-
var getMapData$2 = _getMapData;
|
|
1520
|
-
|
|
1521
|
-
/**
|
|
1522
|
-
* Gets the map value for `key`.
|
|
1523
|
-
*
|
|
1524
|
-
* @private
|
|
1525
|
-
* @name get
|
|
1526
|
-
* @memberOf MapCache
|
|
1527
|
-
* @param {string} key The key of the value to get.
|
|
1528
|
-
* @returns {*} Returns the entry value.
|
|
1529
|
-
*/
|
|
1530
|
-
function mapCacheGet$1(key) {
|
|
1531
|
-
return getMapData$2(this, key).get(key);
|
|
1532
|
-
}
|
|
1533
|
-
var _mapCacheGet = mapCacheGet$1;
|
|
1534
|
-
var getMapData$1 = _getMapData;
|
|
1535
|
-
|
|
1536
|
-
/**
|
|
1537
|
-
* Checks if a map value for `key` exists.
|
|
1538
|
-
*
|
|
1539
|
-
* @private
|
|
1540
|
-
* @name has
|
|
1541
|
-
* @memberOf MapCache
|
|
1542
|
-
* @param {string} key The key of the entry to check.
|
|
1543
|
-
* @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
|
|
1544
|
-
*/
|
|
1545
|
-
function mapCacheHas$1(key) {
|
|
1546
|
-
return getMapData$1(this, key).has(key);
|
|
1547
|
-
}
|
|
1548
|
-
var _mapCacheHas = mapCacheHas$1;
|
|
1549
|
-
var getMapData = _getMapData;
|
|
1550
|
-
|
|
1551
|
-
/**
|
|
1552
|
-
* Sets the map `key` to `value`.
|
|
1553
|
-
*
|
|
1554
|
-
* @private
|
|
1555
|
-
* @name set
|
|
1556
|
-
* @memberOf MapCache
|
|
1557
|
-
* @param {string} key The key of the value to set.
|
|
1558
|
-
* @param {*} value The value to set.
|
|
1559
|
-
* @returns {Object} Returns the map cache instance.
|
|
1560
|
-
*/
|
|
1561
|
-
function mapCacheSet$1(key, value) {
|
|
1562
|
-
var data = getMapData(this, key),
|
|
1563
|
-
size = data.size;
|
|
1564
|
-
data.set(key, value);
|
|
1565
|
-
this.size += data.size == size ? 0 : 1;
|
|
1566
|
-
return this;
|
|
1567
|
-
}
|
|
1568
|
-
var _mapCacheSet = mapCacheSet$1;
|
|
1569
|
-
var mapCacheClear = _mapCacheClear,
|
|
1570
|
-
mapCacheDelete = _mapCacheDelete,
|
|
1571
|
-
mapCacheGet = _mapCacheGet,
|
|
1572
|
-
mapCacheHas = _mapCacheHas,
|
|
1573
|
-
mapCacheSet = _mapCacheSet;
|
|
1574
|
-
|
|
1575
|
-
/**
|
|
1576
|
-
* Creates a map cache object to store key-value pairs.
|
|
1577
|
-
*
|
|
1578
|
-
* @private
|
|
1579
|
-
* @constructor
|
|
1580
|
-
* @param {Array} [entries] The key-value pairs to cache.
|
|
1581
|
-
*/
|
|
1582
|
-
function MapCache$2(entries) {
|
|
1583
|
-
var index = -1,
|
|
1584
|
-
length = entries == null ? 0 : entries.length;
|
|
1585
|
-
this.clear();
|
|
1586
|
-
while (++index < length) {
|
|
1587
|
-
var entry = entries[index];
|
|
1588
|
-
this.set(entry[0], entry[1]);
|
|
1589
|
-
}
|
|
1590
|
-
}
|
|
1591
|
-
|
|
1592
|
-
// Add methods to `MapCache`.
|
|
1593
|
-
MapCache$2.prototype.clear = mapCacheClear;
|
|
1594
|
-
MapCache$2.prototype['delete'] = mapCacheDelete;
|
|
1595
|
-
MapCache$2.prototype.get = mapCacheGet;
|
|
1596
|
-
MapCache$2.prototype.has = mapCacheHas;
|
|
1597
|
-
MapCache$2.prototype.set = mapCacheSet;
|
|
1598
|
-
var _MapCache = MapCache$2;
|
|
1599
|
-
var ListCache$1 = _ListCache,
|
|
1600
|
-
Map$2 = _Map,
|
|
1601
|
-
MapCache$1 = _MapCache;
|
|
1602
|
-
|
|
1603
|
-
/** Used as the size to enable large array optimizations. */
|
|
1604
|
-
var LARGE_ARRAY_SIZE = 200;
|
|
1605
|
-
|
|
1606
|
-
/**
|
|
1607
|
-
* Sets the stack `key` to `value`.
|
|
1608
|
-
*
|
|
1609
|
-
* @private
|
|
1610
|
-
* @name set
|
|
1611
|
-
* @memberOf Stack
|
|
1612
|
-
* @param {string} key The key of the value to set.
|
|
1613
|
-
* @param {*} value The value to set.
|
|
1614
|
-
* @returns {Object} Returns the stack cache instance.
|
|
1615
|
-
*/
|
|
1616
|
-
function stackSet$1(key, value) {
|
|
1617
|
-
var data = this.__data__;
|
|
1618
|
-
if (data instanceof ListCache$1) {
|
|
1619
|
-
var pairs = data.__data__;
|
|
1620
|
-
if (!Map$2 || pairs.length < LARGE_ARRAY_SIZE - 1) {
|
|
1621
|
-
pairs.push([key, value]);
|
|
1622
|
-
this.size = ++data.size;
|
|
1623
|
-
return this;
|
|
1624
|
-
}
|
|
1625
|
-
data = this.__data__ = new MapCache$1(pairs);
|
|
1626
|
-
}
|
|
1627
|
-
data.set(key, value);
|
|
1628
|
-
this.size = data.size;
|
|
1629
|
-
return this;
|
|
1630
|
-
}
|
|
1631
|
-
var _stackSet = stackSet$1;
|
|
1632
|
-
var ListCache = _ListCache,
|
|
1633
|
-
stackClear = _stackClear,
|
|
1634
|
-
stackDelete = _stackDelete,
|
|
1635
|
-
stackGet = _stackGet,
|
|
1636
|
-
stackHas = _stackHas,
|
|
1637
|
-
stackSet = _stackSet;
|
|
1638
|
-
|
|
1639
|
-
/**
|
|
1640
|
-
* Creates a stack cache object to store key-value pairs.
|
|
1641
|
-
*
|
|
1642
|
-
* @private
|
|
1643
|
-
* @constructor
|
|
1644
|
-
* @param {Array} [entries] The key-value pairs to cache.
|
|
1645
|
-
*/
|
|
1646
|
-
function Stack(entries) {
|
|
1647
|
-
var data = this.__data__ = new ListCache(entries);
|
|
1648
|
-
this.size = data.size;
|
|
1649
|
-
}
|
|
1650
|
-
|
|
1651
|
-
// Add methods to `Stack`.
|
|
1652
|
-
Stack.prototype.clear = stackClear;
|
|
1653
|
-
Stack.prototype['delete'] = stackDelete;
|
|
1654
|
-
Stack.prototype.get = stackGet;
|
|
1655
|
-
Stack.prototype.has = stackHas;
|
|
1656
|
-
Stack.prototype.set = stackSet;
|
|
1657
|
-
|
|
1658
|
-
/** Used to stand-in for `undefined` hash values. */
|
|
1659
|
-
|
|
1660
|
-
var HASH_UNDEFINED = '__lodash_hash_undefined__';
|
|
1661
|
-
|
|
1662
|
-
/**
|
|
1663
|
-
* Adds `value` to the array cache.
|
|
1664
|
-
*
|
|
1665
|
-
* @private
|
|
1666
|
-
* @name add
|
|
1667
|
-
* @memberOf SetCache
|
|
1668
|
-
* @alias push
|
|
1669
|
-
* @param {*} value The value to cache.
|
|
1670
|
-
* @returns {Object} Returns the cache instance.
|
|
1671
|
-
*/
|
|
1672
|
-
function setCacheAdd$1(value) {
|
|
1673
|
-
this.__data__.set(value, HASH_UNDEFINED);
|
|
1674
|
-
return this;
|
|
1675
|
-
}
|
|
1676
|
-
var _setCacheAdd = setCacheAdd$1;
|
|
1677
|
-
|
|
1678
|
-
/**
|
|
1679
|
-
* Checks if `value` is in the array cache.
|
|
1680
|
-
*
|
|
1681
|
-
* @private
|
|
1682
|
-
* @name has
|
|
1683
|
-
* @memberOf SetCache
|
|
1684
|
-
* @param {*} value The value to search for.
|
|
1685
|
-
* @returns {number} Returns `true` if `value` is found, else `false`.
|
|
1686
|
-
*/
|
|
1687
|
-
|
|
1688
|
-
function setCacheHas$1(value) {
|
|
1689
|
-
return this.__data__.has(value);
|
|
1690
|
-
}
|
|
1691
|
-
var _setCacheHas = setCacheHas$1;
|
|
1692
|
-
var MapCache = _MapCache,
|
|
1693
|
-
setCacheAdd = _setCacheAdd,
|
|
1694
|
-
setCacheHas = _setCacheHas;
|
|
1695
|
-
|
|
1696
|
-
/**
|
|
1697
|
-
*
|
|
1698
|
-
* Creates an array cache object to store unique values.
|
|
1699
|
-
*
|
|
1700
|
-
* @private
|
|
1701
|
-
* @constructor
|
|
1702
|
-
* @param {Array} [values] The values to cache.
|
|
1703
|
-
*/
|
|
1704
|
-
function SetCache(values) {
|
|
1705
|
-
var index = -1,
|
|
1706
|
-
length = values == null ? 0 : values.length;
|
|
1707
|
-
this.__data__ = new MapCache();
|
|
1708
|
-
while (++index < length) {
|
|
1709
|
-
this.add(values[index]);
|
|
1710
|
-
}
|
|
1711
|
-
}
|
|
1712
|
-
|
|
1713
|
-
// Add methods to `SetCache`.
|
|
1714
|
-
SetCache.prototype.add = SetCache.prototype.push = setCacheAdd;
|
|
1715
|
-
SetCache.prototype.has = setCacheHas;
|
|
1716
|
-
var isBuffer = {
|
|
1717
|
-
exports: {}
|
|
1718
|
-
};
|
|
1719
|
-
|
|
1720
|
-
/**
|
|
1721
|
-
* This method returns `false`.
|
|
1722
|
-
*
|
|
1723
|
-
* @static
|
|
1724
|
-
* @memberOf _
|
|
1725
|
-
* @since 4.13.0
|
|
1726
|
-
* @category Util
|
|
1727
|
-
* @returns {boolean} Returns `false`.
|
|
1728
|
-
* @example
|
|
1729
|
-
*
|
|
1730
|
-
* _.times(2, _.stubFalse);
|
|
1731
|
-
* // => [false, false]
|
|
1732
|
-
*/
|
|
1733
|
-
|
|
1734
|
-
function stubFalse() {
|
|
1735
|
-
return false;
|
|
1736
|
-
}
|
|
1737
|
-
var stubFalse_1 = stubFalse;
|
|
1738
|
-
(function (module, exports) {
|
|
1739
|
-
var root = _root,
|
|
1740
|
-
stubFalse = stubFalse_1;
|
|
1741
|
-
|
|
1742
|
-
/** Detect free variable `exports`. */
|
|
1743
|
-
var freeExports = exports && !exports.nodeType && exports;
|
|
1744
|
-
|
|
1745
|
-
/** Detect free variable `module`. */
|
|
1746
|
-
var freeModule = freeExports && 'object' == 'object' && module && !module.nodeType && module;
|
|
1747
|
-
|
|
1748
|
-
/** Detect the popular CommonJS extension `module.exports`. */
|
|
1749
|
-
var moduleExports = freeModule && freeModule.exports === freeExports;
|
|
1750
|
-
|
|
1751
|
-
/** Built-in value references. */
|
|
1752
|
-
var Buffer = moduleExports ? root.Buffer : undefined;
|
|
1753
|
-
|
|
1754
|
-
/* Built-in method references for those with the same name as other `lodash` methods. */
|
|
1755
|
-
var nativeIsBuffer = Buffer ? Buffer.isBuffer : undefined;
|
|
1756
|
-
|
|
1757
|
-
/**
|
|
1758
|
-
* Checks if `value` is a buffer.
|
|
1759
|
-
*
|
|
1760
|
-
* @static
|
|
1761
|
-
* @memberOf _
|
|
1762
|
-
* @since 4.3.0
|
|
1763
|
-
* @category Lang
|
|
1764
|
-
* @param {*} value The value to check.
|
|
1765
|
-
* @returns {boolean} Returns `true` if `value` is a buffer, else `false`.
|
|
1766
|
-
* @example
|
|
1767
|
-
*
|
|
1768
|
-
* _.isBuffer(new Buffer(2));
|
|
1769
|
-
* // => true
|
|
1770
|
-
*
|
|
1771
|
-
* _.isBuffer(new Uint8Array(2));
|
|
1772
|
-
* // => false
|
|
1773
|
-
*/
|
|
1774
|
-
var isBuffer = nativeIsBuffer || stubFalse;
|
|
1775
|
-
module.exports = isBuffer;
|
|
1776
|
-
})(isBuffer, isBuffer.exports);
|
|
1777
|
-
var _nodeUtil = {
|
|
1778
|
-
exports: {}
|
|
1779
|
-
};
|
|
1780
|
-
(function (module, exports) {
|
|
1781
|
-
var freeGlobal = _freeGlobal;
|
|
1782
|
-
|
|
1783
|
-
/** Detect free variable `exports`. */
|
|
1784
|
-
var freeExports = exports && !exports.nodeType && exports;
|
|
1785
|
-
|
|
1786
|
-
/** Detect free variable `module`. */
|
|
1787
|
-
var freeModule = freeExports && 'object' == 'object' && module && !module.nodeType && module;
|
|
1788
|
-
|
|
1789
|
-
/** Detect the popular CommonJS extension `module.exports`. */
|
|
1790
|
-
var moduleExports = freeModule && freeModule.exports === freeExports;
|
|
1791
|
-
|
|
1792
|
-
/** Detect free variable `process` from Node.js. */
|
|
1793
|
-
var freeProcess = moduleExports && freeGlobal.process;
|
|
1794
|
-
|
|
1795
|
-
/** Used to access faster Node.js helpers. */
|
|
1796
|
-
var nodeUtil = function () {
|
|
1797
|
-
try {
|
|
1798
|
-
// Use `util.types` for Node.js 10+.
|
|
1799
|
-
var types = freeModule && freeModule.require && freeModule.require('util').types;
|
|
1800
|
-
if (types) {
|
|
1801
|
-
return types;
|
|
1802
|
-
}
|
|
1803
|
-
|
|
1804
|
-
// Legacy `process.binding('util')` for Node.js < 10.
|
|
1805
|
-
return freeProcess && freeProcess.binding && freeProcess.binding('util');
|
|
1806
|
-
} catch (e) {}
|
|
1807
|
-
}();
|
|
1808
|
-
module.exports = nodeUtil;
|
|
1809
|
-
})(_nodeUtil, _nodeUtil.exports);
|
|
1810
|
-
var getNative$3 = _getNative,
|
|
1811
|
-
root$3 = _root;
|
|
1812
|
-
|
|
1813
|
-
/* Built-in method references that are verified to be native. */
|
|
1814
|
-
var DataView$1 = getNative$3(root$3, 'DataView');
|
|
1815
|
-
var _DataView = DataView$1;
|
|
1816
|
-
var getNative$2 = _getNative,
|
|
1817
|
-
root$2 = _root;
|
|
1818
|
-
|
|
1819
|
-
/* Built-in method references that are verified to be native. */
|
|
1820
|
-
var Promise$2 = getNative$2(root$2, 'Promise');
|
|
1821
|
-
var _Promise = Promise$2;
|
|
1822
|
-
var getNative$1 = _getNative,
|
|
1823
|
-
root$1 = _root;
|
|
1824
|
-
|
|
1825
|
-
/* Built-in method references that are verified to be native. */
|
|
1826
|
-
var Set$1 = getNative$1(root$1, 'Set');
|
|
1827
|
-
var _Set = Set$1;
|
|
1828
|
-
var getNative = _getNative,
|
|
1829
|
-
root = _root;
|
|
1830
|
-
|
|
1831
|
-
/* Built-in method references that are verified to be native. */
|
|
1832
|
-
var WeakMap$1 = getNative(root, 'WeakMap');
|
|
1833
|
-
var _WeakMap = WeakMap$1;
|
|
1834
|
-
var DataView = _DataView,
|
|
1835
|
-
Map$1 = _Map,
|
|
1836
|
-
Promise$1 = _Promise,
|
|
1837
|
-
Set = _Set,
|
|
1838
|
-
WeakMap = _WeakMap,
|
|
1839
|
-
baseGetTag = _baseGetTag,
|
|
1840
|
-
toSource = _toSource;
|
|
1841
|
-
|
|
1842
|
-
/** `Object#toString` result references. */
|
|
1843
|
-
var mapTag = '[object Map]',
|
|
1844
|
-
objectTag = '[object Object]',
|
|
1845
|
-
promiseTag = '[object Promise]',
|
|
1846
|
-
setTag = '[object Set]',
|
|
1847
|
-
weakMapTag = '[object WeakMap]';
|
|
1848
|
-
var dataViewTag = '[object DataView]';
|
|
1849
|
-
|
|
1850
|
-
/** Used to detect maps, sets, and weakmaps. */
|
|
1851
|
-
var dataViewCtorString = toSource(DataView),
|
|
1852
|
-
mapCtorString = toSource(Map$1),
|
|
1853
|
-
promiseCtorString = toSource(Promise$1),
|
|
1854
|
-
setCtorString = toSource(Set),
|
|
1855
|
-
weakMapCtorString = toSource(WeakMap);
|
|
1856
|
-
|
|
1857
|
-
/**
|
|
1858
|
-
* Gets the `toStringTag` of `value`.
|
|
1859
|
-
*
|
|
1860
|
-
* @private
|
|
1861
|
-
* @param {*} value The value to query.
|
|
1862
|
-
* @returns {string} Returns the `toStringTag`.
|
|
1863
|
-
*/
|
|
1864
|
-
var getTag = baseGetTag;
|
|
1865
|
-
|
|
1866
|
-
// Fallback for data views, maps, sets, and weak maps in IE 11 and promises in Node.js < 6.
|
|
1867
|
-
if (DataView && getTag(new DataView(new ArrayBuffer(1))) != dataViewTag || Map$1 && getTag(new Map$1()) != mapTag || Promise$1 && getTag(Promise$1.resolve()) != promiseTag || Set && getTag(new Set()) != setTag || WeakMap && getTag(new WeakMap()) != weakMapTag) {
|
|
1868
|
-
getTag = function (value) {
|
|
1869
|
-
var result = baseGetTag(value),
|
|
1870
|
-
Ctor = result == objectTag ? value.constructor : undefined,
|
|
1871
|
-
ctorString = Ctor ? toSource(Ctor) : '';
|
|
1872
|
-
if (ctorString) {
|
|
1873
|
-
switch (ctorString) {
|
|
1874
|
-
case dataViewCtorString:
|
|
1875
|
-
return dataViewTag;
|
|
1876
|
-
case mapCtorString:
|
|
1877
|
-
return mapTag;
|
|
1878
|
-
case promiseCtorString:
|
|
1879
|
-
return promiseTag;
|
|
1880
|
-
case setCtorString:
|
|
1881
|
-
return setTag;
|
|
1882
|
-
case weakMapCtorString:
|
|
1883
|
-
return weakMapTag;
|
|
1884
|
-
}
|
|
1885
|
-
}
|
|
1886
|
-
return result;
|
|
1887
|
-
};
|
|
1888
|
-
}
|
|
1889
|
-
var src = {
|
|
1890
|
-
exports: {}
|
|
1891
|
-
};
|
|
1892
|
-
var browser = {
|
|
1893
|
-
exports: {}
|
|
1894
|
-
};
|
|
1895
|
-
|
|
1896
|
-
/**
|
|
1897
|
-
* Helpers.
|
|
1898
|
-
*/
|
|
1899
|
-
|
|
1900
|
-
var ms;
|
|
1901
|
-
var hasRequiredMs;
|
|
1902
|
-
function requireMs() {
|
|
1903
|
-
if (hasRequiredMs) return ms;
|
|
1904
|
-
hasRequiredMs = 1;
|
|
1905
|
-
var s = 1000;
|
|
1906
|
-
var m = s * 60;
|
|
1907
|
-
var h = m * 60;
|
|
1908
|
-
var d = h * 24;
|
|
1909
|
-
var w = d * 7;
|
|
1910
|
-
var y = d * 365.25;
|
|
1911
|
-
|
|
1912
|
-
/**
|
|
1913
|
-
* Parse or format the given `val`.
|
|
1914
|
-
*
|
|
1915
|
-
* Options:
|
|
1916
|
-
*
|
|
1917
|
-
* - `long` verbose formatting [false]
|
|
1918
|
-
*
|
|
1919
|
-
* @param {String|Number} val
|
|
1920
|
-
* @param {Object} [options]
|
|
1921
|
-
* @throws {Error} throw an error if val is not a non-empty string or a number
|
|
1922
|
-
* @return {String|Number}
|
|
1923
|
-
* @api public
|
|
1924
|
-
*/
|
|
1925
|
-
|
|
1926
|
-
ms = function (val, options) {
|
|
1927
|
-
options = options || {};
|
|
1928
|
-
var type = typeof val;
|
|
1929
|
-
if (type === 'string' && val.length > 0) {
|
|
1930
|
-
return parse(val);
|
|
1931
|
-
} else if (type === 'number' && isFinite(val)) {
|
|
1932
|
-
return options.long ? fmtLong(val) : fmtShort(val);
|
|
1933
|
-
}
|
|
1934
|
-
throw new Error('val is not a non-empty string or a valid number. val=' + JSON.stringify(val));
|
|
1935
|
-
};
|
|
1936
|
-
|
|
1937
|
-
/**
|
|
1938
|
-
* Parse the given `str` and return milliseconds.
|
|
1939
|
-
*
|
|
1940
|
-
* @param {String} str
|
|
1941
|
-
* @return {Number}
|
|
1942
|
-
* @api private
|
|
1943
|
-
*/
|
|
1944
|
-
|
|
1945
|
-
function parse(str) {
|
|
1946
|
-
str = String(str);
|
|
1947
|
-
if (str.length > 100) {
|
|
1948
|
-
return;
|
|
1949
|
-
}
|
|
1950
|
-
var match = /^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(str);
|
|
1951
|
-
if (!match) {
|
|
1952
|
-
return;
|
|
1953
|
-
}
|
|
1954
|
-
var n = parseFloat(match[1]);
|
|
1955
|
-
var type = (match[2] || 'ms').toLowerCase();
|
|
1956
|
-
switch (type) {
|
|
1957
|
-
case 'years':
|
|
1958
|
-
case 'year':
|
|
1959
|
-
case 'yrs':
|
|
1960
|
-
case 'yr':
|
|
1961
|
-
case 'y':
|
|
1962
|
-
return n * y;
|
|
1963
|
-
case 'weeks':
|
|
1964
|
-
case 'week':
|
|
1965
|
-
case 'w':
|
|
1966
|
-
return n * w;
|
|
1967
|
-
case 'days':
|
|
1968
|
-
case 'day':
|
|
1969
|
-
case 'd':
|
|
1970
|
-
return n * d;
|
|
1971
|
-
case 'hours':
|
|
1972
|
-
case 'hour':
|
|
1973
|
-
case 'hrs':
|
|
1974
|
-
case 'hr':
|
|
1975
|
-
case 'h':
|
|
1976
|
-
return n * h;
|
|
1977
|
-
case 'minutes':
|
|
1978
|
-
case 'minute':
|
|
1979
|
-
case 'mins':
|
|
1980
|
-
case 'min':
|
|
1981
|
-
case 'm':
|
|
1982
|
-
return n * m;
|
|
1983
|
-
case 'seconds':
|
|
1984
|
-
case 'second':
|
|
1985
|
-
case 'secs':
|
|
1986
|
-
case 'sec':
|
|
1987
|
-
case 's':
|
|
1988
|
-
return n * s;
|
|
1989
|
-
case 'milliseconds':
|
|
1990
|
-
case 'millisecond':
|
|
1991
|
-
case 'msecs':
|
|
1992
|
-
case 'msec':
|
|
1993
|
-
case 'ms':
|
|
1994
|
-
return n;
|
|
1995
|
-
default:
|
|
1996
|
-
return undefined;
|
|
1997
|
-
}
|
|
1998
|
-
}
|
|
1999
|
-
|
|
2000
|
-
/**
|
|
2001
|
-
* Short format for `ms`.
|
|
2002
|
-
*
|
|
2003
|
-
* @param {Number} ms
|
|
2004
|
-
* @return {String}
|
|
2005
|
-
* @api private
|
|
2006
|
-
*/
|
|
2007
|
-
|
|
2008
|
-
function fmtShort(ms) {
|
|
2009
|
-
var msAbs = Math.abs(ms);
|
|
2010
|
-
if (msAbs >= d) {
|
|
2011
|
-
return Math.round(ms / d) + 'd';
|
|
2012
|
-
}
|
|
2013
|
-
if (msAbs >= h) {
|
|
2014
|
-
return Math.round(ms / h) + 'h';
|
|
2015
|
-
}
|
|
2016
|
-
if (msAbs >= m) {
|
|
2017
|
-
return Math.round(ms / m) + 'm';
|
|
2018
|
-
}
|
|
2019
|
-
if (msAbs >= s) {
|
|
2020
|
-
return Math.round(ms / s) + 's';
|
|
2021
|
-
}
|
|
2022
|
-
return ms + 'ms';
|
|
2023
|
-
}
|
|
2024
|
-
|
|
2025
|
-
/**
|
|
2026
|
-
* Long format for `ms`.
|
|
2027
|
-
*
|
|
2028
|
-
* @param {Number} ms
|
|
2029
|
-
* @return {String}
|
|
2030
|
-
* @api private
|
|
2031
|
-
*/
|
|
2032
|
-
|
|
2033
|
-
function fmtLong(ms) {
|
|
2034
|
-
var msAbs = Math.abs(ms);
|
|
2035
|
-
if (msAbs >= d) {
|
|
2036
|
-
return plural(ms, msAbs, d, 'day');
|
|
2037
|
-
}
|
|
2038
|
-
if (msAbs >= h) {
|
|
2039
|
-
return plural(ms, msAbs, h, 'hour');
|
|
2040
|
-
}
|
|
2041
|
-
if (msAbs >= m) {
|
|
2042
|
-
return plural(ms, msAbs, m, 'minute');
|
|
2043
|
-
}
|
|
2044
|
-
if (msAbs >= s) {
|
|
2045
|
-
return plural(ms, msAbs, s, 'second');
|
|
2046
|
-
}
|
|
2047
|
-
return ms + ' ms';
|
|
2048
|
-
}
|
|
2049
|
-
|
|
2050
|
-
/**
|
|
2051
|
-
* Pluralization helper.
|
|
2052
|
-
*/
|
|
2053
|
-
|
|
2054
|
-
function plural(ms, msAbs, n, name) {
|
|
2055
|
-
var isPlural = msAbs >= n * 1.5;
|
|
2056
|
-
return Math.round(ms / n) + ' ' + name + (isPlural ? 's' : '');
|
|
2057
|
-
}
|
|
2058
|
-
return ms;
|
|
2059
|
-
}
|
|
2060
|
-
var common;
|
|
2061
|
-
var hasRequiredCommon;
|
|
2062
|
-
function requireCommon() {
|
|
2063
|
-
if (hasRequiredCommon) return common;
|
|
2064
|
-
hasRequiredCommon = 1;
|
|
2065
|
-
|
|
2066
|
-
/**
|
|
2067
|
-
* This is the common logic for both the Node.js and web browser
|
|
2068
|
-
* implementations of `debug()`.
|
|
2069
|
-
*/
|
|
2070
|
-
function setup(env) {
|
|
2071
|
-
createDebug.debug = createDebug;
|
|
2072
|
-
createDebug.default = createDebug;
|
|
2073
|
-
createDebug.coerce = coerce;
|
|
2074
|
-
createDebug.disable = disable;
|
|
2075
|
-
createDebug.enable = enable;
|
|
2076
|
-
createDebug.enabled = enabled;
|
|
2077
|
-
createDebug.humanize = requireMs();
|
|
2078
|
-
Object.keys(env).forEach(function (key) {
|
|
2079
|
-
createDebug[key] = env[key];
|
|
2080
|
-
});
|
|
2081
|
-
/**
|
|
2082
|
-
* Active `debug` instances.
|
|
2083
|
-
*/
|
|
2084
|
-
|
|
2085
|
-
createDebug.instances = [];
|
|
2086
|
-
/**
|
|
2087
|
-
* The currently active debug mode names, and names to skip.
|
|
2088
|
-
*/
|
|
2089
|
-
|
|
2090
|
-
createDebug.names = [];
|
|
2091
|
-
createDebug.skips = [];
|
|
2092
|
-
/**
|
|
2093
|
-
* Map of special "%n" handling functions, for the debug "format" argument.
|
|
2094
|
-
*
|
|
2095
|
-
* Valid key names are a single, lower or upper-case letter, i.e. "n" and "N".
|
|
2096
|
-
*/
|
|
2097
|
-
|
|
2098
|
-
createDebug.formatters = {};
|
|
2099
|
-
/**
|
|
2100
|
-
* Selects a color for a debug namespace
|
|
2101
|
-
* @param {String} namespace The namespace string for the for the debug instance to be colored
|
|
2102
|
-
* @return {Number|String} An ANSI color code for the given namespace
|
|
2103
|
-
* @api private
|
|
2104
|
-
*/
|
|
2105
|
-
|
|
2106
|
-
function selectColor(namespace) {
|
|
2107
|
-
var hash = 0;
|
|
2108
|
-
for (var i = 0; i < namespace.length; i++) {
|
|
2109
|
-
hash = (hash << 5) - hash + namespace.charCodeAt(i);
|
|
2110
|
-
hash |= 0; // Convert to 32bit integer
|
|
2111
|
-
}
|
|
2112
|
-
|
|
2113
|
-
return createDebug.colors[Math.abs(hash) % createDebug.colors.length];
|
|
2114
|
-
}
|
|
2115
|
-
createDebug.selectColor = selectColor;
|
|
2116
|
-
/**
|
|
2117
|
-
* Create a debugger with the given `namespace`.
|
|
2118
|
-
*
|
|
2119
|
-
* @param {String} namespace
|
|
2120
|
-
* @return {Function}
|
|
2121
|
-
* @api public
|
|
2122
|
-
*/
|
|
2123
|
-
|
|
2124
|
-
function createDebug(namespace) {
|
|
2125
|
-
var prevTime;
|
|
2126
|
-
function debug() {
|
|
2127
|
-
// Disabled?
|
|
2128
|
-
if (!debug.enabled) {
|
|
2129
|
-
return;
|
|
2130
|
-
}
|
|
2131
|
-
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
2132
|
-
args[_key] = arguments[_key];
|
|
2133
|
-
}
|
|
2134
|
-
var self = debug; // Set `diff` timestamp
|
|
2135
|
-
|
|
2136
|
-
var curr = Number(new Date());
|
|
2137
|
-
var ms = curr - (prevTime || curr);
|
|
2138
|
-
self.diff = ms;
|
|
2139
|
-
self.prev = prevTime;
|
|
2140
|
-
self.curr = curr;
|
|
2141
|
-
prevTime = curr;
|
|
2142
|
-
args[0] = createDebug.coerce(args[0]);
|
|
2143
|
-
if (typeof args[0] !== 'string') {
|
|
2144
|
-
// Anything else let's inspect with %O
|
|
2145
|
-
args.unshift('%O');
|
|
2146
|
-
} // Apply any `formatters` transformations
|
|
2147
|
-
|
|
2148
|
-
var index = 0;
|
|
2149
|
-
args[0] = args[0].replace(/%([a-zA-Z%])/g, function (match, format) {
|
|
2150
|
-
// If we encounter an escaped % then don't increase the array index
|
|
2151
|
-
if (match === '%%') {
|
|
2152
|
-
return match;
|
|
2153
|
-
}
|
|
2154
|
-
index++;
|
|
2155
|
-
var formatter = createDebug.formatters[format];
|
|
2156
|
-
if (typeof formatter === 'function') {
|
|
2157
|
-
var val = args[index];
|
|
2158
|
-
match = formatter.call(self, val); // Now we need to remove `args[index]` since it's inlined in the `format`
|
|
2159
|
-
|
|
2160
|
-
args.splice(index, 1);
|
|
2161
|
-
index--;
|
|
2162
|
-
}
|
|
2163
|
-
return match;
|
|
2164
|
-
}); // Apply env-specific formatting (colors, etc.)
|
|
2165
|
-
|
|
2166
|
-
createDebug.formatArgs.call(self, args);
|
|
2167
|
-
var logFn = self.log || createDebug.log;
|
|
2168
|
-
logFn.apply(self, args);
|
|
2169
|
-
}
|
|
2170
|
-
debug.namespace = namespace;
|
|
2171
|
-
debug.enabled = createDebug.enabled(namespace);
|
|
2172
|
-
debug.useColors = createDebug.useColors();
|
|
2173
|
-
debug.color = selectColor(namespace);
|
|
2174
|
-
debug.destroy = destroy;
|
|
2175
|
-
debug.extend = extend; // Debug.formatArgs = formatArgs;
|
|
2176
|
-
// debug.rawLog = rawLog;
|
|
2177
|
-
// env-specific initialization logic for debug instances
|
|
2178
|
-
|
|
2179
|
-
if (typeof createDebug.init === 'function') {
|
|
2180
|
-
createDebug.init(debug);
|
|
2181
|
-
}
|
|
2182
|
-
createDebug.instances.push(debug);
|
|
2183
|
-
return debug;
|
|
2184
|
-
}
|
|
2185
|
-
function destroy() {
|
|
2186
|
-
var index = createDebug.instances.indexOf(this);
|
|
2187
|
-
if (index !== -1) {
|
|
2188
|
-
createDebug.instances.splice(index, 1);
|
|
2189
|
-
return true;
|
|
2190
|
-
}
|
|
2191
|
-
return false;
|
|
2192
|
-
}
|
|
2193
|
-
function extend(namespace, delimiter) {
|
|
2194
|
-
return createDebug(this.namespace + (typeof delimiter === 'undefined' ? ':' : delimiter) + namespace);
|
|
2195
|
-
}
|
|
2196
|
-
/**
|
|
2197
|
-
* Enables a debug mode by namespaces. This can include modes
|
|
2198
|
-
* separated by a colon and wildcards.
|
|
2199
|
-
*
|
|
2200
|
-
* @param {String} namespaces
|
|
2201
|
-
* @api public
|
|
2202
|
-
*/
|
|
2203
|
-
|
|
2204
|
-
function enable(namespaces) {
|
|
2205
|
-
createDebug.save(namespaces);
|
|
2206
|
-
createDebug.names = [];
|
|
2207
|
-
createDebug.skips = [];
|
|
2208
|
-
var i;
|
|
2209
|
-
var split = (typeof namespaces === 'string' ? namespaces : '').split(/[\s,]+/);
|
|
2210
|
-
var len = split.length;
|
|
2211
|
-
for (i = 0; i < len; i++) {
|
|
2212
|
-
if (!split[i]) {
|
|
2213
|
-
// ignore empty strings
|
|
2214
|
-
continue;
|
|
2215
|
-
}
|
|
2216
|
-
namespaces = split[i].replace(/\*/g, '.*?');
|
|
2217
|
-
if (namespaces[0] === '-') {
|
|
2218
|
-
createDebug.skips.push(new RegExp('^' + namespaces.substr(1) + '$'));
|
|
2219
|
-
} else {
|
|
2220
|
-
createDebug.names.push(new RegExp('^' + namespaces + '$'));
|
|
2221
|
-
}
|
|
2222
|
-
}
|
|
2223
|
-
for (i = 0; i < createDebug.instances.length; i++) {
|
|
2224
|
-
var instance = createDebug.instances[i];
|
|
2225
|
-
instance.enabled = createDebug.enabled(instance.namespace);
|
|
2226
|
-
}
|
|
2227
|
-
}
|
|
2228
|
-
/**
|
|
2229
|
-
* Disable debug output.
|
|
2230
|
-
*
|
|
2231
|
-
* @api public
|
|
2232
|
-
*/
|
|
2233
|
-
|
|
2234
|
-
function disable() {
|
|
2235
|
-
createDebug.enable('');
|
|
2236
|
-
}
|
|
2237
|
-
/**
|
|
2238
|
-
* Returns true if the given mode name is enabled, false otherwise.
|
|
2239
|
-
*
|
|
2240
|
-
* @param {String} name
|
|
2241
|
-
* @return {Boolean}
|
|
2242
|
-
* @api public
|
|
2243
|
-
*/
|
|
2244
|
-
|
|
2245
|
-
function enabled(name) {
|
|
2246
|
-
if (name[name.length - 1] === '*') {
|
|
2247
|
-
return true;
|
|
2248
|
-
}
|
|
2249
|
-
var i;
|
|
2250
|
-
var len;
|
|
2251
|
-
for (i = 0, len = createDebug.skips.length; i < len; i++) {
|
|
2252
|
-
if (createDebug.skips[i].test(name)) {
|
|
2253
|
-
return false;
|
|
2254
|
-
}
|
|
2255
|
-
}
|
|
2256
|
-
for (i = 0, len = createDebug.names.length; i < len; i++) {
|
|
2257
|
-
if (createDebug.names[i].test(name)) {
|
|
2258
|
-
return true;
|
|
2259
|
-
}
|
|
2260
|
-
}
|
|
2261
|
-
return false;
|
|
2262
|
-
}
|
|
2263
|
-
/**
|
|
2264
|
-
* Coerce `val`.
|
|
2265
|
-
*
|
|
2266
|
-
* @param {Mixed} val
|
|
2267
|
-
* @return {Mixed}
|
|
2268
|
-
* @api private
|
|
2269
|
-
*/
|
|
2270
|
-
|
|
2271
|
-
function coerce(val) {
|
|
2272
|
-
if (val instanceof Error) {
|
|
2273
|
-
return val.stack || val.message;
|
|
2274
|
-
}
|
|
2275
|
-
return val;
|
|
2276
|
-
}
|
|
2277
|
-
createDebug.enable(createDebug.load());
|
|
2278
|
-
return createDebug;
|
|
2279
|
-
}
|
|
2280
|
-
common = setup;
|
|
2281
|
-
return common;
|
|
2282
|
-
}
|
|
2283
|
-
var hasRequiredBrowser;
|
|
2284
|
-
function requireBrowser() {
|
|
2285
|
-
if (hasRequiredBrowser) return browser.exports;
|
|
2286
|
-
hasRequiredBrowser = 1;
|
|
2287
|
-
(function (module, exports) {
|
|
2288
|
-
function _typeof(obj) {
|
|
2289
|
-
if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
|
|
2290
|
-
_typeof = function _typeof(obj) {
|
|
2291
|
-
return typeof obj;
|
|
2292
|
-
};
|
|
2293
|
-
} else {
|
|
2294
|
-
_typeof = function _typeof(obj) {
|
|
2295
|
-
return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
|
|
2296
|
-
};
|
|
2297
|
-
}
|
|
2298
|
-
return _typeof(obj);
|
|
2299
|
-
}
|
|
2300
|
-
|
|
2301
|
-
/* eslint-env browser */
|
|
2302
|
-
|
|
2303
|
-
/**
|
|
2304
|
-
* This is the web browser implementation of `debug()`.
|
|
2305
|
-
*/
|
|
2306
|
-
exports.log = log;
|
|
2307
|
-
exports.formatArgs = formatArgs;
|
|
2308
|
-
exports.save = save;
|
|
2309
|
-
exports.load = load;
|
|
2310
|
-
exports.useColors = useColors;
|
|
2311
|
-
exports.storage = localstorage();
|
|
2312
|
-
/**
|
|
2313
|
-
* Colors.
|
|
2314
|
-
*/
|
|
2315
|
-
|
|
2316
|
-
exports.colors = ['#0000CC', '#0000FF', '#0033CC', '#0033FF', '#0066CC', '#0066FF', '#0099CC', '#0099FF', '#00CC00', '#00CC33', '#00CC66', '#00CC99', '#00CCCC', '#00CCFF', '#3300CC', '#3300FF', '#3333CC', '#3333FF', '#3366CC', '#3366FF', '#3399CC', '#3399FF', '#33CC00', '#33CC33', '#33CC66', '#33CC99', '#33CCCC', '#33CCFF', '#6600CC', '#6600FF', '#6633CC', '#6633FF', '#66CC00', '#66CC33', '#9900CC', '#9900FF', '#9933CC', '#9933FF', '#99CC00', '#99CC33', '#CC0000', '#CC0033', '#CC0066', '#CC0099', '#CC00CC', '#CC00FF', '#CC3300', '#CC3333', '#CC3366', '#CC3399', '#CC33CC', '#CC33FF', '#CC6600', '#CC6633', '#CC9900', '#CC9933', '#CCCC00', '#CCCC33', '#FF0000', '#FF0033', '#FF0066', '#FF0099', '#FF00CC', '#FF00FF', '#FF3300', '#FF3333', '#FF3366', '#FF3399', '#FF33CC', '#FF33FF', '#FF6600', '#FF6633', '#FF9900', '#FF9933', '#FFCC00', '#FFCC33'];
|
|
2317
|
-
/**
|
|
2318
|
-
* Currently only WebKit-based Web Inspectors, Firefox >= v31,
|
|
2319
|
-
* and the Firebug extension (any Firefox version) are known
|
|
2320
|
-
* to support "%c" CSS customizations.
|
|
2321
|
-
*
|
|
2322
|
-
* TODO: add a `localStorage` variable to explicitly enable/disable colors
|
|
2323
|
-
*/
|
|
2324
|
-
// eslint-disable-next-line complexity
|
|
2325
|
-
|
|
2326
|
-
function useColors() {
|
|
2327
|
-
// NB: In an Electron preload script, document will be defined but not fully
|
|
2328
|
-
// initialized. Since we know we're in Chrome, we'll just detect this case
|
|
2329
|
-
// explicitly
|
|
2330
|
-
if (typeof window !== 'undefined' && window.process && (window.process.type === 'renderer' || window.process.__nwjs)) {
|
|
2331
|
-
return true;
|
|
2332
|
-
} // Internet Explorer and Edge do not support colors.
|
|
2333
|
-
|
|
2334
|
-
if (typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/)) {
|
|
2335
|
-
return false;
|
|
2336
|
-
} // Is webkit? http://stackoverflow.com/a/16459606/376773
|
|
2337
|
-
// document is undefined in react-native: https://github.com/facebook/react-native/pull/1632
|
|
2338
|
-
|
|
2339
|
-
return typeof document !== 'undefined' && document.documentElement && document.documentElement.style && document.documentElement.style.WebkitAppearance ||
|
|
2340
|
-
// Is firebug? http://stackoverflow.com/a/398120/376773
|
|
2341
|
-
typeof window !== 'undefined' && window.console && (window.console.firebug || window.console.exception && window.console.table) ||
|
|
2342
|
-
// Is firefox >= v31?
|
|
2343
|
-
// https://developer.mozilla.org/en-US/docs/Tools/Web_Console#Styling_messages
|
|
2344
|
-
typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/) && parseInt(RegExp.$1, 10) >= 31 ||
|
|
2345
|
-
// Double check webkit in userAgent just in case we are in a worker
|
|
2346
|
-
typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/);
|
|
2347
|
-
}
|
|
2348
|
-
/**
|
|
2349
|
-
* Colorize log arguments if enabled.
|
|
2350
|
-
*
|
|
2351
|
-
* @api public
|
|
2352
|
-
*/
|
|
2353
|
-
|
|
2354
|
-
function formatArgs(args) {
|
|
2355
|
-
args[0] = (this.useColors ? '%c' : '') + this.namespace + (this.useColors ? ' %c' : ' ') + args[0] + (this.useColors ? '%c ' : ' ') + '+' + module.exports.humanize(this.diff);
|
|
2356
|
-
if (!this.useColors) {
|
|
2357
|
-
return;
|
|
2358
|
-
}
|
|
2359
|
-
var c = 'color: ' + this.color;
|
|
2360
|
-
args.splice(1, 0, c, 'color: inherit'); // The final "%c" is somewhat tricky, because there could be other
|
|
2361
|
-
// arguments passed either before or after the %c, so we need to
|
|
2362
|
-
// figure out the correct index to insert the CSS into
|
|
2363
|
-
|
|
2364
|
-
var index = 0;
|
|
2365
|
-
var lastC = 0;
|
|
2366
|
-
args[0].replace(/%[a-zA-Z%]/g, function (match) {
|
|
2367
|
-
if (match === '%%') {
|
|
2368
|
-
return;
|
|
2369
|
-
}
|
|
2370
|
-
index++;
|
|
2371
|
-
if (match === '%c') {
|
|
2372
|
-
// We only are interested in the *last* %c
|
|
2373
|
-
// (the user may have provided their own)
|
|
2374
|
-
lastC = index;
|
|
2375
|
-
}
|
|
2376
|
-
});
|
|
2377
|
-
args.splice(lastC, 0, c);
|
|
2378
|
-
}
|
|
2379
|
-
/**
|
|
2380
|
-
* Invokes `console.log()` when available.
|
|
2381
|
-
* No-op when `console.log` is not a "function".
|
|
2382
|
-
*
|
|
2383
|
-
* @api public
|
|
2384
|
-
*/
|
|
2385
|
-
|
|
2386
|
-
function log() {
|
|
2387
|
-
var _console;
|
|
2388
|
-
|
|
2389
|
-
// This hackery is required for IE8/9, where
|
|
2390
|
-
// the `console.log` function doesn't have 'apply'
|
|
2391
|
-
return (typeof console === "undefined" ? "undefined" : _typeof(console)) === 'object' && console.log && (_console = console).log.apply(_console, arguments);
|
|
2392
|
-
}
|
|
2393
|
-
/**
|
|
2394
|
-
* Save `namespaces`.
|
|
2395
|
-
*
|
|
2396
|
-
* @param {String} namespaces
|
|
2397
|
-
* @api private
|
|
2398
|
-
*/
|
|
2399
|
-
|
|
2400
|
-
function save(namespaces) {
|
|
2401
|
-
try {
|
|
2402
|
-
if (namespaces) {
|
|
2403
|
-
exports.storage.setItem('debug', namespaces);
|
|
2404
|
-
} else {
|
|
2405
|
-
exports.storage.removeItem('debug');
|
|
2406
|
-
}
|
|
2407
|
-
} catch (error) {// Swallow
|
|
2408
|
-
// XXX (@Qix-) should we be logging these?
|
|
2409
|
-
}
|
|
2410
|
-
}
|
|
2411
|
-
/**
|
|
2412
|
-
* Load `namespaces`.
|
|
2413
|
-
*
|
|
2414
|
-
* @return {String} returns the previously persisted debug modes
|
|
2415
|
-
* @api private
|
|
2416
|
-
*/
|
|
2417
|
-
|
|
2418
|
-
function load() {
|
|
2419
|
-
var r;
|
|
2420
|
-
try {
|
|
2421
|
-
r = exports.storage.getItem('debug');
|
|
2422
|
-
} catch (error) {} // Swallow
|
|
2423
|
-
// XXX (@Qix-) should we be logging these?
|
|
2424
|
-
// If debug isn't set in LS, and we're in Electron, try to load $DEBUG
|
|
2425
|
-
|
|
2426
|
-
if (!r && typeof process !== 'undefined' && 'env' in process) {
|
|
2427
|
-
r = process.env.DEBUG;
|
|
2428
|
-
}
|
|
2429
|
-
return r;
|
|
2430
|
-
}
|
|
2431
|
-
/**
|
|
2432
|
-
* Localstorage attempts to return the localstorage.
|
|
2433
|
-
*
|
|
2434
|
-
* This is necessary because safari throws
|
|
2435
|
-
* when a user disables cookies/localstorage
|
|
2436
|
-
* and you attempt to access it.
|
|
2437
|
-
*
|
|
2438
|
-
* @return {LocalStorage}
|
|
2439
|
-
* @api private
|
|
2440
|
-
*/
|
|
2441
|
-
|
|
2442
|
-
function localstorage() {
|
|
2443
|
-
try {
|
|
2444
|
-
// TVMLKit (Apple TV JS Runtime) does not have a window object, just localStorage in the global context
|
|
2445
|
-
// The Browser also has localStorage in the global context.
|
|
2446
|
-
return localStorage;
|
|
2447
|
-
} catch (error) {// Swallow
|
|
2448
|
-
// XXX (@Qix-) should we be logging these?
|
|
2449
|
-
}
|
|
2450
|
-
}
|
|
2451
|
-
module.exports = requireCommon()(exports);
|
|
2452
|
-
var formatters = module.exports.formatters;
|
|
2453
|
-
/**
|
|
2454
|
-
* Map %j to `JSON.stringify()`, since no Web Inspectors do that by default.
|
|
2455
|
-
*/
|
|
2456
|
-
|
|
2457
|
-
formatters.j = function (v) {
|
|
2458
|
-
try {
|
|
2459
|
-
return JSON.stringify(v);
|
|
2460
|
-
} catch (error) {
|
|
2461
|
-
return '[UnexpectedJSONParseError]: ' + error.message;
|
|
2462
|
-
}
|
|
2463
|
-
};
|
|
2464
|
-
})(browser, browser.exports);
|
|
2465
|
-
return browser.exports;
|
|
2466
|
-
}
|
|
2467
|
-
var node$2 = {
|
|
2468
|
-
exports: {}
|
|
2469
|
-
};
|
|
2470
|
-
var hasFlag;
|
|
2471
|
-
var hasRequiredHasFlag;
|
|
2472
|
-
function requireHasFlag() {
|
|
2473
|
-
if (hasRequiredHasFlag) return hasFlag;
|
|
2474
|
-
hasRequiredHasFlag = 1;
|
|
2475
|
-
hasFlag = function (flag) {
|
|
2476
|
-
let argv = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : process.argv;
|
|
2477
|
-
const prefix = flag.startsWith('-') ? '' : flag.length === 1 ? '-' : '--';
|
|
2478
|
-
const position = argv.indexOf(prefix + flag);
|
|
2479
|
-
const terminatorPosition = argv.indexOf('--');
|
|
2480
|
-
return position !== -1 && (terminatorPosition === -1 || position < terminatorPosition);
|
|
2481
|
-
};
|
|
2482
|
-
return hasFlag;
|
|
2483
|
-
}
|
|
2484
|
-
var supportsColor_1;
|
|
2485
|
-
var hasRequiredSupportsColor;
|
|
2486
|
-
function requireSupportsColor() {
|
|
2487
|
-
if (hasRequiredSupportsColor) return supportsColor_1;
|
|
2488
|
-
hasRequiredSupportsColor = 1;
|
|
2489
|
-
const os = require$$0;
|
|
2490
|
-
const tty = require$$1;
|
|
2491
|
-
const hasFlag = requireHasFlag();
|
|
2492
|
-
const {
|
|
2493
|
-
env
|
|
2494
|
-
} = process;
|
|
2495
|
-
let forceColor;
|
|
2496
|
-
if (hasFlag('no-color') || hasFlag('no-colors') || hasFlag('color=false') || hasFlag('color=never')) {
|
|
2497
|
-
forceColor = 0;
|
|
2498
|
-
} else if (hasFlag('color') || hasFlag('colors') || hasFlag('color=true') || hasFlag('color=always')) {
|
|
2499
|
-
forceColor = 1;
|
|
2500
|
-
}
|
|
2501
|
-
if ('FORCE_COLOR' in env) {
|
|
2502
|
-
if (env.FORCE_COLOR === 'true') {
|
|
2503
|
-
forceColor = 1;
|
|
2504
|
-
} else if (env.FORCE_COLOR === 'false') {
|
|
2505
|
-
forceColor = 0;
|
|
2506
|
-
} else {
|
|
2507
|
-
forceColor = env.FORCE_COLOR.length === 0 ? 1 : Math.min(parseInt(env.FORCE_COLOR, 10), 3);
|
|
2508
|
-
}
|
|
2509
|
-
}
|
|
2510
|
-
function translateLevel(level) {
|
|
2511
|
-
if (level === 0) {
|
|
2512
|
-
return false;
|
|
2513
|
-
}
|
|
2514
|
-
return {
|
|
2515
|
-
level,
|
|
2516
|
-
hasBasic: true,
|
|
2517
|
-
has256: level >= 2,
|
|
2518
|
-
has16m: level >= 3
|
|
2519
|
-
};
|
|
2520
|
-
}
|
|
2521
|
-
function supportsColor(haveStream, streamIsTTY) {
|
|
2522
|
-
if (forceColor === 0) {
|
|
2523
|
-
return 0;
|
|
2524
|
-
}
|
|
2525
|
-
if (hasFlag('color=16m') || hasFlag('color=full') || hasFlag('color=truecolor')) {
|
|
2526
|
-
return 3;
|
|
2527
|
-
}
|
|
2528
|
-
if (hasFlag('color=256')) {
|
|
2529
|
-
return 2;
|
|
2530
|
-
}
|
|
2531
|
-
if (haveStream && !streamIsTTY && forceColor === undefined) {
|
|
2532
|
-
return 0;
|
|
2533
|
-
}
|
|
2534
|
-
const min = forceColor || 0;
|
|
2535
|
-
if (env.TERM === 'dumb') {
|
|
2536
|
-
return min;
|
|
2537
|
-
}
|
|
2538
|
-
if (process.platform === 'win32') {
|
|
2539
|
-
// Windows 10 build 10586 is the first Windows release that supports 256 colors.
|
|
2540
|
-
// Windows 10 build 14931 is the first release that supports 16m/TrueColor.
|
|
2541
|
-
const osRelease = os.release().split('.');
|
|
2542
|
-
if (Number(osRelease[0]) >= 10 && Number(osRelease[2]) >= 10586) {
|
|
2543
|
-
return Number(osRelease[2]) >= 14931 ? 3 : 2;
|
|
2544
|
-
}
|
|
2545
|
-
return 1;
|
|
2546
|
-
}
|
|
2547
|
-
if ('CI' in env) {
|
|
2548
|
-
if (['TRAVIS', 'CIRCLECI', 'APPVEYOR', 'GITLAB_CI', 'GITHUB_ACTIONS', 'BUILDKITE'].some(sign => sign in env) || env.CI_NAME === 'codeship') {
|
|
2549
|
-
return 1;
|
|
2550
|
-
}
|
|
2551
|
-
return min;
|
|
2552
|
-
}
|
|
2553
|
-
if ('TEAMCITY_VERSION' in env) {
|
|
2554
|
-
return /^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(env.TEAMCITY_VERSION) ? 1 : 0;
|
|
2555
|
-
}
|
|
2556
|
-
if (env.COLORTERM === 'truecolor') {
|
|
2557
|
-
return 3;
|
|
2558
|
-
}
|
|
2559
|
-
if ('TERM_PROGRAM' in env) {
|
|
2560
|
-
const version = parseInt((env.TERM_PROGRAM_VERSION || '').split('.')[0], 10);
|
|
2561
|
-
switch (env.TERM_PROGRAM) {
|
|
2562
|
-
case 'iTerm.app':
|
|
2563
|
-
return version >= 3 ? 3 : 2;
|
|
2564
|
-
case 'Apple_Terminal':
|
|
2565
|
-
return 2;
|
|
2566
|
-
// No default
|
|
2567
|
-
}
|
|
2568
|
-
}
|
|
2569
|
-
|
|
2570
|
-
if (/-256(color)?$/i.test(env.TERM)) {
|
|
2571
|
-
return 2;
|
|
2572
|
-
}
|
|
2573
|
-
if (/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(env.TERM)) {
|
|
2574
|
-
return 1;
|
|
2575
|
-
}
|
|
2576
|
-
if ('COLORTERM' in env) {
|
|
2577
|
-
return 1;
|
|
2578
|
-
}
|
|
2579
|
-
return min;
|
|
2580
|
-
}
|
|
2581
|
-
function getSupportLevel(stream) {
|
|
2582
|
-
const level = supportsColor(stream, stream && stream.isTTY);
|
|
2583
|
-
return translateLevel(level);
|
|
2584
|
-
}
|
|
2585
|
-
supportsColor_1 = {
|
|
2586
|
-
supportsColor: getSupportLevel,
|
|
2587
|
-
stdout: translateLevel(supportsColor(true, tty.isatty(1))),
|
|
2588
|
-
stderr: translateLevel(supportsColor(true, tty.isatty(2)))
|
|
2589
|
-
};
|
|
2590
|
-
return supportsColor_1;
|
|
2591
|
-
}
|
|
2592
|
-
var hasRequiredNode;
|
|
2593
|
-
function requireNode() {
|
|
2594
|
-
if (hasRequiredNode) return node$2.exports;
|
|
2595
|
-
hasRequiredNode = 1;
|
|
2596
|
-
(function (module, exports) {
|
|
2597
|
-
/**
|
|
2598
|
-
* Module dependencies.
|
|
2599
|
-
*/
|
|
2600
|
-
var tty = require$$1;
|
|
2601
|
-
var util = require$$1$1;
|
|
2602
|
-
/**
|
|
2603
|
-
* This is the Node.js implementation of `debug()`.
|
|
2604
|
-
*/
|
|
2605
|
-
|
|
2606
|
-
exports.init = init;
|
|
2607
|
-
exports.log = log;
|
|
2608
|
-
exports.formatArgs = formatArgs;
|
|
2609
|
-
exports.save = save;
|
|
2610
|
-
exports.load = load;
|
|
2611
|
-
exports.useColors = useColors;
|
|
2612
|
-
/**
|
|
2613
|
-
* Colors.
|
|
2614
|
-
*/
|
|
2615
|
-
|
|
2616
|
-
exports.colors = [6, 2, 3, 4, 5, 1];
|
|
2617
|
-
try {
|
|
2618
|
-
// Optional dependency (as in, doesn't need to be installed, NOT like optionalDependencies in package.json)
|
|
2619
|
-
// eslint-disable-next-line import/no-extraneous-dependencies
|
|
2620
|
-
var supportsColor = requireSupportsColor();
|
|
2621
|
-
if (supportsColor && (supportsColor.stderr || supportsColor).level >= 2) {
|
|
2622
|
-
exports.colors = [20, 21, 26, 27, 32, 33, 38, 39, 40, 41, 42, 43, 44, 45, 56, 57, 62, 63, 68, 69, 74, 75, 76, 77, 78, 79, 80, 81, 92, 93, 98, 99, 112, 113, 128, 129, 134, 135, 148, 149, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 178, 179, 184, 185, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, 214, 215, 220, 221];
|
|
2623
|
-
}
|
|
2624
|
-
} catch (error) {} // Swallow - we only care if `supports-color` is available; it doesn't have to be.
|
|
2625
|
-
|
|
2626
|
-
/**
|
|
2627
|
-
* Build up the default `inspectOpts` object from the environment variables.
|
|
2628
|
-
*
|
|
2629
|
-
* $ DEBUG_COLORS=no DEBUG_DEPTH=10 DEBUG_SHOW_HIDDEN=enabled node script.js
|
|
2630
|
-
*/
|
|
2631
|
-
|
|
2632
|
-
exports.inspectOpts = Object.keys(process.env).filter(function (key) {
|
|
2633
|
-
return /^debug_/i.test(key);
|
|
2634
|
-
}).reduce(function (obj, key) {
|
|
2635
|
-
// Camel-case
|
|
2636
|
-
var prop = key.substring(6).toLowerCase().replace(/_([a-z])/g, function (_, k) {
|
|
2637
|
-
return k.toUpperCase();
|
|
2638
|
-
}); // Coerce string value into JS value
|
|
2639
|
-
|
|
2640
|
-
var val = process.env[key];
|
|
2641
|
-
if (/^(yes|on|true|enabled)$/i.test(val)) {
|
|
2642
|
-
val = true;
|
|
2643
|
-
} else if (/^(no|off|false|disabled)$/i.test(val)) {
|
|
2644
|
-
val = false;
|
|
2645
|
-
} else if (val === 'null') {
|
|
2646
|
-
val = null;
|
|
2647
|
-
} else {
|
|
2648
|
-
val = Number(val);
|
|
2649
|
-
}
|
|
2650
|
-
obj[prop] = val;
|
|
2651
|
-
return obj;
|
|
2652
|
-
}, {});
|
|
2653
|
-
/**
|
|
2654
|
-
* Is stdout a TTY? Colored output is enabled when `true`.
|
|
2655
|
-
*/
|
|
2656
|
-
|
|
2657
|
-
function useColors() {
|
|
2658
|
-
return 'colors' in exports.inspectOpts ? Boolean(exports.inspectOpts.colors) : tty.isatty(process.stderr.fd);
|
|
2659
|
-
}
|
|
2660
|
-
/**
|
|
2661
|
-
* Adds ANSI color escape codes if enabled.
|
|
2662
|
-
*
|
|
2663
|
-
* @api public
|
|
2664
|
-
*/
|
|
2665
|
-
|
|
2666
|
-
function formatArgs(args) {
|
|
2667
|
-
var name = this.namespace,
|
|
2668
|
-
useColors = this.useColors;
|
|
2669
|
-
if (useColors) {
|
|
2670
|
-
var c = this.color;
|
|
2671
|
-
var colorCode = "\x1B[3" + (c < 8 ? c : '8;5;' + c);
|
|
2672
|
-
var prefix = " ".concat(colorCode, ";1m").concat(name, " \x1B[0m");
|
|
2673
|
-
args[0] = prefix + args[0].split('\n').join('\n' + prefix);
|
|
2674
|
-
args.push(colorCode + 'm+' + module.exports.humanize(this.diff) + "\x1B[0m");
|
|
2675
|
-
} else {
|
|
2676
|
-
args[0] = getDate() + name + ' ' + args[0];
|
|
2677
|
-
}
|
|
2678
|
-
}
|
|
2679
|
-
function getDate() {
|
|
2680
|
-
if (exports.inspectOpts.hideDate) {
|
|
2681
|
-
return '';
|
|
2682
|
-
}
|
|
2683
|
-
return new Date().toISOString() + ' ';
|
|
2684
|
-
}
|
|
2685
|
-
/**
|
|
2686
|
-
* Invokes `util.format()` with the specified arguments and writes to stderr.
|
|
2687
|
-
*/
|
|
2688
|
-
|
|
2689
|
-
function log() {
|
|
2690
|
-
return process.stderr.write(util.format.apply(util, arguments) + '\n');
|
|
2691
|
-
}
|
|
2692
|
-
/**
|
|
2693
|
-
* Save `namespaces`.
|
|
2694
|
-
*
|
|
2695
|
-
* @param {String} namespaces
|
|
2696
|
-
* @api private
|
|
2697
|
-
*/
|
|
2698
|
-
|
|
2699
|
-
function save(namespaces) {
|
|
2700
|
-
if (namespaces) {
|
|
2701
|
-
process.env.DEBUG = namespaces;
|
|
2702
|
-
} else {
|
|
2703
|
-
// If you set a process.env field to null or undefined, it gets cast to the
|
|
2704
|
-
// string 'null' or 'undefined'. Just delete instead.
|
|
2705
|
-
delete process.env.DEBUG;
|
|
2706
|
-
}
|
|
2707
|
-
}
|
|
2708
|
-
/**
|
|
2709
|
-
* Load `namespaces`.
|
|
2710
|
-
*
|
|
2711
|
-
* @return {String} returns the previously persisted debug modes
|
|
2712
|
-
* @api private
|
|
2713
|
-
*/
|
|
2714
|
-
|
|
2715
|
-
function load() {
|
|
2716
|
-
return process.env.DEBUG;
|
|
2717
|
-
}
|
|
2718
|
-
/**
|
|
2719
|
-
* Init logic for `debug` instances.
|
|
2720
|
-
*
|
|
2721
|
-
* Create a new `inspectOpts` object in case `useColors` is set
|
|
2722
|
-
* differently for a particular `debug` instance.
|
|
2723
|
-
*/
|
|
2724
|
-
|
|
2725
|
-
function init(debug) {
|
|
2726
|
-
debug.inspectOpts = {};
|
|
2727
|
-
var keys = Object.keys(exports.inspectOpts);
|
|
2728
|
-
for (var i = 0; i < keys.length; i++) {
|
|
2729
|
-
debug.inspectOpts[keys[i]] = exports.inspectOpts[keys[i]];
|
|
2730
|
-
}
|
|
2731
|
-
}
|
|
2732
|
-
module.exports = requireCommon()(exports);
|
|
2733
|
-
var formatters = module.exports.formatters;
|
|
2734
|
-
/**
|
|
2735
|
-
* Map %o to `util.inspect()`, all on a single line.
|
|
2736
|
-
*/
|
|
2737
|
-
|
|
2738
|
-
formatters.o = function (v) {
|
|
2739
|
-
this.inspectOpts.colors = this.useColors;
|
|
2740
|
-
return util.inspect(v, this.inspectOpts).split('\n').map(function (str) {
|
|
2741
|
-
return str.trim();
|
|
2742
|
-
}).join(' ');
|
|
2743
|
-
};
|
|
2744
|
-
/**
|
|
2745
|
-
* Map %O to `util.inspect()`, allowing multiple lines if needed.
|
|
2746
|
-
*/
|
|
2747
|
-
|
|
2748
|
-
formatters.O = function (v) {
|
|
2749
|
-
this.inspectOpts.colors = this.useColors;
|
|
2750
|
-
return util.inspect(v, this.inspectOpts);
|
|
2751
|
-
};
|
|
2752
|
-
})(node$2, node$2.exports);
|
|
2753
|
-
return node$2.exports;
|
|
2754
|
-
}
|
|
2755
|
-
|
|
2756
|
-
/**
|
|
2757
|
-
* Detect Electron renderer / nwjs process, which is node, but we should
|
|
2758
|
-
* treat as a browser.
|
|
2759
|
-
*/
|
|
2760
|
-
if (typeof process === 'undefined' || process.type === 'renderer' || process.browser === true || process.__nwjs) {
|
|
2761
|
-
src.exports = requireBrowser();
|
|
2762
|
-
} else {
|
|
2763
|
-
src.exports = requireNode();
|
|
2764
|
-
}
|
|
2765
|
-
var srcExports = src.exports;
|
|
2766
|
-
var debugIt = /*@__PURE__*/getDefaultExportFromCjs(srcExports);
|
|
2767
|
-
var __defProp$h = Object.defineProperty;
|
|
2768
|
-
var __defNormalProp$h = (obj, key, value) => key in obj ? __defProp$h(obj, key, {
|
|
2769
|
-
enumerable: true,
|
|
2770
|
-
configurable: true,
|
|
2771
|
-
writable: true,
|
|
2772
|
-
value
|
|
2773
|
-
}) : obj[key] = value;
|
|
2774
|
-
var __publicField$h = (obj, key, value) => {
|
|
2775
|
-
__defNormalProp$h(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
2776
|
-
return value;
|
|
2777
|
-
};
|
|
2778
|
-
const digitChar = /[0-9]/;
|
|
2779
|
-
const attributeCharMatcher = /^[a-zA-Z0-9_]$/;
|
|
2780
|
-
const attributeFirstCharMatcher = /^[a-zA-Z_]$/;
|
|
2781
|
-
const symbols = {
|
|
2782
|
-
operator: ["..", ".", ",", ":", "?"],
|
|
2783
|
-
comparator: [">", ">=", "<", "<=", "==", "!="],
|
|
2784
|
-
keyword: ["$", "@"],
|
|
2785
|
-
boolean: ["true", "false"],
|
|
2786
|
-
paren: ["[", "]"]
|
|
2787
|
-
};
|
|
2788
|
-
const symbolClasses = Object.keys(symbols);
|
|
2789
|
-
class Tokenizer {
|
|
2790
|
-
constructor(path) {
|
|
2791
|
-
__publicField$h(this, "source");
|
|
2792
|
-
__publicField$h(this, "i");
|
|
2793
|
-
__publicField$h(this, "length");
|
|
2794
|
-
__publicField$h(this, "tokenizers");
|
|
2795
|
-
this.source = path;
|
|
2796
|
-
this.length = path.length;
|
|
2797
|
-
this.i = 0;
|
|
2798
|
-
this.tokenizers = [this.tokenizeSymbol, this.tokenizeIdentifier, this.tokenizeNumber, this.tokenizeQuoted].map(fn => fn.bind(this));
|
|
2799
|
-
}
|
|
2800
|
-
tokenize() {
|
|
2801
|
-
const result = [];
|
|
2802
|
-
while (!this.EOF()) {
|
|
2803
|
-
this.chompWhitespace();
|
|
2804
|
-
let token = null;
|
|
2805
|
-
const found = this.tokenizers.some(tokenizer => {
|
|
2806
|
-
token = tokenizer();
|
|
2807
|
-
return Boolean(token);
|
|
2808
|
-
});
|
|
2809
|
-
if (!found || !token) {
|
|
2810
|
-
throw new Error("Invalid tokens in jsonpath '".concat(this.source, "' @ ").concat(this.i));
|
|
2811
|
-
}
|
|
2812
|
-
result.push(token);
|
|
2813
|
-
}
|
|
2814
|
-
return result;
|
|
2815
|
-
}
|
|
2816
|
-
takeWhile(fn) {
|
|
2817
|
-
const start = this.i;
|
|
2818
|
-
let result = "";
|
|
2819
|
-
while (!this.EOF()) {
|
|
2820
|
-
const nextChar = fn(this.source[this.i]);
|
|
2821
|
-
if (nextChar === null) {
|
|
2822
|
-
break;
|
|
2823
|
-
}
|
|
2824
|
-
result += nextChar;
|
|
2825
|
-
this.i++;
|
|
2826
|
-
}
|
|
2827
|
-
if (this.i === start) {
|
|
2828
|
-
return null;
|
|
2829
|
-
}
|
|
2830
|
-
return result;
|
|
2831
|
-
}
|
|
2832
|
-
EOF() {
|
|
2833
|
-
return this.i >= this.length;
|
|
2834
|
-
}
|
|
2835
|
-
peek() {
|
|
2836
|
-
if (this.EOF()) {
|
|
2837
|
-
return null;
|
|
2838
|
-
}
|
|
2839
|
-
return this.source[this.i];
|
|
2840
|
-
}
|
|
2841
|
-
consume(str) {
|
|
2842
|
-
if (this.i + str.length > this.length) {
|
|
2843
|
-
throw new Error("Expected ".concat(str, " at end of jsonpath"));
|
|
2844
|
-
}
|
|
2845
|
-
if (str === this.source.slice(this.i, this.i + str.length)) {
|
|
2846
|
-
this.i += str.length;
|
|
2847
|
-
} else {
|
|
2848
|
-
throw new Error('Expected "'.concat(str, '", but source contained "').concat(this.source.slice()));
|
|
2849
|
-
}
|
|
2850
|
-
}
|
|
2851
|
-
// Tries to match the upcoming bit of string with the provided string. If it matches, returns
|
|
2852
|
-
// the string, then advances the read pointer to the next bit. If not, returns null and nothing
|
|
2853
|
-
// happens.
|
|
2854
|
-
tryConsume(str) {
|
|
2855
|
-
if (this.i + str.length > this.length) {
|
|
2856
|
-
return null;
|
|
2857
|
-
}
|
|
2858
|
-
if (str === this.source.slice(this.i, this.i + str.length)) {
|
|
2859
|
-
this.i += str.length;
|
|
2860
|
-
return str;
|
|
2861
|
-
}
|
|
2862
|
-
return null;
|
|
2863
|
-
}
|
|
2864
|
-
chompWhitespace() {
|
|
2865
|
-
this.takeWhile(char => {
|
|
2866
|
-
return char === " " ? "" : null;
|
|
2867
|
-
});
|
|
2868
|
-
}
|
|
2869
|
-
tokenizeQuoted() {
|
|
2870
|
-
const quote = this.peek();
|
|
2871
|
-
if (quote === "'" || quote === '"') {
|
|
2872
|
-
this.consume(quote);
|
|
2873
|
-
let escape = false;
|
|
2874
|
-
const inner = this.takeWhile(char => {
|
|
2875
|
-
if (escape) {
|
|
2876
|
-
escape = false;
|
|
2877
|
-
return char;
|
|
2878
|
-
}
|
|
2879
|
-
if (char === "\\") {
|
|
2880
|
-
escape = true;
|
|
2881
|
-
return "";
|
|
2882
|
-
}
|
|
2883
|
-
if (char != quote) {
|
|
2884
|
-
return char;
|
|
2885
|
-
}
|
|
2886
|
-
return null;
|
|
2887
|
-
});
|
|
2888
|
-
this.consume(quote);
|
|
2889
|
-
return {
|
|
2890
|
-
type: "quoted",
|
|
2891
|
-
value: inner,
|
|
2892
|
-
quote: quote === '"' ? "double" : "single"
|
|
2893
|
-
};
|
|
2894
|
-
}
|
|
2895
|
-
return null;
|
|
2896
|
-
}
|
|
2897
|
-
tokenizeIdentifier() {
|
|
2898
|
-
let first = true;
|
|
2899
|
-
const identifier = this.takeWhile(char => {
|
|
2900
|
-
if (first) {
|
|
2901
|
-
first = false;
|
|
2902
|
-
return char.match(attributeFirstCharMatcher) ? char : null;
|
|
2903
|
-
}
|
|
2904
|
-
return char.match(attributeCharMatcher) ? char : null;
|
|
2905
|
-
});
|
|
2906
|
-
if (identifier !== null) {
|
|
2907
|
-
return {
|
|
2908
|
-
type: "identifier",
|
|
2909
|
-
name: identifier
|
|
2910
|
-
};
|
|
2911
|
-
}
|
|
2912
|
-
return null;
|
|
2913
|
-
}
|
|
2914
|
-
tokenizeNumber() {
|
|
2915
|
-
const start = this.i;
|
|
2916
|
-
let dotSeen = false;
|
|
2917
|
-
let digitSeen = false;
|
|
2918
|
-
let negative = false;
|
|
2919
|
-
if (this.peek() === "-") {
|
|
2920
|
-
negative = true;
|
|
2921
|
-
this.consume("-");
|
|
2922
|
-
}
|
|
2923
|
-
const number = this.takeWhile(char => {
|
|
2924
|
-
if (char === "." && !dotSeen && digitSeen) {
|
|
2925
|
-
dotSeen = true;
|
|
2926
|
-
return char;
|
|
2927
|
-
}
|
|
2928
|
-
digitSeen = true;
|
|
2929
|
-
return char.match(digitChar) ? char : null;
|
|
2930
|
-
});
|
|
2931
|
-
if (number !== null) {
|
|
2932
|
-
return {
|
|
2933
|
-
type: "number",
|
|
2934
|
-
value: negative ? -number : +number,
|
|
2935
|
-
raw: negative ? "-".concat(number) : number
|
|
2936
|
-
};
|
|
2937
|
-
}
|
|
2938
|
-
this.i = start;
|
|
2939
|
-
return null;
|
|
2940
|
-
}
|
|
2941
|
-
tokenizeSymbol() {
|
|
2942
|
-
for (const symbolClass of symbolClasses) {
|
|
2943
|
-
const patterns = symbols[symbolClass];
|
|
2944
|
-
const symbol = patterns.find(pattern => this.tryConsume(pattern));
|
|
2945
|
-
if (symbol) {
|
|
2946
|
-
return {
|
|
2947
|
-
type: symbolClass,
|
|
2948
|
-
symbol
|
|
2949
|
-
};
|
|
2950
|
-
}
|
|
2951
|
-
}
|
|
2952
|
-
return null;
|
|
2953
|
-
}
|
|
2954
|
-
}
|
|
2955
|
-
function tokenize(jsonpath) {
|
|
2956
|
-
return new Tokenizer(jsonpath).tokenize();
|
|
2957
|
-
}
|
|
2958
|
-
var __defProp$g = Object.defineProperty;
|
|
2959
|
-
var __defNormalProp$g = (obj, key, value) => key in obj ? __defProp$g(obj, key, {
|
|
2960
|
-
enumerable: true,
|
|
2961
|
-
configurable: true,
|
|
2962
|
-
writable: true,
|
|
2963
|
-
value
|
|
2964
|
-
}) : obj[key] = value;
|
|
2965
|
-
var __publicField$g = (obj, key, value) => {
|
|
2966
|
-
__defNormalProp$g(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
2967
|
-
return value;
|
|
2968
|
-
};
|
|
2969
|
-
class Parser {
|
|
2970
|
-
constructor(path) {
|
|
2971
|
-
__publicField$g(this, "tokens");
|
|
2972
|
-
__publicField$g(this, "length");
|
|
2973
|
-
__publicField$g(this, "i");
|
|
2974
|
-
this.tokens = tokenize(path);
|
|
2975
|
-
this.length = this.tokens.length;
|
|
2976
|
-
this.i = 0;
|
|
2977
|
-
}
|
|
2978
|
-
parse() {
|
|
2979
|
-
return this.parsePath();
|
|
2980
|
-
}
|
|
2981
|
-
EOF() {
|
|
2982
|
-
return this.i >= this.length;
|
|
2983
|
-
}
|
|
2984
|
-
// Look at upcoming token
|
|
2985
|
-
peek() {
|
|
2986
|
-
if (this.EOF()) {
|
|
2987
|
-
return null;
|
|
2988
|
-
}
|
|
2989
|
-
return this.tokens[this.i];
|
|
2990
|
-
}
|
|
2991
|
-
consume() {
|
|
2992
|
-
const result = this.peek();
|
|
2993
|
-
this.i += 1;
|
|
2994
|
-
return result;
|
|
2995
|
-
}
|
|
2996
|
-
// Return next token if it matches the pattern
|
|
2997
|
-
probe(pattern) {
|
|
2998
|
-
const token = this.peek();
|
|
2999
|
-
if (!token) {
|
|
3000
|
-
return null;
|
|
3001
|
-
}
|
|
3002
|
-
const record = token;
|
|
3003
|
-
const match = Object.keys(pattern).every(key => {
|
|
3004
|
-
return key in token && pattern[key] === record[key];
|
|
3005
|
-
});
|
|
3006
|
-
return match ? token : null;
|
|
3007
|
-
}
|
|
3008
|
-
// Return and consume next token if it matches the pattern
|
|
3009
|
-
match(pattern) {
|
|
3010
|
-
return this.probe(pattern) ? this.consume() : null;
|
|
3011
|
-
}
|
|
3012
|
-
parseAttribute() {
|
|
3013
|
-
const token = this.match({
|
|
3014
|
-
type: "identifier"
|
|
3015
|
-
});
|
|
3016
|
-
if (token && token.type === "identifier") {
|
|
3017
|
-
return {
|
|
3018
|
-
type: "attribute",
|
|
3019
|
-
name: token.name
|
|
3020
|
-
};
|
|
3021
|
-
}
|
|
3022
|
-
const quoted = this.match({
|
|
3023
|
-
type: "quoted",
|
|
3024
|
-
quote: "single"
|
|
3025
|
-
});
|
|
3026
|
-
if (quoted && quoted.type === "quoted") {
|
|
3027
|
-
return {
|
|
3028
|
-
type: "attribute",
|
|
3029
|
-
name: quoted.value || ""
|
|
3030
|
-
};
|
|
3031
|
-
}
|
|
3032
|
-
return null;
|
|
3033
|
-
}
|
|
3034
|
-
parseAlias() {
|
|
3035
|
-
if (this.match({
|
|
3036
|
-
type: "keyword",
|
|
3037
|
-
symbol: "@"
|
|
3038
|
-
}) || this.match({
|
|
3039
|
-
type: "keyword",
|
|
3040
|
-
symbol: "$"
|
|
3041
|
-
})) {
|
|
3042
|
-
return {
|
|
3043
|
-
type: "alias",
|
|
3044
|
-
target: "self"
|
|
3045
|
-
};
|
|
3046
|
-
}
|
|
3047
|
-
return null;
|
|
3048
|
-
}
|
|
3049
|
-
parseNumber() {
|
|
3050
|
-
const token = this.match({
|
|
3051
|
-
type: "number"
|
|
3052
|
-
});
|
|
3053
|
-
if (token && token.type === "number") {
|
|
3054
|
-
return {
|
|
3055
|
-
type: "number",
|
|
3056
|
-
value: token.value
|
|
3057
|
-
};
|
|
3058
|
-
}
|
|
3059
|
-
return null;
|
|
3060
|
-
}
|
|
3061
|
-
parseNumberValue() {
|
|
3062
|
-
const expr = this.parseNumber();
|
|
3063
|
-
if (expr) {
|
|
3064
|
-
return expr.value;
|
|
3065
|
-
}
|
|
3066
|
-
return null;
|
|
3067
|
-
}
|
|
3068
|
-
parseSliceSelector() {
|
|
3069
|
-
const start = this.i;
|
|
3070
|
-
const rangeStart = this.parseNumberValue();
|
|
3071
|
-
const colon1 = this.match({
|
|
3072
|
-
type: "operator",
|
|
3073
|
-
symbol: ":"
|
|
3074
|
-
});
|
|
3075
|
-
if (!colon1) {
|
|
3076
|
-
if (rangeStart === null) {
|
|
3077
|
-
this.i = start;
|
|
3078
|
-
return null;
|
|
3079
|
-
}
|
|
3080
|
-
return {
|
|
3081
|
-
type: "index",
|
|
3082
|
-
value: rangeStart
|
|
3083
|
-
};
|
|
3084
|
-
}
|
|
3085
|
-
const result = {
|
|
3086
|
-
type: "range",
|
|
3087
|
-
start: rangeStart,
|
|
3088
|
-
end: this.parseNumberValue()
|
|
3089
|
-
};
|
|
3090
|
-
const colon2 = this.match({
|
|
3091
|
-
type: "operator",
|
|
3092
|
-
symbol: ":"
|
|
3093
|
-
});
|
|
3094
|
-
if (colon2) {
|
|
3095
|
-
result.step = this.parseNumberValue();
|
|
3096
|
-
}
|
|
3097
|
-
if (result.start === null && result.end === null) {
|
|
3098
|
-
this.i = start;
|
|
3099
|
-
return null;
|
|
3100
|
-
}
|
|
3101
|
-
return result;
|
|
3102
|
-
}
|
|
3103
|
-
parseValueReference() {
|
|
3104
|
-
return this.parseAttribute() || this.parseSliceSelector();
|
|
3105
|
-
}
|
|
3106
|
-
parseLiteralValue() {
|
|
3107
|
-
const literalString = this.match({
|
|
3108
|
-
type: "quoted",
|
|
3109
|
-
quote: "double"
|
|
3110
|
-
});
|
|
3111
|
-
if (literalString && literalString.type === "quoted") {
|
|
3112
|
-
return {
|
|
3113
|
-
type: "string",
|
|
3114
|
-
value: literalString.value || ""
|
|
3115
|
-
};
|
|
3116
|
-
}
|
|
3117
|
-
const literalBoolean = this.match({
|
|
3118
|
-
type: "boolean"
|
|
3119
|
-
});
|
|
3120
|
-
if (literalBoolean && literalBoolean.type === "boolean") {
|
|
3121
|
-
return {
|
|
3122
|
-
type: "boolean",
|
|
3123
|
-
value: literalBoolean.symbol === "true"
|
|
3124
|
-
};
|
|
3125
|
-
}
|
|
3126
|
-
return this.parseNumber();
|
|
3127
|
-
}
|
|
3128
|
-
// TODO: Reorder constraints so that literal value is always on rhs, and variable is always
|
|
3129
|
-
// on lhs.
|
|
3130
|
-
parseFilterExpression() {
|
|
3131
|
-
const start = this.i;
|
|
3132
|
-
const expr = this.parseAttribute() || this.parseAlias();
|
|
3133
|
-
if (!expr) {
|
|
3134
|
-
return null;
|
|
3135
|
-
}
|
|
3136
|
-
if (this.match({
|
|
3137
|
-
type: "operator",
|
|
3138
|
-
symbol: "?"
|
|
3139
|
-
})) {
|
|
3140
|
-
return {
|
|
3141
|
-
type: "constraint",
|
|
3142
|
-
operator: "?",
|
|
3143
|
-
lhs: expr
|
|
3144
|
-
};
|
|
3145
|
-
}
|
|
3146
|
-
const binOp = this.match({
|
|
3147
|
-
type: "comparator"
|
|
3148
|
-
});
|
|
3149
|
-
if (!binOp || binOp.type !== "comparator") {
|
|
3150
|
-
this.i = start;
|
|
3151
|
-
return null;
|
|
3152
|
-
}
|
|
3153
|
-
const lhs = expr;
|
|
3154
|
-
const rhs = this.parseLiteralValue();
|
|
3155
|
-
if (!rhs) {
|
|
3156
|
-
throw new Error("Operator ".concat(binOp.symbol, " needs a literal value at the right hand side"));
|
|
3157
|
-
}
|
|
3158
|
-
return {
|
|
3159
|
-
type: "constraint",
|
|
3160
|
-
operator: binOp.symbol,
|
|
3161
|
-
lhs,
|
|
3162
|
-
rhs
|
|
3163
|
-
};
|
|
3164
|
-
}
|
|
3165
|
-
parseExpression() {
|
|
3166
|
-
return this.parseFilterExpression() || this.parseValueReference();
|
|
3167
|
-
}
|
|
3168
|
-
parseUnion() {
|
|
3169
|
-
if (!this.match({
|
|
3170
|
-
type: "paren",
|
|
3171
|
-
symbol: "["
|
|
3172
|
-
})) {
|
|
3173
|
-
return null;
|
|
3174
|
-
}
|
|
3175
|
-
const terms = [];
|
|
3176
|
-
let expr = this.parseFilterExpression() || this.parsePath() || this.parseValueReference();
|
|
3177
|
-
while (expr) {
|
|
3178
|
-
terms.push(expr);
|
|
3179
|
-
if (this.match({
|
|
3180
|
-
type: "paren",
|
|
3181
|
-
symbol: "]"
|
|
3182
|
-
})) {
|
|
3183
|
-
break;
|
|
3184
|
-
}
|
|
3185
|
-
if (!this.match({
|
|
3186
|
-
type: "operator",
|
|
3187
|
-
symbol: ","
|
|
3188
|
-
})) {
|
|
3189
|
-
throw new Error("Expected ]");
|
|
3190
|
-
}
|
|
3191
|
-
expr = this.parseFilterExpression() || this.parsePath() || this.parseValueReference();
|
|
3192
|
-
if (!expr) {
|
|
3193
|
-
throw new Error("Expected expression following ','");
|
|
3194
|
-
}
|
|
3195
|
-
}
|
|
3196
|
-
return {
|
|
3197
|
-
type: "union",
|
|
3198
|
-
nodes: terms
|
|
3199
|
-
};
|
|
3200
|
-
}
|
|
3201
|
-
parseRecursive() {
|
|
3202
|
-
if (!this.match({
|
|
3203
|
-
type: "operator",
|
|
3204
|
-
symbol: ".."
|
|
3205
|
-
})) {
|
|
3206
|
-
return null;
|
|
3207
|
-
}
|
|
3208
|
-
const subpath = this.parsePath();
|
|
3209
|
-
if (!subpath) {
|
|
3210
|
-
throw new Error("Expected path following '..' operator");
|
|
3211
|
-
}
|
|
3212
|
-
return {
|
|
3213
|
-
type: "recursive",
|
|
3214
|
-
term: subpath
|
|
3215
|
-
};
|
|
3216
|
-
}
|
|
3217
|
-
parsePath() {
|
|
3218
|
-
const nodes = [];
|
|
3219
|
-
const expr = this.parseAttribute() || this.parseUnion() || this.parseRecursive();
|
|
3220
|
-
if (!expr) {
|
|
3221
|
-
return null;
|
|
3222
|
-
}
|
|
3223
|
-
nodes.push(expr);
|
|
3224
|
-
while (!this.EOF()) {
|
|
3225
|
-
if (this.match({
|
|
3226
|
-
type: "operator",
|
|
3227
|
-
symbol: "."
|
|
3228
|
-
})) {
|
|
3229
|
-
const attr = this.parseAttribute();
|
|
3230
|
-
if (!attr) {
|
|
3231
|
-
throw new Error("Expected attribute name following '.");
|
|
3232
|
-
}
|
|
3233
|
-
nodes.push(attr);
|
|
3234
|
-
continue;
|
|
3235
|
-
} else if (this.probe({
|
|
3236
|
-
type: "paren",
|
|
3237
|
-
symbol: "["
|
|
3238
|
-
})) {
|
|
3239
|
-
const union = this.parseUnion();
|
|
3240
|
-
if (!union) {
|
|
3241
|
-
throw new Error("Expected union following '['");
|
|
3242
|
-
}
|
|
3243
|
-
nodes.push(union);
|
|
3244
|
-
} else {
|
|
3245
|
-
const recursive = this.parseRecursive();
|
|
3246
|
-
if (recursive) {
|
|
3247
|
-
nodes.push(recursive);
|
|
3248
|
-
}
|
|
3249
|
-
break;
|
|
3250
|
-
}
|
|
3251
|
-
}
|
|
3252
|
-
if (nodes.length === 1) {
|
|
3253
|
-
return nodes[0];
|
|
3254
|
-
}
|
|
3255
|
-
return {
|
|
3256
|
-
type: "path",
|
|
3257
|
-
nodes
|
|
3258
|
-
};
|
|
3259
|
-
}
|
|
3260
|
-
}
|
|
3261
|
-
function parseJsonPath(path) {
|
|
3262
|
-
const parsed = new Parser(path).parse();
|
|
3263
|
-
if (!parsed) {
|
|
3264
|
-
throw new Error('Failed to parse JSON path "'.concat(path, '"'));
|
|
3265
|
-
}
|
|
3266
|
-
return parsed;
|
|
3267
|
-
}
|
|
3268
|
-
function descend$1(tail) {
|
|
3269
|
-
const [head, newTail] = splitIfPath(tail);
|
|
3270
|
-
if (!head) {
|
|
3271
|
-
throw new Error("Head cannot be null");
|
|
3272
|
-
}
|
|
3273
|
-
return spreadIfUnionHead(head, newTail);
|
|
3274
|
-
}
|
|
3275
|
-
function splitIfPath(tail) {
|
|
3276
|
-
if (tail.type !== "path") {
|
|
3277
|
-
return [tail, null];
|
|
3278
|
-
}
|
|
3279
|
-
const nodes = tail.nodes;
|
|
3280
|
-
if (nodes.length === 0) {
|
|
3281
|
-
return [null, null];
|
|
3282
|
-
}
|
|
3283
|
-
if (nodes.length === 1) {
|
|
3284
|
-
return [nodes[0], null];
|
|
3285
|
-
}
|
|
3286
|
-
return [nodes[0], {
|
|
3287
|
-
type: "path",
|
|
3288
|
-
nodes: nodes.slice(1)
|
|
3289
|
-
}];
|
|
3290
|
-
}
|
|
3291
|
-
function concatPaths(path1, path2) {
|
|
3292
|
-
if (!path1 && !path2) {
|
|
3293
|
-
return null;
|
|
3294
|
-
}
|
|
3295
|
-
const nodes1 = path1 ? path1.nodes : [];
|
|
3296
|
-
const nodes2 = path2 ? path2.nodes : [];
|
|
3297
|
-
return {
|
|
3298
|
-
type: "path",
|
|
3299
|
-
nodes: nodes1.concat(nodes2)
|
|
3300
|
-
};
|
|
3301
|
-
}
|
|
3302
|
-
function spreadIfUnionHead(head, tail) {
|
|
3303
|
-
if (head.type !== "union") {
|
|
3304
|
-
return [[head, tail]];
|
|
3305
|
-
}
|
|
3306
|
-
return head.nodes.map(node => {
|
|
3307
|
-
if (node.type === "path") {
|
|
3308
|
-
const [subHead, subTail] = splitIfPath(node);
|
|
3309
|
-
return [subHead, concatPaths(subTail, tail)];
|
|
3310
|
-
}
|
|
3311
|
-
return [node, tail];
|
|
3312
|
-
});
|
|
3313
|
-
}
|
|
3314
|
-
function toPath(expr) {
|
|
3315
|
-
return toPathInner(expr, false);
|
|
3316
|
-
}
|
|
3317
|
-
function toPathInner(expr, inUnion) {
|
|
3318
|
-
switch (expr.type) {
|
|
3319
|
-
case "attribute":
|
|
3320
|
-
return expr.name;
|
|
3321
|
-
case "alias":
|
|
3322
|
-
return expr.target === "self" ? "@" : "$";
|
|
3323
|
-
case "number":
|
|
3324
|
-
return "".concat(expr.value);
|
|
3325
|
-
case "range":
|
|
3326
|
-
{
|
|
3327
|
-
const result = [];
|
|
3328
|
-
if (!inUnion) {
|
|
3329
|
-
result.push("[");
|
|
3330
|
-
}
|
|
3331
|
-
if (expr.start) {
|
|
3332
|
-
result.push("".concat(expr.start));
|
|
3333
|
-
}
|
|
3334
|
-
result.push(":");
|
|
3335
|
-
if (expr.end) {
|
|
3336
|
-
result.push("".concat(expr.end));
|
|
3337
|
-
}
|
|
3338
|
-
if (expr.step) {
|
|
3339
|
-
result.push(":".concat(expr.step));
|
|
3340
|
-
}
|
|
3341
|
-
if (!inUnion) {
|
|
3342
|
-
result.push("]");
|
|
3343
|
-
}
|
|
3344
|
-
return result.join("");
|
|
3345
|
-
}
|
|
3346
|
-
case "index":
|
|
3347
|
-
if (inUnion) {
|
|
3348
|
-
return "".concat(expr.value);
|
|
3349
|
-
}
|
|
3350
|
-
return "[".concat(expr.value, "]");
|
|
3351
|
-
case "constraint":
|
|
3352
|
-
{
|
|
3353
|
-
const rhs = expr.rhs ? " ".concat(toPathInner(expr.rhs, false)) : "";
|
|
3354
|
-
const inner = "".concat(toPathInner(expr.lhs, false), " ").concat(expr.operator).concat(rhs);
|
|
3355
|
-
if (inUnion) {
|
|
3356
|
-
return inner;
|
|
3357
|
-
}
|
|
3358
|
-
return "[".concat(inner, "]");
|
|
3359
|
-
}
|
|
3360
|
-
case "string":
|
|
3361
|
-
return JSON.stringify(expr.value);
|
|
3362
|
-
case "path":
|
|
3363
|
-
{
|
|
3364
|
-
const result = [];
|
|
3365
|
-
const nodes = expr.nodes.slice();
|
|
3366
|
-
while (nodes.length > 0) {
|
|
3367
|
-
const node = nodes.shift();
|
|
3368
|
-
if (node) {
|
|
3369
|
-
result.push(toPath(node));
|
|
3370
|
-
}
|
|
3371
|
-
const upcoming = nodes[0];
|
|
3372
|
-
if (upcoming && toPathInner(upcoming, false)[0] !== "[") {
|
|
3373
|
-
result.push(".");
|
|
3374
|
-
}
|
|
3375
|
-
}
|
|
3376
|
-
return result.join("");
|
|
3377
|
-
}
|
|
3378
|
-
case "union":
|
|
3379
|
-
return "[".concat(expr.nodes.map(e => toPathInner(e, true)).join(","), "]");
|
|
3380
|
-
default:
|
|
3381
|
-
throw new Error("Unknown node type ".concat(expr.type));
|
|
3382
|
-
case "recursive":
|
|
3383
|
-
return "..".concat(toPathInner(expr.term, false));
|
|
3384
|
-
}
|
|
3385
|
-
}
|
|
3386
|
-
var __defProp$f = Object.defineProperty;
|
|
3387
|
-
var __defNormalProp$f = (obj, key, value) => key in obj ? __defProp$f(obj, key, {
|
|
3388
|
-
enumerable: true,
|
|
3389
|
-
configurable: true,
|
|
3390
|
-
writable: true,
|
|
3391
|
-
value
|
|
3392
|
-
}) : obj[key] = value;
|
|
3393
|
-
var __publicField$f = (obj, key, value) => {
|
|
3394
|
-
__defNormalProp$f(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
3395
|
-
return value;
|
|
3396
|
-
};
|
|
3397
|
-
class Expression {
|
|
3398
|
-
constructor(expr) {
|
|
3399
|
-
__publicField$f(this, "expr");
|
|
3400
|
-
if (!expr) {
|
|
3401
|
-
throw new Error("Attempted to create Expression from null-value");
|
|
3402
|
-
}
|
|
3403
|
-
if ("expr" in expr) {
|
|
3404
|
-
this.expr = expr.expr;
|
|
3405
|
-
} else {
|
|
3406
|
-
this.expr = expr;
|
|
3407
|
-
}
|
|
3408
|
-
if (!("type" in this.expr)) {
|
|
3409
|
-
throw new Error("Attempt to create Expression for expression with no type");
|
|
3410
|
-
}
|
|
3411
|
-
}
|
|
3412
|
-
isPath() {
|
|
3413
|
-
return this.expr.type === "path";
|
|
3414
|
-
}
|
|
3415
|
-
isUnion() {
|
|
3416
|
-
return this.expr.type === "union";
|
|
3417
|
-
}
|
|
3418
|
-
isCollection() {
|
|
3419
|
-
return this.isPath() || this.isUnion();
|
|
3420
|
-
}
|
|
3421
|
-
isConstraint() {
|
|
3422
|
-
return this.expr.type === "constraint";
|
|
3423
|
-
}
|
|
3424
|
-
isRecursive() {
|
|
3425
|
-
return this.expr.type === "recursive";
|
|
3426
|
-
}
|
|
3427
|
-
isExistenceConstraint() {
|
|
3428
|
-
return this.expr.type === "constraint" && this.expr.operator === "?";
|
|
3429
|
-
}
|
|
3430
|
-
isIndex() {
|
|
3431
|
-
return this.expr.type === "index";
|
|
3432
|
-
}
|
|
3433
|
-
isRange() {
|
|
3434
|
-
return this.expr.type === "range";
|
|
3435
|
-
}
|
|
3436
|
-
expandRange(probe) {
|
|
3437
|
-
const probeLength = () => {
|
|
3438
|
-
if (!probe) {
|
|
3439
|
-
throw new Error("expandRange() required a probe that was not passed");
|
|
3440
|
-
}
|
|
3441
|
-
return probe.length();
|
|
3442
|
-
};
|
|
3443
|
-
let start = "start" in this.expr ? this.expr.start || 0 : 0;
|
|
3444
|
-
start = interpretNegativeIndex(start, probe);
|
|
3445
|
-
let end = "end" in this.expr ? this.expr.end || probeLength() : probeLength();
|
|
3446
|
-
end = interpretNegativeIndex(end, probe);
|
|
3447
|
-
const step = "step" in this.expr ? this.expr.step || 1 : 1;
|
|
3448
|
-
return {
|
|
3449
|
-
start,
|
|
3450
|
-
end,
|
|
3451
|
-
step
|
|
3452
|
-
};
|
|
3453
|
-
}
|
|
3454
|
-
isAttributeReference() {
|
|
3455
|
-
return this.expr.type === "attribute";
|
|
3456
|
-
}
|
|
3457
|
-
// Is a range or index -> something referencing indexes
|
|
3458
|
-
isIndexReference() {
|
|
3459
|
-
return this.isIndex() || this.isRange();
|
|
3460
|
-
}
|
|
3461
|
-
name() {
|
|
3462
|
-
return "name" in this.expr ? this.expr.name : "";
|
|
3463
|
-
}
|
|
3464
|
-
isSelfReference() {
|
|
3465
|
-
return this.expr.type === "alias" && this.expr.target === "self";
|
|
3466
|
-
}
|
|
3467
|
-
constraintTargetIsSelf() {
|
|
3468
|
-
return this.expr.type === "constraint" && this.expr.lhs.type === "alias" && this.expr.lhs.target === "self";
|
|
3469
|
-
}
|
|
3470
|
-
constraintTargetIsAttribute() {
|
|
3471
|
-
return this.expr.type === "constraint" && this.expr.lhs.type === "attribute";
|
|
3472
|
-
}
|
|
3473
|
-
testConstraint(probe) {
|
|
3474
|
-
const expr = this.expr;
|
|
3475
|
-
if (expr.type === "constraint" && expr.lhs.type === "alias" && expr.lhs.target === "self") {
|
|
3476
|
-
if (probe.containerType() !== "primitive") {
|
|
3477
|
-
return false;
|
|
3478
|
-
}
|
|
3479
|
-
if (expr.type === "constraint" && expr.operator === "?") {
|
|
3480
|
-
return true;
|
|
3481
|
-
}
|
|
3482
|
-
const lhs2 = probe.get();
|
|
3483
|
-
const rhs2 = expr.rhs && "value" in expr.rhs ? expr.rhs.value : void 0;
|
|
3484
|
-
return testBinaryOperator(lhs2, expr.operator, rhs2);
|
|
3485
|
-
}
|
|
3486
|
-
if (expr.type !== "constraint") {
|
|
3487
|
-
return false;
|
|
3488
|
-
}
|
|
3489
|
-
const lhs = expr.lhs;
|
|
3490
|
-
if (!lhs) {
|
|
3491
|
-
throw new Error("No LHS of expression");
|
|
3492
|
-
}
|
|
3493
|
-
if (lhs.type !== "attribute") {
|
|
3494
|
-
throw new Error("Constraint target ".concat(lhs.type, " not supported"));
|
|
3495
|
-
}
|
|
3496
|
-
if (probe.containerType() !== "object") {
|
|
3497
|
-
return false;
|
|
3498
|
-
}
|
|
3499
|
-
const lhsValue = probe.getAttribute(lhs.name);
|
|
3500
|
-
if (lhsValue === void 0 || lhsValue === null || lhsValue.containerType() !== "primitive") {
|
|
3501
|
-
return false;
|
|
3502
|
-
}
|
|
3503
|
-
if (this.isExistenceConstraint()) {
|
|
3504
|
-
return true;
|
|
3505
|
-
}
|
|
3506
|
-
const rhs = expr.rhs && "value" in expr.rhs ? expr.rhs.value : void 0;
|
|
3507
|
-
return testBinaryOperator(lhsValue.get(), expr.operator, rhs);
|
|
3508
|
-
}
|
|
3509
|
-
pathNodes() {
|
|
3510
|
-
return this.expr.type === "path" ? this.expr.nodes : [this.expr];
|
|
3511
|
-
}
|
|
3512
|
-
prepend(node) {
|
|
3513
|
-
if (!node) {
|
|
3514
|
-
return this;
|
|
3515
|
-
}
|
|
3516
|
-
return new Expression({
|
|
3517
|
-
type: "path",
|
|
3518
|
-
nodes: node.pathNodes().concat(this.pathNodes())
|
|
3519
|
-
});
|
|
3520
|
-
}
|
|
3521
|
-
concat(other) {
|
|
3522
|
-
return other ? other.prepend(this) : this;
|
|
3523
|
-
}
|
|
3524
|
-
descend() {
|
|
3525
|
-
return descend$1(this.expr).map(headTail => {
|
|
3526
|
-
const [head, tail] = headTail;
|
|
3527
|
-
return {
|
|
3528
|
-
head: head ? new Expression(head) : null,
|
|
3529
|
-
tail: tail ? new Expression(tail) : null
|
|
3530
|
-
};
|
|
3531
|
-
});
|
|
3532
|
-
}
|
|
3533
|
-
unwrapRecursive() {
|
|
3534
|
-
if (this.expr.type !== "recursive") {
|
|
3535
|
-
throw new Error("Attempt to unwrap recursive on type ".concat(this.expr.type));
|
|
3536
|
-
}
|
|
3537
|
-
return new Expression(this.expr.term);
|
|
3538
|
-
}
|
|
3539
|
-
toIndicies(probe) {
|
|
3540
|
-
if (this.expr.type !== "index" && this.expr.type !== "range") {
|
|
3541
|
-
throw new Error("Node cannot be converted to indexes");
|
|
3542
|
-
}
|
|
3543
|
-
if (this.expr.type === "index") {
|
|
3544
|
-
return [interpretNegativeIndex(this.expr.value, probe)];
|
|
3545
|
-
}
|
|
3546
|
-
const result = [];
|
|
3547
|
-
const range = this.expandRange(probe);
|
|
3548
|
-
let {
|
|
3549
|
-
start,
|
|
3550
|
-
end
|
|
3551
|
-
} = range;
|
|
3552
|
-
if (range.step < 0) {
|
|
3553
|
-
[start, end] = [end, start];
|
|
3554
|
-
}
|
|
3555
|
-
for (let i = start; i < end; i++) {
|
|
3556
|
-
result.push(i);
|
|
3557
|
-
}
|
|
3558
|
-
return result;
|
|
3559
|
-
}
|
|
3560
|
-
toFieldReferences() {
|
|
3561
|
-
if (this.isIndexReference()) {
|
|
3562
|
-
return this.toIndicies();
|
|
3563
|
-
}
|
|
3564
|
-
if (this.expr.type === "attribute") {
|
|
3565
|
-
return [this.expr.name];
|
|
3566
|
-
}
|
|
3567
|
-
throw new Error("Can't convert ".concat(this.expr.type, " to field references"));
|
|
3568
|
-
}
|
|
3569
|
-
toString() {
|
|
3570
|
-
return toPath(this.expr);
|
|
3571
|
-
}
|
|
3572
|
-
static fromPath(path) {
|
|
3573
|
-
const parsed = parseJsonPath(path);
|
|
3574
|
-
if (!parsed) {
|
|
3575
|
-
throw new Error('Failed to parse path "'.concat(path, '"'));
|
|
3576
|
-
}
|
|
3577
|
-
return new Expression(parsed);
|
|
3578
|
-
}
|
|
3579
|
-
static attributeReference(name) {
|
|
3580
|
-
return new Expression({
|
|
3581
|
-
type: "attribute",
|
|
3582
|
-
name
|
|
3583
|
-
});
|
|
3584
|
-
}
|
|
3585
|
-
static indexReference(i) {
|
|
3586
|
-
return new Expression({
|
|
3587
|
-
type: "index",
|
|
3588
|
-
value: i
|
|
3589
|
-
});
|
|
3590
|
-
}
|
|
3591
|
-
}
|
|
3592
|
-
function testBinaryOperator(lhsValue, operator, rhsValue) {
|
|
3593
|
-
switch (operator) {
|
|
3594
|
-
case ">":
|
|
3595
|
-
return lhsValue > rhsValue;
|
|
3596
|
-
case ">=":
|
|
3597
|
-
return lhsValue >= rhsValue;
|
|
3598
|
-
case "<":
|
|
3599
|
-
return lhsValue < rhsValue;
|
|
3600
|
-
case "<=":
|
|
3601
|
-
return lhsValue <= rhsValue;
|
|
3602
|
-
case "==":
|
|
3603
|
-
return lhsValue === rhsValue;
|
|
3604
|
-
case "!=":
|
|
3605
|
-
return lhsValue !== rhsValue;
|
|
3606
|
-
default:
|
|
3607
|
-
throw new Error("Unsupported binary operator ".concat(operator));
|
|
3608
|
-
}
|
|
3609
|
-
}
|
|
3610
|
-
function interpretNegativeIndex(index, probe) {
|
|
3611
|
-
if (index >= 0) {
|
|
3612
|
-
return index;
|
|
3613
|
-
}
|
|
3614
|
-
if (!probe) {
|
|
3615
|
-
throw new Error("interpretNegativeIndex() must have a probe when < 0");
|
|
3616
|
-
}
|
|
3617
|
-
return index + probe.length();
|
|
3618
|
-
}
|
|
3619
|
-
var __defProp$e = Object.defineProperty;
|
|
3620
|
-
var __defNormalProp$e = (obj, key, value) => key in obj ? __defProp$e(obj, key, {
|
|
3621
|
-
enumerable: true,
|
|
3622
|
-
configurable: true,
|
|
3623
|
-
writable: true,
|
|
3624
|
-
value
|
|
3625
|
-
}) : obj[key] = value;
|
|
3626
|
-
var __publicField$e = (obj, key, value) => {
|
|
3627
|
-
__defNormalProp$e(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
3628
|
-
return value;
|
|
3629
|
-
};
|
|
3630
|
-
class Descender {
|
|
3631
|
-
constructor(head, tail) {
|
|
3632
|
-
__publicField$e(this, "head");
|
|
3633
|
-
__publicField$e(this, "tail");
|
|
3634
|
-
this.head = head;
|
|
3635
|
-
this.tail = tail;
|
|
3636
|
-
}
|
|
3637
|
-
// Iterate this descender once processing any constraints that are
|
|
3638
|
-
// resolvable on the current value. Returns an array of new descenders
|
|
3639
|
-
// that are guaranteed to be without constraints in the head
|
|
3640
|
-
iterate(probe) {
|
|
3641
|
-
let result = [this];
|
|
3642
|
-
if (this.head && this.head.isConstraint()) {
|
|
3643
|
-
let anyConstraints = true;
|
|
3644
|
-
while (anyConstraints) {
|
|
3645
|
-
result = flatten$1(result.map(descender => {
|
|
3646
|
-
return descender.iterateConstraints(probe);
|
|
3647
|
-
}));
|
|
3648
|
-
anyConstraints = result.some(descender => {
|
|
3649
|
-
return descender.head && descender.head.isConstraint();
|
|
3650
|
-
});
|
|
3651
|
-
}
|
|
3652
|
-
}
|
|
3653
|
-
return result;
|
|
3654
|
-
}
|
|
3655
|
-
isRecursive() {
|
|
3656
|
-
return Boolean(this.head && this.head.isRecursive());
|
|
3657
|
-
}
|
|
3658
|
-
hasArrived() {
|
|
3659
|
-
return this.head === null && this.tail === null;
|
|
3660
|
-
}
|
|
3661
|
-
extractRecursives() {
|
|
3662
|
-
if (this.head && this.head.isRecursive()) {
|
|
3663
|
-
const term = this.head.unwrapRecursive();
|
|
3664
|
-
return new Descender(null, term.concat(this.tail)).descend();
|
|
3665
|
-
}
|
|
3666
|
-
return [];
|
|
3667
|
-
}
|
|
3668
|
-
iterateConstraints(probe) {
|
|
3669
|
-
const head = this.head;
|
|
3670
|
-
if (head === null || !head.isConstraint()) {
|
|
3671
|
-
return [this];
|
|
3672
|
-
}
|
|
3673
|
-
const result = [];
|
|
3674
|
-
if (probe.containerType() === "primitive" && head.constraintTargetIsSelf()) {
|
|
3675
|
-
if (head.testConstraint(probe)) {
|
|
3676
|
-
result.push(...this.descend());
|
|
3677
|
-
}
|
|
3678
|
-
return result;
|
|
3679
|
-
}
|
|
3680
|
-
if (probe.containerType() === "array") {
|
|
3681
|
-
const length = probe.length();
|
|
3682
|
-
for (let i = 0; i < length; i++) {
|
|
3683
|
-
const constraint = probe.getIndex(i);
|
|
3684
|
-
if (constraint && head.testConstraint(constraint)) {
|
|
3685
|
-
result.push(new Descender(new Expression({
|
|
3686
|
-
type: "index",
|
|
3687
|
-
value: i
|
|
3688
|
-
}), this.tail));
|
|
3689
|
-
}
|
|
3690
|
-
}
|
|
3691
|
-
return result;
|
|
3692
|
-
}
|
|
3693
|
-
if (probe.containerType() === "object") {
|
|
3694
|
-
if (head.constraintTargetIsSelf()) {
|
|
3695
|
-
return [];
|
|
3696
|
-
}
|
|
3697
|
-
if (head.testConstraint(probe)) {
|
|
3698
|
-
return this.descend();
|
|
3699
|
-
}
|
|
3700
|
-
return result;
|
|
3701
|
-
}
|
|
3702
|
-
return result;
|
|
3703
|
-
}
|
|
3704
|
-
descend() {
|
|
3705
|
-
if (!this.tail) {
|
|
3706
|
-
return [new Descender(null, null)];
|
|
3707
|
-
}
|
|
3708
|
-
return this.tail.descend().map(ht => {
|
|
3709
|
-
return new Descender(ht.head, ht.tail);
|
|
3710
|
-
});
|
|
3711
|
-
}
|
|
3712
|
-
toString() {
|
|
3713
|
-
const result = ["<"];
|
|
3714
|
-
if (this.head) {
|
|
3715
|
-
result.push(this.head.toString());
|
|
3716
|
-
}
|
|
3717
|
-
result.push("|");
|
|
3718
|
-
if (this.tail) {
|
|
3719
|
-
result.push(this.tail.toString());
|
|
3720
|
-
}
|
|
3721
|
-
result.push(">");
|
|
3722
|
-
return result.join("");
|
|
3723
|
-
}
|
|
3724
|
-
}
|
|
3725
|
-
var __defProp$d = Object.defineProperty;
|
|
3726
|
-
var __defNormalProp$d = (obj, key, value) => key in obj ? __defProp$d(obj, key, {
|
|
3727
|
-
enumerable: true,
|
|
3728
|
-
configurable: true,
|
|
3729
|
-
writable: true,
|
|
3730
|
-
value
|
|
3731
|
-
}) : obj[key] = value;
|
|
3732
|
-
var __publicField$d = (obj, key, value) => {
|
|
3733
|
-
__defNormalProp$d(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
3734
|
-
return value;
|
|
3735
|
-
};
|
|
3736
|
-
class Matcher {
|
|
3737
|
-
constructor(active, parent) {
|
|
3738
|
-
__publicField$d(this, "active");
|
|
3739
|
-
__publicField$d(this, "recursives");
|
|
3740
|
-
__publicField$d(this, "payload");
|
|
3741
|
-
this.active = active || [];
|
|
3742
|
-
if (parent) {
|
|
3743
|
-
this.recursives = parent.recursives;
|
|
3744
|
-
this.payload = parent.payload;
|
|
3745
|
-
} else {
|
|
3746
|
-
this.recursives = [];
|
|
3747
|
-
}
|
|
3748
|
-
this.extractRecursives();
|
|
3749
|
-
}
|
|
3750
|
-
setPayload(payload) {
|
|
3751
|
-
this.payload = payload;
|
|
3752
|
-
return this;
|
|
3753
|
-
}
|
|
3754
|
-
// Moves any recursive descenders onto the recursive track, removing them from
|
|
3755
|
-
// the active set
|
|
3756
|
-
extractRecursives() {
|
|
3757
|
-
this.active = this.active.filter(descender => {
|
|
3758
|
-
if (descender.isRecursive()) {
|
|
3759
|
-
this.recursives.push(...descender.extractRecursives());
|
|
3760
|
-
return false;
|
|
3761
|
-
}
|
|
3762
|
-
return true;
|
|
3763
|
-
});
|
|
3764
|
-
}
|
|
3765
|
-
// Find recursives that are relevant now and should be considered part of the active set
|
|
3766
|
-
activeRecursives(probe) {
|
|
3767
|
-
return this.recursives.filter(descender => {
|
|
3768
|
-
const head = descender.head;
|
|
3769
|
-
if (!head) {
|
|
3770
|
-
return false;
|
|
3771
|
-
}
|
|
3772
|
-
if (head.isConstraint()) {
|
|
3773
|
-
return true;
|
|
3774
|
-
}
|
|
3775
|
-
if (probe.containerType() === "array" && head.isIndexReference()) {
|
|
3776
|
-
return true;
|
|
3777
|
-
}
|
|
3778
|
-
if (probe.containerType() === "object") {
|
|
3779
|
-
return head.isAttributeReference() && probe.hasAttribute(head.name());
|
|
3780
|
-
}
|
|
3781
|
-
return false;
|
|
3782
|
-
});
|
|
3783
|
-
}
|
|
3784
|
-
match(probe) {
|
|
3785
|
-
return this.iterate(probe).extractMatches(probe);
|
|
3786
|
-
}
|
|
3787
|
-
iterate(probe) {
|
|
3788
|
-
const newActiveSet = [];
|
|
3789
|
-
this.active.concat(this.activeRecursives(probe)).forEach(descender => {
|
|
3790
|
-
newActiveSet.push(...descender.iterate(probe));
|
|
3791
|
-
});
|
|
3792
|
-
return new Matcher(newActiveSet, this);
|
|
3793
|
-
}
|
|
3794
|
-
// Returns true if any of the descenders in the active or recursive set
|
|
3795
|
-
// consider the current state a final destination
|
|
3796
|
-
isDestination() {
|
|
3797
|
-
return this.active.some(descender => descender.hasArrived());
|
|
3798
|
-
}
|
|
3799
|
-
hasRecursives() {
|
|
3800
|
-
return this.recursives.length > 0;
|
|
3801
|
-
}
|
|
3802
|
-
// Returns any payload delivieries and leads that needs to be followed to complete
|
|
3803
|
-
// the process.
|
|
3804
|
-
extractMatches(probe) {
|
|
3805
|
-
const leads = [];
|
|
3806
|
-
const targets = [];
|
|
3807
|
-
this.active.forEach(descender => {
|
|
3808
|
-
if (descender.hasArrived()) {
|
|
3809
|
-
targets.push(new Expression({
|
|
3810
|
-
type: "alias",
|
|
3811
|
-
target: "self"
|
|
3812
|
-
}));
|
|
3813
|
-
return;
|
|
3814
|
-
}
|
|
3815
|
-
const descenderHead = descender.head;
|
|
3816
|
-
if (!descenderHead) {
|
|
3817
|
-
return;
|
|
3818
|
-
}
|
|
3819
|
-
if (probe.containerType() === "array" && !descenderHead.isIndexReference()) {
|
|
3820
|
-
return;
|
|
3821
|
-
}
|
|
3822
|
-
if (probe.containerType() === "object" && !descenderHead.isAttributeReference()) {
|
|
3823
|
-
return;
|
|
3824
|
-
}
|
|
3825
|
-
if (descender.tail) {
|
|
3826
|
-
const matcher = new Matcher(descender.descend(), this);
|
|
3827
|
-
descenderHead.toFieldReferences().forEach(() => {
|
|
3828
|
-
leads.push({
|
|
3829
|
-
target: descenderHead,
|
|
3830
|
-
matcher
|
|
3831
|
-
});
|
|
3832
|
-
});
|
|
3833
|
-
} else {
|
|
3834
|
-
targets.push(descenderHead);
|
|
3835
|
-
}
|
|
3836
|
-
});
|
|
3837
|
-
if (this.hasRecursives()) {
|
|
3838
|
-
const recursivesMatcher = new Matcher([], this);
|
|
3839
|
-
if (probe.containerType() === "array") {
|
|
3840
|
-
const length = probe.length();
|
|
3841
|
-
for (let i = 0; i < length; i++) {
|
|
3842
|
-
leads.push({
|
|
3843
|
-
target: Expression.indexReference(i),
|
|
3844
|
-
matcher: recursivesMatcher
|
|
3845
|
-
});
|
|
3846
|
-
}
|
|
3847
|
-
} else if (probe.containerType() === "object") {
|
|
3848
|
-
probe.attributeKeys().forEach(name => {
|
|
3849
|
-
leads.push({
|
|
3850
|
-
target: Expression.attributeReference(name),
|
|
3851
|
-
matcher: recursivesMatcher
|
|
3852
|
-
});
|
|
3853
|
-
});
|
|
3854
|
-
}
|
|
3855
|
-
}
|
|
3856
|
-
return targets.length > 0 ? {
|
|
3857
|
-
leads,
|
|
3858
|
-
delivery: {
|
|
3859
|
-
targets,
|
|
3860
|
-
payload: this.payload
|
|
3861
|
-
}
|
|
3862
|
-
} : {
|
|
3863
|
-
leads
|
|
3864
|
-
};
|
|
3865
|
-
}
|
|
3866
|
-
static fromPath(jsonpath) {
|
|
3867
|
-
const path = parseJsonPath(jsonpath);
|
|
3868
|
-
if (!path) {
|
|
3869
|
-
throw new Error('Failed to parse path from "'.concat(jsonpath, '"'));
|
|
3870
|
-
}
|
|
3871
|
-
const descender = new Descender(null, new Expression(path));
|
|
3872
|
-
return new Matcher(descender.descend());
|
|
3873
|
-
}
|
|
3874
|
-
}
|
|
3875
|
-
function isRecord$1(value) {
|
|
3876
|
-
return value !== null && typeof value === "object";
|
|
3877
|
-
}
|
|
3878
|
-
var __defProp$c = Object.defineProperty;
|
|
3879
|
-
var __defNormalProp$c = (obj, key, value) => key in obj ? __defProp$c(obj, key, {
|
|
3880
|
-
enumerable: true,
|
|
3881
|
-
configurable: true,
|
|
3882
|
-
writable: true,
|
|
3883
|
-
value
|
|
3884
|
-
}) : obj[key] = value;
|
|
3885
|
-
var __publicField$c = (obj, key, value) => {
|
|
3886
|
-
__defNormalProp$c(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
3887
|
-
return value;
|
|
3888
|
-
};
|
|
3889
|
-
class PlainProbe {
|
|
3890
|
-
constructor(value, path) {
|
|
3891
|
-
__publicField$c(this, "_value");
|
|
3892
|
-
__publicField$c(this, "path");
|
|
3893
|
-
this._value = value;
|
|
3894
|
-
this.path = path || [];
|
|
3895
|
-
}
|
|
3896
|
-
containerType() {
|
|
3897
|
-
if (Array.isArray(this._value)) {
|
|
3898
|
-
return "array";
|
|
3899
|
-
} else if (this._value !== null && typeof this._value === "object") {
|
|
3900
|
-
return "object";
|
|
3901
|
-
}
|
|
3902
|
-
return "primitive";
|
|
3903
|
-
}
|
|
3904
|
-
length() {
|
|
3905
|
-
if (!Array.isArray(this._value)) {
|
|
3906
|
-
throw new Error("Won't return length of non-indexable _value");
|
|
3907
|
-
}
|
|
3908
|
-
return this._value.length;
|
|
3909
|
-
}
|
|
3910
|
-
getIndex(i) {
|
|
3911
|
-
if (!Array.isArray(this._value)) {
|
|
3912
|
-
return false;
|
|
3913
|
-
}
|
|
3914
|
-
if (i >= this.length()) {
|
|
3915
|
-
return null;
|
|
3916
|
-
}
|
|
3917
|
-
return new PlainProbe(this._value[i], this.path.concat(i));
|
|
3918
|
-
}
|
|
3919
|
-
hasAttribute(key) {
|
|
3920
|
-
if (!isRecord$1(this._value)) {
|
|
3921
|
-
return false;
|
|
3922
|
-
}
|
|
3923
|
-
return this._value.hasOwnProperty(key);
|
|
3924
|
-
}
|
|
3925
|
-
attributeKeys() {
|
|
3926
|
-
return isRecord$1(this._value) ? Object.keys(this._value) : [];
|
|
3927
|
-
}
|
|
3928
|
-
getAttribute(key) {
|
|
3929
|
-
if (!isRecord$1(this._value)) {
|
|
3930
|
-
throw new Error("getAttribute only applies to plain objects");
|
|
3931
|
-
}
|
|
3932
|
-
if (!this.hasAttribute(key)) {
|
|
3933
|
-
return null;
|
|
3934
|
-
}
|
|
3935
|
-
return new PlainProbe(this._value[key], this.path.concat(key));
|
|
3936
|
-
}
|
|
3937
|
-
get() {
|
|
3938
|
-
return this._value;
|
|
3939
|
-
}
|
|
3940
|
-
}
|
|
3941
|
-
function extractAccessors(path, value) {
|
|
3942
|
-
const result = [];
|
|
3943
|
-
const matcher = Matcher.fromPath(path).setPayload(function appendResult(values) {
|
|
3944
|
-
result.push(...values);
|
|
3945
|
-
});
|
|
3946
|
-
const accessor = new PlainProbe(value);
|
|
3947
|
-
descend(matcher, accessor);
|
|
3948
|
-
return result;
|
|
3949
|
-
}
|
|
3950
|
-
function descend(matcher, accessor) {
|
|
3951
|
-
const {
|
|
3952
|
-
leads,
|
|
3953
|
-
delivery
|
|
3954
|
-
} = matcher.match(accessor);
|
|
3955
|
-
leads.forEach(lead => {
|
|
3956
|
-
accessorsFromTarget(lead.target, accessor).forEach(childAccessor => {
|
|
3957
|
-
descend(lead.matcher, childAccessor);
|
|
3958
|
-
});
|
|
3959
|
-
});
|
|
3960
|
-
if (delivery) {
|
|
3961
|
-
delivery.targets.forEach(target => {
|
|
3962
|
-
if (typeof delivery.payload === "function") {
|
|
3963
|
-
delivery.payload(accessorsFromTarget(target, accessor));
|
|
3964
|
-
}
|
|
3965
|
-
});
|
|
3966
|
-
}
|
|
3967
|
-
}
|
|
3968
|
-
function accessorsFromTarget(target, accessor) {
|
|
3969
|
-
const result = [];
|
|
3970
|
-
if (target.isIndexReference()) {
|
|
3971
|
-
target.toIndicies(accessor).forEach(i => {
|
|
3972
|
-
result.push(accessor.getIndex(i));
|
|
3973
|
-
});
|
|
3974
|
-
} else if (target.isAttributeReference()) {
|
|
3975
|
-
result.push(accessor.getAttribute(target.name()));
|
|
3976
|
-
} else if (target.isSelfReference()) {
|
|
3977
|
-
result.push(accessor);
|
|
3978
|
-
} else {
|
|
3979
|
-
throw new Error("Unable to derive accessor for target ".concat(target.toString()));
|
|
3980
|
-
}
|
|
3981
|
-
return compact$1(result);
|
|
3982
|
-
}
|
|
3983
|
-
function extractWithPath(path, value) {
|
|
3984
|
-
const accessors = extractAccessors(path, value);
|
|
3985
|
-
return accessors.map(acc => ({
|
|
3986
|
-
path: acc.path,
|
|
3987
|
-
value: acc.get()
|
|
3988
|
-
}));
|
|
3989
|
-
}
|
|
3990
|
-
debugIt("mutator-document");
|
|
3991
510
|
const maxDepth = 6;
|
|
3992
511
|
function getTypeIcon(schemaType) {
|
|
3993
512
|
let t = schemaType;
|
|
@@ -4375,7 +894,7 @@ function TaskList(props) {
|
|
|
4375
894
|
onEscape();
|
|
4376
895
|
}
|
|
4377
896
|
}, [isTopLayer, onEscape]));
|
|
4378
|
-
return /* @__PURE__ */jsx(Stack
|
|
897
|
+
return /* @__PURE__ */jsx(Stack, {
|
|
4379
898
|
padding: 1,
|
|
4380
899
|
space: 1,
|
|
4381
900
|
children: tasks.map(task => /* @__PURE__ */jsx(TaskItem, {
|
|
@@ -4406,7 +925,7 @@ function TaskItem(props) {
|
|
|
4406
925
|
size: 1,
|
|
4407
926
|
children: [taskType && createElement(taskType.icon), !task.reason && /* @__PURE__ */jsx(Spinner, {})]
|
|
4408
927
|
})
|
|
4409
|
-
}), /* @__PURE__ */jsxs(Stack
|
|
928
|
+
}), /* @__PURE__ */jsxs(Stack, {
|
|
4410
929
|
flex: 1,
|
|
4411
930
|
space: 2,
|
|
4412
931
|
children: [/* @__PURE__ */jsxs(Text, {
|
|
@@ -4748,7 +1267,7 @@ function RunInstructionProvider(props) {
|
|
|
4748
1267
|
})
|
|
4749
1268
|
}) : runButton
|
|
4750
1269
|
}),
|
|
4751
|
-
children: /* @__PURE__ */jsx(Stack
|
|
1270
|
+
children: /* @__PURE__ */jsx(Stack, {
|
|
4752
1271
|
padding: 4,
|
|
4753
1272
|
space: 2,
|
|
4754
1273
|
children: (_a = runRequest == null ? void 0 : runRequest.userInputBlocks) == null ? void 0 : _a.map((block, i) => /* @__PURE__ */jsx(UserInput, {
|
|
@@ -4790,7 +1309,7 @@ function UserInput(props) {
|
|
|
4790
1309
|
return (_a2 = textAreaRef.current) == null ? void 0 : _a2.focus();
|
|
4791
1310
|
}, 0);
|
|
4792
1311
|
}, [autoFocus]);
|
|
4793
|
-
return /* @__PURE__ */jsxs(Stack
|
|
1312
|
+
return /* @__PURE__ */jsxs(Stack, {
|
|
4794
1313
|
padding: 2,
|
|
4795
1314
|
space: 3,
|
|
4796
1315
|
children: [/* @__PURE__ */jsx(FormFieldHeaderText, {
|
|
@@ -4852,7 +1371,7 @@ function InspectorOnboarding(props) {
|
|
|
4852
1371
|
padding: 4,
|
|
4853
1372
|
children: /* @__PURE__ */jsx(Container, {
|
|
4854
1373
|
width: 0,
|
|
4855
|
-
children: /* @__PURE__ */jsxs(Stack
|
|
1374
|
+
children: /* @__PURE__ */jsxs(Stack, {
|
|
4856
1375
|
space: 4,
|
|
4857
1376
|
children: [/* @__PURE__ */jsx("div", {
|
|
4858
1377
|
style: {
|
|
@@ -5023,7 +1542,7 @@ function AssistDocumentForm(props) {
|
|
|
5023
1542
|
}, [activePath, instruction, onPathOpen]);
|
|
5024
1543
|
return /* @__PURE__ */jsx(SelectedFieldContextProvider, {
|
|
5025
1544
|
value: context,
|
|
5026
|
-
children: /* @__PURE__ */jsxs(Stack
|
|
1545
|
+
children: /* @__PURE__ */jsxs(Stack, {
|
|
5027
1546
|
space: 5,
|
|
5028
1547
|
children: [/* @__PURE__ */jsx(FieldsInitializer, {
|
|
5029
1548
|
pathKey: typePath,
|
|
@@ -5239,7 +1758,7 @@ function AssistInspectorWrapper(props) {
|
|
|
5239
1758
|
justify: "center",
|
|
5240
1759
|
padding: 4,
|
|
5241
1760
|
sizing: "border",
|
|
5242
|
-
children: /* @__PURE__ */jsxs(Stack
|
|
1761
|
+
children: /* @__PURE__ */jsxs(Stack, {
|
|
5243
1762
|
space: 3,
|
|
5244
1763
|
style: {
|
|
5245
1764
|
textAlign: "center"
|
|
@@ -5263,7 +1782,7 @@ function AssistInspectorWrapper(props) {
|
|
|
5263
1782
|
closeButtonLabel: "Close",
|
|
5264
1783
|
onClose: props.onClose,
|
|
5265
1784
|
title: pluginTitle
|
|
5266
|
-
}), /* @__PURE__ */jsxs(Stack
|
|
1785
|
+
}), /* @__PURE__ */jsxs(Stack, {
|
|
5267
1786
|
flex: 1,
|
|
5268
1787
|
overflow: "auto",
|
|
5269
1788
|
padding: 4,
|
|
@@ -5300,7 +1819,7 @@ function AssistInspectorWrapper(props) {
|
|
|
5300
1819
|
closeButtonLabel: "Close",
|
|
5301
1820
|
onClose: props.onClose,
|
|
5302
1821
|
title: pluginTitle
|
|
5303
|
-
}), /* @__PURE__ */jsxs(Stack
|
|
1822
|
+
}), /* @__PURE__ */jsxs(Stack, {
|
|
5304
1823
|
padding: 4,
|
|
5305
1824
|
space: 3,
|
|
5306
1825
|
children: [context.error ? /* @__PURE__ */jsxs(Text, {
|
|
@@ -5512,7 +2031,7 @@ function AssistInspector(props) {
|
|
|
5512
2031
|
gap: 2,
|
|
5513
2032
|
flex: 1,
|
|
5514
2033
|
justify: "flex-end",
|
|
5515
|
-
children: [(schemaType == null ? void 0 : schemaType.name) && pathKey && instructionKey && /* @__PURE__ */jsx(Stack
|
|
2034
|
+
children: [(schemaType == null ? void 0 : schemaType.name) && pathKey && instructionKey && /* @__PURE__ */jsx(Stack, {
|
|
5516
2035
|
flex: 1,
|
|
5517
2036
|
children: /* @__PURE__ */jsx(Button, {
|
|
5518
2037
|
mode: "ghost",
|
|
@@ -5864,11 +2383,11 @@ function AssistOnboardingPopover(props) {
|
|
|
5864
2383
|
}
|
|
5865
2384
|
function AssistIntroCard(props) {
|
|
5866
2385
|
const buttonRef = useRef(null);
|
|
5867
|
-
return /* @__PURE__ */jsxs(Stack
|
|
2386
|
+
return /* @__PURE__ */jsxs(Stack, {
|
|
5868
2387
|
as: "section",
|
|
5869
2388
|
padding: 3,
|
|
5870
2389
|
space: 3,
|
|
5871
|
-
children: [/* @__PURE__ */jsxs(Stack
|
|
2390
|
+
children: [/* @__PURE__ */jsxs(Stack, {
|
|
5872
2391
|
padding: 2,
|
|
5873
2392
|
space: 4,
|
|
5874
2393
|
children: [/* @__PURE__ */jsxs(Flex, {
|
|
@@ -5887,7 +2406,7 @@ function AssistIntroCard(props) {
|
|
|
5887
2406
|
},
|
|
5888
2407
|
children: /* @__PURE__ */jsx(AssistFeatureBadge, {})
|
|
5889
2408
|
})]
|
|
5890
|
-
}), /* @__PURE__ */jsx(Stack
|
|
2409
|
+
}), /* @__PURE__ */jsx(Stack, {
|
|
5891
2410
|
space: 3,
|
|
5892
2411
|
children: /* @__PURE__ */jsxs(Text, {
|
|
5893
2412
|
as: "p",
|
|
@@ -6511,7 +3030,7 @@ function AlphaMigration() {
|
|
|
6511
3030
|
header: pluginTitle,
|
|
6512
3031
|
children: /* @__PURE__ */jsx(Card, {
|
|
6513
3032
|
padding: 3,
|
|
6514
|
-
children: /* @__PURE__ */jsxs(Stack
|
|
3033
|
+
children: /* @__PURE__ */jsxs(Stack, {
|
|
6515
3034
|
space: 4,
|
|
6516
3035
|
style: {
|
|
6517
3036
|
maxWidth: 500
|
|
@@ -6726,7 +3245,7 @@ function ErrorWrapper(props) {
|
|
|
6726
3245
|
tone: "critical",
|
|
6727
3246
|
padding: 2,
|
|
6728
3247
|
contentEditable: false,
|
|
6729
|
-
children: /* @__PURE__ */jsxs(Stack
|
|
3248
|
+
children: /* @__PURE__ */jsxs(Stack, {
|
|
6730
3249
|
space: 3,
|
|
6731
3250
|
children: [/* @__PURE__ */jsx(Text, {
|
|
6732
3251
|
muted: true,
|
|
@@ -6831,7 +3350,7 @@ function findFieldsetMember(members, fieldsetName) {
|
|
|
6831
3350
|
return members.find(m => m.kind === "fieldSet" && m.fieldSet.name === fieldsetName);
|
|
6832
3351
|
}
|
|
6833
3352
|
function InstructionInput(props) {
|
|
6834
|
-
return /* @__PURE__ */jsxs(Stack
|
|
3353
|
+
return /* @__PURE__ */jsxs(Stack, {
|
|
6835
3354
|
space: [4, 4, 4, 5],
|
|
6836
3355
|
children: [/* @__PURE__ */jsx(NameField, {
|
|
6837
3356
|
...props
|
|
@@ -6876,9 +3395,9 @@ function NameField(props) {
|
|
|
6876
3395
|
}
|
|
6877
3396
|
};
|
|
6878
3397
|
}, [titleMember, titlePlaceholder]);
|
|
6879
|
-
return /* @__PURE__ */jsx(Stack
|
|
3398
|
+
return /* @__PURE__ */jsx(Stack, {
|
|
6880
3399
|
space: 5,
|
|
6881
|
-
children: /* @__PURE__ */jsxs(Stack
|
|
3400
|
+
children: /* @__PURE__ */jsxs(Stack, {
|
|
6882
3401
|
space: 2,
|
|
6883
3402
|
children: [/* @__PURE__ */jsx(Flex, {
|
|
6884
3403
|
gap: 1,
|
|
@@ -7491,7 +4010,7 @@ const instruction = defineType({
|
|
|
7491
4010
|
size: 1,
|
|
7492
4011
|
children: createElement(props.icon)
|
|
7493
4012
|
})
|
|
7494
|
-
}), /* @__PURE__ */jsx(Stack
|
|
4013
|
+
}), /* @__PURE__ */jsx(Stack, {
|
|
7495
4014
|
flex: 1,
|
|
7496
4015
|
space: 2,
|
|
7497
4016
|
children: /* @__PURE__ */jsx(Text, {
|
|
@@ -7610,7 +4129,7 @@ const fieldInstructions = defineType({
|
|
|
7610
4129
|
});
|
|
7611
4130
|
const assistDocumentSchema = defineType({
|
|
7612
4131
|
//NOTE: this is a document type. Using object here ensures it does not appear in structure menus
|
|
7613
|
-
type: "
|
|
4132
|
+
type: "object",
|
|
7614
4133
|
//workaround for using object and not document
|
|
7615
4134
|
...{
|
|
7616
4135
|
liveEdit: true
|