@bigbinary/neeto-commons-frontend 2.1.8 → 2.1.10

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.
@@ -12,8 +12,9 @@ var reactRouterDom = require('react-router-dom');
12
12
  var pure = require('@bigbinary/neeto-commons-frontend/pure');
13
13
  var reactUtils = require('@bigbinary/neeto-commons-frontend/react-utils');
14
14
  var axios = require('axios');
15
- var utils = require('@bigbinary/neeto-commons-frontend/utils');
15
+ var utils$3 = require('@bigbinary/neeto-commons-frontend/utils');
16
16
  var reactQuery = require('react-query');
17
+ var require$$0 = require('util');
17
18
  var reactHelmet = require('react-helmet');
18
19
 
19
20
  function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
@@ -40,6 +41,7 @@ var React__namespace = /*#__PURE__*/_interopNamespace(React);
40
41
  var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
41
42
  var ErrorPage__default = /*#__PURE__*/_interopDefaultLegacy(ErrorPage);
42
43
  var axios__default = /*#__PURE__*/_interopDefaultLegacy(axios);
44
+ var require$$0__default = /*#__PURE__*/_interopDefaultLegacy(require$$0);
43
45
 
44
46
  var IGNORABLE_ERRORS_REGEX = /(window\.requestAnimationFrame|ResizeObserver|ChunkLoadError|window\.webkit\.messageHandlers|Request aborted|Network Error)/;
45
47
 
@@ -286,31 +288,31 @@ var QUERY_KEYS = {
286
288
  var QUERY_CACHE_NAME_SPACE = "queryCache";
287
289
  var NEETO_APPS_LIST_STALE_TIME = 30 * 24 * 60 * 60 * 1000; // 30 days
288
290
 
289
- function ownKeys$2(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
290
- function _objectSpread$2(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys$2(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys$2(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
291
+ function ownKeys$3(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
292
+ function _objectSpread$3(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys$3(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys$3(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
291
293
  var useFetchNeetoApps = function useFetchNeetoApps(options) {
292
294
  var _globalProps$user;
293
295
  var scopedQueryKey = "".concat(QUERY_KEYS.NEETO_APPS_LIST, "-").concat((_globalProps$user = globalProps.user) === null || _globalProps$user === void 0 ? void 0 : _globalProps$user.id);
294
296
  var neetoApps = reactUtils.usePersistedQuery.getCache(scopedQueryKey);
295
- return reactUtils.usePersistedQuery(scopedQueryKey, neetoAppsApi.fetch, _objectSpread$2({
297
+ return reactUtils.usePersistedQuery(scopedQueryKey, neetoAppsApi.fetch, _objectSpread$3({
296
298
  staleTime: NEETO_APPS_LIST_STALE_TIME,
297
299
  enabled: pure.isNotPresent(neetoApps === null || neetoApps === void 0 ? void 0 : neetoApps.data)
298
300
  }, options));
299
301
  };
300
302
 
301
- function ownKeys$1(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
302
- function _objectSpread$1(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys$1(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys$1(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
303
+ function ownKeys$2(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
304
+ function _objectSpread$2(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys$2(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys$2(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
303
305
  var localStorageQueryCache = {
304
306
  set: function set(key, data) {
305
307
  var cache = localStorageQueryCache.getAll();
306
- var newCache = _objectSpread$1(_objectSpread$1({}, cache), {}, _defineProperty({}, key, {
308
+ var newCache = _objectSpread$2(_objectSpread$2({}, cache), {}, _defineProperty({}, key, {
307
309
  data: data,
308
310
  modifiedAt: Date.now()
309
311
  }));
310
312
  localStorage.setItem(QUERY_CACHE_NAME_SPACE, JSON.stringify(newCache));
311
313
  },
312
314
  getAll: function getAll() {
313
- var cache = utils.getFromLocalStorage(QUERY_CACHE_NAME_SPACE);
315
+ var cache = utils$3.getFromLocalStorage(QUERY_CACHE_NAME_SPACE);
314
316
  if (!cache) return {};
315
317
  return cache;
316
318
  },
@@ -331,11 +333,11 @@ var usePersistedQuery = function usePersistedQuery(queryKey, fetch, options) {
331
333
  localStorageQueryCache.set(queryKey, queryResult.data);
332
334
  }, [queryKey, queryResult.data, queryResult.isSuccess]);
333
335
  if (isOutdated(localCache, options === null || options === void 0 ? void 0 : options.staleTime)) {
334
- return _objectSpread$1(_objectSpread$1({}, queryResult), {}, {
336
+ return _objectSpread$2(_objectSpread$2({}, queryResult), {}, {
335
337
  isFreshLoading: queryResult.isLoading
336
338
  });
337
339
  }
338
- return _objectSpread$1(_objectSpread$1({}, queryResult), {}, {
340
+ return _objectSpread$2(_objectSpread$2({}, queryResult), {}, {
339
341
  data: queryResult.data || localCache.data,
340
342
  isFreshLoading: false
341
343
  });
@@ -3423,6 +3425,9 @@ var useHotKeys = function useHotKeys(hotkey, handler, userConfig) {
3423
3425
  var ref = React.useRef(null);
3424
3426
  var convertedHotkey = convertHotkeyToUsersPlatform(hotkey);
3425
3427
  var config = ramda.mergeLeft(userConfig, DEFAULT_CONFIG);
3428
+ if (!handler) {
3429
+ throw new Error("You must provide a handler function to useHotKeys");
3430
+ }
3426
3431
  React.useEffect(function () {
3427
3432
  if (!config.enabled) return undefined;
3428
3433
  var mousetrapInstance = bindHotKey({
@@ -3594,15 +3599,15 @@ var useLocalStorage = function useLocalStorage(key, defaultValue) {
3594
3599
 
3595
3600
  var _excluded = ["keysToInvalidate"],
3596
3601
  _excluded2 = ["onSuccess"];
3597
- function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
3598
- function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
3602
+ function ownKeys$1(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
3603
+ function _objectSpread$1(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys$1(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys$1(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
3599
3604
  var useMutationWithInvalidation = function useMutationWithInvalidation(mutationFn, _ref) {
3600
3605
  var keysToInvalidate = _ref.keysToInvalidate,
3601
3606
  options = _objectWithoutProperties(_ref, _excluded);
3602
3607
  var queryClient = reactQuery.useQueryClient();
3603
3608
  var _onSuccess = options.onSuccess,
3604
3609
  otherOptions = _objectWithoutProperties(options, _excluded2);
3605
- return reactQuery.useMutation(mutationFn, _objectSpread({
3610
+ return reactQuery.useMutation(mutationFn, _objectSpread$1({
3606
3611
  onSuccess: function onSuccess(data, variables, context) {
3607
3612
  keysToInvalidate.forEach(function (key) {
3608
3613
  var keyToInvalidate = typeof key === "function" ? key(data, variables, context) : key;
@@ -3639,6 +3644,2048 @@ var usePrevious = function usePrevious(value) {
3639
3644
  return ref.current;
3640
3645
  };
3641
3646
 
3647
+ /* eslint complexity: [2, 18], max-statements: [2, 33] */
3648
+ var shams = function hasSymbols() {
3649
+ if (typeof Symbol !== 'function' || typeof Object.getOwnPropertySymbols !== 'function') { return false; }
3650
+ if (typeof Symbol.iterator === 'symbol') { return true; }
3651
+
3652
+ var obj = {};
3653
+ var sym = Symbol('test');
3654
+ var symObj = Object(sym);
3655
+ if (typeof sym === 'string') { return false; }
3656
+
3657
+ if (Object.prototype.toString.call(sym) !== '[object Symbol]') { return false; }
3658
+ if (Object.prototype.toString.call(symObj) !== '[object Symbol]') { return false; }
3659
+
3660
+ // temp disabled per https://github.com/ljharb/object.assign/issues/17
3661
+ // if (sym instanceof Symbol) { return false; }
3662
+ // temp disabled per https://github.com/WebReflection/get-own-property-symbols/issues/4
3663
+ // if (!(symObj instanceof Symbol)) { return false; }
3664
+
3665
+ // if (typeof Symbol.prototype.toString !== 'function') { return false; }
3666
+ // if (String(sym) !== Symbol.prototype.toString.call(sym)) { return false; }
3667
+
3668
+ var symVal = 42;
3669
+ obj[sym] = symVal;
3670
+ for (sym in obj) { return false; } // eslint-disable-line no-restricted-syntax, no-unreachable-loop
3671
+ if (typeof Object.keys === 'function' && Object.keys(obj).length !== 0) { return false; }
3672
+
3673
+ if (typeof Object.getOwnPropertyNames === 'function' && Object.getOwnPropertyNames(obj).length !== 0) { return false; }
3674
+
3675
+ var syms = Object.getOwnPropertySymbols(obj);
3676
+ if (syms.length !== 1 || syms[0] !== sym) { return false; }
3677
+
3678
+ if (!Object.prototype.propertyIsEnumerable.call(obj, sym)) { return false; }
3679
+
3680
+ if (typeof Object.getOwnPropertyDescriptor === 'function') {
3681
+ var descriptor = Object.getOwnPropertyDescriptor(obj, sym);
3682
+ if (descriptor.value !== symVal || descriptor.enumerable !== true) { return false; }
3683
+ }
3684
+
3685
+ return true;
3686
+ };
3687
+
3688
+ var origSymbol = typeof Symbol !== 'undefined' && Symbol;
3689
+ var hasSymbolSham = shams;
3690
+
3691
+ var hasSymbols$1 = function hasNativeSymbols() {
3692
+ if (typeof origSymbol !== 'function') { return false; }
3693
+ if (typeof Symbol !== 'function') { return false; }
3694
+ if (typeof origSymbol('foo') !== 'symbol') { return false; }
3695
+ if (typeof Symbol('bar') !== 'symbol') { return false; }
3696
+
3697
+ return hasSymbolSham();
3698
+ };
3699
+
3700
+ /* eslint no-invalid-this: 1 */
3701
+
3702
+ var ERROR_MESSAGE = 'Function.prototype.bind called on incompatible ';
3703
+ var slice = Array.prototype.slice;
3704
+ var toStr$1 = Object.prototype.toString;
3705
+ var funcType = '[object Function]';
3706
+
3707
+ var implementation$1 = function bind(that) {
3708
+ var target = this;
3709
+ if (typeof target !== 'function' || toStr$1.call(target) !== funcType) {
3710
+ throw new TypeError(ERROR_MESSAGE + target);
3711
+ }
3712
+ var args = slice.call(arguments, 1);
3713
+
3714
+ var bound;
3715
+ var binder = function () {
3716
+ if (this instanceof bound) {
3717
+ var result = target.apply(
3718
+ this,
3719
+ args.concat(slice.call(arguments))
3720
+ );
3721
+ if (Object(result) === result) {
3722
+ return result;
3723
+ }
3724
+ return this;
3725
+ } else {
3726
+ return target.apply(
3727
+ that,
3728
+ args.concat(slice.call(arguments))
3729
+ );
3730
+ }
3731
+ };
3732
+
3733
+ var boundLength = Math.max(0, target.length - args.length);
3734
+ var boundArgs = [];
3735
+ for (var i = 0; i < boundLength; i++) {
3736
+ boundArgs.push('$' + i);
3737
+ }
3738
+
3739
+ bound = Function('binder', 'return function (' + boundArgs.join(',') + '){ return binder.apply(this,arguments); }')(binder);
3740
+
3741
+ if (target.prototype) {
3742
+ var Empty = function Empty() {};
3743
+ Empty.prototype = target.prototype;
3744
+ bound.prototype = new Empty();
3745
+ Empty.prototype = null;
3746
+ }
3747
+
3748
+ return bound;
3749
+ };
3750
+
3751
+ var implementation = implementation$1;
3752
+
3753
+ var functionBind = Function.prototype.bind || implementation;
3754
+
3755
+ var bind$1 = functionBind;
3756
+
3757
+ var src = bind$1.call(Function.call, Object.prototype.hasOwnProperty);
3758
+
3759
+ var undefined$1;
3760
+
3761
+ var $SyntaxError = SyntaxError;
3762
+ var $Function = Function;
3763
+ var $TypeError$1 = TypeError;
3764
+
3765
+ // eslint-disable-next-line consistent-return
3766
+ var getEvalledConstructor = function (expressionSyntax) {
3767
+ try {
3768
+ return $Function('"use strict"; return (' + expressionSyntax + ').constructor;')();
3769
+ } catch (e) {}
3770
+ };
3771
+
3772
+ var $gOPD = Object.getOwnPropertyDescriptor;
3773
+ if ($gOPD) {
3774
+ try {
3775
+ $gOPD({}, '');
3776
+ } catch (e) {
3777
+ $gOPD = null; // this is IE 8, which has a broken gOPD
3778
+ }
3779
+ }
3780
+
3781
+ var throwTypeError = function () {
3782
+ throw new $TypeError$1();
3783
+ };
3784
+ var ThrowTypeError = $gOPD
3785
+ ? (function () {
3786
+ try {
3787
+ // eslint-disable-next-line no-unused-expressions, no-caller, no-restricted-properties
3788
+ arguments.callee; // IE 8 does not throw here
3789
+ return throwTypeError;
3790
+ } catch (calleeThrows) {
3791
+ try {
3792
+ // IE 8 throws on Object.getOwnPropertyDescriptor(arguments, '')
3793
+ return $gOPD(arguments, 'callee').get;
3794
+ } catch (gOPDthrows) {
3795
+ return throwTypeError;
3796
+ }
3797
+ }
3798
+ }())
3799
+ : throwTypeError;
3800
+
3801
+ var hasSymbols = hasSymbols$1();
3802
+
3803
+ var getProto = Object.getPrototypeOf || function (x) { return x.__proto__; }; // eslint-disable-line no-proto
3804
+
3805
+ var needsEval = {};
3806
+
3807
+ var TypedArray = typeof Uint8Array === 'undefined' ? undefined$1 : getProto(Uint8Array);
3808
+
3809
+ var INTRINSICS = {
3810
+ '%AggregateError%': typeof AggregateError === 'undefined' ? undefined$1 : AggregateError,
3811
+ '%Array%': Array,
3812
+ '%ArrayBuffer%': typeof ArrayBuffer === 'undefined' ? undefined$1 : ArrayBuffer,
3813
+ '%ArrayIteratorPrototype%': hasSymbols ? getProto([][Symbol.iterator]()) : undefined$1,
3814
+ '%AsyncFromSyncIteratorPrototype%': undefined$1,
3815
+ '%AsyncFunction%': needsEval,
3816
+ '%AsyncGenerator%': needsEval,
3817
+ '%AsyncGeneratorFunction%': needsEval,
3818
+ '%AsyncIteratorPrototype%': needsEval,
3819
+ '%Atomics%': typeof Atomics === 'undefined' ? undefined$1 : Atomics,
3820
+ '%BigInt%': typeof BigInt === 'undefined' ? undefined$1 : BigInt,
3821
+ '%BigInt64Array%': typeof BigInt64Array === 'undefined' ? undefined$1 : BigInt64Array,
3822
+ '%BigUint64Array%': typeof BigUint64Array === 'undefined' ? undefined$1 : BigUint64Array,
3823
+ '%Boolean%': Boolean,
3824
+ '%DataView%': typeof DataView === 'undefined' ? undefined$1 : DataView,
3825
+ '%Date%': Date,
3826
+ '%decodeURI%': decodeURI,
3827
+ '%decodeURIComponent%': decodeURIComponent,
3828
+ '%encodeURI%': encodeURI,
3829
+ '%encodeURIComponent%': encodeURIComponent,
3830
+ '%Error%': Error,
3831
+ '%eval%': eval, // eslint-disable-line no-eval
3832
+ '%EvalError%': EvalError,
3833
+ '%Float32Array%': typeof Float32Array === 'undefined' ? undefined$1 : Float32Array,
3834
+ '%Float64Array%': typeof Float64Array === 'undefined' ? undefined$1 : Float64Array,
3835
+ '%FinalizationRegistry%': typeof FinalizationRegistry === 'undefined' ? undefined$1 : FinalizationRegistry,
3836
+ '%Function%': $Function,
3837
+ '%GeneratorFunction%': needsEval,
3838
+ '%Int8Array%': typeof Int8Array === 'undefined' ? undefined$1 : Int8Array,
3839
+ '%Int16Array%': typeof Int16Array === 'undefined' ? undefined$1 : Int16Array,
3840
+ '%Int32Array%': typeof Int32Array === 'undefined' ? undefined$1 : Int32Array,
3841
+ '%isFinite%': isFinite,
3842
+ '%isNaN%': isNaN,
3843
+ '%IteratorPrototype%': hasSymbols ? getProto(getProto([][Symbol.iterator]())) : undefined$1,
3844
+ '%JSON%': typeof JSON === 'object' ? JSON : undefined$1,
3845
+ '%Map%': typeof Map === 'undefined' ? undefined$1 : Map,
3846
+ '%MapIteratorPrototype%': typeof Map === 'undefined' || !hasSymbols ? undefined$1 : getProto(new Map()[Symbol.iterator]()),
3847
+ '%Math%': Math,
3848
+ '%Number%': Number,
3849
+ '%Object%': Object,
3850
+ '%parseFloat%': parseFloat,
3851
+ '%parseInt%': parseInt,
3852
+ '%Promise%': typeof Promise === 'undefined' ? undefined$1 : Promise,
3853
+ '%Proxy%': typeof Proxy === 'undefined' ? undefined$1 : Proxy,
3854
+ '%RangeError%': RangeError,
3855
+ '%ReferenceError%': ReferenceError,
3856
+ '%Reflect%': typeof Reflect === 'undefined' ? undefined$1 : Reflect,
3857
+ '%RegExp%': RegExp,
3858
+ '%Set%': typeof Set === 'undefined' ? undefined$1 : Set,
3859
+ '%SetIteratorPrototype%': typeof Set === 'undefined' || !hasSymbols ? undefined$1 : getProto(new Set()[Symbol.iterator]()),
3860
+ '%SharedArrayBuffer%': typeof SharedArrayBuffer === 'undefined' ? undefined$1 : SharedArrayBuffer,
3861
+ '%String%': String,
3862
+ '%StringIteratorPrototype%': hasSymbols ? getProto(''[Symbol.iterator]()) : undefined$1,
3863
+ '%Symbol%': hasSymbols ? Symbol : undefined$1,
3864
+ '%SyntaxError%': $SyntaxError,
3865
+ '%ThrowTypeError%': ThrowTypeError,
3866
+ '%TypedArray%': TypedArray,
3867
+ '%TypeError%': $TypeError$1,
3868
+ '%Uint8Array%': typeof Uint8Array === 'undefined' ? undefined$1 : Uint8Array,
3869
+ '%Uint8ClampedArray%': typeof Uint8ClampedArray === 'undefined' ? undefined$1 : Uint8ClampedArray,
3870
+ '%Uint16Array%': typeof Uint16Array === 'undefined' ? undefined$1 : Uint16Array,
3871
+ '%Uint32Array%': typeof Uint32Array === 'undefined' ? undefined$1 : Uint32Array,
3872
+ '%URIError%': URIError,
3873
+ '%WeakMap%': typeof WeakMap === 'undefined' ? undefined$1 : WeakMap,
3874
+ '%WeakRef%': typeof WeakRef === 'undefined' ? undefined$1 : WeakRef,
3875
+ '%WeakSet%': typeof WeakSet === 'undefined' ? undefined$1 : WeakSet
3876
+ };
3877
+
3878
+ try {
3879
+ null.error; // eslint-disable-line no-unused-expressions
3880
+ } catch (e) {
3881
+ // https://github.com/tc39/proposal-shadowrealm/pull/384#issuecomment-1364264229
3882
+ var errorProto = getProto(getProto(e));
3883
+ INTRINSICS['%Error.prototype%'] = errorProto;
3884
+ }
3885
+
3886
+ var doEval = function doEval(name) {
3887
+ var value;
3888
+ if (name === '%AsyncFunction%') {
3889
+ value = getEvalledConstructor('async function () {}');
3890
+ } else if (name === '%GeneratorFunction%') {
3891
+ value = getEvalledConstructor('function* () {}');
3892
+ } else if (name === '%AsyncGeneratorFunction%') {
3893
+ value = getEvalledConstructor('async function* () {}');
3894
+ } else if (name === '%AsyncGenerator%') {
3895
+ var fn = doEval('%AsyncGeneratorFunction%');
3896
+ if (fn) {
3897
+ value = fn.prototype;
3898
+ }
3899
+ } else if (name === '%AsyncIteratorPrototype%') {
3900
+ var gen = doEval('%AsyncGenerator%');
3901
+ if (gen) {
3902
+ value = getProto(gen.prototype);
3903
+ }
3904
+ }
3905
+
3906
+ INTRINSICS[name] = value;
3907
+
3908
+ return value;
3909
+ };
3910
+
3911
+ var LEGACY_ALIASES = {
3912
+ '%ArrayBufferPrototype%': ['ArrayBuffer', 'prototype'],
3913
+ '%ArrayPrototype%': ['Array', 'prototype'],
3914
+ '%ArrayProto_entries%': ['Array', 'prototype', 'entries'],
3915
+ '%ArrayProto_forEach%': ['Array', 'prototype', 'forEach'],
3916
+ '%ArrayProto_keys%': ['Array', 'prototype', 'keys'],
3917
+ '%ArrayProto_values%': ['Array', 'prototype', 'values'],
3918
+ '%AsyncFunctionPrototype%': ['AsyncFunction', 'prototype'],
3919
+ '%AsyncGenerator%': ['AsyncGeneratorFunction', 'prototype'],
3920
+ '%AsyncGeneratorPrototype%': ['AsyncGeneratorFunction', 'prototype', 'prototype'],
3921
+ '%BooleanPrototype%': ['Boolean', 'prototype'],
3922
+ '%DataViewPrototype%': ['DataView', 'prototype'],
3923
+ '%DatePrototype%': ['Date', 'prototype'],
3924
+ '%ErrorPrototype%': ['Error', 'prototype'],
3925
+ '%EvalErrorPrototype%': ['EvalError', 'prototype'],
3926
+ '%Float32ArrayPrototype%': ['Float32Array', 'prototype'],
3927
+ '%Float64ArrayPrototype%': ['Float64Array', 'prototype'],
3928
+ '%FunctionPrototype%': ['Function', 'prototype'],
3929
+ '%Generator%': ['GeneratorFunction', 'prototype'],
3930
+ '%GeneratorPrototype%': ['GeneratorFunction', 'prototype', 'prototype'],
3931
+ '%Int8ArrayPrototype%': ['Int8Array', 'prototype'],
3932
+ '%Int16ArrayPrototype%': ['Int16Array', 'prototype'],
3933
+ '%Int32ArrayPrototype%': ['Int32Array', 'prototype'],
3934
+ '%JSONParse%': ['JSON', 'parse'],
3935
+ '%JSONStringify%': ['JSON', 'stringify'],
3936
+ '%MapPrototype%': ['Map', 'prototype'],
3937
+ '%NumberPrototype%': ['Number', 'prototype'],
3938
+ '%ObjectPrototype%': ['Object', 'prototype'],
3939
+ '%ObjProto_toString%': ['Object', 'prototype', 'toString'],
3940
+ '%ObjProto_valueOf%': ['Object', 'prototype', 'valueOf'],
3941
+ '%PromisePrototype%': ['Promise', 'prototype'],
3942
+ '%PromiseProto_then%': ['Promise', 'prototype', 'then'],
3943
+ '%Promise_all%': ['Promise', 'all'],
3944
+ '%Promise_reject%': ['Promise', 'reject'],
3945
+ '%Promise_resolve%': ['Promise', 'resolve'],
3946
+ '%RangeErrorPrototype%': ['RangeError', 'prototype'],
3947
+ '%ReferenceErrorPrototype%': ['ReferenceError', 'prototype'],
3948
+ '%RegExpPrototype%': ['RegExp', 'prototype'],
3949
+ '%SetPrototype%': ['Set', 'prototype'],
3950
+ '%SharedArrayBufferPrototype%': ['SharedArrayBuffer', 'prototype'],
3951
+ '%StringPrototype%': ['String', 'prototype'],
3952
+ '%SymbolPrototype%': ['Symbol', 'prototype'],
3953
+ '%SyntaxErrorPrototype%': ['SyntaxError', 'prototype'],
3954
+ '%TypedArrayPrototype%': ['TypedArray', 'prototype'],
3955
+ '%TypeErrorPrototype%': ['TypeError', 'prototype'],
3956
+ '%Uint8ArrayPrototype%': ['Uint8Array', 'prototype'],
3957
+ '%Uint8ClampedArrayPrototype%': ['Uint8ClampedArray', 'prototype'],
3958
+ '%Uint16ArrayPrototype%': ['Uint16Array', 'prototype'],
3959
+ '%Uint32ArrayPrototype%': ['Uint32Array', 'prototype'],
3960
+ '%URIErrorPrototype%': ['URIError', 'prototype'],
3961
+ '%WeakMapPrototype%': ['WeakMap', 'prototype'],
3962
+ '%WeakSetPrototype%': ['WeakSet', 'prototype']
3963
+ };
3964
+
3965
+ var bind = functionBind;
3966
+ var hasOwn$1 = src;
3967
+ var $concat$1 = bind.call(Function.call, Array.prototype.concat);
3968
+ var $spliceApply = bind.call(Function.apply, Array.prototype.splice);
3969
+ var $replace$1 = bind.call(Function.call, String.prototype.replace);
3970
+ var $strSlice = bind.call(Function.call, String.prototype.slice);
3971
+ var $exec = bind.call(Function.call, RegExp.prototype.exec);
3972
+
3973
+ /* adapted from https://github.com/lodash/lodash/blob/4.17.15/dist/lodash.js#L6735-L6744 */
3974
+ var rePropName = /[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g;
3975
+ var reEscapeChar = /\\(\\)?/g; /** Used to match backslashes in property paths. */
3976
+ var stringToPath = function stringToPath(string) {
3977
+ var first = $strSlice(string, 0, 1);
3978
+ var last = $strSlice(string, -1);
3979
+ if (first === '%' && last !== '%') {
3980
+ throw new $SyntaxError('invalid intrinsic syntax, expected closing `%`');
3981
+ } else if (last === '%' && first !== '%') {
3982
+ throw new $SyntaxError('invalid intrinsic syntax, expected opening `%`');
3983
+ }
3984
+ var result = [];
3985
+ $replace$1(string, rePropName, function (match, number, quote, subString) {
3986
+ result[result.length] = quote ? $replace$1(subString, reEscapeChar, '$1') : number || match;
3987
+ });
3988
+ return result;
3989
+ };
3990
+ /* end adaptation */
3991
+
3992
+ var getBaseIntrinsic = function getBaseIntrinsic(name, allowMissing) {
3993
+ var intrinsicName = name;
3994
+ var alias;
3995
+ if (hasOwn$1(LEGACY_ALIASES, intrinsicName)) {
3996
+ alias = LEGACY_ALIASES[intrinsicName];
3997
+ intrinsicName = '%' + alias[0] + '%';
3998
+ }
3999
+
4000
+ if (hasOwn$1(INTRINSICS, intrinsicName)) {
4001
+ var value = INTRINSICS[intrinsicName];
4002
+ if (value === needsEval) {
4003
+ value = doEval(intrinsicName);
4004
+ }
4005
+ if (typeof value === 'undefined' && !allowMissing) {
4006
+ throw new $TypeError$1('intrinsic ' + name + ' exists, but is not available. Please file an issue!');
4007
+ }
4008
+
4009
+ return {
4010
+ alias: alias,
4011
+ name: intrinsicName,
4012
+ value: value
4013
+ };
4014
+ }
4015
+
4016
+ throw new $SyntaxError('intrinsic ' + name + ' does not exist!');
4017
+ };
4018
+
4019
+ var getIntrinsic = function GetIntrinsic(name, allowMissing) {
4020
+ if (typeof name !== 'string' || name.length === 0) {
4021
+ throw new $TypeError$1('intrinsic name must be a non-empty string');
4022
+ }
4023
+ if (arguments.length > 1 && typeof allowMissing !== 'boolean') {
4024
+ throw new $TypeError$1('"allowMissing" argument must be a boolean');
4025
+ }
4026
+
4027
+ if ($exec(/^%?[^%]*%?$/, name) === null) {
4028
+ throw new $SyntaxError('`%` may not be present anywhere but at the beginning and end of the intrinsic name');
4029
+ }
4030
+ var parts = stringToPath(name);
4031
+ var intrinsicBaseName = parts.length > 0 ? parts[0] : '';
4032
+
4033
+ var intrinsic = getBaseIntrinsic('%' + intrinsicBaseName + '%', allowMissing);
4034
+ var intrinsicRealName = intrinsic.name;
4035
+ var value = intrinsic.value;
4036
+ var skipFurtherCaching = false;
4037
+
4038
+ var alias = intrinsic.alias;
4039
+ if (alias) {
4040
+ intrinsicBaseName = alias[0];
4041
+ $spliceApply(parts, $concat$1([0, 1], alias));
4042
+ }
4043
+
4044
+ for (var i = 1, isOwn = true; i < parts.length; i += 1) {
4045
+ var part = parts[i];
4046
+ var first = $strSlice(part, 0, 1);
4047
+ var last = $strSlice(part, -1);
4048
+ if (
4049
+ (
4050
+ (first === '"' || first === "'" || first === '`')
4051
+ || (last === '"' || last === "'" || last === '`')
4052
+ )
4053
+ && first !== last
4054
+ ) {
4055
+ throw new $SyntaxError('property names with quotes must have matching quotes');
4056
+ }
4057
+ if (part === 'constructor' || !isOwn) {
4058
+ skipFurtherCaching = true;
4059
+ }
4060
+
4061
+ intrinsicBaseName += '.' + part;
4062
+ intrinsicRealName = '%' + intrinsicBaseName + '%';
4063
+
4064
+ if (hasOwn$1(INTRINSICS, intrinsicRealName)) {
4065
+ value = INTRINSICS[intrinsicRealName];
4066
+ } else if (value != null) {
4067
+ if (!(part in value)) {
4068
+ if (!allowMissing) {
4069
+ throw new $TypeError$1('base intrinsic for ' + name + ' exists, but the property is not available.');
4070
+ }
4071
+ return void undefined$1;
4072
+ }
4073
+ if ($gOPD && (i + 1) >= parts.length) {
4074
+ var desc = $gOPD(value, part);
4075
+ isOwn = !!desc;
4076
+
4077
+ // By convention, when a data property is converted to an accessor
4078
+ // property to emulate a data property that does not suffer from
4079
+ // the override mistake, that accessor's getter is marked with
4080
+ // an `originalValue` property. Here, when we detect this, we
4081
+ // uphold the illusion by pretending to see that original data
4082
+ // property, i.e., returning the value rather than the getter
4083
+ // itself.
4084
+ if (isOwn && 'get' in desc && !('originalValue' in desc.get)) {
4085
+ value = desc.get;
4086
+ } else {
4087
+ value = value[part];
4088
+ }
4089
+ } else {
4090
+ isOwn = hasOwn$1(value, part);
4091
+ value = value[part];
4092
+ }
4093
+
4094
+ if (isOwn && !skipFurtherCaching) {
4095
+ INTRINSICS[intrinsicRealName] = value;
4096
+ }
4097
+ }
4098
+ }
4099
+ return value;
4100
+ };
4101
+
4102
+ var callBind$1 = {exports: {}};
4103
+
4104
+ (function (module) {
4105
+
4106
+ var bind = functionBind;
4107
+ var GetIntrinsic = getIntrinsic;
4108
+
4109
+ var $apply = GetIntrinsic('%Function.prototype.apply%');
4110
+ var $call = GetIntrinsic('%Function.prototype.call%');
4111
+ var $reflectApply = GetIntrinsic('%Reflect.apply%', true) || bind.call($call, $apply);
4112
+
4113
+ var $gOPD = GetIntrinsic('%Object.getOwnPropertyDescriptor%', true);
4114
+ var $defineProperty = GetIntrinsic('%Object.defineProperty%', true);
4115
+ var $max = GetIntrinsic('%Math.max%');
4116
+
4117
+ if ($defineProperty) {
4118
+ try {
4119
+ $defineProperty({}, 'a', { value: 1 });
4120
+ } catch (e) {
4121
+ // IE 8 has a broken defineProperty
4122
+ $defineProperty = null;
4123
+ }
4124
+ }
4125
+
4126
+ module.exports = function callBind(originalFunction) {
4127
+ var func = $reflectApply(bind, $call, arguments);
4128
+ if ($gOPD && $defineProperty) {
4129
+ var desc = $gOPD(func, 'length');
4130
+ if (desc.configurable) {
4131
+ // original length, plus the receiver, minus any additional arguments (after the receiver)
4132
+ $defineProperty(
4133
+ func,
4134
+ 'length',
4135
+ { value: 1 + $max(0, originalFunction.length - (arguments.length - 1)) }
4136
+ );
4137
+ }
4138
+ }
4139
+ return func;
4140
+ };
4141
+
4142
+ var applyBind = function applyBind() {
4143
+ return $reflectApply(bind, $apply, arguments);
4144
+ };
4145
+
4146
+ if ($defineProperty) {
4147
+ $defineProperty(module.exports, 'apply', { value: applyBind });
4148
+ } else {
4149
+ module.exports.apply = applyBind;
4150
+ }
4151
+ } (callBind$1));
4152
+
4153
+ var GetIntrinsic$1 = getIntrinsic;
4154
+
4155
+ var callBind = callBind$1.exports;
4156
+
4157
+ var $indexOf = callBind(GetIntrinsic$1('String.prototype.indexOf'));
4158
+
4159
+ var callBound$1 = function callBoundIntrinsic(name, allowMissing) {
4160
+ var intrinsic = GetIntrinsic$1(name, !!allowMissing);
4161
+ if (typeof intrinsic === 'function' && $indexOf(name, '.prototype.') > -1) {
4162
+ return callBind(intrinsic);
4163
+ }
4164
+ return intrinsic;
4165
+ };
4166
+
4167
+ var util_inspect = require$$0__default["default"].inspect;
4168
+
4169
+ var hasMap = typeof Map === 'function' && Map.prototype;
4170
+ var mapSizeDescriptor = Object.getOwnPropertyDescriptor && hasMap ? Object.getOwnPropertyDescriptor(Map.prototype, 'size') : null;
4171
+ var mapSize = hasMap && mapSizeDescriptor && typeof mapSizeDescriptor.get === 'function' ? mapSizeDescriptor.get : null;
4172
+ var mapForEach = hasMap && Map.prototype.forEach;
4173
+ var hasSet = typeof Set === 'function' && Set.prototype;
4174
+ var setSizeDescriptor = Object.getOwnPropertyDescriptor && hasSet ? Object.getOwnPropertyDescriptor(Set.prototype, 'size') : null;
4175
+ var setSize = hasSet && setSizeDescriptor && typeof setSizeDescriptor.get === 'function' ? setSizeDescriptor.get : null;
4176
+ var setForEach = hasSet && Set.prototype.forEach;
4177
+ var hasWeakMap = typeof WeakMap === 'function' && WeakMap.prototype;
4178
+ var weakMapHas = hasWeakMap ? WeakMap.prototype.has : null;
4179
+ var hasWeakSet = typeof WeakSet === 'function' && WeakSet.prototype;
4180
+ var weakSetHas = hasWeakSet ? WeakSet.prototype.has : null;
4181
+ var hasWeakRef = typeof WeakRef === 'function' && WeakRef.prototype;
4182
+ var weakRefDeref = hasWeakRef ? WeakRef.prototype.deref : null;
4183
+ var booleanValueOf = Boolean.prototype.valueOf;
4184
+ var objectToString = Object.prototype.toString;
4185
+ var functionToString = Function.prototype.toString;
4186
+ var $match = String.prototype.match;
4187
+ var $slice = String.prototype.slice;
4188
+ var $replace = String.prototype.replace;
4189
+ var $toUpperCase = String.prototype.toUpperCase;
4190
+ var $toLowerCase = String.prototype.toLowerCase;
4191
+ var $test = RegExp.prototype.test;
4192
+ var $concat = Array.prototype.concat;
4193
+ var $join = Array.prototype.join;
4194
+ var $arrSlice = Array.prototype.slice;
4195
+ var $floor = Math.floor;
4196
+ var bigIntValueOf = typeof BigInt === 'function' ? BigInt.prototype.valueOf : null;
4197
+ var gOPS = Object.getOwnPropertySymbols;
4198
+ var symToString = typeof Symbol === 'function' && typeof Symbol.iterator === 'symbol' ? Symbol.prototype.toString : null;
4199
+ var hasShammedSymbols = typeof Symbol === 'function' && typeof Symbol.iterator === 'object';
4200
+ // ie, `has-tostringtag/shams
4201
+ var toStringTag = typeof Symbol === 'function' && Symbol.toStringTag && (typeof Symbol.toStringTag === hasShammedSymbols ? 'object' : 'symbol')
4202
+ ? Symbol.toStringTag
4203
+ : null;
4204
+ var isEnumerable = Object.prototype.propertyIsEnumerable;
4205
+
4206
+ var gPO = (typeof Reflect === 'function' ? Reflect.getPrototypeOf : Object.getPrototypeOf) || (
4207
+ [].__proto__ === Array.prototype // eslint-disable-line no-proto
4208
+ ? function (O) {
4209
+ return O.__proto__; // eslint-disable-line no-proto
4210
+ }
4211
+ : null
4212
+ );
4213
+
4214
+ function addNumericSeparator(num, str) {
4215
+ if (
4216
+ num === Infinity
4217
+ || num === -Infinity
4218
+ || num !== num
4219
+ || (num && num > -1000 && num < 1000)
4220
+ || $test.call(/e/, str)
4221
+ ) {
4222
+ return str;
4223
+ }
4224
+ var sepRegex = /[0-9](?=(?:[0-9]{3})+(?![0-9]))/g;
4225
+ if (typeof num === 'number') {
4226
+ var int = num < 0 ? -$floor(-num) : $floor(num); // trunc(num)
4227
+ if (int !== num) {
4228
+ var intStr = String(int);
4229
+ var dec = $slice.call(str, intStr.length + 1);
4230
+ return $replace.call(intStr, sepRegex, '$&_') + '.' + $replace.call($replace.call(dec, /([0-9]{3})/g, '$&_'), /_$/, '');
4231
+ }
4232
+ }
4233
+ return $replace.call(str, sepRegex, '$&_');
4234
+ }
4235
+
4236
+ var utilInspect = util_inspect;
4237
+ var inspectCustom = utilInspect.custom;
4238
+ var inspectSymbol = isSymbol(inspectCustom) ? inspectCustom : null;
4239
+
4240
+ var objectInspect = function inspect_(obj, options, depth, seen) {
4241
+ var opts = options || {};
4242
+
4243
+ if (has$3(opts, 'quoteStyle') && (opts.quoteStyle !== 'single' && opts.quoteStyle !== 'double')) {
4244
+ throw new TypeError('option "quoteStyle" must be "single" or "double"');
4245
+ }
4246
+ if (
4247
+ has$3(opts, 'maxStringLength') && (typeof opts.maxStringLength === 'number'
4248
+ ? opts.maxStringLength < 0 && opts.maxStringLength !== Infinity
4249
+ : opts.maxStringLength !== null
4250
+ )
4251
+ ) {
4252
+ throw new TypeError('option "maxStringLength", if provided, must be a positive integer, Infinity, or `null`');
4253
+ }
4254
+ var customInspect = has$3(opts, 'customInspect') ? opts.customInspect : true;
4255
+ if (typeof customInspect !== 'boolean' && customInspect !== 'symbol') {
4256
+ throw new TypeError('option "customInspect", if provided, must be `true`, `false`, or `\'symbol\'`');
4257
+ }
4258
+
4259
+ if (
4260
+ has$3(opts, 'indent')
4261
+ && opts.indent !== null
4262
+ && opts.indent !== '\t'
4263
+ && !(parseInt(opts.indent, 10) === opts.indent && opts.indent > 0)
4264
+ ) {
4265
+ throw new TypeError('option "indent" must be "\\t", an integer > 0, or `null`');
4266
+ }
4267
+ if (has$3(opts, 'numericSeparator') && typeof opts.numericSeparator !== 'boolean') {
4268
+ throw new TypeError('option "numericSeparator", if provided, must be `true` or `false`');
4269
+ }
4270
+ var numericSeparator = opts.numericSeparator;
4271
+
4272
+ if (typeof obj === 'undefined') {
4273
+ return 'undefined';
4274
+ }
4275
+ if (obj === null) {
4276
+ return 'null';
4277
+ }
4278
+ if (typeof obj === 'boolean') {
4279
+ return obj ? 'true' : 'false';
4280
+ }
4281
+
4282
+ if (typeof obj === 'string') {
4283
+ return inspectString(obj, opts);
4284
+ }
4285
+ if (typeof obj === 'number') {
4286
+ if (obj === 0) {
4287
+ return Infinity / obj > 0 ? '0' : '-0';
4288
+ }
4289
+ var str = String(obj);
4290
+ return numericSeparator ? addNumericSeparator(obj, str) : str;
4291
+ }
4292
+ if (typeof obj === 'bigint') {
4293
+ var bigIntStr = String(obj) + 'n';
4294
+ return numericSeparator ? addNumericSeparator(obj, bigIntStr) : bigIntStr;
4295
+ }
4296
+
4297
+ var maxDepth = typeof opts.depth === 'undefined' ? 5 : opts.depth;
4298
+ if (typeof depth === 'undefined') { depth = 0; }
4299
+ if (depth >= maxDepth && maxDepth > 0 && typeof obj === 'object') {
4300
+ return isArray$3(obj) ? '[Array]' : '[Object]';
4301
+ }
4302
+
4303
+ var indent = getIndent(opts, depth);
4304
+
4305
+ if (typeof seen === 'undefined') {
4306
+ seen = [];
4307
+ } else if (indexOf(seen, obj) >= 0) {
4308
+ return '[Circular]';
4309
+ }
4310
+
4311
+ function inspect(value, from, noIndent) {
4312
+ if (from) {
4313
+ seen = $arrSlice.call(seen);
4314
+ seen.push(from);
4315
+ }
4316
+ if (noIndent) {
4317
+ var newOpts = {
4318
+ depth: opts.depth
4319
+ };
4320
+ if (has$3(opts, 'quoteStyle')) {
4321
+ newOpts.quoteStyle = opts.quoteStyle;
4322
+ }
4323
+ return inspect_(value, newOpts, depth + 1, seen);
4324
+ }
4325
+ return inspect_(value, opts, depth + 1, seen);
4326
+ }
4327
+
4328
+ if (typeof obj === 'function' && !isRegExp$1(obj)) { // in older engines, regexes are callable
4329
+ var name = nameOf(obj);
4330
+ var keys = arrObjKeys(obj, inspect);
4331
+ return '[Function' + (name ? ': ' + name : ' (anonymous)') + ']' + (keys.length > 0 ? ' { ' + $join.call(keys, ', ') + ' }' : '');
4332
+ }
4333
+ if (isSymbol(obj)) {
4334
+ var symString = hasShammedSymbols ? $replace.call(String(obj), /^(Symbol\(.*\))_[^)]*$/, '$1') : symToString.call(obj);
4335
+ return typeof obj === 'object' && !hasShammedSymbols ? markBoxed(symString) : symString;
4336
+ }
4337
+ if (isElement(obj)) {
4338
+ var s = '<' + $toLowerCase.call(String(obj.nodeName));
4339
+ var attrs = obj.attributes || [];
4340
+ for (var i = 0; i < attrs.length; i++) {
4341
+ s += ' ' + attrs[i].name + '=' + wrapQuotes(quote(attrs[i].value), 'double', opts);
4342
+ }
4343
+ s += '>';
4344
+ if (obj.childNodes && obj.childNodes.length) { s += '...'; }
4345
+ s += '</' + $toLowerCase.call(String(obj.nodeName)) + '>';
4346
+ return s;
4347
+ }
4348
+ if (isArray$3(obj)) {
4349
+ if (obj.length === 0) { return '[]'; }
4350
+ var xs = arrObjKeys(obj, inspect);
4351
+ if (indent && !singleLineValues(xs)) {
4352
+ return '[' + indentedJoin(xs, indent) + ']';
4353
+ }
4354
+ return '[ ' + $join.call(xs, ', ') + ' ]';
4355
+ }
4356
+ if (isError(obj)) {
4357
+ var parts = arrObjKeys(obj, inspect);
4358
+ if (!('cause' in Error.prototype) && 'cause' in obj && !isEnumerable.call(obj, 'cause')) {
4359
+ return '{ [' + String(obj) + '] ' + $join.call($concat.call('[cause]: ' + inspect(obj.cause), parts), ', ') + ' }';
4360
+ }
4361
+ if (parts.length === 0) { return '[' + String(obj) + ']'; }
4362
+ return '{ [' + String(obj) + '] ' + $join.call(parts, ', ') + ' }';
4363
+ }
4364
+ if (typeof obj === 'object' && customInspect) {
4365
+ if (inspectSymbol && typeof obj[inspectSymbol] === 'function' && utilInspect) {
4366
+ return utilInspect(obj, { depth: maxDepth - depth });
4367
+ } else if (customInspect !== 'symbol' && typeof obj.inspect === 'function') {
4368
+ return obj.inspect();
4369
+ }
4370
+ }
4371
+ if (isMap(obj)) {
4372
+ var mapParts = [];
4373
+ if (mapForEach) {
4374
+ mapForEach.call(obj, function (value, key) {
4375
+ mapParts.push(inspect(key, obj, true) + ' => ' + inspect(value, obj));
4376
+ });
4377
+ }
4378
+ return collectionOf('Map', mapSize.call(obj), mapParts, indent);
4379
+ }
4380
+ if (isSet(obj)) {
4381
+ var setParts = [];
4382
+ if (setForEach) {
4383
+ setForEach.call(obj, function (value) {
4384
+ setParts.push(inspect(value, obj));
4385
+ });
4386
+ }
4387
+ return collectionOf('Set', setSize.call(obj), setParts, indent);
4388
+ }
4389
+ if (isWeakMap(obj)) {
4390
+ return weakCollectionOf('WeakMap');
4391
+ }
4392
+ if (isWeakSet(obj)) {
4393
+ return weakCollectionOf('WeakSet');
4394
+ }
4395
+ if (isWeakRef(obj)) {
4396
+ return weakCollectionOf('WeakRef');
4397
+ }
4398
+ if (isNumber(obj)) {
4399
+ return markBoxed(inspect(Number(obj)));
4400
+ }
4401
+ if (isBigInt(obj)) {
4402
+ return markBoxed(inspect(bigIntValueOf.call(obj)));
4403
+ }
4404
+ if (isBoolean(obj)) {
4405
+ return markBoxed(booleanValueOf.call(obj));
4406
+ }
4407
+ if (isString(obj)) {
4408
+ return markBoxed(inspect(String(obj)));
4409
+ }
4410
+ if (!isDate(obj) && !isRegExp$1(obj)) {
4411
+ var ys = arrObjKeys(obj, inspect);
4412
+ var isPlainObject = gPO ? gPO(obj) === Object.prototype : obj instanceof Object || obj.constructor === Object;
4413
+ var protoTag = obj instanceof Object ? '' : 'null prototype';
4414
+ var stringTag = !isPlainObject && toStringTag && Object(obj) === obj && toStringTag in obj ? $slice.call(toStr(obj), 8, -1) : protoTag ? 'Object' : '';
4415
+ var constructorTag = isPlainObject || typeof obj.constructor !== 'function' ? '' : obj.constructor.name ? obj.constructor.name + ' ' : '';
4416
+ var tag = constructorTag + (stringTag || protoTag ? '[' + $join.call($concat.call([], stringTag || [], protoTag || []), ': ') + '] ' : '');
4417
+ if (ys.length === 0) { return tag + '{}'; }
4418
+ if (indent) {
4419
+ return tag + '{' + indentedJoin(ys, indent) + '}';
4420
+ }
4421
+ return tag + '{ ' + $join.call(ys, ', ') + ' }';
4422
+ }
4423
+ return String(obj);
4424
+ };
4425
+
4426
+ function wrapQuotes(s, defaultStyle, opts) {
4427
+ var quoteChar = (opts.quoteStyle || defaultStyle) === 'double' ? '"' : "'";
4428
+ return quoteChar + s + quoteChar;
4429
+ }
4430
+
4431
+ function quote(s) {
4432
+ return $replace.call(String(s), /"/g, '&quot;');
4433
+ }
4434
+
4435
+ function isArray$3(obj) { return toStr(obj) === '[object Array]' && (!toStringTag || !(typeof obj === 'object' && toStringTag in obj)); }
4436
+ function isDate(obj) { return toStr(obj) === '[object Date]' && (!toStringTag || !(typeof obj === 'object' && toStringTag in obj)); }
4437
+ function isRegExp$1(obj) { return toStr(obj) === '[object RegExp]' && (!toStringTag || !(typeof obj === 'object' && toStringTag in obj)); }
4438
+ function isError(obj) { return toStr(obj) === '[object Error]' && (!toStringTag || !(typeof obj === 'object' && toStringTag in obj)); }
4439
+ function isString(obj) { return toStr(obj) === '[object String]' && (!toStringTag || !(typeof obj === 'object' && toStringTag in obj)); }
4440
+ function isNumber(obj) { return toStr(obj) === '[object Number]' && (!toStringTag || !(typeof obj === 'object' && toStringTag in obj)); }
4441
+ function isBoolean(obj) { return toStr(obj) === '[object Boolean]' && (!toStringTag || !(typeof obj === 'object' && toStringTag in obj)); }
4442
+
4443
+ // Symbol and BigInt do have Symbol.toStringTag by spec, so that can't be used to eliminate false positives
4444
+ function isSymbol(obj) {
4445
+ if (hasShammedSymbols) {
4446
+ return obj && typeof obj === 'object' && obj instanceof Symbol;
4447
+ }
4448
+ if (typeof obj === 'symbol') {
4449
+ return true;
4450
+ }
4451
+ if (!obj || typeof obj !== 'object' || !symToString) {
4452
+ return false;
4453
+ }
4454
+ try {
4455
+ symToString.call(obj);
4456
+ return true;
4457
+ } catch (e) {}
4458
+ return false;
4459
+ }
4460
+
4461
+ function isBigInt(obj) {
4462
+ if (!obj || typeof obj !== 'object' || !bigIntValueOf) {
4463
+ return false;
4464
+ }
4465
+ try {
4466
+ bigIntValueOf.call(obj);
4467
+ return true;
4468
+ } catch (e) {}
4469
+ return false;
4470
+ }
4471
+
4472
+ var hasOwn = Object.prototype.hasOwnProperty || function (key) { return key in this; };
4473
+ function has$3(obj, key) {
4474
+ return hasOwn.call(obj, key);
4475
+ }
4476
+
4477
+ function toStr(obj) {
4478
+ return objectToString.call(obj);
4479
+ }
4480
+
4481
+ function nameOf(f) {
4482
+ if (f.name) { return f.name; }
4483
+ var m = $match.call(functionToString.call(f), /^function\s*([\w$]+)/);
4484
+ if (m) { return m[1]; }
4485
+ return null;
4486
+ }
4487
+
4488
+ function indexOf(xs, x) {
4489
+ if (xs.indexOf) { return xs.indexOf(x); }
4490
+ for (var i = 0, l = xs.length; i < l; i++) {
4491
+ if (xs[i] === x) { return i; }
4492
+ }
4493
+ return -1;
4494
+ }
4495
+
4496
+ function isMap(x) {
4497
+ if (!mapSize || !x || typeof x !== 'object') {
4498
+ return false;
4499
+ }
4500
+ try {
4501
+ mapSize.call(x);
4502
+ try {
4503
+ setSize.call(x);
4504
+ } catch (s) {
4505
+ return true;
4506
+ }
4507
+ return x instanceof Map; // core-js workaround, pre-v2.5.0
4508
+ } catch (e) {}
4509
+ return false;
4510
+ }
4511
+
4512
+ function isWeakMap(x) {
4513
+ if (!weakMapHas || !x || typeof x !== 'object') {
4514
+ return false;
4515
+ }
4516
+ try {
4517
+ weakMapHas.call(x, weakMapHas);
4518
+ try {
4519
+ weakSetHas.call(x, weakSetHas);
4520
+ } catch (s) {
4521
+ return true;
4522
+ }
4523
+ return x instanceof WeakMap; // core-js workaround, pre-v2.5.0
4524
+ } catch (e) {}
4525
+ return false;
4526
+ }
4527
+
4528
+ function isWeakRef(x) {
4529
+ if (!weakRefDeref || !x || typeof x !== 'object') {
4530
+ return false;
4531
+ }
4532
+ try {
4533
+ weakRefDeref.call(x);
4534
+ return true;
4535
+ } catch (e) {}
4536
+ return false;
4537
+ }
4538
+
4539
+ function isSet(x) {
4540
+ if (!setSize || !x || typeof x !== 'object') {
4541
+ return false;
4542
+ }
4543
+ try {
4544
+ setSize.call(x);
4545
+ try {
4546
+ mapSize.call(x);
4547
+ } catch (m) {
4548
+ return true;
4549
+ }
4550
+ return x instanceof Set; // core-js workaround, pre-v2.5.0
4551
+ } catch (e) {}
4552
+ return false;
4553
+ }
4554
+
4555
+ function isWeakSet(x) {
4556
+ if (!weakSetHas || !x || typeof x !== 'object') {
4557
+ return false;
4558
+ }
4559
+ try {
4560
+ weakSetHas.call(x, weakSetHas);
4561
+ try {
4562
+ weakMapHas.call(x, weakMapHas);
4563
+ } catch (s) {
4564
+ return true;
4565
+ }
4566
+ return x instanceof WeakSet; // core-js workaround, pre-v2.5.0
4567
+ } catch (e) {}
4568
+ return false;
4569
+ }
4570
+
4571
+ function isElement(x) {
4572
+ if (!x || typeof x !== 'object') { return false; }
4573
+ if (typeof HTMLElement !== 'undefined' && x instanceof HTMLElement) {
4574
+ return true;
4575
+ }
4576
+ return typeof x.nodeName === 'string' && typeof x.getAttribute === 'function';
4577
+ }
4578
+
4579
+ function inspectString(str, opts) {
4580
+ if (str.length > opts.maxStringLength) {
4581
+ var remaining = str.length - opts.maxStringLength;
4582
+ var trailer = '... ' + remaining + ' more character' + (remaining > 1 ? 's' : '');
4583
+ return inspectString($slice.call(str, 0, opts.maxStringLength), opts) + trailer;
4584
+ }
4585
+ // eslint-disable-next-line no-control-regex
4586
+ var s = $replace.call($replace.call(str, /(['\\])/g, '\\$1'), /[\x00-\x1f]/g, lowbyte);
4587
+ return wrapQuotes(s, 'single', opts);
4588
+ }
4589
+
4590
+ function lowbyte(c) {
4591
+ var n = c.charCodeAt(0);
4592
+ var x = {
4593
+ 8: 'b',
4594
+ 9: 't',
4595
+ 10: 'n',
4596
+ 12: 'f',
4597
+ 13: 'r'
4598
+ }[n];
4599
+ if (x) { return '\\' + x; }
4600
+ return '\\x' + (n < 0x10 ? '0' : '') + $toUpperCase.call(n.toString(16));
4601
+ }
4602
+
4603
+ function markBoxed(str) {
4604
+ return 'Object(' + str + ')';
4605
+ }
4606
+
4607
+ function weakCollectionOf(type) {
4608
+ return type + ' { ? }';
4609
+ }
4610
+
4611
+ function collectionOf(type, size, entries, indent) {
4612
+ var joinedEntries = indent ? indentedJoin(entries, indent) : $join.call(entries, ', ');
4613
+ return type + ' (' + size + ') {' + joinedEntries + '}';
4614
+ }
4615
+
4616
+ function singleLineValues(xs) {
4617
+ for (var i = 0; i < xs.length; i++) {
4618
+ if (indexOf(xs[i], '\n') >= 0) {
4619
+ return false;
4620
+ }
4621
+ }
4622
+ return true;
4623
+ }
4624
+
4625
+ function getIndent(opts, depth) {
4626
+ var baseIndent;
4627
+ if (opts.indent === '\t') {
4628
+ baseIndent = '\t';
4629
+ } else if (typeof opts.indent === 'number' && opts.indent > 0) {
4630
+ baseIndent = $join.call(Array(opts.indent + 1), ' ');
4631
+ } else {
4632
+ return null;
4633
+ }
4634
+ return {
4635
+ base: baseIndent,
4636
+ prev: $join.call(Array(depth + 1), baseIndent)
4637
+ };
4638
+ }
4639
+
4640
+ function indentedJoin(xs, indent) {
4641
+ if (xs.length === 0) { return ''; }
4642
+ var lineJoiner = '\n' + indent.prev + indent.base;
4643
+ return lineJoiner + $join.call(xs, ',' + lineJoiner) + '\n' + indent.prev;
4644
+ }
4645
+
4646
+ function arrObjKeys(obj, inspect) {
4647
+ var isArr = isArray$3(obj);
4648
+ var xs = [];
4649
+ if (isArr) {
4650
+ xs.length = obj.length;
4651
+ for (var i = 0; i < obj.length; i++) {
4652
+ xs[i] = has$3(obj, i) ? inspect(obj[i], obj) : '';
4653
+ }
4654
+ }
4655
+ var syms = typeof gOPS === 'function' ? gOPS(obj) : [];
4656
+ var symMap;
4657
+ if (hasShammedSymbols) {
4658
+ symMap = {};
4659
+ for (var k = 0; k < syms.length; k++) {
4660
+ symMap['$' + syms[k]] = syms[k];
4661
+ }
4662
+ }
4663
+
4664
+ for (var key in obj) { // eslint-disable-line no-restricted-syntax
4665
+ if (!has$3(obj, key)) { continue; } // eslint-disable-line no-restricted-syntax, no-continue
4666
+ if (isArr && String(Number(key)) === key && key < obj.length) { continue; } // eslint-disable-line no-restricted-syntax, no-continue
4667
+ if (hasShammedSymbols && symMap['$' + key] instanceof Symbol) {
4668
+ // this is to prevent shammed Symbols, which are stored as strings, from being included in the string key section
4669
+ continue; // eslint-disable-line no-restricted-syntax, no-continue
4670
+ } else if ($test.call(/[^\w$]/, key)) {
4671
+ xs.push(inspect(key, obj) + ': ' + inspect(obj[key], obj));
4672
+ } else {
4673
+ xs.push(key + ': ' + inspect(obj[key], obj));
4674
+ }
4675
+ }
4676
+ if (typeof gOPS === 'function') {
4677
+ for (var j = 0; j < syms.length; j++) {
4678
+ if (isEnumerable.call(obj, syms[j])) {
4679
+ xs.push('[' + inspect(syms[j]) + ']: ' + inspect(obj[syms[j]], obj));
4680
+ }
4681
+ }
4682
+ }
4683
+ return xs;
4684
+ }
4685
+
4686
+ var GetIntrinsic = getIntrinsic;
4687
+ var callBound = callBound$1;
4688
+ var inspect = objectInspect;
4689
+
4690
+ var $TypeError = GetIntrinsic('%TypeError%');
4691
+ var $WeakMap = GetIntrinsic('%WeakMap%', true);
4692
+ var $Map = GetIntrinsic('%Map%', true);
4693
+
4694
+ var $weakMapGet = callBound('WeakMap.prototype.get', true);
4695
+ var $weakMapSet = callBound('WeakMap.prototype.set', true);
4696
+ var $weakMapHas = callBound('WeakMap.prototype.has', true);
4697
+ var $mapGet = callBound('Map.prototype.get', true);
4698
+ var $mapSet = callBound('Map.prototype.set', true);
4699
+ var $mapHas = callBound('Map.prototype.has', true);
4700
+
4701
+ /*
4702
+ * This function traverses the list returning the node corresponding to the
4703
+ * given key.
4704
+ *
4705
+ * That node is also moved to the head of the list, so that if it's accessed
4706
+ * again we don't need to traverse the whole list. By doing so, all the recently
4707
+ * used nodes can be accessed relatively quickly.
4708
+ */
4709
+ var listGetNode = function (list, key) { // eslint-disable-line consistent-return
4710
+ for (var prev = list, curr; (curr = prev.next) !== null; prev = curr) {
4711
+ if (curr.key === key) {
4712
+ prev.next = curr.next;
4713
+ curr.next = list.next;
4714
+ list.next = curr; // eslint-disable-line no-param-reassign
4715
+ return curr;
4716
+ }
4717
+ }
4718
+ };
4719
+
4720
+ var listGet = function (objects, key) {
4721
+ var node = listGetNode(objects, key);
4722
+ return node && node.value;
4723
+ };
4724
+ var listSet = function (objects, key, value) {
4725
+ var node = listGetNode(objects, key);
4726
+ if (node) {
4727
+ node.value = value;
4728
+ } else {
4729
+ // Prepend the new node to the beginning of the list
4730
+ objects.next = { // eslint-disable-line no-param-reassign
4731
+ key: key,
4732
+ next: objects.next,
4733
+ value: value
4734
+ };
4735
+ }
4736
+ };
4737
+ var listHas = function (objects, key) {
4738
+ return !!listGetNode(objects, key);
4739
+ };
4740
+
4741
+ var sideChannel = function getSideChannel() {
4742
+ var $wm;
4743
+ var $m;
4744
+ var $o;
4745
+ var channel = {
4746
+ assert: function (key) {
4747
+ if (!channel.has(key)) {
4748
+ throw new $TypeError('Side channel does not contain ' + inspect(key));
4749
+ }
4750
+ },
4751
+ get: function (key) { // eslint-disable-line consistent-return
4752
+ if ($WeakMap && key && (typeof key === 'object' || typeof key === 'function')) {
4753
+ if ($wm) {
4754
+ return $weakMapGet($wm, key);
4755
+ }
4756
+ } else if ($Map) {
4757
+ if ($m) {
4758
+ return $mapGet($m, key);
4759
+ }
4760
+ } else {
4761
+ if ($o) { // eslint-disable-line no-lonely-if
4762
+ return listGet($o, key);
4763
+ }
4764
+ }
4765
+ },
4766
+ has: function (key) {
4767
+ if ($WeakMap && key && (typeof key === 'object' || typeof key === 'function')) {
4768
+ if ($wm) {
4769
+ return $weakMapHas($wm, key);
4770
+ }
4771
+ } else if ($Map) {
4772
+ if ($m) {
4773
+ return $mapHas($m, key);
4774
+ }
4775
+ } else {
4776
+ if ($o) { // eslint-disable-line no-lonely-if
4777
+ return listHas($o, key);
4778
+ }
4779
+ }
4780
+ return false;
4781
+ },
4782
+ set: function (key, value) {
4783
+ if ($WeakMap && key && (typeof key === 'object' || typeof key === 'function')) {
4784
+ if (!$wm) {
4785
+ $wm = new $WeakMap();
4786
+ }
4787
+ $weakMapSet($wm, key, value);
4788
+ } else if ($Map) {
4789
+ if (!$m) {
4790
+ $m = new $Map();
4791
+ }
4792
+ $mapSet($m, key, value);
4793
+ } else {
4794
+ if (!$o) {
4795
+ /*
4796
+ * Initialize the linked list as an empty node, so that we don't have
4797
+ * to special-case handling of the first node: we can always refer to
4798
+ * it as (previous node).next, instead of something like (list).head
4799
+ */
4800
+ $o = { key: {}, next: null };
4801
+ }
4802
+ listSet($o, key, value);
4803
+ }
4804
+ }
4805
+ };
4806
+ return channel;
4807
+ };
4808
+
4809
+ var replace = String.prototype.replace;
4810
+ var percentTwenties = /%20/g;
4811
+
4812
+ var Format = {
4813
+ RFC1738: 'RFC1738',
4814
+ RFC3986: 'RFC3986'
4815
+ };
4816
+
4817
+ var formats$3 = {
4818
+ 'default': Format.RFC3986,
4819
+ formatters: {
4820
+ RFC1738: function (value) {
4821
+ return replace.call(value, percentTwenties, '+');
4822
+ },
4823
+ RFC3986: function (value) {
4824
+ return String(value);
4825
+ }
4826
+ },
4827
+ RFC1738: Format.RFC1738,
4828
+ RFC3986: Format.RFC3986
4829
+ };
4830
+
4831
+ var formats$2 = formats$3;
4832
+
4833
+ var has$2 = Object.prototype.hasOwnProperty;
4834
+ var isArray$2 = Array.isArray;
4835
+
4836
+ var hexTable = (function () {
4837
+ var array = [];
4838
+ for (var i = 0; i < 256; ++i) {
4839
+ array.push('%' + ((i < 16 ? '0' : '') + i.toString(16)).toUpperCase());
4840
+ }
4841
+
4842
+ return array;
4843
+ }());
4844
+
4845
+ var compactQueue = function compactQueue(queue) {
4846
+ while (queue.length > 1) {
4847
+ var item = queue.pop();
4848
+ var obj = item.obj[item.prop];
4849
+
4850
+ if (isArray$2(obj)) {
4851
+ var compacted = [];
4852
+
4853
+ for (var j = 0; j < obj.length; ++j) {
4854
+ if (typeof obj[j] !== 'undefined') {
4855
+ compacted.push(obj[j]);
4856
+ }
4857
+ }
4858
+
4859
+ item.obj[item.prop] = compacted;
4860
+ }
4861
+ }
4862
+ };
4863
+
4864
+ var arrayToObject = function arrayToObject(source, options) {
4865
+ var obj = options && options.plainObjects ? Object.create(null) : {};
4866
+ for (var i = 0; i < source.length; ++i) {
4867
+ if (typeof source[i] !== 'undefined') {
4868
+ obj[i] = source[i];
4869
+ }
4870
+ }
4871
+
4872
+ return obj;
4873
+ };
4874
+
4875
+ var merge = function merge(target, source, options) {
4876
+ /* eslint no-param-reassign: 0 */
4877
+ if (!source) {
4878
+ return target;
4879
+ }
4880
+
4881
+ if (typeof source !== 'object') {
4882
+ if (isArray$2(target)) {
4883
+ target.push(source);
4884
+ } else if (target && typeof target === 'object') {
4885
+ if ((options && (options.plainObjects || options.allowPrototypes)) || !has$2.call(Object.prototype, source)) {
4886
+ target[source] = true;
4887
+ }
4888
+ } else {
4889
+ return [target, source];
4890
+ }
4891
+
4892
+ return target;
4893
+ }
4894
+
4895
+ if (!target || typeof target !== 'object') {
4896
+ return [target].concat(source);
4897
+ }
4898
+
4899
+ var mergeTarget = target;
4900
+ if (isArray$2(target) && !isArray$2(source)) {
4901
+ mergeTarget = arrayToObject(target, options);
4902
+ }
4903
+
4904
+ if (isArray$2(target) && isArray$2(source)) {
4905
+ source.forEach(function (item, i) {
4906
+ if (has$2.call(target, i)) {
4907
+ var targetItem = target[i];
4908
+ if (targetItem && typeof targetItem === 'object' && item && typeof item === 'object') {
4909
+ target[i] = merge(targetItem, item, options);
4910
+ } else {
4911
+ target.push(item);
4912
+ }
4913
+ } else {
4914
+ target[i] = item;
4915
+ }
4916
+ });
4917
+ return target;
4918
+ }
4919
+
4920
+ return Object.keys(source).reduce(function (acc, key) {
4921
+ var value = source[key];
4922
+
4923
+ if (has$2.call(acc, key)) {
4924
+ acc[key] = merge(acc[key], value, options);
4925
+ } else {
4926
+ acc[key] = value;
4927
+ }
4928
+ return acc;
4929
+ }, mergeTarget);
4930
+ };
4931
+
4932
+ var assign = function assignSingleSource(target, source) {
4933
+ return Object.keys(source).reduce(function (acc, key) {
4934
+ acc[key] = source[key];
4935
+ return acc;
4936
+ }, target);
4937
+ };
4938
+
4939
+ var decode = function (str, decoder, charset) {
4940
+ var strWithoutPlus = str.replace(/\+/g, ' ');
4941
+ if (charset === 'iso-8859-1') {
4942
+ // unescape never throws, no try...catch needed:
4943
+ return strWithoutPlus.replace(/%[0-9a-f]{2}/gi, unescape);
4944
+ }
4945
+ // utf-8
4946
+ try {
4947
+ return decodeURIComponent(strWithoutPlus);
4948
+ } catch (e) {
4949
+ return strWithoutPlus;
4950
+ }
4951
+ };
4952
+
4953
+ var encode = function encode(str, defaultEncoder, charset, kind, format) {
4954
+ // This code was originally written by Brian White (mscdex) for the io.js core querystring library.
4955
+ // It has been adapted here for stricter adherence to RFC 3986
4956
+ if (str.length === 0) {
4957
+ return str;
4958
+ }
4959
+
4960
+ var string = str;
4961
+ if (typeof str === 'symbol') {
4962
+ string = Symbol.prototype.toString.call(str);
4963
+ } else if (typeof str !== 'string') {
4964
+ string = String(str);
4965
+ }
4966
+
4967
+ if (charset === 'iso-8859-1') {
4968
+ return escape(string).replace(/%u[0-9a-f]{4}/gi, function ($0) {
4969
+ return '%26%23' + parseInt($0.slice(2), 16) + '%3B';
4970
+ });
4971
+ }
4972
+
4973
+ var out = '';
4974
+ for (var i = 0; i < string.length; ++i) {
4975
+ var c = string.charCodeAt(i);
4976
+
4977
+ if (
4978
+ c === 0x2D // -
4979
+ || c === 0x2E // .
4980
+ || c === 0x5F // _
4981
+ || c === 0x7E // ~
4982
+ || (c >= 0x30 && c <= 0x39) // 0-9
4983
+ || (c >= 0x41 && c <= 0x5A) // a-z
4984
+ || (c >= 0x61 && c <= 0x7A) // A-Z
4985
+ || (format === formats$2.RFC1738 && (c === 0x28 || c === 0x29)) // ( )
4986
+ ) {
4987
+ out += string.charAt(i);
4988
+ continue;
4989
+ }
4990
+
4991
+ if (c < 0x80) {
4992
+ out = out + hexTable[c];
4993
+ continue;
4994
+ }
4995
+
4996
+ if (c < 0x800) {
4997
+ out = out + (hexTable[0xC0 | (c >> 6)] + hexTable[0x80 | (c & 0x3F)]);
4998
+ continue;
4999
+ }
5000
+
5001
+ if (c < 0xD800 || c >= 0xE000) {
5002
+ out = out + (hexTable[0xE0 | (c >> 12)] + hexTable[0x80 | ((c >> 6) & 0x3F)] + hexTable[0x80 | (c & 0x3F)]);
5003
+ continue;
5004
+ }
5005
+
5006
+ i += 1;
5007
+ c = 0x10000 + (((c & 0x3FF) << 10) | (string.charCodeAt(i) & 0x3FF));
5008
+ /* eslint operator-linebreak: [2, "before"] */
5009
+ out += hexTable[0xF0 | (c >> 18)]
5010
+ + hexTable[0x80 | ((c >> 12) & 0x3F)]
5011
+ + hexTable[0x80 | ((c >> 6) & 0x3F)]
5012
+ + hexTable[0x80 | (c & 0x3F)];
5013
+ }
5014
+
5015
+ return out;
5016
+ };
5017
+
5018
+ var compact = function compact(value) {
5019
+ var queue = [{ obj: { o: value }, prop: 'o' }];
5020
+ var refs = [];
5021
+
5022
+ for (var i = 0; i < queue.length; ++i) {
5023
+ var item = queue[i];
5024
+ var obj = item.obj[item.prop];
5025
+
5026
+ var keys = Object.keys(obj);
5027
+ for (var j = 0; j < keys.length; ++j) {
5028
+ var key = keys[j];
5029
+ var val = obj[key];
5030
+ if (typeof val === 'object' && val !== null && refs.indexOf(val) === -1) {
5031
+ queue.push({ obj: obj, prop: key });
5032
+ refs.push(val);
5033
+ }
5034
+ }
5035
+ }
5036
+
5037
+ compactQueue(queue);
5038
+
5039
+ return value;
5040
+ };
5041
+
5042
+ var isRegExp = function isRegExp(obj) {
5043
+ return Object.prototype.toString.call(obj) === '[object RegExp]';
5044
+ };
5045
+
5046
+ var isBuffer = function isBuffer(obj) {
5047
+ if (!obj || typeof obj !== 'object') {
5048
+ return false;
5049
+ }
5050
+
5051
+ return !!(obj.constructor && obj.constructor.isBuffer && obj.constructor.isBuffer(obj));
5052
+ };
5053
+
5054
+ var combine = function combine(a, b) {
5055
+ return [].concat(a, b);
5056
+ };
5057
+
5058
+ var maybeMap = function maybeMap(val, fn) {
5059
+ if (isArray$2(val)) {
5060
+ var mapped = [];
5061
+ for (var i = 0; i < val.length; i += 1) {
5062
+ mapped.push(fn(val[i]));
5063
+ }
5064
+ return mapped;
5065
+ }
5066
+ return fn(val);
5067
+ };
5068
+
5069
+ var utils$2 = {
5070
+ arrayToObject: arrayToObject,
5071
+ assign: assign,
5072
+ combine: combine,
5073
+ compact: compact,
5074
+ decode: decode,
5075
+ encode: encode,
5076
+ isBuffer: isBuffer,
5077
+ isRegExp: isRegExp,
5078
+ maybeMap: maybeMap,
5079
+ merge: merge
5080
+ };
5081
+
5082
+ var getSideChannel = sideChannel;
5083
+ var utils$1 = utils$2;
5084
+ var formats$1 = formats$3;
5085
+ var has$1 = Object.prototype.hasOwnProperty;
5086
+
5087
+ var arrayPrefixGenerators = {
5088
+ brackets: function brackets(prefix) {
5089
+ return prefix + '[]';
5090
+ },
5091
+ comma: 'comma',
5092
+ indices: function indices(prefix, key) {
5093
+ return prefix + '[' + key + ']';
5094
+ },
5095
+ repeat: function repeat(prefix) {
5096
+ return prefix;
5097
+ }
5098
+ };
5099
+
5100
+ var isArray$1 = Array.isArray;
5101
+ var split = String.prototype.split;
5102
+ var push = Array.prototype.push;
5103
+ var pushToArray = function (arr, valueOrArray) {
5104
+ push.apply(arr, isArray$1(valueOrArray) ? valueOrArray : [valueOrArray]);
5105
+ };
5106
+
5107
+ var toISO = Date.prototype.toISOString;
5108
+
5109
+ var defaultFormat = formats$1['default'];
5110
+ var defaults$1 = {
5111
+ addQueryPrefix: false,
5112
+ allowDots: false,
5113
+ charset: 'utf-8',
5114
+ charsetSentinel: false,
5115
+ delimiter: '&',
5116
+ encode: true,
5117
+ encoder: utils$1.encode,
5118
+ encodeValuesOnly: false,
5119
+ format: defaultFormat,
5120
+ formatter: formats$1.formatters[defaultFormat],
5121
+ // deprecated
5122
+ indices: false,
5123
+ serializeDate: function serializeDate(date) {
5124
+ return toISO.call(date);
5125
+ },
5126
+ skipNulls: false,
5127
+ strictNullHandling: false
5128
+ };
5129
+
5130
+ var isNonNullishPrimitive = function isNonNullishPrimitive(v) {
5131
+ return typeof v === 'string'
5132
+ || typeof v === 'number'
5133
+ || typeof v === 'boolean'
5134
+ || typeof v === 'symbol'
5135
+ || typeof v === 'bigint';
5136
+ };
5137
+
5138
+ var sentinel = {};
5139
+
5140
+ var stringify$1 = function stringify(
5141
+ object,
5142
+ prefix,
5143
+ generateArrayPrefix,
5144
+ commaRoundTrip,
5145
+ strictNullHandling,
5146
+ skipNulls,
5147
+ encoder,
5148
+ filter,
5149
+ sort,
5150
+ allowDots,
5151
+ serializeDate,
5152
+ format,
5153
+ formatter,
5154
+ encodeValuesOnly,
5155
+ charset,
5156
+ sideChannel
5157
+ ) {
5158
+ var obj = object;
5159
+
5160
+ var tmpSc = sideChannel;
5161
+ var step = 0;
5162
+ var findFlag = false;
5163
+ while ((tmpSc = tmpSc.get(sentinel)) !== void undefined && !findFlag) {
5164
+ // Where object last appeared in the ref tree
5165
+ var pos = tmpSc.get(object);
5166
+ step += 1;
5167
+ if (typeof pos !== 'undefined') {
5168
+ if (pos === step) {
5169
+ throw new RangeError('Cyclic object value');
5170
+ } else {
5171
+ findFlag = true; // Break while
5172
+ }
5173
+ }
5174
+ if (typeof tmpSc.get(sentinel) === 'undefined') {
5175
+ step = 0;
5176
+ }
5177
+ }
5178
+
5179
+ if (typeof filter === 'function') {
5180
+ obj = filter(prefix, obj);
5181
+ } else if (obj instanceof Date) {
5182
+ obj = serializeDate(obj);
5183
+ } else if (generateArrayPrefix === 'comma' && isArray$1(obj)) {
5184
+ obj = utils$1.maybeMap(obj, function (value) {
5185
+ if (value instanceof Date) {
5186
+ return serializeDate(value);
5187
+ }
5188
+ return value;
5189
+ });
5190
+ }
5191
+
5192
+ if (obj === null) {
5193
+ if (strictNullHandling) {
5194
+ return encoder && !encodeValuesOnly ? encoder(prefix, defaults$1.encoder, charset, 'key', format) : prefix;
5195
+ }
5196
+
5197
+ obj = '';
5198
+ }
5199
+
5200
+ if (isNonNullishPrimitive(obj) || utils$1.isBuffer(obj)) {
5201
+ if (encoder) {
5202
+ var keyValue = encodeValuesOnly ? prefix : encoder(prefix, defaults$1.encoder, charset, 'key', format);
5203
+ if (generateArrayPrefix === 'comma' && encodeValuesOnly) {
5204
+ var valuesArray = split.call(String(obj), ',');
5205
+ var valuesJoined = '';
5206
+ for (var i = 0; i < valuesArray.length; ++i) {
5207
+ valuesJoined += (i === 0 ? '' : ',') + formatter(encoder(valuesArray[i], defaults$1.encoder, charset, 'value', format));
5208
+ }
5209
+ return [formatter(keyValue) + (commaRoundTrip && isArray$1(obj) && valuesArray.length === 1 ? '[]' : '') + '=' + valuesJoined];
5210
+ }
5211
+ return [formatter(keyValue) + '=' + formatter(encoder(obj, defaults$1.encoder, charset, 'value', format))];
5212
+ }
5213
+ return [formatter(prefix) + '=' + formatter(String(obj))];
5214
+ }
5215
+
5216
+ var values = [];
5217
+
5218
+ if (typeof obj === 'undefined') {
5219
+ return values;
5220
+ }
5221
+
5222
+ var objKeys;
5223
+ if (generateArrayPrefix === 'comma' && isArray$1(obj)) {
5224
+ // we need to join elements in
5225
+ objKeys = [{ value: obj.length > 0 ? obj.join(',') || null : void undefined }];
5226
+ } else if (isArray$1(filter)) {
5227
+ objKeys = filter;
5228
+ } else {
5229
+ var keys = Object.keys(obj);
5230
+ objKeys = sort ? keys.sort(sort) : keys;
5231
+ }
5232
+
5233
+ var adjustedPrefix = commaRoundTrip && isArray$1(obj) && obj.length === 1 ? prefix + '[]' : prefix;
5234
+
5235
+ for (var j = 0; j < objKeys.length; ++j) {
5236
+ var key = objKeys[j];
5237
+ var value = typeof key === 'object' && typeof key.value !== 'undefined' ? key.value : obj[key];
5238
+
5239
+ if (skipNulls && value === null) {
5240
+ continue;
5241
+ }
5242
+
5243
+ var keyPrefix = isArray$1(obj)
5244
+ ? typeof generateArrayPrefix === 'function' ? generateArrayPrefix(adjustedPrefix, key) : adjustedPrefix
5245
+ : adjustedPrefix + (allowDots ? '.' + key : '[' + key + ']');
5246
+
5247
+ sideChannel.set(object, step);
5248
+ var valueSideChannel = getSideChannel();
5249
+ valueSideChannel.set(sentinel, sideChannel);
5250
+ pushToArray(values, stringify(
5251
+ value,
5252
+ keyPrefix,
5253
+ generateArrayPrefix,
5254
+ commaRoundTrip,
5255
+ strictNullHandling,
5256
+ skipNulls,
5257
+ encoder,
5258
+ filter,
5259
+ sort,
5260
+ allowDots,
5261
+ serializeDate,
5262
+ format,
5263
+ formatter,
5264
+ encodeValuesOnly,
5265
+ charset,
5266
+ valueSideChannel
5267
+ ));
5268
+ }
5269
+
5270
+ return values;
5271
+ };
5272
+
5273
+ var normalizeStringifyOptions = function normalizeStringifyOptions(opts) {
5274
+ if (!opts) {
5275
+ return defaults$1;
5276
+ }
5277
+
5278
+ if (opts.encoder !== null && typeof opts.encoder !== 'undefined' && typeof opts.encoder !== 'function') {
5279
+ throw new TypeError('Encoder has to be a function.');
5280
+ }
5281
+
5282
+ var charset = opts.charset || defaults$1.charset;
5283
+ if (typeof opts.charset !== 'undefined' && opts.charset !== 'utf-8' && opts.charset !== 'iso-8859-1') {
5284
+ throw new TypeError('The charset option must be either utf-8, iso-8859-1, or undefined');
5285
+ }
5286
+
5287
+ var format = formats$1['default'];
5288
+ if (typeof opts.format !== 'undefined') {
5289
+ if (!has$1.call(formats$1.formatters, opts.format)) {
5290
+ throw new TypeError('Unknown format option provided.');
5291
+ }
5292
+ format = opts.format;
5293
+ }
5294
+ var formatter = formats$1.formatters[format];
5295
+
5296
+ var filter = defaults$1.filter;
5297
+ if (typeof opts.filter === 'function' || isArray$1(opts.filter)) {
5298
+ filter = opts.filter;
5299
+ }
5300
+
5301
+ return {
5302
+ addQueryPrefix: typeof opts.addQueryPrefix === 'boolean' ? opts.addQueryPrefix : defaults$1.addQueryPrefix,
5303
+ allowDots: typeof opts.allowDots === 'undefined' ? defaults$1.allowDots : !!opts.allowDots,
5304
+ charset: charset,
5305
+ charsetSentinel: typeof opts.charsetSentinel === 'boolean' ? opts.charsetSentinel : defaults$1.charsetSentinel,
5306
+ delimiter: typeof opts.delimiter === 'undefined' ? defaults$1.delimiter : opts.delimiter,
5307
+ encode: typeof opts.encode === 'boolean' ? opts.encode : defaults$1.encode,
5308
+ encoder: typeof opts.encoder === 'function' ? opts.encoder : defaults$1.encoder,
5309
+ encodeValuesOnly: typeof opts.encodeValuesOnly === 'boolean' ? opts.encodeValuesOnly : defaults$1.encodeValuesOnly,
5310
+ filter: filter,
5311
+ format: format,
5312
+ formatter: formatter,
5313
+ serializeDate: typeof opts.serializeDate === 'function' ? opts.serializeDate : defaults$1.serializeDate,
5314
+ skipNulls: typeof opts.skipNulls === 'boolean' ? opts.skipNulls : defaults$1.skipNulls,
5315
+ sort: typeof opts.sort === 'function' ? opts.sort : null,
5316
+ strictNullHandling: typeof opts.strictNullHandling === 'boolean' ? opts.strictNullHandling : defaults$1.strictNullHandling
5317
+ };
5318
+ };
5319
+
5320
+ var stringify_1 = function (object, opts) {
5321
+ var obj = object;
5322
+ var options = normalizeStringifyOptions(opts);
5323
+
5324
+ var objKeys;
5325
+ var filter;
5326
+
5327
+ if (typeof options.filter === 'function') {
5328
+ filter = options.filter;
5329
+ obj = filter('', obj);
5330
+ } else if (isArray$1(options.filter)) {
5331
+ filter = options.filter;
5332
+ objKeys = filter;
5333
+ }
5334
+
5335
+ var keys = [];
5336
+
5337
+ if (typeof obj !== 'object' || obj === null) {
5338
+ return '';
5339
+ }
5340
+
5341
+ var arrayFormat;
5342
+ if (opts && opts.arrayFormat in arrayPrefixGenerators) {
5343
+ arrayFormat = opts.arrayFormat;
5344
+ } else if (opts && 'indices' in opts) {
5345
+ arrayFormat = opts.indices ? 'indices' : 'repeat';
5346
+ } else {
5347
+ arrayFormat = 'indices';
5348
+ }
5349
+
5350
+ var generateArrayPrefix = arrayPrefixGenerators[arrayFormat];
5351
+ if (opts && 'commaRoundTrip' in opts && typeof opts.commaRoundTrip !== 'boolean') {
5352
+ throw new TypeError('`commaRoundTrip` must be a boolean, or absent');
5353
+ }
5354
+ var commaRoundTrip = generateArrayPrefix === 'comma' && opts && opts.commaRoundTrip;
5355
+
5356
+ if (!objKeys) {
5357
+ objKeys = Object.keys(obj);
5358
+ }
5359
+
5360
+ if (options.sort) {
5361
+ objKeys.sort(options.sort);
5362
+ }
5363
+
5364
+ var sideChannel = getSideChannel();
5365
+ for (var i = 0; i < objKeys.length; ++i) {
5366
+ var key = objKeys[i];
5367
+
5368
+ if (options.skipNulls && obj[key] === null) {
5369
+ continue;
5370
+ }
5371
+ pushToArray(keys, stringify$1(
5372
+ obj[key],
5373
+ key,
5374
+ generateArrayPrefix,
5375
+ commaRoundTrip,
5376
+ options.strictNullHandling,
5377
+ options.skipNulls,
5378
+ options.encode ? options.encoder : null,
5379
+ options.filter,
5380
+ options.sort,
5381
+ options.allowDots,
5382
+ options.serializeDate,
5383
+ options.format,
5384
+ options.formatter,
5385
+ options.encodeValuesOnly,
5386
+ options.charset,
5387
+ sideChannel
5388
+ ));
5389
+ }
5390
+
5391
+ var joined = keys.join(options.delimiter);
5392
+ var prefix = options.addQueryPrefix === true ? '?' : '';
5393
+
5394
+ if (options.charsetSentinel) {
5395
+ if (options.charset === 'iso-8859-1') {
5396
+ // encodeURIComponent('&#10003;'), the "numeric entity" representation of a checkmark
5397
+ prefix += 'utf8=%26%2310003%3B&';
5398
+ } else {
5399
+ // encodeURIComponent('✓')
5400
+ prefix += 'utf8=%E2%9C%93&';
5401
+ }
5402
+ }
5403
+
5404
+ return joined.length > 0 ? prefix + joined : '';
5405
+ };
5406
+
5407
+ var utils = utils$2;
5408
+
5409
+ var has = Object.prototype.hasOwnProperty;
5410
+ var isArray = Array.isArray;
5411
+
5412
+ var defaults = {
5413
+ allowDots: false,
5414
+ allowPrototypes: false,
5415
+ allowSparse: false,
5416
+ arrayLimit: 20,
5417
+ charset: 'utf-8',
5418
+ charsetSentinel: false,
5419
+ comma: false,
5420
+ decoder: utils.decode,
5421
+ delimiter: '&',
5422
+ depth: 5,
5423
+ ignoreQueryPrefix: false,
5424
+ interpretNumericEntities: false,
5425
+ parameterLimit: 1000,
5426
+ parseArrays: true,
5427
+ plainObjects: false,
5428
+ strictNullHandling: false
5429
+ };
5430
+
5431
+ var interpretNumericEntities = function (str) {
5432
+ return str.replace(/&#(\d+);/g, function ($0, numberStr) {
5433
+ return String.fromCharCode(parseInt(numberStr, 10));
5434
+ });
5435
+ };
5436
+
5437
+ var parseArrayValue = function (val, options) {
5438
+ if (val && typeof val === 'string' && options.comma && val.indexOf(',') > -1) {
5439
+ return val.split(',');
5440
+ }
5441
+
5442
+ return val;
5443
+ };
5444
+
5445
+ // This is what browsers will submit when the ✓ character occurs in an
5446
+ // application/x-www-form-urlencoded body and the encoding of the page containing
5447
+ // the form is iso-8859-1, or when the submitted form has an accept-charset
5448
+ // attribute of iso-8859-1. Presumably also with other charsets that do not contain
5449
+ // the ✓ character, such as us-ascii.
5450
+ var isoSentinel = 'utf8=%26%2310003%3B'; // encodeURIComponent('&#10003;')
5451
+
5452
+ // These are the percent-encoded utf-8 octets representing a checkmark, indicating that the request actually is utf-8 encoded.
5453
+ var charsetSentinel = 'utf8=%E2%9C%93'; // encodeURIComponent('✓')
5454
+
5455
+ var parseValues = function parseQueryStringValues(str, options) {
5456
+ var obj = {};
5457
+ var cleanStr = options.ignoreQueryPrefix ? str.replace(/^\?/, '') : str;
5458
+ var limit = options.parameterLimit === Infinity ? undefined : options.parameterLimit;
5459
+ var parts = cleanStr.split(options.delimiter, limit);
5460
+ var skipIndex = -1; // Keep track of where the utf8 sentinel was found
5461
+ var i;
5462
+
5463
+ var charset = options.charset;
5464
+ if (options.charsetSentinel) {
5465
+ for (i = 0; i < parts.length; ++i) {
5466
+ if (parts[i].indexOf('utf8=') === 0) {
5467
+ if (parts[i] === charsetSentinel) {
5468
+ charset = 'utf-8';
5469
+ } else if (parts[i] === isoSentinel) {
5470
+ charset = 'iso-8859-1';
5471
+ }
5472
+ skipIndex = i;
5473
+ i = parts.length; // The eslint settings do not allow break;
5474
+ }
5475
+ }
5476
+ }
5477
+
5478
+ for (i = 0; i < parts.length; ++i) {
5479
+ if (i === skipIndex) {
5480
+ continue;
5481
+ }
5482
+ var part = parts[i];
5483
+
5484
+ var bracketEqualsPos = part.indexOf(']=');
5485
+ var pos = bracketEqualsPos === -1 ? part.indexOf('=') : bracketEqualsPos + 1;
5486
+
5487
+ var key, val;
5488
+ if (pos === -1) {
5489
+ key = options.decoder(part, defaults.decoder, charset, 'key');
5490
+ val = options.strictNullHandling ? null : '';
5491
+ } else {
5492
+ key = options.decoder(part.slice(0, pos), defaults.decoder, charset, 'key');
5493
+ val = utils.maybeMap(
5494
+ parseArrayValue(part.slice(pos + 1), options),
5495
+ function (encodedVal) {
5496
+ return options.decoder(encodedVal, defaults.decoder, charset, 'value');
5497
+ }
5498
+ );
5499
+ }
5500
+
5501
+ if (val && options.interpretNumericEntities && charset === 'iso-8859-1') {
5502
+ val = interpretNumericEntities(val);
5503
+ }
5504
+
5505
+ if (part.indexOf('[]=') > -1) {
5506
+ val = isArray(val) ? [val] : val;
5507
+ }
5508
+
5509
+ if (has.call(obj, key)) {
5510
+ obj[key] = utils.combine(obj[key], val);
5511
+ } else {
5512
+ obj[key] = val;
5513
+ }
5514
+ }
5515
+
5516
+ return obj;
5517
+ };
5518
+
5519
+ var parseObject = function (chain, val, options, valuesParsed) {
5520
+ var leaf = valuesParsed ? val : parseArrayValue(val, options);
5521
+
5522
+ for (var i = chain.length - 1; i >= 0; --i) {
5523
+ var obj;
5524
+ var root = chain[i];
5525
+
5526
+ if (root === '[]' && options.parseArrays) {
5527
+ obj = [].concat(leaf);
5528
+ } else {
5529
+ obj = options.plainObjects ? Object.create(null) : {};
5530
+ var cleanRoot = root.charAt(0) === '[' && root.charAt(root.length - 1) === ']' ? root.slice(1, -1) : root;
5531
+ var index = parseInt(cleanRoot, 10);
5532
+ if (!options.parseArrays && cleanRoot === '') {
5533
+ obj = { 0: leaf };
5534
+ } else if (
5535
+ !isNaN(index)
5536
+ && root !== cleanRoot
5537
+ && String(index) === cleanRoot
5538
+ && index >= 0
5539
+ && (options.parseArrays && index <= options.arrayLimit)
5540
+ ) {
5541
+ obj = [];
5542
+ obj[index] = leaf;
5543
+ } else if (cleanRoot !== '__proto__') {
5544
+ obj[cleanRoot] = leaf;
5545
+ }
5546
+ }
5547
+
5548
+ leaf = obj;
5549
+ }
5550
+
5551
+ return leaf;
5552
+ };
5553
+
5554
+ var parseKeys = function parseQueryStringKeys(givenKey, val, options, valuesParsed) {
5555
+ if (!givenKey) {
5556
+ return;
5557
+ }
5558
+
5559
+ // Transform dot notation to bracket notation
5560
+ var key = options.allowDots ? givenKey.replace(/\.([^.[]+)/g, '[$1]') : givenKey;
5561
+
5562
+ // The regex chunks
5563
+
5564
+ var brackets = /(\[[^[\]]*])/;
5565
+ var child = /(\[[^[\]]*])/g;
5566
+
5567
+ // Get the parent
5568
+
5569
+ var segment = options.depth > 0 && brackets.exec(key);
5570
+ var parent = segment ? key.slice(0, segment.index) : key;
5571
+
5572
+ // Stash the parent if it exists
5573
+
5574
+ var keys = [];
5575
+ if (parent) {
5576
+ // If we aren't using plain objects, optionally prefix keys that would overwrite object prototype properties
5577
+ if (!options.plainObjects && has.call(Object.prototype, parent)) {
5578
+ if (!options.allowPrototypes) {
5579
+ return;
5580
+ }
5581
+ }
5582
+
5583
+ keys.push(parent);
5584
+ }
5585
+
5586
+ // Loop through children appending to the array until we hit depth
5587
+
5588
+ var i = 0;
5589
+ while (options.depth > 0 && (segment = child.exec(key)) !== null && i < options.depth) {
5590
+ i += 1;
5591
+ if (!options.plainObjects && has.call(Object.prototype, segment[1].slice(1, -1))) {
5592
+ if (!options.allowPrototypes) {
5593
+ return;
5594
+ }
5595
+ }
5596
+ keys.push(segment[1]);
5597
+ }
5598
+
5599
+ // If there's a remainder, just add whatever is left
5600
+
5601
+ if (segment) {
5602
+ keys.push('[' + key.slice(segment.index) + ']');
5603
+ }
5604
+
5605
+ return parseObject(keys, val, options, valuesParsed);
5606
+ };
5607
+
5608
+ var normalizeParseOptions = function normalizeParseOptions(opts) {
5609
+ if (!opts) {
5610
+ return defaults;
5611
+ }
5612
+
5613
+ if (opts.decoder !== null && opts.decoder !== undefined && typeof opts.decoder !== 'function') {
5614
+ throw new TypeError('Decoder has to be a function.');
5615
+ }
5616
+
5617
+ if (typeof opts.charset !== 'undefined' && opts.charset !== 'utf-8' && opts.charset !== 'iso-8859-1') {
5618
+ throw new TypeError('The charset option must be either utf-8, iso-8859-1, or undefined');
5619
+ }
5620
+ var charset = typeof opts.charset === 'undefined' ? defaults.charset : opts.charset;
5621
+
5622
+ return {
5623
+ allowDots: typeof opts.allowDots === 'undefined' ? defaults.allowDots : !!opts.allowDots,
5624
+ allowPrototypes: typeof opts.allowPrototypes === 'boolean' ? opts.allowPrototypes : defaults.allowPrototypes,
5625
+ allowSparse: typeof opts.allowSparse === 'boolean' ? opts.allowSparse : defaults.allowSparse,
5626
+ arrayLimit: typeof opts.arrayLimit === 'number' ? opts.arrayLimit : defaults.arrayLimit,
5627
+ charset: charset,
5628
+ charsetSentinel: typeof opts.charsetSentinel === 'boolean' ? opts.charsetSentinel : defaults.charsetSentinel,
5629
+ comma: typeof opts.comma === 'boolean' ? opts.comma : defaults.comma,
5630
+ decoder: typeof opts.decoder === 'function' ? opts.decoder : defaults.decoder,
5631
+ delimiter: typeof opts.delimiter === 'string' || utils.isRegExp(opts.delimiter) ? opts.delimiter : defaults.delimiter,
5632
+ // eslint-disable-next-line no-implicit-coercion, no-extra-parens
5633
+ depth: (typeof opts.depth === 'number' || opts.depth === false) ? +opts.depth : defaults.depth,
5634
+ ignoreQueryPrefix: opts.ignoreQueryPrefix === true,
5635
+ interpretNumericEntities: typeof opts.interpretNumericEntities === 'boolean' ? opts.interpretNumericEntities : defaults.interpretNumericEntities,
5636
+ parameterLimit: typeof opts.parameterLimit === 'number' ? opts.parameterLimit : defaults.parameterLimit,
5637
+ parseArrays: opts.parseArrays !== false,
5638
+ plainObjects: typeof opts.plainObjects === 'boolean' ? opts.plainObjects : defaults.plainObjects,
5639
+ strictNullHandling: typeof opts.strictNullHandling === 'boolean' ? opts.strictNullHandling : defaults.strictNullHandling
5640
+ };
5641
+ };
5642
+
5643
+ var parse$2 = function (str, opts) {
5644
+ var options = normalizeParseOptions(opts);
5645
+
5646
+ if (str === '' || str === null || typeof str === 'undefined') {
5647
+ return options.plainObjects ? Object.create(null) : {};
5648
+ }
5649
+
5650
+ var tempObj = typeof str === 'string' ? parseValues(str, options) : str;
5651
+ var obj = options.plainObjects ? Object.create(null) : {};
5652
+
5653
+ // Iterate over the keys and setup the new object
5654
+
5655
+ var keys = Object.keys(tempObj);
5656
+ for (var i = 0; i < keys.length; ++i) {
5657
+ var key = keys[i];
5658
+ var newObj = parseKeys(key, tempObj[key], options, typeof str === 'string');
5659
+ obj = utils.merge(obj, newObj, options);
5660
+ }
5661
+
5662
+ if (options.allowSparse === true) {
5663
+ return obj;
5664
+ }
5665
+
5666
+ return utils.compact(obj);
5667
+ };
5668
+
5669
+ var stringify = stringify_1;
5670
+ var parse$1 = parse$2;
5671
+ var formats = formats$3;
5672
+
5673
+ var lib = {
5674
+ formats: formats,
5675
+ parse: parse$1,
5676
+ stringify: stringify
5677
+ };
5678
+
5679
+ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
5680
+ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
5681
+ var useQueryParams = function useQueryParams() {
5682
+ var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
5683
+ var location = reactRouterDom.useLocation();
5684
+ return lib.parse(location.search, _objectSpread({
5685
+ ignoreQueryPrefix: true
5686
+ }, options));
5687
+ };
5688
+
3642
5689
  function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
3643
5690
  try {
3644
5691
  var info = gen[key](arg);
@@ -4882,6 +6929,7 @@ exports.useNavigationCheckpoints = useNavigationCheckpoints;
4882
6929
  exports.useOnClickOutside = useOnClickOutside;
4883
6930
  exports.usePersistedQuery = usePersistedQuery;
4884
6931
  exports.usePrevious = usePrevious;
6932
+ exports.useQueryParams = useQueryParams;
4885
6933
  exports.useRegisterNavigationCheckpoint = useRegisterNavigationCheckpoint;
4886
6934
  exports.useStateWithDependency = useStateWithDependency;
4887
6935
  exports.useTimer = useTimer;