@bigbinary/neeto-commons-frontend 2.0.8 → 2.0.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.
package/utils.js CHANGED
@@ -1,6 +1,8 @@
1
1
  import axios from 'axios';
2
- import { values, curry, toPairs, omit, isEmpty } from 'ramda';
2
+ import { values, curry, toPairs, pipe, omit, isEmpty } from 'ramda';
3
+ import { Toastr } from '@bigbinary/neetoui';
3
4
  import i18next from 'i18next';
5
+ import require$$0 from 'util';
4
6
  import dayjs from 'dayjs';
5
7
  import relativeTime from 'dayjs/plugin/relativeTime';
6
8
  import updateLocale from 'dayjs/plugin/updateLocale';
@@ -131,7 +133,7 @@ function _defineProperty(obj, key, value) {
131
133
 
132
134
  var regeneratorRuntime$1 = {exports: {}};
133
135
 
134
- var _typeof = {exports: {}};
136
+ var _typeof$1 = {exports: {}};
135
137
 
136
138
  (function (module) {
137
139
  function _typeof(obj) {
@@ -145,10 +147,10 @@ var _typeof = {exports: {}};
145
147
  }
146
148
 
147
149
  module.exports = _typeof, module.exports.__esModule = true, module.exports["default"] = module.exports;
148
- } (_typeof));
150
+ } (_typeof$1));
149
151
 
150
152
  (function (module) {
151
- var _typeof$1 = _typeof.exports["default"];
153
+ var _typeof = _typeof$1.exports["default"];
152
154
 
153
155
  function _regeneratorRuntime() {
154
156
  /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */
@@ -275,7 +277,7 @@ var _typeof = {exports: {}};
275
277
  if ("throw" !== record.type) {
276
278
  var result = record.arg,
277
279
  value = result.value;
278
- return value && "object" == _typeof$1(value) && hasOwn.call(value, "__await") ? PromiseImpl.resolve(value.__await).then(function (value) {
280
+ return value && "object" == _typeof(value) && hasOwn.call(value, "__await") ? PromiseImpl.resolve(value.__await).then(function (value) {
279
281
  invoke("next", value, resolve, reject);
280
282
  }, function (err) {
281
283
  invoke("throw", err, resolve, reject);
@@ -534,625 +536,2059 @@ var getRandomInt = function getRandomInt() {
534
536
  return Math.floor(Math.random() * (b - a) + a);
535
537
  };
536
538
 
537
- var queryString = {};
539
+ function _typeof(obj) {
540
+ "@babel/helpers - typeof";
538
541
 
539
- var strictUriEncode = str => encodeURIComponent(str).replace(/[!'()*]/g, x => `%${x.charCodeAt(0).toString(16).toUpperCase()}`);
542
+ return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) {
543
+ return typeof obj;
544
+ } : function (obj) {
545
+ return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
546
+ }, _typeof(obj);
547
+ }
540
548
 
541
- var token = '%[a-f0-9]{2}';
542
- var singleMatcher = new RegExp(token, 'gi');
543
- var multiMatcher = new RegExp('(' + token + ')+', 'gi');
549
+ var transformObjectDeep = function transformObjectDeep(object, keyValueTransformer) {
550
+ var objectPreProcessor = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : undefined;
544
551
 
545
- function decodeComponents(components, split) {
546
- try {
547
- // Try to decode the entire string first
548
- return decodeURIComponent(components.join(''));
549
- } catch (err) {
550
- // Do nothing
551
- }
552
+ if (objectPreProcessor && typeof objectPreProcessor === "function") {
553
+ object = objectPreProcessor(object);
554
+ }
552
555
 
553
- if (components.length === 1) {
554
- return components;
555
- }
556
+ if (Array.isArray(object)) {
557
+ return object.map(function (obj) {
558
+ return transformObjectDeep(obj, keyValueTransformer, objectPreProcessor);
559
+ });
560
+ } else if (object === null || _typeof(object) !== "object") {
561
+ return object;
562
+ }
556
563
 
557
- split = split || 1;
564
+ return Object.fromEntries(Object.entries(object).map(function (_ref3) {
565
+ var _ref4 = _slicedToArray(_ref3, 2),
566
+ key = _ref4[0],
567
+ value = _ref4[1];
558
568
 
559
- // Split the array in 2 parts
560
- var left = components.slice(0, split);
561
- var right = components.slice(split);
569
+ return keyValueTransformer(key, transformObjectDeep(value, keyValueTransformer, objectPreProcessor));
570
+ }));
571
+ };
572
+ var preprocessForSerialization = function preprocessForSerialization(object) {
573
+ return transformObjectDeep(object, function (key, value) {
574
+ return [key, value];
575
+ }, function (object) {
576
+ return typeof (object === null || object === void 0 ? void 0 : object.toJSON) === "function" ? object.toJSON() : object;
577
+ });
578
+ };
562
579
 
563
- return Array.prototype.concat.call([], decodeComponents(left), decodeComponents(right));
564
- }
580
+ /* eslint complexity: [2, 18], max-statements: [2, 33] */
581
+ var shams = function hasSymbols() {
582
+ if (typeof Symbol !== 'function' || typeof Object.getOwnPropertySymbols !== 'function') { return false; }
583
+ if (typeof Symbol.iterator === 'symbol') { return true; }
565
584
 
566
- function decode(input) {
567
- try {
568
- return decodeURIComponent(input);
569
- } catch (err) {
570
- var tokens = input.match(singleMatcher);
585
+ var obj = {};
586
+ var sym = Symbol('test');
587
+ var symObj = Object(sym);
588
+ if (typeof sym === 'string') { return false; }
571
589
 
572
- for (var i = 1; i < tokens.length; i++) {
573
- input = decodeComponents(tokens, i).join('');
590
+ if (Object.prototype.toString.call(sym) !== '[object Symbol]') { return false; }
591
+ if (Object.prototype.toString.call(symObj) !== '[object Symbol]') { return false; }
574
592
 
575
- tokens = input.match(singleMatcher);
576
- }
593
+ // temp disabled per https://github.com/ljharb/object.assign/issues/17
594
+ // if (sym instanceof Symbol) { return false; }
595
+ // temp disabled per https://github.com/WebReflection/get-own-property-symbols/issues/4
596
+ // if (!(symObj instanceof Symbol)) { return false; }
577
597
 
578
- return input;
579
- }
580
- }
598
+ // if (typeof Symbol.prototype.toString !== 'function') { return false; }
599
+ // if (String(sym) !== Symbol.prototype.toString.call(sym)) { return false; }
581
600
 
582
- function customDecodeURIComponent(input) {
583
- // Keep track of all the replacements and prefill the map with the `BOM`
584
- var replaceMap = {
585
- '%FE%FF': '\uFFFD\uFFFD',
586
- '%FF%FE': '\uFFFD\uFFFD'
587
- };
601
+ var symVal = 42;
602
+ obj[sym] = symVal;
603
+ for (sym in obj) { return false; } // eslint-disable-line no-restricted-syntax, no-unreachable-loop
604
+ if (typeof Object.keys === 'function' && Object.keys(obj).length !== 0) { return false; }
588
605
 
589
- var match = multiMatcher.exec(input);
590
- while (match) {
591
- try {
592
- // Decode as big chunks as possible
593
- replaceMap[match[0]] = decodeURIComponent(match[0]);
594
- } catch (err) {
595
- var result = decode(match[0]);
606
+ if (typeof Object.getOwnPropertyNames === 'function' && Object.getOwnPropertyNames(obj).length !== 0) { return false; }
596
607
 
597
- if (result !== match[0]) {
598
- replaceMap[match[0]] = result;
599
- }
600
- }
608
+ var syms = Object.getOwnPropertySymbols(obj);
609
+ if (syms.length !== 1 || syms[0] !== sym) { return false; }
610
+
611
+ if (!Object.prototype.propertyIsEnumerable.call(obj, sym)) { return false; }
601
612
 
602
- match = multiMatcher.exec(input);
613
+ if (typeof Object.getOwnPropertyDescriptor === 'function') {
614
+ var descriptor = Object.getOwnPropertyDescriptor(obj, sym);
615
+ if (descriptor.value !== symVal || descriptor.enumerable !== true) { return false; }
603
616
  }
604
617
 
605
- // Add `%C2` at the end of the map to make sure it does not replace the combinator before everything else
606
- replaceMap['%C2'] = '\uFFFD';
618
+ return true;
619
+ };
607
620
 
608
- var entries = Object.keys(replaceMap);
621
+ var origSymbol = typeof Symbol !== 'undefined' && Symbol;
622
+ var hasSymbolSham = shams;
609
623
 
610
- for (var i = 0; i < entries.length; i++) {
611
- // Replace all decoded components
612
- var key = entries[i];
613
- input = input.replace(new RegExp(key, 'g'), replaceMap[key]);
614
- }
624
+ var hasSymbols$1 = function hasNativeSymbols() {
625
+ if (typeof origSymbol !== 'function') { return false; }
626
+ if (typeof Symbol !== 'function') { return false; }
627
+ if (typeof origSymbol('foo') !== 'symbol') { return false; }
628
+ if (typeof Symbol('bar') !== 'symbol') { return false; }
615
629
 
616
- return input;
617
- }
630
+ return hasSymbolSham();
631
+ };
618
632
 
619
- var decodeUriComponent = function (encodedURI) {
620
- if (typeof encodedURI !== 'string') {
621
- throw new TypeError('Expected `encodedURI` to be of type `string`, got `' + typeof encodedURI + '`');
622
- }
633
+ /* eslint no-invalid-this: 1 */
623
634
 
624
- try {
625
- encodedURI = encodedURI.replace(/\+/g, ' ');
635
+ var ERROR_MESSAGE = 'Function.prototype.bind called on incompatible ';
636
+ var slice = Array.prototype.slice;
637
+ var toStr$1 = Object.prototype.toString;
638
+ var funcType = '[object Function]';
626
639
 
627
- // Try the built in decoder first
628
- return decodeURIComponent(encodedURI);
629
- } catch (err) {
630
- // Fallback to a more advanced decoder
631
- return customDecodeURIComponent(encodedURI);
632
- }
640
+ var implementation$1 = function bind(that) {
641
+ var target = this;
642
+ if (typeof target !== 'function' || toStr$1.call(target) !== funcType) {
643
+ throw new TypeError(ERROR_MESSAGE + target);
644
+ }
645
+ var args = slice.call(arguments, 1);
646
+
647
+ var bound;
648
+ var binder = function () {
649
+ if (this instanceof bound) {
650
+ var result = target.apply(
651
+ this,
652
+ args.concat(slice.call(arguments))
653
+ );
654
+ if (Object(result) === result) {
655
+ return result;
656
+ }
657
+ return this;
658
+ } else {
659
+ return target.apply(
660
+ that,
661
+ args.concat(slice.call(arguments))
662
+ );
663
+ }
664
+ };
665
+
666
+ var boundLength = Math.max(0, target.length - args.length);
667
+ var boundArgs = [];
668
+ for (var i = 0; i < boundLength; i++) {
669
+ boundArgs.push('$' + i);
670
+ }
671
+
672
+ bound = Function('binder', 'return function (' + boundArgs.join(',') + '){ return binder.apply(this,arguments); }')(binder);
673
+
674
+ if (target.prototype) {
675
+ var Empty = function Empty() {};
676
+ Empty.prototype = target.prototype;
677
+ bound.prototype = new Empty();
678
+ Empty.prototype = null;
679
+ }
680
+
681
+ return bound;
633
682
  };
634
683
 
635
- var splitOnFirst = (string, separator) => {
636
- if (!(typeof string === 'string' && typeof separator === 'string')) {
637
- throw new TypeError('Expected the arguments to be of type `string`');
638
- }
684
+ var implementation = implementation$1;
639
685
 
640
- if (separator === '') {
641
- return [string];
642
- }
686
+ var functionBind = Function.prototype.bind || implementation;
643
687
 
644
- const separatorIndex = string.indexOf(separator);
688
+ var bind$1 = functionBind;
645
689
 
646
- if (separatorIndex === -1) {
647
- return [string];
648
- }
690
+ var src = bind$1.call(Function.call, Object.prototype.hasOwnProperty);
649
691
 
650
- return [
651
- string.slice(0, separatorIndex),
652
- string.slice(separatorIndex + separator.length)
653
- ];
654
- };
692
+ var undefined$1;
655
693
 
656
- var filterObj = function (obj, predicate) {
657
- var ret = {};
658
- var keys = Object.keys(obj);
659
- var isArr = Array.isArray(predicate);
694
+ var $SyntaxError = SyntaxError;
695
+ var $Function = Function;
696
+ var $TypeError$1 = TypeError;
660
697
 
661
- for (var i = 0; i < keys.length; i++) {
662
- var key = keys[i];
663
- var val = obj[key];
698
+ // eslint-disable-next-line consistent-return
699
+ var getEvalledConstructor = function (expressionSyntax) {
700
+ try {
701
+ return $Function('"use strict"; return (' + expressionSyntax + ').constructor;')();
702
+ } catch (e) {}
703
+ };
664
704
 
665
- if (isArr ? predicate.indexOf(key) !== -1 : predicate(key, val, obj)) {
666
- ret[key] = val;
667
- }
705
+ var $gOPD = Object.getOwnPropertyDescriptor;
706
+ if ($gOPD) {
707
+ try {
708
+ $gOPD({}, '');
709
+ } catch (e) {
710
+ $gOPD = null; // this is IE 8, which has a broken gOPD
668
711
  }
712
+ }
669
713
 
670
- return ret;
714
+ var throwTypeError = function () {
715
+ throw new $TypeError$1();
671
716
  };
672
-
673
- (function (exports) {
674
- const strictUriEncode$1 = strictUriEncode;
675
- const decodeComponent = decodeUriComponent;
676
- const splitOnFirst$1 = splitOnFirst;
677
- const filterObject = filterObj;
678
-
679
- const isNullOrUndefined = value => value === null || value === undefined;
680
-
681
- const encodeFragmentIdentifier = Symbol('encodeFragmentIdentifier');
682
-
683
- function encoderForArrayFormat(options) {
684
- switch (options.arrayFormat) {
685
- case 'index':
686
- return key => (result, value) => {
687
- const index = result.length;
688
-
689
- if (
690
- value === undefined ||
691
- (options.skipNull && value === null) ||
692
- (options.skipEmptyString && value === '')
693
- ) {
694
- return result;
695
- }
696
-
697
- if (value === null) {
698
- return [...result, [encode(key, options), '[', index, ']'].join('')];
699
- }
700
-
701
- return [
702
- ...result,
703
- [encode(key, options), '[', encode(index, options), ']=', encode(value, options)].join('')
704
- ];
705
- };
706
-
707
- case 'bracket':
708
- return key => (result, value) => {
709
- if (
710
- value === undefined ||
711
- (options.skipNull && value === null) ||
712
- (options.skipEmptyString && value === '')
713
- ) {
714
- return result;
715
- }
716
-
717
- if (value === null) {
718
- return [...result, [encode(key, options), '[]'].join('')];
719
- }
720
-
721
- return [...result, [encode(key, options), '[]=', encode(value, options)].join('')];
722
- };
723
-
724
- case 'colon-list-separator':
725
- return key => (result, value) => {
726
- if (
727
- value === undefined ||
728
- (options.skipNull && value === null) ||
729
- (options.skipEmptyString && value === '')
730
- ) {
731
- return result;
732
- }
733
-
734
- if (value === null) {
735
- return [...result, [encode(key, options), ':list='].join('')];
736
- }
737
-
738
- return [...result, [encode(key, options), ':list=', encode(value, options)].join('')];
739
- };
740
-
741
- case 'comma':
742
- case 'separator':
743
- case 'bracket-separator': {
744
- const keyValueSep = options.arrayFormat === 'bracket-separator' ?
745
- '[]=' :
746
- '=';
747
-
748
- return key => (result, value) => {
749
- if (
750
- value === undefined ||
751
- (options.skipNull && value === null) ||
752
- (options.skipEmptyString && value === '')
753
- ) {
754
- return result;
755
- }
756
-
757
- // Translate null to an empty string so that it doesn't serialize as 'null'
758
- value = value === null ? '' : value;
759
-
760
- if (result.length === 0) {
761
- return [[encode(key, options), keyValueSep, encode(value, options)].join('')];
762
- }
763
-
764
- return [[result, encode(value, options)].join(options.arrayFormatSeparator)];
765
- };
717
+ var ThrowTypeError = $gOPD
718
+ ? (function () {
719
+ try {
720
+ // eslint-disable-next-line no-unused-expressions, no-caller, no-restricted-properties
721
+ arguments.callee; // IE 8 does not throw here
722
+ return throwTypeError;
723
+ } catch (calleeThrows) {
724
+ try {
725
+ // IE 8 throws on Object.getOwnPropertyDescriptor(arguments, '')
726
+ return $gOPD(arguments, 'callee').get;
727
+ } catch (gOPDthrows) {
728
+ return throwTypeError;
766
729
  }
767
-
768
- default:
769
- return key => (result, value) => {
770
- if (
771
- value === undefined ||
772
- (options.skipNull && value === null) ||
773
- (options.skipEmptyString && value === '')
774
- ) {
775
- return result;
776
- }
777
-
778
- if (value === null) {
779
- return [...result, encode(key, options)];
780
- }
781
-
782
- return [...result, [encode(key, options), '=', encode(value, options)].join('')];
783
- };
784
730
  }
785
- }
731
+ }())
732
+ : throwTypeError;
733
+
734
+ var hasSymbols = hasSymbols$1();
735
+
736
+ var getProto = Object.getPrototypeOf || function (x) { return x.__proto__; }; // eslint-disable-line no-proto
737
+
738
+ var needsEval = {};
739
+
740
+ var TypedArray = typeof Uint8Array === 'undefined' ? undefined$1 : getProto(Uint8Array);
741
+
742
+ var INTRINSICS = {
743
+ '%AggregateError%': typeof AggregateError === 'undefined' ? undefined$1 : AggregateError,
744
+ '%Array%': Array,
745
+ '%ArrayBuffer%': typeof ArrayBuffer === 'undefined' ? undefined$1 : ArrayBuffer,
746
+ '%ArrayIteratorPrototype%': hasSymbols ? getProto([][Symbol.iterator]()) : undefined$1,
747
+ '%AsyncFromSyncIteratorPrototype%': undefined$1,
748
+ '%AsyncFunction%': needsEval,
749
+ '%AsyncGenerator%': needsEval,
750
+ '%AsyncGeneratorFunction%': needsEval,
751
+ '%AsyncIteratorPrototype%': needsEval,
752
+ '%Atomics%': typeof Atomics === 'undefined' ? undefined$1 : Atomics,
753
+ '%BigInt%': typeof BigInt === 'undefined' ? undefined$1 : BigInt,
754
+ '%Boolean%': Boolean,
755
+ '%DataView%': typeof DataView === 'undefined' ? undefined$1 : DataView,
756
+ '%Date%': Date,
757
+ '%decodeURI%': decodeURI,
758
+ '%decodeURIComponent%': decodeURIComponent,
759
+ '%encodeURI%': encodeURI,
760
+ '%encodeURIComponent%': encodeURIComponent,
761
+ '%Error%': Error,
762
+ '%eval%': eval, // eslint-disable-line no-eval
763
+ '%EvalError%': EvalError,
764
+ '%Float32Array%': typeof Float32Array === 'undefined' ? undefined$1 : Float32Array,
765
+ '%Float64Array%': typeof Float64Array === 'undefined' ? undefined$1 : Float64Array,
766
+ '%FinalizationRegistry%': typeof FinalizationRegistry === 'undefined' ? undefined$1 : FinalizationRegistry,
767
+ '%Function%': $Function,
768
+ '%GeneratorFunction%': needsEval,
769
+ '%Int8Array%': typeof Int8Array === 'undefined' ? undefined$1 : Int8Array,
770
+ '%Int16Array%': typeof Int16Array === 'undefined' ? undefined$1 : Int16Array,
771
+ '%Int32Array%': typeof Int32Array === 'undefined' ? undefined$1 : Int32Array,
772
+ '%isFinite%': isFinite,
773
+ '%isNaN%': isNaN,
774
+ '%IteratorPrototype%': hasSymbols ? getProto(getProto([][Symbol.iterator]())) : undefined$1,
775
+ '%JSON%': typeof JSON === 'object' ? JSON : undefined$1,
776
+ '%Map%': typeof Map === 'undefined' ? undefined$1 : Map,
777
+ '%MapIteratorPrototype%': typeof Map === 'undefined' || !hasSymbols ? undefined$1 : getProto(new Map()[Symbol.iterator]()),
778
+ '%Math%': Math,
779
+ '%Number%': Number,
780
+ '%Object%': Object,
781
+ '%parseFloat%': parseFloat,
782
+ '%parseInt%': parseInt,
783
+ '%Promise%': typeof Promise === 'undefined' ? undefined$1 : Promise,
784
+ '%Proxy%': typeof Proxy === 'undefined' ? undefined$1 : Proxy,
785
+ '%RangeError%': RangeError,
786
+ '%ReferenceError%': ReferenceError,
787
+ '%Reflect%': typeof Reflect === 'undefined' ? undefined$1 : Reflect,
788
+ '%RegExp%': RegExp,
789
+ '%Set%': typeof Set === 'undefined' ? undefined$1 : Set,
790
+ '%SetIteratorPrototype%': typeof Set === 'undefined' || !hasSymbols ? undefined$1 : getProto(new Set()[Symbol.iterator]()),
791
+ '%SharedArrayBuffer%': typeof SharedArrayBuffer === 'undefined' ? undefined$1 : SharedArrayBuffer,
792
+ '%String%': String,
793
+ '%StringIteratorPrototype%': hasSymbols ? getProto(''[Symbol.iterator]()) : undefined$1,
794
+ '%Symbol%': hasSymbols ? Symbol : undefined$1,
795
+ '%SyntaxError%': $SyntaxError,
796
+ '%ThrowTypeError%': ThrowTypeError,
797
+ '%TypedArray%': TypedArray,
798
+ '%TypeError%': $TypeError$1,
799
+ '%Uint8Array%': typeof Uint8Array === 'undefined' ? undefined$1 : Uint8Array,
800
+ '%Uint8ClampedArray%': typeof Uint8ClampedArray === 'undefined' ? undefined$1 : Uint8ClampedArray,
801
+ '%Uint16Array%': typeof Uint16Array === 'undefined' ? undefined$1 : Uint16Array,
802
+ '%Uint32Array%': typeof Uint32Array === 'undefined' ? undefined$1 : Uint32Array,
803
+ '%URIError%': URIError,
804
+ '%WeakMap%': typeof WeakMap === 'undefined' ? undefined$1 : WeakMap,
805
+ '%WeakRef%': typeof WeakRef === 'undefined' ? undefined$1 : WeakRef,
806
+ '%WeakSet%': typeof WeakSet === 'undefined' ? undefined$1 : WeakSet
807
+ };
786
808
 
787
- function parserForArrayFormat(options) {
788
- let result;
789
-
790
- switch (options.arrayFormat) {
791
- case 'index':
792
- return (key, value, accumulator) => {
793
- result = /\[(\d*)\]$/.exec(key);
794
-
795
- key = key.replace(/\[\d*\]$/, '');
796
-
797
- if (!result) {
798
- accumulator[key] = value;
799
- return;
800
- }
801
-
802
- if (accumulator[key] === undefined) {
803
- accumulator[key] = {};
804
- }
805
-
806
- accumulator[key][result[1]] = value;
807
- };
808
-
809
- case 'bracket':
810
- return (key, value, accumulator) => {
811
- result = /(\[\])$/.exec(key);
812
- key = key.replace(/\[\]$/, '');
813
-
814
- if (!result) {
815
- accumulator[key] = value;
816
- return;
817
- }
818
-
819
- if (accumulator[key] === undefined) {
820
- accumulator[key] = [value];
821
- return;
822
- }
823
-
824
- accumulator[key] = [].concat(accumulator[key], value);
825
- };
826
-
827
- case 'colon-list-separator':
828
- return (key, value, accumulator) => {
829
- result = /(:list)$/.exec(key);
830
- key = key.replace(/:list$/, '');
831
-
832
- if (!result) {
833
- accumulator[key] = value;
834
- return;
835
- }
836
-
837
- if (accumulator[key] === undefined) {
838
- accumulator[key] = [value];
839
- return;
840
- }
841
-
842
- accumulator[key] = [].concat(accumulator[key], value);
843
- };
844
-
845
- case 'comma':
846
- case 'separator':
847
- return (key, value, accumulator) => {
848
- const isArray = typeof value === 'string' && value.includes(options.arrayFormatSeparator);
849
- const isEncodedArray = (typeof value === 'string' && !isArray && decode(value, options).includes(options.arrayFormatSeparator));
850
- value = isEncodedArray ? decode(value, options) : value;
851
- const newValue = isArray || isEncodedArray ? value.split(options.arrayFormatSeparator).map(item => decode(item, options)) : value === null ? value : decode(value, options);
852
- accumulator[key] = newValue;
853
- };
854
-
855
- case 'bracket-separator':
856
- return (key, value, accumulator) => {
857
- const isArray = /(\[\])$/.test(key);
858
- key = key.replace(/\[\]$/, '');
859
-
860
- if (!isArray) {
861
- accumulator[key] = value ? decode(value, options) : value;
862
- return;
863
- }
864
-
865
- const arrayValue = value === null ?
866
- [] :
867
- value.split(options.arrayFormatSeparator).map(item => decode(item, options));
868
-
869
- if (accumulator[key] === undefined) {
870
- accumulator[key] = arrayValue;
871
- return;
872
- }
873
-
874
- accumulator[key] = [].concat(accumulator[key], arrayValue);
875
- };
876
-
877
- default:
878
- return (key, value, accumulator) => {
879
- if (accumulator[key] === undefined) {
880
- accumulator[key] = value;
881
- return;
882
- }
883
-
884
- accumulator[key] = [].concat(accumulator[key], value);
885
- };
809
+ var doEval = function doEval(name) {
810
+ var value;
811
+ if (name === '%AsyncFunction%') {
812
+ value = getEvalledConstructor('async function () {}');
813
+ } else if (name === '%GeneratorFunction%') {
814
+ value = getEvalledConstructor('function* () {}');
815
+ } else if (name === '%AsyncGeneratorFunction%') {
816
+ value = getEvalledConstructor('async function* () {}');
817
+ } else if (name === '%AsyncGenerator%') {
818
+ var fn = doEval('%AsyncGeneratorFunction%');
819
+ if (fn) {
820
+ value = fn.prototype;
821
+ }
822
+ } else if (name === '%AsyncIteratorPrototype%') {
823
+ var gen = doEval('%AsyncGenerator%');
824
+ if (gen) {
825
+ value = getProto(gen.prototype);
886
826
  }
887
827
  }
888
828
 
889
- function validateArrayFormatSeparator(value) {
890
- if (typeof value !== 'string' || value.length !== 1) {
891
- throw new TypeError('arrayFormatSeparator must be single character string');
892
- }
829
+ INTRINSICS[name] = value;
830
+
831
+ return value;
832
+ };
833
+
834
+ var LEGACY_ALIASES = {
835
+ '%ArrayBufferPrototype%': ['ArrayBuffer', 'prototype'],
836
+ '%ArrayPrototype%': ['Array', 'prototype'],
837
+ '%ArrayProto_entries%': ['Array', 'prototype', 'entries'],
838
+ '%ArrayProto_forEach%': ['Array', 'prototype', 'forEach'],
839
+ '%ArrayProto_keys%': ['Array', 'prototype', 'keys'],
840
+ '%ArrayProto_values%': ['Array', 'prototype', 'values'],
841
+ '%AsyncFunctionPrototype%': ['AsyncFunction', 'prototype'],
842
+ '%AsyncGenerator%': ['AsyncGeneratorFunction', 'prototype'],
843
+ '%AsyncGeneratorPrototype%': ['AsyncGeneratorFunction', 'prototype', 'prototype'],
844
+ '%BooleanPrototype%': ['Boolean', 'prototype'],
845
+ '%DataViewPrototype%': ['DataView', 'prototype'],
846
+ '%DatePrototype%': ['Date', 'prototype'],
847
+ '%ErrorPrototype%': ['Error', 'prototype'],
848
+ '%EvalErrorPrototype%': ['EvalError', 'prototype'],
849
+ '%Float32ArrayPrototype%': ['Float32Array', 'prototype'],
850
+ '%Float64ArrayPrototype%': ['Float64Array', 'prototype'],
851
+ '%FunctionPrototype%': ['Function', 'prototype'],
852
+ '%Generator%': ['GeneratorFunction', 'prototype'],
853
+ '%GeneratorPrototype%': ['GeneratorFunction', 'prototype', 'prototype'],
854
+ '%Int8ArrayPrototype%': ['Int8Array', 'prototype'],
855
+ '%Int16ArrayPrototype%': ['Int16Array', 'prototype'],
856
+ '%Int32ArrayPrototype%': ['Int32Array', 'prototype'],
857
+ '%JSONParse%': ['JSON', 'parse'],
858
+ '%JSONStringify%': ['JSON', 'stringify'],
859
+ '%MapPrototype%': ['Map', 'prototype'],
860
+ '%NumberPrototype%': ['Number', 'prototype'],
861
+ '%ObjectPrototype%': ['Object', 'prototype'],
862
+ '%ObjProto_toString%': ['Object', 'prototype', 'toString'],
863
+ '%ObjProto_valueOf%': ['Object', 'prototype', 'valueOf'],
864
+ '%PromisePrototype%': ['Promise', 'prototype'],
865
+ '%PromiseProto_then%': ['Promise', 'prototype', 'then'],
866
+ '%Promise_all%': ['Promise', 'all'],
867
+ '%Promise_reject%': ['Promise', 'reject'],
868
+ '%Promise_resolve%': ['Promise', 'resolve'],
869
+ '%RangeErrorPrototype%': ['RangeError', 'prototype'],
870
+ '%ReferenceErrorPrototype%': ['ReferenceError', 'prototype'],
871
+ '%RegExpPrototype%': ['RegExp', 'prototype'],
872
+ '%SetPrototype%': ['Set', 'prototype'],
873
+ '%SharedArrayBufferPrototype%': ['SharedArrayBuffer', 'prototype'],
874
+ '%StringPrototype%': ['String', 'prototype'],
875
+ '%SymbolPrototype%': ['Symbol', 'prototype'],
876
+ '%SyntaxErrorPrototype%': ['SyntaxError', 'prototype'],
877
+ '%TypedArrayPrototype%': ['TypedArray', 'prototype'],
878
+ '%TypeErrorPrototype%': ['TypeError', 'prototype'],
879
+ '%Uint8ArrayPrototype%': ['Uint8Array', 'prototype'],
880
+ '%Uint8ClampedArrayPrototype%': ['Uint8ClampedArray', 'prototype'],
881
+ '%Uint16ArrayPrototype%': ['Uint16Array', 'prototype'],
882
+ '%Uint32ArrayPrototype%': ['Uint32Array', 'prototype'],
883
+ '%URIErrorPrototype%': ['URIError', 'prototype'],
884
+ '%WeakMapPrototype%': ['WeakMap', 'prototype'],
885
+ '%WeakSetPrototype%': ['WeakSet', 'prototype']
886
+ };
887
+
888
+ var bind = functionBind;
889
+ var hasOwn$1 = src;
890
+ var $concat$1 = bind.call(Function.call, Array.prototype.concat);
891
+ var $spliceApply = bind.call(Function.apply, Array.prototype.splice);
892
+ var $replace$1 = bind.call(Function.call, String.prototype.replace);
893
+ var $strSlice = bind.call(Function.call, String.prototype.slice);
894
+
895
+ /* adapted from https://github.com/lodash/lodash/blob/4.17.15/dist/lodash.js#L6735-L6744 */
896
+ var rePropName = /[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g;
897
+ var reEscapeChar = /\\(\\)?/g; /** Used to match backslashes in property paths. */
898
+ var stringToPath = function stringToPath(string) {
899
+ var first = $strSlice(string, 0, 1);
900
+ var last = $strSlice(string, -1);
901
+ if (first === '%' && last !== '%') {
902
+ throw new $SyntaxError('invalid intrinsic syntax, expected closing `%`');
903
+ } else if (last === '%' && first !== '%') {
904
+ throw new $SyntaxError('invalid intrinsic syntax, expected opening `%`');
905
+ }
906
+ var result = [];
907
+ $replace$1(string, rePropName, function (match, number, quote, subString) {
908
+ result[result.length] = quote ? $replace$1(subString, reEscapeChar, '$1') : number || match;
909
+ });
910
+ return result;
911
+ };
912
+ /* end adaptation */
913
+
914
+ var getBaseIntrinsic = function getBaseIntrinsic(name, allowMissing) {
915
+ var intrinsicName = name;
916
+ var alias;
917
+ if (hasOwn$1(LEGACY_ALIASES, intrinsicName)) {
918
+ alias = LEGACY_ALIASES[intrinsicName];
919
+ intrinsicName = '%' + alias[0] + '%';
893
920
  }
894
921
 
895
- function encode(value, options) {
896
- if (options.encode) {
897
- return options.strict ? strictUriEncode$1(value) : encodeURIComponent(value);
922
+ if (hasOwn$1(INTRINSICS, intrinsicName)) {
923
+ var value = INTRINSICS[intrinsicName];
924
+ if (value === needsEval) {
925
+ value = doEval(intrinsicName);
926
+ }
927
+ if (typeof value === 'undefined' && !allowMissing) {
928
+ throw new $TypeError$1('intrinsic ' + name + ' exists, but is not available. Please file an issue!');
898
929
  }
899
930
 
900
- return value;
931
+ return {
932
+ alias: alias,
933
+ name: intrinsicName,
934
+ value: value
935
+ };
901
936
  }
902
937
 
903
- function decode(value, options) {
904
- if (options.decode) {
905
- return decodeComponent(value);
906
- }
938
+ throw new $SyntaxError('intrinsic ' + name + ' does not exist!');
939
+ };
907
940
 
908
- return value;
941
+ var getIntrinsic = function GetIntrinsic(name, allowMissing) {
942
+ if (typeof name !== 'string' || name.length === 0) {
943
+ throw new $TypeError$1('intrinsic name must be a non-empty string');
944
+ }
945
+ if (arguments.length > 1 && typeof allowMissing !== 'boolean') {
946
+ throw new $TypeError$1('"allowMissing" argument must be a boolean');
909
947
  }
910
948
 
911
- function keysSorter(input) {
912
- if (Array.isArray(input)) {
913
- return input.sort();
914
- }
949
+ var parts = stringToPath(name);
950
+ var intrinsicBaseName = parts.length > 0 ? parts[0] : '';
915
951
 
916
- if (typeof input === 'object') {
917
- return keysSorter(Object.keys(input))
918
- .sort((a, b) => Number(a) - Number(b))
919
- .map(key => input[key]);
920
- }
952
+ var intrinsic = getBaseIntrinsic('%' + intrinsicBaseName + '%', allowMissing);
953
+ var intrinsicRealName = intrinsic.name;
954
+ var value = intrinsic.value;
955
+ var skipFurtherCaching = false;
921
956
 
922
- return input;
957
+ var alias = intrinsic.alias;
958
+ if (alias) {
959
+ intrinsicBaseName = alias[0];
960
+ $spliceApply(parts, $concat$1([0, 1], alias));
923
961
  }
924
962
 
925
- function removeHash(input) {
926
- const hashStart = input.indexOf('#');
927
- if (hashStart !== -1) {
928
- input = input.slice(0, hashStart);
963
+ for (var i = 1, isOwn = true; i < parts.length; i += 1) {
964
+ var part = parts[i];
965
+ var first = $strSlice(part, 0, 1);
966
+ var last = $strSlice(part, -1);
967
+ if (
968
+ (
969
+ (first === '"' || first === "'" || first === '`')
970
+ || (last === '"' || last === "'" || last === '`')
971
+ )
972
+ && first !== last
973
+ ) {
974
+ throw new $SyntaxError('property names with quotes must have matching quotes');
975
+ }
976
+ if (part === 'constructor' || !isOwn) {
977
+ skipFurtherCaching = true;
929
978
  }
930
979
 
931
- return input;
932
- }
980
+ intrinsicBaseName += '.' + part;
981
+ intrinsicRealName = '%' + intrinsicBaseName + '%';
982
+
983
+ if (hasOwn$1(INTRINSICS, intrinsicRealName)) {
984
+ value = INTRINSICS[intrinsicRealName];
985
+ } else if (value != null) {
986
+ if (!(part in value)) {
987
+ if (!allowMissing) {
988
+ throw new $TypeError$1('base intrinsic for ' + name + ' exists, but the property is not available.');
989
+ }
990
+ return void undefined$1;
991
+ }
992
+ if ($gOPD && (i + 1) >= parts.length) {
993
+ var desc = $gOPD(value, part);
994
+ isOwn = !!desc;
995
+
996
+ // By convention, when a data property is converted to an accessor
997
+ // property to emulate a data property that does not suffer from
998
+ // the override mistake, that accessor's getter is marked with
999
+ // an `originalValue` property. Here, when we detect this, we
1000
+ // uphold the illusion by pretending to see that original data
1001
+ // property, i.e., returning the value rather than the getter
1002
+ // itself.
1003
+ if (isOwn && 'get' in desc && !('originalValue' in desc.get)) {
1004
+ value = desc.get;
1005
+ } else {
1006
+ value = value[part];
1007
+ }
1008
+ } else {
1009
+ isOwn = hasOwn$1(value, part);
1010
+ value = value[part];
1011
+ }
933
1012
 
934
- function getHash(url) {
935
- let hash = '';
936
- const hashStart = url.indexOf('#');
937
- if (hashStart !== -1) {
938
- hash = url.slice(hashStart);
1013
+ if (isOwn && !skipFurtherCaching) {
1014
+ INTRINSICS[intrinsicRealName] = value;
1015
+ }
939
1016
  }
1017
+ }
1018
+ return value;
1019
+ };
1020
+
1021
+ var callBind$1 = {exports: {}};
1022
+
1023
+ (function (module) {
1024
+
1025
+ var bind = functionBind;
1026
+ var GetIntrinsic = getIntrinsic;
940
1027
 
941
- return hash;
1028
+ var $apply = GetIntrinsic('%Function.prototype.apply%');
1029
+ var $call = GetIntrinsic('%Function.prototype.call%');
1030
+ var $reflectApply = GetIntrinsic('%Reflect.apply%', true) || bind.call($call, $apply);
1031
+
1032
+ var $gOPD = GetIntrinsic('%Object.getOwnPropertyDescriptor%', true);
1033
+ var $defineProperty = GetIntrinsic('%Object.defineProperty%', true);
1034
+ var $max = GetIntrinsic('%Math.max%');
1035
+
1036
+ if ($defineProperty) {
1037
+ try {
1038
+ $defineProperty({}, 'a', { value: 1 });
1039
+ } catch (e) {
1040
+ // IE 8 has a broken defineProperty
1041
+ $defineProperty = null;
1042
+ }
942
1043
  }
943
1044
 
944
- function extract(input) {
945
- input = removeHash(input);
946
- const queryStart = input.indexOf('?');
947
- if (queryStart === -1) {
948
- return '';
1045
+ module.exports = function callBind(originalFunction) {
1046
+ var func = $reflectApply(bind, $call, arguments);
1047
+ if ($gOPD && $defineProperty) {
1048
+ var desc = $gOPD(func, 'length');
1049
+ if (desc.configurable) {
1050
+ // original length, plus the receiver, minus any additional arguments (after the receiver)
1051
+ $defineProperty(
1052
+ func,
1053
+ 'length',
1054
+ { value: 1 + $max(0, originalFunction.length - (arguments.length - 1)) }
1055
+ );
1056
+ }
949
1057
  }
1058
+ return func;
1059
+ };
1060
+
1061
+ var applyBind = function applyBind() {
1062
+ return $reflectApply(bind, $apply, arguments);
1063
+ };
950
1064
 
951
- return input.slice(queryStart + 1);
1065
+ if ($defineProperty) {
1066
+ $defineProperty(module.exports, 'apply', { value: applyBind });
1067
+ } else {
1068
+ module.exports.apply = applyBind;
952
1069
  }
1070
+ } (callBind$1));
953
1071
 
954
- function parseValue(value, options) {
955
- if (options.parseNumbers && !Number.isNaN(Number(value)) && (typeof value === 'string' && value.trim() !== '')) {
956
- value = Number(value);
957
- } else if (options.parseBooleans && value !== null && (value.toLowerCase() === 'true' || value.toLowerCase() === 'false')) {
958
- value = value.toLowerCase() === 'true';
959
- }
1072
+ var GetIntrinsic$1 = getIntrinsic;
1073
+
1074
+ var callBind = callBind$1.exports;
1075
+
1076
+ var $indexOf = callBind(GetIntrinsic$1('String.prototype.indexOf'));
960
1077
 
961
- return value;
1078
+ var callBound$1 = function callBoundIntrinsic(name, allowMissing) {
1079
+ var intrinsic = GetIntrinsic$1(name, !!allowMissing);
1080
+ if (typeof intrinsic === 'function' && $indexOf(name, '.prototype.') > -1) {
1081
+ return callBind(intrinsic);
962
1082
  }
1083
+ return intrinsic;
1084
+ };
963
1085
 
964
- function parse(query, options) {
965
- options = Object.assign({
966
- decode: true,
967
- sort: true,
968
- arrayFormat: 'none',
969
- arrayFormatSeparator: ',',
970
- parseNumbers: false,
971
- parseBooleans: false
972
- }, options);
1086
+ var util_inspect = require$$0.inspect;
1087
+
1088
+ var hasMap = typeof Map === 'function' && Map.prototype;
1089
+ var mapSizeDescriptor = Object.getOwnPropertyDescriptor && hasMap ? Object.getOwnPropertyDescriptor(Map.prototype, 'size') : null;
1090
+ var mapSize = hasMap && mapSizeDescriptor && typeof mapSizeDescriptor.get === 'function' ? mapSizeDescriptor.get : null;
1091
+ var mapForEach = hasMap && Map.prototype.forEach;
1092
+ var hasSet = typeof Set === 'function' && Set.prototype;
1093
+ var setSizeDescriptor = Object.getOwnPropertyDescriptor && hasSet ? Object.getOwnPropertyDescriptor(Set.prototype, 'size') : null;
1094
+ var setSize = hasSet && setSizeDescriptor && typeof setSizeDescriptor.get === 'function' ? setSizeDescriptor.get : null;
1095
+ var setForEach = hasSet && Set.prototype.forEach;
1096
+ var hasWeakMap = typeof WeakMap === 'function' && WeakMap.prototype;
1097
+ var weakMapHas = hasWeakMap ? WeakMap.prototype.has : null;
1098
+ var hasWeakSet = typeof WeakSet === 'function' && WeakSet.prototype;
1099
+ var weakSetHas = hasWeakSet ? WeakSet.prototype.has : null;
1100
+ var hasWeakRef = typeof WeakRef === 'function' && WeakRef.prototype;
1101
+ var weakRefDeref = hasWeakRef ? WeakRef.prototype.deref : null;
1102
+ var booleanValueOf = Boolean.prototype.valueOf;
1103
+ var objectToString = Object.prototype.toString;
1104
+ var functionToString = Function.prototype.toString;
1105
+ var $match = String.prototype.match;
1106
+ var $slice = String.prototype.slice;
1107
+ var $replace = String.prototype.replace;
1108
+ var $toUpperCase = String.prototype.toUpperCase;
1109
+ var $toLowerCase = String.prototype.toLowerCase;
1110
+ var $test = RegExp.prototype.test;
1111
+ var $concat = Array.prototype.concat;
1112
+ var $join = Array.prototype.join;
1113
+ var $arrSlice = Array.prototype.slice;
1114
+ var $floor = Math.floor;
1115
+ var bigIntValueOf = typeof BigInt === 'function' ? BigInt.prototype.valueOf : null;
1116
+ var gOPS = Object.getOwnPropertySymbols;
1117
+ var symToString = typeof Symbol === 'function' && typeof Symbol.iterator === 'symbol' ? Symbol.prototype.toString : null;
1118
+ var hasShammedSymbols = typeof Symbol === 'function' && typeof Symbol.iterator === 'object';
1119
+ // ie, `has-tostringtag/shams
1120
+ var toStringTag = typeof Symbol === 'function' && Symbol.toStringTag && (typeof Symbol.toStringTag === hasShammedSymbols ? 'object' : 'symbol')
1121
+ ? Symbol.toStringTag
1122
+ : null;
1123
+ var isEnumerable = Object.prototype.propertyIsEnumerable;
1124
+
1125
+ var gPO = (typeof Reflect === 'function' ? Reflect.getPrototypeOf : Object.getPrototypeOf) || (
1126
+ [].__proto__ === Array.prototype // eslint-disable-line no-proto
1127
+ ? function (O) {
1128
+ return O.__proto__; // eslint-disable-line no-proto
1129
+ }
1130
+ : null
1131
+ );
1132
+
1133
+ function addNumericSeparator(num, str) {
1134
+ if (
1135
+ num === Infinity
1136
+ || num === -Infinity
1137
+ || num !== num
1138
+ || (num && num > -1000 && num < 1000)
1139
+ || $test.call(/e/, str)
1140
+ ) {
1141
+ return str;
1142
+ }
1143
+ var sepRegex = /[0-9](?=(?:[0-9]{3})+(?![0-9]))/g;
1144
+ if (typeof num === 'number') {
1145
+ var int = num < 0 ? -$floor(-num) : $floor(num); // trunc(num)
1146
+ if (int !== num) {
1147
+ var intStr = String(int);
1148
+ var dec = $slice.call(str, intStr.length + 1);
1149
+ return $replace.call(intStr, sepRegex, '$&_') + '.' + $replace.call($replace.call(dec, /([0-9]{3})/g, '$&_'), /_$/, '');
1150
+ }
1151
+ }
1152
+ return $replace.call(str, sepRegex, '$&_');
1153
+ }
973
1154
 
974
- validateArrayFormatSeparator(options.arrayFormatSeparator);
1155
+ var inspectCustom = util_inspect.custom;
1156
+ var inspectSymbol = inspectCustom && isSymbol(inspectCustom) ? inspectCustom : null;
975
1157
 
976
- const formatter = parserForArrayFormat(options);
1158
+ var objectInspect = function inspect_(obj, options, depth, seen) {
1159
+ var opts = options || {};
977
1160
 
978
- // Create an object with no prototype
979
- const ret = Object.create(null);
1161
+ if (has$3(opts, 'quoteStyle') && (opts.quoteStyle !== 'single' && opts.quoteStyle !== 'double')) {
1162
+ throw new TypeError('option "quoteStyle" must be "single" or "double"');
1163
+ }
1164
+ if (
1165
+ has$3(opts, 'maxStringLength') && (typeof opts.maxStringLength === 'number'
1166
+ ? opts.maxStringLength < 0 && opts.maxStringLength !== Infinity
1167
+ : opts.maxStringLength !== null
1168
+ )
1169
+ ) {
1170
+ throw new TypeError('option "maxStringLength", if provided, must be a positive integer, Infinity, or `null`');
1171
+ }
1172
+ var customInspect = has$3(opts, 'customInspect') ? opts.customInspect : true;
1173
+ if (typeof customInspect !== 'boolean' && customInspect !== 'symbol') {
1174
+ throw new TypeError('option "customInspect", if provided, must be `true`, `false`, or `\'symbol\'`');
1175
+ }
980
1176
 
981
- if (typeof query !== 'string') {
982
- return ret;
983
- }
1177
+ if (
1178
+ has$3(opts, 'indent')
1179
+ && opts.indent !== null
1180
+ && opts.indent !== '\t'
1181
+ && !(parseInt(opts.indent, 10) === opts.indent && opts.indent > 0)
1182
+ ) {
1183
+ throw new TypeError('option "indent" must be "\\t", an integer > 0, or `null`');
1184
+ }
1185
+ if (has$3(opts, 'numericSeparator') && typeof opts.numericSeparator !== 'boolean') {
1186
+ throw new TypeError('option "numericSeparator", if provided, must be `true` or `false`');
1187
+ }
1188
+ var numericSeparator = opts.numericSeparator;
984
1189
 
985
- query = query.trim().replace(/^[?#&]/, '');
1190
+ if (typeof obj === 'undefined') {
1191
+ return 'undefined';
1192
+ }
1193
+ if (obj === null) {
1194
+ return 'null';
1195
+ }
1196
+ if (typeof obj === 'boolean') {
1197
+ return obj ? 'true' : 'false';
1198
+ }
986
1199
 
987
- if (!query) {
988
- return ret;
989
- }
1200
+ if (typeof obj === 'string') {
1201
+ return inspectString(obj, opts);
1202
+ }
1203
+ if (typeof obj === 'number') {
1204
+ if (obj === 0) {
1205
+ return Infinity / obj > 0 ? '0' : '-0';
1206
+ }
1207
+ var str = String(obj);
1208
+ return numericSeparator ? addNumericSeparator(obj, str) : str;
1209
+ }
1210
+ if (typeof obj === 'bigint') {
1211
+ var bigIntStr = String(obj) + 'n';
1212
+ return numericSeparator ? addNumericSeparator(obj, bigIntStr) : bigIntStr;
1213
+ }
990
1214
 
991
- for (const param of query.split('&')) {
992
- if (param === '') {
993
- continue;
994
- }
1215
+ var maxDepth = typeof opts.depth === 'undefined' ? 5 : opts.depth;
1216
+ if (typeof depth === 'undefined') { depth = 0; }
1217
+ if (depth >= maxDepth && maxDepth > 0 && typeof obj === 'object') {
1218
+ return isArray$3(obj) ? '[Array]' : '[Object]';
1219
+ }
1220
+
1221
+ var indent = getIndent(opts, depth);
1222
+
1223
+ if (typeof seen === 'undefined') {
1224
+ seen = [];
1225
+ } else if (indexOf(seen, obj) >= 0) {
1226
+ return '[Circular]';
1227
+ }
1228
+
1229
+ function inspect(value, from, noIndent) {
1230
+ if (from) {
1231
+ seen = $arrSlice.call(seen);
1232
+ seen.push(from);
1233
+ }
1234
+ if (noIndent) {
1235
+ var newOpts = {
1236
+ depth: opts.depth
1237
+ };
1238
+ if (has$3(opts, 'quoteStyle')) {
1239
+ newOpts.quoteStyle = opts.quoteStyle;
1240
+ }
1241
+ return inspect_(value, newOpts, depth + 1, seen);
1242
+ }
1243
+ return inspect_(value, opts, depth + 1, seen);
1244
+ }
995
1245
 
996
- let [key, value] = splitOnFirst$1(options.decode ? param.replace(/\+/g, ' ') : param, '=');
1246
+ if (typeof obj === 'function') {
1247
+ var name = nameOf(obj);
1248
+ var keys = arrObjKeys(obj, inspect);
1249
+ return '[Function' + (name ? ': ' + name : ' (anonymous)') + ']' + (keys.length > 0 ? ' { ' + $join.call(keys, ', ') + ' }' : '');
1250
+ }
1251
+ if (isSymbol(obj)) {
1252
+ var symString = hasShammedSymbols ? $replace.call(String(obj), /^(Symbol\(.*\))_[^)]*$/, '$1') : symToString.call(obj);
1253
+ return typeof obj === 'object' && !hasShammedSymbols ? markBoxed(symString) : symString;
1254
+ }
1255
+ if (isElement(obj)) {
1256
+ var s = '<' + $toLowerCase.call(String(obj.nodeName));
1257
+ var attrs = obj.attributes || [];
1258
+ for (var i = 0; i < attrs.length; i++) {
1259
+ s += ' ' + attrs[i].name + '=' + wrapQuotes(quote(attrs[i].value), 'double', opts);
1260
+ }
1261
+ s += '>';
1262
+ if (obj.childNodes && obj.childNodes.length) { s += '...'; }
1263
+ s += '</' + $toLowerCase.call(String(obj.nodeName)) + '>';
1264
+ return s;
1265
+ }
1266
+ if (isArray$3(obj)) {
1267
+ if (obj.length === 0) { return '[]'; }
1268
+ var xs = arrObjKeys(obj, inspect);
1269
+ if (indent && !singleLineValues(xs)) {
1270
+ return '[' + indentedJoin(xs, indent) + ']';
1271
+ }
1272
+ return '[ ' + $join.call(xs, ', ') + ' ]';
1273
+ }
1274
+ if (isError(obj)) {
1275
+ var parts = arrObjKeys(obj, inspect);
1276
+ if ('cause' in obj && !isEnumerable.call(obj, 'cause')) {
1277
+ return '{ [' + String(obj) + '] ' + $join.call($concat.call('[cause]: ' + inspect(obj.cause), parts), ', ') + ' }';
1278
+ }
1279
+ if (parts.length === 0) { return '[' + String(obj) + ']'; }
1280
+ return '{ [' + String(obj) + '] ' + $join.call(parts, ', ') + ' }';
1281
+ }
1282
+ if (typeof obj === 'object' && customInspect) {
1283
+ if (inspectSymbol && typeof obj[inspectSymbol] === 'function') {
1284
+ return obj[inspectSymbol]();
1285
+ } else if (customInspect !== 'symbol' && typeof obj.inspect === 'function') {
1286
+ return obj.inspect();
1287
+ }
1288
+ }
1289
+ if (isMap(obj)) {
1290
+ var mapParts = [];
1291
+ mapForEach.call(obj, function (value, key) {
1292
+ mapParts.push(inspect(key, obj, true) + ' => ' + inspect(value, obj));
1293
+ });
1294
+ return collectionOf('Map', mapSize.call(obj), mapParts, indent);
1295
+ }
1296
+ if (isSet(obj)) {
1297
+ var setParts = [];
1298
+ setForEach.call(obj, function (value) {
1299
+ setParts.push(inspect(value, obj));
1300
+ });
1301
+ return collectionOf('Set', setSize.call(obj), setParts, indent);
1302
+ }
1303
+ if (isWeakMap(obj)) {
1304
+ return weakCollectionOf('WeakMap');
1305
+ }
1306
+ if (isWeakSet(obj)) {
1307
+ return weakCollectionOf('WeakSet');
1308
+ }
1309
+ if (isWeakRef(obj)) {
1310
+ return weakCollectionOf('WeakRef');
1311
+ }
1312
+ if (isNumber(obj)) {
1313
+ return markBoxed(inspect(Number(obj)));
1314
+ }
1315
+ if (isBigInt(obj)) {
1316
+ return markBoxed(inspect(bigIntValueOf.call(obj)));
1317
+ }
1318
+ if (isBoolean(obj)) {
1319
+ return markBoxed(booleanValueOf.call(obj));
1320
+ }
1321
+ if (isString(obj)) {
1322
+ return markBoxed(inspect(String(obj)));
1323
+ }
1324
+ if (!isDate(obj) && !isRegExp$1(obj)) {
1325
+ var ys = arrObjKeys(obj, inspect);
1326
+ var isPlainObject = gPO ? gPO(obj) === Object.prototype : obj instanceof Object || obj.constructor === Object;
1327
+ var protoTag = obj instanceof Object ? '' : 'null prototype';
1328
+ var stringTag = !isPlainObject && toStringTag && Object(obj) === obj && toStringTag in obj ? $slice.call(toStr(obj), 8, -1) : protoTag ? 'Object' : '';
1329
+ var constructorTag = isPlainObject || typeof obj.constructor !== 'function' ? '' : obj.constructor.name ? obj.constructor.name + ' ' : '';
1330
+ var tag = constructorTag + (stringTag || protoTag ? '[' + $join.call($concat.call([], stringTag || [], protoTag || []), ': ') + '] ' : '');
1331
+ if (ys.length === 0) { return tag + '{}'; }
1332
+ if (indent) {
1333
+ return tag + '{' + indentedJoin(ys, indent) + '}';
1334
+ }
1335
+ return tag + '{ ' + $join.call(ys, ', ') + ' }';
1336
+ }
1337
+ return String(obj);
1338
+ };
1339
+
1340
+ function wrapQuotes(s, defaultStyle, opts) {
1341
+ var quoteChar = (opts.quoteStyle || defaultStyle) === 'double' ? '"' : "'";
1342
+ return quoteChar + s + quoteChar;
1343
+ }
997
1344
 
998
- // Missing `=` should be `null`:
999
- // http://w3.org/TR/2012/WD-url-20120524/#collect-url-parameters
1000
- value = value === undefined ? null : ['comma', 'separator', 'bracket-separator'].includes(options.arrayFormat) ? value : decode(value, options);
1001
- formatter(decode(key, options), value, ret);
1345
+ function quote(s) {
1346
+ return $replace.call(String(s), /"/g, '&quot;');
1347
+ }
1348
+
1349
+ function isArray$3(obj) { return toStr(obj) === '[object Array]' && (!toStringTag || !(typeof obj === 'object' && toStringTag in obj)); }
1350
+ function isDate(obj) { return toStr(obj) === '[object Date]' && (!toStringTag || !(typeof obj === 'object' && toStringTag in obj)); }
1351
+ function isRegExp$1(obj) { return toStr(obj) === '[object RegExp]' && (!toStringTag || !(typeof obj === 'object' && toStringTag in obj)); }
1352
+ function isError(obj) { return toStr(obj) === '[object Error]' && (!toStringTag || !(typeof obj === 'object' && toStringTag in obj)); }
1353
+ function isString(obj) { return toStr(obj) === '[object String]' && (!toStringTag || !(typeof obj === 'object' && toStringTag in obj)); }
1354
+ function isNumber(obj) { return toStr(obj) === '[object Number]' && (!toStringTag || !(typeof obj === 'object' && toStringTag in obj)); }
1355
+ function isBoolean(obj) { return toStr(obj) === '[object Boolean]' && (!toStringTag || !(typeof obj === 'object' && toStringTag in obj)); }
1356
+
1357
+ // Symbol and BigInt do have Symbol.toStringTag by spec, so that can't be used to eliminate false positives
1358
+ function isSymbol(obj) {
1359
+ if (hasShammedSymbols) {
1360
+ return obj && typeof obj === 'object' && obj instanceof Symbol;
1361
+ }
1362
+ if (typeof obj === 'symbol') {
1363
+ return true;
1364
+ }
1365
+ if (!obj || typeof obj !== 'object' || !symToString) {
1366
+ return false;
1367
+ }
1368
+ try {
1369
+ symToString.call(obj);
1370
+ return true;
1371
+ } catch (e) {}
1372
+ return false;
1373
+ }
1374
+
1375
+ function isBigInt(obj) {
1376
+ if (!obj || typeof obj !== 'object' || !bigIntValueOf) {
1377
+ return false;
1378
+ }
1379
+ try {
1380
+ bigIntValueOf.call(obj);
1381
+ return true;
1382
+ } catch (e) {}
1383
+ return false;
1384
+ }
1385
+
1386
+ var hasOwn = Object.prototype.hasOwnProperty || function (key) { return key in this; };
1387
+ function has$3(obj, key) {
1388
+ return hasOwn.call(obj, key);
1389
+ }
1390
+
1391
+ function toStr(obj) {
1392
+ return objectToString.call(obj);
1393
+ }
1394
+
1395
+ function nameOf(f) {
1396
+ if (f.name) { return f.name; }
1397
+ var m = $match.call(functionToString.call(f), /^function\s*([\w$]+)/);
1398
+ if (m) { return m[1]; }
1399
+ return null;
1400
+ }
1401
+
1402
+ function indexOf(xs, x) {
1403
+ if (xs.indexOf) { return xs.indexOf(x); }
1404
+ for (var i = 0, l = xs.length; i < l; i++) {
1405
+ if (xs[i] === x) { return i; }
1406
+ }
1407
+ return -1;
1408
+ }
1409
+
1410
+ function isMap(x) {
1411
+ if (!mapSize || !x || typeof x !== 'object') {
1412
+ return false;
1413
+ }
1414
+ try {
1415
+ mapSize.call(x);
1416
+ try {
1417
+ setSize.call(x);
1418
+ } catch (s) {
1419
+ return true;
1420
+ }
1421
+ return x instanceof Map; // core-js workaround, pre-v2.5.0
1422
+ } catch (e) {}
1423
+ return false;
1424
+ }
1425
+
1426
+ function isWeakMap(x) {
1427
+ if (!weakMapHas || !x || typeof x !== 'object') {
1428
+ return false;
1429
+ }
1430
+ try {
1431
+ weakMapHas.call(x, weakMapHas);
1432
+ try {
1433
+ weakSetHas.call(x, weakSetHas);
1434
+ } catch (s) {
1435
+ return true;
1436
+ }
1437
+ return x instanceof WeakMap; // core-js workaround, pre-v2.5.0
1438
+ } catch (e) {}
1439
+ return false;
1440
+ }
1441
+
1442
+ function isWeakRef(x) {
1443
+ if (!weakRefDeref || !x || typeof x !== 'object') {
1444
+ return false;
1445
+ }
1446
+ try {
1447
+ weakRefDeref.call(x);
1448
+ return true;
1449
+ } catch (e) {}
1450
+ return false;
1451
+ }
1452
+
1453
+ function isSet(x) {
1454
+ if (!setSize || !x || typeof x !== 'object') {
1455
+ return false;
1456
+ }
1457
+ try {
1458
+ setSize.call(x);
1459
+ try {
1460
+ mapSize.call(x);
1461
+ } catch (m) {
1462
+ return true;
1463
+ }
1464
+ return x instanceof Set; // core-js workaround, pre-v2.5.0
1465
+ } catch (e) {}
1466
+ return false;
1467
+ }
1468
+
1469
+ function isWeakSet(x) {
1470
+ if (!weakSetHas || !x || typeof x !== 'object') {
1471
+ return false;
1472
+ }
1473
+ try {
1474
+ weakSetHas.call(x, weakSetHas);
1475
+ try {
1476
+ weakMapHas.call(x, weakMapHas);
1477
+ } catch (s) {
1478
+ return true;
1479
+ }
1480
+ return x instanceof WeakSet; // core-js workaround, pre-v2.5.0
1481
+ } catch (e) {}
1482
+ return false;
1483
+ }
1484
+
1485
+ function isElement(x) {
1486
+ if (!x || typeof x !== 'object') { return false; }
1487
+ if (typeof HTMLElement !== 'undefined' && x instanceof HTMLElement) {
1488
+ return true;
1489
+ }
1490
+ return typeof x.nodeName === 'string' && typeof x.getAttribute === 'function';
1491
+ }
1492
+
1493
+ function inspectString(str, opts) {
1494
+ if (str.length > opts.maxStringLength) {
1495
+ var remaining = str.length - opts.maxStringLength;
1496
+ var trailer = '... ' + remaining + ' more character' + (remaining > 1 ? 's' : '');
1497
+ return inspectString($slice.call(str, 0, opts.maxStringLength), opts) + trailer;
1498
+ }
1499
+ // eslint-disable-next-line no-control-regex
1500
+ var s = $replace.call($replace.call(str, /(['\\])/g, '\\$1'), /[\x00-\x1f]/g, lowbyte);
1501
+ return wrapQuotes(s, 'single', opts);
1502
+ }
1503
+
1504
+ function lowbyte(c) {
1505
+ var n = c.charCodeAt(0);
1506
+ var x = {
1507
+ 8: 'b',
1508
+ 9: 't',
1509
+ 10: 'n',
1510
+ 12: 'f',
1511
+ 13: 'r'
1512
+ }[n];
1513
+ if (x) { return '\\' + x; }
1514
+ return '\\x' + (n < 0x10 ? '0' : '') + $toUpperCase.call(n.toString(16));
1515
+ }
1516
+
1517
+ function markBoxed(str) {
1518
+ return 'Object(' + str + ')';
1519
+ }
1520
+
1521
+ function weakCollectionOf(type) {
1522
+ return type + ' { ? }';
1523
+ }
1524
+
1525
+ function collectionOf(type, size, entries, indent) {
1526
+ var joinedEntries = indent ? indentedJoin(entries, indent) : $join.call(entries, ', ');
1527
+ return type + ' (' + size + ') {' + joinedEntries + '}';
1528
+ }
1529
+
1530
+ function singleLineValues(xs) {
1531
+ for (var i = 0; i < xs.length; i++) {
1532
+ if (indexOf(xs[i], '\n') >= 0) {
1533
+ return false;
1534
+ }
1535
+ }
1536
+ return true;
1537
+ }
1538
+
1539
+ function getIndent(opts, depth) {
1540
+ var baseIndent;
1541
+ if (opts.indent === '\t') {
1542
+ baseIndent = '\t';
1543
+ } else if (typeof opts.indent === 'number' && opts.indent > 0) {
1544
+ baseIndent = $join.call(Array(opts.indent + 1), ' ');
1545
+ } else {
1546
+ return null;
1547
+ }
1548
+ return {
1549
+ base: baseIndent,
1550
+ prev: $join.call(Array(depth + 1), baseIndent)
1551
+ };
1552
+ }
1553
+
1554
+ function indentedJoin(xs, indent) {
1555
+ if (xs.length === 0) { return ''; }
1556
+ var lineJoiner = '\n' + indent.prev + indent.base;
1557
+ return lineJoiner + $join.call(xs, ',' + lineJoiner) + '\n' + indent.prev;
1558
+ }
1559
+
1560
+ function arrObjKeys(obj, inspect) {
1561
+ var isArr = isArray$3(obj);
1562
+ var xs = [];
1563
+ if (isArr) {
1564
+ xs.length = obj.length;
1565
+ for (var i = 0; i < obj.length; i++) {
1566
+ xs[i] = has$3(obj, i) ? inspect(obj[i], obj) : '';
1567
+ }
1568
+ }
1569
+ var syms = typeof gOPS === 'function' ? gOPS(obj) : [];
1570
+ var symMap;
1571
+ if (hasShammedSymbols) {
1572
+ symMap = {};
1573
+ for (var k = 0; k < syms.length; k++) {
1574
+ symMap['$' + syms[k]] = syms[k];
1575
+ }
1576
+ }
1577
+
1578
+ for (var key in obj) { // eslint-disable-line no-restricted-syntax
1579
+ if (!has$3(obj, key)) { continue; } // eslint-disable-line no-restricted-syntax, no-continue
1580
+ if (isArr && String(Number(key)) === key && key < obj.length) { continue; } // eslint-disable-line no-restricted-syntax, no-continue
1581
+ if (hasShammedSymbols && symMap['$' + key] instanceof Symbol) {
1582
+ // this is to prevent shammed Symbols, which are stored as strings, from being included in the string key section
1583
+ continue; // eslint-disable-line no-restricted-syntax, no-continue
1584
+ } else if ($test.call(/[^\w$]/, key)) {
1585
+ xs.push(inspect(key, obj) + ': ' + inspect(obj[key], obj));
1586
+ } else {
1587
+ xs.push(key + ': ' + inspect(obj[key], obj));
1588
+ }
1589
+ }
1590
+ if (typeof gOPS === 'function') {
1591
+ for (var j = 0; j < syms.length; j++) {
1592
+ if (isEnumerable.call(obj, syms[j])) {
1593
+ xs.push('[' + inspect(syms[j]) + ']: ' + inspect(obj[syms[j]], obj));
1594
+ }
1595
+ }
1596
+ }
1597
+ return xs;
1598
+ }
1599
+
1600
+ var GetIntrinsic = getIntrinsic;
1601
+ var callBound = callBound$1;
1602
+ var inspect = objectInspect;
1603
+
1604
+ var $TypeError = GetIntrinsic('%TypeError%');
1605
+ var $WeakMap = GetIntrinsic('%WeakMap%', true);
1606
+ var $Map = GetIntrinsic('%Map%', true);
1607
+
1608
+ var $weakMapGet = callBound('WeakMap.prototype.get', true);
1609
+ var $weakMapSet = callBound('WeakMap.prototype.set', true);
1610
+ var $weakMapHas = callBound('WeakMap.prototype.has', true);
1611
+ var $mapGet = callBound('Map.prototype.get', true);
1612
+ var $mapSet = callBound('Map.prototype.set', true);
1613
+ var $mapHas = callBound('Map.prototype.has', true);
1614
+
1615
+ /*
1616
+ * This function traverses the list returning the node corresponding to the
1617
+ * given key.
1618
+ *
1619
+ * That node is also moved to the head of the list, so that if it's accessed
1620
+ * again we don't need to traverse the whole list. By doing so, all the recently
1621
+ * used nodes can be accessed relatively quickly.
1622
+ */
1623
+ var listGetNode = function (list, key) { // eslint-disable-line consistent-return
1624
+ for (var prev = list, curr; (curr = prev.next) !== null; prev = curr) {
1625
+ if (curr.key === key) {
1626
+ prev.next = curr.next;
1627
+ curr.next = list.next;
1628
+ list.next = curr; // eslint-disable-line no-param-reassign
1629
+ return curr;
1002
1630
  }
1631
+ }
1632
+ };
1003
1633
 
1004
- for (const key of Object.keys(ret)) {
1005
- const value = ret[key];
1006
- if (typeof value === 'object' && value !== null) {
1007
- for (const k of Object.keys(value)) {
1008
- value[k] = parseValue(value[k], options);
1634
+ var listGet = function (objects, key) {
1635
+ var node = listGetNode(objects, key);
1636
+ return node && node.value;
1637
+ };
1638
+ var listSet = function (objects, key, value) {
1639
+ var node = listGetNode(objects, key);
1640
+ if (node) {
1641
+ node.value = value;
1642
+ } else {
1643
+ // Prepend the new node to the beginning of the list
1644
+ objects.next = { // eslint-disable-line no-param-reassign
1645
+ key: key,
1646
+ next: objects.next,
1647
+ value: value
1648
+ };
1649
+ }
1650
+ };
1651
+ var listHas = function (objects, key) {
1652
+ return !!listGetNode(objects, key);
1653
+ };
1654
+
1655
+ var sideChannel = function getSideChannel() {
1656
+ var $wm;
1657
+ var $m;
1658
+ var $o;
1659
+ var channel = {
1660
+ assert: function (key) {
1661
+ if (!channel.has(key)) {
1662
+ throw new $TypeError('Side channel does not contain ' + inspect(key));
1663
+ }
1664
+ },
1665
+ get: function (key) { // eslint-disable-line consistent-return
1666
+ if ($WeakMap && key && (typeof key === 'object' || typeof key === 'function')) {
1667
+ if ($wm) {
1668
+ return $weakMapGet($wm, key);
1669
+ }
1670
+ } else if ($Map) {
1671
+ if ($m) {
1672
+ return $mapGet($m, key);
1009
1673
  }
1010
1674
  } else {
1011
- ret[key] = parseValue(value, options);
1675
+ if ($o) { // eslint-disable-line no-lonely-if
1676
+ return listGet($o, key);
1677
+ }
1678
+ }
1679
+ },
1680
+ has: function (key) {
1681
+ if ($WeakMap && key && (typeof key === 'object' || typeof key === 'function')) {
1682
+ if ($wm) {
1683
+ return $weakMapHas($wm, key);
1684
+ }
1685
+ } else if ($Map) {
1686
+ if ($m) {
1687
+ return $mapHas($m, key);
1688
+ }
1689
+ } else {
1690
+ if ($o) { // eslint-disable-line no-lonely-if
1691
+ return listHas($o, key);
1692
+ }
1693
+ }
1694
+ return false;
1695
+ },
1696
+ set: function (key, value) {
1697
+ if ($WeakMap && key && (typeof key === 'object' || typeof key === 'function')) {
1698
+ if (!$wm) {
1699
+ $wm = new $WeakMap();
1700
+ }
1701
+ $weakMapSet($wm, key, value);
1702
+ } else if ($Map) {
1703
+ if (!$m) {
1704
+ $m = new $Map();
1705
+ }
1706
+ $mapSet($m, key, value);
1707
+ } else {
1708
+ if (!$o) {
1709
+ /*
1710
+ * Initialize the linked list as an empty node, so that we don't have
1711
+ * to special-case handling of the first node: we can always refer to
1712
+ * it as (previous node).next, instead of something like (list).head
1713
+ */
1714
+ $o = { key: {}, next: null };
1715
+ }
1716
+ listSet($o, key, value);
1012
1717
  }
1013
1718
  }
1719
+ };
1720
+ return channel;
1721
+ };
1014
1722
 
1015
- if (options.sort === false) {
1016
- return ret;
1017
- }
1723
+ var replace = String.prototype.replace;
1724
+ var percentTwenties = /%20/g;
1018
1725
 
1019
- return (options.sort === true ? Object.keys(ret).sort() : Object.keys(ret).sort(options.sort)).reduce((result, key) => {
1020
- const value = ret[key];
1021
- if (Boolean(value) && typeof value === 'object' && !Array.isArray(value)) {
1022
- // Sort object keys, not values
1023
- result[key] = keysSorter(value);
1024
- } else {
1025
- result[key] = value;
1026
- }
1726
+ var Format = {
1727
+ RFC1738: 'RFC1738',
1728
+ RFC3986: 'RFC3986'
1729
+ };
1027
1730
 
1028
- return result;
1029
- }, Object.create(null));
1030
- }
1731
+ var formats$3 = {
1732
+ 'default': Format.RFC3986,
1733
+ formatters: {
1734
+ RFC1738: function (value) {
1735
+ return replace.call(value, percentTwenties, '+');
1736
+ },
1737
+ RFC3986: function (value) {
1738
+ return String(value);
1739
+ }
1740
+ },
1741
+ RFC1738: Format.RFC1738,
1742
+ RFC3986: Format.RFC3986
1743
+ };
1031
1744
 
1032
- exports.extract = extract;
1033
- exports.parse = parse;
1745
+ var formats$2 = formats$3;
1034
1746
 
1035
- exports.stringify = (object, options) => {
1036
- if (!object) {
1037
- return '';
1038
- }
1747
+ var has$2 = Object.prototype.hasOwnProperty;
1748
+ var isArray$2 = Array.isArray;
1039
1749
 
1040
- options = Object.assign({
1041
- encode: true,
1042
- strict: true,
1043
- arrayFormat: 'none',
1044
- arrayFormatSeparator: ','
1045
- }, options);
1750
+ var hexTable = (function () {
1751
+ var array = [];
1752
+ for (var i = 0; i < 256; ++i) {
1753
+ array.push('%' + ((i < 16 ? '0' : '') + i.toString(16)).toUpperCase());
1754
+ }
1046
1755
 
1047
- validateArrayFormatSeparator(options.arrayFormatSeparator);
1756
+ return array;
1757
+ }());
1048
1758
 
1049
- const shouldFilter = key => (
1050
- (options.skipNull && isNullOrUndefined(object[key])) ||
1051
- (options.skipEmptyString && object[key] === '')
1052
- );
1759
+ var compactQueue = function compactQueue(queue) {
1760
+ while (queue.length > 1) {
1761
+ var item = queue.pop();
1762
+ var obj = item.obj[item.prop];
1053
1763
 
1054
- const formatter = encoderForArrayFormat(options);
1764
+ if (isArray$2(obj)) {
1765
+ var compacted = [];
1055
1766
 
1056
- const objectCopy = {};
1767
+ for (var j = 0; j < obj.length; ++j) {
1768
+ if (typeof obj[j] !== 'undefined') {
1769
+ compacted.push(obj[j]);
1770
+ }
1771
+ }
1057
1772
 
1058
- for (const key of Object.keys(object)) {
1059
- if (!shouldFilter(key)) {
1060
- objectCopy[key] = object[key];
1061
- }
1062
- }
1773
+ item.obj[item.prop] = compacted;
1774
+ }
1775
+ }
1776
+ };
1063
1777
 
1064
- const keys = Object.keys(objectCopy);
1778
+ var arrayToObject = function arrayToObject(source, options) {
1779
+ var obj = options && options.plainObjects ? Object.create(null) : {};
1780
+ for (var i = 0; i < source.length; ++i) {
1781
+ if (typeof source[i] !== 'undefined') {
1782
+ obj[i] = source[i];
1783
+ }
1784
+ }
1065
1785
 
1066
- if (options.sort !== false) {
1067
- keys.sort(options.sort);
1068
- }
1786
+ return obj;
1787
+ };
1069
1788
 
1070
- return keys.map(key => {
1071
- const value = object[key];
1789
+ var merge = function merge(target, source, options) {
1790
+ /* eslint no-param-reassign: 0 */
1791
+ if (!source) {
1792
+ return target;
1793
+ }
1072
1794
 
1073
- if (value === undefined) {
1074
- return '';
1075
- }
1795
+ if (typeof source !== 'object') {
1796
+ if (isArray$2(target)) {
1797
+ target.push(source);
1798
+ } else if (target && typeof target === 'object') {
1799
+ if ((options && (options.plainObjects || options.allowPrototypes)) || !has$2.call(Object.prototype, source)) {
1800
+ target[source] = true;
1801
+ }
1802
+ } else {
1803
+ return [target, source];
1804
+ }
1076
1805
 
1077
- if (value === null) {
1078
- return encode(key, options);
1079
- }
1806
+ return target;
1807
+ }
1080
1808
 
1081
- if (Array.isArray(value)) {
1082
- if (value.length === 0 && options.arrayFormat === 'bracket-separator') {
1083
- return encode(key, options) + '[]';
1084
- }
1809
+ if (!target || typeof target !== 'object') {
1810
+ return [target].concat(source);
1811
+ }
1085
1812
 
1086
- return value
1087
- .reduce(formatter(key), [])
1088
- .join('&');
1089
- }
1813
+ var mergeTarget = target;
1814
+ if (isArray$2(target) && !isArray$2(source)) {
1815
+ mergeTarget = arrayToObject(target, options);
1816
+ }
1090
1817
 
1091
- return encode(key, options) + '=' + encode(value, options);
1092
- }).filter(x => x.length > 0).join('&');
1093
- };
1818
+ if (isArray$2(target) && isArray$2(source)) {
1819
+ source.forEach(function (item, i) {
1820
+ if (has$2.call(target, i)) {
1821
+ var targetItem = target[i];
1822
+ if (targetItem && typeof targetItem === 'object' && item && typeof item === 'object') {
1823
+ target[i] = merge(targetItem, item, options);
1824
+ } else {
1825
+ target.push(item);
1826
+ }
1827
+ } else {
1828
+ target[i] = item;
1829
+ }
1830
+ });
1831
+ return target;
1832
+ }
1094
1833
 
1095
- exports.parseUrl = (url, options) => {
1096
- options = Object.assign({
1097
- decode: true
1098
- }, options);
1834
+ return Object.keys(source).reduce(function (acc, key) {
1835
+ var value = source[key];
1099
1836
 
1100
- const [url_, hash] = splitOnFirst$1(url, '#');
1837
+ if (has$2.call(acc, key)) {
1838
+ acc[key] = merge(acc[key], value, options);
1839
+ } else {
1840
+ acc[key] = value;
1841
+ }
1842
+ return acc;
1843
+ }, mergeTarget);
1844
+ };
1101
1845
 
1102
- return Object.assign(
1103
- {
1104
- url: url_.split('?')[0] || '',
1105
- query: parse(extract(url), options)
1106
- },
1107
- options && options.parseFragmentIdentifier && hash ? {fragmentIdentifier: decode(hash, options)} : {}
1108
- );
1109
- };
1846
+ var assign = function assignSingleSource(target, source) {
1847
+ return Object.keys(source).reduce(function (acc, key) {
1848
+ acc[key] = source[key];
1849
+ return acc;
1850
+ }, target);
1851
+ };
1110
1852
 
1111
- exports.stringifyUrl = (object, options) => {
1112
- options = Object.assign({
1113
- encode: true,
1114
- strict: true,
1115
- [encodeFragmentIdentifier]: true
1116
- }, options);
1117
-
1118
- const url = removeHash(object.url).split('?')[0] || '';
1119
- const queryFromUrl = exports.extract(object.url);
1120
- const parsedQueryFromUrl = exports.parse(queryFromUrl, {sort: false});
1121
-
1122
- const query = Object.assign(parsedQueryFromUrl, object.query);
1123
- let queryString = exports.stringify(query, options);
1124
- if (queryString) {
1125
- queryString = `?${queryString}`;
1126
- }
1853
+ var decode = function (str, decoder, charset) {
1854
+ var strWithoutPlus = str.replace(/\+/g, ' ');
1855
+ if (charset === 'iso-8859-1') {
1856
+ // unescape never throws, no try...catch needed:
1857
+ return strWithoutPlus.replace(/%[0-9a-f]{2}/gi, unescape);
1858
+ }
1859
+ // utf-8
1860
+ try {
1861
+ return decodeURIComponent(strWithoutPlus);
1862
+ } catch (e) {
1863
+ return strWithoutPlus;
1864
+ }
1865
+ };
1127
1866
 
1128
- let hash = getHash(object.url);
1129
- if (object.fragmentIdentifier) {
1130
- hash = `#${options[encodeFragmentIdentifier] ? encode(object.fragmentIdentifier, options) : object.fragmentIdentifier}`;
1131
- }
1867
+ var encode = function encode(str, defaultEncoder, charset, kind, format) {
1868
+ // This code was originally written by Brian White (mscdex) for the io.js core querystring library.
1869
+ // It has been adapted here for stricter adherence to RFC 3986
1870
+ if (str.length === 0) {
1871
+ return str;
1872
+ }
1132
1873
 
1133
- return `${url}${queryString}${hash}`;
1134
- };
1874
+ var string = str;
1875
+ if (typeof str === 'symbol') {
1876
+ string = Symbol.prototype.toString.call(str);
1877
+ } else if (typeof str !== 'string') {
1878
+ string = String(str);
1879
+ }
1135
1880
 
1136
- exports.pick = (input, filter, options) => {
1137
- options = Object.assign({
1138
- parseFragmentIdentifier: true,
1139
- [encodeFragmentIdentifier]: false
1140
- }, options);
1141
-
1142
- const {url, query, fragmentIdentifier} = exports.parseUrl(input, options);
1143
- return exports.stringifyUrl({
1144
- url,
1145
- query: filterObject(query, filter),
1146
- fragmentIdentifier
1147
- }, options);
1148
- };
1881
+ if (charset === 'iso-8859-1') {
1882
+ return escape(string).replace(/%u[0-9a-f]{4}/gi, function ($0) {
1883
+ return '%26%23' + parseInt($0.slice(2), 16) + '%3B';
1884
+ });
1885
+ }
1149
1886
 
1150
- exports.exclude = (input, filter, options) => {
1151
- const exclusionFilter = Array.isArray(filter) ? key => !filter.includes(key) : (key, value) => !filter(key, value);
1887
+ var out = '';
1888
+ for (var i = 0; i < string.length; ++i) {
1889
+ var c = string.charCodeAt(i);
1890
+
1891
+ if (
1892
+ c === 0x2D // -
1893
+ || c === 0x2E // .
1894
+ || c === 0x5F // _
1895
+ || c === 0x7E // ~
1896
+ || (c >= 0x30 && c <= 0x39) // 0-9
1897
+ || (c >= 0x41 && c <= 0x5A) // a-z
1898
+ || (c >= 0x61 && c <= 0x7A) // A-Z
1899
+ || (format === formats$2.RFC1738 && (c === 0x28 || c === 0x29)) // ( )
1900
+ ) {
1901
+ out += string.charAt(i);
1902
+ continue;
1903
+ }
1152
1904
 
1153
- return exports.pick(input, exclusionFilter, options);
1154
- };
1155
- } (queryString));
1905
+ if (c < 0x80) {
1906
+ out = out + hexTable[c];
1907
+ continue;
1908
+ }
1909
+
1910
+ if (c < 0x800) {
1911
+ out = out + (hexTable[0xC0 | (c >> 6)] + hexTable[0x80 | (c & 0x3F)]);
1912
+ continue;
1913
+ }
1914
+
1915
+ if (c < 0xD800 || c >= 0xE000) {
1916
+ out = out + (hexTable[0xE0 | (c >> 12)] + hexTable[0x80 | ((c >> 6) & 0x3F)] + hexTable[0x80 | (c & 0x3F)]);
1917
+ continue;
1918
+ }
1919
+
1920
+ i += 1;
1921
+ c = 0x10000 + (((c & 0x3FF) << 10) | (string.charCodeAt(i) & 0x3FF));
1922
+ /* eslint operator-linebreak: [2, "before"] */
1923
+ out += hexTable[0xF0 | (c >> 18)]
1924
+ + hexTable[0x80 | ((c >> 12) & 0x3F)]
1925
+ + hexTable[0x80 | ((c >> 6) & 0x3F)]
1926
+ + hexTable[0x80 | (c & 0x3F)];
1927
+ }
1928
+
1929
+ return out;
1930
+ };
1931
+
1932
+ var compact = function compact(value) {
1933
+ var queue = [{ obj: { o: value }, prop: 'o' }];
1934
+ var refs = [];
1935
+
1936
+ for (var i = 0; i < queue.length; ++i) {
1937
+ var item = queue[i];
1938
+ var obj = item.obj[item.prop];
1939
+
1940
+ var keys = Object.keys(obj);
1941
+ for (var j = 0; j < keys.length; ++j) {
1942
+ var key = keys[j];
1943
+ var val = obj[key];
1944
+ if (typeof val === 'object' && val !== null && refs.indexOf(val) === -1) {
1945
+ queue.push({ obj: obj, prop: key });
1946
+ refs.push(val);
1947
+ }
1948
+ }
1949
+ }
1950
+
1951
+ compactQueue(queue);
1952
+
1953
+ return value;
1954
+ };
1955
+
1956
+ var isRegExp = function isRegExp(obj) {
1957
+ return Object.prototype.toString.call(obj) === '[object RegExp]';
1958
+ };
1959
+
1960
+ var isBuffer = function isBuffer(obj) {
1961
+ if (!obj || typeof obj !== 'object') {
1962
+ return false;
1963
+ }
1964
+
1965
+ return !!(obj.constructor && obj.constructor.isBuffer && obj.constructor.isBuffer(obj));
1966
+ };
1967
+
1968
+ var combine = function combine(a, b) {
1969
+ return [].concat(a, b);
1970
+ };
1971
+
1972
+ var maybeMap = function maybeMap(val, fn) {
1973
+ if (isArray$2(val)) {
1974
+ var mapped = [];
1975
+ for (var i = 0; i < val.length; i += 1) {
1976
+ mapped.push(fn(val[i]));
1977
+ }
1978
+ return mapped;
1979
+ }
1980
+ return fn(val);
1981
+ };
1982
+
1983
+ var utils$2 = {
1984
+ arrayToObject: arrayToObject,
1985
+ assign: assign,
1986
+ combine: combine,
1987
+ compact: compact,
1988
+ decode: decode,
1989
+ encode: encode,
1990
+ isBuffer: isBuffer,
1991
+ isRegExp: isRegExp,
1992
+ maybeMap: maybeMap,
1993
+ merge: merge
1994
+ };
1995
+
1996
+ var getSideChannel = sideChannel;
1997
+ var utils$1 = utils$2;
1998
+ var formats$1 = formats$3;
1999
+ var has$1 = Object.prototype.hasOwnProperty;
2000
+
2001
+ var arrayPrefixGenerators = {
2002
+ brackets: function brackets(prefix) {
2003
+ return prefix + '[]';
2004
+ },
2005
+ comma: 'comma',
2006
+ indices: function indices(prefix, key) {
2007
+ return prefix + '[' + key + ']';
2008
+ },
2009
+ repeat: function repeat(prefix) {
2010
+ return prefix;
2011
+ }
2012
+ };
2013
+
2014
+ var isArray$1 = Array.isArray;
2015
+ var split = String.prototype.split;
2016
+ var push = Array.prototype.push;
2017
+ var pushToArray = function (arr, valueOrArray) {
2018
+ push.apply(arr, isArray$1(valueOrArray) ? valueOrArray : [valueOrArray]);
2019
+ };
2020
+
2021
+ var toISO = Date.prototype.toISOString;
2022
+
2023
+ var defaultFormat = formats$1['default'];
2024
+ var defaults$1 = {
2025
+ addQueryPrefix: false,
2026
+ allowDots: false,
2027
+ charset: 'utf-8',
2028
+ charsetSentinel: false,
2029
+ delimiter: '&',
2030
+ encode: true,
2031
+ encoder: utils$1.encode,
2032
+ encodeValuesOnly: false,
2033
+ format: defaultFormat,
2034
+ formatter: formats$1.formatters[defaultFormat],
2035
+ // deprecated
2036
+ indices: false,
2037
+ serializeDate: function serializeDate(date) {
2038
+ return toISO.call(date);
2039
+ },
2040
+ skipNulls: false,
2041
+ strictNullHandling: false
2042
+ };
2043
+
2044
+ var isNonNullishPrimitive = function isNonNullishPrimitive(v) {
2045
+ return typeof v === 'string'
2046
+ || typeof v === 'number'
2047
+ || typeof v === 'boolean'
2048
+ || typeof v === 'symbol'
2049
+ || typeof v === 'bigint';
2050
+ };
2051
+
2052
+ var sentinel = {};
2053
+
2054
+ var stringify$1 = function stringify(
2055
+ object,
2056
+ prefix,
2057
+ generateArrayPrefix,
2058
+ commaRoundTrip,
2059
+ strictNullHandling,
2060
+ skipNulls,
2061
+ encoder,
2062
+ filter,
2063
+ sort,
2064
+ allowDots,
2065
+ serializeDate,
2066
+ format,
2067
+ formatter,
2068
+ encodeValuesOnly,
2069
+ charset,
2070
+ sideChannel
2071
+ ) {
2072
+ var obj = object;
2073
+
2074
+ var tmpSc = sideChannel;
2075
+ var step = 0;
2076
+ var findFlag = false;
2077
+ while ((tmpSc = tmpSc.get(sentinel)) !== void undefined && !findFlag) {
2078
+ // Where object last appeared in the ref tree
2079
+ var pos = tmpSc.get(object);
2080
+ step += 1;
2081
+ if (typeof pos !== 'undefined') {
2082
+ if (pos === step) {
2083
+ throw new RangeError('Cyclic object value');
2084
+ } else {
2085
+ findFlag = true; // Break while
2086
+ }
2087
+ }
2088
+ if (typeof tmpSc.get(sentinel) === 'undefined') {
2089
+ step = 0;
2090
+ }
2091
+ }
2092
+
2093
+ if (typeof filter === 'function') {
2094
+ obj = filter(prefix, obj);
2095
+ } else if (obj instanceof Date) {
2096
+ obj = serializeDate(obj);
2097
+ } else if (generateArrayPrefix === 'comma' && isArray$1(obj)) {
2098
+ obj = utils$1.maybeMap(obj, function (value) {
2099
+ if (value instanceof Date) {
2100
+ return serializeDate(value);
2101
+ }
2102
+ return value;
2103
+ });
2104
+ }
2105
+
2106
+ if (obj === null) {
2107
+ if (strictNullHandling) {
2108
+ return encoder && !encodeValuesOnly ? encoder(prefix, defaults$1.encoder, charset, 'key', format) : prefix;
2109
+ }
2110
+
2111
+ obj = '';
2112
+ }
2113
+
2114
+ if (isNonNullishPrimitive(obj) || utils$1.isBuffer(obj)) {
2115
+ if (encoder) {
2116
+ var keyValue = encodeValuesOnly ? prefix : encoder(prefix, defaults$1.encoder, charset, 'key', format);
2117
+ if (generateArrayPrefix === 'comma' && encodeValuesOnly) {
2118
+ var valuesArray = split.call(String(obj), ',');
2119
+ var valuesJoined = '';
2120
+ for (var i = 0; i < valuesArray.length; ++i) {
2121
+ valuesJoined += (i === 0 ? '' : ',') + formatter(encoder(valuesArray[i], defaults$1.encoder, charset, 'value', format));
2122
+ }
2123
+ return [formatter(keyValue) + (commaRoundTrip && isArray$1(obj) && valuesArray.length === 1 ? '[]' : '') + '=' + valuesJoined];
2124
+ }
2125
+ return [formatter(keyValue) + '=' + formatter(encoder(obj, defaults$1.encoder, charset, 'value', format))];
2126
+ }
2127
+ return [formatter(prefix) + '=' + formatter(String(obj))];
2128
+ }
2129
+
2130
+ var values = [];
2131
+
2132
+ if (typeof obj === 'undefined') {
2133
+ return values;
2134
+ }
2135
+
2136
+ var objKeys;
2137
+ if (generateArrayPrefix === 'comma' && isArray$1(obj)) {
2138
+ // we need to join elements in
2139
+ objKeys = [{ value: obj.length > 0 ? obj.join(',') || null : void undefined }];
2140
+ } else if (isArray$1(filter)) {
2141
+ objKeys = filter;
2142
+ } else {
2143
+ var keys = Object.keys(obj);
2144
+ objKeys = sort ? keys.sort(sort) : keys;
2145
+ }
2146
+
2147
+ var adjustedPrefix = commaRoundTrip && isArray$1(obj) && obj.length === 1 ? prefix + '[]' : prefix;
2148
+
2149
+ for (var j = 0; j < objKeys.length; ++j) {
2150
+ var key = objKeys[j];
2151
+ var value = typeof key === 'object' && typeof key.value !== 'undefined' ? key.value : obj[key];
2152
+
2153
+ if (skipNulls && value === null) {
2154
+ continue;
2155
+ }
2156
+
2157
+ var keyPrefix = isArray$1(obj)
2158
+ ? typeof generateArrayPrefix === 'function' ? generateArrayPrefix(adjustedPrefix, key) : adjustedPrefix
2159
+ : adjustedPrefix + (allowDots ? '.' + key : '[' + key + ']');
2160
+
2161
+ sideChannel.set(object, step);
2162
+ var valueSideChannel = getSideChannel();
2163
+ valueSideChannel.set(sentinel, sideChannel);
2164
+ pushToArray(values, stringify(
2165
+ value,
2166
+ keyPrefix,
2167
+ generateArrayPrefix,
2168
+ commaRoundTrip,
2169
+ strictNullHandling,
2170
+ skipNulls,
2171
+ encoder,
2172
+ filter,
2173
+ sort,
2174
+ allowDots,
2175
+ serializeDate,
2176
+ format,
2177
+ formatter,
2178
+ encodeValuesOnly,
2179
+ charset,
2180
+ valueSideChannel
2181
+ ));
2182
+ }
2183
+
2184
+ return values;
2185
+ };
2186
+
2187
+ var normalizeStringifyOptions = function normalizeStringifyOptions(opts) {
2188
+ if (!opts) {
2189
+ return defaults$1;
2190
+ }
2191
+
2192
+ if (opts.encoder !== null && typeof opts.encoder !== 'undefined' && typeof opts.encoder !== 'function') {
2193
+ throw new TypeError('Encoder has to be a function.');
2194
+ }
2195
+
2196
+ var charset = opts.charset || defaults$1.charset;
2197
+ if (typeof opts.charset !== 'undefined' && opts.charset !== 'utf-8' && opts.charset !== 'iso-8859-1') {
2198
+ throw new TypeError('The charset option must be either utf-8, iso-8859-1, or undefined');
2199
+ }
2200
+
2201
+ var format = formats$1['default'];
2202
+ if (typeof opts.format !== 'undefined') {
2203
+ if (!has$1.call(formats$1.formatters, opts.format)) {
2204
+ throw new TypeError('Unknown format option provided.');
2205
+ }
2206
+ format = opts.format;
2207
+ }
2208
+ var formatter = formats$1.formatters[format];
2209
+
2210
+ var filter = defaults$1.filter;
2211
+ if (typeof opts.filter === 'function' || isArray$1(opts.filter)) {
2212
+ filter = opts.filter;
2213
+ }
2214
+
2215
+ return {
2216
+ addQueryPrefix: typeof opts.addQueryPrefix === 'boolean' ? opts.addQueryPrefix : defaults$1.addQueryPrefix,
2217
+ allowDots: typeof opts.allowDots === 'undefined' ? defaults$1.allowDots : !!opts.allowDots,
2218
+ charset: charset,
2219
+ charsetSentinel: typeof opts.charsetSentinel === 'boolean' ? opts.charsetSentinel : defaults$1.charsetSentinel,
2220
+ delimiter: typeof opts.delimiter === 'undefined' ? defaults$1.delimiter : opts.delimiter,
2221
+ encode: typeof opts.encode === 'boolean' ? opts.encode : defaults$1.encode,
2222
+ encoder: typeof opts.encoder === 'function' ? opts.encoder : defaults$1.encoder,
2223
+ encodeValuesOnly: typeof opts.encodeValuesOnly === 'boolean' ? opts.encodeValuesOnly : defaults$1.encodeValuesOnly,
2224
+ filter: filter,
2225
+ format: format,
2226
+ formatter: formatter,
2227
+ serializeDate: typeof opts.serializeDate === 'function' ? opts.serializeDate : defaults$1.serializeDate,
2228
+ skipNulls: typeof opts.skipNulls === 'boolean' ? opts.skipNulls : defaults$1.skipNulls,
2229
+ sort: typeof opts.sort === 'function' ? opts.sort : null,
2230
+ strictNullHandling: typeof opts.strictNullHandling === 'boolean' ? opts.strictNullHandling : defaults$1.strictNullHandling
2231
+ };
2232
+ };
2233
+
2234
+ var stringify_1 = function (object, opts) {
2235
+ var obj = object;
2236
+ var options = normalizeStringifyOptions(opts);
2237
+
2238
+ var objKeys;
2239
+ var filter;
2240
+
2241
+ if (typeof options.filter === 'function') {
2242
+ filter = options.filter;
2243
+ obj = filter('', obj);
2244
+ } else if (isArray$1(options.filter)) {
2245
+ filter = options.filter;
2246
+ objKeys = filter;
2247
+ }
2248
+
2249
+ var keys = [];
2250
+
2251
+ if (typeof obj !== 'object' || obj === null) {
2252
+ return '';
2253
+ }
2254
+
2255
+ var arrayFormat;
2256
+ if (opts && opts.arrayFormat in arrayPrefixGenerators) {
2257
+ arrayFormat = opts.arrayFormat;
2258
+ } else if (opts && 'indices' in opts) {
2259
+ arrayFormat = opts.indices ? 'indices' : 'repeat';
2260
+ } else {
2261
+ arrayFormat = 'indices';
2262
+ }
2263
+
2264
+ var generateArrayPrefix = arrayPrefixGenerators[arrayFormat];
2265
+ if (opts && 'commaRoundTrip' in opts && typeof opts.commaRoundTrip !== 'boolean') {
2266
+ throw new TypeError('`commaRoundTrip` must be a boolean, or absent');
2267
+ }
2268
+ var commaRoundTrip = generateArrayPrefix === 'comma' && opts && opts.commaRoundTrip;
2269
+
2270
+ if (!objKeys) {
2271
+ objKeys = Object.keys(obj);
2272
+ }
2273
+
2274
+ if (options.sort) {
2275
+ objKeys.sort(options.sort);
2276
+ }
2277
+
2278
+ var sideChannel = getSideChannel();
2279
+ for (var i = 0; i < objKeys.length; ++i) {
2280
+ var key = objKeys[i];
2281
+
2282
+ if (options.skipNulls && obj[key] === null) {
2283
+ continue;
2284
+ }
2285
+ pushToArray(keys, stringify$1(
2286
+ obj[key],
2287
+ key,
2288
+ generateArrayPrefix,
2289
+ commaRoundTrip,
2290
+ options.strictNullHandling,
2291
+ options.skipNulls,
2292
+ options.encode ? options.encoder : null,
2293
+ options.filter,
2294
+ options.sort,
2295
+ options.allowDots,
2296
+ options.serializeDate,
2297
+ options.format,
2298
+ options.formatter,
2299
+ options.encodeValuesOnly,
2300
+ options.charset,
2301
+ sideChannel
2302
+ ));
2303
+ }
2304
+
2305
+ var joined = keys.join(options.delimiter);
2306
+ var prefix = options.addQueryPrefix === true ? '?' : '';
2307
+
2308
+ if (options.charsetSentinel) {
2309
+ if (options.charset === 'iso-8859-1') {
2310
+ // encodeURIComponent('&#10003;'), the "numeric entity" representation of a checkmark
2311
+ prefix += 'utf8=%26%2310003%3B&';
2312
+ } else {
2313
+ // encodeURIComponent('✓')
2314
+ prefix += 'utf8=%E2%9C%93&';
2315
+ }
2316
+ }
2317
+
2318
+ return joined.length > 0 ? prefix + joined : '';
2319
+ };
2320
+
2321
+ var utils = utils$2;
2322
+
2323
+ var has = Object.prototype.hasOwnProperty;
2324
+ var isArray = Array.isArray;
2325
+
2326
+ var defaults = {
2327
+ allowDots: false,
2328
+ allowPrototypes: false,
2329
+ allowSparse: false,
2330
+ arrayLimit: 20,
2331
+ charset: 'utf-8',
2332
+ charsetSentinel: false,
2333
+ comma: false,
2334
+ decoder: utils.decode,
2335
+ delimiter: '&',
2336
+ depth: 5,
2337
+ ignoreQueryPrefix: false,
2338
+ interpretNumericEntities: false,
2339
+ parameterLimit: 1000,
2340
+ parseArrays: true,
2341
+ plainObjects: false,
2342
+ strictNullHandling: false
2343
+ };
2344
+
2345
+ var interpretNumericEntities = function (str) {
2346
+ return str.replace(/&#(\d+);/g, function ($0, numberStr) {
2347
+ return String.fromCharCode(parseInt(numberStr, 10));
2348
+ });
2349
+ };
2350
+
2351
+ var parseArrayValue = function (val, options) {
2352
+ if (val && typeof val === 'string' && options.comma && val.indexOf(',') > -1) {
2353
+ return val.split(',');
2354
+ }
2355
+
2356
+ return val;
2357
+ };
2358
+
2359
+ // This is what browsers will submit when the ✓ character occurs in an
2360
+ // application/x-www-form-urlencoded body and the encoding of the page containing
2361
+ // the form is iso-8859-1, or when the submitted form has an accept-charset
2362
+ // attribute of iso-8859-1. Presumably also with other charsets that do not contain
2363
+ // the ✓ character, such as us-ascii.
2364
+ var isoSentinel = 'utf8=%26%2310003%3B'; // encodeURIComponent('&#10003;')
2365
+
2366
+ // These are the percent-encoded utf-8 octets representing a checkmark, indicating that the request actually is utf-8 encoded.
2367
+ var charsetSentinel = 'utf8=%E2%9C%93'; // encodeURIComponent('✓')
2368
+
2369
+ var parseValues = function parseQueryStringValues(str, options) {
2370
+ var obj = {};
2371
+ var cleanStr = options.ignoreQueryPrefix ? str.replace(/^\?/, '') : str;
2372
+ var limit = options.parameterLimit === Infinity ? undefined : options.parameterLimit;
2373
+ var parts = cleanStr.split(options.delimiter, limit);
2374
+ var skipIndex = -1; // Keep track of where the utf8 sentinel was found
2375
+ var i;
2376
+
2377
+ var charset = options.charset;
2378
+ if (options.charsetSentinel) {
2379
+ for (i = 0; i < parts.length; ++i) {
2380
+ if (parts[i].indexOf('utf8=') === 0) {
2381
+ if (parts[i] === charsetSentinel) {
2382
+ charset = 'utf-8';
2383
+ } else if (parts[i] === isoSentinel) {
2384
+ charset = 'iso-8859-1';
2385
+ }
2386
+ skipIndex = i;
2387
+ i = parts.length; // The eslint settings do not allow break;
2388
+ }
2389
+ }
2390
+ }
2391
+
2392
+ for (i = 0; i < parts.length; ++i) {
2393
+ if (i === skipIndex) {
2394
+ continue;
2395
+ }
2396
+ var part = parts[i];
2397
+
2398
+ var bracketEqualsPos = part.indexOf(']=');
2399
+ var pos = bracketEqualsPos === -1 ? part.indexOf('=') : bracketEqualsPos + 1;
2400
+
2401
+ var key, val;
2402
+ if (pos === -1) {
2403
+ key = options.decoder(part, defaults.decoder, charset, 'key');
2404
+ val = options.strictNullHandling ? null : '';
2405
+ } else {
2406
+ key = options.decoder(part.slice(0, pos), defaults.decoder, charset, 'key');
2407
+ val = utils.maybeMap(
2408
+ parseArrayValue(part.slice(pos + 1), options),
2409
+ function (encodedVal) {
2410
+ return options.decoder(encodedVal, defaults.decoder, charset, 'value');
2411
+ }
2412
+ );
2413
+ }
2414
+
2415
+ if (val && options.interpretNumericEntities && charset === 'iso-8859-1') {
2416
+ val = interpretNumericEntities(val);
2417
+ }
2418
+
2419
+ if (part.indexOf('[]=') > -1) {
2420
+ val = isArray(val) ? [val] : val;
2421
+ }
2422
+
2423
+ if (has.call(obj, key)) {
2424
+ obj[key] = utils.combine(obj[key], val);
2425
+ } else {
2426
+ obj[key] = val;
2427
+ }
2428
+ }
2429
+
2430
+ return obj;
2431
+ };
2432
+
2433
+ var parseObject = function (chain, val, options, valuesParsed) {
2434
+ var leaf = valuesParsed ? val : parseArrayValue(val, options);
2435
+
2436
+ for (var i = chain.length - 1; i >= 0; --i) {
2437
+ var obj;
2438
+ var root = chain[i];
2439
+
2440
+ if (root === '[]' && options.parseArrays) {
2441
+ obj = [].concat(leaf);
2442
+ } else {
2443
+ obj = options.plainObjects ? Object.create(null) : {};
2444
+ var cleanRoot = root.charAt(0) === '[' && root.charAt(root.length - 1) === ']' ? root.slice(1, -1) : root;
2445
+ var index = parseInt(cleanRoot, 10);
2446
+ if (!options.parseArrays && cleanRoot === '') {
2447
+ obj = { 0: leaf };
2448
+ } else if (
2449
+ !isNaN(index)
2450
+ && root !== cleanRoot
2451
+ && String(index) === cleanRoot
2452
+ && index >= 0
2453
+ && (options.parseArrays && index <= options.arrayLimit)
2454
+ ) {
2455
+ obj = [];
2456
+ obj[index] = leaf;
2457
+ } else if (cleanRoot !== '__proto__') {
2458
+ obj[cleanRoot] = leaf;
2459
+ }
2460
+ }
2461
+
2462
+ leaf = obj;
2463
+ }
2464
+
2465
+ return leaf;
2466
+ };
2467
+
2468
+ var parseKeys = function parseQueryStringKeys(givenKey, val, options, valuesParsed) {
2469
+ if (!givenKey) {
2470
+ return;
2471
+ }
2472
+
2473
+ // Transform dot notation to bracket notation
2474
+ var key = options.allowDots ? givenKey.replace(/\.([^.[]+)/g, '[$1]') : givenKey;
2475
+
2476
+ // The regex chunks
2477
+
2478
+ var brackets = /(\[[^[\]]*])/;
2479
+ var child = /(\[[^[\]]*])/g;
2480
+
2481
+ // Get the parent
2482
+
2483
+ var segment = options.depth > 0 && brackets.exec(key);
2484
+ var parent = segment ? key.slice(0, segment.index) : key;
2485
+
2486
+ // Stash the parent if it exists
2487
+
2488
+ var keys = [];
2489
+ if (parent) {
2490
+ // If we aren't using plain objects, optionally prefix keys that would overwrite object prototype properties
2491
+ if (!options.plainObjects && has.call(Object.prototype, parent)) {
2492
+ if (!options.allowPrototypes) {
2493
+ return;
2494
+ }
2495
+ }
2496
+
2497
+ keys.push(parent);
2498
+ }
2499
+
2500
+ // Loop through children appending to the array until we hit depth
2501
+
2502
+ var i = 0;
2503
+ while (options.depth > 0 && (segment = child.exec(key)) !== null && i < options.depth) {
2504
+ i += 1;
2505
+ if (!options.plainObjects && has.call(Object.prototype, segment[1].slice(1, -1))) {
2506
+ if (!options.allowPrototypes) {
2507
+ return;
2508
+ }
2509
+ }
2510
+ keys.push(segment[1]);
2511
+ }
2512
+
2513
+ // If there's a remainder, just add whatever is left
2514
+
2515
+ if (segment) {
2516
+ keys.push('[' + key.slice(segment.index) + ']');
2517
+ }
2518
+
2519
+ return parseObject(keys, val, options, valuesParsed);
2520
+ };
2521
+
2522
+ var normalizeParseOptions = function normalizeParseOptions(opts) {
2523
+ if (!opts) {
2524
+ return defaults;
2525
+ }
2526
+
2527
+ if (opts.decoder !== null && opts.decoder !== undefined && typeof opts.decoder !== 'function') {
2528
+ throw new TypeError('Decoder has to be a function.');
2529
+ }
2530
+
2531
+ if (typeof opts.charset !== 'undefined' && opts.charset !== 'utf-8' && opts.charset !== 'iso-8859-1') {
2532
+ throw new TypeError('The charset option must be either utf-8, iso-8859-1, or undefined');
2533
+ }
2534
+ var charset = typeof opts.charset === 'undefined' ? defaults.charset : opts.charset;
2535
+
2536
+ return {
2537
+ allowDots: typeof opts.allowDots === 'undefined' ? defaults.allowDots : !!opts.allowDots,
2538
+ allowPrototypes: typeof opts.allowPrototypes === 'boolean' ? opts.allowPrototypes : defaults.allowPrototypes,
2539
+ allowSparse: typeof opts.allowSparse === 'boolean' ? opts.allowSparse : defaults.allowSparse,
2540
+ arrayLimit: typeof opts.arrayLimit === 'number' ? opts.arrayLimit : defaults.arrayLimit,
2541
+ charset: charset,
2542
+ charsetSentinel: typeof opts.charsetSentinel === 'boolean' ? opts.charsetSentinel : defaults.charsetSentinel,
2543
+ comma: typeof opts.comma === 'boolean' ? opts.comma : defaults.comma,
2544
+ decoder: typeof opts.decoder === 'function' ? opts.decoder : defaults.decoder,
2545
+ delimiter: typeof opts.delimiter === 'string' || utils.isRegExp(opts.delimiter) ? opts.delimiter : defaults.delimiter,
2546
+ // eslint-disable-next-line no-implicit-coercion, no-extra-parens
2547
+ depth: (typeof opts.depth === 'number' || opts.depth === false) ? +opts.depth : defaults.depth,
2548
+ ignoreQueryPrefix: opts.ignoreQueryPrefix === true,
2549
+ interpretNumericEntities: typeof opts.interpretNumericEntities === 'boolean' ? opts.interpretNumericEntities : defaults.interpretNumericEntities,
2550
+ parameterLimit: typeof opts.parameterLimit === 'number' ? opts.parameterLimit : defaults.parameterLimit,
2551
+ parseArrays: opts.parseArrays !== false,
2552
+ plainObjects: typeof opts.plainObjects === 'boolean' ? opts.plainObjects : defaults.plainObjects,
2553
+ strictNullHandling: typeof opts.strictNullHandling === 'boolean' ? opts.strictNullHandling : defaults.strictNullHandling
2554
+ };
2555
+ };
2556
+
2557
+ var parse$1 = function (str, opts) {
2558
+ var options = normalizeParseOptions(opts);
2559
+
2560
+ if (str === '' || str === null || typeof str === 'undefined') {
2561
+ return options.plainObjects ? Object.create(null) : {};
2562
+ }
2563
+
2564
+ var tempObj = typeof str === 'string' ? parseValues(str, options) : str;
2565
+ var obj = options.plainObjects ? Object.create(null) : {};
2566
+
2567
+ // Iterate over the keys and setup the new object
2568
+
2569
+ var keys = Object.keys(tempObj);
2570
+ for (var i = 0; i < keys.length; ++i) {
2571
+ var key = keys[i];
2572
+ var newObj = parseKeys(key, tempObj[key], options, typeof str === 'string');
2573
+ obj = utils.merge(obj, newObj, options);
2574
+ }
2575
+
2576
+ if (options.allowSparse === true) {
2577
+ return obj;
2578
+ }
2579
+
2580
+ return utils.compact(obj);
2581
+ };
2582
+
2583
+ var stringify = stringify_1;
2584
+ var parse = parse$1;
2585
+ var formats = formats$3;
2586
+
2587
+ var lib = {
2588
+ formats: formats,
2589
+ parse: parse,
2590
+ stringify: stringify
2591
+ };
1156
2592
 
1157
2593
  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; }
1158
2594
 
@@ -1185,8 +2621,6 @@ var copyToClipboard = /*#__PURE__*/function () {
1185
2621
  showToastr,
1186
2622
  _ref2$message,
1187
2623
  message,
1188
- _require,
1189
- Toastr,
1190
2624
  textArea,
1191
2625
  _args = arguments;
1192
2626
 
@@ -1195,27 +2629,21 @@ var copyToClipboard = /*#__PURE__*/function () {
1195
2629
  switch (_context.prev = _context.next) {
1196
2630
  case 0:
1197
2631
  _ref2 = _args.length > 1 && _args[1] !== undefined ? _args[1] : {}, _ref2$showToastr = _ref2.showToastr, showToastr = _ref2$showToastr === void 0 ? true : _ref2$showToastr, _ref2$message = _ref2.message, message = _ref2$message === void 0 ? i18next.t("neetoCommons.toastr.success.copiedToClipboard") : _ref2$message;
1198
-
1199
- /*
1200
- This is a workaround to prevent the jest tests from failing. Once the issue in neetoUI
1201
- https://github.com/bigbinary/neeto-ui/issues/1175 is resolved, this import can be moved to the top of the file.
1202
- */
1203
- _require = require("@bigbinary/neetoui"), Toastr = _require.Toastr;
1204
- _context.prev = 2;
2632
+ _context.prev = 1;
1205
2633
 
1206
2634
  if (!(navigator.clipboard && window.isSecureContext)) {
1207
- _context.next = 8;
2635
+ _context.next = 7;
1208
2636
  break;
1209
2637
  }
1210
2638
 
1211
- _context.next = 6;
2639
+ _context.next = 5;
1212
2640
  return navigator.clipboard.writeText(text);
1213
2641
 
1214
- case 6:
1215
- _context.next = 18;
2642
+ case 5:
2643
+ _context.next = 17;
1216
2644
  break;
1217
2645
 
1218
- case 8:
2646
+ case 7:
1219
2647
  textArea = document.createElement("textarea");
1220
2648
  textArea.value = text;
1221
2649
  textArea.style.top = "0";
@@ -1227,22 +2655,22 @@ var copyToClipboard = /*#__PURE__*/function () {
1227
2655
  document.execCommand("copy");
1228
2656
  document.body.removeChild(textArea);
1229
2657
 
1230
- case 18:
2658
+ case 17:
1231
2659
  showToastr && Toastr.success(message);
1232
- _context.next = 24;
2660
+ _context.next = 23;
1233
2661
  break;
1234
2662
 
1235
- case 21:
1236
- _context.prev = 21;
1237
- _context.t0 = _context["catch"](2);
2663
+ case 20:
2664
+ _context.prev = 20;
2665
+ _context.t0 = _context["catch"](1);
1238
2666
  Toastr.error(_context.t0);
1239
2667
 
1240
- case 24:
2668
+ case 23:
1241
2669
  case "end":
1242
2670
  return _context.stop();
1243
2671
  }
1244
2672
  }
1245
- }, _callee, null, [[2, 21]]);
2673
+ }, _callee, null, [[1, 20]]);
1246
2674
  }));
1247
2675
 
1248
2676
  return function copyToClipboard(_x) {
@@ -1261,8 +2689,8 @@ var buildUrl = function buildUrl(route, params) {
1261
2689
  route = route.replace(":".concat(key), encodeURIComponent(value));
1262
2690
  }
1263
2691
  });
1264
- var queryParams = omit(placeHolders, params);
1265
- return isEmpty(queryParams) ? route : "".concat(route, "?").concat(queryString.stringify(queryParams));
2692
+ var queryParams = pipe(omit(placeHolders), preprocessForSerialization, lib.stringify)(params);
2693
+ return isEmpty(queryParams) ? route : "".concat(route, "?").concat(queryParams);
1266
2694
  };
1267
2695
 
1268
2696
  dayjs.extend(relativeTime);