@wg-npm/survey-service-api 0.1.272 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,2817 +0,0 @@
1
- var SurveyServiceApiPlugin = (function (Axios, util) {
2
- 'use strict';
3
-
4
- Axios = Axios && Object.prototype.hasOwnProperty.call(Axios, 'default') ? Axios['default'] : Axios;
5
- util = util && Object.prototype.hasOwnProperty.call(util, 'default') ? util['default'] : util;
6
-
7
- /*! *****************************************************************************
8
- Copyright (c) Microsoft Corporation.
9
-
10
- Permission to use, copy, modify, and/or distribute this software for any
11
- purpose with or without fee is hereby granted.
12
-
13
- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
14
- REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
15
- AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
16
- INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
17
- LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
18
- OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
19
- PERFORMANCE OF THIS SOFTWARE.
20
- ***************************************************************************** */
21
-
22
- var __assign = function() {
23
- __assign = Object.assign || function __assign(t) {
24
- for (var s, i = 1, n = arguments.length; i < n; i++) {
25
- s = arguments[i];
26
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
27
- }
28
- return t;
29
- };
30
- return __assign.apply(this, arguments);
31
- };
32
-
33
- var SurveyModel = function () {
34
- function SurveyModel() {}
35
-
36
- return SurveyModel;
37
- }();
38
-
39
- var QuestionModel = function () {
40
- function QuestionModel() {}
41
-
42
- return QuestionModel;
43
- }();
44
-
45
- /* eslint complexity: [2, 18], max-statements: [2, 33] */
46
-
47
- var shams = function hasSymbols() {
48
- if (typeof Symbol !== 'function' || typeof Object.getOwnPropertySymbols !== 'function') {
49
- return false;
50
- }
51
-
52
- if (typeof Symbol.iterator === 'symbol') {
53
- return true;
54
- }
55
-
56
- var obj = {};
57
- var sym = Symbol('test');
58
- var symObj = Object(sym);
59
-
60
- if (typeof sym === 'string') {
61
- return false;
62
- }
63
-
64
- if (Object.prototype.toString.call(sym) !== '[object Symbol]') {
65
- return false;
66
- }
67
-
68
- if (Object.prototype.toString.call(symObj) !== '[object Symbol]') {
69
- return false;
70
- } // temp disabled per https://github.com/ljharb/object.assign/issues/17
71
- // if (sym instanceof Symbol) { return false; }
72
- // temp disabled per https://github.com/WebReflection/get-own-property-symbols/issues/4
73
- // if (!(symObj instanceof Symbol)) { return false; }
74
- // if (typeof Symbol.prototype.toString !== 'function') { return false; }
75
- // if (String(sym) !== Symbol.prototype.toString.call(sym)) { return false; }
76
-
77
-
78
- var symVal = 42;
79
- obj[sym] = symVal;
80
-
81
- for (sym in obj) {
82
- return false;
83
- } // eslint-disable-line no-restricted-syntax, no-unreachable-loop
84
-
85
-
86
- if (typeof Object.keys === 'function' && Object.keys(obj).length !== 0) {
87
- return false;
88
- }
89
-
90
- if (typeof Object.getOwnPropertyNames === 'function' && Object.getOwnPropertyNames(obj).length !== 0) {
91
- return false;
92
- }
93
-
94
- var syms = Object.getOwnPropertySymbols(obj);
95
-
96
- if (syms.length !== 1 || syms[0] !== sym) {
97
- return false;
98
- }
99
-
100
- if (!Object.prototype.propertyIsEnumerable.call(obj, sym)) {
101
- return false;
102
- }
103
-
104
- if (typeof Object.getOwnPropertyDescriptor === 'function') {
105
- var descriptor = Object.getOwnPropertyDescriptor(obj, sym);
106
-
107
- if (descriptor.value !== symVal || descriptor.enumerable !== true) {
108
- return false;
109
- }
110
- }
111
-
112
- return true;
113
- };
114
-
115
- var origSymbol = typeof Symbol !== 'undefined' && Symbol;
116
-
117
- var hasSymbols = function hasNativeSymbols() {
118
- if (typeof origSymbol !== 'function') {
119
- return false;
120
- }
121
-
122
- if (typeof Symbol !== 'function') {
123
- return false;
124
- }
125
-
126
- if (typeof origSymbol('foo') !== 'symbol') {
127
- return false;
128
- }
129
-
130
- if (typeof Symbol('bar') !== 'symbol') {
131
- return false;
132
- }
133
-
134
- return shams();
135
- };
136
-
137
- /* eslint no-invalid-this: 1 */
138
-
139
- var ERROR_MESSAGE = 'Function.prototype.bind called on incompatible ';
140
- var slice = Array.prototype.slice;
141
- var toStr = Object.prototype.toString;
142
- var funcType = '[object Function]';
143
-
144
- var implementation = function bind(that) {
145
- var target = this;
146
-
147
- if (typeof target !== 'function' || toStr.call(target) !== funcType) {
148
- throw new TypeError(ERROR_MESSAGE + target);
149
- }
150
-
151
- var args = slice.call(arguments, 1);
152
- var bound;
153
-
154
- var binder = function () {
155
- if (this instanceof bound) {
156
- var result = target.apply(this, args.concat(slice.call(arguments)));
157
-
158
- if (Object(result) === result) {
159
- return result;
160
- }
161
-
162
- return this;
163
- } else {
164
- return target.apply(that, args.concat(slice.call(arguments)));
165
- }
166
- };
167
-
168
- var boundLength = Math.max(0, target.length - args.length);
169
- var boundArgs = [];
170
-
171
- for (var i = 0; i < boundLength; i++) {
172
- boundArgs.push('$' + i);
173
- }
174
-
175
- bound = Function('binder', 'return function (' + boundArgs.join(',') + '){ return binder.apply(this,arguments); }')(binder);
176
-
177
- if (target.prototype) {
178
- var Empty = function Empty() {};
179
-
180
- Empty.prototype = target.prototype;
181
- bound.prototype = new Empty();
182
- Empty.prototype = null;
183
- }
184
-
185
- return bound;
186
- };
187
-
188
- var functionBind = Function.prototype.bind || implementation;
189
-
190
- var src = functionBind.call(Function.call, Object.prototype.hasOwnProperty);
191
-
192
- var undefined$1;
193
- var $SyntaxError = SyntaxError;
194
- var $Function = Function;
195
- var $TypeError = TypeError; // eslint-disable-next-line consistent-return
196
-
197
- var getEvalledConstructor = function (expressionSyntax) {
198
- try {
199
- return $Function('"use strict"; return (' + expressionSyntax + ').constructor;')();
200
- } catch (e) {}
201
- };
202
-
203
- var $gOPD = Object.getOwnPropertyDescriptor;
204
-
205
- if ($gOPD) {
206
- try {
207
- $gOPD({}, '');
208
- } catch (e) {
209
- $gOPD = null; // this is IE 8, which has a broken gOPD
210
- }
211
- }
212
-
213
- var throwTypeError = function () {
214
- throw new $TypeError();
215
- };
216
-
217
- var ThrowTypeError = $gOPD ? function () {
218
- try {
219
- // eslint-disable-next-line no-unused-expressions, no-caller, no-restricted-properties
220
- arguments.callee; // IE 8 does not throw here
221
-
222
- return throwTypeError;
223
- } catch (calleeThrows) {
224
- try {
225
- // IE 8 throws on Object.getOwnPropertyDescriptor(arguments, '')
226
- return $gOPD(arguments, 'callee').get;
227
- } catch (gOPDthrows) {
228
- return throwTypeError;
229
- }
230
- }
231
- }() : throwTypeError;
232
- var hasSymbols$1 = hasSymbols();
233
-
234
- var getProto = Object.getPrototypeOf || function (x) {
235
- return x.__proto__;
236
- }; // eslint-disable-line no-proto
237
-
238
-
239
- var needsEval = {};
240
- var TypedArray = typeof Uint8Array === 'undefined' ? undefined$1 : getProto(Uint8Array);
241
- var INTRINSICS = {
242
- '%AggregateError%': typeof AggregateError === 'undefined' ? undefined$1 : AggregateError,
243
- '%Array%': Array,
244
- '%ArrayBuffer%': typeof ArrayBuffer === 'undefined' ? undefined$1 : ArrayBuffer,
245
- '%ArrayIteratorPrototype%': hasSymbols$1 ? getProto([][Symbol.iterator]()) : undefined$1,
246
- '%AsyncFromSyncIteratorPrototype%': undefined$1,
247
- '%AsyncFunction%': needsEval,
248
- '%AsyncGenerator%': needsEval,
249
- '%AsyncGeneratorFunction%': needsEval,
250
- '%AsyncIteratorPrototype%': needsEval,
251
- '%Atomics%': typeof Atomics === 'undefined' ? undefined$1 : Atomics,
252
- '%BigInt%': typeof BigInt === 'undefined' ? undefined$1 : BigInt,
253
- '%Boolean%': Boolean,
254
- '%DataView%': typeof DataView === 'undefined' ? undefined$1 : DataView,
255
- '%Date%': Date,
256
- '%decodeURI%': decodeURI,
257
- '%decodeURIComponent%': decodeURIComponent,
258
- '%encodeURI%': encodeURI,
259
- '%encodeURIComponent%': encodeURIComponent,
260
- '%Error%': Error,
261
- '%eval%': eval,
262
- // eslint-disable-line no-eval
263
- '%EvalError%': EvalError,
264
- '%Float32Array%': typeof Float32Array === 'undefined' ? undefined$1 : Float32Array,
265
- '%Float64Array%': typeof Float64Array === 'undefined' ? undefined$1 : Float64Array,
266
- '%FinalizationRegistry%': typeof FinalizationRegistry === 'undefined' ? undefined$1 : FinalizationRegistry,
267
- '%Function%': $Function,
268
- '%GeneratorFunction%': needsEval,
269
- '%Int8Array%': typeof Int8Array === 'undefined' ? undefined$1 : Int8Array,
270
- '%Int16Array%': typeof Int16Array === 'undefined' ? undefined$1 : Int16Array,
271
- '%Int32Array%': typeof Int32Array === 'undefined' ? undefined$1 : Int32Array,
272
- '%isFinite%': isFinite,
273
- '%isNaN%': isNaN,
274
- '%IteratorPrototype%': hasSymbols$1 ? getProto(getProto([][Symbol.iterator]())) : undefined$1,
275
- '%JSON%': typeof JSON === 'object' ? JSON : undefined$1,
276
- '%Map%': typeof Map === 'undefined' ? undefined$1 : Map,
277
- '%MapIteratorPrototype%': typeof Map === 'undefined' || !hasSymbols$1 ? undefined$1 : getProto(new Map()[Symbol.iterator]()),
278
- '%Math%': Math,
279
- '%Number%': Number,
280
- '%Object%': Object,
281
- '%parseFloat%': parseFloat,
282
- '%parseInt%': parseInt,
283
- '%Promise%': typeof Promise === 'undefined' ? undefined$1 : Promise,
284
- '%Proxy%': typeof Proxy === 'undefined' ? undefined$1 : Proxy,
285
- '%RangeError%': RangeError,
286
- '%ReferenceError%': ReferenceError,
287
- '%Reflect%': typeof Reflect === 'undefined' ? undefined$1 : Reflect,
288
- '%RegExp%': RegExp,
289
- '%Set%': typeof Set === 'undefined' ? undefined$1 : Set,
290
- '%SetIteratorPrototype%': typeof Set === 'undefined' || !hasSymbols$1 ? undefined$1 : getProto(new Set()[Symbol.iterator]()),
291
- '%SharedArrayBuffer%': typeof SharedArrayBuffer === 'undefined' ? undefined$1 : SharedArrayBuffer,
292
- '%String%': String,
293
- '%StringIteratorPrototype%': hasSymbols$1 ? getProto(''[Symbol.iterator]()) : undefined$1,
294
- '%Symbol%': hasSymbols$1 ? Symbol : undefined$1,
295
- '%SyntaxError%': $SyntaxError,
296
- '%ThrowTypeError%': ThrowTypeError,
297
- '%TypedArray%': TypedArray,
298
- '%TypeError%': $TypeError,
299
- '%Uint8Array%': typeof Uint8Array === 'undefined' ? undefined$1 : Uint8Array,
300
- '%Uint8ClampedArray%': typeof Uint8ClampedArray === 'undefined' ? undefined$1 : Uint8ClampedArray,
301
- '%Uint16Array%': typeof Uint16Array === 'undefined' ? undefined$1 : Uint16Array,
302
- '%Uint32Array%': typeof Uint32Array === 'undefined' ? undefined$1 : Uint32Array,
303
- '%URIError%': URIError,
304
- '%WeakMap%': typeof WeakMap === 'undefined' ? undefined$1 : WeakMap,
305
- '%WeakRef%': typeof WeakRef === 'undefined' ? undefined$1 : WeakRef,
306
- '%WeakSet%': typeof WeakSet === 'undefined' ? undefined$1 : WeakSet
307
- };
308
-
309
- var doEval = function doEval(name) {
310
- var value;
311
-
312
- if (name === '%AsyncFunction%') {
313
- value = getEvalledConstructor('async function () {}');
314
- } else if (name === '%GeneratorFunction%') {
315
- value = getEvalledConstructor('function* () {}');
316
- } else if (name === '%AsyncGeneratorFunction%') {
317
- value = getEvalledConstructor('async function* () {}');
318
- } else if (name === '%AsyncGenerator%') {
319
- var fn = doEval('%AsyncGeneratorFunction%');
320
-
321
- if (fn) {
322
- value = fn.prototype;
323
- }
324
- } else if (name === '%AsyncIteratorPrototype%') {
325
- var gen = doEval('%AsyncGenerator%');
326
-
327
- if (gen) {
328
- value = getProto(gen.prototype);
329
- }
330
- }
331
-
332
- INTRINSICS[name] = value;
333
- return value;
334
- };
335
-
336
- var LEGACY_ALIASES = {
337
- '%ArrayBufferPrototype%': ['ArrayBuffer', 'prototype'],
338
- '%ArrayPrototype%': ['Array', 'prototype'],
339
- '%ArrayProto_entries%': ['Array', 'prototype', 'entries'],
340
- '%ArrayProto_forEach%': ['Array', 'prototype', 'forEach'],
341
- '%ArrayProto_keys%': ['Array', 'prototype', 'keys'],
342
- '%ArrayProto_values%': ['Array', 'prototype', 'values'],
343
- '%AsyncFunctionPrototype%': ['AsyncFunction', 'prototype'],
344
- '%AsyncGenerator%': ['AsyncGeneratorFunction', 'prototype'],
345
- '%AsyncGeneratorPrototype%': ['AsyncGeneratorFunction', 'prototype', 'prototype'],
346
- '%BooleanPrototype%': ['Boolean', 'prototype'],
347
- '%DataViewPrototype%': ['DataView', 'prototype'],
348
- '%DatePrototype%': ['Date', 'prototype'],
349
- '%ErrorPrototype%': ['Error', 'prototype'],
350
- '%EvalErrorPrototype%': ['EvalError', 'prototype'],
351
- '%Float32ArrayPrototype%': ['Float32Array', 'prototype'],
352
- '%Float64ArrayPrototype%': ['Float64Array', 'prototype'],
353
- '%FunctionPrototype%': ['Function', 'prototype'],
354
- '%Generator%': ['GeneratorFunction', 'prototype'],
355
- '%GeneratorPrototype%': ['GeneratorFunction', 'prototype', 'prototype'],
356
- '%Int8ArrayPrototype%': ['Int8Array', 'prototype'],
357
- '%Int16ArrayPrototype%': ['Int16Array', 'prototype'],
358
- '%Int32ArrayPrototype%': ['Int32Array', 'prototype'],
359
- '%JSONParse%': ['JSON', 'parse'],
360
- '%JSONStringify%': ['JSON', 'stringify'],
361
- '%MapPrototype%': ['Map', 'prototype'],
362
- '%NumberPrototype%': ['Number', 'prototype'],
363
- '%ObjectPrototype%': ['Object', 'prototype'],
364
- '%ObjProto_toString%': ['Object', 'prototype', 'toString'],
365
- '%ObjProto_valueOf%': ['Object', 'prototype', 'valueOf'],
366
- '%PromisePrototype%': ['Promise', 'prototype'],
367
- '%PromiseProto_then%': ['Promise', 'prototype', 'then'],
368
- '%Promise_all%': ['Promise', 'all'],
369
- '%Promise_reject%': ['Promise', 'reject'],
370
- '%Promise_resolve%': ['Promise', 'resolve'],
371
- '%RangeErrorPrototype%': ['RangeError', 'prototype'],
372
- '%ReferenceErrorPrototype%': ['ReferenceError', 'prototype'],
373
- '%RegExpPrototype%': ['RegExp', 'prototype'],
374
- '%SetPrototype%': ['Set', 'prototype'],
375
- '%SharedArrayBufferPrototype%': ['SharedArrayBuffer', 'prototype'],
376
- '%StringPrototype%': ['String', 'prototype'],
377
- '%SymbolPrototype%': ['Symbol', 'prototype'],
378
- '%SyntaxErrorPrototype%': ['SyntaxError', 'prototype'],
379
- '%TypedArrayPrototype%': ['TypedArray', 'prototype'],
380
- '%TypeErrorPrototype%': ['TypeError', 'prototype'],
381
- '%Uint8ArrayPrototype%': ['Uint8Array', 'prototype'],
382
- '%Uint8ClampedArrayPrototype%': ['Uint8ClampedArray', 'prototype'],
383
- '%Uint16ArrayPrototype%': ['Uint16Array', 'prototype'],
384
- '%Uint32ArrayPrototype%': ['Uint32Array', 'prototype'],
385
- '%URIErrorPrototype%': ['URIError', 'prototype'],
386
- '%WeakMapPrototype%': ['WeakMap', 'prototype'],
387
- '%WeakSetPrototype%': ['WeakSet', 'prototype']
388
- };
389
- var $concat = functionBind.call(Function.call, Array.prototype.concat);
390
- var $spliceApply = functionBind.call(Function.apply, Array.prototype.splice);
391
- var $replace = functionBind.call(Function.call, String.prototype.replace);
392
- var $strSlice = functionBind.call(Function.call, String.prototype.slice);
393
- /* adapted from https://github.com/lodash/lodash/blob/4.17.15/dist/lodash.js#L6735-L6744 */
394
-
395
- var rePropName = /[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g;
396
- var reEscapeChar = /\\(\\)?/g;
397
- /** Used to match backslashes in property paths. */
398
-
399
- var stringToPath = function stringToPath(string) {
400
- var first = $strSlice(string, 0, 1);
401
- var last = $strSlice(string, -1);
402
-
403
- if (first === '%' && last !== '%') {
404
- throw new $SyntaxError('invalid intrinsic syntax, expected closing `%`');
405
- } else if (last === '%' && first !== '%') {
406
- throw new $SyntaxError('invalid intrinsic syntax, expected opening `%`');
407
- }
408
-
409
- var result = [];
410
- $replace(string, rePropName, function (match, number, quote, subString) {
411
- result[result.length] = quote ? $replace(subString, reEscapeChar, '$1') : number || match;
412
- });
413
- return result;
414
- };
415
- /* end adaptation */
416
-
417
-
418
- var getBaseIntrinsic = function getBaseIntrinsic(name, allowMissing) {
419
- var intrinsicName = name;
420
- var alias;
421
-
422
- if (src(LEGACY_ALIASES, intrinsicName)) {
423
- alias = LEGACY_ALIASES[intrinsicName];
424
- intrinsicName = '%' + alias[0] + '%';
425
- }
426
-
427
- if (src(INTRINSICS, intrinsicName)) {
428
- var value = INTRINSICS[intrinsicName];
429
-
430
- if (value === needsEval) {
431
- value = doEval(intrinsicName);
432
- }
433
-
434
- if (typeof value === 'undefined' && !allowMissing) {
435
- throw new $TypeError('intrinsic ' + name + ' exists, but is not available. Please file an issue!');
436
- }
437
-
438
- return {
439
- alias: alias,
440
- name: intrinsicName,
441
- value: value
442
- };
443
- }
444
-
445
- throw new $SyntaxError('intrinsic ' + name + ' does not exist!');
446
- };
447
-
448
- var getIntrinsic = function GetIntrinsic(name, allowMissing) {
449
- if (typeof name !== 'string' || name.length === 0) {
450
- throw new $TypeError('intrinsic name must be a non-empty string');
451
- }
452
-
453
- if (arguments.length > 1 && typeof allowMissing !== 'boolean') {
454
- throw new $TypeError('"allowMissing" argument must be a boolean');
455
- }
456
-
457
- var parts = stringToPath(name);
458
- var intrinsicBaseName = parts.length > 0 ? parts[0] : '';
459
- var intrinsic = getBaseIntrinsic('%' + intrinsicBaseName + '%', allowMissing);
460
- var intrinsicRealName = intrinsic.name;
461
- var value = intrinsic.value;
462
- var skipFurtherCaching = false;
463
- var alias = intrinsic.alias;
464
-
465
- if (alias) {
466
- intrinsicBaseName = alias[0];
467
- $spliceApply(parts, $concat([0, 1], alias));
468
- }
469
-
470
- for (var i = 1, isOwn = true; i < parts.length; i += 1) {
471
- var part = parts[i];
472
- var first = $strSlice(part, 0, 1);
473
- var last = $strSlice(part, -1);
474
-
475
- if ((first === '"' || first === "'" || first === '`' || last === '"' || last === "'" || last === '`') && first !== last) {
476
- throw new $SyntaxError('property names with quotes must have matching quotes');
477
- }
478
-
479
- if (part === 'constructor' || !isOwn) {
480
- skipFurtherCaching = true;
481
- }
482
-
483
- intrinsicBaseName += '.' + part;
484
- intrinsicRealName = '%' + intrinsicBaseName + '%';
485
-
486
- if (src(INTRINSICS, intrinsicRealName)) {
487
- value = INTRINSICS[intrinsicRealName];
488
- } else if (value != null) {
489
- if (!(part in value)) {
490
- if (!allowMissing) {
491
- throw new $TypeError('base intrinsic for ' + name + ' exists, but the property is not available.');
492
- }
493
-
494
- return void undefined$1;
495
- }
496
-
497
- if ($gOPD && i + 1 >= parts.length) {
498
- var desc = $gOPD(value, part);
499
- isOwn = !!desc; // By convention, when a data property is converted to an accessor
500
- // property to emulate a data property that does not suffer from
501
- // the override mistake, that accessor's getter is marked with
502
- // an `originalValue` property. Here, when we detect this, we
503
- // uphold the illusion by pretending to see that original data
504
- // property, i.e., returning the value rather than the getter
505
- // itself.
506
-
507
- if (isOwn && 'get' in desc && !('originalValue' in desc.get)) {
508
- value = desc.get;
509
- } else {
510
- value = value[part];
511
- }
512
- } else {
513
- isOwn = src(value, part);
514
- value = value[part];
515
- }
516
-
517
- if (isOwn && !skipFurtherCaching) {
518
- INTRINSICS[intrinsicRealName] = value;
519
- }
520
- }
521
- }
522
-
523
- return value;
524
- };
525
-
526
- function unwrapExports (x) {
527
- return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
528
- }
529
-
530
- function createCommonjsModule(fn, module) {
531
- return module = { exports: {} }, fn(module, module.exports), module.exports;
532
- }
533
-
534
- var callBind = createCommonjsModule(function (module) {
535
-
536
- var $apply = getIntrinsic('%Function.prototype.apply%');
537
- var $call = getIntrinsic('%Function.prototype.call%');
538
- var $reflectApply = getIntrinsic('%Reflect.apply%', true) || functionBind.call($call, $apply);
539
- var $gOPD = getIntrinsic('%Object.getOwnPropertyDescriptor%', true);
540
- var $defineProperty = getIntrinsic('%Object.defineProperty%', true);
541
- var $max = getIntrinsic('%Math.max%');
542
-
543
- if ($defineProperty) {
544
- try {
545
- $defineProperty({}, 'a', {
546
- value: 1
547
- });
548
- } catch (e) {
549
- // IE 8 has a broken defineProperty
550
- $defineProperty = null;
551
- }
552
- }
553
-
554
- module.exports = function callBind(originalFunction) {
555
- var func = $reflectApply(functionBind, $call, arguments);
556
-
557
- if ($gOPD && $defineProperty) {
558
- var desc = $gOPD(func, 'length');
559
-
560
- if (desc.configurable) {
561
- // original length, plus the receiver, minus any additional arguments (after the receiver)
562
- $defineProperty(func, 'length', {
563
- value: 1 + $max(0, originalFunction.length - (arguments.length - 1))
564
- });
565
- }
566
- }
567
-
568
- return func;
569
- };
570
-
571
- var applyBind = function applyBind() {
572
- return $reflectApply(functionBind, $apply, arguments);
573
- };
574
-
575
- if ($defineProperty) {
576
- $defineProperty(module.exports, 'apply', {
577
- value: applyBind
578
- });
579
- } else {
580
- module.exports.apply = applyBind;
581
- }
582
- });
583
- var callBind_1 = callBind.apply;
584
-
585
- var $indexOf = callBind(getIntrinsic('String.prototype.indexOf'));
586
-
587
- var callBound = function callBoundIntrinsic(name, allowMissing) {
588
- var intrinsic = getIntrinsic(name, !!allowMissing);
589
-
590
- if (typeof intrinsic === 'function' && $indexOf(name, '.prototype.') > -1) {
591
- return callBind(intrinsic);
592
- }
593
-
594
- return intrinsic;
595
- };
596
-
597
- var util_inspect = util.inspect;
598
-
599
- var hasMap = typeof Map === 'function' && Map.prototype;
600
- var mapSizeDescriptor = Object.getOwnPropertyDescriptor && hasMap ? Object.getOwnPropertyDescriptor(Map.prototype, 'size') : null;
601
- var mapSize = hasMap && mapSizeDescriptor && typeof mapSizeDescriptor.get === 'function' ? mapSizeDescriptor.get : null;
602
- var mapForEach = hasMap && Map.prototype.forEach;
603
- var hasSet = typeof Set === 'function' && Set.prototype;
604
- var setSizeDescriptor = Object.getOwnPropertyDescriptor && hasSet ? Object.getOwnPropertyDescriptor(Set.prototype, 'size') : null;
605
- var setSize = hasSet && setSizeDescriptor && typeof setSizeDescriptor.get === 'function' ? setSizeDescriptor.get : null;
606
- var setForEach = hasSet && Set.prototype.forEach;
607
- var hasWeakMap = typeof WeakMap === 'function' && WeakMap.prototype;
608
- var weakMapHas = hasWeakMap ? WeakMap.prototype.has : null;
609
- var hasWeakSet = typeof WeakSet === 'function' && WeakSet.prototype;
610
- var weakSetHas = hasWeakSet ? WeakSet.prototype.has : null;
611
- var hasWeakRef = typeof WeakRef === 'function' && WeakRef.prototype;
612
- var weakRefDeref = hasWeakRef ? WeakRef.prototype.deref : null;
613
- var booleanValueOf = Boolean.prototype.valueOf;
614
- var objectToString = Object.prototype.toString;
615
- var functionToString = Function.prototype.toString;
616
- var match = String.prototype.match;
617
- var bigIntValueOf = typeof BigInt === 'function' ? BigInt.prototype.valueOf : null;
618
- var gOPS = Object.getOwnPropertySymbols;
619
- var symToString = typeof Symbol === 'function' && typeof Symbol.iterator === 'symbol' ? Symbol.prototype.toString : null;
620
- var hasShammedSymbols = typeof Symbol === 'function' && typeof Symbol.iterator === 'object';
621
- var isEnumerable = Object.prototype.propertyIsEnumerable;
622
- var gPO = (typeof Reflect === 'function' ? Reflect.getPrototypeOf : Object.getPrototypeOf) || ([].__proto__ === Array.prototype // eslint-disable-line no-proto
623
- ? function (O) {
624
- return O.__proto__; // eslint-disable-line no-proto
625
- } : null);
626
- var inspectCustom = util_inspect.custom;
627
- var inspectSymbol = inspectCustom && isSymbol(inspectCustom) ? inspectCustom : null;
628
- var toStringTag = typeof Symbol === 'function' && typeof Symbol.toStringTag !== 'undefined' ? Symbol.toStringTag : null;
629
-
630
- var objectInspect = function inspect_(obj, options, depth, seen) {
631
- var opts = options || {};
632
-
633
- if (has(opts, 'quoteStyle') && opts.quoteStyle !== 'single' && opts.quoteStyle !== 'double') {
634
- throw new TypeError('option "quoteStyle" must be "single" or "double"');
635
- }
636
-
637
- if (has(opts, 'maxStringLength') && (typeof opts.maxStringLength === 'number' ? opts.maxStringLength < 0 && opts.maxStringLength !== Infinity : opts.maxStringLength !== null)) {
638
- throw new TypeError('option "maxStringLength", if provided, must be a positive integer, Infinity, or `null`');
639
- }
640
-
641
- var customInspect = has(opts, 'customInspect') ? opts.customInspect : true;
642
-
643
- if (typeof customInspect !== 'boolean' && customInspect !== 'symbol') {
644
- throw new TypeError('option "customInspect", if provided, must be `true`, `false`, or `\'symbol\'`');
645
- }
646
-
647
- if (has(opts, 'indent') && opts.indent !== null && opts.indent !== '\t' && !(parseInt(opts.indent, 10) === opts.indent && opts.indent > 0)) {
648
- throw new TypeError('options "indent" must be "\\t", an integer > 0, or `null`');
649
- }
650
-
651
- if (typeof obj === 'undefined') {
652
- return 'undefined';
653
- }
654
-
655
- if (obj === null) {
656
- return 'null';
657
- }
658
-
659
- if (typeof obj === 'boolean') {
660
- return obj ? 'true' : 'false';
661
- }
662
-
663
- if (typeof obj === 'string') {
664
- return inspectString(obj, opts);
665
- }
666
-
667
- if (typeof obj === 'number') {
668
- if (obj === 0) {
669
- return Infinity / obj > 0 ? '0' : '-0';
670
- }
671
-
672
- return String(obj);
673
- }
674
-
675
- if (typeof obj === 'bigint') {
676
- return String(obj) + 'n';
677
- }
678
-
679
- var maxDepth = typeof opts.depth === 'undefined' ? 5 : opts.depth;
680
-
681
- if (typeof depth === 'undefined') {
682
- depth = 0;
683
- }
684
-
685
- if (depth >= maxDepth && maxDepth > 0 && typeof obj === 'object') {
686
- return isArray(obj) ? '[Array]' : '[Object]';
687
- }
688
-
689
- var indent = getIndent(opts, depth);
690
-
691
- if (typeof seen === 'undefined') {
692
- seen = [];
693
- } else if (indexOf(seen, obj) >= 0) {
694
- return '[Circular]';
695
- }
696
-
697
- function inspect(value, from, noIndent) {
698
- if (from) {
699
- seen = seen.slice();
700
- seen.push(from);
701
- }
702
-
703
- if (noIndent) {
704
- var newOpts = {
705
- depth: opts.depth
706
- };
707
-
708
- if (has(opts, 'quoteStyle')) {
709
- newOpts.quoteStyle = opts.quoteStyle;
710
- }
711
-
712
- return inspect_(value, newOpts, depth + 1, seen);
713
- }
714
-
715
- return inspect_(value, opts, depth + 1, seen);
716
- }
717
-
718
- if (typeof obj === 'function') {
719
- var name = nameOf(obj);
720
- var keys = arrObjKeys(obj, inspect);
721
- return '[Function' + (name ? ': ' + name : ' (anonymous)') + ']' + (keys.length > 0 ? ' { ' + keys.join(', ') + ' }' : '');
722
- }
723
-
724
- if (isSymbol(obj)) {
725
- var symString = hasShammedSymbols ? String(obj).replace(/^(Symbol\(.*\))_[^)]*$/, '$1') : symToString.call(obj);
726
- return typeof obj === 'object' && !hasShammedSymbols ? markBoxed(symString) : symString;
727
- }
728
-
729
- if (isElement(obj)) {
730
- var s = '<' + String(obj.nodeName).toLowerCase();
731
- var attrs = obj.attributes || [];
732
-
733
- for (var i = 0; i < attrs.length; i++) {
734
- s += ' ' + attrs[i].name + '=' + wrapQuotes(quote(attrs[i].value), 'double', opts);
735
- }
736
-
737
- s += '>';
738
-
739
- if (obj.childNodes && obj.childNodes.length) {
740
- s += '...';
741
- }
742
-
743
- s += '</' + String(obj.nodeName).toLowerCase() + '>';
744
- return s;
745
- }
746
-
747
- if (isArray(obj)) {
748
- if (obj.length === 0) {
749
- return '[]';
750
- }
751
-
752
- var xs = arrObjKeys(obj, inspect);
753
-
754
- if (indent && !singleLineValues(xs)) {
755
- return '[' + indentedJoin(xs, indent) + ']';
756
- }
757
-
758
- return '[ ' + xs.join(', ') + ' ]';
759
- }
760
-
761
- if (isError(obj)) {
762
- var parts = arrObjKeys(obj, inspect);
763
-
764
- if (parts.length === 0) {
765
- return '[' + String(obj) + ']';
766
- }
767
-
768
- return '{ [' + String(obj) + '] ' + parts.join(', ') + ' }';
769
- }
770
-
771
- if (typeof obj === 'object' && customInspect) {
772
- if (inspectSymbol && typeof obj[inspectSymbol] === 'function') {
773
- return obj[inspectSymbol]();
774
- } else if (customInspect !== 'symbol' && typeof obj.inspect === 'function') {
775
- return obj.inspect();
776
- }
777
- }
778
-
779
- if (isMap(obj)) {
780
- var mapParts = [];
781
- mapForEach.call(obj, function (value, key) {
782
- mapParts.push(inspect(key, obj, true) + ' => ' + inspect(value, obj));
783
- });
784
- return collectionOf('Map', mapSize.call(obj), mapParts, indent);
785
- }
786
-
787
- if (isSet(obj)) {
788
- var setParts = [];
789
- setForEach.call(obj, function (value) {
790
- setParts.push(inspect(value, obj));
791
- });
792
- return collectionOf('Set', setSize.call(obj), setParts, indent);
793
- }
794
-
795
- if (isWeakMap(obj)) {
796
- return weakCollectionOf('WeakMap');
797
- }
798
-
799
- if (isWeakSet(obj)) {
800
- return weakCollectionOf('WeakSet');
801
- }
802
-
803
- if (isWeakRef(obj)) {
804
- return weakCollectionOf('WeakRef');
805
- }
806
-
807
- if (isNumber(obj)) {
808
- return markBoxed(inspect(Number(obj)));
809
- }
810
-
811
- if (isBigInt(obj)) {
812
- return markBoxed(inspect(bigIntValueOf.call(obj)));
813
- }
814
-
815
- if (isBoolean(obj)) {
816
- return markBoxed(booleanValueOf.call(obj));
817
- }
818
-
819
- if (isString(obj)) {
820
- return markBoxed(inspect(String(obj)));
821
- }
822
-
823
- if (!isDate(obj) && !isRegExp(obj)) {
824
- var ys = arrObjKeys(obj, inspect);
825
- var isPlainObject = gPO ? gPO(obj) === Object.prototype : obj instanceof Object || obj.constructor === Object;
826
- var protoTag = obj instanceof Object ? '' : 'null prototype';
827
- var stringTag = !isPlainObject && toStringTag && Object(obj) === obj && toStringTag in obj ? toStr$1(obj).slice(8, -1) : protoTag ? 'Object' : '';
828
- var constructorTag = isPlainObject || typeof obj.constructor !== 'function' ? '' : obj.constructor.name ? obj.constructor.name + ' ' : '';
829
- var tag = constructorTag + (stringTag || protoTag ? '[' + [].concat(stringTag || [], protoTag || []).join(': ') + '] ' : '');
830
-
831
- if (ys.length === 0) {
832
- return tag + '{}';
833
- }
834
-
835
- if (indent) {
836
- return tag + '{' + indentedJoin(ys, indent) + '}';
837
- }
838
-
839
- return tag + '{ ' + ys.join(', ') + ' }';
840
- }
841
-
842
- return String(obj);
843
- };
844
-
845
- function wrapQuotes(s, defaultStyle, opts) {
846
- var quoteChar = (opts.quoteStyle || defaultStyle) === 'double' ? '"' : "'";
847
- return quoteChar + s + quoteChar;
848
- }
849
-
850
- function quote(s) {
851
- return String(s).replace(/"/g, '&quot;');
852
- }
853
-
854
- function isArray(obj) {
855
- return toStr$1(obj) === '[object Array]' && (!toStringTag || !(typeof obj === 'object' && toStringTag in obj));
856
- }
857
-
858
- function isDate(obj) {
859
- return toStr$1(obj) === '[object Date]' && (!toStringTag || !(typeof obj === 'object' && toStringTag in obj));
860
- }
861
-
862
- function isRegExp(obj) {
863
- return toStr$1(obj) === '[object RegExp]' && (!toStringTag || !(typeof obj === 'object' && toStringTag in obj));
864
- }
865
-
866
- function isError(obj) {
867
- return toStr$1(obj) === '[object Error]' && (!toStringTag || !(typeof obj === 'object' && toStringTag in obj));
868
- }
869
-
870
- function isString(obj) {
871
- return toStr$1(obj) === '[object String]' && (!toStringTag || !(typeof obj === 'object' && toStringTag in obj));
872
- }
873
-
874
- function isNumber(obj) {
875
- return toStr$1(obj) === '[object Number]' && (!toStringTag || !(typeof obj === 'object' && toStringTag in obj));
876
- }
877
-
878
- function isBoolean(obj) {
879
- return toStr$1(obj) === '[object Boolean]' && (!toStringTag || !(typeof obj === 'object' && toStringTag in obj));
880
- } // Symbol and BigInt do have Symbol.toStringTag by spec, so that can't be used to eliminate false positives
881
-
882
-
883
- function isSymbol(obj) {
884
- if (hasShammedSymbols) {
885
- return obj && typeof obj === 'object' && obj instanceof Symbol;
886
- }
887
-
888
- if (typeof obj === 'symbol') {
889
- return true;
890
- }
891
-
892
- if (!obj || typeof obj !== 'object' || !symToString) {
893
- return false;
894
- }
895
-
896
- try {
897
- symToString.call(obj);
898
- return true;
899
- } catch (e) {}
900
-
901
- return false;
902
- }
903
-
904
- function isBigInt(obj) {
905
- if (!obj || typeof obj !== 'object' || !bigIntValueOf) {
906
- return false;
907
- }
908
-
909
- try {
910
- bigIntValueOf.call(obj);
911
- return true;
912
- } catch (e) {}
913
-
914
- return false;
915
- }
916
-
917
- var hasOwn = Object.prototype.hasOwnProperty || function (key) {
918
- return key in this;
919
- };
920
-
921
- function has(obj, key) {
922
- return hasOwn.call(obj, key);
923
- }
924
-
925
- function toStr$1(obj) {
926
- return objectToString.call(obj);
927
- }
928
-
929
- function nameOf(f) {
930
- if (f.name) {
931
- return f.name;
932
- }
933
-
934
- var m = match.call(functionToString.call(f), /^function\s*([\w$]+)/);
935
-
936
- if (m) {
937
- return m[1];
938
- }
939
-
940
- return null;
941
- }
942
-
943
- function indexOf(xs, x) {
944
- if (xs.indexOf) {
945
- return xs.indexOf(x);
946
- }
947
-
948
- for (var i = 0, l = xs.length; i < l; i++) {
949
- if (xs[i] === x) {
950
- return i;
951
- }
952
- }
953
-
954
- return -1;
955
- }
956
-
957
- function isMap(x) {
958
- if (!mapSize || !x || typeof x !== 'object') {
959
- return false;
960
- }
961
-
962
- try {
963
- mapSize.call(x);
964
-
965
- try {
966
- setSize.call(x);
967
- } catch (s) {
968
- return true;
969
- }
970
-
971
- return x instanceof Map; // core-js workaround, pre-v2.5.0
972
- } catch (e) {}
973
-
974
- return false;
975
- }
976
-
977
- function isWeakMap(x) {
978
- if (!weakMapHas || !x || typeof x !== 'object') {
979
- return false;
980
- }
981
-
982
- try {
983
- weakMapHas.call(x, weakMapHas);
984
-
985
- try {
986
- weakSetHas.call(x, weakSetHas);
987
- } catch (s) {
988
- return true;
989
- }
990
-
991
- return x instanceof WeakMap; // core-js workaround, pre-v2.5.0
992
- } catch (e) {}
993
-
994
- return false;
995
- }
996
-
997
- function isWeakRef(x) {
998
- if (!weakRefDeref || !x || typeof x !== 'object') {
999
- return false;
1000
- }
1001
-
1002
- try {
1003
- weakRefDeref.call(x);
1004
- return true;
1005
- } catch (e) {}
1006
-
1007
- return false;
1008
- }
1009
-
1010
- function isSet(x) {
1011
- if (!setSize || !x || typeof x !== 'object') {
1012
- return false;
1013
- }
1014
-
1015
- try {
1016
- setSize.call(x);
1017
-
1018
- try {
1019
- mapSize.call(x);
1020
- } catch (m) {
1021
- return true;
1022
- }
1023
-
1024
- return x instanceof Set; // core-js workaround, pre-v2.5.0
1025
- } catch (e) {}
1026
-
1027
- return false;
1028
- }
1029
-
1030
- function isWeakSet(x) {
1031
- if (!weakSetHas || !x || typeof x !== 'object') {
1032
- return false;
1033
- }
1034
-
1035
- try {
1036
- weakSetHas.call(x, weakSetHas);
1037
-
1038
- try {
1039
- weakMapHas.call(x, weakMapHas);
1040
- } catch (s) {
1041
- return true;
1042
- }
1043
-
1044
- return x instanceof WeakSet; // core-js workaround, pre-v2.5.0
1045
- } catch (e) {}
1046
-
1047
- return false;
1048
- }
1049
-
1050
- function isElement(x) {
1051
- if (!x || typeof x !== 'object') {
1052
- return false;
1053
- }
1054
-
1055
- if (typeof HTMLElement !== 'undefined' && x instanceof HTMLElement) {
1056
- return true;
1057
- }
1058
-
1059
- return typeof x.nodeName === 'string' && typeof x.getAttribute === 'function';
1060
- }
1061
-
1062
- function inspectString(str, opts) {
1063
- if (str.length > opts.maxStringLength) {
1064
- var remaining = str.length - opts.maxStringLength;
1065
- var trailer = '... ' + remaining + ' more character' + (remaining > 1 ? 's' : '');
1066
- return inspectString(str.slice(0, opts.maxStringLength), opts) + trailer;
1067
- } // eslint-disable-next-line no-control-regex
1068
-
1069
-
1070
- var s = str.replace(/(['\\])/g, '\\$1').replace(/[\x00-\x1f]/g, lowbyte);
1071
- return wrapQuotes(s, 'single', opts);
1072
- }
1073
-
1074
- function lowbyte(c) {
1075
- var n = c.charCodeAt(0);
1076
- var x = {
1077
- 8: 'b',
1078
- 9: 't',
1079
- 10: 'n',
1080
- 12: 'f',
1081
- 13: 'r'
1082
- }[n];
1083
-
1084
- if (x) {
1085
- return '\\' + x;
1086
- }
1087
-
1088
- return '\\x' + (n < 0x10 ? '0' : '') + n.toString(16).toUpperCase();
1089
- }
1090
-
1091
- function markBoxed(str) {
1092
- return 'Object(' + str + ')';
1093
- }
1094
-
1095
- function weakCollectionOf(type) {
1096
- return type + ' { ? }';
1097
- }
1098
-
1099
- function collectionOf(type, size, entries, indent) {
1100
- var joinedEntries = indent ? indentedJoin(entries, indent) : entries.join(', ');
1101
- return type + ' (' + size + ') {' + joinedEntries + '}';
1102
- }
1103
-
1104
- function singleLineValues(xs) {
1105
- for (var i = 0; i < xs.length; i++) {
1106
- if (indexOf(xs[i], '\n') >= 0) {
1107
- return false;
1108
- }
1109
- }
1110
-
1111
- return true;
1112
- }
1113
-
1114
- function getIndent(opts, depth) {
1115
- var baseIndent;
1116
-
1117
- if (opts.indent === '\t') {
1118
- baseIndent = '\t';
1119
- } else if (typeof opts.indent === 'number' && opts.indent > 0) {
1120
- baseIndent = Array(opts.indent + 1).join(' ');
1121
- } else {
1122
- return null;
1123
- }
1124
-
1125
- return {
1126
- base: baseIndent,
1127
- prev: Array(depth + 1).join(baseIndent)
1128
- };
1129
- }
1130
-
1131
- function indentedJoin(xs, indent) {
1132
- if (xs.length === 0) {
1133
- return '';
1134
- }
1135
-
1136
- var lineJoiner = '\n' + indent.prev + indent.base;
1137
- return lineJoiner + xs.join(',' + lineJoiner) + '\n' + indent.prev;
1138
- }
1139
-
1140
- function arrObjKeys(obj, inspect) {
1141
- var isArr = isArray(obj);
1142
- var xs = [];
1143
-
1144
- if (isArr) {
1145
- xs.length = obj.length;
1146
-
1147
- for (var i = 0; i < obj.length; i++) {
1148
- xs[i] = has(obj, i) ? inspect(obj[i], obj) : '';
1149
- }
1150
- }
1151
-
1152
- var syms = typeof gOPS === 'function' ? gOPS(obj) : [];
1153
- var symMap;
1154
-
1155
- if (hasShammedSymbols) {
1156
- symMap = {};
1157
-
1158
- for (var k = 0; k < syms.length; k++) {
1159
- symMap['$' + syms[k]] = syms[k];
1160
- }
1161
- }
1162
-
1163
- for (var key in obj) {
1164
- // eslint-disable-line no-restricted-syntax
1165
- if (!has(obj, key)) {
1166
- continue;
1167
- } // eslint-disable-line no-restricted-syntax, no-continue
1168
-
1169
-
1170
- if (isArr && String(Number(key)) === key && key < obj.length) {
1171
- continue;
1172
- } // eslint-disable-line no-restricted-syntax, no-continue
1173
-
1174
-
1175
- if (hasShammedSymbols && symMap['$' + key] instanceof Symbol) {
1176
- // this is to prevent shammed Symbols, which are stored as strings, from being included in the string key section
1177
- continue; // eslint-disable-line no-restricted-syntax, no-continue
1178
- } else if (/[^\w$]/.test(key)) {
1179
- xs.push(inspect(key, obj) + ': ' + inspect(obj[key], obj));
1180
- } else {
1181
- xs.push(key + ': ' + inspect(obj[key], obj));
1182
- }
1183
- }
1184
-
1185
- if (typeof gOPS === 'function') {
1186
- for (var j = 0; j < syms.length; j++) {
1187
- if (isEnumerable.call(obj, syms[j])) {
1188
- xs.push('[' + inspect(syms[j]) + ']: ' + inspect(obj[syms[j]], obj));
1189
- }
1190
- }
1191
- }
1192
-
1193
- return xs;
1194
- }
1195
-
1196
- var $TypeError$1 = getIntrinsic('%TypeError%');
1197
- var $WeakMap = getIntrinsic('%WeakMap%', true);
1198
- var $Map = getIntrinsic('%Map%', true);
1199
- var $weakMapGet = callBound('WeakMap.prototype.get', true);
1200
- var $weakMapSet = callBound('WeakMap.prototype.set', true);
1201
- var $weakMapHas = callBound('WeakMap.prototype.has', true);
1202
- var $mapGet = callBound('Map.prototype.get', true);
1203
- var $mapSet = callBound('Map.prototype.set', true);
1204
- var $mapHas = callBound('Map.prototype.has', true);
1205
- /*
1206
- * This function traverses the list returning the node corresponding to the
1207
- * given key.
1208
- *
1209
- * That node is also moved to the head of the list, so that if it's accessed
1210
- * again we don't need to traverse the whole list. By doing so, all the recently
1211
- * used nodes can be accessed relatively quickly.
1212
- */
1213
-
1214
- var listGetNode = function (list, key) {
1215
- // eslint-disable-line consistent-return
1216
- for (var prev = list, curr; (curr = prev.next) !== null; prev = curr) {
1217
- if (curr.key === key) {
1218
- prev.next = curr.next;
1219
- curr.next = list.next;
1220
- list.next = curr; // eslint-disable-line no-param-reassign
1221
-
1222
- return curr;
1223
- }
1224
- }
1225
- };
1226
-
1227
- var listGet = function (objects, key) {
1228
- var node = listGetNode(objects, key);
1229
- return node && node.value;
1230
- };
1231
-
1232
- var listSet = function (objects, key, value) {
1233
- var node = listGetNode(objects, key);
1234
-
1235
- if (node) {
1236
- node.value = value;
1237
- } else {
1238
- // Prepend the new node to the beginning of the list
1239
- objects.next = {
1240
- // eslint-disable-line no-param-reassign
1241
- key: key,
1242
- next: objects.next,
1243
- value: value
1244
- };
1245
- }
1246
- };
1247
-
1248
- var listHas = function (objects, key) {
1249
- return !!listGetNode(objects, key);
1250
- };
1251
-
1252
- var sideChannel = function getSideChannel() {
1253
- var $wm;
1254
- var $m;
1255
- var $o;
1256
- var channel = {
1257
- assert: function (key) {
1258
- if (!channel.has(key)) {
1259
- throw new $TypeError$1('Side channel does not contain ' + objectInspect(key));
1260
- }
1261
- },
1262
- get: function (key) {
1263
- // eslint-disable-line consistent-return
1264
- if ($WeakMap && key && (typeof key === 'object' || typeof key === 'function')) {
1265
- if ($wm) {
1266
- return $weakMapGet($wm, key);
1267
- }
1268
- } else if ($Map) {
1269
- if ($m) {
1270
- return $mapGet($m, key);
1271
- }
1272
- } else {
1273
- if ($o) {
1274
- // eslint-disable-line no-lonely-if
1275
- return listGet($o, key);
1276
- }
1277
- }
1278
- },
1279
- has: function (key) {
1280
- if ($WeakMap && key && (typeof key === 'object' || typeof key === 'function')) {
1281
- if ($wm) {
1282
- return $weakMapHas($wm, key);
1283
- }
1284
- } else if ($Map) {
1285
- if ($m) {
1286
- return $mapHas($m, key);
1287
- }
1288
- } else {
1289
- if ($o) {
1290
- // eslint-disable-line no-lonely-if
1291
- return listHas($o, key);
1292
- }
1293
- }
1294
-
1295
- return false;
1296
- },
1297
- set: function (key, value) {
1298
- if ($WeakMap && key && (typeof key === 'object' || typeof key === 'function')) {
1299
- if (!$wm) {
1300
- $wm = new $WeakMap();
1301
- }
1302
-
1303
- $weakMapSet($wm, key, value);
1304
- } else if ($Map) {
1305
- if (!$m) {
1306
- $m = new $Map();
1307
- }
1308
-
1309
- $mapSet($m, key, value);
1310
- } else {
1311
- if (!$o) {
1312
- /*
1313
- * Initialize the linked list as an empty node, so that we don't have
1314
- * to special-case handling of the first node: we can always refer to
1315
- * it as (previous node).next, instead of something like (list).head
1316
- */
1317
- $o = {
1318
- key: {},
1319
- next: null
1320
- };
1321
- }
1322
-
1323
- listSet($o, key, value);
1324
- }
1325
- }
1326
- };
1327
- return channel;
1328
- };
1329
-
1330
- var replace = String.prototype.replace;
1331
- var percentTwenties = /%20/g;
1332
- var Format = {
1333
- RFC1738: 'RFC1738',
1334
- RFC3986: 'RFC3986'
1335
- };
1336
- var formats = {
1337
- 'default': Format.RFC3986,
1338
- formatters: {
1339
- RFC1738: function (value) {
1340
- return replace.call(value, percentTwenties, '+');
1341
- },
1342
- RFC3986: function (value) {
1343
- return String(value);
1344
- }
1345
- },
1346
- RFC1738: Format.RFC1738,
1347
- RFC3986: Format.RFC3986
1348
- };
1349
-
1350
- var has$1 = Object.prototype.hasOwnProperty;
1351
- var isArray$1 = Array.isArray;
1352
-
1353
- var hexTable = function () {
1354
- var array = [];
1355
-
1356
- for (var i = 0; i < 256; ++i) {
1357
- array.push('%' + ((i < 16 ? '0' : '') + i.toString(16)).toUpperCase());
1358
- }
1359
-
1360
- return array;
1361
- }();
1362
-
1363
- var compactQueue = function compactQueue(queue) {
1364
- while (queue.length > 1) {
1365
- var item = queue.pop();
1366
- var obj = item.obj[item.prop];
1367
-
1368
- if (isArray$1(obj)) {
1369
- var compacted = [];
1370
-
1371
- for (var j = 0; j < obj.length; ++j) {
1372
- if (typeof obj[j] !== 'undefined') {
1373
- compacted.push(obj[j]);
1374
- }
1375
- }
1376
-
1377
- item.obj[item.prop] = compacted;
1378
- }
1379
- }
1380
- };
1381
-
1382
- var arrayToObject = function arrayToObject(source, options) {
1383
- var obj = options && options.plainObjects ? Object.create(null) : {};
1384
-
1385
- for (var i = 0; i < source.length; ++i) {
1386
- if (typeof source[i] !== 'undefined') {
1387
- obj[i] = source[i];
1388
- }
1389
- }
1390
-
1391
- return obj;
1392
- };
1393
-
1394
- var merge = function merge(target, source, options) {
1395
- /* eslint no-param-reassign: 0 */
1396
- if (!source) {
1397
- return target;
1398
- }
1399
-
1400
- if (typeof source !== 'object') {
1401
- if (isArray$1(target)) {
1402
- target.push(source);
1403
- } else if (target && typeof target === 'object') {
1404
- if (options && (options.plainObjects || options.allowPrototypes) || !has$1.call(Object.prototype, source)) {
1405
- target[source] = true;
1406
- }
1407
- } else {
1408
- return [target, source];
1409
- }
1410
-
1411
- return target;
1412
- }
1413
-
1414
- if (!target || typeof target !== 'object') {
1415
- return [target].concat(source);
1416
- }
1417
-
1418
- var mergeTarget = target;
1419
-
1420
- if (isArray$1(target) && !isArray$1(source)) {
1421
- mergeTarget = arrayToObject(target, options);
1422
- }
1423
-
1424
- if (isArray$1(target) && isArray$1(source)) {
1425
- source.forEach(function (item, i) {
1426
- if (has$1.call(target, i)) {
1427
- var targetItem = target[i];
1428
-
1429
- if (targetItem && typeof targetItem === 'object' && item && typeof item === 'object') {
1430
- target[i] = merge(targetItem, item, options);
1431
- } else {
1432
- target.push(item);
1433
- }
1434
- } else {
1435
- target[i] = item;
1436
- }
1437
- });
1438
- return target;
1439
- }
1440
-
1441
- return Object.keys(source).reduce(function (acc, key) {
1442
- var value = source[key];
1443
-
1444
- if (has$1.call(acc, key)) {
1445
- acc[key] = merge(acc[key], value, options);
1446
- } else {
1447
- acc[key] = value;
1448
- }
1449
-
1450
- return acc;
1451
- }, mergeTarget);
1452
- };
1453
-
1454
- var assign = function assignSingleSource(target, source) {
1455
- return Object.keys(source).reduce(function (acc, key) {
1456
- acc[key] = source[key];
1457
- return acc;
1458
- }, target);
1459
- };
1460
-
1461
- var decode = function (str, decoder, charset) {
1462
- var strWithoutPlus = str.replace(/\+/g, ' ');
1463
-
1464
- if (charset === 'iso-8859-1') {
1465
- // unescape never throws, no try...catch needed:
1466
- return strWithoutPlus.replace(/%[0-9a-f]{2}/gi, unescape);
1467
- } // utf-8
1468
-
1469
-
1470
- try {
1471
- return decodeURIComponent(strWithoutPlus);
1472
- } catch (e) {
1473
- return strWithoutPlus;
1474
- }
1475
- };
1476
-
1477
- var encode = function encode(str, defaultEncoder, charset, kind, format) {
1478
- // This code was originally written by Brian White (mscdex) for the io.js core querystring library.
1479
- // It has been adapted here for stricter adherence to RFC 3986
1480
- if (str.length === 0) {
1481
- return str;
1482
- }
1483
-
1484
- var string = str;
1485
-
1486
- if (typeof str === 'symbol') {
1487
- string = Symbol.prototype.toString.call(str);
1488
- } else if (typeof str !== 'string') {
1489
- string = String(str);
1490
- }
1491
-
1492
- if (charset === 'iso-8859-1') {
1493
- return escape(string).replace(/%u[0-9a-f]{4}/gi, function ($0) {
1494
- return '%26%23' + parseInt($0.slice(2), 16) + '%3B';
1495
- });
1496
- }
1497
-
1498
- var out = '';
1499
-
1500
- for (var i = 0; i < string.length; ++i) {
1501
- var c = string.charCodeAt(i);
1502
-
1503
- if (c === 0x2D // -
1504
- || c === 0x2E // .
1505
- || c === 0x5F // _
1506
- || c === 0x7E // ~
1507
- || c >= 0x30 && c <= 0x39 // 0-9
1508
- || c >= 0x41 && c <= 0x5A // a-z
1509
- || c >= 0x61 && c <= 0x7A // A-Z
1510
- || format === formats.RFC1738 && (c === 0x28 || c === 0x29) // ( )
1511
- ) {
1512
- out += string.charAt(i);
1513
- continue;
1514
- }
1515
-
1516
- if (c < 0x80) {
1517
- out = out + hexTable[c];
1518
- continue;
1519
- }
1520
-
1521
- if (c < 0x800) {
1522
- out = out + (hexTable[0xC0 | c >> 6] + hexTable[0x80 | c & 0x3F]);
1523
- continue;
1524
- }
1525
-
1526
- if (c < 0xD800 || c >= 0xE000) {
1527
- out = out + (hexTable[0xE0 | c >> 12] + hexTable[0x80 | c >> 6 & 0x3F] + hexTable[0x80 | c & 0x3F]);
1528
- continue;
1529
- }
1530
-
1531
- i += 1;
1532
- c = 0x10000 + ((c & 0x3FF) << 10 | string.charCodeAt(i) & 0x3FF);
1533
- out += hexTable[0xF0 | c >> 18] + hexTable[0x80 | c >> 12 & 0x3F] + hexTable[0x80 | c >> 6 & 0x3F] + hexTable[0x80 | c & 0x3F];
1534
- }
1535
-
1536
- return out;
1537
- };
1538
-
1539
- var compact = function compact(value) {
1540
- var queue = [{
1541
- obj: {
1542
- o: value
1543
- },
1544
- prop: 'o'
1545
- }];
1546
- var refs = [];
1547
-
1548
- for (var i = 0; i < queue.length; ++i) {
1549
- var item = queue[i];
1550
- var obj = item.obj[item.prop];
1551
- var keys = Object.keys(obj);
1552
-
1553
- for (var j = 0; j < keys.length; ++j) {
1554
- var key = keys[j];
1555
- var val = obj[key];
1556
-
1557
- if (typeof val === 'object' && val !== null && refs.indexOf(val) === -1) {
1558
- queue.push({
1559
- obj: obj,
1560
- prop: key
1561
- });
1562
- refs.push(val);
1563
- }
1564
- }
1565
- }
1566
-
1567
- compactQueue(queue);
1568
- return value;
1569
- };
1570
-
1571
- var isRegExp$1 = function isRegExp(obj) {
1572
- return Object.prototype.toString.call(obj) === '[object RegExp]';
1573
- };
1574
-
1575
- var isBuffer = function isBuffer(obj) {
1576
- if (!obj || typeof obj !== 'object') {
1577
- return false;
1578
- }
1579
-
1580
- return !!(obj.constructor && obj.constructor.isBuffer && obj.constructor.isBuffer(obj));
1581
- };
1582
-
1583
- var combine = function combine(a, b) {
1584
- return [].concat(a, b);
1585
- };
1586
-
1587
- var maybeMap = function maybeMap(val, fn) {
1588
- if (isArray$1(val)) {
1589
- var mapped = [];
1590
-
1591
- for (var i = 0; i < val.length; i += 1) {
1592
- mapped.push(fn(val[i]));
1593
- }
1594
-
1595
- return mapped;
1596
- }
1597
-
1598
- return fn(val);
1599
- };
1600
-
1601
- var utils = {
1602
- arrayToObject: arrayToObject,
1603
- assign: assign,
1604
- combine: combine,
1605
- compact: compact,
1606
- decode: decode,
1607
- encode: encode,
1608
- isBuffer: isBuffer,
1609
- isRegExp: isRegExp$1,
1610
- maybeMap: maybeMap,
1611
- merge: merge
1612
- };
1613
-
1614
- var has$2 = Object.prototype.hasOwnProperty;
1615
- var arrayPrefixGenerators = {
1616
- brackets: function brackets(prefix) {
1617
- return prefix + '[]';
1618
- },
1619
- comma: 'comma',
1620
- indices: function indices(prefix, key) {
1621
- return prefix + '[' + key + ']';
1622
- },
1623
- repeat: function repeat(prefix) {
1624
- return prefix;
1625
- }
1626
- };
1627
- var isArray$2 = Array.isArray;
1628
- var push = Array.prototype.push;
1629
-
1630
- var pushToArray = function (arr, valueOrArray) {
1631
- push.apply(arr, isArray$2(valueOrArray) ? valueOrArray : [valueOrArray]);
1632
- };
1633
-
1634
- var toISO = Date.prototype.toISOString;
1635
- var defaultFormat = formats['default'];
1636
- var defaults = {
1637
- addQueryPrefix: false,
1638
- allowDots: false,
1639
- charset: 'utf-8',
1640
- charsetSentinel: false,
1641
- delimiter: '&',
1642
- encode: true,
1643
- encoder: utils.encode,
1644
- encodeValuesOnly: false,
1645
- format: defaultFormat,
1646
- formatter: formats.formatters[defaultFormat],
1647
- // deprecated
1648
- indices: false,
1649
- serializeDate: function serializeDate(date) {
1650
- return toISO.call(date);
1651
- },
1652
- skipNulls: false,
1653
- strictNullHandling: false
1654
- };
1655
-
1656
- var isNonNullishPrimitive = function isNonNullishPrimitive(v) {
1657
- return typeof v === 'string' || typeof v === 'number' || typeof v === 'boolean' || typeof v === 'symbol' || typeof v === 'bigint';
1658
- };
1659
-
1660
- var stringify = function stringify(object, prefix, generateArrayPrefix, strictNullHandling, skipNulls, encoder, filter, sort, allowDots, serializeDate, format, formatter, encodeValuesOnly, charset, sideChannel$1) {
1661
- var obj = object;
1662
-
1663
- if (sideChannel$1.has(object)) {
1664
- throw new RangeError('Cyclic object value');
1665
- }
1666
-
1667
- if (typeof filter === 'function') {
1668
- obj = filter(prefix, obj);
1669
- } else if (obj instanceof Date) {
1670
- obj = serializeDate(obj);
1671
- } else if (generateArrayPrefix === 'comma' && isArray$2(obj)) {
1672
- obj = utils.maybeMap(obj, function (value) {
1673
- if (value instanceof Date) {
1674
- return serializeDate(value);
1675
- }
1676
-
1677
- return value;
1678
- });
1679
- }
1680
-
1681
- if (obj === null) {
1682
- if (strictNullHandling) {
1683
- return encoder && !encodeValuesOnly ? encoder(prefix, defaults.encoder, charset, 'key', format) : prefix;
1684
- }
1685
-
1686
- obj = '';
1687
- }
1688
-
1689
- if (isNonNullishPrimitive(obj) || utils.isBuffer(obj)) {
1690
- if (encoder) {
1691
- var keyValue = encodeValuesOnly ? prefix : encoder(prefix, defaults.encoder, charset, 'key', format);
1692
- return [formatter(keyValue) + '=' + formatter(encoder(obj, defaults.encoder, charset, 'value', format))];
1693
- }
1694
-
1695
- return [formatter(prefix) + '=' + formatter(String(obj))];
1696
- }
1697
-
1698
- var values = [];
1699
-
1700
- if (typeof obj === 'undefined') {
1701
- return values;
1702
- }
1703
-
1704
- var objKeys;
1705
-
1706
- if (generateArrayPrefix === 'comma' && isArray$2(obj)) {
1707
- // we need to join elements in
1708
- objKeys = [{
1709
- value: obj.length > 0 ? obj.join(',') || null : undefined
1710
- }];
1711
- } else if (isArray$2(filter)) {
1712
- objKeys = filter;
1713
- } else {
1714
- var keys = Object.keys(obj);
1715
- objKeys = sort ? keys.sort(sort) : keys;
1716
- }
1717
-
1718
- for (var i = 0; i < objKeys.length; ++i) {
1719
- var key = objKeys[i];
1720
- var value = typeof key === 'object' && key.value !== undefined ? key.value : obj[key];
1721
-
1722
- if (skipNulls && value === null) {
1723
- continue;
1724
- }
1725
-
1726
- var keyPrefix = isArray$2(obj) ? typeof generateArrayPrefix === 'function' ? generateArrayPrefix(prefix, key) : prefix : prefix + (allowDots ? '.' + key : '[' + key + ']');
1727
- sideChannel$1.set(object, true);
1728
- var valueSideChannel = sideChannel();
1729
- pushToArray(values, stringify(value, keyPrefix, generateArrayPrefix, strictNullHandling, skipNulls, encoder, filter, sort, allowDots, serializeDate, format, formatter, encodeValuesOnly, charset, valueSideChannel));
1730
- }
1731
-
1732
- return values;
1733
- };
1734
-
1735
- var normalizeStringifyOptions = function normalizeStringifyOptions(opts) {
1736
- if (!opts) {
1737
- return defaults;
1738
- }
1739
-
1740
- if (opts.encoder !== null && opts.encoder !== undefined && typeof opts.encoder !== 'function') {
1741
- throw new TypeError('Encoder has to be a function.');
1742
- }
1743
-
1744
- var charset = opts.charset || defaults.charset;
1745
-
1746
- if (typeof opts.charset !== 'undefined' && opts.charset !== 'utf-8' && opts.charset !== 'iso-8859-1') {
1747
- throw new TypeError('The charset option must be either utf-8, iso-8859-1, or undefined');
1748
- }
1749
-
1750
- var format = formats['default'];
1751
-
1752
- if (typeof opts.format !== 'undefined') {
1753
- if (!has$2.call(formats.formatters, opts.format)) {
1754
- throw new TypeError('Unknown format option provided.');
1755
- }
1756
-
1757
- format = opts.format;
1758
- }
1759
-
1760
- var formatter = formats.formatters[format];
1761
- var filter = defaults.filter;
1762
-
1763
- if (typeof opts.filter === 'function' || isArray$2(opts.filter)) {
1764
- filter = opts.filter;
1765
- }
1766
-
1767
- return {
1768
- addQueryPrefix: typeof opts.addQueryPrefix === 'boolean' ? opts.addQueryPrefix : defaults.addQueryPrefix,
1769
- allowDots: typeof opts.allowDots === 'undefined' ? defaults.allowDots : !!opts.allowDots,
1770
- charset: charset,
1771
- charsetSentinel: typeof opts.charsetSentinel === 'boolean' ? opts.charsetSentinel : defaults.charsetSentinel,
1772
- delimiter: typeof opts.delimiter === 'undefined' ? defaults.delimiter : opts.delimiter,
1773
- encode: typeof opts.encode === 'boolean' ? opts.encode : defaults.encode,
1774
- encoder: typeof opts.encoder === 'function' ? opts.encoder : defaults.encoder,
1775
- encodeValuesOnly: typeof opts.encodeValuesOnly === 'boolean' ? opts.encodeValuesOnly : defaults.encodeValuesOnly,
1776
- filter: filter,
1777
- format: format,
1778
- formatter: formatter,
1779
- serializeDate: typeof opts.serializeDate === 'function' ? opts.serializeDate : defaults.serializeDate,
1780
- skipNulls: typeof opts.skipNulls === 'boolean' ? opts.skipNulls : defaults.skipNulls,
1781
- sort: typeof opts.sort === 'function' ? opts.sort : null,
1782
- strictNullHandling: typeof opts.strictNullHandling === 'boolean' ? opts.strictNullHandling : defaults.strictNullHandling
1783
- };
1784
- };
1785
-
1786
- var stringify_1 = function (object, opts) {
1787
- var obj = object;
1788
- var options = normalizeStringifyOptions(opts);
1789
- var objKeys;
1790
- var filter;
1791
-
1792
- if (typeof options.filter === 'function') {
1793
- filter = options.filter;
1794
- obj = filter('', obj);
1795
- } else if (isArray$2(options.filter)) {
1796
- filter = options.filter;
1797
- objKeys = filter;
1798
- }
1799
-
1800
- var keys = [];
1801
-
1802
- if (typeof obj !== 'object' || obj === null) {
1803
- return '';
1804
- }
1805
-
1806
- var arrayFormat;
1807
-
1808
- if (opts && opts.arrayFormat in arrayPrefixGenerators) {
1809
- arrayFormat = opts.arrayFormat;
1810
- } else if (opts && 'indices' in opts) {
1811
- arrayFormat = opts.indices ? 'indices' : 'repeat';
1812
- } else {
1813
- arrayFormat = 'indices';
1814
- }
1815
-
1816
- var generateArrayPrefix = arrayPrefixGenerators[arrayFormat];
1817
-
1818
- if (!objKeys) {
1819
- objKeys = Object.keys(obj);
1820
- }
1821
-
1822
- if (options.sort) {
1823
- objKeys.sort(options.sort);
1824
- }
1825
-
1826
- var sideChannel$1 = sideChannel();
1827
-
1828
- for (var i = 0; i < objKeys.length; ++i) {
1829
- var key = objKeys[i];
1830
-
1831
- if (options.skipNulls && obj[key] === null) {
1832
- continue;
1833
- }
1834
-
1835
- pushToArray(keys, stringify(obj[key], key, generateArrayPrefix, options.strictNullHandling, options.skipNulls, options.encode ? options.encoder : null, options.filter, options.sort, options.allowDots, options.serializeDate, options.format, options.formatter, options.encodeValuesOnly, options.charset, sideChannel$1));
1836
- }
1837
-
1838
- var joined = keys.join(options.delimiter);
1839
- var prefix = options.addQueryPrefix === true ? '?' : '';
1840
-
1841
- if (options.charsetSentinel) {
1842
- if (options.charset === 'iso-8859-1') {
1843
- // encodeURIComponent('&#10003;'), the "numeric entity" representation of a checkmark
1844
- prefix += 'utf8=%26%2310003%3B&';
1845
- } else {
1846
- // encodeURIComponent('✓')
1847
- prefix += 'utf8=%E2%9C%93&';
1848
- }
1849
- }
1850
-
1851
- return joined.length > 0 ? prefix + joined : '';
1852
- };
1853
-
1854
- var has$3 = Object.prototype.hasOwnProperty;
1855
- var isArray$3 = Array.isArray;
1856
- var defaults$1 = {
1857
- allowDots: false,
1858
- allowPrototypes: false,
1859
- allowSparse: false,
1860
- arrayLimit: 20,
1861
- charset: 'utf-8',
1862
- charsetSentinel: false,
1863
- comma: false,
1864
- decoder: utils.decode,
1865
- delimiter: '&',
1866
- depth: 5,
1867
- ignoreQueryPrefix: false,
1868
- interpretNumericEntities: false,
1869
- parameterLimit: 1000,
1870
- parseArrays: true,
1871
- plainObjects: false,
1872
- strictNullHandling: false
1873
- };
1874
-
1875
- var interpretNumericEntities = function (str) {
1876
- return str.replace(/&#(\d+);/g, function ($0, numberStr) {
1877
- return String.fromCharCode(parseInt(numberStr, 10));
1878
- });
1879
- };
1880
-
1881
- var parseArrayValue = function (val, options) {
1882
- if (val && typeof val === 'string' && options.comma && val.indexOf(',') > -1) {
1883
- return val.split(',');
1884
- }
1885
-
1886
- return val;
1887
- }; // This is what browsers will submit when the ✓ character occurs in an
1888
- // application/x-www-form-urlencoded body and the encoding of the page containing
1889
- // the form is iso-8859-1, or when the submitted form has an accept-charset
1890
- // attribute of iso-8859-1. Presumably also with other charsets that do not contain
1891
- // the ✓ character, such as us-ascii.
1892
-
1893
-
1894
- var isoSentinel = 'utf8=%26%2310003%3B'; // encodeURIComponent('&#10003;')
1895
- // These are the percent-encoded utf-8 octets representing a checkmark, indicating that the request actually is utf-8 encoded.
1896
-
1897
- var charsetSentinel = 'utf8=%E2%9C%93'; // encodeURIComponent('✓')
1898
-
1899
- var parseValues = function parseQueryStringValues(str, options) {
1900
- var obj = {};
1901
- var cleanStr = options.ignoreQueryPrefix ? str.replace(/^\?/, '') : str;
1902
- var limit = options.parameterLimit === Infinity ? undefined : options.parameterLimit;
1903
- var parts = cleanStr.split(options.delimiter, limit);
1904
- var skipIndex = -1; // Keep track of where the utf8 sentinel was found
1905
-
1906
- var i;
1907
- var charset = options.charset;
1908
-
1909
- if (options.charsetSentinel) {
1910
- for (i = 0; i < parts.length; ++i) {
1911
- if (parts[i].indexOf('utf8=') === 0) {
1912
- if (parts[i] === charsetSentinel) {
1913
- charset = 'utf-8';
1914
- } else if (parts[i] === isoSentinel) {
1915
- charset = 'iso-8859-1';
1916
- }
1917
-
1918
- skipIndex = i;
1919
- i = parts.length; // The eslint settings do not allow break;
1920
- }
1921
- }
1922
- }
1923
-
1924
- for (i = 0; i < parts.length; ++i) {
1925
- if (i === skipIndex) {
1926
- continue;
1927
- }
1928
-
1929
- var part = parts[i];
1930
- var bracketEqualsPos = part.indexOf(']=');
1931
- var pos = bracketEqualsPos === -1 ? part.indexOf('=') : bracketEqualsPos + 1;
1932
- var key, val;
1933
-
1934
- if (pos === -1) {
1935
- key = options.decoder(part, defaults$1.decoder, charset, 'key');
1936
- val = options.strictNullHandling ? null : '';
1937
- } else {
1938
- key = options.decoder(part.slice(0, pos), defaults$1.decoder, charset, 'key');
1939
- val = utils.maybeMap(parseArrayValue(part.slice(pos + 1), options), function (encodedVal) {
1940
- return options.decoder(encodedVal, defaults$1.decoder, charset, 'value');
1941
- });
1942
- }
1943
-
1944
- if (val && options.interpretNumericEntities && charset === 'iso-8859-1') {
1945
- val = interpretNumericEntities(val);
1946
- }
1947
-
1948
- if (part.indexOf('[]=') > -1) {
1949
- val = isArray$3(val) ? [val] : val;
1950
- }
1951
-
1952
- if (has$3.call(obj, key)) {
1953
- obj[key] = utils.combine(obj[key], val);
1954
- } else {
1955
- obj[key] = val;
1956
- }
1957
- }
1958
-
1959
- return obj;
1960
- };
1961
-
1962
- var parseObject = function (chain, val, options, valuesParsed) {
1963
- var leaf = valuesParsed ? val : parseArrayValue(val, options);
1964
-
1965
- for (var i = chain.length - 1; i >= 0; --i) {
1966
- var obj;
1967
- var root = chain[i];
1968
-
1969
- if (root === '[]' && options.parseArrays) {
1970
- obj = [].concat(leaf);
1971
- } else {
1972
- obj = options.plainObjects ? Object.create(null) : {};
1973
- var cleanRoot = root.charAt(0) === '[' && root.charAt(root.length - 1) === ']' ? root.slice(1, -1) : root;
1974
- var index = parseInt(cleanRoot, 10);
1975
-
1976
- if (!options.parseArrays && cleanRoot === '') {
1977
- obj = {
1978
- 0: leaf
1979
- };
1980
- } else if (!isNaN(index) && root !== cleanRoot && String(index) === cleanRoot && index >= 0 && options.parseArrays && index <= options.arrayLimit) {
1981
- obj = [];
1982
- obj[index] = leaf;
1983
- } else {
1984
- obj[cleanRoot] = leaf;
1985
- }
1986
- }
1987
-
1988
- leaf = obj;
1989
- }
1990
-
1991
- return leaf;
1992
- };
1993
-
1994
- var parseKeys = function parseQueryStringKeys(givenKey, val, options, valuesParsed) {
1995
- if (!givenKey) {
1996
- return;
1997
- } // Transform dot notation to bracket notation
1998
-
1999
-
2000
- var key = options.allowDots ? givenKey.replace(/\.([^.[]+)/g, '[$1]') : givenKey; // The regex chunks
2001
-
2002
- var brackets = /(\[[^[\]]*])/;
2003
- var child = /(\[[^[\]]*])/g; // Get the parent
2004
-
2005
- var segment = options.depth > 0 && brackets.exec(key);
2006
- var parent = segment ? key.slice(0, segment.index) : key; // Stash the parent if it exists
2007
-
2008
- var keys = [];
2009
-
2010
- if (parent) {
2011
- // If we aren't using plain objects, optionally prefix keys that would overwrite object prototype properties
2012
- if (!options.plainObjects && has$3.call(Object.prototype, parent)) {
2013
- if (!options.allowPrototypes) {
2014
- return;
2015
- }
2016
- }
2017
-
2018
- keys.push(parent);
2019
- } // Loop through children appending to the array until we hit depth
2020
-
2021
-
2022
- var i = 0;
2023
-
2024
- while (options.depth > 0 && (segment = child.exec(key)) !== null && i < options.depth) {
2025
- i += 1;
2026
-
2027
- if (!options.plainObjects && has$3.call(Object.prototype, segment[1].slice(1, -1))) {
2028
- if (!options.allowPrototypes) {
2029
- return;
2030
- }
2031
- }
2032
-
2033
- keys.push(segment[1]);
2034
- } // If there's a remainder, just add whatever is left
2035
-
2036
-
2037
- if (segment) {
2038
- keys.push('[' + key.slice(segment.index) + ']');
2039
- }
2040
-
2041
- return parseObject(keys, val, options, valuesParsed);
2042
- };
2043
-
2044
- var normalizeParseOptions = function normalizeParseOptions(opts) {
2045
- if (!opts) {
2046
- return defaults$1;
2047
- }
2048
-
2049
- if (opts.decoder !== null && opts.decoder !== undefined && typeof opts.decoder !== 'function') {
2050
- throw new TypeError('Decoder has to be a function.');
2051
- }
2052
-
2053
- if (typeof opts.charset !== 'undefined' && opts.charset !== 'utf-8' && opts.charset !== 'iso-8859-1') {
2054
- throw new TypeError('The charset option must be either utf-8, iso-8859-1, or undefined');
2055
- }
2056
-
2057
- var charset = typeof opts.charset === 'undefined' ? defaults$1.charset : opts.charset;
2058
- return {
2059
- allowDots: typeof opts.allowDots === 'undefined' ? defaults$1.allowDots : !!opts.allowDots,
2060
- allowPrototypes: typeof opts.allowPrototypes === 'boolean' ? opts.allowPrototypes : defaults$1.allowPrototypes,
2061
- allowSparse: typeof opts.allowSparse === 'boolean' ? opts.allowSparse : defaults$1.allowSparse,
2062
- arrayLimit: typeof opts.arrayLimit === 'number' ? opts.arrayLimit : defaults$1.arrayLimit,
2063
- charset: charset,
2064
- charsetSentinel: typeof opts.charsetSentinel === 'boolean' ? opts.charsetSentinel : defaults$1.charsetSentinel,
2065
- comma: typeof opts.comma === 'boolean' ? opts.comma : defaults$1.comma,
2066
- decoder: typeof opts.decoder === 'function' ? opts.decoder : defaults$1.decoder,
2067
- delimiter: typeof opts.delimiter === 'string' || utils.isRegExp(opts.delimiter) ? opts.delimiter : defaults$1.delimiter,
2068
- // eslint-disable-next-line no-implicit-coercion, no-extra-parens
2069
- depth: typeof opts.depth === 'number' || opts.depth === false ? +opts.depth : defaults$1.depth,
2070
- ignoreQueryPrefix: opts.ignoreQueryPrefix === true,
2071
- interpretNumericEntities: typeof opts.interpretNumericEntities === 'boolean' ? opts.interpretNumericEntities : defaults$1.interpretNumericEntities,
2072
- parameterLimit: typeof opts.parameterLimit === 'number' ? opts.parameterLimit : defaults$1.parameterLimit,
2073
- parseArrays: opts.parseArrays !== false,
2074
- plainObjects: typeof opts.plainObjects === 'boolean' ? opts.plainObjects : defaults$1.plainObjects,
2075
- strictNullHandling: typeof opts.strictNullHandling === 'boolean' ? opts.strictNullHandling : defaults$1.strictNullHandling
2076
- };
2077
- };
2078
-
2079
- var parse = function (str, opts) {
2080
- var options = normalizeParseOptions(opts);
2081
-
2082
- if (str === '' || str === null || typeof str === 'undefined') {
2083
- return options.plainObjects ? Object.create(null) : {};
2084
- }
2085
-
2086
- var tempObj = typeof str === 'string' ? parseValues(str, options) : str;
2087
- var obj = options.plainObjects ? Object.create(null) : {}; // Iterate over the keys and setup the new object
2088
-
2089
- var keys = Object.keys(tempObj);
2090
-
2091
- for (var i = 0; i < keys.length; ++i) {
2092
- var key = keys[i];
2093
- var newObj = parseKeys(key, tempObj[key], options, typeof str === 'string');
2094
- obj = utils.merge(obj, newObj, options);
2095
- }
2096
-
2097
- if (options.allowSparse === true) {
2098
- return obj;
2099
- }
2100
-
2101
- return utils.compact(obj);
2102
- };
2103
-
2104
- var lib = {
2105
- formats: formats,
2106
- parse: parse,
2107
- stringify: stringify_1
2108
- };
2109
-
2110
- function createHttpFunction(baseUrl, version) {
2111
- var baseURL = baseUrl + "/" + version;
2112
- return Axios.create({
2113
- baseURL: baseURL,
2114
- headers: { Pragma: 'no-cache' },
2115
- paramsSerializer: function (params) { return lib.stringify(params, { arrayFormat: 'repeat' }); }
2116
- });
2117
- }
2118
-
2119
- var arrayLikeToArray = createCommonjsModule(function (module) {
2120
- function _arrayLikeToArray(arr, len) {
2121
- if (len == null || len > arr.length) {
2122
- len = arr.length;
2123
- }
2124
-
2125
- for (var i = 0, arr2 = new Array(len); i < len; i++) {
2126
- arr2[i] = arr[i];
2127
- }
2128
-
2129
- return arr2;
2130
- }
2131
-
2132
- module.exports = _arrayLikeToArray;
2133
- module.exports["default"] = module.exports, module.exports.__esModule = true;
2134
- });
2135
- unwrapExports(arrayLikeToArray);
2136
-
2137
- var arrayWithoutHoles = createCommonjsModule(function (module) {
2138
- function _arrayWithoutHoles(arr) {
2139
- if (Array.isArray(arr)) {
2140
- return arrayLikeToArray(arr);
2141
- }
2142
- }
2143
-
2144
- module.exports = _arrayWithoutHoles;
2145
- module.exports["default"] = module.exports, module.exports.__esModule = true;
2146
- });
2147
- unwrapExports(arrayWithoutHoles);
2148
-
2149
- var iterableToArray = createCommonjsModule(function (module) {
2150
- function _iterableToArray(iter) {
2151
- if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) {
2152
- return Array.from(iter);
2153
- }
2154
- }
2155
-
2156
- module.exports = _iterableToArray;
2157
- module.exports["default"] = module.exports, module.exports.__esModule = true;
2158
- });
2159
- unwrapExports(iterableToArray);
2160
-
2161
- var unsupportedIterableToArray = createCommonjsModule(function (module) {
2162
- function _unsupportedIterableToArray(o, minLen) {
2163
- if (!o) {
2164
- return;
2165
- }
2166
-
2167
- if (typeof o === "string") {
2168
- return arrayLikeToArray(o, minLen);
2169
- }
2170
-
2171
- var n = Object.prototype.toString.call(o).slice(8, -1);
2172
-
2173
- if (n === "Object" && o.constructor) {
2174
- n = o.constructor.name;
2175
- }
2176
-
2177
- if (n === "Map" || n === "Set") {
2178
- return Array.from(o);
2179
- }
2180
-
2181
- if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) {
2182
- return arrayLikeToArray(o, minLen);
2183
- }
2184
- }
2185
-
2186
- module.exports = _unsupportedIterableToArray;
2187
- module.exports["default"] = module.exports, module.exports.__esModule = true;
2188
- });
2189
- unwrapExports(unsupportedIterableToArray);
2190
-
2191
- var nonIterableSpread = createCommonjsModule(function (module) {
2192
- function _nonIterableSpread() {
2193
- throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
2194
- }
2195
-
2196
- module.exports = _nonIterableSpread;
2197
- module.exports["default"] = module.exports, module.exports.__esModule = true;
2198
- });
2199
- unwrapExports(nonIterableSpread);
2200
-
2201
- var toConsumableArray = createCommonjsModule(function (module) {
2202
- function _toConsumableArray(arr) {
2203
- return arrayWithoutHoles(arr) || iterableToArray(arr) || unsupportedIterableToArray(arr) || nonIterableSpread();
2204
- }
2205
-
2206
- module.exports = _toConsumableArray;
2207
- module.exports["default"] = module.exports, module.exports.__esModule = true;
2208
- });
2209
- var _toConsumableArray = unwrapExports(toConsumableArray);
2210
-
2211
- var arrayWithHoles = createCommonjsModule(function (module) {
2212
- function _arrayWithHoles(arr) {
2213
- if (Array.isArray(arr)) {
2214
- return arr;
2215
- }
2216
- }
2217
-
2218
- module.exports = _arrayWithHoles;
2219
- module.exports["default"] = module.exports, module.exports.__esModule = true;
2220
- });
2221
- unwrapExports(arrayWithHoles);
2222
-
2223
- var iterableToArrayLimit = createCommonjsModule(function (module) {
2224
- function _iterableToArrayLimit(arr, i) {
2225
- var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
2226
-
2227
- if (_i == null) {
2228
- return;
2229
- }
2230
-
2231
- var _arr = [];
2232
- var _n = true;
2233
- var _d = false;
2234
-
2235
- var _s, _e;
2236
-
2237
- try {
2238
- for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) {
2239
- _arr.push(_s.value);
2240
-
2241
- if (i && _arr.length === i) {
2242
- break;
2243
- }
2244
- }
2245
- } catch (err) {
2246
- _d = true;
2247
- _e = err;
2248
- } finally {
2249
- try {
2250
- if (!_n && _i["return"] != null) {
2251
- _i["return"]();
2252
- }
2253
- } finally {
2254
- if (_d) {
2255
- throw _e;
2256
- }
2257
- }
2258
- }
2259
-
2260
- return _arr;
2261
- }
2262
-
2263
- module.exports = _iterableToArrayLimit;
2264
- module.exports["default"] = module.exports, module.exports.__esModule = true;
2265
- });
2266
- unwrapExports(iterableToArrayLimit);
2267
-
2268
- var nonIterableRest = createCommonjsModule(function (module) {
2269
- function _nonIterableRest() {
2270
- throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
2271
- }
2272
-
2273
- module.exports = _nonIterableRest;
2274
- module.exports["default"] = module.exports, module.exports.__esModule = true;
2275
- });
2276
- unwrapExports(nonIterableRest);
2277
-
2278
- var slicedToArray = createCommonjsModule(function (module) {
2279
- function _slicedToArray(arr, i) {
2280
- return arrayWithHoles(arr) || iterableToArrayLimit(arr, i) || unsupportedIterableToArray(arr, i) || nonIterableRest();
2281
- }
2282
-
2283
- module.exports = _slicedToArray;
2284
- module.exports["default"] = module.exports, module.exports.__esModule = true;
2285
- });
2286
- var _slicedToArray = unwrapExports(slicedToArray);
2287
-
2288
- /**
2289
- * Source: ftp://ftp.unicode.org/Public/UCD/latest/ucd/SpecialCasing.txt
2290
- */
2291
- /**
2292
- * Lower case as a function.
2293
- */
2294
-
2295
- function lowerCase(str) {
2296
- return str.toLowerCase();
2297
- }
2298
-
2299
- var DEFAULT_SPLIT_REGEXP = [/([a-z0-9])([A-Z])/g, /([A-Z])([A-Z][a-z])/g]; // Remove all non-word characters.
2300
-
2301
- var DEFAULT_STRIP_REGEXP = /[^A-Z0-9]+/gi;
2302
- /**
2303
- * Normalize the string into something other libraries can manipulate easier.
2304
- */
2305
-
2306
- function noCase(input, options) {
2307
- if (options === void 0) {
2308
- options = {};
2309
- }
2310
-
2311
- var _a = options.splitRegexp,
2312
- splitRegexp = _a === void 0 ? DEFAULT_SPLIT_REGEXP : _a,
2313
- _b = options.stripRegexp,
2314
- stripRegexp = _b === void 0 ? DEFAULT_STRIP_REGEXP : _b,
2315
- _c = options.transform,
2316
- transform = _c === void 0 ? lowerCase : _c,
2317
- _d = options.delimiter,
2318
- delimiter = _d === void 0 ? " " : _d;
2319
- var result = replace$1(replace$1(input, splitRegexp, "$1\0$2"), stripRegexp, "\0");
2320
- var start = 0;
2321
- var end = result.length; // Trim the delimiter from around the output string.
2322
-
2323
- while (result.charAt(start) === "\0") {
2324
- start++;
2325
- }
2326
-
2327
- while (result.charAt(end - 1) === "\0") {
2328
- end--;
2329
- } // Transform each token independently.
2330
-
2331
-
2332
- return result.slice(start, end).split("\0").map(transform).join(delimiter);
2333
- }
2334
- /**
2335
- * Replace `re` in the input string with the replacement value.
2336
- */
2337
-
2338
- function replace$1(input, re, value) {
2339
- if (re instanceof RegExp) {
2340
- return input.replace(re, value);
2341
- }
2342
-
2343
- return re.reduce(function (input, re) {
2344
- return input.replace(re, value);
2345
- }, input);
2346
- }
2347
-
2348
- /**
2349
- * Upper case the first character of an input string.
2350
- */
2351
- function upperCaseFirst(input) {
2352
- return input.charAt(0).toUpperCase() + input.substr(1);
2353
- }
2354
-
2355
- function capitalCaseTransform(input) {
2356
- return upperCaseFirst(input.toLowerCase());
2357
- }
2358
- function capitalCase(input, options) {
2359
- if (options === void 0) {
2360
- options = {};
2361
- }
2362
-
2363
- return noCase(input, __assign({
2364
- delimiter: " ",
2365
- transform: capitalCaseTransform
2366
- }, options));
2367
- }
2368
-
2369
- function headerCase(input, options) {
2370
- if (options === void 0) {
2371
- options = {};
2372
- }
2373
-
2374
- return capitalCase(input, __assign({
2375
- delimiter: "-"
2376
- }, options));
2377
- }
2378
-
2379
- function pascalCaseTransform(input, index) {
2380
- var firstChar = input.charAt(0);
2381
- var lowerChars = input.substr(1).toLowerCase();
2382
-
2383
- if (index > 0 && firstChar >= "0" && firstChar <= "9") {
2384
- return "_" + firstChar + lowerChars;
2385
- }
2386
-
2387
- return "" + firstChar.toUpperCase() + lowerChars;
2388
- }
2389
- function pascalCase(input, options) {
2390
- if (options === void 0) {
2391
- options = {};
2392
- }
2393
-
2394
- return noCase(input, __assign({
2395
- delimiter: "",
2396
- transform: pascalCaseTransform
2397
- }, options));
2398
- }
2399
-
2400
- function camelCaseTransform(input, index) {
2401
- if (index === 0) {
2402
- return input.toLowerCase();
2403
- }
2404
-
2405
- return pascalCaseTransform(input, index);
2406
- }
2407
- function camelCase(input, options) {
2408
- if (options === void 0) {
2409
- options = {};
2410
- }
2411
-
2412
- return pascalCase(input, __assign({
2413
- transform: camelCaseTransform
2414
- }, options));
2415
- }
2416
-
2417
- function dotCase(input, options) {
2418
- if (options === void 0) {
2419
- options = {};
2420
- }
2421
-
2422
- return noCase(input, __assign({
2423
- delimiter: "."
2424
- }, options));
2425
- }
2426
-
2427
- function snakeCase(input, options) {
2428
- if (options === void 0) {
2429
- options = {};
2430
- }
2431
-
2432
- return dotCase(input, __assign({
2433
- delimiter: "_"
2434
- }, options));
2435
- }
2436
-
2437
- var _typeof_1 = createCommonjsModule(function (module) {
2438
- function _typeof(obj) {
2439
- "@babel/helpers - typeof";
2440
-
2441
- if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
2442
- module.exports = _typeof = function _typeof(obj) {
2443
- return typeof obj;
2444
- };
2445
-
2446
- module.exports["default"] = module.exports, module.exports.__esModule = true;
2447
- } else {
2448
- module.exports = _typeof = function _typeof(obj) {
2449
- return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
2450
- };
2451
-
2452
- module.exports["default"] = module.exports, module.exports.__esModule = true;
2453
- }
2454
-
2455
- return _typeof(obj);
2456
- }
2457
-
2458
- module.exports = _typeof;
2459
- module.exports["default"] = module.exports, module.exports.__esModule = true;
2460
- });
2461
-
2462
- var _typeof = unwrapExports(_typeof_1);
2463
-
2464
- var isURLSearchParams = function isURLSearchParams(value) {
2465
- return typeof URLSearchParams !== 'undefined' && value instanceof URLSearchParams;
2466
- };
2467
- var isFormData = function isFormData(value) {
2468
- return typeof FormData !== 'undefined' && value instanceof FormData;
2469
- };
2470
- var isPlainObject = function isPlainObject(value) {
2471
- return _typeof(value) === 'object' && value !== null && Object.prototype.toString.call(value) === '[object Object]';
2472
- };
2473
-
2474
- var transform = function transform(data, fn) {
2475
- var overwrite = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
2476
-
2477
- if (!Array.isArray(data) && !isPlainObject(data) && !isFormData(data) && !isURLSearchParams(data)) {
2478
- return data;
2479
- }
2480
- /* eslint-disable no-console */
2481
-
2482
-
2483
- if (isFormData(data) && !data.entries) {
2484
- if (navigator.product === 'ReactNative') {
2485
- console.warn('Be careful that FormData cannot be transformed on React Native. If you intentionally implemented, ignore this kind of warning: https://facebook.github.io/react-native/docs/debugging.html');
2486
- } else {
2487
- console.warn('You must use polyfill of FormData.prototype.entries() on Internet Explorer or Safari: https://github.com/jimmywarting/FormData');
2488
- }
2489
-
2490
- return data;
2491
- }
2492
- /* eslint-enable no-console */
2493
-
2494
-
2495
- var prototype = Object.getPrototypeOf(data);
2496
- var store = overwrite ? data : prototype ? new prototype.constructor() : Object.create(null);
2497
- var _iteratorNormalCompletion = true;
2498
- var _didIteratorError = false;
2499
- var _iteratorError = undefined;
2500
-
2501
- try {
2502
- for (var _iterator = (prototype && prototype.entries ? prototype.entries.call(data) : Object.entries(data))[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
2503
- var _step$value = _slicedToArray(_step.value, 2),
2504
- key = _step$value[0],
2505
- value = _step$value[1];
2506
-
2507
- if (prototype && prototype.append) {
2508
- prototype.append.call(store, key.replace(/[^[\]]+/g, function (k) {
2509
- return fn(k);
2510
- }), transform(value, fn));
2511
- } else if (key !== '__proto__') {
2512
- store[fn(typeof key === 'string' ? key : "".concat(key))] = transform(value, fn);
2513
- }
2514
- }
2515
- } catch (err) {
2516
- _didIteratorError = true;
2517
- _iteratorError = err;
2518
- } finally {
2519
- try {
2520
- if (!_iteratorNormalCompletion && _iterator["return"] != null) {
2521
- _iterator["return"]();
2522
- }
2523
- } finally {
2524
- if (_didIteratorError) {
2525
- throw _iteratorError;
2526
- }
2527
- }
2528
- }
2529
-
2530
- return store;
2531
- };
2532
-
2533
- var createTransform = function createTransform(fn) {
2534
- return function (data) {
2535
- var overwrite = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
2536
- return transform(data, fn, overwrite);
2537
- };
2538
- };
2539
- var snake = createTransform(snakeCase);
2540
- var camel = createTransform(camelCase);
2541
- var header = createTransform(headerCase);
2542
-
2543
- var snakeParams = function snakeParams(config) {
2544
- if (config.params) {
2545
- config.params = snake(config.params);
2546
- }
2547
-
2548
- return config;
2549
- };
2550
- var snakeRequest = function snakeRequest(data, headers) {
2551
- for (var _i = 0, _Object$entries = Object.entries(headers); _i < _Object$entries.length; _i++) {
2552
- var _Object$entries$_i = _slicedToArray(_Object$entries[_i], 2),
2553
- key = _Object$entries$_i[0],
2554
- value = _Object$entries$_i[1];
2555
-
2556
- header(value, true);
2557
-
2558
- if (!['common', 'delete', 'get', 'head', 'post', 'put', 'patch'].includes(key)) {
2559
- delete headers[key];
2560
- headers[headerCase(key)] = value;
2561
- }
2562
- }
2563
-
2564
- return snake(data);
2565
- };
2566
- var camelResponse = function camelResponse(data, headers) {
2567
- camel(headers, true);
2568
- return camel(data);
2569
- };
2570
-
2571
- var applyConverters = function applyConverters(axios) {
2572
- axios.defaults.transformRequest = [snakeRequest].concat(_toConsumableArray(axios.defaults.transformRequest));
2573
- axios.defaults.transformResponse = [].concat(_toConsumableArray(axios.defaults.transformResponse), [camelResponse]);
2574
- axios.interceptors.request.use(snakeParams);
2575
- return axios;
2576
- };
2577
-
2578
- var AsyncSurveyServiceImpl = /** @class */ (function () {
2579
- function AsyncSurveyServiceImpl(options) {
2580
- this.http = applyConverters(createHttpFunction(options.baseUrl, options.version));
2581
- if (options.httpDecorator) {
2582
- this.http = options.httpDecorator(this.http);
2583
- }
2584
- this.exhttp = createHttpFunction("", "");
2585
- }
2586
- AsyncSurveyServiceImpl.prototype.loadTemplate = function (id) {
2587
- return this.http
2588
- .get("/templates/" + id)
2589
- .then(function (response) { return response.data; });
2590
- };
2591
- AsyncSurveyServiceImpl.prototype.loadTemplates = function (params) {
2592
- return this.http
2593
- .get("/templates", { params: params })
2594
- .then(function (response) { return response.data; });
2595
- };
2596
- AsyncSurveyServiceImpl.prototype.createTemplate = function (survey) {
2597
- return this.http
2598
- .post("/templates", survey)
2599
- .then(function (response) { return response.data; });
2600
- };
2601
- AsyncSurveyServiceImpl.prototype.updateTemplate = function (survey) {
2602
- return this.http
2603
- .put("/templates", survey)
2604
- .then(function (response) { return response.data; });
2605
- };
2606
- AsyncSurveyServiceImpl.prototype.deleteTemplate = function (id) {
2607
- return this.http.delete("/templates/" + id);
2608
- };
2609
- AsyncSurveyServiceImpl.prototype.loadSurvey = function (id) {
2610
- return this.http.get("/surveys/" + id).then(function (response) { return response.data; });
2611
- };
2612
- AsyncSurveyServiceImpl.prototype.loadSurveys = function (params) {
2613
- return this.http
2614
- .get("/surveys", { params: params })
2615
- .then(function (response) { return response.data; });
2616
- };
2617
- AsyncSurveyServiceImpl.prototype.createSurvey = function (survey) {
2618
- return this.http
2619
- .post("/surveys", survey)
2620
- .then(function (response) { return response.data; });
2621
- };
2622
- AsyncSurveyServiceImpl.prototype.updateSurvey = function (survey) {
2623
- return this.http
2624
- .put("/surveys", survey)
2625
- .then(function (response) { return response.data; });
2626
- };
2627
- AsyncSurveyServiceImpl.prototype.deleteSurvey = function (id) {
2628
- return this.http.delete("/surveys/" + id);
2629
- };
2630
- AsyncSurveyServiceImpl.prototype.createQuestion = function (surveyId, question) {
2631
- return this.http
2632
- .post("/templates/" + surveyId + "/question", question)
2633
- .then(function (response) { return response.data; });
2634
- };
2635
- AsyncSurveyServiceImpl.prototype.createQuestions = function (surveyId, questions) {
2636
- return this.http
2637
- .post("/templates/" + surveyId + "/questions", questions)
2638
- .then(function (response) { return response.data; });
2639
- };
2640
- AsyncSurveyServiceImpl.prototype.updateQuestion = function (surveyId, question) {
2641
- return this.http
2642
- .put("/templates/" + surveyId + "/questions/" + question.id, question)
2643
- .then(function (response) { return response.data; });
2644
- };
2645
- AsyncSurveyServiceImpl.prototype.updateQuestionsOptions = function (surveyId, questions) {
2646
- return this.http
2647
- .put("/surveys/" + surveyId + "/questions/options", questions)
2648
- .then(function (response) { return response.data; });
2649
- };
2650
- AsyncSurveyServiceImpl.prototype.moveQuestion = function (surveyId, questionId, index) {
2651
- return Promise.resolve(this.http.put("/templates/" + surveyId + "/questions/" + questionId + "/move", { index: index }));
2652
- };
2653
- AsyncSurveyServiceImpl.prototype.deleteQuestion = function (surveyId, questionId) {
2654
- return Promise.resolve(this.http.delete("/templates/" + surveyId + "/questions/" + questionId));
2655
- };
2656
- AsyncSurveyServiceImpl.prototype.loadResponse = function (id) {
2657
- return this.http
2658
- .get("/responses/" + id)
2659
- .then(function (response) { return response.data; });
2660
- };
2661
- AsyncSurveyServiceImpl.prototype.dispatchResponse = function (surveyId, response) {
2662
- return this.http
2663
- .post("/surveys/" + surveyId + "/responses", response)
2664
- .then(function (response) { return response.data; });
2665
- };
2666
- AsyncSurveyServiceImpl.prototype.updateResponse = function (response) {
2667
- return this.http
2668
- .put("/responses/" + response.id, response)
2669
- .then(function (response) { return response.data; });
2670
- };
2671
- AsyncSurveyServiceImpl.prototype.loadMyPlans = function (params) {
2672
- return this.http
2673
- .get("/plans/me", { params: params })
2674
- .then(function (response) { return response.data; });
2675
- };
2676
- AsyncSurveyServiceImpl.prototype.loadPlans = function (params) {
2677
- return this.http
2678
- .get("/plans", { params: params })
2679
- .then(function (response) { return response.data; });
2680
- };
2681
- AsyncSurveyServiceImpl.prototype.loadPlanById = function (planId, params) {
2682
- return this.http
2683
- .get("/plan/" + planId, { params: params })
2684
- .then(function (response) { return response.data; });
2685
- };
2686
- AsyncSurveyServiceImpl.prototype.loadPlanWithFiltersById = function (planId, PlanStatisticsModel) {
2687
- return this.http
2688
- .post("/plan/" + planId, __assign({}, PlanStatisticsModel))
2689
- .then(function (response) { return response.data; });
2690
- };
2691
- AsyncSurveyServiceImpl.prototype.loadPlanWithFiltersByIdAndTargetId = function (planId, targetId, PlanStatisticsModel) {
2692
- return this.http
2693
- .post("/plan/" + planId + "/targets/" + targetId, __assign({}, PlanStatisticsModel))
2694
- .then(function (response) { return response.data; });
2695
- };
2696
- AsyncSurveyServiceImpl.prototype.createPlan = function (plan) {
2697
- return this.http.post("/plans", plan).then(function (response) { return response.data; });
2698
- };
2699
- AsyncSurveyServiceImpl.prototype.updatePlan = function (plan) {
2700
- return this.http.put("/plans", plan).then(function (response) { return response.data; });
2701
- };
2702
- AsyncSurveyServiceImpl.prototype.deletePlan = function (id) {
2703
- return this.http.delete("/plans/" + id);
2704
- };
2705
- AsyncSurveyServiceImpl.prototype.dispatchResponses = function (surveyId, respondentId, targets) {
2706
- return this.http.post("/surveys/" + surveyId + "/respondents/" + respondentId + "/responses", { targets: targets });
2707
- };
2708
- AsyncSurveyServiceImpl.prototype.loadResponses = function (params) {
2709
- return this.http
2710
- .get("/responses", { params: params })
2711
- .then(function (response) { return response.data; });
2712
- };
2713
- AsyncSurveyServiceImpl.prototype.loadResponsesPost = function (data) {
2714
- return this.http
2715
- .post("/responses", __assign({}, data))
2716
- .then(function (response) { return response.data; });
2717
- };
2718
- AsyncSurveyServiceImpl.prototype.loadStatisticsByAll = function (surveyId, statistics) {
2719
- return this.http.get("/statistics/" + surveyId, { params: __assign(__assign({}, statistics), { statisticsBy: 'ALL' }) })
2720
- .then(function (response) { return response.data; });
2721
- };
2722
- AsyncSurveyServiceImpl.prototype.loadStatisticsBySurvey = function (surveyId, statistics) {
2723
- return this.http.get("/statistics/" + surveyId, { params: __assign(__assign({}, statistics), { statisticsBy: 'SURVEY' }) })
2724
- .then(function (response) { return response.data; });
2725
- };
2726
- AsyncSurveyServiceImpl.prototype.loadStatisticsByTargets = function (surveyId, statistics) {
2727
- return this.http.get("/statistics/" + surveyId, { params: __assign(__assign({}, statistics), { statisticsBy: 'TARGET' }) })
2728
- .then(function (response) { return response.data; });
2729
- };
2730
- AsyncSurveyServiceImpl.prototype.loadStatisticsWithFiltersByAll = function (surveyId, statistics) {
2731
- return this.http.post("/statistics/" + surveyId, __assign(__assign({}, statistics), { statisticsBy: 'ALL' }))
2732
- .then(function (response) { return response.data; });
2733
- };
2734
- AsyncSurveyServiceImpl.prototype.loadStatisticsWithFiltersBySurvey = function (surveyId, statistics) {
2735
- return this.http.post("/statistics/" + surveyId, __assign(__assign({}, statistics), { statisticsBy: 'SURVEY' }))
2736
- .then(function (response) { return response.data; });
2737
- };
2738
- AsyncSurveyServiceImpl.prototype.loadStatisticsWithFiltersByTargets = function (surveyId, statistics) {
2739
- return this.http.post("/statistics/" + surveyId, __assign(__assign({}, statistics), { statisticsBy: 'TARGET' }))
2740
- .then(function (response) { return response.data; });
2741
- };
2742
- AsyncSurveyServiceImpl.prototype.loadStatisticsBySurveyAndTarget = function (data) {
2743
- return this.http.post("/statistics/targets", data)
2744
- .then(function (response) { return response.data; });
2745
- };
2746
- AsyncSurveyServiceImpl.prototype.loadRespondents = function (params) {
2747
- return this.http
2748
- .get("/respondents", { params: params })
2749
- .then(function (response) { return response.data; });
2750
- };
2751
- AsyncSurveyServiceImpl.prototype.loadRespondentbyPlanAndTarget = function (params) {
2752
- return this.http
2753
- .get("/respondents/target", { params: params })
2754
- .then(function (response) { return response.data; });
2755
- };
2756
- AsyncSurveyServiceImpl.prototype.loadRespondentbyPlanAndTargetAndRespondentIds = function (planId, targetId, respondentIds) {
2757
- return this.http.post("/respondents/target", { planId: planId, targetId: targetId, respondentIds: respondentIds })
2758
- .then(function (response) { return response.data; });
2759
- };
2760
- AsyncSurveyServiceImpl.prototype.get = function (url, params) {
2761
- return this.exhttp.get(url, { params: params })
2762
- .then(function (response) { return response.data; });
2763
- };
2764
- AsyncSurveyServiceImpl.prototype.updatePlanStatistics = function (params) {
2765
- return this.http.put('/statistics', params)
2766
- .then(function (response) { return response.data; });
2767
- };
2768
- AsyncSurveyServiceImpl.prototype.exportPlanStatisticsRawData = function (params) {
2769
- return this.http.put('/statistics/exportRawData', params)
2770
- .then(function (response) { return response.data; });
2771
- };
2772
- return AsyncSurveyServiceImpl;
2773
- }());
2774
- var BlockingSurveyServiceImpl = /** @class */ (function () {
2775
- function BlockingSurveyServiceImpl(asyncSurveyService) {
2776
- this.asyncSurveyService = asyncSurveyService;
2777
- }
2778
- BlockingSurveyServiceImpl.prototype.loadSurvey = function (id) {
2779
- var survey = new SurveyModel();
2780
- survey.id = id;
2781
- return survey;
2782
- };
2783
- BlockingSurveyServiceImpl.prototype.createQuestion = function (surveyId, question) {
2784
- var q = new QuestionModel();
2785
- return q;
2786
- };
2787
- BlockingSurveyServiceImpl.prototype.updateQuestion = function (surveyId, question) {
2788
- var q = new QuestionModel();
2789
- return q;
2790
- };
2791
- BlockingSurveyServiceImpl.prototype.moveQuestion = function (surveyId, questionId, index) {
2792
- };
2793
- BlockingSurveyServiceImpl.prototype.deleteQuestion = function (surveyId, questionId) {
2794
- };
2795
- return BlockingSurveyServiceImpl;
2796
- }());
2797
-
2798
- //todo install options
2799
- // export class SurveyServiceApiOptions implements SurveyServiceOptions{
2800
- //
2801
- // }
2802
- var SurveyServiceApiPlugin = /** @class */ (function () {
2803
- function SurveyServiceApiPlugin() {
2804
- }
2805
- SurveyServiceApiPlugin.install = function (Vue, options) {
2806
- var asyncSurveyService = new AsyncSurveyServiceImpl(options);
2807
- var blockingSurveyService = new BlockingSurveyServiceImpl(asyncSurveyService);
2808
- Vue.prototype.$surveyService = asyncSurveyService;
2809
- Vue.prototype.$asyncSurveyService = asyncSurveyService;
2810
- Vue.prototype.$blockingSurveyService = blockingSurveyService;
2811
- };
2812
- return SurveyServiceApiPlugin;
2813
- }());
2814
-
2815
- return SurveyServiceApiPlugin;
2816
-
2817
- }(Axios, util));