@m4l/core 0.0.9 → 0.0.12

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -1,36 +1,7 @@
1
- var __defProp = Object.defineProperty;
2
- var __defProps = Object.defineProperties;
3
- var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
4
- var __getOwnPropSymbols = Object.getOwnPropertySymbols;
5
- var __hasOwnProp = Object.prototype.hasOwnProperty;
6
- var __propIsEnum = Object.prototype.propertyIsEnumerable;
7
- var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
8
- var __spreadValues = (a, b) => {
9
- for (var prop in b || (b = {}))
10
- if (__hasOwnProp.call(b, prop))
11
- __defNormalProp(a, prop, b[prop]);
12
- if (__getOwnPropSymbols)
13
- for (var prop of __getOwnPropSymbols(b)) {
14
- if (__propIsEnum.call(b, prop))
15
- __defNormalProp(a, prop, b[prop]);
16
- }
17
- return a;
18
- };
19
- var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
20
- var __objRest = (source2, exclude) => {
21
- var target = {};
22
- for (var prop in source2)
23
- if (__hasOwnProp.call(source2, prop) && exclude.indexOf(prop) < 0)
24
- target[prop] = source2[prop];
25
- if (source2 != null && __getOwnPropSymbols)
26
- for (var prop of __getOwnPropSymbols(source2)) {
27
- if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source2, prop))
28
- target[prop] = source2[prop];
29
- }
30
- return target;
31
- };
32
1
  import { createContext, useState, useContext, useCallback, useEffect, useLayoutEffect } from "react";
33
2
  import { jsx } from "react/jsx-runtime";
3
+ import { a as axios } from "./axios.js";
4
+ import { s as snakecaseKeys } from "./snakecase-keys.js";
34
5
  const initialValue$2 = {
35
6
  isLocalhost: true,
36
7
  host: "",
@@ -42,11 +13,10 @@ const initialValue$2 = {
42
13
  };
43
14
  const EnvironmentContext = createContext(initialValue$2);
44
15
  function EnvironmentProvider(props) {
45
- const _a = props, {
46
- children
47
- } = _a, other = __objRest(_a, [
48
- "children"
49
- ]);
16
+ const {
17
+ children,
18
+ ...other
19
+ } = props;
50
20
  const [finalEnvironment] = useState(other);
51
21
  return /* @__PURE__ */ jsx(EnvironmentContext.Provider, {
52
22
  value: finalEnvironment,
@@ -77,1359 +47,12 @@ function setLocalStorage(key, value) {
77
47
  try {
78
48
  const item = window.localStorage.getItem(key);
79
49
  let newValue = item !== null ? JSON.parse(item) : {};
80
- newValue = __spreadValues(__spreadValues({}, newValue), value);
50
+ newValue = { ...newValue, ...value };
81
51
  window.localStorage.setItem(key, JSON.stringify(newValue));
82
52
  } catch (e) {
83
53
  console.error(e);
84
54
  }
85
55
  }
86
- function getAugmentedNamespace(n) {
87
- if (n.__esModule)
88
- return n;
89
- var a = Object.defineProperty({}, "__esModule", { value: true });
90
- Object.keys(n).forEach(function(k) {
91
- var d = Object.getOwnPropertyDescriptor(n, k);
92
- Object.defineProperty(a, k, d.get ? d : {
93
- enumerable: true,
94
- get: function() {
95
- return n[k];
96
- }
97
- });
98
- });
99
- return a;
100
- }
101
- var axios$2 = { exports: {} };
102
- var bind$2 = function bind(fn, thisArg) {
103
- return function wrap() {
104
- var args = new Array(arguments.length);
105
- for (var i = 0; i < args.length; i++) {
106
- args[i] = arguments[i];
107
- }
108
- return fn.apply(thisArg, args);
109
- };
110
- };
111
- var bind$1 = bind$2;
112
- var toString = Object.prototype.toString;
113
- var kindOf = function(cache) {
114
- return function(thing) {
115
- var str = toString.call(thing);
116
- return cache[str] || (cache[str] = str.slice(8, -1).toLowerCase());
117
- };
118
- }(/* @__PURE__ */ Object.create(null));
119
- function kindOfTest(type) {
120
- type = type.toLowerCase();
121
- return function isKindOf(thing) {
122
- return kindOf(thing) === type;
123
- };
124
- }
125
- function isArray(val) {
126
- return Array.isArray(val);
127
- }
128
- function isUndefined(val) {
129
- return typeof val === "undefined";
130
- }
131
- function isBuffer(val) {
132
- return val !== null && !isUndefined(val) && val.constructor !== null && !isUndefined(val.constructor) && typeof val.constructor.isBuffer === "function" && val.constructor.isBuffer(val);
133
- }
134
- var isArrayBuffer = kindOfTest("ArrayBuffer");
135
- function isArrayBufferView(val) {
136
- var result;
137
- if (typeof ArrayBuffer !== "undefined" && ArrayBuffer.isView) {
138
- result = ArrayBuffer.isView(val);
139
- } else {
140
- result = val && val.buffer && isArrayBuffer(val.buffer);
141
- }
142
- return result;
143
- }
144
- function isString(val) {
145
- return typeof val === "string";
146
- }
147
- function isNumber(val) {
148
- return typeof val === "number";
149
- }
150
- function isObject$1(val) {
151
- return val !== null && typeof val === "object";
152
- }
153
- function isPlainObject(val) {
154
- if (kindOf(val) !== "object") {
155
- return false;
156
- }
157
- var prototype2 = Object.getPrototypeOf(val);
158
- return prototype2 === null || prototype2 === Object.prototype;
159
- }
160
- var isDate = kindOfTest("Date");
161
- var isFile = kindOfTest("File");
162
- var isBlob = kindOfTest("Blob");
163
- var isFileList = kindOfTest("FileList");
164
- function isFunction(val) {
165
- return toString.call(val) === "[object Function]";
166
- }
167
- function isStream(val) {
168
- return isObject$1(val) && isFunction(val.pipe);
169
- }
170
- function isFormData(thing) {
171
- var pattern = "[object FormData]";
172
- return thing && (typeof FormData === "function" && thing instanceof FormData || toString.call(thing) === pattern || isFunction(thing.toString) && thing.toString() === pattern);
173
- }
174
- var isURLSearchParams = kindOfTest("URLSearchParams");
175
- function trim(str) {
176
- return str.trim ? str.trim() : str.replace(/^\s+|\s+$/g, "");
177
- }
178
- function isStandardBrowserEnv() {
179
- if (typeof navigator !== "undefined" && (navigator.product === "ReactNative" || navigator.product === "NativeScript" || navigator.product === "NS")) {
180
- return false;
181
- }
182
- return typeof window !== "undefined" && typeof document !== "undefined";
183
- }
184
- function forEach(obj, fn) {
185
- if (obj === null || typeof obj === "undefined") {
186
- return;
187
- }
188
- if (typeof obj !== "object") {
189
- obj = [obj];
190
- }
191
- if (isArray(obj)) {
192
- for (var i = 0, l = obj.length; i < l; i++) {
193
- fn.call(null, obj[i], i, obj);
194
- }
195
- } else {
196
- for (var key in obj) {
197
- if (Object.prototype.hasOwnProperty.call(obj, key)) {
198
- fn.call(null, obj[key], key, obj);
199
- }
200
- }
201
- }
202
- }
203
- function merge() {
204
- var result = {};
205
- function assignValue(val, key) {
206
- if (isPlainObject(result[key]) && isPlainObject(val)) {
207
- result[key] = merge(result[key], val);
208
- } else if (isPlainObject(val)) {
209
- result[key] = merge({}, val);
210
- } else if (isArray(val)) {
211
- result[key] = val.slice();
212
- } else {
213
- result[key] = val;
214
- }
215
- }
216
- for (var i = 0, l = arguments.length; i < l; i++) {
217
- forEach(arguments[i], assignValue);
218
- }
219
- return result;
220
- }
221
- function extend(a, b, thisArg) {
222
- forEach(b, function assignValue(val, key) {
223
- if (thisArg && typeof val === "function") {
224
- a[key] = bind$1(val, thisArg);
225
- } else {
226
- a[key] = val;
227
- }
228
- });
229
- return a;
230
- }
231
- function stripBOM(content) {
232
- if (content.charCodeAt(0) === 65279) {
233
- content = content.slice(1);
234
- }
235
- return content;
236
- }
237
- function inherits(constructor, superConstructor, props, descriptors2) {
238
- constructor.prototype = Object.create(superConstructor.prototype, descriptors2);
239
- constructor.prototype.constructor = constructor;
240
- props && Object.assign(constructor.prototype, props);
241
- }
242
- function toFlatObject(sourceObj, destObj, filter) {
243
- var props;
244
- var i;
245
- var prop;
246
- var merged = {};
247
- destObj = destObj || {};
248
- do {
249
- props = Object.getOwnPropertyNames(sourceObj);
250
- i = props.length;
251
- while (i-- > 0) {
252
- prop = props[i];
253
- if (!merged[prop]) {
254
- destObj[prop] = sourceObj[prop];
255
- merged[prop] = true;
256
- }
257
- }
258
- sourceObj = Object.getPrototypeOf(sourceObj);
259
- } while (sourceObj && (!filter || filter(sourceObj, destObj)) && sourceObj !== Object.prototype);
260
- return destObj;
261
- }
262
- function endsWith(str, searchString, position) {
263
- str = String(str);
264
- if (position === void 0 || position > str.length) {
265
- position = str.length;
266
- }
267
- position -= searchString.length;
268
- var lastIndex = str.indexOf(searchString, position);
269
- return lastIndex !== -1 && lastIndex === position;
270
- }
271
- function toArray(thing) {
272
- if (!thing)
273
- return null;
274
- var i = thing.length;
275
- if (isUndefined(i))
276
- return null;
277
- var arr = new Array(i);
278
- while (i-- > 0) {
279
- arr[i] = thing[i];
280
- }
281
- return arr;
282
- }
283
- var isTypedArray = function(TypedArray) {
284
- return function(thing) {
285
- return TypedArray && thing instanceof TypedArray;
286
- };
287
- }(typeof Uint8Array !== "undefined" && Object.getPrototypeOf(Uint8Array));
288
- var utils$h = {
289
- isArray,
290
- isArrayBuffer,
291
- isBuffer,
292
- isFormData,
293
- isArrayBufferView,
294
- isString,
295
- isNumber,
296
- isObject: isObject$1,
297
- isPlainObject,
298
- isUndefined,
299
- isDate,
300
- isFile,
301
- isBlob,
302
- isFunction,
303
- isStream,
304
- isURLSearchParams,
305
- isStandardBrowserEnv,
306
- forEach,
307
- merge,
308
- extend,
309
- trim,
310
- stripBOM,
311
- inherits,
312
- toFlatObject,
313
- kindOf,
314
- kindOfTest,
315
- endsWith,
316
- toArray,
317
- isTypedArray,
318
- isFileList
319
- };
320
- var utils$g = utils$h;
321
- function encode(val) {
322
- return encodeURIComponent(val).replace(/%3A/gi, ":").replace(/%24/g, "$").replace(/%2C/gi, ",").replace(/%20/g, "+").replace(/%5B/gi, "[").replace(/%5D/gi, "]");
323
- }
324
- var buildURL$2 = function buildURL(url, params, paramsSerializer) {
325
- if (!params) {
326
- return url;
327
- }
328
- var serializedParams;
329
- if (paramsSerializer) {
330
- serializedParams = paramsSerializer(params);
331
- } else if (utils$g.isURLSearchParams(params)) {
332
- serializedParams = params.toString();
333
- } else {
334
- var parts = [];
335
- utils$g.forEach(params, function serialize(val, key) {
336
- if (val === null || typeof val === "undefined") {
337
- return;
338
- }
339
- if (utils$g.isArray(val)) {
340
- key = key + "[]";
341
- } else {
342
- val = [val];
343
- }
344
- utils$g.forEach(val, function parseValue(v) {
345
- if (utils$g.isDate(v)) {
346
- v = v.toISOString();
347
- } else if (utils$g.isObject(v)) {
348
- v = JSON.stringify(v);
349
- }
350
- parts.push(encode(key) + "=" + encode(v));
351
- });
352
- });
353
- serializedParams = parts.join("&");
354
- }
355
- if (serializedParams) {
356
- var hashmarkIndex = url.indexOf("#");
357
- if (hashmarkIndex !== -1) {
358
- url = url.slice(0, hashmarkIndex);
359
- }
360
- url += (url.indexOf("?") === -1 ? "?" : "&") + serializedParams;
361
- }
362
- return url;
363
- };
364
- var utils$f = utils$h;
365
- function InterceptorManager$1() {
366
- this.handlers = [];
367
- }
368
- InterceptorManager$1.prototype.use = function use(fulfilled, rejected, options) {
369
- this.handlers.push({
370
- fulfilled,
371
- rejected,
372
- synchronous: options ? options.synchronous : false,
373
- runWhen: options ? options.runWhen : null
374
- });
375
- return this.handlers.length - 1;
376
- };
377
- InterceptorManager$1.prototype.eject = function eject(id) {
378
- if (this.handlers[id]) {
379
- this.handlers[id] = null;
380
- }
381
- };
382
- InterceptorManager$1.prototype.forEach = function forEach2(fn) {
383
- utils$f.forEach(this.handlers, function forEachHandler(h) {
384
- if (h !== null) {
385
- fn(h);
386
- }
387
- });
388
- };
389
- var InterceptorManager_1 = InterceptorManager$1;
390
- var utils$e = utils$h;
391
- var normalizeHeaderName$1 = function normalizeHeaderName(headers, normalizedName) {
392
- utils$e.forEach(headers, function processHeader(value, name) {
393
- if (name !== normalizedName && name.toUpperCase() === normalizedName.toUpperCase()) {
394
- headers[normalizedName] = value;
395
- delete headers[name];
396
- }
397
- });
398
- };
399
- var utils$d = utils$h;
400
- function AxiosError$5(message, code, config, request2, response) {
401
- Error.call(this);
402
- this.message = message;
403
- this.name = "AxiosError";
404
- code && (this.code = code);
405
- config && (this.config = config);
406
- request2 && (this.request = request2);
407
- response && (this.response = response);
408
- }
409
- utils$d.inherits(AxiosError$5, Error, {
410
- toJSON: function toJSON() {
411
- return {
412
- message: this.message,
413
- name: this.name,
414
- description: this.description,
415
- number: this.number,
416
- fileName: this.fileName,
417
- lineNumber: this.lineNumber,
418
- columnNumber: this.columnNumber,
419
- stack: this.stack,
420
- config: this.config,
421
- code: this.code,
422
- status: this.response && this.response.status ? this.response.status : null
423
- };
424
- }
425
- });
426
- var prototype = AxiosError$5.prototype;
427
- var descriptors = {};
428
- [
429
- "ERR_BAD_OPTION_VALUE",
430
- "ERR_BAD_OPTION",
431
- "ECONNABORTED",
432
- "ETIMEDOUT",
433
- "ERR_NETWORK",
434
- "ERR_FR_TOO_MANY_REDIRECTS",
435
- "ERR_DEPRECATED",
436
- "ERR_BAD_RESPONSE",
437
- "ERR_BAD_REQUEST",
438
- "ERR_CANCELED"
439
- ].forEach(function(code) {
440
- descriptors[code] = { value: code };
441
- });
442
- Object.defineProperties(AxiosError$5, descriptors);
443
- Object.defineProperty(prototype, "isAxiosError", { value: true });
444
- AxiosError$5.from = function(error, code, config, request2, response, customProps) {
445
- var axiosError = Object.create(prototype);
446
- utils$d.toFlatObject(error, axiosError, function filter(obj) {
447
- return obj !== Error.prototype;
448
- });
449
- AxiosError$5.call(axiosError, error.message, code, config, request2, response);
450
- axiosError.name = error.name;
451
- customProps && Object.assign(axiosError, customProps);
452
- return axiosError;
453
- };
454
- var AxiosError_1 = AxiosError$5;
455
- var transitional = {
456
- silentJSONParsing: true,
457
- forcedJSONParsing: true,
458
- clarifyTimeoutError: false
459
- };
460
- var utils$c = utils$h;
461
- function toFormData$1(obj, formData) {
462
- formData = formData || new FormData();
463
- var stack = [];
464
- function convertValue(value) {
465
- if (value === null)
466
- return "";
467
- if (utils$c.isDate(value)) {
468
- return value.toISOString();
469
- }
470
- if (utils$c.isArrayBuffer(value) || utils$c.isTypedArray(value)) {
471
- return typeof Blob === "function" ? new Blob([value]) : Buffer.from(value);
472
- }
473
- return value;
474
- }
475
- function build(data2, parentKey) {
476
- if (utils$c.isPlainObject(data2) || utils$c.isArray(data2)) {
477
- if (stack.indexOf(data2) !== -1) {
478
- throw Error("Circular reference detected in " + parentKey);
479
- }
480
- stack.push(data2);
481
- utils$c.forEach(data2, function each(value, key) {
482
- if (utils$c.isUndefined(value))
483
- return;
484
- var fullKey = parentKey ? parentKey + "." + key : key;
485
- var arr;
486
- if (value && !parentKey && typeof value === "object") {
487
- if (utils$c.endsWith(key, "{}")) {
488
- value = JSON.stringify(value);
489
- } else if (utils$c.endsWith(key, "[]") && (arr = utils$c.toArray(value))) {
490
- arr.forEach(function(el) {
491
- !utils$c.isUndefined(el) && formData.append(fullKey, convertValue(el));
492
- });
493
- return;
494
- }
495
- }
496
- build(value, fullKey);
497
- });
498
- stack.pop();
499
- } else {
500
- formData.append(parentKey, convertValue(data2));
501
- }
502
- }
503
- build(obj);
504
- return formData;
505
- }
506
- var toFormData_1 = toFormData$1;
507
- var AxiosError$4 = AxiosError_1;
508
- var settle$1 = function settle(resolve, reject, response) {
509
- var validateStatus2 = response.config.validateStatus;
510
- if (!response.status || !validateStatus2 || validateStatus2(response.status)) {
511
- resolve(response);
512
- } else {
513
- reject(new AxiosError$4("Request failed with status code " + response.status, [AxiosError$4.ERR_BAD_REQUEST, AxiosError$4.ERR_BAD_RESPONSE][Math.floor(response.status / 100) - 4], response.config, response.request, response));
514
- }
515
- };
516
- var utils$b = utils$h;
517
- var cookies$1 = utils$b.isStandardBrowserEnv() ? function standardBrowserEnv() {
518
- return {
519
- write: function write(name, value, expires, path, domain, secure) {
520
- var cookie = [];
521
- cookie.push(name + "=" + encodeURIComponent(value));
522
- if (utils$b.isNumber(expires)) {
523
- cookie.push("expires=" + new Date(expires).toGMTString());
524
- }
525
- if (utils$b.isString(path)) {
526
- cookie.push("path=" + path);
527
- }
528
- if (utils$b.isString(domain)) {
529
- cookie.push("domain=" + domain);
530
- }
531
- if (secure === true) {
532
- cookie.push("secure");
533
- }
534
- document.cookie = cookie.join("; ");
535
- },
536
- read: function read(name) {
537
- var match = document.cookie.match(new RegExp("(^|;\\s*)(" + name + ")=([^;]*)"));
538
- return match ? decodeURIComponent(match[3]) : null;
539
- },
540
- remove: function remove(name) {
541
- this.write(name, "", Date.now() - 864e5);
542
- }
543
- };
544
- }() : function nonStandardBrowserEnv() {
545
- return {
546
- write: function write() {
547
- },
548
- read: function read() {
549
- return null;
550
- },
551
- remove: function remove() {
552
- }
553
- };
554
- }();
555
- var isAbsoluteURL$1 = function isAbsoluteURL(url) {
556
- return /^([a-z][a-z\d+\-.]*:)?\/\//i.test(url);
557
- };
558
- var combineURLs$1 = function combineURLs(baseURL, relativeURL) {
559
- return relativeURL ? baseURL.replace(/\/+$/, "") + "/" + relativeURL.replace(/^\/+/, "") : baseURL;
560
- };
561
- var isAbsoluteURL2 = isAbsoluteURL$1;
562
- var combineURLs2 = combineURLs$1;
563
- var buildFullPath$2 = function buildFullPath(baseURL, requestedURL) {
564
- if (baseURL && !isAbsoluteURL2(requestedURL)) {
565
- return combineURLs2(baseURL, requestedURL);
566
- }
567
- return requestedURL;
568
- };
569
- var utils$a = utils$h;
570
- var ignoreDuplicateOf = [
571
- "age",
572
- "authorization",
573
- "content-length",
574
- "content-type",
575
- "etag",
576
- "expires",
577
- "from",
578
- "host",
579
- "if-modified-since",
580
- "if-unmodified-since",
581
- "last-modified",
582
- "location",
583
- "max-forwards",
584
- "proxy-authorization",
585
- "referer",
586
- "retry-after",
587
- "user-agent"
588
- ];
589
- var parseHeaders$1 = function parseHeaders(headers) {
590
- var parsed = {};
591
- var key;
592
- var val;
593
- var i;
594
- if (!headers) {
595
- return parsed;
596
- }
597
- utils$a.forEach(headers.split("\n"), function parser(line) {
598
- i = line.indexOf(":");
599
- key = utils$a.trim(line.substr(0, i)).toLowerCase();
600
- val = utils$a.trim(line.substr(i + 1));
601
- if (key) {
602
- if (parsed[key] && ignoreDuplicateOf.indexOf(key) >= 0) {
603
- return;
604
- }
605
- if (key === "set-cookie") {
606
- parsed[key] = (parsed[key] ? parsed[key] : []).concat([val]);
607
- } else {
608
- parsed[key] = parsed[key] ? parsed[key] + ", " + val : val;
609
- }
610
- }
611
- });
612
- return parsed;
613
- };
614
- var utils$9 = utils$h;
615
- var isURLSameOrigin$1 = utils$9.isStandardBrowserEnv() ? function standardBrowserEnv2() {
616
- var msie = /(msie|trident)/i.test(navigator.userAgent);
617
- var urlParsingNode = document.createElement("a");
618
- var originURL;
619
- function resolveURL(url) {
620
- var href = url;
621
- if (msie) {
622
- urlParsingNode.setAttribute("href", href);
623
- href = urlParsingNode.href;
624
- }
625
- urlParsingNode.setAttribute("href", href);
626
- return {
627
- href: urlParsingNode.href,
628
- protocol: urlParsingNode.protocol ? urlParsingNode.protocol.replace(/:$/, "") : "",
629
- host: urlParsingNode.host,
630
- search: urlParsingNode.search ? urlParsingNode.search.replace(/^\?/, "") : "",
631
- hash: urlParsingNode.hash ? urlParsingNode.hash.replace(/^#/, "") : "",
632
- hostname: urlParsingNode.hostname,
633
- port: urlParsingNode.port,
634
- pathname: urlParsingNode.pathname.charAt(0) === "/" ? urlParsingNode.pathname : "/" + urlParsingNode.pathname
635
- };
636
- }
637
- originURL = resolveURL(window.location.href);
638
- return function isURLSameOrigin2(requestURL) {
639
- var parsed = utils$9.isString(requestURL) ? resolveURL(requestURL) : requestURL;
640
- return parsed.protocol === originURL.protocol && parsed.host === originURL.host;
641
- };
642
- }() : function nonStandardBrowserEnv2() {
643
- return function isURLSameOrigin2() {
644
- return true;
645
- };
646
- }();
647
- var AxiosError$3 = AxiosError_1;
648
- var utils$8 = utils$h;
649
- function CanceledError$3(message) {
650
- AxiosError$3.call(this, message == null ? "canceled" : message, AxiosError$3.ERR_CANCELED);
651
- this.name = "CanceledError";
652
- }
653
- utils$8.inherits(CanceledError$3, AxiosError$3, {
654
- __CANCEL__: true
655
- });
656
- var CanceledError_1 = CanceledError$3;
657
- var parseProtocol$1 = function parseProtocol(url) {
658
- var match = /^([-+\w]{1,25})(:?\/\/|:)/.exec(url);
659
- return match && match[1] || "";
660
- };
661
- var utils$7 = utils$h;
662
- var settle2 = settle$1;
663
- var cookies = cookies$1;
664
- var buildURL$1 = buildURL$2;
665
- var buildFullPath$1 = buildFullPath$2;
666
- var parseHeaders2 = parseHeaders$1;
667
- var isURLSameOrigin = isURLSameOrigin$1;
668
- var transitionalDefaults$1 = transitional;
669
- var AxiosError$2 = AxiosError_1;
670
- var CanceledError$2 = CanceledError_1;
671
- var parseProtocol2 = parseProtocol$1;
672
- var xhr = function xhrAdapter(config) {
673
- return new Promise(function dispatchXhrRequest(resolve, reject) {
674
- var requestData = config.data;
675
- var requestHeaders = config.headers;
676
- var responseType = config.responseType;
677
- var onCanceled;
678
- function done() {
679
- if (config.cancelToken) {
680
- config.cancelToken.unsubscribe(onCanceled);
681
- }
682
- if (config.signal) {
683
- config.signal.removeEventListener("abort", onCanceled);
684
- }
685
- }
686
- if (utils$7.isFormData(requestData) && utils$7.isStandardBrowserEnv()) {
687
- delete requestHeaders["Content-Type"];
688
- }
689
- var request2 = new XMLHttpRequest();
690
- if (config.auth) {
691
- var username = config.auth.username || "";
692
- var password = config.auth.password ? unescape(encodeURIComponent(config.auth.password)) : "";
693
- requestHeaders.Authorization = "Basic " + btoa(username + ":" + password);
694
- }
695
- var fullPath = buildFullPath$1(config.baseURL, config.url);
696
- request2.open(config.method.toUpperCase(), buildURL$1(fullPath, config.params, config.paramsSerializer), true);
697
- request2.timeout = config.timeout;
698
- function onloadend() {
699
- if (!request2) {
700
- return;
701
- }
702
- var responseHeaders = "getAllResponseHeaders" in request2 ? parseHeaders2(request2.getAllResponseHeaders()) : null;
703
- var responseData = !responseType || responseType === "text" || responseType === "json" ? request2.responseText : request2.response;
704
- var response = {
705
- data: responseData,
706
- status: request2.status,
707
- statusText: request2.statusText,
708
- headers: responseHeaders,
709
- config,
710
- request: request2
711
- };
712
- settle2(function _resolve(value) {
713
- resolve(value);
714
- done();
715
- }, function _reject(err) {
716
- reject(err);
717
- done();
718
- }, response);
719
- request2 = null;
720
- }
721
- if ("onloadend" in request2) {
722
- request2.onloadend = onloadend;
723
- } else {
724
- request2.onreadystatechange = function handleLoad() {
725
- if (!request2 || request2.readyState !== 4) {
726
- return;
727
- }
728
- if (request2.status === 0 && !(request2.responseURL && request2.responseURL.indexOf("file:") === 0)) {
729
- return;
730
- }
731
- setTimeout(onloadend);
732
- };
733
- }
734
- request2.onabort = function handleAbort() {
735
- if (!request2) {
736
- return;
737
- }
738
- reject(new AxiosError$2("Request aborted", AxiosError$2.ECONNABORTED, config, request2));
739
- request2 = null;
740
- };
741
- request2.onerror = function handleError() {
742
- reject(new AxiosError$2("Network Error", AxiosError$2.ERR_NETWORK, config, request2, request2));
743
- request2 = null;
744
- };
745
- request2.ontimeout = function handleTimeout() {
746
- var timeoutErrorMessage = config.timeout ? "timeout of " + config.timeout + "ms exceeded" : "timeout exceeded";
747
- var transitional3 = config.transitional || transitionalDefaults$1;
748
- if (config.timeoutErrorMessage) {
749
- timeoutErrorMessage = config.timeoutErrorMessage;
750
- }
751
- reject(new AxiosError$2(timeoutErrorMessage, transitional3.clarifyTimeoutError ? AxiosError$2.ETIMEDOUT : AxiosError$2.ECONNABORTED, config, request2));
752
- request2 = null;
753
- };
754
- if (utils$7.isStandardBrowserEnv()) {
755
- var xsrfValue = (config.withCredentials || isURLSameOrigin(fullPath)) && config.xsrfCookieName ? cookies.read(config.xsrfCookieName) : void 0;
756
- if (xsrfValue) {
757
- requestHeaders[config.xsrfHeaderName] = xsrfValue;
758
- }
759
- }
760
- if ("setRequestHeader" in request2) {
761
- utils$7.forEach(requestHeaders, function setRequestHeader(val, key) {
762
- if (typeof requestData === "undefined" && key.toLowerCase() === "content-type") {
763
- delete requestHeaders[key];
764
- } else {
765
- request2.setRequestHeader(key, val);
766
- }
767
- });
768
- }
769
- if (!utils$7.isUndefined(config.withCredentials)) {
770
- request2.withCredentials = !!config.withCredentials;
771
- }
772
- if (responseType && responseType !== "json") {
773
- request2.responseType = config.responseType;
774
- }
775
- if (typeof config.onDownloadProgress === "function") {
776
- request2.addEventListener("progress", config.onDownloadProgress);
777
- }
778
- if (typeof config.onUploadProgress === "function" && request2.upload) {
779
- request2.upload.addEventListener("progress", config.onUploadProgress);
780
- }
781
- if (config.cancelToken || config.signal) {
782
- onCanceled = function(cancel) {
783
- if (!request2) {
784
- return;
785
- }
786
- reject(!cancel || cancel && cancel.type ? new CanceledError$2() : cancel);
787
- request2.abort();
788
- request2 = null;
789
- };
790
- config.cancelToken && config.cancelToken.subscribe(onCanceled);
791
- if (config.signal) {
792
- config.signal.aborted ? onCanceled() : config.signal.addEventListener("abort", onCanceled);
793
- }
794
- }
795
- if (!requestData) {
796
- requestData = null;
797
- }
798
- var protocol = parseProtocol2(fullPath);
799
- if (protocol && ["http", "https", "file"].indexOf(protocol) === -1) {
800
- reject(new AxiosError$2("Unsupported protocol " + protocol + ":", AxiosError$2.ERR_BAD_REQUEST, config));
801
- return;
802
- }
803
- request2.send(requestData);
804
- });
805
- };
806
- var _null = null;
807
- var utils$6 = utils$h;
808
- var normalizeHeaderName2 = normalizeHeaderName$1;
809
- var AxiosError$1 = AxiosError_1;
810
- var transitionalDefaults = transitional;
811
- var toFormData = toFormData_1;
812
- var DEFAULT_CONTENT_TYPE = {
813
- "Content-Type": "application/x-www-form-urlencoded"
814
- };
815
- function setContentTypeIfUnset(headers, value) {
816
- if (!utils$6.isUndefined(headers) && utils$6.isUndefined(headers["Content-Type"])) {
817
- headers["Content-Type"] = value;
818
- }
819
- }
820
- function getDefaultAdapter() {
821
- var adapter;
822
- if (typeof XMLHttpRequest !== "undefined") {
823
- adapter = xhr;
824
- } else if (typeof process !== "undefined" && Object.prototype.toString.call(process) === "[object process]") {
825
- adapter = xhr;
826
- }
827
- return adapter;
828
- }
829
- function stringifySafely(rawValue, parser, encoder) {
830
- if (utils$6.isString(rawValue)) {
831
- try {
832
- (parser || JSON.parse)(rawValue);
833
- return utils$6.trim(rawValue);
834
- } catch (e) {
835
- if (e.name !== "SyntaxError") {
836
- throw e;
837
- }
838
- }
839
- }
840
- return (encoder || JSON.stringify)(rawValue);
841
- }
842
- var defaults$3 = {
843
- transitional: transitionalDefaults,
844
- adapter: getDefaultAdapter(),
845
- transformRequest: [function transformRequest(data2, headers) {
846
- normalizeHeaderName2(headers, "Accept");
847
- normalizeHeaderName2(headers, "Content-Type");
848
- if (utils$6.isFormData(data2) || utils$6.isArrayBuffer(data2) || utils$6.isBuffer(data2) || utils$6.isStream(data2) || utils$6.isFile(data2) || utils$6.isBlob(data2)) {
849
- return data2;
850
- }
851
- if (utils$6.isArrayBufferView(data2)) {
852
- return data2.buffer;
853
- }
854
- if (utils$6.isURLSearchParams(data2)) {
855
- setContentTypeIfUnset(headers, "application/x-www-form-urlencoded;charset=utf-8");
856
- return data2.toString();
857
- }
858
- var isObjectPayload = utils$6.isObject(data2);
859
- var contentType = headers && headers["Content-Type"];
860
- var isFileList2;
861
- if ((isFileList2 = utils$6.isFileList(data2)) || isObjectPayload && contentType === "multipart/form-data") {
862
- var _FormData = this.env && this.env.FormData;
863
- return toFormData(isFileList2 ? { "files[]": data2 } : data2, _FormData && new _FormData());
864
- } else if (isObjectPayload || contentType === "application/json") {
865
- setContentTypeIfUnset(headers, "application/json");
866
- return stringifySafely(data2);
867
- }
868
- return data2;
869
- }],
870
- transformResponse: [function transformResponse(data2) {
871
- var transitional3 = this.transitional || defaults$3.transitional;
872
- var silentJSONParsing = transitional3 && transitional3.silentJSONParsing;
873
- var forcedJSONParsing = transitional3 && transitional3.forcedJSONParsing;
874
- var strictJSONParsing = !silentJSONParsing && this.responseType === "json";
875
- if (strictJSONParsing || forcedJSONParsing && utils$6.isString(data2) && data2.length) {
876
- try {
877
- return JSON.parse(data2);
878
- } catch (e) {
879
- if (strictJSONParsing) {
880
- if (e.name === "SyntaxError") {
881
- throw AxiosError$1.from(e, AxiosError$1.ERR_BAD_RESPONSE, this, null, this.response);
882
- }
883
- throw e;
884
- }
885
- }
886
- }
887
- return data2;
888
- }],
889
- timeout: 0,
890
- xsrfCookieName: "XSRF-TOKEN",
891
- xsrfHeaderName: "X-XSRF-TOKEN",
892
- maxContentLength: -1,
893
- maxBodyLength: -1,
894
- env: {
895
- FormData: _null
896
- },
897
- validateStatus: function validateStatus(status) {
898
- return status >= 200 && status < 300;
899
- },
900
- headers: {
901
- common: {
902
- "Accept": "application/json, text/plain, */*"
903
- }
904
- }
905
- };
906
- utils$6.forEach(["delete", "get", "head"], function forEachMethodNoData(method) {
907
- defaults$3.headers[method] = {};
908
- });
909
- utils$6.forEach(["post", "put", "patch"], function forEachMethodWithData(method) {
910
- defaults$3.headers[method] = utils$6.merge(DEFAULT_CONTENT_TYPE);
911
- });
912
- var defaults_1 = defaults$3;
913
- var utils$5 = utils$h;
914
- var defaults$2 = defaults_1;
915
- var transformData$1 = function transformData(data2, headers, fns) {
916
- var context = this || defaults$2;
917
- utils$5.forEach(fns, function transform(fn) {
918
- data2 = fn.call(context, data2, headers);
919
- });
920
- return data2;
921
- };
922
- var isCancel$1 = function isCancel(value) {
923
- return !!(value && value.__CANCEL__);
924
- };
925
- var utils$4 = utils$h;
926
- var transformData2 = transformData$1;
927
- var isCancel2 = isCancel$1;
928
- var defaults$1 = defaults_1;
929
- var CanceledError$1 = CanceledError_1;
930
- function throwIfCancellationRequested(config) {
931
- if (config.cancelToken) {
932
- config.cancelToken.throwIfRequested();
933
- }
934
- if (config.signal && config.signal.aborted) {
935
- throw new CanceledError$1();
936
- }
937
- }
938
- var dispatchRequest$1 = function dispatchRequest(config) {
939
- throwIfCancellationRequested(config);
940
- config.headers = config.headers || {};
941
- config.data = transformData2.call(config, config.data, config.headers, config.transformRequest);
942
- config.headers = utils$4.merge(config.headers.common || {}, config.headers[config.method] || {}, config.headers);
943
- utils$4.forEach(["delete", "get", "head", "post", "put", "patch", "common"], function cleanHeaderConfig(method) {
944
- delete config.headers[method];
945
- });
946
- var adapter = config.adapter || defaults$1.adapter;
947
- return adapter(config).then(function onAdapterResolution(response) {
948
- throwIfCancellationRequested(config);
949
- response.data = transformData2.call(config, response.data, response.headers, config.transformResponse);
950
- return response;
951
- }, function onAdapterRejection(reason) {
952
- if (!isCancel2(reason)) {
953
- throwIfCancellationRequested(config);
954
- if (reason && reason.response) {
955
- reason.response.data = transformData2.call(config, reason.response.data, reason.response.headers, config.transformResponse);
956
- }
957
- }
958
- return Promise.reject(reason);
959
- });
960
- };
961
- var utils$3 = utils$h;
962
- var mergeConfig$2 = function mergeConfig(config1, config2) {
963
- config2 = config2 || {};
964
- var config = {};
965
- function getMergedValue(target, source2) {
966
- if (utils$3.isPlainObject(target) && utils$3.isPlainObject(source2)) {
967
- return utils$3.merge(target, source2);
968
- } else if (utils$3.isPlainObject(source2)) {
969
- return utils$3.merge({}, source2);
970
- } else if (utils$3.isArray(source2)) {
971
- return source2.slice();
972
- }
973
- return source2;
974
- }
975
- function mergeDeepProperties(prop) {
976
- if (!utils$3.isUndefined(config2[prop])) {
977
- return getMergedValue(config1[prop], config2[prop]);
978
- } else if (!utils$3.isUndefined(config1[prop])) {
979
- return getMergedValue(void 0, config1[prop]);
980
- }
981
- }
982
- function valueFromConfig2(prop) {
983
- if (!utils$3.isUndefined(config2[prop])) {
984
- return getMergedValue(void 0, config2[prop]);
985
- }
986
- }
987
- function defaultToConfig2(prop) {
988
- if (!utils$3.isUndefined(config2[prop])) {
989
- return getMergedValue(void 0, config2[prop]);
990
- } else if (!utils$3.isUndefined(config1[prop])) {
991
- return getMergedValue(void 0, config1[prop]);
992
- }
993
- }
994
- function mergeDirectKeys(prop) {
995
- if (prop in config2) {
996
- return getMergedValue(config1[prop], config2[prop]);
997
- } else if (prop in config1) {
998
- return getMergedValue(void 0, config1[prop]);
999
- }
1000
- }
1001
- var mergeMap = {
1002
- "url": valueFromConfig2,
1003
- "method": valueFromConfig2,
1004
- "data": valueFromConfig2,
1005
- "baseURL": defaultToConfig2,
1006
- "transformRequest": defaultToConfig2,
1007
- "transformResponse": defaultToConfig2,
1008
- "paramsSerializer": defaultToConfig2,
1009
- "timeout": defaultToConfig2,
1010
- "timeoutMessage": defaultToConfig2,
1011
- "withCredentials": defaultToConfig2,
1012
- "adapter": defaultToConfig2,
1013
- "responseType": defaultToConfig2,
1014
- "xsrfCookieName": defaultToConfig2,
1015
- "xsrfHeaderName": defaultToConfig2,
1016
- "onUploadProgress": defaultToConfig2,
1017
- "onDownloadProgress": defaultToConfig2,
1018
- "decompress": defaultToConfig2,
1019
- "maxContentLength": defaultToConfig2,
1020
- "maxBodyLength": defaultToConfig2,
1021
- "beforeRedirect": defaultToConfig2,
1022
- "transport": defaultToConfig2,
1023
- "httpAgent": defaultToConfig2,
1024
- "httpsAgent": defaultToConfig2,
1025
- "cancelToken": defaultToConfig2,
1026
- "socketPath": defaultToConfig2,
1027
- "responseEncoding": defaultToConfig2,
1028
- "validateStatus": mergeDirectKeys
1029
- };
1030
- utils$3.forEach(Object.keys(config1).concat(Object.keys(config2)), function computeConfigValue(prop) {
1031
- var merge2 = mergeMap[prop] || mergeDeepProperties;
1032
- var configValue = merge2(prop);
1033
- utils$3.isUndefined(configValue) && merge2 !== mergeDirectKeys || (config[prop] = configValue);
1034
- });
1035
- return config;
1036
- };
1037
- var data = {
1038
- "version": "0.27.2"
1039
- };
1040
- var VERSION = data.version;
1041
- var AxiosError = AxiosError_1;
1042
- var validators$1 = {};
1043
- ["object", "boolean", "number", "function", "string", "symbol"].forEach(function(type, i) {
1044
- validators$1[type] = function validator2(thing) {
1045
- return typeof thing === type || "a" + (i < 1 ? "n " : " ") + type;
1046
- };
1047
- });
1048
- var deprecatedWarnings = {};
1049
- validators$1.transitional = function transitional2(validator2, version, message) {
1050
- function formatMessage(opt, desc) {
1051
- return "[Axios v" + VERSION + "] Transitional option '" + opt + "'" + desc + (message ? ". " + message : "");
1052
- }
1053
- return function(value, opt, opts) {
1054
- if (validator2 === false) {
1055
- throw new AxiosError(formatMessage(opt, " has been removed" + (version ? " in " + version : "")), AxiosError.ERR_DEPRECATED);
1056
- }
1057
- if (version && !deprecatedWarnings[opt]) {
1058
- deprecatedWarnings[opt] = true;
1059
- console.warn(formatMessage(opt, " has been deprecated since v" + version + " and will be removed in the near future"));
1060
- }
1061
- return validator2 ? validator2(value, opt, opts) : true;
1062
- };
1063
- };
1064
- function assertOptions(options, schema, allowUnknown) {
1065
- if (typeof options !== "object") {
1066
- throw new AxiosError("options must be an object", AxiosError.ERR_BAD_OPTION_VALUE);
1067
- }
1068
- var keys = Object.keys(options);
1069
- var i = keys.length;
1070
- while (i-- > 0) {
1071
- var opt = keys[i];
1072
- var validator2 = schema[opt];
1073
- if (validator2) {
1074
- var value = options[opt];
1075
- var result = value === void 0 || validator2(value, opt, options);
1076
- if (result !== true) {
1077
- throw new AxiosError("option " + opt + " must be " + result, AxiosError.ERR_BAD_OPTION_VALUE);
1078
- }
1079
- continue;
1080
- }
1081
- if (allowUnknown !== true) {
1082
- throw new AxiosError("Unknown option " + opt, AxiosError.ERR_BAD_OPTION);
1083
- }
1084
- }
1085
- }
1086
- var validator$1 = {
1087
- assertOptions,
1088
- validators: validators$1
1089
- };
1090
- var utils$2 = utils$h;
1091
- var buildURL2 = buildURL$2;
1092
- var InterceptorManager = InterceptorManager_1;
1093
- var dispatchRequest2 = dispatchRequest$1;
1094
- var mergeConfig$1 = mergeConfig$2;
1095
- var buildFullPath2 = buildFullPath$2;
1096
- var validator = validator$1;
1097
- var validators = validator.validators;
1098
- function Axios$1(instanceConfig) {
1099
- this.defaults = instanceConfig;
1100
- this.interceptors = {
1101
- request: new InterceptorManager(),
1102
- response: new InterceptorManager()
1103
- };
1104
- }
1105
- Axios$1.prototype.request = function request(configOrUrl, config) {
1106
- if (typeof configOrUrl === "string") {
1107
- config = config || {};
1108
- config.url = configOrUrl;
1109
- } else {
1110
- config = configOrUrl || {};
1111
- }
1112
- config = mergeConfig$1(this.defaults, config);
1113
- if (config.method) {
1114
- config.method = config.method.toLowerCase();
1115
- } else if (this.defaults.method) {
1116
- config.method = this.defaults.method.toLowerCase();
1117
- } else {
1118
- config.method = "get";
1119
- }
1120
- var transitional3 = config.transitional;
1121
- if (transitional3 !== void 0) {
1122
- validator.assertOptions(transitional3, {
1123
- silentJSONParsing: validators.transitional(validators.boolean),
1124
- forcedJSONParsing: validators.transitional(validators.boolean),
1125
- clarifyTimeoutError: validators.transitional(validators.boolean)
1126
- }, false);
1127
- }
1128
- var requestInterceptorChain = [];
1129
- var synchronousRequestInterceptors = true;
1130
- this.interceptors.request.forEach(function unshiftRequestInterceptors(interceptor) {
1131
- if (typeof interceptor.runWhen === "function" && interceptor.runWhen(config) === false) {
1132
- return;
1133
- }
1134
- synchronousRequestInterceptors = synchronousRequestInterceptors && interceptor.synchronous;
1135
- requestInterceptorChain.unshift(interceptor.fulfilled, interceptor.rejected);
1136
- });
1137
- var responseInterceptorChain = [];
1138
- this.interceptors.response.forEach(function pushResponseInterceptors(interceptor) {
1139
- responseInterceptorChain.push(interceptor.fulfilled, interceptor.rejected);
1140
- });
1141
- var promise;
1142
- if (!synchronousRequestInterceptors) {
1143
- var chain = [dispatchRequest2, void 0];
1144
- Array.prototype.unshift.apply(chain, requestInterceptorChain);
1145
- chain = chain.concat(responseInterceptorChain);
1146
- promise = Promise.resolve(config);
1147
- while (chain.length) {
1148
- promise = promise.then(chain.shift(), chain.shift());
1149
- }
1150
- return promise;
1151
- }
1152
- var newConfig = config;
1153
- while (requestInterceptorChain.length) {
1154
- var onFulfilled = requestInterceptorChain.shift();
1155
- var onRejected = requestInterceptorChain.shift();
1156
- try {
1157
- newConfig = onFulfilled(newConfig);
1158
- } catch (error) {
1159
- onRejected(error);
1160
- break;
1161
- }
1162
- }
1163
- try {
1164
- promise = dispatchRequest2(newConfig);
1165
- } catch (error) {
1166
- return Promise.reject(error);
1167
- }
1168
- while (responseInterceptorChain.length) {
1169
- promise = promise.then(responseInterceptorChain.shift(), responseInterceptorChain.shift());
1170
- }
1171
- return promise;
1172
- };
1173
- Axios$1.prototype.getUri = function getUri(config) {
1174
- config = mergeConfig$1(this.defaults, config);
1175
- var fullPath = buildFullPath2(config.baseURL, config.url);
1176
- return buildURL2(fullPath, config.params, config.paramsSerializer);
1177
- };
1178
- utils$2.forEach(["delete", "get", "head", "options"], function forEachMethodNoData2(method) {
1179
- Axios$1.prototype[method] = function(url, config) {
1180
- return this.request(mergeConfig$1(config || {}, {
1181
- method,
1182
- url,
1183
- data: (config || {}).data
1184
- }));
1185
- };
1186
- });
1187
- utils$2.forEach(["post", "put", "patch"], function forEachMethodWithData2(method) {
1188
- function generateHTTPMethod(isForm) {
1189
- return function httpMethod(url, data2, config) {
1190
- return this.request(mergeConfig$1(config || {}, {
1191
- method,
1192
- headers: isForm ? {
1193
- "Content-Type": "multipart/form-data"
1194
- } : {},
1195
- url,
1196
- data: data2
1197
- }));
1198
- };
1199
- }
1200
- Axios$1.prototype[method] = generateHTTPMethod();
1201
- Axios$1.prototype[method + "Form"] = generateHTTPMethod(true);
1202
- });
1203
- var Axios_1 = Axios$1;
1204
- var CanceledError = CanceledError_1;
1205
- function CancelToken(executor) {
1206
- if (typeof executor !== "function") {
1207
- throw new TypeError("executor must be a function.");
1208
- }
1209
- var resolvePromise;
1210
- this.promise = new Promise(function promiseExecutor(resolve) {
1211
- resolvePromise = resolve;
1212
- });
1213
- var token = this;
1214
- this.promise.then(function(cancel) {
1215
- if (!token._listeners)
1216
- return;
1217
- var i;
1218
- var l = token._listeners.length;
1219
- for (i = 0; i < l; i++) {
1220
- token._listeners[i](cancel);
1221
- }
1222
- token._listeners = null;
1223
- });
1224
- this.promise.then = function(onfulfilled) {
1225
- var _resolve;
1226
- var promise = new Promise(function(resolve) {
1227
- token.subscribe(resolve);
1228
- _resolve = resolve;
1229
- }).then(onfulfilled);
1230
- promise.cancel = function reject() {
1231
- token.unsubscribe(_resolve);
1232
- };
1233
- return promise;
1234
- };
1235
- executor(function cancel(message) {
1236
- if (token.reason) {
1237
- return;
1238
- }
1239
- token.reason = new CanceledError(message);
1240
- resolvePromise(token.reason);
1241
- });
1242
- }
1243
- CancelToken.prototype.throwIfRequested = function throwIfRequested() {
1244
- if (this.reason) {
1245
- throw this.reason;
1246
- }
1247
- };
1248
- CancelToken.prototype.subscribe = function subscribe(listener) {
1249
- if (this.reason) {
1250
- listener(this.reason);
1251
- return;
1252
- }
1253
- if (this._listeners) {
1254
- this._listeners.push(listener);
1255
- } else {
1256
- this._listeners = [listener];
1257
- }
1258
- };
1259
- CancelToken.prototype.unsubscribe = function unsubscribe(listener) {
1260
- if (!this._listeners) {
1261
- return;
1262
- }
1263
- var index = this._listeners.indexOf(listener);
1264
- if (index !== -1) {
1265
- this._listeners.splice(index, 1);
1266
- }
1267
- };
1268
- CancelToken.source = function source() {
1269
- var cancel;
1270
- var token = new CancelToken(function executor(c) {
1271
- cancel = c;
1272
- });
1273
- return {
1274
- token,
1275
- cancel
1276
- };
1277
- };
1278
- var CancelToken_1 = CancelToken;
1279
- var spread = function spread2(callback) {
1280
- return function wrap(arr) {
1281
- return callback.apply(null, arr);
1282
- };
1283
- };
1284
- var utils$1 = utils$h;
1285
- var isAxiosError = function isAxiosError2(payload) {
1286
- return utils$1.isObject(payload) && payload.isAxiosError === true;
1287
- };
1288
- var utils = utils$h;
1289
- var bind2 = bind$2;
1290
- var Axios = Axios_1;
1291
- var mergeConfig2 = mergeConfig$2;
1292
- var defaults = defaults_1;
1293
- function createInstance(defaultConfig) {
1294
- var context = new Axios(defaultConfig);
1295
- var instance = bind2(Axios.prototype.request, context);
1296
- utils.extend(instance, Axios.prototype, context);
1297
- utils.extend(instance, context);
1298
- instance.create = function create(instanceConfig) {
1299
- return createInstance(mergeConfig2(defaultConfig, instanceConfig));
1300
- };
1301
- return instance;
1302
- }
1303
- var axios$1 = createInstance(defaults);
1304
- axios$1.Axios = Axios;
1305
- axios$1.CanceledError = CanceledError_1;
1306
- axios$1.CancelToken = CancelToken_1;
1307
- axios$1.isCancel = isCancel$1;
1308
- axios$1.VERSION = data.version;
1309
- axios$1.toFormData = toFormData_1;
1310
- axios$1.AxiosError = AxiosError_1;
1311
- axios$1.Cancel = axios$1.CanceledError;
1312
- axios$1.all = function all(promises) {
1313
- return Promise.all(promises);
1314
- };
1315
- axios$1.spread = spread;
1316
- axios$1.isAxiosError = isAxiosError;
1317
- axios$2.exports = axios$1;
1318
- axios$2.exports.default = axios$1;
1319
- var axios = axios$2.exports;
1320
- var mapObj = { exports: {} };
1321
- const isObject = (value) => typeof value === "object" && value !== null;
1322
- const mapObjectSkip = Symbol("skip");
1323
- const isObjectCustom = (value) => isObject(value) && !(value instanceof RegExp) && !(value instanceof Error) && !(value instanceof Date);
1324
- const mapObject = (object, mapper, options, isSeen = /* @__PURE__ */ new WeakMap()) => {
1325
- options = __spreadValues({
1326
- deep: false,
1327
- target: {}
1328
- }, options);
1329
- if (isSeen.has(object)) {
1330
- return isSeen.get(object);
1331
- }
1332
- isSeen.set(object, options.target);
1333
- const { target } = options;
1334
- delete options.target;
1335
- const mapArray = (array) => array.map((element) => isObjectCustom(element) ? mapObject(element, mapper, options, isSeen) : element);
1336
- if (Array.isArray(object)) {
1337
- return mapArray(object);
1338
- }
1339
- for (const [key, value] of Object.entries(object)) {
1340
- const mapResult = mapper(key, value, object);
1341
- if (mapResult === mapObjectSkip) {
1342
- continue;
1343
- }
1344
- let [newKey, newValue, { shouldRecurse = true } = {}] = mapResult;
1345
- if (newKey === "__proto__") {
1346
- continue;
1347
- }
1348
- if (options.deep && shouldRecurse && isObjectCustom(newValue)) {
1349
- newValue = Array.isArray(newValue) ? mapArray(newValue) : mapObject(newValue, mapper, options, isSeen);
1350
- }
1351
- target[newKey] = newValue;
1352
- }
1353
- return target;
1354
- };
1355
- mapObj.exports = (object, mapper, options) => {
1356
- if (!isObject(object)) {
1357
- throw new TypeError(`Expected an object, got \`${object}\` (${typeof object})`);
1358
- }
1359
- return mapObject(object, mapper, options);
1360
- };
1361
- mapObj.exports.mapObjectSkip = mapObjectSkip;
1362
- var __assign = function() {
1363
- __assign = Object.assign || function __assign2(t) {
1364
- for (var s, i = 1, n = arguments.length; i < n; i++) {
1365
- s = arguments[i];
1366
- for (var p in s)
1367
- if (Object.prototype.hasOwnProperty.call(s, p))
1368
- t[p] = s[p];
1369
- }
1370
- return t;
1371
- };
1372
- return __assign.apply(this, arguments);
1373
- };
1374
- function lowerCase(str) {
1375
- return str.toLowerCase();
1376
- }
1377
- var DEFAULT_SPLIT_REGEXP = [/([a-z0-9])([A-Z])/g, /([A-Z])([A-Z][a-z])/g];
1378
- var DEFAULT_STRIP_REGEXP = /[^A-Z0-9]+/gi;
1379
- function noCase(input, options) {
1380
- if (options === void 0) {
1381
- options = {};
1382
- }
1383
- var _a = options.splitRegexp, splitRegexp = _a === void 0 ? DEFAULT_SPLIT_REGEXP : _a, _b = options.stripRegexp, stripRegexp = _b === void 0 ? DEFAULT_STRIP_REGEXP : _b, _c = options.transform, transform = _c === void 0 ? lowerCase : _c, _d = options.delimiter, delimiter = _d === void 0 ? " " : _d;
1384
- var result = replace(replace(input, splitRegexp, "$1\0$2"), stripRegexp, "\0");
1385
- var start = 0;
1386
- var end = result.length;
1387
- while (result.charAt(start) === "\0")
1388
- start++;
1389
- while (result.charAt(end - 1) === "\0")
1390
- end--;
1391
- return result.slice(start, end).split("\0").map(transform).join(delimiter);
1392
- }
1393
- function replace(input, re, value) {
1394
- if (re instanceof RegExp)
1395
- return input.replace(re, value);
1396
- return re.reduce(function(input2, re2) {
1397
- return input2.replace(re2, value);
1398
- }, input);
1399
- }
1400
- function dotCase(input, options) {
1401
- if (options === void 0) {
1402
- options = {};
1403
- }
1404
- return noCase(input, __assign({ delimiter: "." }, options));
1405
- }
1406
- function snakeCase$1(input, options) {
1407
- if (options === void 0) {
1408
- options = {};
1409
- }
1410
- return dotCase(input, __assign({ delimiter: "_" }, options));
1411
- }
1412
- const dist_es2015 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
1413
- __proto__: null,
1414
- snakeCase: snakeCase$1
1415
- }, Symbol.toStringTag, { value: "Module" }));
1416
- const require$$1 = /* @__PURE__ */ getAugmentedNamespace(dist_es2015);
1417
- const map = mapObj.exports;
1418
- const { snakeCase } = require$$1;
1419
- var snakecaseKeys = function(obj, options) {
1420
- options = Object.assign({ deep: true, exclude: [], parsingOptions: {} }, options);
1421
- return map(obj, function(key, val) {
1422
- return [
1423
- matches(options.exclude, key) ? key : snakeCase(key, options.parsingOptions),
1424
- val
1425
- ];
1426
- }, options);
1427
- };
1428
- function matches(patterns, value) {
1429
- return patterns.some(function(pattern) {
1430
- return typeof pattern === "string" ? pattern === value : pattern.test(value);
1431
- });
1432
- }
1433
56
  var EmitEvents = /* @__PURE__ */ ((EmitEvents2) => {
1434
57
  EmitEvents2["EMMIT_EVENT_NET_SERVICE_UNAUTHORIZED"] = `netsevice_unauthorized`;
1435
58
  EmitEvents2["EMMIT_EVENT_HOST_THEME_CHANGE"] = "host_theme_change";
@@ -1437,11 +60,10 @@ var EmitEvents = /* @__PURE__ */ ((EmitEvents2) => {
1437
60
  })(EmitEvents || {});
1438
61
  const axiosInstance = axios.create({});
1439
62
  function getResponse(endPoint, response) {
1440
- var _a, _b;
1441
63
  console.log("Axios response", response, typeof response.data);
1442
64
  if (response && response.data && typeof response.data === "object") {
1443
- if (response.data.error && ((_a = response.data.error) == null ? void 0 : _a.code) && ((_b = response.data.error) == null ? void 0 : _b.msg) !== void 0) {
1444
- return Promise.reject(__spreadProps(__spreadValues({}, response.data.error), { status: response.status }));
65
+ if (response.data.error && response.data.error?.code && response.data.error?.msg !== void 0) {
66
+ return Promise.reject({ ...response.data.error, status: response.status });
1445
67
  }
1446
68
  return response.data;
1447
69
  }
@@ -1452,7 +74,6 @@ function getResponse(endPoint, response) {
1452
74
  });
1453
75
  }
1454
76
  function getError(error, hostTools, checkUnAuthorized = true) {
1455
- var _a, _b;
1456
77
  const { toast } = hostTools;
1457
78
  let err = {
1458
79
  message: "",
@@ -1460,11 +81,11 @@ function getError(error, hostTools, checkUnAuthorized = true) {
1460
81
  code: 0
1461
82
  };
1462
83
  console.log("getError", error);
1463
- if ((error == null ? void 0 : error.code) !== void 0 && err.status !== void 0 && error.message !== void 0) {
1464
- err = __spreadValues(__spreadValues({}, err), error);
1465
- } else if (error == null ? void 0 : error.response) {
1466
- if (error.response.data && typeof error.response.data === "object" && error.response.data.error && ((_a = error.response.data.error) == null ? void 0 : _a.code) && ((_b = error.response.data.error) == null ? void 0 : _b.message) !== void 0) {
1467
- err = __spreadProps(__spreadValues({}, error.response.data.error), { status: error.response.status });
84
+ if (error?.code !== void 0 && err.status !== void 0 && error.message !== void 0) {
85
+ err = { ...err, ...error };
86
+ } else if (error?.response) {
87
+ if (error.response.data && typeof error.response.data === "object" && error.response.data.error && error.response.data.error?.code && error.response.data.error?.message !== void 0) {
88
+ err = { ...error.response.data.error, status: error.response.status };
1468
89
  } else {
1469
90
  err.message = error.message;
1470
91
  err.status = error.response.status;
@@ -1473,11 +94,11 @@ function getError(error, hostTools, checkUnAuthorized = true) {
1473
94
  if (checkUnAuthorized && error.response.status === 401) {
1474
95
  hostTools.events_emit(EmitEvents.EMMIT_EVENT_NET_SERVICE_UNAUTHORIZED, {});
1475
96
  }
1476
- } else if (error == null ? void 0 : error.request) {
1477
- err.message = `${error == null ? void 0 : error.code} ${error.message}`;
97
+ } else if (error?.request) {
98
+ err.message = `${error?.code} ${error.message}`;
1478
99
  err.code = -1;
1479
100
  } else {
1480
- err.message = `${error == null ? void 0 : error.code} ${error.message}`;
101
+ err.message = `${error?.code} ${error.message}`;
1481
102
  err.status = 0;
1482
103
  err.code = -2;
1483
104
  }
@@ -1492,7 +113,7 @@ const axiosOperation = async (props, enviroment, hostTools) => {
1492
113
  endPoint,
1493
114
  timeout = 5e3,
1494
115
  parms = {},
1495
- data: data2 = {},
116
+ data = {},
1496
117
  isRemote = true,
1497
118
  checkUnAuthorized = true
1498
119
  } = props;
@@ -1508,7 +129,7 @@ const axiosOperation = async (props, enviroment, hostTools) => {
1508
129
  withCredentials: isRemote,
1509
130
  method,
1510
131
  url: `/${endPoint}`,
1511
- data: snakecaseKeys(data2, { deep: true }),
132
+ data: snakecaseKeys(data, { deep: true }),
1512
133
  params: snakecaseKeys(parms, { deep: true }),
1513
134
  timeout
1514
135
  }).then((response) => getResponse(endPoint, response)).catch((error) => Promise.reject(getError(error, hostTools, checkUnAuthorized))).finally(() => {
@@ -1525,11 +146,10 @@ const initialValue$1 = {
1525
146
  };
1526
147
  const HostToolsContext = createContext(initialValue$1);
1527
148
  function HostToolsProvider(props) {
1528
- const _a = props, {
1529
- children
1530
- } = _a, hostTools = __objRest(_a, [
1531
- "children"
1532
- ]);
149
+ const {
150
+ children,
151
+ ...hostTools
152
+ } = props;
1533
153
  const [finalTools] = useState(hostTools);
1534
154
  return /* @__PURE__ */ jsx(HostToolsContext.Provider, {
1535
155
  value: finalTools,
@@ -1684,14 +304,17 @@ function ModuleDictionaryProvider(props) {
1684
304
  networkOperation({
1685
305
  method: "GET",
1686
306
  endPoint: isAuth ? `dictionaries/${moduleId}` : `na/dictionaries/${moduleId}`,
1687
- parms: __spreadValues({
1688
- comps: componentsDictionary
1689
- }, isAuth ? {} : {
1690
- domain_token
1691
- })
307
+ parms: {
308
+ comps: componentsDictionary,
309
+ ...isAuth ? {} : {
310
+ domain_token
311
+ }
312
+ }
1692
313
  }).then((response) => {
1693
314
  if (mounted) {
1694
- setModuleDictionary(__spreadValues({}, response));
315
+ setModuleDictionary({
316
+ ...response
317
+ });
1695
318
  addFlag("dictionary_loaded");
1696
319
  }
1697
320
  }).finally(() => {