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