@valaxyjs/devtools 0.19.0 → 0.19.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,4918 @@
1
+ import { g as getAppWindow, d as defineComponent, c as computed, o as openBlock, a as createElementBlock, n as normalizeClass, b as createCommentVNode, r as renderSlot, e as ref, f as onMounted, h as createBaseVNode, i as resolveComponent, j as createBlock, w as withCtx, t as toDisplayString, F as Fragment, k as renderList, l as createTextVNode, m as createVNode, p as pageData, q as toRaw, u as unref, s as frontmatter, v as getWindowProperty, x as getGlobalValaxyProperty, y as activePath, z as devtoolsRouter, A as h, B as normalizeStyle, C as isStaticMode } from './index-BIvNeJFh.js';
2
+ import { _ as _export_sfc } from './_plugin-vue_export-helper-DgDhiqFL.js';
3
+
4
+ const target = getAppWindow();
5
+ function openInEditor(options = {}) {
6
+ const { file, line = 0, column = 0 } = options;
7
+ if (file) {
8
+ const baseUrl = window.location.origin;
9
+ target?.__VUE_INSPECTOR__.openInEditor(baseUrl, file, line, column);
10
+ }
11
+ }
12
+
13
+ /* Injected with object hook! */
14
+
15
+ const _sfc_main$7 = /* @__PURE__ */ defineComponent({
16
+ __name: "AGUIButton",
17
+ props: {
18
+ icon: {},
19
+ size: {}
20
+ },
21
+ setup(__props) {
22
+ const props = __props;
23
+ const classes = computed(() => {
24
+ const cls = [];
25
+ if (props.size)
26
+ cls.push(props.size);
27
+ return cls;
28
+ });
29
+ return (_ctx, _cache) => {
30
+ return openBlock(), createElementBlock("button", {
31
+ class: normalizeClass([classes.value, "agui-button"])
32
+ }, [
33
+ _ctx.icon ? (openBlock(), createElementBlock("div", {
34
+ key: 0,
35
+ class: normalizeClass(["mr-1 inline-flex", _ctx.icon])
36
+ }, null, 2)) : createCommentVNode("", true),
37
+ renderSlot(_ctx.$slots, "default")
38
+ ], 2);
39
+ };
40
+ }
41
+ });
42
+
43
+ /* Injected with object hook! */
44
+
45
+ /* Injected with object hook! */
46
+
47
+ const _hoisted_1$6 = {
48
+ key: 0,
49
+ class: "relative flex"
50
+ };
51
+ const _hoisted_2$4 = {
52
+ key: 0,
53
+ class: "absolute"
54
+ };
55
+ const _hoisted_3$3 = { class: "absolute left-1 h-full flex items-center justify-center text-xs op-60" };
56
+ const _hoisted_4$1 = ["value", "placeholder", "autofocus"];
57
+ const _hoisted_5 = ["value", "placeholder"];
58
+ const _sfc_main$6 = /* @__PURE__ */ defineComponent({
59
+ __name: "AGUIInput",
60
+ props: {
61
+ autofocus: { type: Boolean },
62
+ className: {},
63
+ prefixIcon: {},
64
+ modelValue: {},
65
+ placeholder: {}
66
+ },
67
+ emits: ["update:modelValue"],
68
+ setup(__props, { emit: __emit }) {
69
+ const props = __props;
70
+ const emit = __emit;
71
+ function updateModelValue(event) {
72
+ const val = event.target?.value || "";
73
+ emit("update:modelValue", val);
74
+ }
75
+ const inputRef = ref();
76
+ onMounted(async () => {
77
+ if (props.autofocus) {
78
+ setTimeout(() => {
79
+ inputRef.value?.focus();
80
+ }, 1);
81
+ }
82
+ });
83
+ return (_ctx, _cache) => {
84
+ return _ctx.prefixIcon ? (openBlock(), createElementBlock("div", _hoisted_1$6, [
85
+ _ctx.$slots.prefix ? (openBlock(), createElementBlock("div", _hoisted_2$4, [
86
+ renderSlot(_ctx.$slots, "prefix")
87
+ ])) : createCommentVNode("", true),
88
+ createBaseVNode("div", _hoisted_3$3, [
89
+ _ctx.prefixIcon ? (openBlock(), createElementBlock("div", {
90
+ key: 0,
91
+ class: normalizeClass(_ctx.prefixIcon)
92
+ }, null, 2)) : createCommentVNode("", true)
93
+ ]),
94
+ createBaseVNode("input", {
95
+ ref_key: "inputRef",
96
+ ref: inputRef,
97
+ class: normalizeClass(["agui-input w-full px-1 shadow shadow-inset", {
98
+ "pl-5": _ctx.prefixIcon,
99
+ [_ctx.className || ""]: true
100
+ }]),
101
+ value: _ctx.modelValue,
102
+ placeholder: _ctx.placeholder,
103
+ autofocus: _ctx.autofocus,
104
+ onInput: updateModelValue
105
+ }, null, 42, _hoisted_4$1)
106
+ ])) : (openBlock(), createElementBlock("input", {
107
+ key: 1,
108
+ class: "agui-input w-full px-1 shadow shadow-inset",
109
+ value: _ctx.modelValue,
110
+ placeholder: _ctx.placeholder,
111
+ onInput: updateModelValue
112
+ }, null, 40, _hoisted_5));
113
+ };
114
+ }
115
+ });
116
+
117
+ /* Injected with object hook! */
118
+
119
+ /* Injected with object hook! */
120
+
121
+ const _hoisted_1$5 = /* @__PURE__ */ createBaseVNode("div", {
122
+ m: "x-1",
123
+ "inline-flex": "",
124
+ "i-ri-folder-2-line": ""
125
+ }, null, -1);
126
+ const _sfc_main$5 = /* @__PURE__ */ defineComponent({
127
+ __name: "VDPostCategories",
128
+ props: {
129
+ categories: {}
130
+ },
131
+ setup(__props) {
132
+ return (_ctx, _cache) => {
133
+ const _component_RouterLink = resolveComponent("RouterLink");
134
+ return openBlock(), createBlock(_component_RouterLink, {
135
+ to: {
136
+ path: "/categories",
137
+ query: { category: Array.isArray(_ctx.categories) ? _ctx.categories.join("/") : _ctx.categories }
138
+ },
139
+ class: "post-category transition text-xs hover:(text-blue-500 border-blue-500)",
140
+ "px-2": "",
141
+ "py-1": "",
142
+ border: "",
143
+ "rounded-full": "",
144
+ "inline-flex": "",
145
+ "justify-center": "",
146
+ "items-center": "",
147
+ bg: "hover:(blue-500 opacity-10)"
148
+ }, {
149
+ default: withCtx(() => [
150
+ _hoisted_1$5,
151
+ createBaseVNode("span", null, toDisplayString(Array.isArray(_ctx.categories) ? _ctx.categories.join(" > ") : _ctx.categories), 1)
152
+ ]),
153
+ _: 1
154
+ }, 8, ["to"]);
155
+ };
156
+ }
157
+ });
158
+
159
+ /* Injected with object hook! */
160
+
161
+ /* unplugin-vue-components disabled */const _sfc_main$4 = {};
162
+
163
+ const _hoisted_1$4 = {
164
+ class: "vd-tag inline-flex shadow border rounded text-xs",
165
+ p: "x-2 y-1"
166
+ };
167
+
168
+ function _sfc_render(_ctx, _cache) {
169
+ return (openBlock(), createElementBlock("div", _hoisted_1$4, [
170
+ renderSlot(_ctx.$slots, "default")
171
+ ]))
172
+ }
173
+ const __unplugin_components_0 = /*#__PURE__*/_export_sfc(_sfc_main$4, [['render',_sfc_render]]);
174
+ /* Injected with object hook! */
175
+
176
+ function bind(fn, thisArg) {
177
+ return function wrap() {
178
+ return fn.apply(thisArg, arguments);
179
+ };
180
+ }
181
+
182
+ /* Injected with object hook! */
183
+
184
+ // utils is a library of generic helper functions non-specific to axios
185
+
186
+ const {toString} = Object.prototype;
187
+ const {getPrototypeOf} = Object;
188
+
189
+ const kindOf = (cache => thing => {
190
+ const str = toString.call(thing);
191
+ return cache[str] || (cache[str] = str.slice(8, -1).toLowerCase());
192
+ })(Object.create(null));
193
+
194
+ const kindOfTest = (type) => {
195
+ type = type.toLowerCase();
196
+ return (thing) => kindOf(thing) === type
197
+ };
198
+
199
+ const typeOfTest = type => thing => typeof thing === type;
200
+
201
+ /**
202
+ * Determine if a value is an Array
203
+ *
204
+ * @param {Object} val The value to test
205
+ *
206
+ * @returns {boolean} True if value is an Array, otherwise false
207
+ */
208
+ const {isArray} = Array;
209
+
210
+ /**
211
+ * Determine if a value is undefined
212
+ *
213
+ * @param {*} val The value to test
214
+ *
215
+ * @returns {boolean} True if the value is undefined, otherwise false
216
+ */
217
+ const isUndefined = typeOfTest('undefined');
218
+
219
+ /**
220
+ * Determine if a value is a Buffer
221
+ *
222
+ * @param {*} val The value to test
223
+ *
224
+ * @returns {boolean} True if value is a Buffer, otherwise false
225
+ */
226
+ function isBuffer(val) {
227
+ return val !== null && !isUndefined(val) && val.constructor !== null && !isUndefined(val.constructor)
228
+ && isFunction(val.constructor.isBuffer) && val.constructor.isBuffer(val);
229
+ }
230
+
231
+ /**
232
+ * Determine if a value is an ArrayBuffer
233
+ *
234
+ * @param {*} val The value to test
235
+ *
236
+ * @returns {boolean} True if value is an ArrayBuffer, otherwise false
237
+ */
238
+ const isArrayBuffer = kindOfTest('ArrayBuffer');
239
+
240
+
241
+ /**
242
+ * Determine if a value is a view on an ArrayBuffer
243
+ *
244
+ * @param {*} val The value to test
245
+ *
246
+ * @returns {boolean} True if value is a view on an ArrayBuffer, otherwise false
247
+ */
248
+ function isArrayBufferView(val) {
249
+ let result;
250
+ if ((typeof ArrayBuffer !== 'undefined') && (ArrayBuffer.isView)) {
251
+ result = ArrayBuffer.isView(val);
252
+ } else {
253
+ result = (val) && (val.buffer) && (isArrayBuffer(val.buffer));
254
+ }
255
+ return result;
256
+ }
257
+
258
+ /**
259
+ * Determine if a value is a String
260
+ *
261
+ * @param {*} val The value to test
262
+ *
263
+ * @returns {boolean} True if value is a String, otherwise false
264
+ */
265
+ const isString = typeOfTest('string');
266
+
267
+ /**
268
+ * Determine if a value is a Function
269
+ *
270
+ * @param {*} val The value to test
271
+ * @returns {boolean} True if value is a Function, otherwise false
272
+ */
273
+ const isFunction = typeOfTest('function');
274
+
275
+ /**
276
+ * Determine if a value is a Number
277
+ *
278
+ * @param {*} val The value to test
279
+ *
280
+ * @returns {boolean} True if value is a Number, otherwise false
281
+ */
282
+ const isNumber = typeOfTest('number');
283
+
284
+ /**
285
+ * Determine if a value is an Object
286
+ *
287
+ * @param {*} thing The value to test
288
+ *
289
+ * @returns {boolean} True if value is an Object, otherwise false
290
+ */
291
+ const isObject$1 = (thing) => thing !== null && typeof thing === 'object';
292
+
293
+ /**
294
+ * Determine if a value is a Boolean
295
+ *
296
+ * @param {*} thing The value to test
297
+ * @returns {boolean} True if value is a Boolean, otherwise false
298
+ */
299
+ const isBoolean = thing => thing === true || thing === false;
300
+
301
+ /**
302
+ * Determine if a value is a plain Object
303
+ *
304
+ * @param {*} val The value to test
305
+ *
306
+ * @returns {boolean} True if value is a plain Object, otherwise false
307
+ */
308
+ const isPlainObject$1 = (val) => {
309
+ if (kindOf(val) !== 'object') {
310
+ return false;
311
+ }
312
+
313
+ const prototype = getPrototypeOf(val);
314
+ return (prototype === null || prototype === Object.prototype || Object.getPrototypeOf(prototype) === null) && !(Symbol.toStringTag in val) && !(Symbol.iterator in val);
315
+ };
316
+
317
+ /**
318
+ * Determine if a value is a Date
319
+ *
320
+ * @param {*} val The value to test
321
+ *
322
+ * @returns {boolean} True if value is a Date, otherwise false
323
+ */
324
+ const isDate = kindOfTest('Date');
325
+
326
+ /**
327
+ * Determine if a value is a File
328
+ *
329
+ * @param {*} val The value to test
330
+ *
331
+ * @returns {boolean} True if value is a File, otherwise false
332
+ */
333
+ const isFile = kindOfTest('File');
334
+
335
+ /**
336
+ * Determine if a value is a Blob
337
+ *
338
+ * @param {*} val The value to test
339
+ *
340
+ * @returns {boolean} True if value is a Blob, otherwise false
341
+ */
342
+ const isBlob = kindOfTest('Blob');
343
+
344
+ /**
345
+ * Determine if a value is a FileList
346
+ *
347
+ * @param {*} val The value to test
348
+ *
349
+ * @returns {boolean} True if value is a File, otherwise false
350
+ */
351
+ const isFileList = kindOfTest('FileList');
352
+
353
+ /**
354
+ * Determine if a value is a Stream
355
+ *
356
+ * @param {*} val The value to test
357
+ *
358
+ * @returns {boolean} True if value is a Stream, otherwise false
359
+ */
360
+ const isStream = (val) => isObject$1(val) && isFunction(val.pipe);
361
+
362
+ /**
363
+ * Determine if a value is a FormData
364
+ *
365
+ * @param {*} thing The value to test
366
+ *
367
+ * @returns {boolean} True if value is an FormData, otherwise false
368
+ */
369
+ const isFormData = (thing) => {
370
+ let kind;
371
+ return thing && (
372
+ (typeof FormData === 'function' && thing instanceof FormData) || (
373
+ isFunction(thing.append) && (
374
+ (kind = kindOf(thing)) === 'formdata' ||
375
+ // detect form-data instance
376
+ (kind === 'object' && isFunction(thing.toString) && thing.toString() === '[object FormData]')
377
+ )
378
+ )
379
+ )
380
+ };
381
+
382
+ /**
383
+ * Determine if a value is a URLSearchParams object
384
+ *
385
+ * @param {*} val The value to test
386
+ *
387
+ * @returns {boolean} True if value is a URLSearchParams object, otherwise false
388
+ */
389
+ const isURLSearchParams = kindOfTest('URLSearchParams');
390
+
391
+ const [isReadableStream, isRequest, isResponse, isHeaders] = ['ReadableStream', 'Request', 'Response', 'Headers'].map(kindOfTest);
392
+
393
+ /**
394
+ * Trim excess whitespace off the beginning and end of a string
395
+ *
396
+ * @param {String} str The String to trim
397
+ *
398
+ * @returns {String} The String freed of excess whitespace
399
+ */
400
+ const trim = (str) => str.trim ?
401
+ str.trim() : str.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, '');
402
+
403
+ /**
404
+ * Iterate over an Array or an Object invoking a function for each item.
405
+ *
406
+ * If `obj` is an Array callback will be called passing
407
+ * the value, index, and complete array for each item.
408
+ *
409
+ * If 'obj' is an Object callback will be called passing
410
+ * the value, key, and complete object for each property.
411
+ *
412
+ * @param {Object|Array} obj The object to iterate
413
+ * @param {Function} fn The callback to invoke for each item
414
+ *
415
+ * @param {Boolean} [allOwnKeys = false]
416
+ * @returns {any}
417
+ */
418
+ function forEach(obj, fn, {allOwnKeys = false} = {}) {
419
+ // Don't bother if no value provided
420
+ if (obj === null || typeof obj === 'undefined') {
421
+ return;
422
+ }
423
+
424
+ let i;
425
+ let l;
426
+
427
+ // Force an array if not already something iterable
428
+ if (typeof obj !== 'object') {
429
+ /*eslint no-param-reassign:0*/
430
+ obj = [obj];
431
+ }
432
+
433
+ if (isArray(obj)) {
434
+ // Iterate over array values
435
+ for (i = 0, l = obj.length; i < l; i++) {
436
+ fn.call(null, obj[i], i, obj);
437
+ }
438
+ } else {
439
+ // Iterate over object keys
440
+ const keys = allOwnKeys ? Object.getOwnPropertyNames(obj) : Object.keys(obj);
441
+ const len = keys.length;
442
+ let key;
443
+
444
+ for (i = 0; i < len; i++) {
445
+ key = keys[i];
446
+ fn.call(null, obj[key], key, obj);
447
+ }
448
+ }
449
+ }
450
+
451
+ function findKey(obj, key) {
452
+ key = key.toLowerCase();
453
+ const keys = Object.keys(obj);
454
+ let i = keys.length;
455
+ let _key;
456
+ while (i-- > 0) {
457
+ _key = keys[i];
458
+ if (key === _key.toLowerCase()) {
459
+ return _key;
460
+ }
461
+ }
462
+ return null;
463
+ }
464
+
465
+ const _global = (() => {
466
+ /*eslint no-undef:0*/
467
+ if (typeof globalThis !== "undefined") return globalThis;
468
+ return typeof self !== "undefined" ? self : (typeof window !== 'undefined' ? window : global)
469
+ })();
470
+
471
+ const isContextDefined = (context) => !isUndefined(context) && context !== _global;
472
+
473
+ /**
474
+ * Accepts varargs expecting each argument to be an object, then
475
+ * immutably merges the properties of each object and returns result.
476
+ *
477
+ * When multiple objects contain the same key the later object in
478
+ * the arguments list will take precedence.
479
+ *
480
+ * Example:
481
+ *
482
+ * ```js
483
+ * var result = merge({foo: 123}, {foo: 456});
484
+ * console.log(result.foo); // outputs 456
485
+ * ```
486
+ *
487
+ * @param {Object} obj1 Object to merge
488
+ *
489
+ * @returns {Object} Result of all merge properties
490
+ */
491
+ function merge(/* obj1, obj2, obj3, ... */) {
492
+ const {caseless} = isContextDefined(this) && this || {};
493
+ const result = {};
494
+ const assignValue = (val, key) => {
495
+ const targetKey = caseless && findKey(result, key) || key;
496
+ if (isPlainObject$1(result[targetKey]) && isPlainObject$1(val)) {
497
+ result[targetKey] = merge(result[targetKey], val);
498
+ } else if (isPlainObject$1(val)) {
499
+ result[targetKey] = merge({}, val);
500
+ } else if (isArray(val)) {
501
+ result[targetKey] = val.slice();
502
+ } else {
503
+ result[targetKey] = val;
504
+ }
505
+ };
506
+
507
+ for (let i = 0, l = arguments.length; i < l; i++) {
508
+ arguments[i] && forEach(arguments[i], assignValue);
509
+ }
510
+ return result;
511
+ }
512
+
513
+ /**
514
+ * Extends object a by mutably adding to it the properties of object b.
515
+ *
516
+ * @param {Object} a The object to be extended
517
+ * @param {Object} b The object to copy properties from
518
+ * @param {Object} thisArg The object to bind function to
519
+ *
520
+ * @param {Boolean} [allOwnKeys]
521
+ * @returns {Object} The resulting value of object a
522
+ */
523
+ const extend = (a, b, thisArg, {allOwnKeys}= {}) => {
524
+ forEach(b, (val, key) => {
525
+ if (thisArg && isFunction(val)) {
526
+ a[key] = bind(val, thisArg);
527
+ } else {
528
+ a[key] = val;
529
+ }
530
+ }, {allOwnKeys});
531
+ return a;
532
+ };
533
+
534
+ /**
535
+ * Remove byte order marker. This catches EF BB BF (the UTF-8 BOM)
536
+ *
537
+ * @param {string} content with BOM
538
+ *
539
+ * @returns {string} content value without BOM
540
+ */
541
+ const stripBOM = (content) => {
542
+ if (content.charCodeAt(0) === 0xFEFF) {
543
+ content = content.slice(1);
544
+ }
545
+ return content;
546
+ };
547
+
548
+ /**
549
+ * Inherit the prototype methods from one constructor into another
550
+ * @param {function} constructor
551
+ * @param {function} superConstructor
552
+ * @param {object} [props]
553
+ * @param {object} [descriptors]
554
+ *
555
+ * @returns {void}
556
+ */
557
+ const inherits = (constructor, superConstructor, props, descriptors) => {
558
+ constructor.prototype = Object.create(superConstructor.prototype, descriptors);
559
+ constructor.prototype.constructor = constructor;
560
+ Object.defineProperty(constructor, 'super', {
561
+ value: superConstructor.prototype
562
+ });
563
+ props && Object.assign(constructor.prototype, props);
564
+ };
565
+
566
+ /**
567
+ * Resolve object with deep prototype chain to a flat object
568
+ * @param {Object} sourceObj source object
569
+ * @param {Object} [destObj]
570
+ * @param {Function|Boolean} [filter]
571
+ * @param {Function} [propFilter]
572
+ *
573
+ * @returns {Object}
574
+ */
575
+ const toFlatObject = (sourceObj, destObj, filter, propFilter) => {
576
+ let props;
577
+ let i;
578
+ let prop;
579
+ const merged = {};
580
+
581
+ destObj = destObj || {};
582
+ // eslint-disable-next-line no-eq-null,eqeqeq
583
+ if (sourceObj == null) return destObj;
584
+
585
+ do {
586
+ props = Object.getOwnPropertyNames(sourceObj);
587
+ i = props.length;
588
+ while (i-- > 0) {
589
+ prop = props[i];
590
+ if ((!propFilter || propFilter(prop, sourceObj, destObj)) && !merged[prop]) {
591
+ destObj[prop] = sourceObj[prop];
592
+ merged[prop] = true;
593
+ }
594
+ }
595
+ sourceObj = filter !== false && getPrototypeOf(sourceObj);
596
+ } while (sourceObj && (!filter || filter(sourceObj, destObj)) && sourceObj !== Object.prototype);
597
+
598
+ return destObj;
599
+ };
600
+
601
+ /**
602
+ * Determines whether a string ends with the characters of a specified string
603
+ *
604
+ * @param {String} str
605
+ * @param {String} searchString
606
+ * @param {Number} [position= 0]
607
+ *
608
+ * @returns {boolean}
609
+ */
610
+ const endsWith = (str, searchString, position) => {
611
+ str = String(str);
612
+ if (position === undefined || position > str.length) {
613
+ position = str.length;
614
+ }
615
+ position -= searchString.length;
616
+ const lastIndex = str.indexOf(searchString, position);
617
+ return lastIndex !== -1 && lastIndex === position;
618
+ };
619
+
620
+
621
+ /**
622
+ * Returns new array from array like object or null if failed
623
+ *
624
+ * @param {*} [thing]
625
+ *
626
+ * @returns {?Array}
627
+ */
628
+ const toArray = (thing) => {
629
+ if (!thing) return null;
630
+ if (isArray(thing)) return thing;
631
+ let i = thing.length;
632
+ if (!isNumber(i)) return null;
633
+ const arr = new Array(i);
634
+ while (i-- > 0) {
635
+ arr[i] = thing[i];
636
+ }
637
+ return arr;
638
+ };
639
+
640
+ /**
641
+ * Checking if the Uint8Array exists and if it does, it returns a function that checks if the
642
+ * thing passed in is an instance of Uint8Array
643
+ *
644
+ * @param {TypedArray}
645
+ *
646
+ * @returns {Array}
647
+ */
648
+ // eslint-disable-next-line func-names
649
+ const isTypedArray = (TypedArray => {
650
+ // eslint-disable-next-line func-names
651
+ return thing => {
652
+ return TypedArray && thing instanceof TypedArray;
653
+ };
654
+ })(typeof Uint8Array !== 'undefined' && getPrototypeOf(Uint8Array));
655
+
656
+ /**
657
+ * For each entry in the object, call the function with the key and value.
658
+ *
659
+ * @param {Object<any, any>} obj - The object to iterate over.
660
+ * @param {Function} fn - The function to call for each entry.
661
+ *
662
+ * @returns {void}
663
+ */
664
+ const forEachEntry = (obj, fn) => {
665
+ const generator = obj && obj[Symbol.iterator];
666
+
667
+ const iterator = generator.call(obj);
668
+
669
+ let result;
670
+
671
+ while ((result = iterator.next()) && !result.done) {
672
+ const pair = result.value;
673
+ fn.call(obj, pair[0], pair[1]);
674
+ }
675
+ };
676
+
677
+ /**
678
+ * It takes a regular expression and a string, and returns an array of all the matches
679
+ *
680
+ * @param {string} regExp - The regular expression to match against.
681
+ * @param {string} str - The string to search.
682
+ *
683
+ * @returns {Array<boolean>}
684
+ */
685
+ const matchAll = (regExp, str) => {
686
+ let matches;
687
+ const arr = [];
688
+
689
+ while ((matches = regExp.exec(str)) !== null) {
690
+ arr.push(matches);
691
+ }
692
+
693
+ return arr;
694
+ };
695
+
696
+ /* Checking if the kindOfTest function returns true when passed an HTMLFormElement. */
697
+ const isHTMLForm = kindOfTest('HTMLFormElement');
698
+
699
+ const toCamelCase = str => {
700
+ return str.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,
701
+ function replacer(m, p1, p2) {
702
+ return p1.toUpperCase() + p2;
703
+ }
704
+ );
705
+ };
706
+
707
+ /* Creating a function that will check if an object has a property. */
708
+ const hasOwnProperty = (({hasOwnProperty}) => (obj, prop) => hasOwnProperty.call(obj, prop))(Object.prototype);
709
+
710
+ /**
711
+ * Determine if a value is a RegExp object
712
+ *
713
+ * @param {*} val The value to test
714
+ *
715
+ * @returns {boolean} True if value is a RegExp object, otherwise false
716
+ */
717
+ const isRegExp = kindOfTest('RegExp');
718
+
719
+ const reduceDescriptors = (obj, reducer) => {
720
+ const descriptors = Object.getOwnPropertyDescriptors(obj);
721
+ const reducedDescriptors = {};
722
+
723
+ forEach(descriptors, (descriptor, name) => {
724
+ let ret;
725
+ if ((ret = reducer(descriptor, name, obj)) !== false) {
726
+ reducedDescriptors[name] = ret || descriptor;
727
+ }
728
+ });
729
+
730
+ Object.defineProperties(obj, reducedDescriptors);
731
+ };
732
+
733
+ /**
734
+ * Makes all methods read-only
735
+ * @param {Object} obj
736
+ */
737
+
738
+ const freezeMethods = (obj) => {
739
+ reduceDescriptors(obj, (descriptor, name) => {
740
+ // skip restricted props in strict mode
741
+ if (isFunction(obj) && ['arguments', 'caller', 'callee'].indexOf(name) !== -1) {
742
+ return false;
743
+ }
744
+
745
+ const value = obj[name];
746
+
747
+ if (!isFunction(value)) return;
748
+
749
+ descriptor.enumerable = false;
750
+
751
+ if ('writable' in descriptor) {
752
+ descriptor.writable = false;
753
+ return;
754
+ }
755
+
756
+ if (!descriptor.set) {
757
+ descriptor.set = () => {
758
+ throw Error('Can not rewrite read-only method \'' + name + '\'');
759
+ };
760
+ }
761
+ });
762
+ };
763
+
764
+ const toObjectSet = (arrayOrString, delimiter) => {
765
+ const obj = {};
766
+
767
+ const define = (arr) => {
768
+ arr.forEach(value => {
769
+ obj[value] = true;
770
+ });
771
+ };
772
+
773
+ isArray(arrayOrString) ? define(arrayOrString) : define(String(arrayOrString).split(delimiter));
774
+
775
+ return obj;
776
+ };
777
+
778
+ const noop = () => {};
779
+
780
+ const toFiniteNumber = (value, defaultValue) => {
781
+ return value != null && Number.isFinite(value = +value) ? value : defaultValue;
782
+ };
783
+
784
+ const ALPHA = 'abcdefghijklmnopqrstuvwxyz';
785
+
786
+ const DIGIT = '0123456789';
787
+
788
+ const ALPHABET = {
789
+ DIGIT,
790
+ ALPHA,
791
+ ALPHA_DIGIT: ALPHA + ALPHA.toUpperCase() + DIGIT
792
+ };
793
+
794
+ const generateString = (size = 16, alphabet = ALPHABET.ALPHA_DIGIT) => {
795
+ let str = '';
796
+ const {length} = alphabet;
797
+ while (size--) {
798
+ str += alphabet[Math.random() * length|0];
799
+ }
800
+
801
+ return str;
802
+ };
803
+
804
+ /**
805
+ * If the thing is a FormData object, return true, otherwise return false.
806
+ *
807
+ * @param {unknown} thing - The thing to check.
808
+ *
809
+ * @returns {boolean}
810
+ */
811
+ function isSpecCompliantForm(thing) {
812
+ return !!(thing && isFunction(thing.append) && thing[Symbol.toStringTag] === 'FormData' && thing[Symbol.iterator]);
813
+ }
814
+
815
+ const toJSONObject = (obj) => {
816
+ const stack = new Array(10);
817
+
818
+ const visit = (source, i) => {
819
+
820
+ if (isObject$1(source)) {
821
+ if (stack.indexOf(source) >= 0) {
822
+ return;
823
+ }
824
+
825
+ if(!('toJSON' in source)) {
826
+ stack[i] = source;
827
+ const target = isArray(source) ? [] : {};
828
+
829
+ forEach(source, (value, key) => {
830
+ const reducedValue = visit(value, i + 1);
831
+ !isUndefined(reducedValue) && (target[key] = reducedValue);
832
+ });
833
+
834
+ stack[i] = undefined;
835
+
836
+ return target;
837
+ }
838
+ }
839
+
840
+ return source;
841
+ };
842
+
843
+ return visit(obj, 0);
844
+ };
845
+
846
+ const isAsyncFn = kindOfTest('AsyncFunction');
847
+
848
+ const isThenable = (thing) =>
849
+ thing && (isObject$1(thing) || isFunction(thing)) && isFunction(thing.then) && isFunction(thing.catch);
850
+
851
+ const utils$1 = {
852
+ isArray,
853
+ isArrayBuffer,
854
+ isBuffer,
855
+ isFormData,
856
+ isArrayBufferView,
857
+ isString,
858
+ isNumber,
859
+ isBoolean,
860
+ isObject: isObject$1,
861
+ isPlainObject: isPlainObject$1,
862
+ isReadableStream,
863
+ isRequest,
864
+ isResponse,
865
+ isHeaders,
866
+ isUndefined,
867
+ isDate,
868
+ isFile,
869
+ isBlob,
870
+ isRegExp,
871
+ isFunction,
872
+ isStream,
873
+ isURLSearchParams,
874
+ isTypedArray,
875
+ isFileList,
876
+ forEach,
877
+ merge,
878
+ extend,
879
+ trim,
880
+ stripBOM,
881
+ inherits,
882
+ toFlatObject,
883
+ kindOf,
884
+ kindOfTest,
885
+ endsWith,
886
+ toArray,
887
+ forEachEntry,
888
+ matchAll,
889
+ isHTMLForm,
890
+ hasOwnProperty,
891
+ hasOwnProp: hasOwnProperty, // an alias to avoid ESLint no-prototype-builtins detection
892
+ reduceDescriptors,
893
+ freezeMethods,
894
+ toObjectSet,
895
+ toCamelCase,
896
+ noop,
897
+ toFiniteNumber,
898
+ findKey,
899
+ global: _global,
900
+ isContextDefined,
901
+ ALPHABET,
902
+ generateString,
903
+ isSpecCompliantForm,
904
+ toJSONObject,
905
+ isAsyncFn,
906
+ isThenable
907
+ };
908
+
909
+ /* Injected with object hook! */
910
+
911
+ /**
912
+ * Create an Error with the specified message, config, error code, request and response.
913
+ *
914
+ * @param {string} message The error message.
915
+ * @param {string} [code] The error code (for example, 'ECONNABORTED').
916
+ * @param {Object} [config] The config.
917
+ * @param {Object} [request] The request.
918
+ * @param {Object} [response] The response.
919
+ *
920
+ * @returns {Error} The created error.
921
+ */
922
+ function AxiosError(message, code, config, request, response) {
923
+ Error.call(this);
924
+
925
+ if (Error.captureStackTrace) {
926
+ Error.captureStackTrace(this, this.constructor);
927
+ } else {
928
+ this.stack = (new Error()).stack;
929
+ }
930
+
931
+ this.message = message;
932
+ this.name = 'AxiosError';
933
+ code && (this.code = code);
934
+ config && (this.config = config);
935
+ request && (this.request = request);
936
+ response && (this.response = response);
937
+ }
938
+
939
+ utils$1.inherits(AxiosError, Error, {
940
+ toJSON: function toJSON() {
941
+ return {
942
+ // Standard
943
+ message: this.message,
944
+ name: this.name,
945
+ // Microsoft
946
+ description: this.description,
947
+ number: this.number,
948
+ // Mozilla
949
+ fileName: this.fileName,
950
+ lineNumber: this.lineNumber,
951
+ columnNumber: this.columnNumber,
952
+ stack: this.stack,
953
+ // Axios
954
+ config: utils$1.toJSONObject(this.config),
955
+ code: this.code,
956
+ status: this.response && this.response.status ? this.response.status : null
957
+ };
958
+ }
959
+ });
960
+
961
+ const prototype$1 = AxiosError.prototype;
962
+ const descriptors = {};
963
+
964
+ [
965
+ 'ERR_BAD_OPTION_VALUE',
966
+ 'ERR_BAD_OPTION',
967
+ 'ECONNABORTED',
968
+ 'ETIMEDOUT',
969
+ 'ERR_NETWORK',
970
+ 'ERR_FR_TOO_MANY_REDIRECTS',
971
+ 'ERR_DEPRECATED',
972
+ 'ERR_BAD_RESPONSE',
973
+ 'ERR_BAD_REQUEST',
974
+ 'ERR_CANCELED',
975
+ 'ERR_NOT_SUPPORT',
976
+ 'ERR_INVALID_URL'
977
+ // eslint-disable-next-line func-names
978
+ ].forEach(code => {
979
+ descriptors[code] = {value: code};
980
+ });
981
+
982
+ Object.defineProperties(AxiosError, descriptors);
983
+ Object.defineProperty(prototype$1, 'isAxiosError', {value: true});
984
+
985
+ // eslint-disable-next-line func-names
986
+ AxiosError.from = (error, code, config, request, response, customProps) => {
987
+ const axiosError = Object.create(prototype$1);
988
+
989
+ utils$1.toFlatObject(error, axiosError, function filter(obj) {
990
+ return obj !== Error.prototype;
991
+ }, prop => {
992
+ return prop !== 'isAxiosError';
993
+ });
994
+
995
+ AxiosError.call(axiosError, error.message, code, config, request, response);
996
+
997
+ axiosError.cause = error;
998
+
999
+ axiosError.name = error.name;
1000
+
1001
+ customProps && Object.assign(axiosError, customProps);
1002
+
1003
+ return axiosError;
1004
+ };
1005
+
1006
+ /* Injected with object hook! */
1007
+
1008
+ // eslint-disable-next-line strict
1009
+ const httpAdapter = null;
1010
+
1011
+ /* Injected with object hook! */
1012
+
1013
+ /**
1014
+ * Determines if the given thing is a array or js object.
1015
+ *
1016
+ * @param {string} thing - The object or array to be visited.
1017
+ *
1018
+ * @returns {boolean}
1019
+ */
1020
+ function isVisitable(thing) {
1021
+ return utils$1.isPlainObject(thing) || utils$1.isArray(thing);
1022
+ }
1023
+
1024
+ /**
1025
+ * It removes the brackets from the end of a string
1026
+ *
1027
+ * @param {string} key - The key of the parameter.
1028
+ *
1029
+ * @returns {string} the key without the brackets.
1030
+ */
1031
+ function removeBrackets(key) {
1032
+ return utils$1.endsWith(key, '[]') ? key.slice(0, -2) : key;
1033
+ }
1034
+
1035
+ /**
1036
+ * It takes a path, a key, and a boolean, and returns a string
1037
+ *
1038
+ * @param {string} path - The path to the current key.
1039
+ * @param {string} key - The key of the current object being iterated over.
1040
+ * @param {string} dots - If true, the key will be rendered with dots instead of brackets.
1041
+ *
1042
+ * @returns {string} The path to the current key.
1043
+ */
1044
+ function renderKey(path, key, dots) {
1045
+ if (!path) return key;
1046
+ return path.concat(key).map(function each(token, i) {
1047
+ // eslint-disable-next-line no-param-reassign
1048
+ token = removeBrackets(token);
1049
+ return !dots && i ? '[' + token + ']' : token;
1050
+ }).join(dots ? '.' : '');
1051
+ }
1052
+
1053
+ /**
1054
+ * If the array is an array and none of its elements are visitable, then it's a flat array.
1055
+ *
1056
+ * @param {Array<any>} arr - The array to check
1057
+ *
1058
+ * @returns {boolean}
1059
+ */
1060
+ function isFlatArray(arr) {
1061
+ return utils$1.isArray(arr) && !arr.some(isVisitable);
1062
+ }
1063
+
1064
+ const predicates = utils$1.toFlatObject(utils$1, {}, null, function filter(prop) {
1065
+ return /^is[A-Z]/.test(prop);
1066
+ });
1067
+
1068
+ /**
1069
+ * Convert a data object to FormData
1070
+ *
1071
+ * @param {Object} obj
1072
+ * @param {?Object} [formData]
1073
+ * @param {?Object} [options]
1074
+ * @param {Function} [options.visitor]
1075
+ * @param {Boolean} [options.metaTokens = true]
1076
+ * @param {Boolean} [options.dots = false]
1077
+ * @param {?Boolean} [options.indexes = false]
1078
+ *
1079
+ * @returns {Object}
1080
+ **/
1081
+
1082
+ /**
1083
+ * It converts an object into a FormData object
1084
+ *
1085
+ * @param {Object<any, any>} obj - The object to convert to form data.
1086
+ * @param {string} formData - The FormData object to append to.
1087
+ * @param {Object<string, any>} options
1088
+ *
1089
+ * @returns
1090
+ */
1091
+ function toFormData(obj, formData, options) {
1092
+ if (!utils$1.isObject(obj)) {
1093
+ throw new TypeError('target must be an object');
1094
+ }
1095
+
1096
+ // eslint-disable-next-line no-param-reassign
1097
+ formData = formData || new (FormData)();
1098
+
1099
+ // eslint-disable-next-line no-param-reassign
1100
+ options = utils$1.toFlatObject(options, {
1101
+ metaTokens: true,
1102
+ dots: false,
1103
+ indexes: false
1104
+ }, false, function defined(option, source) {
1105
+ // eslint-disable-next-line no-eq-null,eqeqeq
1106
+ return !utils$1.isUndefined(source[option]);
1107
+ });
1108
+
1109
+ const metaTokens = options.metaTokens;
1110
+ // eslint-disable-next-line no-use-before-define
1111
+ const visitor = options.visitor || defaultVisitor;
1112
+ const dots = options.dots;
1113
+ const indexes = options.indexes;
1114
+ const _Blob = options.Blob || typeof Blob !== 'undefined' && Blob;
1115
+ const useBlob = _Blob && utils$1.isSpecCompliantForm(formData);
1116
+
1117
+ if (!utils$1.isFunction(visitor)) {
1118
+ throw new TypeError('visitor must be a function');
1119
+ }
1120
+
1121
+ function convertValue(value) {
1122
+ if (value === null) return '';
1123
+
1124
+ if (utils$1.isDate(value)) {
1125
+ return value.toISOString();
1126
+ }
1127
+
1128
+ if (!useBlob && utils$1.isBlob(value)) {
1129
+ throw new AxiosError('Blob is not supported. Use a Buffer instead.');
1130
+ }
1131
+
1132
+ if (utils$1.isArrayBuffer(value) || utils$1.isTypedArray(value)) {
1133
+ return useBlob && typeof Blob === 'function' ? new Blob([value]) : Buffer.from(value);
1134
+ }
1135
+
1136
+ return value;
1137
+ }
1138
+
1139
+ /**
1140
+ * Default visitor.
1141
+ *
1142
+ * @param {*} value
1143
+ * @param {String|Number} key
1144
+ * @param {Array<String|Number>} path
1145
+ * @this {FormData}
1146
+ *
1147
+ * @returns {boolean} return true to visit the each prop of the value recursively
1148
+ */
1149
+ function defaultVisitor(value, key, path) {
1150
+ let arr = value;
1151
+
1152
+ if (value && !path && typeof value === 'object') {
1153
+ if (utils$1.endsWith(key, '{}')) {
1154
+ // eslint-disable-next-line no-param-reassign
1155
+ key = metaTokens ? key : key.slice(0, -2);
1156
+ // eslint-disable-next-line no-param-reassign
1157
+ value = JSON.stringify(value);
1158
+ } else if (
1159
+ (utils$1.isArray(value) && isFlatArray(value)) ||
1160
+ ((utils$1.isFileList(value) || utils$1.endsWith(key, '[]')) && (arr = utils$1.toArray(value))
1161
+ )) {
1162
+ // eslint-disable-next-line no-param-reassign
1163
+ key = removeBrackets(key);
1164
+
1165
+ arr.forEach(function each(el, index) {
1166
+ !(utils$1.isUndefined(el) || el === null) && formData.append(
1167
+ // eslint-disable-next-line no-nested-ternary
1168
+ indexes === true ? renderKey([key], index, dots) : (indexes === null ? key : key + '[]'),
1169
+ convertValue(el)
1170
+ );
1171
+ });
1172
+ return false;
1173
+ }
1174
+ }
1175
+
1176
+ if (isVisitable(value)) {
1177
+ return true;
1178
+ }
1179
+
1180
+ formData.append(renderKey(path, key, dots), convertValue(value));
1181
+
1182
+ return false;
1183
+ }
1184
+
1185
+ const stack = [];
1186
+
1187
+ const exposedHelpers = Object.assign(predicates, {
1188
+ defaultVisitor,
1189
+ convertValue,
1190
+ isVisitable
1191
+ });
1192
+
1193
+ function build(value, path) {
1194
+ if (utils$1.isUndefined(value)) return;
1195
+
1196
+ if (stack.indexOf(value) !== -1) {
1197
+ throw Error('Circular reference detected in ' + path.join('.'));
1198
+ }
1199
+
1200
+ stack.push(value);
1201
+
1202
+ utils$1.forEach(value, function each(el, key) {
1203
+ const result = !(utils$1.isUndefined(el) || el === null) && visitor.call(
1204
+ formData, el, utils$1.isString(key) ? key.trim() : key, path, exposedHelpers
1205
+ );
1206
+
1207
+ if (result === true) {
1208
+ build(el, path ? path.concat(key) : [key]);
1209
+ }
1210
+ });
1211
+
1212
+ stack.pop();
1213
+ }
1214
+
1215
+ if (!utils$1.isObject(obj)) {
1216
+ throw new TypeError('data must be an object');
1217
+ }
1218
+
1219
+ build(obj);
1220
+
1221
+ return formData;
1222
+ }
1223
+
1224
+ /* Injected with object hook! */
1225
+
1226
+ /**
1227
+ * It encodes a string by replacing all characters that are not in the unreserved set with
1228
+ * their percent-encoded equivalents
1229
+ *
1230
+ * @param {string} str - The string to encode.
1231
+ *
1232
+ * @returns {string} The encoded string.
1233
+ */
1234
+ function encode$1(str) {
1235
+ const charMap = {
1236
+ '!': '%21',
1237
+ "'": '%27',
1238
+ '(': '%28',
1239
+ ')': '%29',
1240
+ '~': '%7E',
1241
+ '%20': '+',
1242
+ '%00': '\x00'
1243
+ };
1244
+ return encodeURIComponent(str).replace(/[!'()~]|%20|%00/g, function replacer(match) {
1245
+ return charMap[match];
1246
+ });
1247
+ }
1248
+
1249
+ /**
1250
+ * It takes a params object and converts it to a FormData object
1251
+ *
1252
+ * @param {Object<string, any>} params - The parameters to be converted to a FormData object.
1253
+ * @param {Object<string, any>} options - The options object passed to the Axios constructor.
1254
+ *
1255
+ * @returns {void}
1256
+ */
1257
+ function AxiosURLSearchParams(params, options) {
1258
+ this._pairs = [];
1259
+
1260
+ params && toFormData(params, this, options);
1261
+ }
1262
+
1263
+ const prototype = AxiosURLSearchParams.prototype;
1264
+
1265
+ prototype.append = function append(name, value) {
1266
+ this._pairs.push([name, value]);
1267
+ };
1268
+
1269
+ prototype.toString = function toString(encoder) {
1270
+ const _encode = encoder ? function(value) {
1271
+ return encoder.call(this, value, encode$1);
1272
+ } : encode$1;
1273
+
1274
+ return this._pairs.map(function each(pair) {
1275
+ return _encode(pair[0]) + '=' + _encode(pair[1]);
1276
+ }, '').join('&');
1277
+ };
1278
+
1279
+ /* Injected with object hook! */
1280
+
1281
+ /**
1282
+ * It replaces all instances of the characters `:`, `$`, `,`, `+`, `[`, and `]` with their
1283
+ * URI encoded counterparts
1284
+ *
1285
+ * @param {string} val The value to be encoded.
1286
+ *
1287
+ * @returns {string} The encoded value.
1288
+ */
1289
+ function encode(val) {
1290
+ return encodeURIComponent(val).
1291
+ replace(/%3A/gi, ':').
1292
+ replace(/%24/g, '$').
1293
+ replace(/%2C/gi, ',').
1294
+ replace(/%20/g, '+').
1295
+ replace(/%5B/gi, '[').
1296
+ replace(/%5D/gi, ']');
1297
+ }
1298
+
1299
+ /**
1300
+ * Build a URL by appending params to the end
1301
+ *
1302
+ * @param {string} url The base of the url (e.g., http://www.google.com)
1303
+ * @param {object} [params] The params to be appended
1304
+ * @param {?object} options
1305
+ *
1306
+ * @returns {string} The formatted url
1307
+ */
1308
+ function buildURL(url, params, options) {
1309
+ /*eslint no-param-reassign:0*/
1310
+ if (!params) {
1311
+ return url;
1312
+ }
1313
+
1314
+ const _encode = options && options.encode || encode;
1315
+
1316
+ const serializeFn = options && options.serialize;
1317
+
1318
+ let serializedParams;
1319
+
1320
+ if (serializeFn) {
1321
+ serializedParams = serializeFn(params, options);
1322
+ } else {
1323
+ serializedParams = utils$1.isURLSearchParams(params) ?
1324
+ params.toString() :
1325
+ new AxiosURLSearchParams(params, options).toString(_encode);
1326
+ }
1327
+
1328
+ if (serializedParams) {
1329
+ const hashmarkIndex = url.indexOf("#");
1330
+
1331
+ if (hashmarkIndex !== -1) {
1332
+ url = url.slice(0, hashmarkIndex);
1333
+ }
1334
+ url += (url.indexOf('?') === -1 ? '?' : '&') + serializedParams;
1335
+ }
1336
+
1337
+ return url;
1338
+ }
1339
+
1340
+ /* Injected with object hook! */
1341
+
1342
+ class InterceptorManager {
1343
+ constructor() {
1344
+ this.handlers = [];
1345
+ }
1346
+
1347
+ /**
1348
+ * Add a new interceptor to the stack
1349
+ *
1350
+ * @param {Function} fulfilled The function to handle `then` for a `Promise`
1351
+ * @param {Function} rejected The function to handle `reject` for a `Promise`
1352
+ *
1353
+ * @return {Number} An ID used to remove interceptor later
1354
+ */
1355
+ use(fulfilled, rejected, options) {
1356
+ this.handlers.push({
1357
+ fulfilled,
1358
+ rejected,
1359
+ synchronous: options ? options.synchronous : false,
1360
+ runWhen: options ? options.runWhen : null
1361
+ });
1362
+ return this.handlers.length - 1;
1363
+ }
1364
+
1365
+ /**
1366
+ * Remove an interceptor from the stack
1367
+ *
1368
+ * @param {Number} id The ID that was returned by `use`
1369
+ *
1370
+ * @returns {Boolean} `true` if the interceptor was removed, `false` otherwise
1371
+ */
1372
+ eject(id) {
1373
+ if (this.handlers[id]) {
1374
+ this.handlers[id] = null;
1375
+ }
1376
+ }
1377
+
1378
+ /**
1379
+ * Clear all interceptors from the stack
1380
+ *
1381
+ * @returns {void}
1382
+ */
1383
+ clear() {
1384
+ if (this.handlers) {
1385
+ this.handlers = [];
1386
+ }
1387
+ }
1388
+
1389
+ /**
1390
+ * Iterate over all the registered interceptors
1391
+ *
1392
+ * This method is particularly useful for skipping over any
1393
+ * interceptors that may have become `null` calling `eject`.
1394
+ *
1395
+ * @param {Function} fn The function to call for each interceptor
1396
+ *
1397
+ * @returns {void}
1398
+ */
1399
+ forEach(fn) {
1400
+ utils$1.forEach(this.handlers, function forEachHandler(h) {
1401
+ if (h !== null) {
1402
+ fn(h);
1403
+ }
1404
+ });
1405
+ }
1406
+ }
1407
+
1408
+ /* Injected with object hook! */
1409
+
1410
+ const transitionalDefaults = {
1411
+ silentJSONParsing: true,
1412
+ forcedJSONParsing: true,
1413
+ clarifyTimeoutError: false
1414
+ };
1415
+
1416
+ /* Injected with object hook! */
1417
+
1418
+ const URLSearchParams$1 = typeof URLSearchParams !== 'undefined' ? URLSearchParams : AxiosURLSearchParams;
1419
+
1420
+ /* Injected with object hook! */
1421
+
1422
+ const FormData$1 = typeof FormData !== 'undefined' ? FormData : null;
1423
+
1424
+ /* Injected with object hook! */
1425
+
1426
+ const Blob$1 = typeof Blob !== 'undefined' ? Blob : null;
1427
+
1428
+ /* Injected with object hook! */
1429
+
1430
+ const platform$1 = {
1431
+ isBrowser: true,
1432
+ classes: {
1433
+ URLSearchParams: URLSearchParams$1,
1434
+ FormData: FormData$1,
1435
+ Blob: Blob$1
1436
+ },
1437
+ protocols: ['http', 'https', 'file', 'blob', 'url', 'data']
1438
+ };
1439
+
1440
+ /* Injected with object hook! */
1441
+
1442
+ const hasBrowserEnv = typeof window !== 'undefined' && typeof document !== 'undefined';
1443
+
1444
+ /**
1445
+ * Determine if we're running in a standard browser environment
1446
+ *
1447
+ * This allows axios to run in a web worker, and react-native.
1448
+ * Both environments support XMLHttpRequest, but not fully standard globals.
1449
+ *
1450
+ * web workers:
1451
+ * typeof window -> undefined
1452
+ * typeof document -> undefined
1453
+ *
1454
+ * react-native:
1455
+ * navigator.product -> 'ReactNative'
1456
+ * nativescript
1457
+ * navigator.product -> 'NativeScript' or 'NS'
1458
+ *
1459
+ * @returns {boolean}
1460
+ */
1461
+ const hasStandardBrowserEnv = (
1462
+ (product) => {
1463
+ return hasBrowserEnv && ['ReactNative', 'NativeScript', 'NS'].indexOf(product) < 0
1464
+ })(typeof navigator !== 'undefined' && navigator.product);
1465
+
1466
+ /**
1467
+ * Determine if we're running in a standard browser webWorker environment
1468
+ *
1469
+ * Although the `isStandardBrowserEnv` method indicates that
1470
+ * `allows axios to run in a web worker`, the WebWorker will still be
1471
+ * filtered out due to its judgment standard
1472
+ * `typeof window !== 'undefined' && typeof document !== 'undefined'`.
1473
+ * This leads to a problem when axios post `FormData` in webWorker
1474
+ */
1475
+ const hasStandardBrowserWebWorkerEnv = (() => {
1476
+ return (
1477
+ typeof WorkerGlobalScope !== 'undefined' &&
1478
+ // eslint-disable-next-line no-undef
1479
+ self instanceof WorkerGlobalScope &&
1480
+ typeof self.importScripts === 'function'
1481
+ );
1482
+ })();
1483
+
1484
+ const origin = hasBrowserEnv && window.location.href || 'http://localhost';
1485
+
1486
+ /* Injected with object hook! */
1487
+
1488
+ const utils = /*#__PURE__*/Object.freeze(/*#__PURE__*/Object.defineProperty({
1489
+ __proto__: null,
1490
+ hasBrowserEnv,
1491
+ hasStandardBrowserEnv,
1492
+ hasStandardBrowserWebWorkerEnv,
1493
+ origin
1494
+ }, Symbol.toStringTag, { value: 'Module' }));
1495
+
1496
+ const platform = {
1497
+ ...utils,
1498
+ ...platform$1
1499
+ };
1500
+
1501
+ /* Injected with object hook! */
1502
+
1503
+ function toURLEncodedForm(data, options) {
1504
+ return toFormData(data, new platform.classes.URLSearchParams(), Object.assign({
1505
+ visitor: function(value, key, path, helpers) {
1506
+ if (platform.isNode && utils$1.isBuffer(value)) {
1507
+ this.append(key, value.toString('base64'));
1508
+ return false;
1509
+ }
1510
+
1511
+ return helpers.defaultVisitor.apply(this, arguments);
1512
+ }
1513
+ }, options));
1514
+ }
1515
+
1516
+ /* Injected with object hook! */
1517
+
1518
+ /**
1519
+ * It takes a string like `foo[x][y][z]` and returns an array like `['foo', 'x', 'y', 'z']
1520
+ *
1521
+ * @param {string} name - The name of the property to get.
1522
+ *
1523
+ * @returns An array of strings.
1524
+ */
1525
+ function parsePropPath(name) {
1526
+ // foo[x][y][z]
1527
+ // foo.x.y.z
1528
+ // foo-x-y-z
1529
+ // foo x y z
1530
+ return utils$1.matchAll(/\w+|\[(\w*)]/g, name).map(match => {
1531
+ return match[0] === '[]' ? '' : match[1] || match[0];
1532
+ });
1533
+ }
1534
+
1535
+ /**
1536
+ * Convert an array to an object.
1537
+ *
1538
+ * @param {Array<any>} arr - The array to convert to an object.
1539
+ *
1540
+ * @returns An object with the same keys and values as the array.
1541
+ */
1542
+ function arrayToObject(arr) {
1543
+ const obj = {};
1544
+ const keys = Object.keys(arr);
1545
+ let i;
1546
+ const len = keys.length;
1547
+ let key;
1548
+ for (i = 0; i < len; i++) {
1549
+ key = keys[i];
1550
+ obj[key] = arr[key];
1551
+ }
1552
+ return obj;
1553
+ }
1554
+
1555
+ /**
1556
+ * It takes a FormData object and returns a JavaScript object
1557
+ *
1558
+ * @param {string} formData The FormData object to convert to JSON.
1559
+ *
1560
+ * @returns {Object<string, any> | null} The converted object.
1561
+ */
1562
+ function formDataToJSON(formData) {
1563
+ function buildPath(path, value, target, index) {
1564
+ let name = path[index++];
1565
+
1566
+ if (name === '__proto__') return true;
1567
+
1568
+ const isNumericKey = Number.isFinite(+name);
1569
+ const isLast = index >= path.length;
1570
+ name = !name && utils$1.isArray(target) ? target.length : name;
1571
+
1572
+ if (isLast) {
1573
+ if (utils$1.hasOwnProp(target, name)) {
1574
+ target[name] = [target[name], value];
1575
+ } else {
1576
+ target[name] = value;
1577
+ }
1578
+
1579
+ return !isNumericKey;
1580
+ }
1581
+
1582
+ if (!target[name] || !utils$1.isObject(target[name])) {
1583
+ target[name] = [];
1584
+ }
1585
+
1586
+ const result = buildPath(path, value, target[name], index);
1587
+
1588
+ if (result && utils$1.isArray(target[name])) {
1589
+ target[name] = arrayToObject(target[name]);
1590
+ }
1591
+
1592
+ return !isNumericKey;
1593
+ }
1594
+
1595
+ if (utils$1.isFormData(formData) && utils$1.isFunction(formData.entries)) {
1596
+ const obj = {};
1597
+
1598
+ utils$1.forEachEntry(formData, (name, value) => {
1599
+ buildPath(parsePropPath(name), value, obj, 0);
1600
+ });
1601
+
1602
+ return obj;
1603
+ }
1604
+
1605
+ return null;
1606
+ }
1607
+
1608
+ /* Injected with object hook! */
1609
+
1610
+ /**
1611
+ * It takes a string, tries to parse it, and if it fails, it returns the stringified version
1612
+ * of the input
1613
+ *
1614
+ * @param {any} rawValue - The value to be stringified.
1615
+ * @param {Function} parser - A function that parses a string into a JavaScript object.
1616
+ * @param {Function} encoder - A function that takes a value and returns a string.
1617
+ *
1618
+ * @returns {string} A stringified version of the rawValue.
1619
+ */
1620
+ function stringifySafely(rawValue, parser, encoder) {
1621
+ if (utils$1.isString(rawValue)) {
1622
+ try {
1623
+ (parser || JSON.parse)(rawValue);
1624
+ return utils$1.trim(rawValue);
1625
+ } catch (e) {
1626
+ if (e.name !== 'SyntaxError') {
1627
+ throw e;
1628
+ }
1629
+ }
1630
+ }
1631
+
1632
+ return (encoder || JSON.stringify)(rawValue);
1633
+ }
1634
+
1635
+ const defaults = {
1636
+
1637
+ transitional: transitionalDefaults,
1638
+
1639
+ adapter: ['xhr', 'http', 'fetch'],
1640
+
1641
+ transformRequest: [function transformRequest(data, headers) {
1642
+ const contentType = headers.getContentType() || '';
1643
+ const hasJSONContentType = contentType.indexOf('application/json') > -1;
1644
+ const isObjectPayload = utils$1.isObject(data);
1645
+
1646
+ if (isObjectPayload && utils$1.isHTMLForm(data)) {
1647
+ data = new FormData(data);
1648
+ }
1649
+
1650
+ const isFormData = utils$1.isFormData(data);
1651
+
1652
+ if (isFormData) {
1653
+ return hasJSONContentType ? JSON.stringify(formDataToJSON(data)) : data;
1654
+ }
1655
+
1656
+ if (utils$1.isArrayBuffer(data) ||
1657
+ utils$1.isBuffer(data) ||
1658
+ utils$1.isStream(data) ||
1659
+ utils$1.isFile(data) ||
1660
+ utils$1.isBlob(data) ||
1661
+ utils$1.isReadableStream(data)
1662
+ ) {
1663
+ return data;
1664
+ }
1665
+ if (utils$1.isArrayBufferView(data)) {
1666
+ return data.buffer;
1667
+ }
1668
+ if (utils$1.isURLSearchParams(data)) {
1669
+ headers.setContentType('application/x-www-form-urlencoded;charset=utf-8', false);
1670
+ return data.toString();
1671
+ }
1672
+
1673
+ let isFileList;
1674
+
1675
+ if (isObjectPayload) {
1676
+ if (contentType.indexOf('application/x-www-form-urlencoded') > -1) {
1677
+ return toURLEncodedForm(data, this.formSerializer).toString();
1678
+ }
1679
+
1680
+ if ((isFileList = utils$1.isFileList(data)) || contentType.indexOf('multipart/form-data') > -1) {
1681
+ const _FormData = this.env && this.env.FormData;
1682
+
1683
+ return toFormData(
1684
+ isFileList ? {'files[]': data} : data,
1685
+ _FormData && new _FormData(),
1686
+ this.formSerializer
1687
+ );
1688
+ }
1689
+ }
1690
+
1691
+ if (isObjectPayload || hasJSONContentType ) {
1692
+ headers.setContentType('application/json', false);
1693
+ return stringifySafely(data);
1694
+ }
1695
+
1696
+ return data;
1697
+ }],
1698
+
1699
+ transformResponse: [function transformResponse(data) {
1700
+ const transitional = this.transitional || defaults.transitional;
1701
+ const forcedJSONParsing = transitional && transitional.forcedJSONParsing;
1702
+ const JSONRequested = this.responseType === 'json';
1703
+
1704
+ if (utils$1.isResponse(data) || utils$1.isReadableStream(data)) {
1705
+ return data;
1706
+ }
1707
+
1708
+ if (data && utils$1.isString(data) && ((forcedJSONParsing && !this.responseType) || JSONRequested)) {
1709
+ const silentJSONParsing = transitional && transitional.silentJSONParsing;
1710
+ const strictJSONParsing = !silentJSONParsing && JSONRequested;
1711
+
1712
+ try {
1713
+ return JSON.parse(data);
1714
+ } catch (e) {
1715
+ if (strictJSONParsing) {
1716
+ if (e.name === 'SyntaxError') {
1717
+ throw AxiosError.from(e, AxiosError.ERR_BAD_RESPONSE, this, null, this.response);
1718
+ }
1719
+ throw e;
1720
+ }
1721
+ }
1722
+ }
1723
+
1724
+ return data;
1725
+ }],
1726
+
1727
+ /**
1728
+ * A timeout in milliseconds to abort a request. If set to 0 (default) a
1729
+ * timeout is not created.
1730
+ */
1731
+ timeout: 0,
1732
+
1733
+ xsrfCookieName: 'XSRF-TOKEN',
1734
+ xsrfHeaderName: 'X-XSRF-TOKEN',
1735
+
1736
+ maxContentLength: -1,
1737
+ maxBodyLength: -1,
1738
+
1739
+ env: {
1740
+ FormData: platform.classes.FormData,
1741
+ Blob: platform.classes.Blob
1742
+ },
1743
+
1744
+ validateStatus: function validateStatus(status) {
1745
+ return status >= 200 && status < 300;
1746
+ },
1747
+
1748
+ headers: {
1749
+ common: {
1750
+ 'Accept': 'application/json, text/plain, */*',
1751
+ 'Content-Type': undefined
1752
+ }
1753
+ }
1754
+ };
1755
+
1756
+ utils$1.forEach(['delete', 'get', 'head', 'post', 'put', 'patch'], (method) => {
1757
+ defaults.headers[method] = {};
1758
+ });
1759
+
1760
+ /* Injected with object hook! */
1761
+
1762
+ // RawAxiosHeaders whose duplicates are ignored by node
1763
+ // c.f. https://nodejs.org/api/http.html#http_message_headers
1764
+ const ignoreDuplicateOf = utils$1.toObjectSet([
1765
+ 'age', 'authorization', 'content-length', 'content-type', 'etag',
1766
+ 'expires', 'from', 'host', 'if-modified-since', 'if-unmodified-since',
1767
+ 'last-modified', 'location', 'max-forwards', 'proxy-authorization',
1768
+ 'referer', 'retry-after', 'user-agent'
1769
+ ]);
1770
+
1771
+ /**
1772
+ * Parse headers into an object
1773
+ *
1774
+ * ```
1775
+ * Date: Wed, 27 Aug 2014 08:58:49 GMT
1776
+ * Content-Type: application/json
1777
+ * Connection: keep-alive
1778
+ * Transfer-Encoding: chunked
1779
+ * ```
1780
+ *
1781
+ * @param {String} rawHeaders Headers needing to be parsed
1782
+ *
1783
+ * @returns {Object} Headers parsed into an object
1784
+ */
1785
+ const parseHeaders = rawHeaders => {
1786
+ const parsed = {};
1787
+ let key;
1788
+ let val;
1789
+ let i;
1790
+
1791
+ rawHeaders && rawHeaders.split('\n').forEach(function parser(line) {
1792
+ i = line.indexOf(':');
1793
+ key = line.substring(0, i).trim().toLowerCase();
1794
+ val = line.substring(i + 1).trim();
1795
+
1796
+ if (!key || (parsed[key] && ignoreDuplicateOf[key])) {
1797
+ return;
1798
+ }
1799
+
1800
+ if (key === 'set-cookie') {
1801
+ if (parsed[key]) {
1802
+ parsed[key].push(val);
1803
+ } else {
1804
+ parsed[key] = [val];
1805
+ }
1806
+ } else {
1807
+ parsed[key] = parsed[key] ? parsed[key] + ', ' + val : val;
1808
+ }
1809
+ });
1810
+
1811
+ return parsed;
1812
+ };
1813
+
1814
+ /* Injected with object hook! */
1815
+
1816
+ const $internals = Symbol('internals');
1817
+
1818
+ function normalizeHeader(header) {
1819
+ return header && String(header).trim().toLowerCase();
1820
+ }
1821
+
1822
+ function normalizeValue(value) {
1823
+ if (value === false || value == null) {
1824
+ return value;
1825
+ }
1826
+
1827
+ return utils$1.isArray(value) ? value.map(normalizeValue) : String(value);
1828
+ }
1829
+
1830
+ function parseTokens(str) {
1831
+ const tokens = Object.create(null);
1832
+ const tokensRE = /([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;
1833
+ let match;
1834
+
1835
+ while ((match = tokensRE.exec(str))) {
1836
+ tokens[match[1]] = match[2];
1837
+ }
1838
+
1839
+ return tokens;
1840
+ }
1841
+
1842
+ const isValidHeaderName = (str) => /^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(str.trim());
1843
+
1844
+ function matchHeaderValue(context, value, header, filter, isHeaderNameFilter) {
1845
+ if (utils$1.isFunction(filter)) {
1846
+ return filter.call(this, value, header);
1847
+ }
1848
+
1849
+ if (isHeaderNameFilter) {
1850
+ value = header;
1851
+ }
1852
+
1853
+ if (!utils$1.isString(value)) return;
1854
+
1855
+ if (utils$1.isString(filter)) {
1856
+ return value.indexOf(filter) !== -1;
1857
+ }
1858
+
1859
+ if (utils$1.isRegExp(filter)) {
1860
+ return filter.test(value);
1861
+ }
1862
+ }
1863
+
1864
+ function formatHeader(header) {
1865
+ return header.trim()
1866
+ .toLowerCase().replace(/([a-z\d])(\w*)/g, (w, char, str) => {
1867
+ return char.toUpperCase() + str;
1868
+ });
1869
+ }
1870
+
1871
+ function buildAccessors(obj, header) {
1872
+ const accessorName = utils$1.toCamelCase(' ' + header);
1873
+
1874
+ ['get', 'set', 'has'].forEach(methodName => {
1875
+ Object.defineProperty(obj, methodName + accessorName, {
1876
+ value: function(arg1, arg2, arg3) {
1877
+ return this[methodName].call(this, header, arg1, arg2, arg3);
1878
+ },
1879
+ configurable: true
1880
+ });
1881
+ });
1882
+ }
1883
+
1884
+ class AxiosHeaders {
1885
+ constructor(headers) {
1886
+ headers && this.set(headers);
1887
+ }
1888
+
1889
+ set(header, valueOrRewrite, rewrite) {
1890
+ const self = this;
1891
+
1892
+ function setHeader(_value, _header, _rewrite) {
1893
+ const lHeader = normalizeHeader(_header);
1894
+
1895
+ if (!lHeader) {
1896
+ throw new Error('header name must be a non-empty string');
1897
+ }
1898
+
1899
+ const key = utils$1.findKey(self, lHeader);
1900
+
1901
+ if(!key || self[key] === undefined || _rewrite === true || (_rewrite === undefined && self[key] !== false)) {
1902
+ self[key || _header] = normalizeValue(_value);
1903
+ }
1904
+ }
1905
+
1906
+ const setHeaders = (headers, _rewrite) =>
1907
+ utils$1.forEach(headers, (_value, _header) => setHeader(_value, _header, _rewrite));
1908
+
1909
+ if (utils$1.isPlainObject(header) || header instanceof this.constructor) {
1910
+ setHeaders(header, valueOrRewrite);
1911
+ } else if(utils$1.isString(header) && (header = header.trim()) && !isValidHeaderName(header)) {
1912
+ setHeaders(parseHeaders(header), valueOrRewrite);
1913
+ } else if (utils$1.isHeaders(header)) {
1914
+ for (const [key, value] of header.entries()) {
1915
+ setHeader(value, key, rewrite);
1916
+ }
1917
+ } else {
1918
+ header != null && setHeader(valueOrRewrite, header, rewrite);
1919
+ }
1920
+
1921
+ return this;
1922
+ }
1923
+
1924
+ get(header, parser) {
1925
+ header = normalizeHeader(header);
1926
+
1927
+ if (header) {
1928
+ const key = utils$1.findKey(this, header);
1929
+
1930
+ if (key) {
1931
+ const value = this[key];
1932
+
1933
+ if (!parser) {
1934
+ return value;
1935
+ }
1936
+
1937
+ if (parser === true) {
1938
+ return parseTokens(value);
1939
+ }
1940
+
1941
+ if (utils$1.isFunction(parser)) {
1942
+ return parser.call(this, value, key);
1943
+ }
1944
+
1945
+ if (utils$1.isRegExp(parser)) {
1946
+ return parser.exec(value);
1947
+ }
1948
+
1949
+ throw new TypeError('parser must be boolean|regexp|function');
1950
+ }
1951
+ }
1952
+ }
1953
+
1954
+ has(header, matcher) {
1955
+ header = normalizeHeader(header);
1956
+
1957
+ if (header) {
1958
+ const key = utils$1.findKey(this, header);
1959
+
1960
+ return !!(key && this[key] !== undefined && (!matcher || matchHeaderValue(this, this[key], key, matcher)));
1961
+ }
1962
+
1963
+ return false;
1964
+ }
1965
+
1966
+ delete(header, matcher) {
1967
+ const self = this;
1968
+ let deleted = false;
1969
+
1970
+ function deleteHeader(_header) {
1971
+ _header = normalizeHeader(_header);
1972
+
1973
+ if (_header) {
1974
+ const key = utils$1.findKey(self, _header);
1975
+
1976
+ if (key && (!matcher || matchHeaderValue(self, self[key], key, matcher))) {
1977
+ delete self[key];
1978
+
1979
+ deleted = true;
1980
+ }
1981
+ }
1982
+ }
1983
+
1984
+ if (utils$1.isArray(header)) {
1985
+ header.forEach(deleteHeader);
1986
+ } else {
1987
+ deleteHeader(header);
1988
+ }
1989
+
1990
+ return deleted;
1991
+ }
1992
+
1993
+ clear(matcher) {
1994
+ const keys = Object.keys(this);
1995
+ let i = keys.length;
1996
+ let deleted = false;
1997
+
1998
+ while (i--) {
1999
+ const key = keys[i];
2000
+ if(!matcher || matchHeaderValue(this, this[key], key, matcher, true)) {
2001
+ delete this[key];
2002
+ deleted = true;
2003
+ }
2004
+ }
2005
+
2006
+ return deleted;
2007
+ }
2008
+
2009
+ normalize(format) {
2010
+ const self = this;
2011
+ const headers = {};
2012
+
2013
+ utils$1.forEach(this, (value, header) => {
2014
+ const key = utils$1.findKey(headers, header);
2015
+
2016
+ if (key) {
2017
+ self[key] = normalizeValue(value);
2018
+ delete self[header];
2019
+ return;
2020
+ }
2021
+
2022
+ const normalized = format ? formatHeader(header) : String(header).trim();
2023
+
2024
+ if (normalized !== header) {
2025
+ delete self[header];
2026
+ }
2027
+
2028
+ self[normalized] = normalizeValue(value);
2029
+
2030
+ headers[normalized] = true;
2031
+ });
2032
+
2033
+ return this;
2034
+ }
2035
+
2036
+ concat(...targets) {
2037
+ return this.constructor.concat(this, ...targets);
2038
+ }
2039
+
2040
+ toJSON(asStrings) {
2041
+ const obj = Object.create(null);
2042
+
2043
+ utils$1.forEach(this, (value, header) => {
2044
+ value != null && value !== false && (obj[header] = asStrings && utils$1.isArray(value) ? value.join(', ') : value);
2045
+ });
2046
+
2047
+ return obj;
2048
+ }
2049
+
2050
+ [Symbol.iterator]() {
2051
+ return Object.entries(this.toJSON())[Symbol.iterator]();
2052
+ }
2053
+
2054
+ toString() {
2055
+ return Object.entries(this.toJSON()).map(([header, value]) => header + ': ' + value).join('\n');
2056
+ }
2057
+
2058
+ get [Symbol.toStringTag]() {
2059
+ return 'AxiosHeaders';
2060
+ }
2061
+
2062
+ static from(thing) {
2063
+ return thing instanceof this ? thing : new this(thing);
2064
+ }
2065
+
2066
+ static concat(first, ...targets) {
2067
+ const computed = new this(first);
2068
+
2069
+ targets.forEach((target) => computed.set(target));
2070
+
2071
+ return computed;
2072
+ }
2073
+
2074
+ static accessor(header) {
2075
+ const internals = this[$internals] = (this[$internals] = {
2076
+ accessors: {}
2077
+ });
2078
+
2079
+ const accessors = internals.accessors;
2080
+ const prototype = this.prototype;
2081
+
2082
+ function defineAccessor(_header) {
2083
+ const lHeader = normalizeHeader(_header);
2084
+
2085
+ if (!accessors[lHeader]) {
2086
+ buildAccessors(prototype, _header);
2087
+ accessors[lHeader] = true;
2088
+ }
2089
+ }
2090
+
2091
+ utils$1.isArray(header) ? header.forEach(defineAccessor) : defineAccessor(header);
2092
+
2093
+ return this;
2094
+ }
2095
+ }
2096
+
2097
+ AxiosHeaders.accessor(['Content-Type', 'Content-Length', 'Accept', 'Accept-Encoding', 'User-Agent', 'Authorization']);
2098
+
2099
+ // reserved names hotfix
2100
+ utils$1.reduceDescriptors(AxiosHeaders.prototype, ({value}, key) => {
2101
+ let mapped = key[0].toUpperCase() + key.slice(1); // map `set` => `Set`
2102
+ return {
2103
+ get: () => value,
2104
+ set(headerValue) {
2105
+ this[mapped] = headerValue;
2106
+ }
2107
+ }
2108
+ });
2109
+
2110
+ utils$1.freezeMethods(AxiosHeaders);
2111
+
2112
+ /* Injected with object hook! */
2113
+
2114
+ /**
2115
+ * Transform the data for a request or a response
2116
+ *
2117
+ * @param {Array|Function} fns A single function or Array of functions
2118
+ * @param {?Object} response The response object
2119
+ *
2120
+ * @returns {*} The resulting transformed data
2121
+ */
2122
+ function transformData(fns, response) {
2123
+ const config = this || defaults;
2124
+ const context = response || config;
2125
+ const headers = AxiosHeaders.from(context.headers);
2126
+ let data = context.data;
2127
+
2128
+ utils$1.forEach(fns, function transform(fn) {
2129
+ data = fn.call(config, data, headers.normalize(), response ? response.status : undefined);
2130
+ });
2131
+
2132
+ headers.normalize();
2133
+
2134
+ return data;
2135
+ }
2136
+
2137
+ /* Injected with object hook! */
2138
+
2139
+ function isCancel(value) {
2140
+ return !!(value && value.__CANCEL__);
2141
+ }
2142
+
2143
+ /* Injected with object hook! */
2144
+
2145
+ /**
2146
+ * A `CanceledError` is an object that is thrown when an operation is canceled.
2147
+ *
2148
+ * @param {string=} message The message.
2149
+ * @param {Object=} config The config.
2150
+ * @param {Object=} request The request.
2151
+ *
2152
+ * @returns {CanceledError} The created error.
2153
+ */
2154
+ function CanceledError(message, config, request) {
2155
+ // eslint-disable-next-line no-eq-null,eqeqeq
2156
+ AxiosError.call(this, message == null ? 'canceled' : message, AxiosError.ERR_CANCELED, config, request);
2157
+ this.name = 'CanceledError';
2158
+ }
2159
+
2160
+ utils$1.inherits(CanceledError, AxiosError, {
2161
+ __CANCEL__: true
2162
+ });
2163
+
2164
+ /* Injected with object hook! */
2165
+
2166
+ /**
2167
+ * Resolve or reject a Promise based on response status.
2168
+ *
2169
+ * @param {Function} resolve A function that resolves the promise.
2170
+ * @param {Function} reject A function that rejects the promise.
2171
+ * @param {object} response The response.
2172
+ *
2173
+ * @returns {object} The response.
2174
+ */
2175
+ function settle(resolve, reject, response) {
2176
+ const validateStatus = response.config.validateStatus;
2177
+ if (!response.status || !validateStatus || validateStatus(response.status)) {
2178
+ resolve(response);
2179
+ } else {
2180
+ reject(new AxiosError(
2181
+ 'Request failed with status code ' + response.status,
2182
+ [AxiosError.ERR_BAD_REQUEST, AxiosError.ERR_BAD_RESPONSE][Math.floor(response.status / 100) - 4],
2183
+ response.config,
2184
+ response.request,
2185
+ response
2186
+ ));
2187
+ }
2188
+ }
2189
+
2190
+ /* Injected with object hook! */
2191
+
2192
+ function parseProtocol(url) {
2193
+ const match = /^([-+\w]{1,25})(:?\/\/|:)/.exec(url);
2194
+ return match && match[1] || '';
2195
+ }
2196
+
2197
+ /* Injected with object hook! */
2198
+
2199
+ /**
2200
+ * Calculate data maxRate
2201
+ * @param {Number} [samplesCount= 10]
2202
+ * @param {Number} [min= 1000]
2203
+ * @returns {Function}
2204
+ */
2205
+ function speedometer(samplesCount, min) {
2206
+ samplesCount = samplesCount || 10;
2207
+ const bytes = new Array(samplesCount);
2208
+ const timestamps = new Array(samplesCount);
2209
+ let head = 0;
2210
+ let tail = 0;
2211
+ let firstSampleTS;
2212
+
2213
+ min = min !== undefined ? min : 1000;
2214
+
2215
+ return function push(chunkLength) {
2216
+ const now = Date.now();
2217
+
2218
+ const startedAt = timestamps[tail];
2219
+
2220
+ if (!firstSampleTS) {
2221
+ firstSampleTS = now;
2222
+ }
2223
+
2224
+ bytes[head] = chunkLength;
2225
+ timestamps[head] = now;
2226
+
2227
+ let i = tail;
2228
+ let bytesCount = 0;
2229
+
2230
+ while (i !== head) {
2231
+ bytesCount += bytes[i++];
2232
+ i = i % samplesCount;
2233
+ }
2234
+
2235
+ head = (head + 1) % samplesCount;
2236
+
2237
+ if (head === tail) {
2238
+ tail = (tail + 1) % samplesCount;
2239
+ }
2240
+
2241
+ if (now - firstSampleTS < min) {
2242
+ return;
2243
+ }
2244
+
2245
+ const passed = startedAt && now - startedAt;
2246
+
2247
+ return passed ? Math.round(bytesCount * 1000 / passed) : undefined;
2248
+ };
2249
+ }
2250
+
2251
+ /* Injected with object hook! */
2252
+
2253
+ /**
2254
+ * Throttle decorator
2255
+ * @param {Function} fn
2256
+ * @param {Number} freq
2257
+ * @return {Function}
2258
+ */
2259
+ function throttle(fn, freq) {
2260
+ let timestamp = 0;
2261
+ const threshold = 1000 / freq;
2262
+ let timer = null;
2263
+ return function throttled() {
2264
+ const force = this === true;
2265
+
2266
+ const now = Date.now();
2267
+ if (force || now - timestamp > threshold) {
2268
+ if (timer) {
2269
+ clearTimeout(timer);
2270
+ timer = null;
2271
+ }
2272
+ timestamp = now;
2273
+ return fn.apply(null, arguments);
2274
+ }
2275
+ if (!timer) {
2276
+ timer = setTimeout(() => {
2277
+ timer = null;
2278
+ timestamp = Date.now();
2279
+ return fn.apply(null, arguments);
2280
+ }, threshold - (now - timestamp));
2281
+ }
2282
+ };
2283
+ }
2284
+
2285
+ /* Injected with object hook! */
2286
+
2287
+ const progressEventReducer = (listener, isDownloadStream, freq = 3) => {
2288
+ let bytesNotified = 0;
2289
+ const _speedometer = speedometer(50, 250);
2290
+
2291
+ return throttle(e => {
2292
+ const loaded = e.loaded;
2293
+ const total = e.lengthComputable ? e.total : undefined;
2294
+ const progressBytes = loaded - bytesNotified;
2295
+ const rate = _speedometer(progressBytes);
2296
+ const inRange = loaded <= total;
2297
+
2298
+ bytesNotified = loaded;
2299
+
2300
+ const data = {
2301
+ loaded,
2302
+ total,
2303
+ progress: total ? (loaded / total) : undefined,
2304
+ bytes: progressBytes,
2305
+ rate: rate ? rate : undefined,
2306
+ estimated: rate && total && inRange ? (total - loaded) / rate : undefined,
2307
+ event: e,
2308
+ lengthComputable: total != null
2309
+ };
2310
+
2311
+ data[isDownloadStream ? 'download' : 'upload'] = true;
2312
+
2313
+ listener(data);
2314
+ }, freq);
2315
+ };
2316
+
2317
+ /* Injected with object hook! */
2318
+
2319
+ const isURLSameOrigin = platform.hasStandardBrowserEnv ?
2320
+
2321
+ // Standard browser envs have full support of the APIs needed to test
2322
+ // whether the request URL is of the same origin as current location.
2323
+ (function standardBrowserEnv() {
2324
+ const msie = /(msie|trident)/i.test(navigator.userAgent);
2325
+ const urlParsingNode = document.createElement('a');
2326
+ let originURL;
2327
+
2328
+ /**
2329
+ * Parse a URL to discover its components
2330
+ *
2331
+ * @param {String} url The URL to be parsed
2332
+ * @returns {Object}
2333
+ */
2334
+ function resolveURL(url) {
2335
+ let href = url;
2336
+
2337
+ if (msie) {
2338
+ // IE needs attribute set twice to normalize properties
2339
+ urlParsingNode.setAttribute('href', href);
2340
+ href = urlParsingNode.href;
2341
+ }
2342
+
2343
+ urlParsingNode.setAttribute('href', href);
2344
+
2345
+ // urlParsingNode provides the UrlUtils interface - http://url.spec.whatwg.org/#urlutils
2346
+ return {
2347
+ href: urlParsingNode.href,
2348
+ protocol: urlParsingNode.protocol ? urlParsingNode.protocol.replace(/:$/, '') : '',
2349
+ host: urlParsingNode.host,
2350
+ search: urlParsingNode.search ? urlParsingNode.search.replace(/^\?/, '') : '',
2351
+ hash: urlParsingNode.hash ? urlParsingNode.hash.replace(/^#/, '') : '',
2352
+ hostname: urlParsingNode.hostname,
2353
+ port: urlParsingNode.port,
2354
+ pathname: (urlParsingNode.pathname.charAt(0) === '/') ?
2355
+ urlParsingNode.pathname :
2356
+ '/' + urlParsingNode.pathname
2357
+ };
2358
+ }
2359
+
2360
+ originURL = resolveURL(window.location.href);
2361
+
2362
+ /**
2363
+ * Determine if a URL shares the same origin as the current location
2364
+ *
2365
+ * @param {String} requestURL The URL to test
2366
+ * @returns {boolean} True if URL shares the same origin, otherwise false
2367
+ */
2368
+ return function isURLSameOrigin(requestURL) {
2369
+ const parsed = (utils$1.isString(requestURL)) ? resolveURL(requestURL) : requestURL;
2370
+ return (parsed.protocol === originURL.protocol &&
2371
+ parsed.host === originURL.host);
2372
+ };
2373
+ })() :
2374
+
2375
+ // Non standard browser envs (web workers, react-native) lack needed support.
2376
+ (function nonStandardBrowserEnv() {
2377
+ return function isURLSameOrigin() {
2378
+ return true;
2379
+ };
2380
+ })();
2381
+
2382
+ /* Injected with object hook! */
2383
+
2384
+ const cookies = platform.hasStandardBrowserEnv ?
2385
+
2386
+ // Standard browser envs support document.cookie
2387
+ {
2388
+ write(name, value, expires, path, domain, secure) {
2389
+ const cookie = [name + '=' + encodeURIComponent(value)];
2390
+
2391
+ utils$1.isNumber(expires) && cookie.push('expires=' + new Date(expires).toGMTString());
2392
+
2393
+ utils$1.isString(path) && cookie.push('path=' + path);
2394
+
2395
+ utils$1.isString(domain) && cookie.push('domain=' + domain);
2396
+
2397
+ secure === true && cookie.push('secure');
2398
+
2399
+ document.cookie = cookie.join('; ');
2400
+ },
2401
+
2402
+ read(name) {
2403
+ const match = document.cookie.match(new RegExp('(^|;\\s*)(' + name + ')=([^;]*)'));
2404
+ return (match ? decodeURIComponent(match[3]) : null);
2405
+ },
2406
+
2407
+ remove(name) {
2408
+ this.write(name, '', Date.now() - 86400000);
2409
+ }
2410
+ }
2411
+
2412
+ :
2413
+
2414
+ // Non-standard browser env (web workers, react-native) lack needed support.
2415
+ {
2416
+ write() {},
2417
+ read() {
2418
+ return null;
2419
+ },
2420
+ remove() {}
2421
+ };
2422
+
2423
+
2424
+ /* Injected with object hook! */
2425
+
2426
+ /**
2427
+ * Determines whether the specified URL is absolute
2428
+ *
2429
+ * @param {string} url The URL to test
2430
+ *
2431
+ * @returns {boolean} True if the specified URL is absolute, otherwise false
2432
+ */
2433
+ function isAbsoluteURL(url) {
2434
+ // A URL is considered absolute if it begins with "<scheme>://" or "//" (protocol-relative URL).
2435
+ // RFC 3986 defines scheme name as a sequence of characters beginning with a letter and followed
2436
+ // by any combination of letters, digits, plus, period, or hyphen.
2437
+ return /^([a-z][a-z\d+\-.]*:)?\/\//i.test(url);
2438
+ }
2439
+
2440
+ /* Injected with object hook! */
2441
+
2442
+ /**
2443
+ * Creates a new URL by combining the specified URLs
2444
+ *
2445
+ * @param {string} baseURL The base URL
2446
+ * @param {string} relativeURL The relative URL
2447
+ *
2448
+ * @returns {string} The combined URL
2449
+ */
2450
+ function combineURLs(baseURL, relativeURL) {
2451
+ return relativeURL
2452
+ ? baseURL.replace(/\/?\/$/, '') + '/' + relativeURL.replace(/^\/+/, '')
2453
+ : baseURL;
2454
+ }
2455
+
2456
+ /* Injected with object hook! */
2457
+
2458
+ /**
2459
+ * Creates a new URL by combining the baseURL with the requestedURL,
2460
+ * only when the requestedURL is not already an absolute URL.
2461
+ * If the requestURL is absolute, this function returns the requestedURL untouched.
2462
+ *
2463
+ * @param {string} baseURL The base URL
2464
+ * @param {string} requestedURL Absolute or relative URL to combine
2465
+ *
2466
+ * @returns {string} The combined full path
2467
+ */
2468
+ function buildFullPath(baseURL, requestedURL) {
2469
+ if (baseURL && !isAbsoluteURL(requestedURL)) {
2470
+ return combineURLs(baseURL, requestedURL);
2471
+ }
2472
+ return requestedURL;
2473
+ }
2474
+
2475
+ /* Injected with object hook! */
2476
+
2477
+ const headersToObject = (thing) => thing instanceof AxiosHeaders ? { ...thing } : thing;
2478
+
2479
+ /**
2480
+ * Config-specific merge-function which creates a new config-object
2481
+ * by merging two configuration objects together.
2482
+ *
2483
+ * @param {Object} config1
2484
+ * @param {Object} config2
2485
+ *
2486
+ * @returns {Object} New object resulting from merging config2 to config1
2487
+ */
2488
+ function mergeConfig(config1, config2) {
2489
+ // eslint-disable-next-line no-param-reassign
2490
+ config2 = config2 || {};
2491
+ const config = {};
2492
+
2493
+ function getMergedValue(target, source, caseless) {
2494
+ if (utils$1.isPlainObject(target) && utils$1.isPlainObject(source)) {
2495
+ return utils$1.merge.call({caseless}, target, source);
2496
+ } else if (utils$1.isPlainObject(source)) {
2497
+ return utils$1.merge({}, source);
2498
+ } else if (utils$1.isArray(source)) {
2499
+ return source.slice();
2500
+ }
2501
+ return source;
2502
+ }
2503
+
2504
+ // eslint-disable-next-line consistent-return
2505
+ function mergeDeepProperties(a, b, caseless) {
2506
+ if (!utils$1.isUndefined(b)) {
2507
+ return getMergedValue(a, b, caseless);
2508
+ } else if (!utils$1.isUndefined(a)) {
2509
+ return getMergedValue(undefined, a, caseless);
2510
+ }
2511
+ }
2512
+
2513
+ // eslint-disable-next-line consistent-return
2514
+ function valueFromConfig2(a, b) {
2515
+ if (!utils$1.isUndefined(b)) {
2516
+ return getMergedValue(undefined, b);
2517
+ }
2518
+ }
2519
+
2520
+ // eslint-disable-next-line consistent-return
2521
+ function defaultToConfig2(a, b) {
2522
+ if (!utils$1.isUndefined(b)) {
2523
+ return getMergedValue(undefined, b);
2524
+ } else if (!utils$1.isUndefined(a)) {
2525
+ return getMergedValue(undefined, a);
2526
+ }
2527
+ }
2528
+
2529
+ // eslint-disable-next-line consistent-return
2530
+ function mergeDirectKeys(a, b, prop) {
2531
+ if (prop in config2) {
2532
+ return getMergedValue(a, b);
2533
+ } else if (prop in config1) {
2534
+ return getMergedValue(undefined, a);
2535
+ }
2536
+ }
2537
+
2538
+ const mergeMap = {
2539
+ url: valueFromConfig2,
2540
+ method: valueFromConfig2,
2541
+ data: valueFromConfig2,
2542
+ baseURL: defaultToConfig2,
2543
+ transformRequest: defaultToConfig2,
2544
+ transformResponse: defaultToConfig2,
2545
+ paramsSerializer: defaultToConfig2,
2546
+ timeout: defaultToConfig2,
2547
+ timeoutMessage: defaultToConfig2,
2548
+ withCredentials: defaultToConfig2,
2549
+ withXSRFToken: defaultToConfig2,
2550
+ adapter: defaultToConfig2,
2551
+ responseType: defaultToConfig2,
2552
+ xsrfCookieName: defaultToConfig2,
2553
+ xsrfHeaderName: defaultToConfig2,
2554
+ onUploadProgress: defaultToConfig2,
2555
+ onDownloadProgress: defaultToConfig2,
2556
+ decompress: defaultToConfig2,
2557
+ maxContentLength: defaultToConfig2,
2558
+ maxBodyLength: defaultToConfig2,
2559
+ beforeRedirect: defaultToConfig2,
2560
+ transport: defaultToConfig2,
2561
+ httpAgent: defaultToConfig2,
2562
+ httpsAgent: defaultToConfig2,
2563
+ cancelToken: defaultToConfig2,
2564
+ socketPath: defaultToConfig2,
2565
+ responseEncoding: defaultToConfig2,
2566
+ validateStatus: mergeDirectKeys,
2567
+ headers: (a, b) => mergeDeepProperties(headersToObject(a), headersToObject(b), true)
2568
+ };
2569
+
2570
+ utils$1.forEach(Object.keys(Object.assign({}, config1, config2)), function computeConfigValue(prop) {
2571
+ const merge = mergeMap[prop] || mergeDeepProperties;
2572
+ const configValue = merge(config1[prop], config2[prop], prop);
2573
+ (utils$1.isUndefined(configValue) && merge !== mergeDirectKeys) || (config[prop] = configValue);
2574
+ });
2575
+
2576
+ return config;
2577
+ }
2578
+
2579
+ /* Injected with object hook! */
2580
+
2581
+ const resolveConfig = (config) => {
2582
+ const newConfig = mergeConfig({}, config);
2583
+
2584
+ let {data, withXSRFToken, xsrfHeaderName, xsrfCookieName, headers, auth} = newConfig;
2585
+
2586
+ newConfig.headers = headers = AxiosHeaders.from(headers);
2587
+
2588
+ newConfig.url = buildURL(buildFullPath(newConfig.baseURL, newConfig.url), config.params, config.paramsSerializer);
2589
+
2590
+ // HTTP basic authentication
2591
+ if (auth) {
2592
+ headers.set('Authorization', 'Basic ' +
2593
+ btoa((auth.username || '') + ':' + (auth.password ? unescape(encodeURIComponent(auth.password)) : ''))
2594
+ );
2595
+ }
2596
+
2597
+ let contentType;
2598
+
2599
+ if (utils$1.isFormData(data)) {
2600
+ if (platform.hasStandardBrowserEnv || platform.hasStandardBrowserWebWorkerEnv) {
2601
+ headers.setContentType(undefined); // Let the browser set it
2602
+ } else if ((contentType = headers.getContentType()) !== false) {
2603
+ // fix semicolon duplication issue for ReactNative FormData implementation
2604
+ const [type, ...tokens] = contentType ? contentType.split(';').map(token => token.trim()).filter(Boolean) : [];
2605
+ headers.setContentType([type || 'multipart/form-data', ...tokens].join('; '));
2606
+ }
2607
+ }
2608
+
2609
+ // Add xsrf header
2610
+ // This is only done if running in a standard browser environment.
2611
+ // Specifically not if we're in a web worker, or react-native.
2612
+
2613
+ if (platform.hasStandardBrowserEnv) {
2614
+ withXSRFToken && utils$1.isFunction(withXSRFToken) && (withXSRFToken = withXSRFToken(newConfig));
2615
+
2616
+ if (withXSRFToken || (withXSRFToken !== false && isURLSameOrigin(newConfig.url))) {
2617
+ // Add xsrf header
2618
+ const xsrfValue = xsrfHeaderName && xsrfCookieName && cookies.read(xsrfCookieName);
2619
+
2620
+ if (xsrfValue) {
2621
+ headers.set(xsrfHeaderName, xsrfValue);
2622
+ }
2623
+ }
2624
+ }
2625
+
2626
+ return newConfig;
2627
+ };
2628
+
2629
+
2630
+ /* Injected with object hook! */
2631
+
2632
+ const isXHRAdapterSupported = typeof XMLHttpRequest !== 'undefined';
2633
+
2634
+ const xhrAdapter = isXHRAdapterSupported && function (config) {
2635
+ return new Promise(function dispatchXhrRequest(resolve, reject) {
2636
+ const _config = resolveConfig(config);
2637
+ let requestData = _config.data;
2638
+ const requestHeaders = AxiosHeaders.from(_config.headers).normalize();
2639
+ let {responseType} = _config;
2640
+ let onCanceled;
2641
+ function done() {
2642
+ if (_config.cancelToken) {
2643
+ _config.cancelToken.unsubscribe(onCanceled);
2644
+ }
2645
+
2646
+ if (_config.signal) {
2647
+ _config.signal.removeEventListener('abort', onCanceled);
2648
+ }
2649
+ }
2650
+
2651
+ let request = new XMLHttpRequest();
2652
+
2653
+ request.open(_config.method.toUpperCase(), _config.url, true);
2654
+
2655
+ // Set the request timeout in MS
2656
+ request.timeout = _config.timeout;
2657
+
2658
+ function onloadend() {
2659
+ if (!request) {
2660
+ return;
2661
+ }
2662
+ // Prepare the response
2663
+ const responseHeaders = AxiosHeaders.from(
2664
+ 'getAllResponseHeaders' in request && request.getAllResponseHeaders()
2665
+ );
2666
+ const responseData = !responseType || responseType === 'text' || responseType === 'json' ?
2667
+ request.responseText : request.response;
2668
+ const response = {
2669
+ data: responseData,
2670
+ status: request.status,
2671
+ statusText: request.statusText,
2672
+ headers: responseHeaders,
2673
+ config,
2674
+ request
2675
+ };
2676
+
2677
+ settle(function _resolve(value) {
2678
+ resolve(value);
2679
+ done();
2680
+ }, function _reject(err) {
2681
+ reject(err);
2682
+ done();
2683
+ }, response);
2684
+
2685
+ // Clean up request
2686
+ request = null;
2687
+ }
2688
+
2689
+ if ('onloadend' in request) {
2690
+ // Use onloadend if available
2691
+ request.onloadend = onloadend;
2692
+ } else {
2693
+ // Listen for ready state to emulate onloadend
2694
+ request.onreadystatechange = function handleLoad() {
2695
+ if (!request || request.readyState !== 4) {
2696
+ return;
2697
+ }
2698
+
2699
+ // The request errored out and we didn't get a response, this will be
2700
+ // handled by onerror instead
2701
+ // With one exception: request that using file: protocol, most browsers
2702
+ // will return status as 0 even though it's a successful request
2703
+ if (request.status === 0 && !(request.responseURL && request.responseURL.indexOf('file:') === 0)) {
2704
+ return;
2705
+ }
2706
+ // readystate handler is calling before onerror or ontimeout handlers,
2707
+ // so we should call onloadend on the next 'tick'
2708
+ setTimeout(onloadend);
2709
+ };
2710
+ }
2711
+
2712
+ // Handle browser request cancellation (as opposed to a manual cancellation)
2713
+ request.onabort = function handleAbort() {
2714
+ if (!request) {
2715
+ return;
2716
+ }
2717
+
2718
+ reject(new AxiosError('Request aborted', AxiosError.ECONNABORTED, _config, request));
2719
+
2720
+ // Clean up request
2721
+ request = null;
2722
+ };
2723
+
2724
+ // Handle low level network errors
2725
+ request.onerror = function handleError() {
2726
+ // Real errors are hidden from us by the browser
2727
+ // onerror should only fire if it's a network error
2728
+ reject(new AxiosError('Network Error', AxiosError.ERR_NETWORK, _config, request));
2729
+
2730
+ // Clean up request
2731
+ request = null;
2732
+ };
2733
+
2734
+ // Handle timeout
2735
+ request.ontimeout = function handleTimeout() {
2736
+ let timeoutErrorMessage = _config.timeout ? 'timeout of ' + _config.timeout + 'ms exceeded' : 'timeout exceeded';
2737
+ const transitional = _config.transitional || transitionalDefaults;
2738
+ if (_config.timeoutErrorMessage) {
2739
+ timeoutErrorMessage = _config.timeoutErrorMessage;
2740
+ }
2741
+ reject(new AxiosError(
2742
+ timeoutErrorMessage,
2743
+ transitional.clarifyTimeoutError ? AxiosError.ETIMEDOUT : AxiosError.ECONNABORTED,
2744
+ _config,
2745
+ request));
2746
+
2747
+ // Clean up request
2748
+ request = null;
2749
+ };
2750
+
2751
+ // Remove Content-Type if data is undefined
2752
+ requestData === undefined && requestHeaders.setContentType(null);
2753
+
2754
+ // Add headers to the request
2755
+ if ('setRequestHeader' in request) {
2756
+ utils$1.forEach(requestHeaders.toJSON(), function setRequestHeader(val, key) {
2757
+ request.setRequestHeader(key, val);
2758
+ });
2759
+ }
2760
+
2761
+ // Add withCredentials to request if needed
2762
+ if (!utils$1.isUndefined(_config.withCredentials)) {
2763
+ request.withCredentials = !!_config.withCredentials;
2764
+ }
2765
+
2766
+ // Add responseType to request if needed
2767
+ if (responseType && responseType !== 'json') {
2768
+ request.responseType = _config.responseType;
2769
+ }
2770
+
2771
+ // Handle progress if needed
2772
+ if (typeof _config.onDownloadProgress === 'function') {
2773
+ request.addEventListener('progress', progressEventReducer(_config.onDownloadProgress, true));
2774
+ }
2775
+
2776
+ // Not all browsers support upload events
2777
+ if (typeof _config.onUploadProgress === 'function' && request.upload) {
2778
+ request.upload.addEventListener('progress', progressEventReducer(_config.onUploadProgress));
2779
+ }
2780
+
2781
+ if (_config.cancelToken || _config.signal) {
2782
+ // Handle cancellation
2783
+ // eslint-disable-next-line func-names
2784
+ onCanceled = cancel => {
2785
+ if (!request) {
2786
+ return;
2787
+ }
2788
+ reject(!cancel || cancel.type ? new CanceledError(null, config, request) : cancel);
2789
+ request.abort();
2790
+ request = null;
2791
+ };
2792
+
2793
+ _config.cancelToken && _config.cancelToken.subscribe(onCanceled);
2794
+ if (_config.signal) {
2795
+ _config.signal.aborted ? onCanceled() : _config.signal.addEventListener('abort', onCanceled);
2796
+ }
2797
+ }
2798
+
2799
+ const protocol = parseProtocol(_config.url);
2800
+
2801
+ if (protocol && platform.protocols.indexOf(protocol) === -1) {
2802
+ reject(new AxiosError('Unsupported protocol ' + protocol + ':', AxiosError.ERR_BAD_REQUEST, config));
2803
+ return;
2804
+ }
2805
+
2806
+
2807
+ // Send the request
2808
+ request.send(requestData || null);
2809
+ });
2810
+ };
2811
+
2812
+ /* Injected with object hook! */
2813
+
2814
+ const composeSignals = (signals, timeout) => {
2815
+ let controller = new AbortController();
2816
+
2817
+ let aborted;
2818
+
2819
+ const onabort = function (cancel) {
2820
+ if (!aborted) {
2821
+ aborted = true;
2822
+ unsubscribe();
2823
+ const err = cancel instanceof Error ? cancel : this.reason;
2824
+ controller.abort(err instanceof AxiosError ? err : new CanceledError(err instanceof Error ? err.message : err));
2825
+ }
2826
+ };
2827
+
2828
+ let timer = timeout && setTimeout(() => {
2829
+ onabort(new AxiosError(`timeout ${timeout} of ms exceeded`, AxiosError.ETIMEDOUT));
2830
+ }, timeout);
2831
+
2832
+ const unsubscribe = () => {
2833
+ if (signals) {
2834
+ timer && clearTimeout(timer);
2835
+ timer = null;
2836
+ signals.forEach(signal => {
2837
+ signal &&
2838
+ (signal.removeEventListener ? signal.removeEventListener('abort', onabort) : signal.unsubscribe(onabort));
2839
+ });
2840
+ signals = null;
2841
+ }
2842
+ };
2843
+
2844
+ signals.forEach((signal) => signal && signal.addEventListener && signal.addEventListener('abort', onabort));
2845
+
2846
+ const {signal} = controller;
2847
+
2848
+ signal.unsubscribe = unsubscribe;
2849
+
2850
+ return [signal, () => {
2851
+ timer && clearTimeout(timer);
2852
+ timer = null;
2853
+ }];
2854
+ };
2855
+
2856
+ /* Injected with object hook! */
2857
+
2858
+ const streamChunk = function* (chunk, chunkSize) {
2859
+ let len = chunk.byteLength;
2860
+
2861
+ if (!chunkSize || len < chunkSize) {
2862
+ yield chunk;
2863
+ return;
2864
+ }
2865
+
2866
+ let pos = 0;
2867
+ let end;
2868
+
2869
+ while (pos < len) {
2870
+ end = pos + chunkSize;
2871
+ yield chunk.slice(pos, end);
2872
+ pos = end;
2873
+ }
2874
+ };
2875
+
2876
+ const readBytes = async function* (iterable, chunkSize, encode) {
2877
+ for await (const chunk of iterable) {
2878
+ yield* streamChunk(ArrayBuffer.isView(chunk) ? chunk : (await encode(String(chunk))), chunkSize);
2879
+ }
2880
+ };
2881
+
2882
+ const trackStream = (stream, chunkSize, onProgress, onFinish, encode) => {
2883
+ const iterator = readBytes(stream, chunkSize, encode);
2884
+
2885
+ let bytes = 0;
2886
+
2887
+ return new ReadableStream({
2888
+ type: 'bytes',
2889
+
2890
+ async pull(controller) {
2891
+ const {done, value} = await iterator.next();
2892
+
2893
+ if (done) {
2894
+ controller.close();
2895
+ onFinish();
2896
+ return;
2897
+ }
2898
+
2899
+ let len = value.byteLength;
2900
+ onProgress && onProgress(bytes += len);
2901
+ controller.enqueue(new Uint8Array(value));
2902
+ },
2903
+ cancel(reason) {
2904
+ onFinish(reason);
2905
+ return iterator.return();
2906
+ }
2907
+ }, {
2908
+ highWaterMark: 2
2909
+ })
2910
+ };
2911
+
2912
+ /* Injected with object hook! */
2913
+
2914
+ const fetchProgressDecorator = (total, fn) => {
2915
+ const lengthComputable = total != null;
2916
+ return (loaded) => setTimeout(() => fn({
2917
+ lengthComputable,
2918
+ total,
2919
+ loaded
2920
+ }));
2921
+ };
2922
+
2923
+ const isFetchSupported = typeof fetch === 'function' && typeof Request === 'function' && typeof Response === 'function';
2924
+ const isReadableStreamSupported = isFetchSupported && typeof ReadableStream === 'function';
2925
+
2926
+ // used only inside the fetch adapter
2927
+ const encodeText = isFetchSupported && (typeof TextEncoder === 'function' ?
2928
+ ((encoder) => (str) => encoder.encode(str))(new TextEncoder()) :
2929
+ async (str) => new Uint8Array(await new Response(str).arrayBuffer())
2930
+ );
2931
+
2932
+ const supportsRequestStream = isReadableStreamSupported && (() => {
2933
+ let duplexAccessed = false;
2934
+
2935
+ const hasContentType = new Request(platform.origin, {
2936
+ body: new ReadableStream(),
2937
+ method: 'POST',
2938
+ get duplex() {
2939
+ duplexAccessed = true;
2940
+ return 'half';
2941
+ },
2942
+ }).headers.has('Content-Type');
2943
+
2944
+ return duplexAccessed && !hasContentType;
2945
+ })();
2946
+
2947
+ const DEFAULT_CHUNK_SIZE = 64 * 1024;
2948
+
2949
+ const supportsResponseStream = isReadableStreamSupported && !!(()=> {
2950
+ try {
2951
+ return utils$1.isReadableStream(new Response('').body);
2952
+ } catch(err) {
2953
+ // return undefined
2954
+ }
2955
+ })();
2956
+
2957
+ const resolvers = {
2958
+ stream: supportsResponseStream && ((res) => res.body)
2959
+ };
2960
+
2961
+ isFetchSupported && (((res) => {
2962
+ ['text', 'arrayBuffer', 'blob', 'formData', 'stream'].forEach(type => {
2963
+ !resolvers[type] && (resolvers[type] = utils$1.isFunction(res[type]) ? (res) => res[type]() :
2964
+ (_, config) => {
2965
+ throw new AxiosError(`Response type '${type}' is not supported`, AxiosError.ERR_NOT_SUPPORT, config);
2966
+ });
2967
+ });
2968
+ })(new Response));
2969
+
2970
+ const getBodyLength = async (body) => {
2971
+ if (body == null) {
2972
+ return 0;
2973
+ }
2974
+
2975
+ if(utils$1.isBlob(body)) {
2976
+ return body.size;
2977
+ }
2978
+
2979
+ if(utils$1.isSpecCompliantForm(body)) {
2980
+ return (await new Request(body).arrayBuffer()).byteLength;
2981
+ }
2982
+
2983
+ if(utils$1.isArrayBufferView(body)) {
2984
+ return body.byteLength;
2985
+ }
2986
+
2987
+ if(utils$1.isURLSearchParams(body)) {
2988
+ body = body + '';
2989
+ }
2990
+
2991
+ if(utils$1.isString(body)) {
2992
+ return (await encodeText(body)).byteLength;
2993
+ }
2994
+ };
2995
+
2996
+ const resolveBodyLength = async (headers, body) => {
2997
+ const length = utils$1.toFiniteNumber(headers.getContentLength());
2998
+
2999
+ return length == null ? getBodyLength(body) : length;
3000
+ };
3001
+
3002
+ const fetchAdapter = isFetchSupported && (async (config) => {
3003
+ let {
3004
+ url,
3005
+ method,
3006
+ data,
3007
+ signal,
3008
+ cancelToken,
3009
+ timeout,
3010
+ onDownloadProgress,
3011
+ onUploadProgress,
3012
+ responseType,
3013
+ headers,
3014
+ withCredentials = 'same-origin',
3015
+ fetchOptions
3016
+ } = resolveConfig(config);
3017
+
3018
+ responseType = responseType ? (responseType + '').toLowerCase() : 'text';
3019
+
3020
+ let [composedSignal, stopTimeout] = (signal || cancelToken || timeout) ?
3021
+ composeSignals([signal, cancelToken], timeout) : [];
3022
+
3023
+ let finished, request;
3024
+
3025
+ const onFinish = () => {
3026
+ !finished && setTimeout(() => {
3027
+ composedSignal && composedSignal.unsubscribe();
3028
+ });
3029
+
3030
+ finished = true;
3031
+ };
3032
+
3033
+ let requestContentLength;
3034
+
3035
+ try {
3036
+ if (
3037
+ onUploadProgress && supportsRequestStream && method !== 'get' && method !== 'head' &&
3038
+ (requestContentLength = await resolveBodyLength(headers, data)) !== 0
3039
+ ) {
3040
+ let _request = new Request(url, {
3041
+ method: 'POST',
3042
+ body: data,
3043
+ duplex: "half"
3044
+ });
3045
+
3046
+ let contentTypeHeader;
3047
+
3048
+ if (utils$1.isFormData(data) && (contentTypeHeader = _request.headers.get('content-type'))) {
3049
+ headers.setContentType(contentTypeHeader);
3050
+ }
3051
+
3052
+ if (_request.body) {
3053
+ data = trackStream(_request.body, DEFAULT_CHUNK_SIZE, fetchProgressDecorator(
3054
+ requestContentLength,
3055
+ progressEventReducer(onUploadProgress)
3056
+ ), null, encodeText);
3057
+ }
3058
+ }
3059
+
3060
+ if (!utils$1.isString(withCredentials)) {
3061
+ withCredentials = withCredentials ? 'cors' : 'omit';
3062
+ }
3063
+
3064
+ request = new Request(url, {
3065
+ ...fetchOptions,
3066
+ signal: composedSignal,
3067
+ method: method.toUpperCase(),
3068
+ headers: headers.normalize().toJSON(),
3069
+ body: data,
3070
+ duplex: "half",
3071
+ withCredentials
3072
+ });
3073
+
3074
+ let response = await fetch(request);
3075
+
3076
+ const isStreamResponse = supportsResponseStream && (responseType === 'stream' || responseType === 'response');
3077
+
3078
+ if (supportsResponseStream && (onDownloadProgress || isStreamResponse)) {
3079
+ const options = {};
3080
+
3081
+ ['status', 'statusText', 'headers'].forEach(prop => {
3082
+ options[prop] = response[prop];
3083
+ });
3084
+
3085
+ const responseContentLength = utils$1.toFiniteNumber(response.headers.get('content-length'));
3086
+
3087
+ response = new Response(
3088
+ trackStream(response.body, DEFAULT_CHUNK_SIZE, onDownloadProgress && fetchProgressDecorator(
3089
+ responseContentLength,
3090
+ progressEventReducer(onDownloadProgress, true)
3091
+ ), isStreamResponse && onFinish, encodeText),
3092
+ options
3093
+ );
3094
+ }
3095
+
3096
+ responseType = responseType || 'text';
3097
+
3098
+ let responseData = await resolvers[utils$1.findKey(resolvers, responseType) || 'text'](response, config);
3099
+
3100
+ !isStreamResponse && onFinish();
3101
+
3102
+ stopTimeout && stopTimeout();
3103
+
3104
+ return await new Promise((resolve, reject) => {
3105
+ settle(resolve, reject, {
3106
+ data: responseData,
3107
+ headers: AxiosHeaders.from(response.headers),
3108
+ status: response.status,
3109
+ statusText: response.statusText,
3110
+ config,
3111
+ request
3112
+ });
3113
+ })
3114
+ } catch (err) {
3115
+ onFinish();
3116
+
3117
+ if (err && err.name === 'TypeError' && /fetch/i.test(err.message)) {
3118
+ throw Object.assign(
3119
+ new AxiosError('Network Error', AxiosError.ERR_NETWORK, config, request),
3120
+ {
3121
+ cause: err.cause || err
3122
+ }
3123
+ )
3124
+ }
3125
+
3126
+ throw AxiosError.from(err, err && err.code, config, request);
3127
+ }
3128
+ });
3129
+
3130
+
3131
+
3132
+ /* Injected with object hook! */
3133
+
3134
+ const knownAdapters = {
3135
+ http: httpAdapter,
3136
+ xhr: xhrAdapter,
3137
+ fetch: fetchAdapter
3138
+ };
3139
+
3140
+ utils$1.forEach(knownAdapters, (fn, value) => {
3141
+ if (fn) {
3142
+ try {
3143
+ Object.defineProperty(fn, 'name', {value});
3144
+ } catch (e) {
3145
+ // eslint-disable-next-line no-empty
3146
+ }
3147
+ Object.defineProperty(fn, 'adapterName', {value});
3148
+ }
3149
+ });
3150
+
3151
+ const renderReason = (reason) => `- ${reason}`;
3152
+
3153
+ const isResolvedHandle = (adapter) => utils$1.isFunction(adapter) || adapter === null || adapter === false;
3154
+
3155
+ const adapters = {
3156
+ getAdapter: (adapters) => {
3157
+ adapters = utils$1.isArray(adapters) ? adapters : [adapters];
3158
+
3159
+ const {length} = adapters;
3160
+ let nameOrAdapter;
3161
+ let adapter;
3162
+
3163
+ const rejectedReasons = {};
3164
+
3165
+ for (let i = 0; i < length; i++) {
3166
+ nameOrAdapter = adapters[i];
3167
+ let id;
3168
+
3169
+ adapter = nameOrAdapter;
3170
+
3171
+ if (!isResolvedHandle(nameOrAdapter)) {
3172
+ adapter = knownAdapters[(id = String(nameOrAdapter)).toLowerCase()];
3173
+
3174
+ if (adapter === undefined) {
3175
+ throw new AxiosError(`Unknown adapter '${id}'`);
3176
+ }
3177
+ }
3178
+
3179
+ if (adapter) {
3180
+ break;
3181
+ }
3182
+
3183
+ rejectedReasons[id || '#' + i] = adapter;
3184
+ }
3185
+
3186
+ if (!adapter) {
3187
+
3188
+ const reasons = Object.entries(rejectedReasons)
3189
+ .map(([id, state]) => `adapter ${id} ` +
3190
+ (state === false ? 'is not supported by the environment' : 'is not available in the build')
3191
+ );
3192
+
3193
+ let s = length ?
3194
+ (reasons.length > 1 ? 'since :\n' + reasons.map(renderReason).join('\n') : ' ' + renderReason(reasons[0])) :
3195
+ 'as no adapter specified';
3196
+
3197
+ throw new AxiosError(
3198
+ `There is no suitable adapter to dispatch the request ` + s,
3199
+ 'ERR_NOT_SUPPORT'
3200
+ );
3201
+ }
3202
+
3203
+ return adapter;
3204
+ },
3205
+ adapters: knownAdapters
3206
+ };
3207
+
3208
+ /* Injected with object hook! */
3209
+
3210
+ /**
3211
+ * Throws a `CanceledError` if cancellation has been requested.
3212
+ *
3213
+ * @param {Object} config The config that is to be used for the request
3214
+ *
3215
+ * @returns {void}
3216
+ */
3217
+ function throwIfCancellationRequested(config) {
3218
+ if (config.cancelToken) {
3219
+ config.cancelToken.throwIfRequested();
3220
+ }
3221
+
3222
+ if (config.signal && config.signal.aborted) {
3223
+ throw new CanceledError(null, config);
3224
+ }
3225
+ }
3226
+
3227
+ /**
3228
+ * Dispatch a request to the server using the configured adapter.
3229
+ *
3230
+ * @param {object} config The config that is to be used for the request
3231
+ *
3232
+ * @returns {Promise} The Promise to be fulfilled
3233
+ */
3234
+ function dispatchRequest(config) {
3235
+ throwIfCancellationRequested(config);
3236
+
3237
+ config.headers = AxiosHeaders.from(config.headers);
3238
+
3239
+ // Transform request data
3240
+ config.data = transformData.call(
3241
+ config,
3242
+ config.transformRequest
3243
+ );
3244
+
3245
+ if (['post', 'put', 'patch'].indexOf(config.method) !== -1) {
3246
+ config.headers.setContentType('application/x-www-form-urlencoded', false);
3247
+ }
3248
+
3249
+ const adapter = adapters.getAdapter(config.adapter || defaults.adapter);
3250
+
3251
+ return adapter(config).then(function onAdapterResolution(response) {
3252
+ throwIfCancellationRequested(config);
3253
+
3254
+ // Transform response data
3255
+ response.data = transformData.call(
3256
+ config,
3257
+ config.transformResponse,
3258
+ response
3259
+ );
3260
+
3261
+ response.headers = AxiosHeaders.from(response.headers);
3262
+
3263
+ return response;
3264
+ }, function onAdapterRejection(reason) {
3265
+ if (!isCancel(reason)) {
3266
+ throwIfCancellationRequested(config);
3267
+
3268
+ // Transform response data
3269
+ if (reason && reason.response) {
3270
+ reason.response.data = transformData.call(
3271
+ config,
3272
+ config.transformResponse,
3273
+ reason.response
3274
+ );
3275
+ reason.response.headers = AxiosHeaders.from(reason.response.headers);
3276
+ }
3277
+ }
3278
+
3279
+ return Promise.reject(reason);
3280
+ });
3281
+ }
3282
+
3283
+ /* Injected with object hook! */
3284
+
3285
+ const VERSION = "1.7.2";
3286
+ /* Injected with object hook! */
3287
+
3288
+ const validators$1 = {};
3289
+
3290
+ // eslint-disable-next-line func-names
3291
+ ['object', 'boolean', 'number', 'function', 'string', 'symbol'].forEach((type, i) => {
3292
+ validators$1[type] = function validator(thing) {
3293
+ return typeof thing === type || 'a' + (i < 1 ? 'n ' : ' ') + type;
3294
+ };
3295
+ });
3296
+
3297
+ const deprecatedWarnings = {};
3298
+
3299
+ /**
3300
+ * Transitional option validator
3301
+ *
3302
+ * @param {function|boolean?} validator - set to false if the transitional option has been removed
3303
+ * @param {string?} version - deprecated version / removed since version
3304
+ * @param {string?} message - some message with additional info
3305
+ *
3306
+ * @returns {function}
3307
+ */
3308
+ validators$1.transitional = function transitional(validator, version, message) {
3309
+ function formatMessage(opt, desc) {
3310
+ return '[Axios v' + VERSION + '] Transitional option \'' + opt + '\'' + desc + (message ? '. ' + message : '');
3311
+ }
3312
+
3313
+ // eslint-disable-next-line func-names
3314
+ return (value, opt, opts) => {
3315
+ if (validator === false) {
3316
+ throw new AxiosError(
3317
+ formatMessage(opt, ' has been removed' + (version ? ' in ' + version : '')),
3318
+ AxiosError.ERR_DEPRECATED
3319
+ );
3320
+ }
3321
+
3322
+ if (version && !deprecatedWarnings[opt]) {
3323
+ deprecatedWarnings[opt] = true;
3324
+ // eslint-disable-next-line no-console
3325
+ console.warn(
3326
+ formatMessage(
3327
+ opt,
3328
+ ' has been deprecated since v' + version + ' and will be removed in the near future'
3329
+ )
3330
+ );
3331
+ }
3332
+
3333
+ return validator ? validator(value, opt, opts) : true;
3334
+ };
3335
+ };
3336
+
3337
+ /**
3338
+ * Assert object's properties type
3339
+ *
3340
+ * @param {object} options
3341
+ * @param {object} schema
3342
+ * @param {boolean?} allowUnknown
3343
+ *
3344
+ * @returns {object}
3345
+ */
3346
+
3347
+ function assertOptions(options, schema, allowUnknown) {
3348
+ if (typeof options !== 'object') {
3349
+ throw new AxiosError('options must be an object', AxiosError.ERR_BAD_OPTION_VALUE);
3350
+ }
3351
+ const keys = Object.keys(options);
3352
+ let i = keys.length;
3353
+ while (i-- > 0) {
3354
+ const opt = keys[i];
3355
+ const validator = schema[opt];
3356
+ if (validator) {
3357
+ const value = options[opt];
3358
+ const result = value === undefined || validator(value, opt, options);
3359
+ if (result !== true) {
3360
+ throw new AxiosError('option ' + opt + ' must be ' + result, AxiosError.ERR_BAD_OPTION_VALUE);
3361
+ }
3362
+ continue;
3363
+ }
3364
+ if (allowUnknown !== true) {
3365
+ throw new AxiosError('Unknown option ' + opt, AxiosError.ERR_BAD_OPTION);
3366
+ }
3367
+ }
3368
+ }
3369
+
3370
+ const validator = {
3371
+ assertOptions,
3372
+ validators: validators$1
3373
+ };
3374
+
3375
+ /* Injected with object hook! */
3376
+
3377
+ const validators = validator.validators;
3378
+
3379
+ /**
3380
+ * Create a new instance of Axios
3381
+ *
3382
+ * @param {Object} instanceConfig The default config for the instance
3383
+ *
3384
+ * @return {Axios} A new instance of Axios
3385
+ */
3386
+ class Axios {
3387
+ constructor(instanceConfig) {
3388
+ this.defaults = instanceConfig;
3389
+ this.interceptors = {
3390
+ request: new InterceptorManager(),
3391
+ response: new InterceptorManager()
3392
+ };
3393
+ }
3394
+
3395
+ /**
3396
+ * Dispatch a request
3397
+ *
3398
+ * @param {String|Object} configOrUrl The config specific for this request (merged with this.defaults)
3399
+ * @param {?Object} config
3400
+ *
3401
+ * @returns {Promise} The Promise to be fulfilled
3402
+ */
3403
+ async request(configOrUrl, config) {
3404
+ try {
3405
+ return await this._request(configOrUrl, config);
3406
+ } catch (err) {
3407
+ if (err instanceof Error) {
3408
+ let dummy;
3409
+
3410
+ Error.captureStackTrace ? Error.captureStackTrace(dummy = {}) : (dummy = new Error());
3411
+
3412
+ // slice off the Error: ... line
3413
+ const stack = dummy.stack ? dummy.stack.replace(/^.+\n/, '') : '';
3414
+ try {
3415
+ if (!err.stack) {
3416
+ err.stack = stack;
3417
+ // match without the 2 top stack lines
3418
+ } else if (stack && !String(err.stack).endsWith(stack.replace(/^.+\n.+\n/, ''))) {
3419
+ err.stack += '\n' + stack;
3420
+ }
3421
+ } catch (e) {
3422
+ // ignore the case where "stack" is an un-writable property
3423
+ }
3424
+ }
3425
+
3426
+ throw err;
3427
+ }
3428
+ }
3429
+
3430
+ _request(configOrUrl, config) {
3431
+ /*eslint no-param-reassign:0*/
3432
+ // Allow for axios('example/url'[, config]) a la fetch API
3433
+ if (typeof configOrUrl === 'string') {
3434
+ config = config || {};
3435
+ config.url = configOrUrl;
3436
+ } else {
3437
+ config = configOrUrl || {};
3438
+ }
3439
+
3440
+ config = mergeConfig(this.defaults, config);
3441
+
3442
+ const {transitional, paramsSerializer, headers} = config;
3443
+
3444
+ if (transitional !== undefined) {
3445
+ validator.assertOptions(transitional, {
3446
+ silentJSONParsing: validators.transitional(validators.boolean),
3447
+ forcedJSONParsing: validators.transitional(validators.boolean),
3448
+ clarifyTimeoutError: validators.transitional(validators.boolean)
3449
+ }, false);
3450
+ }
3451
+
3452
+ if (paramsSerializer != null) {
3453
+ if (utils$1.isFunction(paramsSerializer)) {
3454
+ config.paramsSerializer = {
3455
+ serialize: paramsSerializer
3456
+ };
3457
+ } else {
3458
+ validator.assertOptions(paramsSerializer, {
3459
+ encode: validators.function,
3460
+ serialize: validators.function
3461
+ }, true);
3462
+ }
3463
+ }
3464
+
3465
+ // Set config.method
3466
+ config.method = (config.method || this.defaults.method || 'get').toLowerCase();
3467
+
3468
+ // Flatten headers
3469
+ let contextHeaders = headers && utils$1.merge(
3470
+ headers.common,
3471
+ headers[config.method]
3472
+ );
3473
+
3474
+ headers && utils$1.forEach(
3475
+ ['delete', 'get', 'head', 'post', 'put', 'patch', 'common'],
3476
+ (method) => {
3477
+ delete headers[method];
3478
+ }
3479
+ );
3480
+
3481
+ config.headers = AxiosHeaders.concat(contextHeaders, headers);
3482
+
3483
+ // filter out skipped interceptors
3484
+ const requestInterceptorChain = [];
3485
+ let synchronousRequestInterceptors = true;
3486
+ this.interceptors.request.forEach(function unshiftRequestInterceptors(interceptor) {
3487
+ if (typeof interceptor.runWhen === 'function' && interceptor.runWhen(config) === false) {
3488
+ return;
3489
+ }
3490
+
3491
+ synchronousRequestInterceptors = synchronousRequestInterceptors && interceptor.synchronous;
3492
+
3493
+ requestInterceptorChain.unshift(interceptor.fulfilled, interceptor.rejected);
3494
+ });
3495
+
3496
+ const responseInterceptorChain = [];
3497
+ this.interceptors.response.forEach(function pushResponseInterceptors(interceptor) {
3498
+ responseInterceptorChain.push(interceptor.fulfilled, interceptor.rejected);
3499
+ });
3500
+
3501
+ let promise;
3502
+ let i = 0;
3503
+ let len;
3504
+
3505
+ if (!synchronousRequestInterceptors) {
3506
+ const chain = [dispatchRequest.bind(this), undefined];
3507
+ chain.unshift.apply(chain, requestInterceptorChain);
3508
+ chain.push.apply(chain, responseInterceptorChain);
3509
+ len = chain.length;
3510
+
3511
+ promise = Promise.resolve(config);
3512
+
3513
+ while (i < len) {
3514
+ promise = promise.then(chain[i++], chain[i++]);
3515
+ }
3516
+
3517
+ return promise;
3518
+ }
3519
+
3520
+ len = requestInterceptorChain.length;
3521
+
3522
+ let newConfig = config;
3523
+
3524
+ i = 0;
3525
+
3526
+ while (i < len) {
3527
+ const onFulfilled = requestInterceptorChain[i++];
3528
+ const onRejected = requestInterceptorChain[i++];
3529
+ try {
3530
+ newConfig = onFulfilled(newConfig);
3531
+ } catch (error) {
3532
+ onRejected.call(this, error);
3533
+ break;
3534
+ }
3535
+ }
3536
+
3537
+ try {
3538
+ promise = dispatchRequest.call(this, newConfig);
3539
+ } catch (error) {
3540
+ return Promise.reject(error);
3541
+ }
3542
+
3543
+ i = 0;
3544
+ len = responseInterceptorChain.length;
3545
+
3546
+ while (i < len) {
3547
+ promise = promise.then(responseInterceptorChain[i++], responseInterceptorChain[i++]);
3548
+ }
3549
+
3550
+ return promise;
3551
+ }
3552
+
3553
+ getUri(config) {
3554
+ config = mergeConfig(this.defaults, config);
3555
+ const fullPath = buildFullPath(config.baseURL, config.url);
3556
+ return buildURL(fullPath, config.params, config.paramsSerializer);
3557
+ }
3558
+ }
3559
+
3560
+ // Provide aliases for supported request methods
3561
+ utils$1.forEach(['delete', 'get', 'head', 'options'], function forEachMethodNoData(method) {
3562
+ /*eslint func-names:0*/
3563
+ Axios.prototype[method] = function(url, config) {
3564
+ return this.request(mergeConfig(config || {}, {
3565
+ method,
3566
+ url,
3567
+ data: (config || {}).data
3568
+ }));
3569
+ };
3570
+ });
3571
+
3572
+ utils$1.forEach(['post', 'put', 'patch'], function forEachMethodWithData(method) {
3573
+ /*eslint func-names:0*/
3574
+
3575
+ function generateHTTPMethod(isForm) {
3576
+ return function httpMethod(url, data, config) {
3577
+ return this.request(mergeConfig(config || {}, {
3578
+ method,
3579
+ headers: isForm ? {
3580
+ 'Content-Type': 'multipart/form-data'
3581
+ } : {},
3582
+ url,
3583
+ data
3584
+ }));
3585
+ };
3586
+ }
3587
+
3588
+ Axios.prototype[method] = generateHTTPMethod();
3589
+
3590
+ Axios.prototype[method + 'Form'] = generateHTTPMethod(true);
3591
+ });
3592
+
3593
+ /* Injected with object hook! */
3594
+
3595
+ /**
3596
+ * A `CancelToken` is an object that can be used to request cancellation of an operation.
3597
+ *
3598
+ * @param {Function} executor The executor function.
3599
+ *
3600
+ * @returns {CancelToken}
3601
+ */
3602
+ class CancelToken {
3603
+ constructor(executor) {
3604
+ if (typeof executor !== 'function') {
3605
+ throw new TypeError('executor must be a function.');
3606
+ }
3607
+
3608
+ let resolvePromise;
3609
+
3610
+ this.promise = new Promise(function promiseExecutor(resolve) {
3611
+ resolvePromise = resolve;
3612
+ });
3613
+
3614
+ const token = this;
3615
+
3616
+ // eslint-disable-next-line func-names
3617
+ this.promise.then(cancel => {
3618
+ if (!token._listeners) return;
3619
+
3620
+ let i = token._listeners.length;
3621
+
3622
+ while (i-- > 0) {
3623
+ token._listeners[i](cancel);
3624
+ }
3625
+ token._listeners = null;
3626
+ });
3627
+
3628
+ // eslint-disable-next-line func-names
3629
+ this.promise.then = onfulfilled => {
3630
+ let _resolve;
3631
+ // eslint-disable-next-line func-names
3632
+ const promise = new Promise(resolve => {
3633
+ token.subscribe(resolve);
3634
+ _resolve = resolve;
3635
+ }).then(onfulfilled);
3636
+
3637
+ promise.cancel = function reject() {
3638
+ token.unsubscribe(_resolve);
3639
+ };
3640
+
3641
+ return promise;
3642
+ };
3643
+
3644
+ executor(function cancel(message, config, request) {
3645
+ if (token.reason) {
3646
+ // Cancellation has already been requested
3647
+ return;
3648
+ }
3649
+
3650
+ token.reason = new CanceledError(message, config, request);
3651
+ resolvePromise(token.reason);
3652
+ });
3653
+ }
3654
+
3655
+ /**
3656
+ * Throws a `CanceledError` if cancellation has been requested.
3657
+ */
3658
+ throwIfRequested() {
3659
+ if (this.reason) {
3660
+ throw this.reason;
3661
+ }
3662
+ }
3663
+
3664
+ /**
3665
+ * Subscribe to the cancel signal
3666
+ */
3667
+
3668
+ subscribe(listener) {
3669
+ if (this.reason) {
3670
+ listener(this.reason);
3671
+ return;
3672
+ }
3673
+
3674
+ if (this._listeners) {
3675
+ this._listeners.push(listener);
3676
+ } else {
3677
+ this._listeners = [listener];
3678
+ }
3679
+ }
3680
+
3681
+ /**
3682
+ * Unsubscribe from the cancel signal
3683
+ */
3684
+
3685
+ unsubscribe(listener) {
3686
+ if (!this._listeners) {
3687
+ return;
3688
+ }
3689
+ const index = this._listeners.indexOf(listener);
3690
+ if (index !== -1) {
3691
+ this._listeners.splice(index, 1);
3692
+ }
3693
+ }
3694
+
3695
+ /**
3696
+ * Returns an object that contains a new `CancelToken` and a function that, when called,
3697
+ * cancels the `CancelToken`.
3698
+ */
3699
+ static source() {
3700
+ let cancel;
3701
+ const token = new CancelToken(function executor(c) {
3702
+ cancel = c;
3703
+ });
3704
+ return {
3705
+ token,
3706
+ cancel
3707
+ };
3708
+ }
3709
+ }
3710
+
3711
+ /* Injected with object hook! */
3712
+
3713
+ /**
3714
+ * Syntactic sugar for invoking a function and expanding an array for arguments.
3715
+ *
3716
+ * Common use case would be to use `Function.prototype.apply`.
3717
+ *
3718
+ * ```js
3719
+ * function f(x, y, z) {}
3720
+ * var args = [1, 2, 3];
3721
+ * f.apply(null, args);
3722
+ * ```
3723
+ *
3724
+ * With `spread` this example can be re-written.
3725
+ *
3726
+ * ```js
3727
+ * spread(function(x, y, z) {})([1, 2, 3]);
3728
+ * ```
3729
+ *
3730
+ * @param {Function} callback
3731
+ *
3732
+ * @returns {Function}
3733
+ */
3734
+ function spread(callback) {
3735
+ return function wrap(arr) {
3736
+ return callback.apply(null, arr);
3737
+ };
3738
+ }
3739
+
3740
+ /* Injected with object hook! */
3741
+
3742
+ /**
3743
+ * Determines whether the payload is an error thrown by Axios
3744
+ *
3745
+ * @param {*} payload The value to test
3746
+ *
3747
+ * @returns {boolean} True if the payload is an error thrown by Axios, otherwise false
3748
+ */
3749
+ function isAxiosError(payload) {
3750
+ return utils$1.isObject(payload) && (payload.isAxiosError === true);
3751
+ }
3752
+
3753
+ /* Injected with object hook! */
3754
+
3755
+ const HttpStatusCode = {
3756
+ Continue: 100,
3757
+ SwitchingProtocols: 101,
3758
+ Processing: 102,
3759
+ EarlyHints: 103,
3760
+ Ok: 200,
3761
+ Created: 201,
3762
+ Accepted: 202,
3763
+ NonAuthoritativeInformation: 203,
3764
+ NoContent: 204,
3765
+ ResetContent: 205,
3766
+ PartialContent: 206,
3767
+ MultiStatus: 207,
3768
+ AlreadyReported: 208,
3769
+ ImUsed: 226,
3770
+ MultipleChoices: 300,
3771
+ MovedPermanently: 301,
3772
+ Found: 302,
3773
+ SeeOther: 303,
3774
+ NotModified: 304,
3775
+ UseProxy: 305,
3776
+ Unused: 306,
3777
+ TemporaryRedirect: 307,
3778
+ PermanentRedirect: 308,
3779
+ BadRequest: 400,
3780
+ Unauthorized: 401,
3781
+ PaymentRequired: 402,
3782
+ Forbidden: 403,
3783
+ NotFound: 404,
3784
+ MethodNotAllowed: 405,
3785
+ NotAcceptable: 406,
3786
+ ProxyAuthenticationRequired: 407,
3787
+ RequestTimeout: 408,
3788
+ Conflict: 409,
3789
+ Gone: 410,
3790
+ LengthRequired: 411,
3791
+ PreconditionFailed: 412,
3792
+ PayloadTooLarge: 413,
3793
+ UriTooLong: 414,
3794
+ UnsupportedMediaType: 415,
3795
+ RangeNotSatisfiable: 416,
3796
+ ExpectationFailed: 417,
3797
+ ImATeapot: 418,
3798
+ MisdirectedRequest: 421,
3799
+ UnprocessableEntity: 422,
3800
+ Locked: 423,
3801
+ FailedDependency: 424,
3802
+ TooEarly: 425,
3803
+ UpgradeRequired: 426,
3804
+ PreconditionRequired: 428,
3805
+ TooManyRequests: 429,
3806
+ RequestHeaderFieldsTooLarge: 431,
3807
+ UnavailableForLegalReasons: 451,
3808
+ InternalServerError: 500,
3809
+ NotImplemented: 501,
3810
+ BadGateway: 502,
3811
+ ServiceUnavailable: 503,
3812
+ GatewayTimeout: 504,
3813
+ HttpVersionNotSupported: 505,
3814
+ VariantAlsoNegotiates: 506,
3815
+ InsufficientStorage: 507,
3816
+ LoopDetected: 508,
3817
+ NotExtended: 510,
3818
+ NetworkAuthenticationRequired: 511,
3819
+ };
3820
+
3821
+ Object.entries(HttpStatusCode).forEach(([key, value]) => {
3822
+ HttpStatusCode[value] = key;
3823
+ });
3824
+
3825
+ /* Injected with object hook! */
3826
+
3827
+ /**
3828
+ * Create an instance of Axios
3829
+ *
3830
+ * @param {Object} defaultConfig The default config for the instance
3831
+ *
3832
+ * @returns {Axios} A new instance of Axios
3833
+ */
3834
+ function createInstance(defaultConfig) {
3835
+ const context = new Axios(defaultConfig);
3836
+ const instance = bind(Axios.prototype.request, context);
3837
+
3838
+ // Copy axios.prototype to instance
3839
+ utils$1.extend(instance, Axios.prototype, context, {allOwnKeys: true});
3840
+
3841
+ // Copy context to instance
3842
+ utils$1.extend(instance, context, null, {allOwnKeys: true});
3843
+
3844
+ // Factory for creating new instances
3845
+ instance.create = function create(instanceConfig) {
3846
+ return createInstance(mergeConfig(defaultConfig, instanceConfig));
3847
+ };
3848
+
3849
+ return instance;
3850
+ }
3851
+
3852
+ // Create the default instance to be exported
3853
+ const axios = createInstance(defaults);
3854
+
3855
+ // Expose Axios class to allow class inheritance
3856
+ axios.Axios = Axios;
3857
+
3858
+ // Expose Cancel & CancelToken
3859
+ axios.CanceledError = CanceledError;
3860
+ axios.CancelToken = CancelToken;
3861
+ axios.isCancel = isCancel;
3862
+ axios.VERSION = VERSION;
3863
+ axios.toFormData = toFormData;
3864
+
3865
+ // Expose AxiosError class
3866
+ axios.AxiosError = AxiosError;
3867
+
3868
+ // alias for CanceledError for backward compatibility
3869
+ axios.Cancel = axios.CanceledError;
3870
+
3871
+ // Expose all/spread
3872
+ axios.all = function all(promises) {
3873
+ return Promise.all(promises);
3874
+ };
3875
+
3876
+ axios.spread = spread;
3877
+
3878
+ // Expose isAxiosError
3879
+ axios.isAxiosError = isAxiosError;
3880
+
3881
+ // Expose mergeConfig
3882
+ axios.mergeConfig = mergeConfig;
3883
+
3884
+ axios.AxiosHeaders = AxiosHeaders;
3885
+
3886
+ axios.formToJSON = thing => formDataToJSON(utils$1.isHTMLForm(thing) ? new FormData(thing) : thing);
3887
+
3888
+ axios.getAdapter = adapters.getAdapter;
3889
+
3890
+ axios.HttpStatusCode = HttpStatusCode;
3891
+
3892
+ axios.default = axios;
3893
+
3894
+ /* Injected with object hook! */
3895
+
3896
+ const LogLevels = {
3897
+ silent: Number.NEGATIVE_INFINITY,
3898
+ fatal: 0,
3899
+ error: 0,
3900
+ warn: 1,
3901
+ log: 2,
3902
+ info: 3,
3903
+ success: 3,
3904
+ fail: 3,
3905
+ ready: 3,
3906
+ start: 3,
3907
+ box: 3,
3908
+ debug: 4,
3909
+ trace: 5,
3910
+ verbose: Number.POSITIVE_INFINITY
3911
+ };
3912
+ const LogTypes = {
3913
+ // Silent
3914
+ silent: {
3915
+ level: -1
3916
+ },
3917
+ // Level 0
3918
+ fatal: {
3919
+ level: LogLevels.fatal
3920
+ },
3921
+ error: {
3922
+ level: LogLevels.error
3923
+ },
3924
+ // Level 1
3925
+ warn: {
3926
+ level: LogLevels.warn
3927
+ },
3928
+ // Level 2
3929
+ log: {
3930
+ level: LogLevels.log
3931
+ },
3932
+ // Level 3
3933
+ info: {
3934
+ level: LogLevels.info
3935
+ },
3936
+ success: {
3937
+ level: LogLevels.success
3938
+ },
3939
+ fail: {
3940
+ level: LogLevels.fail
3941
+ },
3942
+ ready: {
3943
+ level: LogLevels.info
3944
+ },
3945
+ start: {
3946
+ level: LogLevels.info
3947
+ },
3948
+ box: {
3949
+ level: LogLevels.info
3950
+ },
3951
+ // Level 4
3952
+ debug: {
3953
+ level: LogLevels.debug
3954
+ },
3955
+ // Level 5
3956
+ trace: {
3957
+ level: LogLevels.trace
3958
+ },
3959
+ // Verbose
3960
+ verbose: {
3961
+ level: LogLevels.verbose
3962
+ }
3963
+ };
3964
+
3965
+ function isObject(value) {
3966
+ return value !== null && typeof value === "object";
3967
+ }
3968
+ function _defu(baseObject, defaults, namespace = ".", merger) {
3969
+ if (!isObject(defaults)) {
3970
+ return _defu(baseObject, {}, namespace);
3971
+ }
3972
+ const object = Object.assign({}, defaults);
3973
+ for (const key in baseObject) {
3974
+ if (key === "__proto__" || key === "constructor") {
3975
+ continue;
3976
+ }
3977
+ const value = baseObject[key];
3978
+ if (value === null || value === void 0) {
3979
+ continue;
3980
+ }
3981
+ if (Array.isArray(value) && Array.isArray(object[key])) {
3982
+ object[key] = [...value, ...object[key]];
3983
+ } else if (isObject(value) && isObject(object[key])) {
3984
+ object[key] = _defu(
3985
+ value,
3986
+ object[key],
3987
+ (namespace ? `${namespace}.` : "") + key.toString());
3988
+ } else {
3989
+ object[key] = value;
3990
+ }
3991
+ }
3992
+ return object;
3993
+ }
3994
+ function createDefu(merger) {
3995
+ return (...arguments_) => (
3996
+ // eslint-disable-next-line unicorn/no-array-reduce
3997
+ arguments_.reduce((p, c) => _defu(p, c, ""), {})
3998
+ );
3999
+ }
4000
+ const defu = createDefu();
4001
+
4002
+ function isPlainObject(obj) {
4003
+ return Object.prototype.toString.call(obj) === "[object Object]";
4004
+ }
4005
+ function isLogObj(arg) {
4006
+ if (!isPlainObject(arg)) {
4007
+ return false;
4008
+ }
4009
+ if (!arg.message && !arg.args) {
4010
+ return false;
4011
+ }
4012
+ if (arg.stack) {
4013
+ return false;
4014
+ }
4015
+ return true;
4016
+ }
4017
+
4018
+ let paused = false;
4019
+ const queue = [];
4020
+ class Consola {
4021
+ constructor(options = {}) {
4022
+ const types = options.types || LogTypes;
4023
+ this.options = defu(
4024
+ {
4025
+ ...options,
4026
+ defaults: { ...options.defaults },
4027
+ level: _normalizeLogLevel(options.level, types),
4028
+ reporters: [...options.reporters || []]
4029
+ },
4030
+ {
4031
+ types: LogTypes,
4032
+ throttle: 1e3,
4033
+ throttleMin: 5,
4034
+ formatOptions: {
4035
+ date: true,
4036
+ colors: false,
4037
+ compact: true
4038
+ }
4039
+ }
4040
+ );
4041
+ for (const type in types) {
4042
+ const defaults = {
4043
+ type,
4044
+ ...this.options.defaults,
4045
+ ...types[type]
4046
+ };
4047
+ this[type] = this._wrapLogFn(defaults);
4048
+ this[type].raw = this._wrapLogFn(
4049
+ defaults,
4050
+ true
4051
+ );
4052
+ }
4053
+ if (this.options.mockFn) {
4054
+ this.mockTypes();
4055
+ }
4056
+ this._lastLog = {};
4057
+ }
4058
+ get level() {
4059
+ return this.options.level;
4060
+ }
4061
+ set level(level) {
4062
+ this.options.level = _normalizeLogLevel(
4063
+ level,
4064
+ this.options.types,
4065
+ this.options.level
4066
+ );
4067
+ }
4068
+ prompt(message, opts) {
4069
+ if (!this.options.prompt) {
4070
+ throw new Error("prompt is not supported!");
4071
+ }
4072
+ return this.options.prompt(message, opts);
4073
+ }
4074
+ create(options) {
4075
+ const instance = new Consola({
4076
+ ...this.options,
4077
+ ...options
4078
+ });
4079
+ if (this._mockFn) {
4080
+ instance.mockTypes(this._mockFn);
4081
+ }
4082
+ return instance;
4083
+ }
4084
+ withDefaults(defaults) {
4085
+ return this.create({
4086
+ ...this.options,
4087
+ defaults: {
4088
+ ...this.options.defaults,
4089
+ ...defaults
4090
+ }
4091
+ });
4092
+ }
4093
+ withTag(tag) {
4094
+ return this.withDefaults({
4095
+ tag: this.options.defaults.tag ? this.options.defaults.tag + ":" + tag : tag
4096
+ });
4097
+ }
4098
+ addReporter(reporter) {
4099
+ this.options.reporters.push(reporter);
4100
+ return this;
4101
+ }
4102
+ removeReporter(reporter) {
4103
+ if (reporter) {
4104
+ const i = this.options.reporters.indexOf(reporter);
4105
+ if (i >= 0) {
4106
+ return this.options.reporters.splice(i, 1);
4107
+ }
4108
+ } else {
4109
+ this.options.reporters.splice(0);
4110
+ }
4111
+ return this;
4112
+ }
4113
+ setReporters(reporters) {
4114
+ this.options.reporters = Array.isArray(reporters) ? reporters : [reporters];
4115
+ return this;
4116
+ }
4117
+ wrapAll() {
4118
+ this.wrapConsole();
4119
+ this.wrapStd();
4120
+ }
4121
+ restoreAll() {
4122
+ this.restoreConsole();
4123
+ this.restoreStd();
4124
+ }
4125
+ wrapConsole() {
4126
+ for (const type in this.options.types) {
4127
+ if (!console["__" + type]) {
4128
+ console["__" + type] = console[type];
4129
+ }
4130
+ console[type] = this[type].raw;
4131
+ }
4132
+ }
4133
+ restoreConsole() {
4134
+ for (const type in this.options.types) {
4135
+ if (console["__" + type]) {
4136
+ console[type] = console["__" + type];
4137
+ delete console["__" + type];
4138
+ }
4139
+ }
4140
+ }
4141
+ wrapStd() {
4142
+ this._wrapStream(this.options.stdout, "log");
4143
+ this._wrapStream(this.options.stderr, "log");
4144
+ }
4145
+ _wrapStream(stream, type) {
4146
+ if (!stream) {
4147
+ return;
4148
+ }
4149
+ if (!stream.__write) {
4150
+ stream.__write = stream.write;
4151
+ }
4152
+ stream.write = (data) => {
4153
+ this[type].raw(String(data).trim());
4154
+ };
4155
+ }
4156
+ restoreStd() {
4157
+ this._restoreStream(this.options.stdout);
4158
+ this._restoreStream(this.options.stderr);
4159
+ }
4160
+ _restoreStream(stream) {
4161
+ if (!stream) {
4162
+ return;
4163
+ }
4164
+ if (stream.__write) {
4165
+ stream.write = stream.__write;
4166
+ delete stream.__write;
4167
+ }
4168
+ }
4169
+ pauseLogs() {
4170
+ paused = true;
4171
+ }
4172
+ resumeLogs() {
4173
+ paused = false;
4174
+ const _queue = queue.splice(0);
4175
+ for (const item of _queue) {
4176
+ item[0]._logFn(item[1], item[2]);
4177
+ }
4178
+ }
4179
+ mockTypes(mockFn) {
4180
+ const _mockFn = mockFn || this.options.mockFn;
4181
+ this._mockFn = _mockFn;
4182
+ if (typeof _mockFn !== "function") {
4183
+ return;
4184
+ }
4185
+ for (const type in this.options.types) {
4186
+ this[type] = _mockFn(type, this.options.types[type]) || this[type];
4187
+ this[type].raw = this[type];
4188
+ }
4189
+ }
4190
+ _wrapLogFn(defaults, isRaw) {
4191
+ return (...args) => {
4192
+ if (paused) {
4193
+ queue.push([this, defaults, args, isRaw]);
4194
+ return;
4195
+ }
4196
+ return this._logFn(defaults, args, isRaw);
4197
+ };
4198
+ }
4199
+ _logFn(defaults, args, isRaw) {
4200
+ if ((defaults.level || 0) > this.level) {
4201
+ return false;
4202
+ }
4203
+ const logObj = {
4204
+ date: /* @__PURE__ */ new Date(),
4205
+ args: [],
4206
+ ...defaults,
4207
+ level: _normalizeLogLevel(defaults.level, this.options.types)
4208
+ };
4209
+ if (!isRaw && args.length === 1 && isLogObj(args[0])) {
4210
+ Object.assign(logObj, args[0]);
4211
+ } else {
4212
+ logObj.args = [...args];
4213
+ }
4214
+ if (logObj.message) {
4215
+ logObj.args.unshift(logObj.message);
4216
+ delete logObj.message;
4217
+ }
4218
+ if (logObj.additional) {
4219
+ if (!Array.isArray(logObj.additional)) {
4220
+ logObj.additional = logObj.additional.split("\n");
4221
+ }
4222
+ logObj.args.push("\n" + logObj.additional.join("\n"));
4223
+ delete logObj.additional;
4224
+ }
4225
+ logObj.type = typeof logObj.type === "string" ? logObj.type.toLowerCase() : "log";
4226
+ logObj.tag = typeof logObj.tag === "string" ? logObj.tag : "";
4227
+ const resolveLog = (newLog = false) => {
4228
+ const repeated = (this._lastLog.count || 0) - this.options.throttleMin;
4229
+ if (this._lastLog.object && repeated > 0) {
4230
+ const args2 = [...this._lastLog.object.args];
4231
+ if (repeated > 1) {
4232
+ args2.push(`(repeated ${repeated} times)`);
4233
+ }
4234
+ this._log({ ...this._lastLog.object, args: args2 });
4235
+ this._lastLog.count = 1;
4236
+ }
4237
+ if (newLog) {
4238
+ this._lastLog.object = logObj;
4239
+ this._log(logObj);
4240
+ }
4241
+ };
4242
+ clearTimeout(this._lastLog.timeout);
4243
+ const diffTime = this._lastLog.time && logObj.date ? logObj.date.getTime() - this._lastLog.time.getTime() : 0;
4244
+ this._lastLog.time = logObj.date;
4245
+ if (diffTime < this.options.throttle) {
4246
+ try {
4247
+ const serializedLog = JSON.stringify([
4248
+ logObj.type,
4249
+ logObj.tag,
4250
+ logObj.args
4251
+ ]);
4252
+ const isSameLog = this._lastLog.serialized === serializedLog;
4253
+ this._lastLog.serialized = serializedLog;
4254
+ if (isSameLog) {
4255
+ this._lastLog.count = (this._lastLog.count || 0) + 1;
4256
+ if (this._lastLog.count > this.options.throttleMin) {
4257
+ this._lastLog.timeout = setTimeout(
4258
+ resolveLog,
4259
+ this.options.throttle
4260
+ );
4261
+ return;
4262
+ }
4263
+ }
4264
+ } catch {
4265
+ }
4266
+ }
4267
+ resolveLog(true);
4268
+ }
4269
+ _log(logObj) {
4270
+ for (const reporter of this.options.reporters) {
4271
+ reporter.log(logObj, {
4272
+ options: this.options
4273
+ });
4274
+ }
4275
+ }
4276
+ }
4277
+ function _normalizeLogLevel(input, types = {}, defaultLevel = 3) {
4278
+ if (input === void 0) {
4279
+ return defaultLevel;
4280
+ }
4281
+ if (typeof input === "number") {
4282
+ return input;
4283
+ }
4284
+ if (types[input] && types[input].level !== void 0) {
4285
+ return types[input].level;
4286
+ }
4287
+ return defaultLevel;
4288
+ }
4289
+ Consola.prototype.add = Consola.prototype.addReporter;
4290
+ Consola.prototype.remove = Consola.prototype.removeReporter;
4291
+ Consola.prototype.clear = Consola.prototype.removeReporter;
4292
+ Consola.prototype.withScope = Consola.prototype.withTag;
4293
+ Consola.prototype.mock = Consola.prototype.mockTypes;
4294
+ Consola.prototype.pause = Consola.prototype.pauseLogs;
4295
+ Consola.prototype.resume = Consola.prototype.resumeLogs;
4296
+ function createConsola$1(options = {}) {
4297
+ return new Consola(options);
4298
+ }
4299
+
4300
+ /* Injected with object hook! */
4301
+
4302
+ class BrowserReporter {
4303
+ constructor(options) {
4304
+ this.options = { ...options };
4305
+ this.defaultColor = "#7f8c8d";
4306
+ this.levelColorMap = {
4307
+ 0: "#c0392b",
4308
+ // Red
4309
+ 1: "#f39c12",
4310
+ // Yellow
4311
+ 3: "#00BCD4"
4312
+ // Cyan
4313
+ };
4314
+ this.typeColorMap = {
4315
+ success: "#2ecc71"
4316
+ // Green
4317
+ };
4318
+ }
4319
+ _getLogFn(level) {
4320
+ if (level < 1) {
4321
+ return console.__error || console.error;
4322
+ }
4323
+ if (level === 1) {
4324
+ return console.__warn || console.warn;
4325
+ }
4326
+ return console.__log || console.log;
4327
+ }
4328
+ log(logObj) {
4329
+ const consoleLogFn = this._getLogFn(logObj.level);
4330
+ const type = logObj.type === "log" ? "" : logObj.type;
4331
+ const tag = logObj.tag || "";
4332
+ const color = this.typeColorMap[logObj.type] || this.levelColorMap[logObj.level] || this.defaultColor;
4333
+ const style = `
4334
+ background: ${color};
4335
+ border-radius: 0.5em;
4336
+ color: white;
4337
+ font-weight: bold;
4338
+ padding: 2px 0.5em;
4339
+ `;
4340
+ const badge = `%c${[tag, type].filter(Boolean).join(":")}`;
4341
+ if (typeof logObj.args[0] === "string") {
4342
+ consoleLogFn(
4343
+ `${badge}%c ${logObj.args[0]}`,
4344
+ style,
4345
+ // Empty string as style resets to default console style
4346
+ "",
4347
+ ...logObj.args.slice(1)
4348
+ );
4349
+ } else {
4350
+ consoleLogFn(badge, style, ...logObj.args);
4351
+ }
4352
+ }
4353
+ }
4354
+
4355
+ function createConsola(options = {}) {
4356
+ const consola2 = createConsola$1({
4357
+ reporters: options.reporters || [new BrowserReporter({})],
4358
+ prompt(message, options2 = {}) {
4359
+ if (options2.type === "confirm") {
4360
+ return Promise.resolve(confirm(message));
4361
+ }
4362
+ return Promise.resolve(prompt(message));
4363
+ },
4364
+ ...options
4365
+ });
4366
+ return consola2;
4367
+ }
4368
+ const consola = createConsola();
4369
+
4370
+ /* Injected with object hook! */
4371
+
4372
+ const _hoisted_1$3 = { key: 0 };
4373
+ const _hoisted_2$3 = /* @__PURE__ */ createBaseVNode("span", { "mr-1": "" }, ":", -1);
4374
+ const _sfc_main$3 = /* @__PURE__ */ defineComponent({
4375
+ __name: "PageFrontmatter",
4376
+ props: {
4377
+ frontmatter: {}
4378
+ },
4379
+ setup(__props) {
4380
+ const props = __props;
4381
+ const newFm = ref(props.frontmatter);
4382
+ async function saveNewFm() {
4383
+ const res = await axios.post("/valaxy-devtools-api/frontmatter", {
4384
+ pageData: pageData.value,
4385
+ frontmatter: toRaw(newFm.value)
4386
+ });
4387
+ if (res)
4388
+ consola.success("Frontmatter saved");
4389
+ }
4390
+ return (_ctx, _cache) => {
4391
+ const _component_VDTag = __unplugin_components_0;
4392
+ const _component_VDPostCategories = _sfc_main$5;
4393
+ const _component_AGUIInput = _sfc_main$6;
4394
+ const _component_AGUIButton = _sfc_main$7;
4395
+ return openBlock(), createElementBlock("div", null, [
4396
+ _ctx.frontmatter ? (openBlock(), createElementBlock("ul", _hoisted_1$3, [
4397
+ (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.frontmatter, (value, key) => {
4398
+ return openBlock(), createElementBlock("li", { key }, [
4399
+ createBaseVNode("strong", null, toDisplayString(key), 1),
4400
+ _hoisted_2$3,
4401
+ key === "tags" ? (openBlock(true), createElementBlock(Fragment, { key: 0 }, renderList(value, (tag) => {
4402
+ return openBlock(), createBlock(_component_VDTag, { key: tag }, {
4403
+ default: withCtx(() => [
4404
+ createTextVNode(toDisplayString(tag), 1)
4405
+ ]),
4406
+ _: 2
4407
+ }, 1024);
4408
+ }), 128)) : key === "categories" ? (openBlock(), createBlock(_component_VDPostCategories, {
4409
+ key: 1,
4410
+ categories: value
4411
+ }, null, 8, ["categories"])) : key === "encryptedContent" ? (openBlock(), createElementBlock(Fragment, { key: 2 }, [
4412
+ createTextVNode(" [Encrypted] ")
4413
+ ], 64)) : key === "partiallyEncryptedContents" ? (openBlock(), createElementBlock(Fragment, { key: 3 }, [
4414
+ createTextVNode(" [Partially Encrypted] ")
4415
+ ], 64)) : key === "title" ? (openBlock(), createBlock(_component_AGUIInput, {
4416
+ key: 4,
4417
+ modelValue: newFm.value.title,
4418
+ "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => newFm.value.title = $event)
4419
+ }, null, 8, ["modelValue"])) : (openBlock(), createElementBlock(Fragment, { key: 5 }, [
4420
+ createTextVNode(toDisplayString(value), 1)
4421
+ ], 64))
4422
+ ]);
4423
+ }), 128))
4424
+ ])) : createCommentVNode("", true),
4425
+ createVNode(_component_AGUIButton, { onClick: saveNewFm }, {
4426
+ default: withCtx(() => [
4427
+ createTextVNode(" Save Frontmatter ")
4428
+ ]),
4429
+ _: 1
4430
+ })
4431
+ ]);
4432
+ };
4433
+ }
4434
+ });
4435
+
4436
+ /* Injected with object hook! */
4437
+
4438
+ const _hoisted_1$2 = { p: "2" };
4439
+ const _hoisted_2$2 = {
4440
+ class: "flex",
4441
+ gap: "2",
4442
+ "py-2": ""
4443
+ };
4444
+ const _hoisted_3$2 = /* @__PURE__ */ createBaseVNode("div", { "i-vscode-icons:file-type-vscode": "" }, null, -1);
4445
+ const _hoisted_4 = [
4446
+ _hoisted_3$2
4447
+ ];
4448
+ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
4449
+ __name: "PostPanel",
4450
+ setup(__props) {
4451
+ function launchEditor() {
4452
+ openInEditor({
4453
+ file: getWindowProperty("$pageData").path
4454
+ });
4455
+ }
4456
+ return (_ctx, _cache) => {
4457
+ const _component_PageFrontmatter = _sfc_main$3;
4458
+ return openBlock(), createElementBlock("div", _hoisted_1$2, [
4459
+ createBaseVNode("div", _hoisted_2$2, [
4460
+ createBaseVNode("button", {
4461
+ class: "text-xs shadow transition hover:shadow-lg p-2",
4462
+ onClick: _cache[0] || (_cache[0] = ($event) => launchEditor())
4463
+ }, _hoisted_4)
4464
+ ]),
4465
+ unref(frontmatter) ? (openBlock(), createBlock(_component_PageFrontmatter, {
4466
+ key: 0,
4467
+ frontmatter: unref(frontmatter)
4468
+ }, null, 8, ["frontmatter"])) : createCommentVNode("", true)
4469
+ ]);
4470
+ };
4471
+ }
4472
+ });
4473
+
4474
+ /* Injected with object hook! */
4475
+
4476
+ const _hoisted_1$1 = {
4477
+ class: "h-full",
4478
+ overflow: "auto",
4479
+ pl: "12",
4480
+ pr: "4",
4481
+ py: "4"
4482
+ };
4483
+ const _hoisted_2$1 = { flex: "" };
4484
+ const _hoisted_3$1 = ["onClick"];
4485
+ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
4486
+ __name: "VDPostList",
4487
+ setup(__props) {
4488
+ const postList = ref();
4489
+ onMounted(() => {
4490
+ postList.value = getGlobalValaxyProperty("postList").value;
4491
+ });
4492
+ function onClickPost(post) {
4493
+ devtoolsRouter.value?.push(post.path);
4494
+ }
4495
+ return (_ctx, _cache) => {
4496
+ return openBlock(), createElementBlock("ul", _hoisted_1$1, [
4497
+ (openBlock(true), createElementBlock(Fragment, null, renderList(postList.value, (post) => {
4498
+ return openBlock(), createElementBlock("li", {
4499
+ key: post.path,
4500
+ class: "list-decimal"
4501
+ }, [
4502
+ createBaseVNode("div", _hoisted_2$1, [
4503
+ createBaseVNode("span", {
4504
+ class: normalizeClass(["inline-flex flex-grow cursor-pointer hover:text-blue-500", { "text-blue-500 font-bold": unref(activePath) === post.path }]),
4505
+ onClick: ($event) => onClickPost(post)
4506
+ }, toDisplayString(post.title), 11, _hoisted_3$1)
4507
+ ])
4508
+ ]);
4509
+ }), 128))
4510
+ ]);
4511
+ };
4512
+ }
4513
+ });
4514
+
4515
+ /* Injected with object hook! */
4516
+
4517
+ const M = {
4518
+ name: "splitpanes",
4519
+ emits: ["ready", "resize", "resized", "pane-click", "pane-maximize", "pane-add", "pane-remove", "splitter-click"],
4520
+ props: {
4521
+ horizontal: { type: Boolean },
4522
+ pushOtherPanes: { type: Boolean, default: !0 },
4523
+ dblClickSplitter: { type: Boolean, default: !0 },
4524
+ rtl: { type: Boolean, default: !1 },
4525
+ firstSplitter: { type: Boolean }
4526
+ },
4527
+ provide() {
4528
+ return {
4529
+ requestUpdate: this.requestUpdate,
4530
+ onPaneAdd: this.onPaneAdd,
4531
+ onPaneRemove: this.onPaneRemove,
4532
+ onPaneClick: this.onPaneClick
4533
+ };
4534
+ },
4535
+ data: () => ({
4536
+ container: null,
4537
+ ready: !1,
4538
+ panes: [],
4539
+ touch: {
4540
+ mouseDown: !1,
4541
+ dragging: !1,
4542
+ activeSplitter: null
4543
+ },
4544
+ splitterTaps: {
4545
+ splitter: null,
4546
+ timeoutId: null
4547
+ }
4548
+ }),
4549
+ computed: {
4550
+ panesCount() {
4551
+ return this.panes.length;
4552
+ },
4553
+ indexedPanes() {
4554
+ return this.panes.reduce((e, i) => (e[i.id] = i) && e, {});
4555
+ }
4556
+ },
4557
+ methods: {
4558
+ updatePaneComponents() {
4559
+ this.panes.forEach((e) => {
4560
+ e.update && e.update({
4561
+ [this.horizontal ? "height" : "width"]: `${this.indexedPanes[e.id].size}%`
4562
+ });
4563
+ });
4564
+ },
4565
+ bindEvents() {
4566
+ document.addEventListener("mousemove", this.onMouseMove, { passive: !1 }), document.addEventListener("mouseup", this.onMouseUp), "ontouchstart" in window && (document.addEventListener("touchmove", this.onMouseMove, { passive: !1 }), document.addEventListener("touchend", this.onMouseUp));
4567
+ },
4568
+ unbindEvents() {
4569
+ document.removeEventListener("mousemove", this.onMouseMove, { passive: !1 }), document.removeEventListener("mouseup", this.onMouseUp), "ontouchstart" in window && (document.removeEventListener("touchmove", this.onMouseMove, { passive: !1 }), document.removeEventListener("touchend", this.onMouseUp));
4570
+ },
4571
+ onMouseDown(e, i) {
4572
+ this.bindEvents(), this.touch.mouseDown = !0, this.touch.activeSplitter = i;
4573
+ },
4574
+ onMouseMove(e) {
4575
+ this.touch.mouseDown && (e.preventDefault(), this.touch.dragging = !0, this.calculatePanesSize(this.getCurrentMouseDrag(e)), this.$emit("resize", this.panes.map((i) => ({ min: i.min, max: i.max, size: i.size }))));
4576
+ },
4577
+ onMouseUp() {
4578
+ this.touch.dragging && this.$emit("resized", this.panes.map((e) => ({ min: e.min, max: e.max, size: e.size }))), this.touch.mouseDown = !1, setTimeout(() => {
4579
+ this.touch.dragging = !1, this.unbindEvents();
4580
+ }, 100);
4581
+ },
4582
+ onSplitterClick(e, i) {
4583
+ "ontouchstart" in window && (e.preventDefault(), this.dblClickSplitter && (this.splitterTaps.splitter === i ? (clearTimeout(this.splitterTaps.timeoutId), this.splitterTaps.timeoutId = null, this.onSplitterDblClick(e, i), this.splitterTaps.splitter = null) : (this.splitterTaps.splitter = i, this.splitterTaps.timeoutId = setTimeout(() => {
4584
+ this.splitterTaps.splitter = null;
4585
+ }, 500)))), this.touch.dragging || this.$emit("splitter-click", this.panes[i]);
4586
+ },
4587
+ onSplitterDblClick(e, i) {
4588
+ let s = 0;
4589
+ this.panes = this.panes.map((n, t) => (n.size = t === i ? n.max : n.min, t !== i && (s += n.min), n)), this.panes[i].size -= s, this.$emit("pane-maximize", this.panes[i]), this.$emit("resized", this.panes.map((n) => ({ min: n.min, max: n.max, size: n.size })));
4590
+ },
4591
+ onPaneClick(e, i) {
4592
+ this.$emit("pane-click", this.indexedPanes[i]);
4593
+ },
4594
+ getCurrentMouseDrag(e) {
4595
+ const i = this.container.getBoundingClientRect(), { clientX: s, clientY: n } = "ontouchstart" in window && e.touches ? e.touches[0] : e;
4596
+ return {
4597
+ x: s - i.left,
4598
+ y: n - i.top
4599
+ };
4600
+ },
4601
+ getCurrentDragPercentage(e) {
4602
+ e = e[this.horizontal ? "y" : "x"];
4603
+ const i = this.container[this.horizontal ? "clientHeight" : "clientWidth"];
4604
+ return this.rtl && !this.horizontal && (e = i - e), e * 100 / i;
4605
+ },
4606
+ calculatePanesSize(e) {
4607
+ const i = this.touch.activeSplitter;
4608
+ let s = {
4609
+ prevPanesSize: this.sumPrevPanesSize(i),
4610
+ nextPanesSize: this.sumNextPanesSize(i),
4611
+ prevReachedMinPanes: 0,
4612
+ nextReachedMinPanes: 0
4613
+ };
4614
+ const n = 0 + (this.pushOtherPanes ? 0 : s.prevPanesSize), t = 100 - (this.pushOtherPanes ? 0 : s.nextPanesSize), a = Math.max(Math.min(this.getCurrentDragPercentage(e), t), n);
4615
+ let r = [i, i + 1], o = this.panes[r[0]] || null, h = this.panes[r[1]] || null;
4616
+ const l = o.max < 100 && a >= o.max + s.prevPanesSize, u = h.max < 100 && a <= 100 - (h.max + this.sumNextPanesSize(i + 1));
4617
+ if (l || u) {
4618
+ l ? (o.size = o.max, h.size = Math.max(100 - o.max - s.prevPanesSize - s.nextPanesSize, 0)) : (o.size = Math.max(100 - h.max - s.prevPanesSize - this.sumNextPanesSize(i + 1), 0), h.size = h.max);
4619
+ return;
4620
+ }
4621
+ if (this.pushOtherPanes) {
4622
+ const d = this.doPushOtherPanes(s, a);
4623
+ if (!d)
4624
+ return;
4625
+ (({ sums: s, panesToResize: r } = d)), o = this.panes[r[0]] || null, h = this.panes[r[1]] || null;
4626
+ }
4627
+ o !== null && (o.size = Math.min(Math.max(a - s.prevPanesSize - s.prevReachedMinPanes, o.min), o.max)), h !== null && (h.size = Math.min(Math.max(100 - a - s.nextPanesSize - s.nextReachedMinPanes, h.min), h.max));
4628
+ },
4629
+ doPushOtherPanes(e, i) {
4630
+ const s = this.touch.activeSplitter, n = [s, s + 1];
4631
+ return i < e.prevPanesSize + this.panes[n[0]].min && (n[0] = this.findPrevExpandedPane(s).index, e.prevReachedMinPanes = 0, n[0] < s && this.panes.forEach((t, a) => {
4632
+ a > n[0] && a <= s && (t.size = t.min, e.prevReachedMinPanes += t.min);
4633
+ }), e.prevPanesSize = this.sumPrevPanesSize(n[0]), n[0] === void 0) ? (e.prevReachedMinPanes = 0, this.panes[0].size = this.panes[0].min, this.panes.forEach((t, a) => {
4634
+ a > 0 && a <= s && (t.size = t.min, e.prevReachedMinPanes += t.min);
4635
+ }), this.panes[n[1]].size = 100 - e.prevReachedMinPanes - this.panes[0].min - e.prevPanesSize - e.nextPanesSize, null) : i > 100 - e.nextPanesSize - this.panes[n[1]].min && (n[1] = this.findNextExpandedPane(s).index, e.nextReachedMinPanes = 0, n[1] > s + 1 && this.panes.forEach((t, a) => {
4636
+ a > s && a < n[1] && (t.size = t.min, e.nextReachedMinPanes += t.min);
4637
+ }), e.nextPanesSize = this.sumNextPanesSize(n[1] - 1), n[1] === void 0) ? (e.nextReachedMinPanes = 0, this.panes[this.panesCount - 1].size = this.panes[this.panesCount - 1].min, this.panes.forEach((t, a) => {
4638
+ a < this.panesCount - 1 && a >= s + 1 && (t.size = t.min, e.nextReachedMinPanes += t.min);
4639
+ }), this.panes[n[0]].size = 100 - e.prevPanesSize - e.nextReachedMinPanes - this.panes[this.panesCount - 1].min - e.nextPanesSize, null) : { sums: e, panesToResize: n };
4640
+ },
4641
+ sumPrevPanesSize(e) {
4642
+ return this.panes.reduce((i, s, n) => i + (n < e ? s.size : 0), 0);
4643
+ },
4644
+ sumNextPanesSize(e) {
4645
+ return this.panes.reduce((i, s, n) => i + (n > e + 1 ? s.size : 0), 0);
4646
+ },
4647
+ findPrevExpandedPane(e) {
4648
+ return [...this.panes].reverse().find((s) => s.index < e && s.size > s.min) || {};
4649
+ },
4650
+ findNextExpandedPane(e) {
4651
+ return this.panes.find((s) => s.index > e + 1 && s.size > s.min) || {};
4652
+ },
4653
+ checkSplitpanesNodes() {
4654
+ Array.from(this.container.children).forEach((i) => {
4655
+ const s = i.classList.contains("splitpanes__pane"), n = i.classList.contains("splitpanes__splitter");
4656
+ !s && !n && (i.parentNode.removeChild(i), console.warn("Splitpanes: Only <pane> elements are allowed at the root of <splitpanes>. One of your DOM nodes was removed."));
4657
+ });
4658
+ },
4659
+ addSplitter(e, i, s = !1) {
4660
+ const n = e - 1, t = document.createElement("div");
4661
+ t.classList.add("splitpanes__splitter"), s || (t.onmousedown = (a) => this.onMouseDown(a, n), typeof window < "u" && "ontouchstart" in window && (t.ontouchstart = (a) => this.onMouseDown(a, n)), t.onclick = (a) => this.onSplitterClick(a, n + 1)), this.dblClickSplitter && (t.ondblclick = (a) => this.onSplitterDblClick(a, n + 1)), i.parentNode.insertBefore(t, i);
4662
+ },
4663
+ removeSplitter(e) {
4664
+ e.onmousedown = void 0, e.onclick = void 0, e.ondblclick = void 0, e.parentNode.removeChild(e);
4665
+ },
4666
+ redoSplitters() {
4667
+ const e = Array.from(this.container.children);
4668
+ e.forEach((s) => {
4669
+ s.className.includes("splitpanes__splitter") && this.removeSplitter(s);
4670
+ });
4671
+ let i = 0;
4672
+ e.forEach((s) => {
4673
+ s.className.includes("splitpanes__pane") && (!i && this.firstSplitter ? this.addSplitter(i, s, !0) : i && this.addSplitter(i, s), i++);
4674
+ });
4675
+ },
4676
+ requestUpdate({ target: e, ...i }) {
4677
+ const s = this.indexedPanes[e._.uid];
4678
+ Object.entries(i).forEach(([n, t]) => s[n] = t);
4679
+ },
4680
+ onPaneAdd(e) {
4681
+ let i = -1;
4682
+ Array.from(e.$el.parentNode.children).some((t) => (t.className.includes("splitpanes__pane") && i++, t === e.$el));
4683
+ const s = parseFloat(e.minSize), n = parseFloat(e.maxSize);
4684
+ this.panes.splice(i, 0, {
4685
+ id: e._.uid,
4686
+ index: i,
4687
+ min: isNaN(s) ? 0 : s,
4688
+ max: isNaN(n) ? 100 : n,
4689
+ size: e.size === null ? null : parseFloat(e.size),
4690
+ givenSize: e.size,
4691
+ update: e.update
4692
+ }), this.panes.forEach((t, a) => t.index = a), this.ready && this.$nextTick(() => {
4693
+ this.redoSplitters(), this.resetPaneSizes({ addedPane: this.panes[i] }), this.$emit("pane-add", { index: i, panes: this.panes.map((t) => ({ min: t.min, max: t.max, size: t.size })) });
4694
+ });
4695
+ },
4696
+ onPaneRemove(e) {
4697
+ const i = this.panes.findIndex((n) => n.id === e._.uid), s = this.panes.splice(i, 1)[0];
4698
+ this.panes.forEach((n, t) => n.index = t), this.$nextTick(() => {
4699
+ this.redoSplitters(), this.resetPaneSizes({ removedPane: { ...s, index: i } }), this.$emit("pane-remove", { removed: s, panes: this.panes.map((n) => ({ min: n.min, max: n.max, size: n.size })) });
4700
+ });
4701
+ },
4702
+ resetPaneSizes(e = {}) {
4703
+ !e.addedPane && !e.removedPane ? this.initialPanesSizing() : this.panes.some((i) => i.givenSize !== null || i.min || i.max < 100) ? this.equalizeAfterAddOrRemove(e) : this.equalize(), this.ready && this.$emit("resized", this.panes.map((i) => ({ min: i.min, max: i.max, size: i.size })));
4704
+ },
4705
+ equalize() {
4706
+ const e = 100 / this.panesCount;
4707
+ let i = 0;
4708
+ const s = [], n = [];
4709
+ this.panes.forEach((t) => {
4710
+ t.size = Math.max(Math.min(e, t.max), t.min), i -= t.size, t.size >= t.max && s.push(t.id), t.size <= t.min && n.push(t.id);
4711
+ }), i > 0.1 && this.readjustSizes(i, s, n);
4712
+ },
4713
+ initialPanesSizing() {
4714
+ let e = 100;
4715
+ const i = [], s = [];
4716
+ let n = 0;
4717
+ this.panes.forEach((a) => {
4718
+ e -= a.size, a.size !== null && n++, a.size >= a.max && i.push(a.id), a.size <= a.min && s.push(a.id);
4719
+ });
4720
+ let t = 100;
4721
+ e > 0.1 && (this.panes.forEach((a) => {
4722
+ a.size === null && (a.size = Math.max(Math.min(e / (this.panesCount - n), a.max), a.min)), t -= a.size;
4723
+ }), t > 0.1 && this.readjustSizes(e, i, s));
4724
+ },
4725
+ equalizeAfterAddOrRemove({ addedPane: e, removedPane: i } = {}) {
4726
+ let s = 100 / this.panesCount, n = 0;
4727
+ const t = [], a = [];
4728
+ e && e.givenSize !== null && (s = (100 - e.givenSize) / (this.panesCount - 1)), this.panes.forEach((r) => {
4729
+ n -= r.size, r.size >= r.max && t.push(r.id), r.size <= r.min && a.push(r.id);
4730
+ }), !(Math.abs(n) < 0.1) && (this.panes.forEach((r) => {
4731
+ e && e.givenSize !== null && e.id === r.id || (r.size = Math.max(Math.min(s, r.max), r.min)), n -= r.size, r.size >= r.max && t.push(r.id), r.size <= r.min && a.push(r.id);
4732
+ }), n > 0.1 && this.readjustSizes(n, t, a));
4733
+ },
4734
+ readjustSizes(e, i, s) {
4735
+ let n;
4736
+ e > 0 ? n = e / (this.panesCount - i.length) : n = e / (this.panesCount - s.length), this.panes.forEach((t, a) => {
4737
+ if (e > 0 && !i.includes(t.id)) {
4738
+ const r = Math.max(Math.min(t.size + n, t.max), t.min), o = r - t.size;
4739
+ e -= o, t.size = r;
4740
+ } else if (!s.includes(t.id)) {
4741
+ const r = Math.max(Math.min(t.size + n, t.max), t.min), o = r - t.size;
4742
+ e -= o, t.size = r;
4743
+ }
4744
+ t.update({
4745
+ [this.horizontal ? "height" : "width"]: `${this.indexedPanes[t.id].size}%`
4746
+ });
4747
+ }), Math.abs(e) > 0.1 && this.$nextTick(() => {
4748
+ this.ready && console.warn("Splitpanes: Could not resize panes correctly due to their constraints.");
4749
+ });
4750
+ }
4751
+ },
4752
+ watch: {
4753
+ panes: {
4754
+ deep: !0,
4755
+ immediate: !1,
4756
+ handler() {
4757
+ this.updatePaneComponents();
4758
+ }
4759
+ },
4760
+ horizontal() {
4761
+ this.updatePaneComponents();
4762
+ },
4763
+ firstSplitter() {
4764
+ this.redoSplitters();
4765
+ },
4766
+ dblClickSplitter(e) {
4767
+ [...this.container.querySelectorAll(".splitpanes__splitter")].forEach((s, n) => {
4768
+ s.ondblclick = e ? (t) => this.onSplitterDblClick(t, n) : void 0;
4769
+ });
4770
+ }
4771
+ },
4772
+ beforeUnmount() {
4773
+ this.ready = !1;
4774
+ },
4775
+ mounted() {
4776
+ this.container = this.$refs.container, this.checkSplitpanesNodes(), this.redoSplitters(), this.resetPaneSizes(), this.$emit("ready"), this.ready = !0;
4777
+ },
4778
+ render() {
4779
+ return h(
4780
+ "div",
4781
+ {
4782
+ ref: "container",
4783
+ class: [
4784
+ "splitpanes",
4785
+ `splitpanes--${this.horizontal ? "horizontal" : "vertical"}`,
4786
+ {
4787
+ "splitpanes--dragging": this.touch.dragging
4788
+ }
4789
+ ]
4790
+ },
4791
+ this.$slots.default()
4792
+ );
4793
+ }
4794
+ }, S = (e, i) => {
4795
+ const s = e.__vccOpts || e;
4796
+ for (const [n, t] of i)
4797
+ s[n] = t;
4798
+ return s;
4799
+ }, x = {
4800
+ name: "pane",
4801
+ inject: ["requestUpdate", "onPaneAdd", "onPaneRemove", "onPaneClick"],
4802
+ props: {
4803
+ size: { type: [Number, String], default: null },
4804
+ minSize: { type: [Number, String], default: 0 },
4805
+ maxSize: { type: [Number, String], default: 100 }
4806
+ },
4807
+ data: () => ({
4808
+ style: {}
4809
+ }),
4810
+ mounted() {
4811
+ this.onPaneAdd(this);
4812
+ },
4813
+ beforeUnmount() {
4814
+ this.onPaneRemove(this);
4815
+ },
4816
+ methods: {
4817
+ update(e) {
4818
+ this.style = e;
4819
+ }
4820
+ },
4821
+ computed: {
4822
+ sizeNumber() {
4823
+ return this.size || this.size === 0 ? parseFloat(this.size) : null;
4824
+ },
4825
+ minSizeNumber() {
4826
+ return parseFloat(this.minSize);
4827
+ },
4828
+ maxSizeNumber() {
4829
+ return parseFloat(this.maxSize);
4830
+ }
4831
+ },
4832
+ watch: {
4833
+ sizeNumber(e) {
4834
+ this.requestUpdate({ target: this, size: e });
4835
+ },
4836
+ minSizeNumber(e) {
4837
+ this.requestUpdate({ target: this, min: e });
4838
+ },
4839
+ maxSizeNumber(e) {
4840
+ this.requestUpdate({ target: this, max: e });
4841
+ }
4842
+ }
4843
+ };
4844
+ function P(e, i, s, n, t, a) {
4845
+ return openBlock(), createElementBlock("div", {
4846
+ class: "splitpanes__pane",
4847
+ onClick: i[0] || (i[0] = (r) => a.onPaneClick(r, e._.uid)),
4848
+ style: normalizeStyle(e.style)
4849
+ }, [
4850
+ renderSlot(e.$slots, "default")
4851
+ ], 4);
4852
+ }
4853
+ const g = /* @__PURE__ */ S(x, [["render", P]]);
4854
+
4855
+ /* Injected with object hook! */
4856
+
4857
+ const _hoisted_1 = {
4858
+ class: "h-full",
4859
+ flex: "~ col",
4860
+ text: "gray-700 dark:gray-200"
4861
+ };
4862
+ const _hoisted_2 = /* @__PURE__ */ createBaseVNode("div", {
4863
+ class: "w-full border-b shadow flex justify-end",
4864
+ dark: "border-b-black"
4865
+ }, [
4866
+ /* @__PURE__ */ createBaseVNode("a", {
4867
+ href: "https://valaxy.site",
4868
+ target: "_blank",
4869
+ class: "bg-gray-100 dark:bg-gray-900 inline-flex justify-center items-center w-8 h-8"
4870
+ }, [
4871
+ /* @__PURE__ */ createBaseVNode("div", { "i-ri-book-line": "" })
4872
+ ])
4873
+ ], -1);
4874
+ const _hoisted_3 = {
4875
+ style: { "height": "calc(100% - 32px)" },
4876
+ overflow: "auto"
4877
+ };
4878
+ const _sfc_main = /* @__PURE__ */ defineComponent({
4879
+ __name: "index",
4880
+ setup(__props) {
4881
+ onMounted(() => {
4882
+ if (isStaticMode)
4883
+ document.title = "Valaxy DevTools (Production)";
4884
+ });
4885
+ return (_ctx, _cache) => {
4886
+ const _component_VDPostList = _sfc_main$1;
4887
+ const _component_PostPanel = _sfc_main$2;
4888
+ return openBlock(), createElementBlock("main", _hoisted_1, [
4889
+ _hoisted_2,
4890
+ createBaseVNode("div", _hoisted_3, [
4891
+ createVNode(unref(M), { class: "h-full" }, {
4892
+ default: withCtx(() => [
4893
+ createVNode(unref(g), null, {
4894
+ default: withCtx(() => [
4895
+ createVNode(_component_VDPostList)
4896
+ ]),
4897
+ _: 1
4898
+ }),
4899
+ createVNode(unref(g), null, {
4900
+ default: withCtx(() => [
4901
+ createVNode(_component_PostPanel)
4902
+ ]),
4903
+ _: 1
4904
+ })
4905
+ ]),
4906
+ _: 1
4907
+ })
4908
+ ])
4909
+ ]);
4910
+ };
4911
+ }
4912
+ });
4913
+
4914
+ /* Injected with object hook! */
4915
+
4916
+ /* Injected with object hook! */
4917
+
4918
+ export { _sfc_main as default };