hanbiro-react16-sdk 1.0.13 → 1.0.15

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  /*!
2
- * hanbiro-react16-sdk v1.0.12
3
- * Build Date: 2026-03-31
2
+ * hanbiro-react16-sdk v1.0.15
3
+ * Build Date: 2026-04-02
4
4
  */
5
5
  var __defProp = Object.defineProperty;
6
6
  var __defProps = Object.defineProperties;
@@ -8,6 +8,10 @@ var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
8
8
  var __getOwnPropSymbols = Object.getOwnPropertySymbols;
9
9
  var __hasOwnProp = Object.prototype.hasOwnProperty;
10
10
  var __propIsEnum = Object.prototype.propertyIsEnumerable;
11
+ var __knownSymbol = (name, symbol) => (symbol = Symbol[name]) ? symbol : Symbol.for("Symbol." + name);
12
+ var __typeError = (msg) => {
13
+ throw TypeError(msg);
14
+ };
11
15
  var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
12
16
  var __spreadValues = (a, b) => {
13
17
  for (var prop in b || (b = {}))
@@ -21,6 +25,18 @@ var __spreadValues = (a, b) => {
21
25
  return a;
22
26
  };
23
27
  var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
28
+ var __objRest = (source, exclude) => {
29
+ var target = {};
30
+ for (var prop in source)
31
+ if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
32
+ target[prop] = source[prop];
33
+ if (source != null && __getOwnPropSymbols)
34
+ for (var prop of __getOwnPropSymbols(source)) {
35
+ if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
36
+ target[prop] = source[prop];
37
+ }
38
+ return target;
39
+ };
24
40
  var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
25
41
  var __async = (__this, __arguments, generator) => {
26
42
  return new Promise((resolve, reject) => {
@@ -42,6 +58,50 @@ var __async = (__this, __arguments, generator) => {
42
58
  step((generator = generator.apply(__this, __arguments)).next());
43
59
  });
44
60
  };
61
+ var __await = function(promise, isYieldStar) {
62
+ this[0] = promise;
63
+ this[1] = isYieldStar;
64
+ };
65
+ var __asyncGenerator = (__this, __arguments, generator) => {
66
+ var resume = (k, v, yes, no) => {
67
+ try {
68
+ var x = generator[k](v), isAwait = (v = x.value) instanceof __await, done = x.done;
69
+ Promise.resolve(isAwait ? v[0] : v).then((y) => isAwait ? resume(k === "return" ? k : "next", v[1] ? { done: y.done, value: y.value } : y, yes, no) : yes({ value: y, done })).catch((e) => resume("throw", e, yes, no));
70
+ } catch (e) {
71
+ no(e);
72
+ }
73
+ }, method = (k) => it[k] = (x) => new Promise((yes, no) => resume(k, x, yes, no)), it = {};
74
+ return generator = generator.apply(__this, __arguments), it[__knownSymbol("asyncIterator")] = () => it, method("next"), method("throw"), method("return"), it;
75
+ };
76
+ var __yieldStar = (value) => {
77
+ var obj = value[__knownSymbol("asyncIterator")], isAwait = false, method, it = {};
78
+ if (obj == null) {
79
+ obj = value[__knownSymbol("iterator")]();
80
+ method = (k) => it[k] = (x) => obj[k](x);
81
+ } else {
82
+ obj = obj.call(value);
83
+ method = (k) => it[k] = (v) => {
84
+ if (isAwait) {
85
+ isAwait = false;
86
+ if (k === "throw") throw v;
87
+ return v;
88
+ }
89
+ isAwait = true;
90
+ return {
91
+ done: false,
92
+ value: new __await(new Promise((resolve) => {
93
+ var x = obj[k](v);
94
+ if (!(x instanceof Object)) __typeError("Object expected");
95
+ resolve(x);
96
+ }), 1)
97
+ };
98
+ };
99
+ }
100
+ return it[__knownSymbol("iterator")] = () => it, method("next"), "throw" in obj ? method("throw") : it.throw = (x) => {
101
+ throw x;
102
+ }, "return" in obj && method("return"), it;
103
+ };
104
+ var __forAwait = (obj, it, method) => (it = obj[__knownSymbol("asyncIterator")]) ? it.call(obj) : (obj = obj[__knownSymbol("iterator")](), it = {}, method = (key, fn) => (fn = obj[key]) && (it[key] = (arg) => new Promise((yes, no, done) => (arg = fn.call(obj, arg), done = arg.done, Promise.resolve(arg.value).then((value) => yes({ value, done }), no)))), method("next"), method("return"), it);
45
105
  var _a;
46
106
  import * as React from "react";
47
107
  import React__default, { forwardRef } from "react";
@@ -341,16 +401,6 @@ Settings.propTypes = {
341
401
  size: PropTypes.oneOfType([PropTypes.string, PropTypes.number])
342
402
  };
343
403
  Settings.displayName = "Settings";
344
- const LANG_OPTIONS = [
345
- { label: "Korean", value: "KR", extra: "ko" },
346
- { label: "English", value: "US", extra: "en" },
347
- { label: "Japanese", value: "JP" },
348
- { label: "Simplified Chinese", value: "zh-CN", extra: "zh-chs" },
349
- { label: "Traditional Chinese (Taiwan)", value: "zh-TW" },
350
- { label: "Traditional Chinese (Hong Kong)", value: "zh-HK", extra: "zh-cht" },
351
- { label: "Vietnamese", value: "VN", extra: "vi" },
352
- { label: "Indonesian", value: "ID", extra: "id" }
353
- ];
354
404
  const CustomAiIcon = ({ isGradient = false, stroke = 1.5, size = 40 }) => {
355
405
  const gradientId = "ai-gradient-" + Math.random().toString(36).substr(2, 9);
356
406
  return /* @__PURE__ */ React.createElement(
@@ -775,8 +825,8 @@ var escapeReplacements = {
775
825
  "'": "&#39;"
776
826
  };
777
827
  var getEscapeReplacement = (ch) => escapeReplacements[ch];
778
- function escape2(html2, encode) {
779
- if (encode) {
828
+ function escape2(html2, encode2) {
829
+ if (encode2) {
780
830
  if (other.escapeTest.test(html2)) {
781
831
  return html2.replace(other.escapeReplace, getEscapeReplacement);
782
832
  }
@@ -3159,7 +3209,7 @@ var EditorPropTypes = __assign$2({ apiKey: propTypesExports.string, id: propType
3159
3209
  defer: propTypesExports.bool,
3160
3210
  delay: propTypesExports.number
3161
3211
  }) }, eventPropTypes);
3162
- var isFunction = function(x) {
3212
+ var isFunction$2 = function(x) {
3163
3213
  return typeof x === "function";
3164
3214
  };
3165
3215
  var isEventProp = function(name) {
@@ -3395,8 +3445,8 @@ var createScriptLoader = function() {
3395
3445
  };
3396
3446
  var ScriptLoader = createScriptLoader();
3397
3447
  var getTinymce = function(view) {
3398
- var global = view;
3399
- return global && global.tinymce ? global.tinymce : null;
3448
+ var global2 = view;
3449
+ return global2 && global2.tinymce ? global2.tinymce : null;
3400
3450
  };
3401
3451
  var __extends = /* @__PURE__ */ function() {
3402
3452
  var extendStatics = function(d, b) {
@@ -3479,7 +3529,7 @@ var Editor = (
3479
3529
  }
3480
3530
  if (newContent !== _this.currentContent) {
3481
3531
  _this.currentContent = newContent;
3482
- if (isFunction(_this.props.onEditorChange)) {
3532
+ if (isFunction$2(_this.props.onEditorChange)) {
3483
3533
  _this.props.onEditorChange(newContent, editor);
3484
3534
  }
3485
3535
  }
@@ -3525,7 +3575,7 @@ var Editor = (
3525
3575
  editor.setContent(_this.getInitialValue(), { no_events: true });
3526
3576
  });
3527
3577
  }
3528
- if (_this.props.init && isFunction(_this.props.init.setup)) {
3578
+ if (_this.props.init && isFunction$2(_this.props.init.setup)) {
3529
3579
  _this.props.init.setup(editor);
3530
3580
  }
3531
3581
  }, init_instance_callback: function(editor) {
@@ -3541,7 +3591,7 @@ var Editor = (
3541
3591
  }
3542
3592
  var disabled = (_b3 = _this.props.disabled) !== null && _b3 !== void 0 ? _b3 : false;
3543
3593
  setMode(_this.editor, disabled ? "readonly" : "design");
3544
- if (_this.props.init && isFunction(_this.props.init.init_instance_callback)) {
3594
+ if (_this.props.init && isFunction$2(_this.props.init.init_instance_callback)) {
3545
3595
  _this.props.init.init_instance_callback(editor);
3546
3596
  }
3547
3597
  } });
@@ -4012,85 +4062,2796 @@ class TinyMceEditor extends React__default.Component {
4012
4062
  );
4013
4063
  }
4014
4064
  }
4015
- class SettingPopper extends React.Component {
4016
- constructor(props) {
4017
- super(props);
4018
- __publicField(this, "containerRef");
4019
- __publicField(this, "popperRef");
4020
- __publicField(this, "handleClickOutside", (event) => {
4021
- const target = event.target;
4022
- if (this.containerRef.current && !this.containerRef.current.contains(target) && (!this.popperRef.current || !this.popperRef.current.contains(target))) {
4023
- this.setState({ open: false });
4065
+ function bind(fn, thisArg) {
4066
+ return function wrap() {
4067
+ return fn.apply(thisArg, arguments);
4068
+ };
4069
+ }
4070
+ const { toString } = Object.prototype;
4071
+ const { getPrototypeOf } = Object;
4072
+ const { iterator, toStringTag } = Symbol;
4073
+ const kindOf = /* @__PURE__ */ ((cache) => (thing) => {
4074
+ const str = toString.call(thing);
4075
+ return cache[str] || (cache[str] = str.slice(8, -1).toLowerCase());
4076
+ })(/* @__PURE__ */ Object.create(null));
4077
+ const kindOfTest = (type) => {
4078
+ type = type.toLowerCase();
4079
+ return (thing) => kindOf(thing) === type;
4080
+ };
4081
+ const typeOfTest = (type) => (thing) => typeof thing === type;
4082
+ const { isArray } = Array;
4083
+ const isUndefined = typeOfTest("undefined");
4084
+ function isBuffer(val) {
4085
+ return val !== null && !isUndefined(val) && val.constructor !== null && !isUndefined(val.constructor) && isFunction$1(val.constructor.isBuffer) && val.constructor.isBuffer(val);
4086
+ }
4087
+ const isArrayBuffer = kindOfTest("ArrayBuffer");
4088
+ function isArrayBufferView(val) {
4089
+ let result;
4090
+ if (typeof ArrayBuffer !== "undefined" && ArrayBuffer.isView) {
4091
+ result = ArrayBuffer.isView(val);
4092
+ } else {
4093
+ result = val && val.buffer && isArrayBuffer(val.buffer);
4094
+ }
4095
+ return result;
4096
+ }
4097
+ const isString = typeOfTest("string");
4098
+ const isFunction$1 = typeOfTest("function");
4099
+ const isNumber = typeOfTest("number");
4100
+ const isObject = (thing) => thing !== null && typeof thing === "object";
4101
+ const isBoolean = (thing) => thing === true || thing === false;
4102
+ const isPlainObject = (val) => {
4103
+ if (kindOf(val) !== "object") {
4104
+ return false;
4105
+ }
4106
+ const prototype2 = getPrototypeOf(val);
4107
+ return (prototype2 === null || prototype2 === Object.prototype || Object.getPrototypeOf(prototype2) === null) && !(toStringTag in val) && !(iterator in val);
4108
+ };
4109
+ const isEmptyObject = (val) => {
4110
+ if (!isObject(val) || isBuffer(val)) {
4111
+ return false;
4112
+ }
4113
+ try {
4114
+ return Object.keys(val).length === 0 && Object.getPrototypeOf(val) === Object.prototype;
4115
+ } catch (e) {
4116
+ return false;
4117
+ }
4118
+ };
4119
+ const isDate = kindOfTest("Date");
4120
+ const isFile = kindOfTest("File");
4121
+ const isReactNativeBlob = (value) => {
4122
+ return !!(value && typeof value.uri !== "undefined");
4123
+ };
4124
+ const isReactNative = (formData) => formData && typeof formData.getParts !== "undefined";
4125
+ const isBlob = kindOfTest("Blob");
4126
+ const isFileList = kindOfTest("FileList");
4127
+ const isStream = (val) => isObject(val) && isFunction$1(val.pipe);
4128
+ function getGlobal() {
4129
+ if (typeof globalThis !== "undefined") return globalThis;
4130
+ if (typeof self !== "undefined") return self;
4131
+ if (typeof window !== "undefined") return window;
4132
+ if (typeof global !== "undefined") return global;
4133
+ return {};
4134
+ }
4135
+ const G = getGlobal();
4136
+ const FormDataCtor = typeof G.FormData !== "undefined" ? G.FormData : void 0;
4137
+ const isFormData = (thing) => {
4138
+ let kind;
4139
+ return thing && (FormDataCtor && thing instanceof FormDataCtor || isFunction$1(thing.append) && ((kind = kindOf(thing)) === "formdata" || // detect form-data instance
4140
+ kind === "object" && isFunction$1(thing.toString) && thing.toString() === "[object FormData]"));
4141
+ };
4142
+ const isURLSearchParams = kindOfTest("URLSearchParams");
4143
+ const [isReadableStream, isRequest, isResponse, isHeaders] = [
4144
+ "ReadableStream",
4145
+ "Request",
4146
+ "Response",
4147
+ "Headers"
4148
+ ].map(kindOfTest);
4149
+ const trim = (str) => {
4150
+ return str.trim ? str.trim() : str.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, "");
4151
+ };
4152
+ function forEach(obj, fn, { allOwnKeys = false } = {}) {
4153
+ if (obj === null || typeof obj === "undefined") {
4154
+ return;
4155
+ }
4156
+ let i;
4157
+ let l;
4158
+ if (typeof obj !== "object") {
4159
+ obj = [obj];
4160
+ }
4161
+ if (isArray(obj)) {
4162
+ for (i = 0, l = obj.length; i < l; i++) {
4163
+ fn.call(null, obj[i], i, obj);
4164
+ }
4165
+ } else {
4166
+ if (isBuffer(obj)) {
4167
+ return;
4168
+ }
4169
+ const keys = allOwnKeys ? Object.getOwnPropertyNames(obj) : Object.keys(obj);
4170
+ const len = keys.length;
4171
+ let key;
4172
+ for (i = 0; i < len; i++) {
4173
+ key = keys[i];
4174
+ fn.call(null, obj[key], key, obj);
4175
+ }
4176
+ }
4177
+ }
4178
+ function findKey(obj, key) {
4179
+ if (isBuffer(obj)) {
4180
+ return null;
4181
+ }
4182
+ key = key.toLowerCase();
4183
+ const keys = Object.keys(obj);
4184
+ let i = keys.length;
4185
+ let _key;
4186
+ while (i-- > 0) {
4187
+ _key = keys[i];
4188
+ if (key === _key.toLowerCase()) {
4189
+ return _key;
4190
+ }
4191
+ }
4192
+ return null;
4193
+ }
4194
+ const _global = (() => {
4195
+ if (typeof globalThis !== "undefined") return globalThis;
4196
+ return typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : global;
4197
+ })();
4198
+ const isContextDefined = (context) => !isUndefined(context) && context !== _global;
4199
+ function merge() {
4200
+ const { caseless, skipUndefined } = isContextDefined(this) && this || {};
4201
+ const result = {};
4202
+ const assignValue = (val, key) => {
4203
+ if (key === "__proto__" || key === "constructor" || key === "prototype") {
4204
+ return;
4205
+ }
4206
+ const targetKey = caseless && findKey(result, key) || key;
4207
+ if (isPlainObject(result[targetKey]) && isPlainObject(val)) {
4208
+ result[targetKey] = merge(result[targetKey], val);
4209
+ } else if (isPlainObject(val)) {
4210
+ result[targetKey] = merge({}, val);
4211
+ } else if (isArray(val)) {
4212
+ result[targetKey] = val.slice();
4213
+ } else if (!skipUndefined || !isUndefined(val)) {
4214
+ result[targetKey] = val;
4215
+ }
4216
+ };
4217
+ for (let i = 0, l = arguments.length; i < l; i++) {
4218
+ arguments[i] && forEach(arguments[i], assignValue);
4219
+ }
4220
+ return result;
4221
+ }
4222
+ const extend = (a, b, thisArg, { allOwnKeys } = {}) => {
4223
+ forEach(
4224
+ b,
4225
+ (val, key) => {
4226
+ if (thisArg && isFunction$1(val)) {
4227
+ Object.defineProperty(a, key, {
4228
+ value: bind(val, thisArg),
4229
+ writable: true,
4230
+ enumerable: true,
4231
+ configurable: true
4232
+ });
4233
+ } else {
4234
+ Object.defineProperty(a, key, {
4235
+ value: val,
4236
+ writable: true,
4237
+ enumerable: true,
4238
+ configurable: true
4239
+ });
4240
+ }
4241
+ },
4242
+ { allOwnKeys }
4243
+ );
4244
+ return a;
4245
+ };
4246
+ const stripBOM = (content) => {
4247
+ if (content.charCodeAt(0) === 65279) {
4248
+ content = content.slice(1);
4249
+ }
4250
+ return content;
4251
+ };
4252
+ const inherits = (constructor, superConstructor, props, descriptors) => {
4253
+ constructor.prototype = Object.create(superConstructor.prototype, descriptors);
4254
+ Object.defineProperty(constructor.prototype, "constructor", {
4255
+ value: constructor,
4256
+ writable: true,
4257
+ enumerable: false,
4258
+ configurable: true
4259
+ });
4260
+ Object.defineProperty(constructor, "super", {
4261
+ value: superConstructor.prototype
4262
+ });
4263
+ props && Object.assign(constructor.prototype, props);
4264
+ };
4265
+ const toFlatObject = (sourceObj, destObj, filter2, propFilter) => {
4266
+ let props;
4267
+ let i;
4268
+ let prop;
4269
+ const merged = {};
4270
+ destObj = destObj || {};
4271
+ if (sourceObj == null) return destObj;
4272
+ do {
4273
+ props = Object.getOwnPropertyNames(sourceObj);
4274
+ i = props.length;
4275
+ while (i-- > 0) {
4276
+ prop = props[i];
4277
+ if ((!propFilter || propFilter(prop, sourceObj, destObj)) && !merged[prop]) {
4278
+ destObj[prop] = sourceObj[prop];
4279
+ merged[prop] = true;
4024
4280
  }
4281
+ }
4282
+ sourceObj = filter2 !== false && getPrototypeOf(sourceObj);
4283
+ } while (sourceObj && (!filter2 || filter2(sourceObj, destObj)) && sourceObj !== Object.prototype);
4284
+ return destObj;
4285
+ };
4286
+ const endsWith = (str, searchString, position) => {
4287
+ str = String(str);
4288
+ if (position === void 0 || position > str.length) {
4289
+ position = str.length;
4290
+ }
4291
+ position -= searchString.length;
4292
+ const lastIndex = str.indexOf(searchString, position);
4293
+ return lastIndex !== -1 && lastIndex === position;
4294
+ };
4295
+ const toArray = (thing) => {
4296
+ if (!thing) return null;
4297
+ if (isArray(thing)) return thing;
4298
+ let i = thing.length;
4299
+ if (!isNumber(i)) return null;
4300
+ const arr = new Array(i);
4301
+ while (i-- > 0) {
4302
+ arr[i] = thing[i];
4303
+ }
4304
+ return arr;
4305
+ };
4306
+ const isTypedArray = /* @__PURE__ */ ((TypedArray) => {
4307
+ return (thing) => {
4308
+ return TypedArray && thing instanceof TypedArray;
4309
+ };
4310
+ })(typeof Uint8Array !== "undefined" && getPrototypeOf(Uint8Array));
4311
+ const forEachEntry = (obj, fn) => {
4312
+ const generator = obj && obj[iterator];
4313
+ const _iterator = generator.call(obj);
4314
+ let result;
4315
+ while ((result = _iterator.next()) && !result.done) {
4316
+ const pair = result.value;
4317
+ fn.call(obj, pair[0], pair[1]);
4318
+ }
4319
+ };
4320
+ const matchAll = (regExp, str) => {
4321
+ let matches;
4322
+ const arr = [];
4323
+ while ((matches = regExp.exec(str)) !== null) {
4324
+ arr.push(matches);
4325
+ }
4326
+ return arr;
4327
+ };
4328
+ const isHTMLForm = kindOfTest("HTMLFormElement");
4329
+ const toCamelCase = (str) => {
4330
+ return str.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g, function replacer(m, p1, p2) {
4331
+ return p1.toUpperCase() + p2;
4332
+ });
4333
+ };
4334
+ const hasOwnProperty = (({ hasOwnProperty: hasOwnProperty2 }) => (obj, prop) => hasOwnProperty2.call(obj, prop))(Object.prototype);
4335
+ const isRegExp = kindOfTest("RegExp");
4336
+ const reduceDescriptors = (obj, reducer) => {
4337
+ const descriptors = Object.getOwnPropertyDescriptors(obj);
4338
+ const reducedDescriptors = {};
4339
+ forEach(descriptors, (descriptor, name) => {
4340
+ let ret;
4341
+ if ((ret = reducer(descriptor, name, obj)) !== false) {
4342
+ reducedDescriptors[name] = ret || descriptor;
4343
+ }
4344
+ });
4345
+ Object.defineProperties(obj, reducedDescriptors);
4346
+ };
4347
+ const freezeMethods = (obj) => {
4348
+ reduceDescriptors(obj, (descriptor, name) => {
4349
+ if (isFunction$1(obj) && ["arguments", "caller", "callee"].indexOf(name) !== -1) {
4350
+ return false;
4351
+ }
4352
+ const value = obj[name];
4353
+ if (!isFunction$1(value)) return;
4354
+ descriptor.enumerable = false;
4355
+ if ("writable" in descriptor) {
4356
+ descriptor.writable = false;
4357
+ return;
4358
+ }
4359
+ if (!descriptor.set) {
4360
+ descriptor.set = () => {
4361
+ throw Error("Can not rewrite read-only method '" + name + "'");
4362
+ };
4363
+ }
4364
+ });
4365
+ };
4366
+ const toObjectSet = (arrayOrString, delimiter) => {
4367
+ const obj = {};
4368
+ const define = (arr) => {
4369
+ arr.forEach((value) => {
4370
+ obj[value] = true;
4025
4371
  });
4026
- __publicField(this, "togglePopper", () => {
4027
- this.setState((prevState) => ({ open: !prevState.open }));
4372
+ };
4373
+ isArray(arrayOrString) ? define(arrayOrString) : define(String(arrayOrString).split(delimiter));
4374
+ return obj;
4375
+ };
4376
+ const noop = () => {
4377
+ };
4378
+ const toFiniteNumber = (value, defaultValue) => {
4379
+ return value != null && Number.isFinite(value = +value) ? value : defaultValue;
4380
+ };
4381
+ function isSpecCompliantForm(thing) {
4382
+ return !!(thing && isFunction$1(thing.append) && thing[toStringTag] === "FormData" && thing[iterator]);
4383
+ }
4384
+ const toJSONObject = (obj) => {
4385
+ const stack = new Array(10);
4386
+ const visit = (source, i) => {
4387
+ if (isObject(source)) {
4388
+ if (stack.indexOf(source) >= 0) {
4389
+ return;
4390
+ }
4391
+ if (isBuffer(source)) {
4392
+ return source;
4393
+ }
4394
+ if (!("toJSON" in source)) {
4395
+ stack[i] = source;
4396
+ const target = isArray(source) ? [] : {};
4397
+ forEach(source, (value, key) => {
4398
+ const reducedValue = visit(value, i + 1);
4399
+ !isUndefined(reducedValue) && (target[key] = reducedValue);
4400
+ });
4401
+ stack[i] = void 0;
4402
+ return target;
4403
+ }
4404
+ }
4405
+ return source;
4406
+ };
4407
+ return visit(obj, 0);
4408
+ };
4409
+ const isAsyncFn = kindOfTest("AsyncFunction");
4410
+ const isThenable = (thing) => thing && (isObject(thing) || isFunction$1(thing)) && isFunction$1(thing.then) && isFunction$1(thing.catch);
4411
+ const _setImmediate = ((setImmediateSupported, postMessageSupported) => {
4412
+ if (setImmediateSupported) {
4413
+ return setImmediate;
4414
+ }
4415
+ return postMessageSupported ? ((token, callbacks) => {
4416
+ _global.addEventListener(
4417
+ "message",
4418
+ ({ source, data }) => {
4419
+ if (source === _global && data === token) {
4420
+ callbacks.length && callbacks.shift()();
4421
+ }
4422
+ },
4423
+ false
4424
+ );
4425
+ return (cb) => {
4426
+ callbacks.push(cb);
4427
+ _global.postMessage(token, "*");
4428
+ };
4429
+ })(`axios@${Math.random()}`, []) : (cb) => setTimeout(cb);
4430
+ })(typeof setImmediate === "function", isFunction$1(_global.postMessage));
4431
+ const asap = typeof queueMicrotask !== "undefined" ? queueMicrotask.bind(_global) : typeof process !== "undefined" && process.nextTick || _setImmediate;
4432
+ const isIterable = (thing) => thing != null && isFunction$1(thing[iterator]);
4433
+ const utils$1 = {
4434
+ isArray,
4435
+ isArrayBuffer,
4436
+ isBuffer,
4437
+ isFormData,
4438
+ isArrayBufferView,
4439
+ isString,
4440
+ isNumber,
4441
+ isBoolean,
4442
+ isObject,
4443
+ isPlainObject,
4444
+ isEmptyObject,
4445
+ isReadableStream,
4446
+ isRequest,
4447
+ isResponse,
4448
+ isHeaders,
4449
+ isUndefined,
4450
+ isDate,
4451
+ isFile,
4452
+ isReactNativeBlob,
4453
+ isReactNative,
4454
+ isBlob,
4455
+ isRegExp,
4456
+ isFunction: isFunction$1,
4457
+ isStream,
4458
+ isURLSearchParams,
4459
+ isTypedArray,
4460
+ isFileList,
4461
+ forEach,
4462
+ merge,
4463
+ extend,
4464
+ trim,
4465
+ stripBOM,
4466
+ inherits,
4467
+ toFlatObject,
4468
+ kindOf,
4469
+ kindOfTest,
4470
+ endsWith,
4471
+ toArray,
4472
+ forEachEntry,
4473
+ matchAll,
4474
+ isHTMLForm,
4475
+ hasOwnProperty,
4476
+ hasOwnProp: hasOwnProperty,
4477
+ // an alias to avoid ESLint no-prototype-builtins detection
4478
+ reduceDescriptors,
4479
+ freezeMethods,
4480
+ toObjectSet,
4481
+ toCamelCase,
4482
+ noop,
4483
+ toFiniteNumber,
4484
+ findKey,
4485
+ global: _global,
4486
+ isContextDefined,
4487
+ isSpecCompliantForm,
4488
+ toJSONObject,
4489
+ isAsyncFn,
4490
+ isThenable,
4491
+ setImmediate: _setImmediate,
4492
+ asap,
4493
+ isIterable
4494
+ };
4495
+ let AxiosError$1 = class AxiosError extends Error {
4496
+ static from(error, code, config, request, response, customProps) {
4497
+ const axiosError = new AxiosError(error.message, code || error.code, config, request, response);
4498
+ axiosError.cause = error;
4499
+ axiosError.name = error.name;
4500
+ if (error.status != null && axiosError.status == null) {
4501
+ axiosError.status = error.status;
4502
+ }
4503
+ customProps && Object.assign(axiosError, customProps);
4504
+ return axiosError;
4505
+ }
4506
+ /**
4507
+ * Create an Error with the specified message, config, error code, request and response.
4508
+ *
4509
+ * @param {string} message The error message.
4510
+ * @param {string} [code] The error code (for example, 'ECONNABORTED').
4511
+ * @param {Object} [config] The config.
4512
+ * @param {Object} [request] The request.
4513
+ * @param {Object} [response] The response.
4514
+ *
4515
+ * @returns {Error} The created error.
4516
+ */
4517
+ constructor(message, code, config, request, response) {
4518
+ super(message);
4519
+ Object.defineProperty(this, "message", {
4520
+ value: message,
4521
+ enumerable: true,
4522
+ writable: true,
4523
+ configurable: true
4028
4524
  });
4029
- __publicField(this, "handleLangChange", (e) => {
4030
- const selected = LANG_OPTIONS.find((opt) => opt.value === e.target.value);
4031
- this.props.setLang(selected || null);
4525
+ this.name = "AxiosError";
4526
+ this.isAxiosError = true;
4527
+ code && (this.code = code);
4528
+ config && (this.config = config);
4529
+ request && (this.request = request);
4530
+ if (response) {
4531
+ this.response = response;
4532
+ this.status = response.status;
4533
+ }
4534
+ }
4535
+ toJSON() {
4536
+ return {
4537
+ // Standard
4538
+ message: this.message,
4539
+ name: this.name,
4540
+ // Microsoft
4541
+ description: this.description,
4542
+ number: this.number,
4543
+ // Mozilla
4544
+ fileName: this.fileName,
4545
+ lineNumber: this.lineNumber,
4546
+ columnNumber: this.columnNumber,
4547
+ stack: this.stack,
4548
+ // Axios
4549
+ config: utils$1.toJSONObject(this.config),
4550
+ code: this.code,
4551
+ status: this.status
4552
+ };
4553
+ }
4554
+ };
4555
+ AxiosError$1.ERR_BAD_OPTION_VALUE = "ERR_BAD_OPTION_VALUE";
4556
+ AxiosError$1.ERR_BAD_OPTION = "ERR_BAD_OPTION";
4557
+ AxiosError$1.ECONNABORTED = "ECONNABORTED";
4558
+ AxiosError$1.ETIMEDOUT = "ETIMEDOUT";
4559
+ AxiosError$1.ERR_NETWORK = "ERR_NETWORK";
4560
+ AxiosError$1.ERR_FR_TOO_MANY_REDIRECTS = "ERR_FR_TOO_MANY_REDIRECTS";
4561
+ AxiosError$1.ERR_DEPRECATED = "ERR_DEPRECATED";
4562
+ AxiosError$1.ERR_BAD_RESPONSE = "ERR_BAD_RESPONSE";
4563
+ AxiosError$1.ERR_BAD_REQUEST = "ERR_BAD_REQUEST";
4564
+ AxiosError$1.ERR_CANCELED = "ERR_CANCELED";
4565
+ AxiosError$1.ERR_NOT_SUPPORT = "ERR_NOT_SUPPORT";
4566
+ AxiosError$1.ERR_INVALID_URL = "ERR_INVALID_URL";
4567
+ const httpAdapter = null;
4568
+ function isVisitable(thing) {
4569
+ return utils$1.isPlainObject(thing) || utils$1.isArray(thing);
4570
+ }
4571
+ function removeBrackets(key) {
4572
+ return utils$1.endsWith(key, "[]") ? key.slice(0, -2) : key;
4573
+ }
4574
+ function renderKey(path, key, dots) {
4575
+ if (!path) return key;
4576
+ return path.concat(key).map(function each(token, i) {
4577
+ token = removeBrackets(token);
4578
+ return !dots && i ? "[" + token + "]" : token;
4579
+ }).join(dots ? "." : "");
4580
+ }
4581
+ function isFlatArray(arr) {
4582
+ return utils$1.isArray(arr) && !arr.some(isVisitable);
4583
+ }
4584
+ const predicates = utils$1.toFlatObject(utils$1, {}, null, function filter(prop) {
4585
+ return /^is[A-Z]/.test(prop);
4586
+ });
4587
+ function toFormData$1(obj, formData, options) {
4588
+ if (!utils$1.isObject(obj)) {
4589
+ throw new TypeError("target must be an object");
4590
+ }
4591
+ formData = formData || new FormData();
4592
+ options = utils$1.toFlatObject(
4593
+ options,
4594
+ {
4595
+ metaTokens: true,
4596
+ dots: false,
4597
+ indexes: false
4598
+ },
4599
+ false,
4600
+ function defined(option, source) {
4601
+ return !utils$1.isUndefined(source[option]);
4602
+ }
4603
+ );
4604
+ const metaTokens = options.metaTokens;
4605
+ const visitor = options.visitor || defaultVisitor;
4606
+ const dots = options.dots;
4607
+ const indexes = options.indexes;
4608
+ const _Blob = options.Blob || typeof Blob !== "undefined" && Blob;
4609
+ const useBlob = _Blob && utils$1.isSpecCompliantForm(formData);
4610
+ if (!utils$1.isFunction(visitor)) {
4611
+ throw new TypeError("visitor must be a function");
4612
+ }
4613
+ function convertValue(value) {
4614
+ if (value === null) return "";
4615
+ if (utils$1.isDate(value)) {
4616
+ return value.toISOString();
4617
+ }
4618
+ if (utils$1.isBoolean(value)) {
4619
+ return value.toString();
4620
+ }
4621
+ if (!useBlob && utils$1.isBlob(value)) {
4622
+ throw new AxiosError$1("Blob is not supported. Use a Buffer instead.");
4623
+ }
4624
+ if (utils$1.isArrayBuffer(value) || utils$1.isTypedArray(value)) {
4625
+ return useBlob && typeof Blob === "function" ? new Blob([value]) : Buffer.from(value);
4626
+ }
4627
+ return value;
4628
+ }
4629
+ function defaultVisitor(value, key, path) {
4630
+ let arr = value;
4631
+ if (utils$1.isReactNative(formData) && utils$1.isReactNativeBlob(value)) {
4632
+ formData.append(renderKey(path, key, dots), convertValue(value));
4633
+ return false;
4634
+ }
4635
+ if (value && !path && typeof value === "object") {
4636
+ if (utils$1.endsWith(key, "{}")) {
4637
+ key = metaTokens ? key : key.slice(0, -2);
4638
+ value = JSON.stringify(value);
4639
+ } else if (utils$1.isArray(value) && isFlatArray(value) || (utils$1.isFileList(value) || utils$1.endsWith(key, "[]")) && (arr = utils$1.toArray(value))) {
4640
+ key = removeBrackets(key);
4641
+ arr.forEach(function each(el, index) {
4642
+ !(utils$1.isUndefined(el) || el === null) && formData.append(
4643
+ // eslint-disable-next-line no-nested-ternary
4644
+ indexes === true ? renderKey([key], index, dots) : indexes === null ? key : key + "[]",
4645
+ convertValue(el)
4646
+ );
4647
+ });
4648
+ return false;
4649
+ }
4650
+ }
4651
+ if (isVisitable(value)) {
4652
+ return true;
4653
+ }
4654
+ formData.append(renderKey(path, key, dots), convertValue(value));
4655
+ return false;
4656
+ }
4657
+ const stack = [];
4658
+ const exposedHelpers = Object.assign(predicates, {
4659
+ defaultVisitor,
4660
+ convertValue,
4661
+ isVisitable
4662
+ });
4663
+ function build(value, path) {
4664
+ if (utils$1.isUndefined(value)) return;
4665
+ if (stack.indexOf(value) !== -1) {
4666
+ throw Error("Circular reference detected in " + path.join("."));
4667
+ }
4668
+ stack.push(value);
4669
+ utils$1.forEach(value, function each(el, key) {
4670
+ const result = !(utils$1.isUndefined(el) || el === null) && visitor.call(formData, el, utils$1.isString(key) ? key.trim() : key, path, exposedHelpers);
4671
+ if (result === true) {
4672
+ build(el, path ? path.concat(key) : [key]);
4673
+ }
4032
4674
  });
4033
- this.state = { open: false };
4034
- this.containerRef = React.createRef();
4035
- this.popperRef = React.createRef();
4675
+ stack.pop();
4036
4676
  }
4037
- componentDidMount() {
4038
- document.addEventListener("mousedown", this.handleClickOutside);
4677
+ if (!utils$1.isObject(obj)) {
4678
+ throw new TypeError("data must be an object");
4039
4679
  }
4040
- componentWillUnmount() {
4041
- document.removeEventListener("mousedown", this.handleClickOutside);
4680
+ build(obj);
4681
+ return formData;
4682
+ }
4683
+ function encode$1(str) {
4684
+ const charMap = {
4685
+ "!": "%21",
4686
+ "'": "%27",
4687
+ "(": "%28",
4688
+ ")": "%29",
4689
+ "~": "%7E",
4690
+ "%20": "+",
4691
+ "%00": "\0"
4692
+ };
4693
+ return encodeURIComponent(str).replace(/[!'()~]|%20|%00/g, function replacer(match) {
4694
+ return charMap[match];
4695
+ });
4696
+ }
4697
+ function AxiosURLSearchParams(params, options) {
4698
+ this._pairs = [];
4699
+ params && toFormData$1(params, this, options);
4700
+ }
4701
+ const prototype = AxiosURLSearchParams.prototype;
4702
+ prototype.append = function append(name, value) {
4703
+ this._pairs.push([name, value]);
4704
+ };
4705
+ prototype.toString = function toString2(encoder) {
4706
+ const _encode = encoder ? function(value) {
4707
+ return encoder.call(this, value, encode$1);
4708
+ } : encode$1;
4709
+ return this._pairs.map(function each(pair) {
4710
+ return _encode(pair[0]) + "=" + _encode(pair[1]);
4711
+ }, "").join("&");
4712
+ };
4713
+ function encode(val) {
4714
+ return encodeURIComponent(val).replace(/%3A/gi, ":").replace(/%24/g, "$").replace(/%2C/gi, ",").replace(/%20/g, "+");
4715
+ }
4716
+ function buildURL(url, params, options) {
4717
+ if (!params) {
4718
+ return url;
4042
4719
  }
4043
- render() {
4044
- const {
4045
- lang,
4046
- originalEmail,
4047
- setOriginalEmail,
4048
- getEditorContent,
4049
- parentRef
4050
- } = this.props;
4051
- const { open } = this.state;
4052
- let popperTop = 0;
4053
- let popperLeft = 0;
4054
- let popperWidth = 320;
4055
- if (open && this.containerRef.current) {
4056
- const rect = this.containerRef.current.getBoundingClientRect();
4057
- popperTop = rect.top + (window.scrollY || document.documentElement.scrollTop) - 8;
4058
- popperLeft = rect.left + (window.scrollX || document.documentElement.scrollLeft);
4059
- if (parentRef && parentRef.current) {
4060
- const parentRect = parentRef.current.getBoundingClientRect();
4061
- popperWidth = parentRect.width - 16;
4062
- popperLeft = parentRect.left + 8;
4720
+ const _encode = options && options.encode || encode;
4721
+ const _options = utils$1.isFunction(options) ? {
4722
+ serialize: options
4723
+ } : options;
4724
+ const serializeFn = _options && _options.serialize;
4725
+ let serializedParams;
4726
+ if (serializeFn) {
4727
+ serializedParams = serializeFn(params, _options);
4728
+ } else {
4729
+ serializedParams = utils$1.isURLSearchParams(params) ? params.toString() : new AxiosURLSearchParams(params, _options).toString(_encode);
4730
+ }
4731
+ if (serializedParams) {
4732
+ const hashmarkIndex = url.indexOf("#");
4733
+ if (hashmarkIndex !== -1) {
4734
+ url = url.slice(0, hashmarkIndex);
4735
+ }
4736
+ url += (url.indexOf("?") === -1 ? "?" : "&") + serializedParams;
4737
+ }
4738
+ return url;
4739
+ }
4740
+ class InterceptorManager {
4741
+ constructor() {
4742
+ this.handlers = [];
4743
+ }
4744
+ /**
4745
+ * Add a new interceptor to the stack
4746
+ *
4747
+ * @param {Function} fulfilled The function to handle `then` for a `Promise`
4748
+ * @param {Function} rejected The function to handle `reject` for a `Promise`
4749
+ * @param {Object} options The options for the interceptor, synchronous and runWhen
4750
+ *
4751
+ * @return {Number} An ID used to remove interceptor later
4752
+ */
4753
+ use(fulfilled, rejected, options) {
4754
+ this.handlers.push({
4755
+ fulfilled,
4756
+ rejected,
4757
+ synchronous: options ? options.synchronous : false,
4758
+ runWhen: options ? options.runWhen : null
4759
+ });
4760
+ return this.handlers.length - 1;
4761
+ }
4762
+ /**
4763
+ * Remove an interceptor from the stack
4764
+ *
4765
+ * @param {Number} id The ID that was returned by `use`
4766
+ *
4767
+ * @returns {void}
4768
+ */
4769
+ eject(id) {
4770
+ if (this.handlers[id]) {
4771
+ this.handlers[id] = null;
4772
+ }
4773
+ }
4774
+ /**
4775
+ * Clear all interceptors from the stack
4776
+ *
4777
+ * @returns {void}
4778
+ */
4779
+ clear() {
4780
+ if (this.handlers) {
4781
+ this.handlers = [];
4782
+ }
4783
+ }
4784
+ /**
4785
+ * Iterate over all the registered interceptors
4786
+ *
4787
+ * This method is particularly useful for skipping over any
4788
+ * interceptors that may have become `null` calling `eject`.
4789
+ *
4790
+ * @param {Function} fn The function to call for each interceptor
4791
+ *
4792
+ * @returns {void}
4793
+ */
4794
+ forEach(fn) {
4795
+ utils$1.forEach(this.handlers, function forEachHandler(h) {
4796
+ if (h !== null) {
4797
+ fn(h);
4798
+ }
4799
+ });
4800
+ }
4801
+ }
4802
+ const transitionalDefaults = {
4803
+ silentJSONParsing: true,
4804
+ forcedJSONParsing: true,
4805
+ clarifyTimeoutError: false,
4806
+ legacyInterceptorReqResOrdering: true
4807
+ };
4808
+ const URLSearchParams$1 = typeof URLSearchParams !== "undefined" ? URLSearchParams : AxiosURLSearchParams;
4809
+ const FormData$1 = typeof FormData !== "undefined" ? FormData : null;
4810
+ const Blob$1 = typeof Blob !== "undefined" ? Blob : null;
4811
+ const platform$1 = {
4812
+ isBrowser: true,
4813
+ classes: {
4814
+ URLSearchParams: URLSearchParams$1,
4815
+ FormData: FormData$1,
4816
+ Blob: Blob$1
4817
+ },
4818
+ protocols: ["http", "https", "file", "blob", "url", "data"]
4819
+ };
4820
+ const hasBrowserEnv = typeof window !== "undefined" && typeof document !== "undefined";
4821
+ const _navigator = typeof navigator === "object" && navigator || void 0;
4822
+ const hasStandardBrowserEnv = hasBrowserEnv && (!_navigator || ["ReactNative", "NativeScript", "NS"].indexOf(_navigator.product) < 0);
4823
+ const hasStandardBrowserWebWorkerEnv = (() => {
4824
+ return typeof WorkerGlobalScope !== "undefined" && // eslint-disable-next-line no-undef
4825
+ self instanceof WorkerGlobalScope && typeof self.importScripts === "function";
4826
+ })();
4827
+ const origin = hasBrowserEnv && window.location.href || "http://localhost";
4828
+ const utils = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
4829
+ __proto__: null,
4830
+ hasBrowserEnv,
4831
+ hasStandardBrowserEnv,
4832
+ hasStandardBrowserWebWorkerEnv,
4833
+ navigator: _navigator,
4834
+ origin
4835
+ }, Symbol.toStringTag, { value: "Module" }));
4836
+ const platform = __spreadValues(__spreadValues({}, utils), platform$1);
4837
+ function toURLEncodedForm(data, options) {
4838
+ return toFormData$1(data, new platform.classes.URLSearchParams(), __spreadValues({
4839
+ visitor: function(value, key, path, helpers) {
4840
+ if (platform.isNode && utils$1.isBuffer(value)) {
4841
+ this.append(key, value.toString("base64"));
4842
+ return false;
4063
4843
  }
4844
+ return helpers.defaultVisitor.apply(this, arguments);
4064
4845
  }
4065
- return /* @__PURE__ */ React.createElement(
4066
- "div",
4067
- {
4068
- ref: this.containerRef,
4069
- style: { position: "relative", display: "inline-block" }
4070
- },
4071
- /* @__PURE__ */ React.createElement(
4072
- "button",
4073
- {
4074
- type: "button",
4075
- onClick: this.togglePopper,
4076
- className: "icon-button small"
4077
- },
4078
- /* @__PURE__ */ React.createElement(Settings, { size: 16 })
4079
- ),
4080
- open && this.containerRef.current && ReactDOM.createPortal(
4081
- /* @__PURE__ */ React.createElement(
4082
- "div",
4083
- {
4084
- ref: this.popperRef,
4085
- style: {
4086
- position: "absolute",
4087
- top: popperTop,
4088
- left: popperLeft,
4089
- transform: "translateY(-100%)",
4090
- zIndex: 1051,
4091
- background: "#fff",
4092
- border: "1px solid #ddd",
4093
- boxShadow: "0px 4px 12px rgba(0, 0, 0, 0.1)",
4846
+ }, options));
4847
+ }
4848
+ function parsePropPath(name) {
4849
+ return utils$1.matchAll(/\w+|\[(\w*)]/g, name).map((match) => {
4850
+ return match[0] === "[]" ? "" : match[1] || match[0];
4851
+ });
4852
+ }
4853
+ function arrayToObject(arr) {
4854
+ const obj = {};
4855
+ const keys = Object.keys(arr);
4856
+ let i;
4857
+ const len = keys.length;
4858
+ let key;
4859
+ for (i = 0; i < len; i++) {
4860
+ key = keys[i];
4861
+ obj[key] = arr[key];
4862
+ }
4863
+ return obj;
4864
+ }
4865
+ function formDataToJSON(formData) {
4866
+ function buildPath(path, value, target, index) {
4867
+ let name = path[index++];
4868
+ if (name === "__proto__") return true;
4869
+ const isNumericKey = Number.isFinite(+name);
4870
+ const isLast = index >= path.length;
4871
+ name = !name && utils$1.isArray(target) ? target.length : name;
4872
+ if (isLast) {
4873
+ if (utils$1.hasOwnProp(target, name)) {
4874
+ target[name] = [target[name], value];
4875
+ } else {
4876
+ target[name] = value;
4877
+ }
4878
+ return !isNumericKey;
4879
+ }
4880
+ if (!target[name] || !utils$1.isObject(target[name])) {
4881
+ target[name] = [];
4882
+ }
4883
+ const result = buildPath(path, value, target[name], index);
4884
+ if (result && utils$1.isArray(target[name])) {
4885
+ target[name] = arrayToObject(target[name]);
4886
+ }
4887
+ return !isNumericKey;
4888
+ }
4889
+ if (utils$1.isFormData(formData) && utils$1.isFunction(formData.entries)) {
4890
+ const obj = {};
4891
+ utils$1.forEachEntry(formData, (name, value) => {
4892
+ buildPath(parsePropPath(name), value, obj, 0);
4893
+ });
4894
+ return obj;
4895
+ }
4896
+ return null;
4897
+ }
4898
+ function stringifySafely(rawValue, parser, encoder) {
4899
+ if (utils$1.isString(rawValue)) {
4900
+ try {
4901
+ (parser || JSON.parse)(rawValue);
4902
+ return utils$1.trim(rawValue);
4903
+ } catch (e) {
4904
+ if (e.name !== "SyntaxError") {
4905
+ throw e;
4906
+ }
4907
+ }
4908
+ }
4909
+ return (encoder || JSON.stringify)(rawValue);
4910
+ }
4911
+ const defaults = {
4912
+ transitional: transitionalDefaults,
4913
+ adapter: ["xhr", "http", "fetch"],
4914
+ transformRequest: [
4915
+ function transformRequest(data, headers) {
4916
+ const contentType = headers.getContentType() || "";
4917
+ const hasJSONContentType = contentType.indexOf("application/json") > -1;
4918
+ const isObjectPayload = utils$1.isObject(data);
4919
+ if (isObjectPayload && utils$1.isHTMLForm(data)) {
4920
+ data = new FormData(data);
4921
+ }
4922
+ const isFormData2 = utils$1.isFormData(data);
4923
+ if (isFormData2) {
4924
+ return hasJSONContentType ? JSON.stringify(formDataToJSON(data)) : data;
4925
+ }
4926
+ if (utils$1.isArrayBuffer(data) || utils$1.isBuffer(data) || utils$1.isStream(data) || utils$1.isFile(data) || utils$1.isBlob(data) || utils$1.isReadableStream(data)) {
4927
+ return data;
4928
+ }
4929
+ if (utils$1.isArrayBufferView(data)) {
4930
+ return data.buffer;
4931
+ }
4932
+ if (utils$1.isURLSearchParams(data)) {
4933
+ headers.setContentType("application/x-www-form-urlencoded;charset=utf-8", false);
4934
+ return data.toString();
4935
+ }
4936
+ let isFileList2;
4937
+ if (isObjectPayload) {
4938
+ if (contentType.indexOf("application/x-www-form-urlencoded") > -1) {
4939
+ return toURLEncodedForm(data, this.formSerializer).toString();
4940
+ }
4941
+ if ((isFileList2 = utils$1.isFileList(data)) || contentType.indexOf("multipart/form-data") > -1) {
4942
+ const _FormData = this.env && this.env.FormData;
4943
+ return toFormData$1(
4944
+ isFileList2 ? { "files[]": data } : data,
4945
+ _FormData && new _FormData(),
4946
+ this.formSerializer
4947
+ );
4948
+ }
4949
+ }
4950
+ if (isObjectPayload || hasJSONContentType) {
4951
+ headers.setContentType("application/json", false);
4952
+ return stringifySafely(data);
4953
+ }
4954
+ return data;
4955
+ }
4956
+ ],
4957
+ transformResponse: [
4958
+ function transformResponse(data) {
4959
+ const transitional2 = this.transitional || defaults.transitional;
4960
+ const forcedJSONParsing = transitional2 && transitional2.forcedJSONParsing;
4961
+ const JSONRequested = this.responseType === "json";
4962
+ if (utils$1.isResponse(data) || utils$1.isReadableStream(data)) {
4963
+ return data;
4964
+ }
4965
+ if (data && utils$1.isString(data) && (forcedJSONParsing && !this.responseType || JSONRequested)) {
4966
+ const silentJSONParsing = transitional2 && transitional2.silentJSONParsing;
4967
+ const strictJSONParsing = !silentJSONParsing && JSONRequested;
4968
+ try {
4969
+ return JSON.parse(data, this.parseReviver);
4970
+ } catch (e) {
4971
+ if (strictJSONParsing) {
4972
+ if (e.name === "SyntaxError") {
4973
+ throw AxiosError$1.from(e, AxiosError$1.ERR_BAD_RESPONSE, this, null, this.response);
4974
+ }
4975
+ throw e;
4976
+ }
4977
+ }
4978
+ }
4979
+ return data;
4980
+ }
4981
+ ],
4982
+ /**
4983
+ * A timeout in milliseconds to abort a request. If set to 0 (default) a
4984
+ * timeout is not created.
4985
+ */
4986
+ timeout: 0,
4987
+ xsrfCookieName: "XSRF-TOKEN",
4988
+ xsrfHeaderName: "X-XSRF-TOKEN",
4989
+ maxContentLength: -1,
4990
+ maxBodyLength: -1,
4991
+ env: {
4992
+ FormData: platform.classes.FormData,
4993
+ Blob: platform.classes.Blob
4994
+ },
4995
+ validateStatus: function validateStatus(status) {
4996
+ return status >= 200 && status < 300;
4997
+ },
4998
+ headers: {
4999
+ common: {
5000
+ Accept: "application/json, text/plain, */*",
5001
+ "Content-Type": void 0
5002
+ }
5003
+ }
5004
+ };
5005
+ utils$1.forEach(["delete", "get", "head", "post", "put", "patch"], (method) => {
5006
+ defaults.headers[method] = {};
5007
+ });
5008
+ const ignoreDuplicateOf = utils$1.toObjectSet([
5009
+ "age",
5010
+ "authorization",
5011
+ "content-length",
5012
+ "content-type",
5013
+ "etag",
5014
+ "expires",
5015
+ "from",
5016
+ "host",
5017
+ "if-modified-since",
5018
+ "if-unmodified-since",
5019
+ "last-modified",
5020
+ "location",
5021
+ "max-forwards",
5022
+ "proxy-authorization",
5023
+ "referer",
5024
+ "retry-after",
5025
+ "user-agent"
5026
+ ]);
5027
+ const parseHeaders = (rawHeaders) => {
5028
+ const parsed = {};
5029
+ let key;
5030
+ let val;
5031
+ let i;
5032
+ rawHeaders && rawHeaders.split("\n").forEach(function parser(line) {
5033
+ i = line.indexOf(":");
5034
+ key = line.substring(0, i).trim().toLowerCase();
5035
+ val = line.substring(i + 1).trim();
5036
+ if (!key || parsed[key] && ignoreDuplicateOf[key]) {
5037
+ return;
5038
+ }
5039
+ if (key === "set-cookie") {
5040
+ if (parsed[key]) {
5041
+ parsed[key].push(val);
5042
+ } else {
5043
+ parsed[key] = [val];
5044
+ }
5045
+ } else {
5046
+ parsed[key] = parsed[key] ? parsed[key] + ", " + val : val;
5047
+ }
5048
+ });
5049
+ return parsed;
5050
+ };
5051
+ const $internals = Symbol("internals");
5052
+ function normalizeHeader(header) {
5053
+ return header && String(header).trim().toLowerCase();
5054
+ }
5055
+ function normalizeValue(value) {
5056
+ if (value === false || value == null) {
5057
+ return value;
5058
+ }
5059
+ return utils$1.isArray(value) ? value.map(normalizeValue) : String(value);
5060
+ }
5061
+ function parseTokens(str) {
5062
+ const tokens = /* @__PURE__ */ Object.create(null);
5063
+ const tokensRE = /([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;
5064
+ let match;
5065
+ while (match = tokensRE.exec(str)) {
5066
+ tokens[match[1]] = match[2];
5067
+ }
5068
+ return tokens;
5069
+ }
5070
+ const isValidHeaderName = (str) => /^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(str.trim());
5071
+ function matchHeaderValue(context, value, header, filter2, isHeaderNameFilter) {
5072
+ if (utils$1.isFunction(filter2)) {
5073
+ return filter2.call(this, value, header);
5074
+ }
5075
+ if (isHeaderNameFilter) {
5076
+ value = header;
5077
+ }
5078
+ if (!utils$1.isString(value)) return;
5079
+ if (utils$1.isString(filter2)) {
5080
+ return value.indexOf(filter2) !== -1;
5081
+ }
5082
+ if (utils$1.isRegExp(filter2)) {
5083
+ return filter2.test(value);
5084
+ }
5085
+ }
5086
+ function formatHeader(header) {
5087
+ return header.trim().toLowerCase().replace(/([a-z\d])(\w*)/g, (w, char, str) => {
5088
+ return char.toUpperCase() + str;
5089
+ });
5090
+ }
5091
+ function buildAccessors(obj, header) {
5092
+ const accessorName = utils$1.toCamelCase(" " + header);
5093
+ ["get", "set", "has"].forEach((methodName) => {
5094
+ Object.defineProperty(obj, methodName + accessorName, {
5095
+ value: function(arg1, arg2, arg3) {
5096
+ return this[methodName].call(this, header, arg1, arg2, arg3);
5097
+ },
5098
+ configurable: true
5099
+ });
5100
+ });
5101
+ }
5102
+ let AxiosHeaders$1 = class AxiosHeaders {
5103
+ constructor(headers) {
5104
+ headers && this.set(headers);
5105
+ }
5106
+ set(header, valueOrRewrite, rewrite) {
5107
+ const self2 = this;
5108
+ function setHeader(_value, _header, _rewrite) {
5109
+ const lHeader = normalizeHeader(_header);
5110
+ if (!lHeader) {
5111
+ throw new Error("header name must be a non-empty string");
5112
+ }
5113
+ const key = utils$1.findKey(self2, lHeader);
5114
+ if (!key || self2[key] === void 0 || _rewrite === true || _rewrite === void 0 && self2[key] !== false) {
5115
+ self2[key || _header] = normalizeValue(_value);
5116
+ }
5117
+ }
5118
+ const setHeaders = (headers, _rewrite) => utils$1.forEach(headers, (_value, _header) => setHeader(_value, _header, _rewrite));
5119
+ if (utils$1.isPlainObject(header) || header instanceof this.constructor) {
5120
+ setHeaders(header, valueOrRewrite);
5121
+ } else if (utils$1.isString(header) && (header = header.trim()) && !isValidHeaderName(header)) {
5122
+ setHeaders(parseHeaders(header), valueOrRewrite);
5123
+ } else if (utils$1.isObject(header) && utils$1.isIterable(header)) {
5124
+ let obj = {}, dest, key;
5125
+ for (const entry of header) {
5126
+ if (!utils$1.isArray(entry)) {
5127
+ throw TypeError("Object iterator must return a key-value pair");
5128
+ }
5129
+ obj[key = entry[0]] = (dest = obj[key]) ? utils$1.isArray(dest) ? [...dest, entry[1]] : [dest, entry[1]] : entry[1];
5130
+ }
5131
+ setHeaders(obj, valueOrRewrite);
5132
+ } else {
5133
+ header != null && setHeader(valueOrRewrite, header, rewrite);
5134
+ }
5135
+ return this;
5136
+ }
5137
+ get(header, parser) {
5138
+ header = normalizeHeader(header);
5139
+ if (header) {
5140
+ const key = utils$1.findKey(this, header);
5141
+ if (key) {
5142
+ const value = this[key];
5143
+ if (!parser) {
5144
+ return value;
5145
+ }
5146
+ if (parser === true) {
5147
+ return parseTokens(value);
5148
+ }
5149
+ if (utils$1.isFunction(parser)) {
5150
+ return parser.call(this, value, key);
5151
+ }
5152
+ if (utils$1.isRegExp(parser)) {
5153
+ return parser.exec(value);
5154
+ }
5155
+ throw new TypeError("parser must be boolean|regexp|function");
5156
+ }
5157
+ }
5158
+ }
5159
+ has(header, matcher) {
5160
+ header = normalizeHeader(header);
5161
+ if (header) {
5162
+ const key = utils$1.findKey(this, header);
5163
+ return !!(key && this[key] !== void 0 && (!matcher || matchHeaderValue(this, this[key], key, matcher)));
5164
+ }
5165
+ return false;
5166
+ }
5167
+ delete(header, matcher) {
5168
+ const self2 = this;
5169
+ let deleted = false;
5170
+ function deleteHeader(_header) {
5171
+ _header = normalizeHeader(_header);
5172
+ if (_header) {
5173
+ const key = utils$1.findKey(self2, _header);
5174
+ if (key && (!matcher || matchHeaderValue(self2, self2[key], key, matcher))) {
5175
+ delete self2[key];
5176
+ deleted = true;
5177
+ }
5178
+ }
5179
+ }
5180
+ if (utils$1.isArray(header)) {
5181
+ header.forEach(deleteHeader);
5182
+ } else {
5183
+ deleteHeader(header);
5184
+ }
5185
+ return deleted;
5186
+ }
5187
+ clear(matcher) {
5188
+ const keys = Object.keys(this);
5189
+ let i = keys.length;
5190
+ let deleted = false;
5191
+ while (i--) {
5192
+ const key = keys[i];
5193
+ if (!matcher || matchHeaderValue(this, this[key], key, matcher, true)) {
5194
+ delete this[key];
5195
+ deleted = true;
5196
+ }
5197
+ }
5198
+ return deleted;
5199
+ }
5200
+ normalize(format) {
5201
+ const self2 = this;
5202
+ const headers = {};
5203
+ utils$1.forEach(this, (value, header) => {
5204
+ const key = utils$1.findKey(headers, header);
5205
+ if (key) {
5206
+ self2[key] = normalizeValue(value);
5207
+ delete self2[header];
5208
+ return;
5209
+ }
5210
+ const normalized = format ? formatHeader(header) : String(header).trim();
5211
+ if (normalized !== header) {
5212
+ delete self2[header];
5213
+ }
5214
+ self2[normalized] = normalizeValue(value);
5215
+ headers[normalized] = true;
5216
+ });
5217
+ return this;
5218
+ }
5219
+ concat(...targets) {
5220
+ return this.constructor.concat(this, ...targets);
5221
+ }
5222
+ toJSON(asStrings) {
5223
+ const obj = /* @__PURE__ */ Object.create(null);
5224
+ utils$1.forEach(this, (value, header) => {
5225
+ value != null && value !== false && (obj[header] = asStrings && utils$1.isArray(value) ? value.join(", ") : value);
5226
+ });
5227
+ return obj;
5228
+ }
5229
+ [Symbol.iterator]() {
5230
+ return Object.entries(this.toJSON())[Symbol.iterator]();
5231
+ }
5232
+ toString() {
5233
+ return Object.entries(this.toJSON()).map(([header, value]) => header + ": " + value).join("\n");
5234
+ }
5235
+ getSetCookie() {
5236
+ return this.get("set-cookie") || [];
5237
+ }
5238
+ get [Symbol.toStringTag]() {
5239
+ return "AxiosHeaders";
5240
+ }
5241
+ static from(thing) {
5242
+ return thing instanceof this ? thing : new this(thing);
5243
+ }
5244
+ static concat(first, ...targets) {
5245
+ const computed = new this(first);
5246
+ targets.forEach((target) => computed.set(target));
5247
+ return computed;
5248
+ }
5249
+ static accessor(header) {
5250
+ const internals = this[$internals] = this[$internals] = {
5251
+ accessors: {}
5252
+ };
5253
+ const accessors = internals.accessors;
5254
+ const prototype2 = this.prototype;
5255
+ function defineAccessor(_header) {
5256
+ const lHeader = normalizeHeader(_header);
5257
+ if (!accessors[lHeader]) {
5258
+ buildAccessors(prototype2, _header);
5259
+ accessors[lHeader] = true;
5260
+ }
5261
+ }
5262
+ utils$1.isArray(header) ? header.forEach(defineAccessor) : defineAccessor(header);
5263
+ return this;
5264
+ }
5265
+ };
5266
+ AxiosHeaders$1.accessor([
5267
+ "Content-Type",
5268
+ "Content-Length",
5269
+ "Accept",
5270
+ "Accept-Encoding",
5271
+ "User-Agent",
5272
+ "Authorization"
5273
+ ]);
5274
+ utils$1.reduceDescriptors(AxiosHeaders$1.prototype, ({ value }, key) => {
5275
+ let mapped = key[0].toUpperCase() + key.slice(1);
5276
+ return {
5277
+ get: () => value,
5278
+ set(headerValue) {
5279
+ this[mapped] = headerValue;
5280
+ }
5281
+ };
5282
+ });
5283
+ utils$1.freezeMethods(AxiosHeaders$1);
5284
+ function transformData(fns, response) {
5285
+ const config = this || defaults;
5286
+ const context = response || config;
5287
+ const headers = AxiosHeaders$1.from(context.headers);
5288
+ let data = context.data;
5289
+ utils$1.forEach(fns, function transform(fn) {
5290
+ data = fn.call(config, data, headers.normalize(), response ? response.status : void 0);
5291
+ });
5292
+ headers.normalize();
5293
+ return data;
5294
+ }
5295
+ function isCancel$1(value) {
5296
+ return !!(value && value.__CANCEL__);
5297
+ }
5298
+ let CanceledError$1 = class CanceledError extends AxiosError$1 {
5299
+ /**
5300
+ * A `CanceledError` is an object that is thrown when an operation is canceled.
5301
+ *
5302
+ * @param {string=} message The message.
5303
+ * @param {Object=} config The config.
5304
+ * @param {Object=} request The request.
5305
+ *
5306
+ * @returns {CanceledError} The created error.
5307
+ */
5308
+ constructor(message, config, request) {
5309
+ super(message == null ? "canceled" : message, AxiosError$1.ERR_CANCELED, config, request);
5310
+ this.name = "CanceledError";
5311
+ this.__CANCEL__ = true;
5312
+ }
5313
+ };
5314
+ function settle(resolve, reject, response) {
5315
+ const validateStatus2 = response.config.validateStatus;
5316
+ if (!response.status || !validateStatus2 || validateStatus2(response.status)) {
5317
+ resolve(response);
5318
+ } else {
5319
+ reject(
5320
+ new AxiosError$1(
5321
+ "Request failed with status code " + response.status,
5322
+ [AxiosError$1.ERR_BAD_REQUEST, AxiosError$1.ERR_BAD_RESPONSE][Math.floor(response.status / 100) - 4],
5323
+ response.config,
5324
+ response.request,
5325
+ response
5326
+ )
5327
+ );
5328
+ }
5329
+ }
5330
+ function parseProtocol(url) {
5331
+ const match = /^([-+\w]{1,25})(:?\/\/|:)/.exec(url);
5332
+ return match && match[1] || "";
5333
+ }
5334
+ function speedometer(samplesCount, min) {
5335
+ samplesCount = samplesCount || 10;
5336
+ const bytes = new Array(samplesCount);
5337
+ const timestamps = new Array(samplesCount);
5338
+ let head = 0;
5339
+ let tail = 0;
5340
+ let firstSampleTS;
5341
+ min = min !== void 0 ? min : 1e3;
5342
+ return function push(chunkLength) {
5343
+ const now = Date.now();
5344
+ const startedAt = timestamps[tail];
5345
+ if (!firstSampleTS) {
5346
+ firstSampleTS = now;
5347
+ }
5348
+ bytes[head] = chunkLength;
5349
+ timestamps[head] = now;
5350
+ let i = tail;
5351
+ let bytesCount = 0;
5352
+ while (i !== head) {
5353
+ bytesCount += bytes[i++];
5354
+ i = i % samplesCount;
5355
+ }
5356
+ head = (head + 1) % samplesCount;
5357
+ if (head === tail) {
5358
+ tail = (tail + 1) % samplesCount;
5359
+ }
5360
+ if (now - firstSampleTS < min) {
5361
+ return;
5362
+ }
5363
+ const passed = startedAt && now - startedAt;
5364
+ return passed ? Math.round(bytesCount * 1e3 / passed) : void 0;
5365
+ };
5366
+ }
5367
+ function throttle(fn, freq) {
5368
+ let timestamp = 0;
5369
+ let threshold = 1e3 / freq;
5370
+ let lastArgs;
5371
+ let timer;
5372
+ const invoke = (args, now = Date.now()) => {
5373
+ timestamp = now;
5374
+ lastArgs = null;
5375
+ if (timer) {
5376
+ clearTimeout(timer);
5377
+ timer = null;
5378
+ }
5379
+ fn(...args);
5380
+ };
5381
+ const throttled = (...args) => {
5382
+ const now = Date.now();
5383
+ const passed = now - timestamp;
5384
+ if (passed >= threshold) {
5385
+ invoke(args, now);
5386
+ } else {
5387
+ lastArgs = args;
5388
+ if (!timer) {
5389
+ timer = setTimeout(() => {
5390
+ timer = null;
5391
+ invoke(lastArgs);
5392
+ }, threshold - passed);
5393
+ }
5394
+ }
5395
+ };
5396
+ const flush = () => lastArgs && invoke(lastArgs);
5397
+ return [throttled, flush];
5398
+ }
5399
+ const progressEventReducer = (listener, isDownloadStream, freq = 3) => {
5400
+ let bytesNotified = 0;
5401
+ const _speedometer = speedometer(50, 250);
5402
+ return throttle((e) => {
5403
+ const loaded = e.loaded;
5404
+ const total = e.lengthComputable ? e.total : void 0;
5405
+ const progressBytes = loaded - bytesNotified;
5406
+ const rate = _speedometer(progressBytes);
5407
+ const inRange = loaded <= total;
5408
+ bytesNotified = loaded;
5409
+ const data = {
5410
+ loaded,
5411
+ total,
5412
+ progress: total ? loaded / total : void 0,
5413
+ bytes: progressBytes,
5414
+ rate: rate ? rate : void 0,
5415
+ estimated: rate && total && inRange ? (total - loaded) / rate : void 0,
5416
+ event: e,
5417
+ lengthComputable: total != null,
5418
+ [isDownloadStream ? "download" : "upload"]: true
5419
+ };
5420
+ listener(data);
5421
+ }, freq);
5422
+ };
5423
+ const progressEventDecorator = (total, throttled) => {
5424
+ const lengthComputable = total != null;
5425
+ return [
5426
+ (loaded) => throttled[0]({
5427
+ lengthComputable,
5428
+ total,
5429
+ loaded
5430
+ }),
5431
+ throttled[1]
5432
+ ];
5433
+ };
5434
+ const asyncDecorator = (fn) => (...args) => utils$1.asap(() => fn(...args));
5435
+ const isURLSameOrigin = platform.hasStandardBrowserEnv ? /* @__PURE__ */ ((origin2, isMSIE) => (url) => {
5436
+ url = new URL(url, platform.origin);
5437
+ return origin2.protocol === url.protocol && origin2.host === url.host && (isMSIE || origin2.port === url.port);
5438
+ })(
5439
+ new URL(platform.origin),
5440
+ platform.navigator && /(msie|trident)/i.test(platform.navigator.userAgent)
5441
+ ) : () => true;
5442
+ const cookies = platform.hasStandardBrowserEnv ? (
5443
+ // Standard browser envs support document.cookie
5444
+ {
5445
+ write(name, value, expires, path, domain, secure, sameSite) {
5446
+ if (typeof document === "undefined") return;
5447
+ const cookie = [`${name}=${encodeURIComponent(value)}`];
5448
+ if (utils$1.isNumber(expires)) {
5449
+ cookie.push(`expires=${new Date(expires).toUTCString()}`);
5450
+ }
5451
+ if (utils$1.isString(path)) {
5452
+ cookie.push(`path=${path}`);
5453
+ }
5454
+ if (utils$1.isString(domain)) {
5455
+ cookie.push(`domain=${domain}`);
5456
+ }
5457
+ if (secure === true) {
5458
+ cookie.push("secure");
5459
+ }
5460
+ if (utils$1.isString(sameSite)) {
5461
+ cookie.push(`SameSite=${sameSite}`);
5462
+ }
5463
+ document.cookie = cookie.join("; ");
5464
+ },
5465
+ read(name) {
5466
+ if (typeof document === "undefined") return null;
5467
+ const match = document.cookie.match(new RegExp("(?:^|; )" + name + "=([^;]*)"));
5468
+ return match ? decodeURIComponent(match[1]) : null;
5469
+ },
5470
+ remove(name) {
5471
+ this.write(name, "", Date.now() - 864e5, "/");
5472
+ }
5473
+ }
5474
+ ) : (
5475
+ // Non-standard browser env (web workers, react-native) lack needed support.
5476
+ {
5477
+ write() {
5478
+ },
5479
+ read() {
5480
+ return null;
5481
+ },
5482
+ remove() {
5483
+ }
5484
+ }
5485
+ );
5486
+ function isAbsoluteURL(url) {
5487
+ if (typeof url !== "string") {
5488
+ return false;
5489
+ }
5490
+ return /^([a-z][a-z\d+\-.]*:)?\/\//i.test(url);
5491
+ }
5492
+ function combineURLs(baseURL, relativeURL) {
5493
+ return relativeURL ? baseURL.replace(/\/?\/$/, "") + "/" + relativeURL.replace(/^\/+/, "") : baseURL;
5494
+ }
5495
+ function buildFullPath(baseURL, requestedURL, allowAbsoluteUrls) {
5496
+ let isRelativeUrl = !isAbsoluteURL(requestedURL);
5497
+ if (baseURL && (isRelativeUrl || allowAbsoluteUrls == false)) {
5498
+ return combineURLs(baseURL, requestedURL);
5499
+ }
5500
+ return requestedURL;
5501
+ }
5502
+ const headersToObject = (thing) => thing instanceof AxiosHeaders$1 ? __spreadValues({}, thing) : thing;
5503
+ function mergeConfig$1(config1, config2) {
5504
+ config2 = config2 || {};
5505
+ const config = {};
5506
+ function getMergedValue(target, source, prop, caseless) {
5507
+ if (utils$1.isPlainObject(target) && utils$1.isPlainObject(source)) {
5508
+ return utils$1.merge.call({ caseless }, target, source);
5509
+ } else if (utils$1.isPlainObject(source)) {
5510
+ return utils$1.merge({}, source);
5511
+ } else if (utils$1.isArray(source)) {
5512
+ return source.slice();
5513
+ }
5514
+ return source;
5515
+ }
5516
+ function mergeDeepProperties(a, b, prop, caseless) {
5517
+ if (!utils$1.isUndefined(b)) {
5518
+ return getMergedValue(a, b, prop, caseless);
5519
+ } else if (!utils$1.isUndefined(a)) {
5520
+ return getMergedValue(void 0, a, prop, caseless);
5521
+ }
5522
+ }
5523
+ function valueFromConfig2(a, b) {
5524
+ if (!utils$1.isUndefined(b)) {
5525
+ return getMergedValue(void 0, b);
5526
+ }
5527
+ }
5528
+ function defaultToConfig2(a, b) {
5529
+ if (!utils$1.isUndefined(b)) {
5530
+ return getMergedValue(void 0, b);
5531
+ } else if (!utils$1.isUndefined(a)) {
5532
+ return getMergedValue(void 0, a);
5533
+ }
5534
+ }
5535
+ function mergeDirectKeys(a, b, prop) {
5536
+ if (prop in config2) {
5537
+ return getMergedValue(a, b);
5538
+ } else if (prop in config1) {
5539
+ return getMergedValue(void 0, a);
5540
+ }
5541
+ }
5542
+ const mergeMap = {
5543
+ url: valueFromConfig2,
5544
+ method: valueFromConfig2,
5545
+ data: valueFromConfig2,
5546
+ baseURL: defaultToConfig2,
5547
+ transformRequest: defaultToConfig2,
5548
+ transformResponse: defaultToConfig2,
5549
+ paramsSerializer: defaultToConfig2,
5550
+ timeout: defaultToConfig2,
5551
+ timeoutMessage: defaultToConfig2,
5552
+ withCredentials: defaultToConfig2,
5553
+ withXSRFToken: defaultToConfig2,
5554
+ adapter: defaultToConfig2,
5555
+ responseType: defaultToConfig2,
5556
+ xsrfCookieName: defaultToConfig2,
5557
+ xsrfHeaderName: defaultToConfig2,
5558
+ onUploadProgress: defaultToConfig2,
5559
+ onDownloadProgress: defaultToConfig2,
5560
+ decompress: defaultToConfig2,
5561
+ maxContentLength: defaultToConfig2,
5562
+ maxBodyLength: defaultToConfig2,
5563
+ beforeRedirect: defaultToConfig2,
5564
+ transport: defaultToConfig2,
5565
+ httpAgent: defaultToConfig2,
5566
+ httpsAgent: defaultToConfig2,
5567
+ cancelToken: defaultToConfig2,
5568
+ socketPath: defaultToConfig2,
5569
+ responseEncoding: defaultToConfig2,
5570
+ validateStatus: mergeDirectKeys,
5571
+ headers: (a, b, prop) => mergeDeepProperties(headersToObject(a), headersToObject(b), prop, true)
5572
+ };
5573
+ utils$1.forEach(Object.keys(__spreadValues(__spreadValues({}, config1), config2)), function computeConfigValue(prop) {
5574
+ if (prop === "__proto__" || prop === "constructor" || prop === "prototype") return;
5575
+ const merge2 = utils$1.hasOwnProp(mergeMap, prop) ? mergeMap[prop] : mergeDeepProperties;
5576
+ const configValue = merge2(config1[prop], config2[prop], prop);
5577
+ utils$1.isUndefined(configValue) && merge2 !== mergeDirectKeys || (config[prop] = configValue);
5578
+ });
5579
+ return config;
5580
+ }
5581
+ const resolveConfig = (config) => {
5582
+ const newConfig = mergeConfig$1({}, config);
5583
+ let { data, withXSRFToken, xsrfHeaderName, xsrfCookieName, headers, auth } = newConfig;
5584
+ newConfig.headers = headers = AxiosHeaders$1.from(headers);
5585
+ newConfig.url = buildURL(
5586
+ buildFullPath(newConfig.baseURL, newConfig.url, newConfig.allowAbsoluteUrls),
5587
+ config.params,
5588
+ config.paramsSerializer
5589
+ );
5590
+ if (auth) {
5591
+ headers.set(
5592
+ "Authorization",
5593
+ "Basic " + btoa(
5594
+ (auth.username || "") + ":" + (auth.password ? unescape(encodeURIComponent(auth.password)) : "")
5595
+ )
5596
+ );
5597
+ }
5598
+ if (utils$1.isFormData(data)) {
5599
+ if (platform.hasStandardBrowserEnv || platform.hasStandardBrowserWebWorkerEnv) {
5600
+ headers.setContentType(void 0);
5601
+ } else if (utils$1.isFunction(data.getHeaders)) {
5602
+ const formHeaders = data.getHeaders();
5603
+ const allowedHeaders = ["content-type", "content-length"];
5604
+ Object.entries(formHeaders).forEach(([key, val]) => {
5605
+ if (allowedHeaders.includes(key.toLowerCase())) {
5606
+ headers.set(key, val);
5607
+ }
5608
+ });
5609
+ }
5610
+ }
5611
+ if (platform.hasStandardBrowserEnv) {
5612
+ withXSRFToken && utils$1.isFunction(withXSRFToken) && (withXSRFToken = withXSRFToken(newConfig));
5613
+ if (withXSRFToken || withXSRFToken !== false && isURLSameOrigin(newConfig.url)) {
5614
+ const xsrfValue = xsrfHeaderName && xsrfCookieName && cookies.read(xsrfCookieName);
5615
+ if (xsrfValue) {
5616
+ headers.set(xsrfHeaderName, xsrfValue);
5617
+ }
5618
+ }
5619
+ }
5620
+ return newConfig;
5621
+ };
5622
+ const isXHRAdapterSupported = typeof XMLHttpRequest !== "undefined";
5623
+ const xhrAdapter = isXHRAdapterSupported && function(config) {
5624
+ return new Promise(function dispatchXhrRequest(resolve, reject) {
5625
+ const _config = resolveConfig(config);
5626
+ let requestData = _config.data;
5627
+ const requestHeaders = AxiosHeaders$1.from(_config.headers).normalize();
5628
+ let { responseType, onUploadProgress, onDownloadProgress } = _config;
5629
+ let onCanceled;
5630
+ let uploadThrottled, downloadThrottled;
5631
+ let flushUpload, flushDownload;
5632
+ function done() {
5633
+ flushUpload && flushUpload();
5634
+ flushDownload && flushDownload();
5635
+ _config.cancelToken && _config.cancelToken.unsubscribe(onCanceled);
5636
+ _config.signal && _config.signal.removeEventListener("abort", onCanceled);
5637
+ }
5638
+ let request = new XMLHttpRequest();
5639
+ request.open(_config.method.toUpperCase(), _config.url, true);
5640
+ request.timeout = _config.timeout;
5641
+ function onloadend() {
5642
+ if (!request) {
5643
+ return;
5644
+ }
5645
+ const responseHeaders = AxiosHeaders$1.from(
5646
+ "getAllResponseHeaders" in request && request.getAllResponseHeaders()
5647
+ );
5648
+ const responseData = !responseType || responseType === "text" || responseType === "json" ? request.responseText : request.response;
5649
+ const response = {
5650
+ data: responseData,
5651
+ status: request.status,
5652
+ statusText: request.statusText,
5653
+ headers: responseHeaders,
5654
+ config,
5655
+ request
5656
+ };
5657
+ settle(
5658
+ function _resolve(value) {
5659
+ resolve(value);
5660
+ done();
5661
+ },
5662
+ function _reject(err) {
5663
+ reject(err);
5664
+ done();
5665
+ },
5666
+ response
5667
+ );
5668
+ request = null;
5669
+ }
5670
+ if ("onloadend" in request) {
5671
+ request.onloadend = onloadend;
5672
+ } else {
5673
+ request.onreadystatechange = function handleLoad() {
5674
+ if (!request || request.readyState !== 4) {
5675
+ return;
5676
+ }
5677
+ if (request.status === 0 && !(request.responseURL && request.responseURL.indexOf("file:") === 0)) {
5678
+ return;
5679
+ }
5680
+ setTimeout(onloadend);
5681
+ };
5682
+ }
5683
+ request.onabort = function handleAbort() {
5684
+ if (!request) {
5685
+ return;
5686
+ }
5687
+ reject(new AxiosError$1("Request aborted", AxiosError$1.ECONNABORTED, config, request));
5688
+ request = null;
5689
+ };
5690
+ request.onerror = function handleError(event) {
5691
+ const msg = event && event.message ? event.message : "Network Error";
5692
+ const err = new AxiosError$1(msg, AxiosError$1.ERR_NETWORK, config, request);
5693
+ err.event = event || null;
5694
+ reject(err);
5695
+ request = null;
5696
+ };
5697
+ request.ontimeout = function handleTimeout() {
5698
+ let timeoutErrorMessage = _config.timeout ? "timeout of " + _config.timeout + "ms exceeded" : "timeout exceeded";
5699
+ const transitional2 = _config.transitional || transitionalDefaults;
5700
+ if (_config.timeoutErrorMessage) {
5701
+ timeoutErrorMessage = _config.timeoutErrorMessage;
5702
+ }
5703
+ reject(
5704
+ new AxiosError$1(
5705
+ timeoutErrorMessage,
5706
+ transitional2.clarifyTimeoutError ? AxiosError$1.ETIMEDOUT : AxiosError$1.ECONNABORTED,
5707
+ config,
5708
+ request
5709
+ )
5710
+ );
5711
+ request = null;
5712
+ };
5713
+ requestData === void 0 && requestHeaders.setContentType(null);
5714
+ if ("setRequestHeader" in request) {
5715
+ utils$1.forEach(requestHeaders.toJSON(), function setRequestHeader(val, key) {
5716
+ request.setRequestHeader(key, val);
5717
+ });
5718
+ }
5719
+ if (!utils$1.isUndefined(_config.withCredentials)) {
5720
+ request.withCredentials = !!_config.withCredentials;
5721
+ }
5722
+ if (responseType && responseType !== "json") {
5723
+ request.responseType = _config.responseType;
5724
+ }
5725
+ if (onDownloadProgress) {
5726
+ [downloadThrottled, flushDownload] = progressEventReducer(onDownloadProgress, true);
5727
+ request.addEventListener("progress", downloadThrottled);
5728
+ }
5729
+ if (onUploadProgress && request.upload) {
5730
+ [uploadThrottled, flushUpload] = progressEventReducer(onUploadProgress);
5731
+ request.upload.addEventListener("progress", uploadThrottled);
5732
+ request.upload.addEventListener("loadend", flushUpload);
5733
+ }
5734
+ if (_config.cancelToken || _config.signal) {
5735
+ onCanceled = (cancel) => {
5736
+ if (!request) {
5737
+ return;
5738
+ }
5739
+ reject(!cancel || cancel.type ? new CanceledError$1(null, config, request) : cancel);
5740
+ request.abort();
5741
+ request = null;
5742
+ };
5743
+ _config.cancelToken && _config.cancelToken.subscribe(onCanceled);
5744
+ if (_config.signal) {
5745
+ _config.signal.aborted ? onCanceled() : _config.signal.addEventListener("abort", onCanceled);
5746
+ }
5747
+ }
5748
+ const protocol = parseProtocol(_config.url);
5749
+ if (protocol && platform.protocols.indexOf(protocol) === -1) {
5750
+ reject(
5751
+ new AxiosError$1(
5752
+ "Unsupported protocol " + protocol + ":",
5753
+ AxiosError$1.ERR_BAD_REQUEST,
5754
+ config
5755
+ )
5756
+ );
5757
+ return;
5758
+ }
5759
+ request.send(requestData || null);
5760
+ });
5761
+ };
5762
+ const composeSignals = (signals, timeout) => {
5763
+ const { length } = signals = signals ? signals.filter(Boolean) : [];
5764
+ if (timeout || length) {
5765
+ let controller = new AbortController();
5766
+ let aborted;
5767
+ const onabort = function(reason) {
5768
+ if (!aborted) {
5769
+ aborted = true;
5770
+ unsubscribe();
5771
+ const err = reason instanceof Error ? reason : this.reason;
5772
+ controller.abort(
5773
+ err instanceof AxiosError$1 ? err : new CanceledError$1(err instanceof Error ? err.message : err)
5774
+ );
5775
+ }
5776
+ };
5777
+ let timer = timeout && setTimeout(() => {
5778
+ timer = null;
5779
+ onabort(new AxiosError$1(`timeout of ${timeout}ms exceeded`, AxiosError$1.ETIMEDOUT));
5780
+ }, timeout);
5781
+ const unsubscribe = () => {
5782
+ if (signals) {
5783
+ timer && clearTimeout(timer);
5784
+ timer = null;
5785
+ signals.forEach((signal2) => {
5786
+ signal2.unsubscribe ? signal2.unsubscribe(onabort) : signal2.removeEventListener("abort", onabort);
5787
+ });
5788
+ signals = null;
5789
+ }
5790
+ };
5791
+ signals.forEach((signal2) => signal2.addEventListener("abort", onabort));
5792
+ const { signal } = controller;
5793
+ signal.unsubscribe = () => utils$1.asap(unsubscribe);
5794
+ return signal;
5795
+ }
5796
+ };
5797
+ const streamChunk = function* (chunk, chunkSize) {
5798
+ let len = chunk.byteLength;
5799
+ if (len < chunkSize) {
5800
+ yield chunk;
5801
+ return;
5802
+ }
5803
+ let pos = 0;
5804
+ let end;
5805
+ while (pos < len) {
5806
+ end = pos + chunkSize;
5807
+ yield chunk.slice(pos, end);
5808
+ pos = end;
5809
+ }
5810
+ };
5811
+ const readBytes = function(iterable, chunkSize) {
5812
+ return __asyncGenerator(this, null, function* () {
5813
+ try {
5814
+ for (var iter = __forAwait(readStream(iterable)), more, temp, error; more = !(temp = yield new __await(iter.next())).done; more = false) {
5815
+ const chunk = temp.value;
5816
+ yield* __yieldStar(streamChunk(chunk, chunkSize));
5817
+ }
5818
+ } catch (temp) {
5819
+ error = [temp];
5820
+ } finally {
5821
+ try {
5822
+ more && (temp = iter.return) && (yield new __await(temp.call(iter)));
5823
+ } finally {
5824
+ if (error)
5825
+ throw error[0];
5826
+ }
5827
+ }
5828
+ });
5829
+ };
5830
+ const readStream = function(stream) {
5831
+ return __asyncGenerator(this, null, function* () {
5832
+ if (stream[Symbol.asyncIterator]) {
5833
+ yield* __yieldStar(stream);
5834
+ return;
5835
+ }
5836
+ const reader = stream.getReader();
5837
+ try {
5838
+ for (; ; ) {
5839
+ const { done, value } = yield new __await(reader.read());
5840
+ if (done) {
5841
+ break;
5842
+ }
5843
+ yield value;
5844
+ }
5845
+ } finally {
5846
+ yield new __await(reader.cancel());
5847
+ }
5848
+ });
5849
+ };
5850
+ const trackStream = (stream, chunkSize, onProgress, onFinish) => {
5851
+ const iterator2 = readBytes(stream, chunkSize);
5852
+ let bytes = 0;
5853
+ let done;
5854
+ let _onFinish = (e) => {
5855
+ if (!done) {
5856
+ done = true;
5857
+ onFinish && onFinish(e);
5858
+ }
5859
+ };
5860
+ return new ReadableStream(
5861
+ {
5862
+ pull(controller) {
5863
+ return __async(this, null, function* () {
5864
+ try {
5865
+ const { done: done2, value } = yield iterator2.next();
5866
+ if (done2) {
5867
+ _onFinish();
5868
+ controller.close();
5869
+ return;
5870
+ }
5871
+ let len = value.byteLength;
5872
+ if (onProgress) {
5873
+ let loadedBytes = bytes += len;
5874
+ onProgress(loadedBytes);
5875
+ }
5876
+ controller.enqueue(new Uint8Array(value));
5877
+ } catch (err) {
5878
+ _onFinish(err);
5879
+ throw err;
5880
+ }
5881
+ });
5882
+ },
5883
+ cancel(reason) {
5884
+ _onFinish(reason);
5885
+ return iterator2.return();
5886
+ }
5887
+ },
5888
+ {
5889
+ highWaterMark: 2
5890
+ }
5891
+ );
5892
+ };
5893
+ const DEFAULT_CHUNK_SIZE = 64 * 1024;
5894
+ const { isFunction } = utils$1;
5895
+ const globalFetchAPI = (({ Request, Response }) => ({
5896
+ Request,
5897
+ Response
5898
+ }))(utils$1.global);
5899
+ const { ReadableStream: ReadableStream$1, TextEncoder } = utils$1.global;
5900
+ const test = (fn, ...args) => {
5901
+ try {
5902
+ return !!fn(...args);
5903
+ } catch (e) {
5904
+ return false;
5905
+ }
5906
+ };
5907
+ const factory = (env) => {
5908
+ env = utils$1.merge.call(
5909
+ {
5910
+ skipUndefined: true
5911
+ },
5912
+ globalFetchAPI,
5913
+ env
5914
+ );
5915
+ const { fetch: envFetch, Request, Response } = env;
5916
+ const isFetchSupported = envFetch ? isFunction(envFetch) : typeof fetch === "function";
5917
+ const isRequestSupported = isFunction(Request);
5918
+ const isResponseSupported = isFunction(Response);
5919
+ if (!isFetchSupported) {
5920
+ return false;
5921
+ }
5922
+ const isReadableStreamSupported = isFetchSupported && isFunction(ReadableStream$1);
5923
+ const encodeText = isFetchSupported && (typeof TextEncoder === "function" ? /* @__PURE__ */ ((encoder) => (str) => encoder.encode(str))(new TextEncoder()) : (str) => __async(void 0, null, function* () {
5924
+ return new Uint8Array(yield new Request(str).arrayBuffer());
5925
+ }));
5926
+ const supportsRequestStream = isRequestSupported && isReadableStreamSupported && test(() => {
5927
+ let duplexAccessed = false;
5928
+ const hasContentType = new Request(platform.origin, {
5929
+ body: new ReadableStream$1(),
5930
+ method: "POST",
5931
+ get duplex() {
5932
+ duplexAccessed = true;
5933
+ return "half";
5934
+ }
5935
+ }).headers.has("Content-Type");
5936
+ return duplexAccessed && !hasContentType;
5937
+ });
5938
+ const supportsResponseStream = isResponseSupported && isReadableStreamSupported && test(() => utils$1.isReadableStream(new Response("").body));
5939
+ const resolvers = {
5940
+ stream: supportsResponseStream && ((res) => res.body)
5941
+ };
5942
+ isFetchSupported && (() => {
5943
+ ["text", "arrayBuffer", "blob", "formData", "stream"].forEach((type) => {
5944
+ !resolvers[type] && (resolvers[type] = (res, config) => {
5945
+ let method = res && res[type];
5946
+ if (method) {
5947
+ return method.call(res);
5948
+ }
5949
+ throw new AxiosError$1(
5950
+ `Response type '${type}' is not supported`,
5951
+ AxiosError$1.ERR_NOT_SUPPORT,
5952
+ config
5953
+ );
5954
+ });
5955
+ });
5956
+ })();
5957
+ const getBodyLength = (body) => __async(void 0, null, function* () {
5958
+ if (body == null) {
5959
+ return 0;
5960
+ }
5961
+ if (utils$1.isBlob(body)) {
5962
+ return body.size;
5963
+ }
5964
+ if (utils$1.isSpecCompliantForm(body)) {
5965
+ const _request = new Request(platform.origin, {
5966
+ method: "POST",
5967
+ body
5968
+ });
5969
+ return (yield _request.arrayBuffer()).byteLength;
5970
+ }
5971
+ if (utils$1.isArrayBufferView(body) || utils$1.isArrayBuffer(body)) {
5972
+ return body.byteLength;
5973
+ }
5974
+ if (utils$1.isURLSearchParams(body)) {
5975
+ body = body + "";
5976
+ }
5977
+ if (utils$1.isString(body)) {
5978
+ return (yield encodeText(body)).byteLength;
5979
+ }
5980
+ });
5981
+ const resolveBodyLength = (headers, body) => __async(void 0, null, function* () {
5982
+ const length = utils$1.toFiniteNumber(headers.getContentLength());
5983
+ return length == null ? getBodyLength(body) : length;
5984
+ });
5985
+ return (config) => __async(void 0, null, function* () {
5986
+ let {
5987
+ url,
5988
+ method,
5989
+ data,
5990
+ signal,
5991
+ cancelToken,
5992
+ timeout,
5993
+ onDownloadProgress,
5994
+ onUploadProgress,
5995
+ responseType,
5996
+ headers,
5997
+ withCredentials = "same-origin",
5998
+ fetchOptions
5999
+ } = resolveConfig(config);
6000
+ let _fetch = envFetch || fetch;
6001
+ responseType = responseType ? (responseType + "").toLowerCase() : "text";
6002
+ let composedSignal = composeSignals(
6003
+ [signal, cancelToken && cancelToken.toAbortSignal()],
6004
+ timeout
6005
+ );
6006
+ let request = null;
6007
+ const unsubscribe = composedSignal && composedSignal.unsubscribe && (() => {
6008
+ composedSignal.unsubscribe();
6009
+ });
6010
+ let requestContentLength;
6011
+ try {
6012
+ if (onUploadProgress && supportsRequestStream && method !== "get" && method !== "head" && (requestContentLength = yield resolveBodyLength(headers, data)) !== 0) {
6013
+ let _request = new Request(url, {
6014
+ method: "POST",
6015
+ body: data,
6016
+ duplex: "half"
6017
+ });
6018
+ let contentTypeHeader;
6019
+ if (utils$1.isFormData(data) && (contentTypeHeader = _request.headers.get("content-type"))) {
6020
+ headers.setContentType(contentTypeHeader);
6021
+ }
6022
+ if (_request.body) {
6023
+ const [onProgress, flush] = progressEventDecorator(
6024
+ requestContentLength,
6025
+ progressEventReducer(asyncDecorator(onUploadProgress))
6026
+ );
6027
+ data = trackStream(_request.body, DEFAULT_CHUNK_SIZE, onProgress, flush);
6028
+ }
6029
+ }
6030
+ if (!utils$1.isString(withCredentials)) {
6031
+ withCredentials = withCredentials ? "include" : "omit";
6032
+ }
6033
+ const isCredentialsSupported = isRequestSupported && "credentials" in Request.prototype;
6034
+ const resolvedOptions = __spreadProps(__spreadValues({}, fetchOptions), {
6035
+ signal: composedSignal,
6036
+ method: method.toUpperCase(),
6037
+ headers: headers.normalize().toJSON(),
6038
+ body: data,
6039
+ duplex: "half",
6040
+ credentials: isCredentialsSupported ? withCredentials : void 0
6041
+ });
6042
+ request = isRequestSupported && new Request(url, resolvedOptions);
6043
+ let response = yield isRequestSupported ? _fetch(request, fetchOptions) : _fetch(url, resolvedOptions);
6044
+ const isStreamResponse = supportsResponseStream && (responseType === "stream" || responseType === "response");
6045
+ if (supportsResponseStream && (onDownloadProgress || isStreamResponse && unsubscribe)) {
6046
+ const options = {};
6047
+ ["status", "statusText", "headers"].forEach((prop) => {
6048
+ options[prop] = response[prop];
6049
+ });
6050
+ const responseContentLength = utils$1.toFiniteNumber(response.headers.get("content-length"));
6051
+ const [onProgress, flush] = onDownloadProgress && progressEventDecorator(
6052
+ responseContentLength,
6053
+ progressEventReducer(asyncDecorator(onDownloadProgress), true)
6054
+ ) || [];
6055
+ response = new Response(
6056
+ trackStream(response.body, DEFAULT_CHUNK_SIZE, onProgress, () => {
6057
+ flush && flush();
6058
+ unsubscribe && unsubscribe();
6059
+ }),
6060
+ options
6061
+ );
6062
+ }
6063
+ responseType = responseType || "text";
6064
+ let responseData = yield resolvers[utils$1.findKey(resolvers, responseType) || "text"](
6065
+ response,
6066
+ config
6067
+ );
6068
+ !isStreamResponse && unsubscribe && unsubscribe();
6069
+ return yield new Promise((resolve, reject) => {
6070
+ settle(resolve, reject, {
6071
+ data: responseData,
6072
+ headers: AxiosHeaders$1.from(response.headers),
6073
+ status: response.status,
6074
+ statusText: response.statusText,
6075
+ config,
6076
+ request
6077
+ });
6078
+ });
6079
+ } catch (err) {
6080
+ unsubscribe && unsubscribe();
6081
+ if (err && err.name === "TypeError" && /Load failed|fetch/i.test(err.message)) {
6082
+ throw Object.assign(
6083
+ new AxiosError$1(
6084
+ "Network Error",
6085
+ AxiosError$1.ERR_NETWORK,
6086
+ config,
6087
+ request,
6088
+ err && err.response
6089
+ ),
6090
+ {
6091
+ cause: err.cause || err
6092
+ }
6093
+ );
6094
+ }
6095
+ throw AxiosError$1.from(err, err && err.code, config, request, err && err.response);
6096
+ }
6097
+ });
6098
+ };
6099
+ const seedCache = /* @__PURE__ */ new Map();
6100
+ const getFetch = (config) => {
6101
+ let env = config && config.env || {};
6102
+ const { fetch: fetch2, Request, Response } = env;
6103
+ const seeds = [Request, Response, fetch2];
6104
+ let len = seeds.length, i = len, seed, target, map = seedCache;
6105
+ while (i--) {
6106
+ seed = seeds[i];
6107
+ target = map.get(seed);
6108
+ target === void 0 && map.set(seed, target = i ? /* @__PURE__ */ new Map() : factory(env));
6109
+ map = target;
6110
+ }
6111
+ return target;
6112
+ };
6113
+ getFetch();
6114
+ const knownAdapters = {
6115
+ http: httpAdapter,
6116
+ xhr: xhrAdapter,
6117
+ fetch: {
6118
+ get: getFetch
6119
+ }
6120
+ };
6121
+ utils$1.forEach(knownAdapters, (fn, value) => {
6122
+ if (fn) {
6123
+ try {
6124
+ Object.defineProperty(fn, "name", { value });
6125
+ } catch (e) {
6126
+ }
6127
+ Object.defineProperty(fn, "adapterName", { value });
6128
+ }
6129
+ });
6130
+ const renderReason = (reason) => `- ${reason}`;
6131
+ const isResolvedHandle = (adapter) => utils$1.isFunction(adapter) || adapter === null || adapter === false;
6132
+ function getAdapter$1(adapters2, config) {
6133
+ adapters2 = utils$1.isArray(adapters2) ? adapters2 : [adapters2];
6134
+ const { length } = adapters2;
6135
+ let nameOrAdapter;
6136
+ let adapter;
6137
+ const rejectedReasons = {};
6138
+ for (let i = 0; i < length; i++) {
6139
+ nameOrAdapter = adapters2[i];
6140
+ let id;
6141
+ adapter = nameOrAdapter;
6142
+ if (!isResolvedHandle(nameOrAdapter)) {
6143
+ adapter = knownAdapters[(id = String(nameOrAdapter)).toLowerCase()];
6144
+ if (adapter === void 0) {
6145
+ throw new AxiosError$1(`Unknown adapter '${id}'`);
6146
+ }
6147
+ }
6148
+ if (adapter && (utils$1.isFunction(adapter) || (adapter = adapter.get(config)))) {
6149
+ break;
6150
+ }
6151
+ rejectedReasons[id || "#" + i] = adapter;
6152
+ }
6153
+ if (!adapter) {
6154
+ const reasons = Object.entries(rejectedReasons).map(
6155
+ ([id, state]) => `adapter ${id} ` + (state === false ? "is not supported by the environment" : "is not available in the build")
6156
+ );
6157
+ let s = length ? reasons.length > 1 ? "since :\n" + reasons.map(renderReason).join("\n") : " " + renderReason(reasons[0]) : "as no adapter specified";
6158
+ throw new AxiosError$1(
6159
+ `There is no suitable adapter to dispatch the request ` + s,
6160
+ "ERR_NOT_SUPPORT"
6161
+ );
6162
+ }
6163
+ return adapter;
6164
+ }
6165
+ const adapters = {
6166
+ /**
6167
+ * Resolve an adapter from a list of adapter names or functions.
6168
+ * @type {Function}
6169
+ */
6170
+ getAdapter: getAdapter$1,
6171
+ /**
6172
+ * Exposes all known adapters
6173
+ * @type {Object<string, Function|Object>}
6174
+ */
6175
+ adapters: knownAdapters
6176
+ };
6177
+ function throwIfCancellationRequested(config) {
6178
+ if (config.cancelToken) {
6179
+ config.cancelToken.throwIfRequested();
6180
+ }
6181
+ if (config.signal && config.signal.aborted) {
6182
+ throw new CanceledError$1(null, config);
6183
+ }
6184
+ }
6185
+ function dispatchRequest(config) {
6186
+ throwIfCancellationRequested(config);
6187
+ config.headers = AxiosHeaders$1.from(config.headers);
6188
+ config.data = transformData.call(config, config.transformRequest);
6189
+ if (["post", "put", "patch"].indexOf(config.method) !== -1) {
6190
+ config.headers.setContentType("application/x-www-form-urlencoded", false);
6191
+ }
6192
+ const adapter = adapters.getAdapter(config.adapter || defaults.adapter, config);
6193
+ return adapter(config).then(
6194
+ function onAdapterResolution(response) {
6195
+ throwIfCancellationRequested(config);
6196
+ response.data = transformData.call(config, config.transformResponse, response);
6197
+ response.headers = AxiosHeaders$1.from(response.headers);
6198
+ return response;
6199
+ },
6200
+ function onAdapterRejection(reason) {
6201
+ if (!isCancel$1(reason)) {
6202
+ throwIfCancellationRequested(config);
6203
+ if (reason && reason.response) {
6204
+ reason.response.data = transformData.call(
6205
+ config,
6206
+ config.transformResponse,
6207
+ reason.response
6208
+ );
6209
+ reason.response.headers = AxiosHeaders$1.from(reason.response.headers);
6210
+ }
6211
+ }
6212
+ return Promise.reject(reason);
6213
+ }
6214
+ );
6215
+ }
6216
+ const VERSION$1 = "1.13.6";
6217
+ const validators$1 = {};
6218
+ ["object", "boolean", "number", "function", "string", "symbol"].forEach((type, i) => {
6219
+ validators$1[type] = function validator2(thing) {
6220
+ return typeof thing === type || "a" + (i < 1 ? "n " : " ") + type;
6221
+ };
6222
+ });
6223
+ const deprecatedWarnings = {};
6224
+ validators$1.transitional = function transitional(validator2, version, message) {
6225
+ function formatMessage(opt, desc) {
6226
+ return "[Axios v" + VERSION$1 + "] Transitional option '" + opt + "'" + desc + (message ? ". " + message : "");
6227
+ }
6228
+ return (value, opt, opts) => {
6229
+ if (validator2 === false) {
6230
+ throw new AxiosError$1(
6231
+ formatMessage(opt, " has been removed" + (version ? " in " + version : "")),
6232
+ AxiosError$1.ERR_DEPRECATED
6233
+ );
6234
+ }
6235
+ if (version && !deprecatedWarnings[opt]) {
6236
+ deprecatedWarnings[opt] = true;
6237
+ console.warn(
6238
+ formatMessage(
6239
+ opt,
6240
+ " has been deprecated since v" + version + " and will be removed in the near future"
6241
+ )
6242
+ );
6243
+ }
6244
+ return validator2 ? validator2(value, opt, opts) : true;
6245
+ };
6246
+ };
6247
+ validators$1.spelling = function spelling(correctSpelling) {
6248
+ return (value, opt) => {
6249
+ console.warn(`${opt} is likely a misspelling of ${correctSpelling}`);
6250
+ return true;
6251
+ };
6252
+ };
6253
+ function assertOptions(options, schema, allowUnknown) {
6254
+ if (typeof options !== "object") {
6255
+ throw new AxiosError$1("options must be an object", AxiosError$1.ERR_BAD_OPTION_VALUE);
6256
+ }
6257
+ const keys = Object.keys(options);
6258
+ let i = keys.length;
6259
+ while (i-- > 0) {
6260
+ const opt = keys[i];
6261
+ const validator2 = schema[opt];
6262
+ if (validator2) {
6263
+ const value = options[opt];
6264
+ const result = value === void 0 || validator2(value, opt, options);
6265
+ if (result !== true) {
6266
+ throw new AxiosError$1(
6267
+ "option " + opt + " must be " + result,
6268
+ AxiosError$1.ERR_BAD_OPTION_VALUE
6269
+ );
6270
+ }
6271
+ continue;
6272
+ }
6273
+ if (allowUnknown !== true) {
6274
+ throw new AxiosError$1("Unknown option " + opt, AxiosError$1.ERR_BAD_OPTION);
6275
+ }
6276
+ }
6277
+ }
6278
+ const validator = {
6279
+ assertOptions,
6280
+ validators: validators$1
6281
+ };
6282
+ const validators = validator.validators;
6283
+ let Axios$1 = class Axios {
6284
+ constructor(instanceConfig) {
6285
+ this.defaults = instanceConfig || {};
6286
+ this.interceptors = {
6287
+ request: new InterceptorManager(),
6288
+ response: new InterceptorManager()
6289
+ };
6290
+ }
6291
+ /**
6292
+ * Dispatch a request
6293
+ *
6294
+ * @param {String|Object} configOrUrl The config specific for this request (merged with this.defaults)
6295
+ * @param {?Object} config
6296
+ *
6297
+ * @returns {Promise} The Promise to be fulfilled
6298
+ */
6299
+ request(configOrUrl, config) {
6300
+ return __async(this, null, function* () {
6301
+ try {
6302
+ return yield this._request(configOrUrl, config);
6303
+ } catch (err) {
6304
+ if (err instanceof Error) {
6305
+ let dummy = {};
6306
+ Error.captureStackTrace ? Error.captureStackTrace(dummy) : dummy = new Error();
6307
+ const stack = dummy.stack ? dummy.stack.replace(/^.+\n/, "") : "";
6308
+ try {
6309
+ if (!err.stack) {
6310
+ err.stack = stack;
6311
+ } else if (stack && !String(err.stack).endsWith(stack.replace(/^.+\n.+\n/, ""))) {
6312
+ err.stack += "\n" + stack;
6313
+ }
6314
+ } catch (e) {
6315
+ }
6316
+ }
6317
+ throw err;
6318
+ }
6319
+ });
6320
+ }
6321
+ _request(configOrUrl, config) {
6322
+ if (typeof configOrUrl === "string") {
6323
+ config = config || {};
6324
+ config.url = configOrUrl;
6325
+ } else {
6326
+ config = configOrUrl || {};
6327
+ }
6328
+ config = mergeConfig$1(this.defaults, config);
6329
+ const { transitional: transitional2, paramsSerializer, headers } = config;
6330
+ if (transitional2 !== void 0) {
6331
+ validator.assertOptions(
6332
+ transitional2,
6333
+ {
6334
+ silentJSONParsing: validators.transitional(validators.boolean),
6335
+ forcedJSONParsing: validators.transitional(validators.boolean),
6336
+ clarifyTimeoutError: validators.transitional(validators.boolean),
6337
+ legacyInterceptorReqResOrdering: validators.transitional(validators.boolean)
6338
+ },
6339
+ false
6340
+ );
6341
+ }
6342
+ if (paramsSerializer != null) {
6343
+ if (utils$1.isFunction(paramsSerializer)) {
6344
+ config.paramsSerializer = {
6345
+ serialize: paramsSerializer
6346
+ };
6347
+ } else {
6348
+ validator.assertOptions(
6349
+ paramsSerializer,
6350
+ {
6351
+ encode: validators.function,
6352
+ serialize: validators.function
6353
+ },
6354
+ true
6355
+ );
6356
+ }
6357
+ }
6358
+ if (config.allowAbsoluteUrls !== void 0) ;
6359
+ else if (this.defaults.allowAbsoluteUrls !== void 0) {
6360
+ config.allowAbsoluteUrls = this.defaults.allowAbsoluteUrls;
6361
+ } else {
6362
+ config.allowAbsoluteUrls = true;
6363
+ }
6364
+ validator.assertOptions(
6365
+ config,
6366
+ {
6367
+ baseUrl: validators.spelling("baseURL"),
6368
+ withXsrfToken: validators.spelling("withXSRFToken")
6369
+ },
6370
+ true
6371
+ );
6372
+ config.method = (config.method || this.defaults.method || "get").toLowerCase();
6373
+ let contextHeaders = headers && utils$1.merge(headers.common, headers[config.method]);
6374
+ headers && utils$1.forEach(["delete", "get", "head", "post", "put", "patch", "common"], (method) => {
6375
+ delete headers[method];
6376
+ });
6377
+ config.headers = AxiosHeaders$1.concat(contextHeaders, headers);
6378
+ const requestInterceptorChain = [];
6379
+ let synchronousRequestInterceptors = true;
6380
+ this.interceptors.request.forEach(function unshiftRequestInterceptors(interceptor) {
6381
+ if (typeof interceptor.runWhen === "function" && interceptor.runWhen(config) === false) {
6382
+ return;
6383
+ }
6384
+ synchronousRequestInterceptors = synchronousRequestInterceptors && interceptor.synchronous;
6385
+ const transitional3 = config.transitional || transitionalDefaults;
6386
+ const legacyInterceptorReqResOrdering = transitional3 && transitional3.legacyInterceptorReqResOrdering;
6387
+ if (legacyInterceptorReqResOrdering) {
6388
+ requestInterceptorChain.unshift(interceptor.fulfilled, interceptor.rejected);
6389
+ } else {
6390
+ requestInterceptorChain.push(interceptor.fulfilled, interceptor.rejected);
6391
+ }
6392
+ });
6393
+ const responseInterceptorChain = [];
6394
+ this.interceptors.response.forEach(function pushResponseInterceptors(interceptor) {
6395
+ responseInterceptorChain.push(interceptor.fulfilled, interceptor.rejected);
6396
+ });
6397
+ let promise;
6398
+ let i = 0;
6399
+ let len;
6400
+ if (!synchronousRequestInterceptors) {
6401
+ const chain = [dispatchRequest.bind(this), void 0];
6402
+ chain.unshift(...requestInterceptorChain);
6403
+ chain.push(...responseInterceptorChain);
6404
+ len = chain.length;
6405
+ promise = Promise.resolve(config);
6406
+ while (i < len) {
6407
+ promise = promise.then(chain[i++], chain[i++]);
6408
+ }
6409
+ return promise;
6410
+ }
6411
+ len = requestInterceptorChain.length;
6412
+ let newConfig = config;
6413
+ while (i < len) {
6414
+ const onFulfilled = requestInterceptorChain[i++];
6415
+ const onRejected = requestInterceptorChain[i++];
6416
+ try {
6417
+ newConfig = onFulfilled(newConfig);
6418
+ } catch (error) {
6419
+ onRejected.call(this, error);
6420
+ break;
6421
+ }
6422
+ }
6423
+ try {
6424
+ promise = dispatchRequest.call(this, newConfig);
6425
+ } catch (error) {
6426
+ return Promise.reject(error);
6427
+ }
6428
+ i = 0;
6429
+ len = responseInterceptorChain.length;
6430
+ while (i < len) {
6431
+ promise = promise.then(responseInterceptorChain[i++], responseInterceptorChain[i++]);
6432
+ }
6433
+ return promise;
6434
+ }
6435
+ getUri(config) {
6436
+ config = mergeConfig$1(this.defaults, config);
6437
+ const fullPath = buildFullPath(config.baseURL, config.url, config.allowAbsoluteUrls);
6438
+ return buildURL(fullPath, config.params, config.paramsSerializer);
6439
+ }
6440
+ };
6441
+ utils$1.forEach(["delete", "get", "head", "options"], function forEachMethodNoData(method) {
6442
+ Axios$1.prototype[method] = function(url, config) {
6443
+ return this.request(
6444
+ mergeConfig$1(config || {}, {
6445
+ method,
6446
+ url,
6447
+ data: (config || {}).data
6448
+ })
6449
+ );
6450
+ };
6451
+ });
6452
+ utils$1.forEach(["post", "put", "patch"], function forEachMethodWithData(method) {
6453
+ function generateHTTPMethod(isForm) {
6454
+ return function httpMethod(url, data, config) {
6455
+ return this.request(
6456
+ mergeConfig$1(config || {}, {
6457
+ method,
6458
+ headers: isForm ? {
6459
+ "Content-Type": "multipart/form-data"
6460
+ } : {},
6461
+ url,
6462
+ data
6463
+ })
6464
+ );
6465
+ };
6466
+ }
6467
+ Axios$1.prototype[method] = generateHTTPMethod();
6468
+ Axios$1.prototype[method + "Form"] = generateHTTPMethod(true);
6469
+ });
6470
+ let CancelToken$1 = class CancelToken {
6471
+ constructor(executor) {
6472
+ if (typeof executor !== "function") {
6473
+ throw new TypeError("executor must be a function.");
6474
+ }
6475
+ let resolvePromise;
6476
+ this.promise = new Promise(function promiseExecutor(resolve) {
6477
+ resolvePromise = resolve;
6478
+ });
6479
+ const token = this;
6480
+ this.promise.then((cancel) => {
6481
+ if (!token._listeners) return;
6482
+ let i = token._listeners.length;
6483
+ while (i-- > 0) {
6484
+ token._listeners[i](cancel);
6485
+ }
6486
+ token._listeners = null;
6487
+ });
6488
+ this.promise.then = (onfulfilled) => {
6489
+ let _resolve;
6490
+ const promise = new Promise((resolve) => {
6491
+ token.subscribe(resolve);
6492
+ _resolve = resolve;
6493
+ }).then(onfulfilled);
6494
+ promise.cancel = function reject() {
6495
+ token.unsubscribe(_resolve);
6496
+ };
6497
+ return promise;
6498
+ };
6499
+ executor(function cancel(message, config, request) {
6500
+ if (token.reason) {
6501
+ return;
6502
+ }
6503
+ token.reason = new CanceledError$1(message, config, request);
6504
+ resolvePromise(token.reason);
6505
+ });
6506
+ }
6507
+ /**
6508
+ * Throws a `CanceledError` if cancellation has been requested.
6509
+ */
6510
+ throwIfRequested() {
6511
+ if (this.reason) {
6512
+ throw this.reason;
6513
+ }
6514
+ }
6515
+ /**
6516
+ * Subscribe to the cancel signal
6517
+ */
6518
+ subscribe(listener) {
6519
+ if (this.reason) {
6520
+ listener(this.reason);
6521
+ return;
6522
+ }
6523
+ if (this._listeners) {
6524
+ this._listeners.push(listener);
6525
+ } else {
6526
+ this._listeners = [listener];
6527
+ }
6528
+ }
6529
+ /**
6530
+ * Unsubscribe from the cancel signal
6531
+ */
6532
+ unsubscribe(listener) {
6533
+ if (!this._listeners) {
6534
+ return;
6535
+ }
6536
+ const index = this._listeners.indexOf(listener);
6537
+ if (index !== -1) {
6538
+ this._listeners.splice(index, 1);
6539
+ }
6540
+ }
6541
+ toAbortSignal() {
6542
+ const controller = new AbortController();
6543
+ const abort = (err) => {
6544
+ controller.abort(err);
6545
+ };
6546
+ this.subscribe(abort);
6547
+ controller.signal.unsubscribe = () => this.unsubscribe(abort);
6548
+ return controller.signal;
6549
+ }
6550
+ /**
6551
+ * Returns an object that contains a new `CancelToken` and a function that, when called,
6552
+ * cancels the `CancelToken`.
6553
+ */
6554
+ static source() {
6555
+ let cancel;
6556
+ const token = new CancelToken(function executor(c) {
6557
+ cancel = c;
6558
+ });
6559
+ return {
6560
+ token,
6561
+ cancel
6562
+ };
6563
+ }
6564
+ };
6565
+ function spread$1(callback) {
6566
+ return function wrap(arr) {
6567
+ return callback.apply(null, arr);
6568
+ };
6569
+ }
6570
+ function isAxiosError$1(payload) {
6571
+ return utils$1.isObject(payload) && payload.isAxiosError === true;
6572
+ }
6573
+ const HttpStatusCode$1 = {
6574
+ Continue: 100,
6575
+ SwitchingProtocols: 101,
6576
+ Processing: 102,
6577
+ EarlyHints: 103,
6578
+ Ok: 200,
6579
+ Created: 201,
6580
+ Accepted: 202,
6581
+ NonAuthoritativeInformation: 203,
6582
+ NoContent: 204,
6583
+ ResetContent: 205,
6584
+ PartialContent: 206,
6585
+ MultiStatus: 207,
6586
+ AlreadyReported: 208,
6587
+ ImUsed: 226,
6588
+ MultipleChoices: 300,
6589
+ MovedPermanently: 301,
6590
+ Found: 302,
6591
+ SeeOther: 303,
6592
+ NotModified: 304,
6593
+ UseProxy: 305,
6594
+ Unused: 306,
6595
+ TemporaryRedirect: 307,
6596
+ PermanentRedirect: 308,
6597
+ BadRequest: 400,
6598
+ Unauthorized: 401,
6599
+ PaymentRequired: 402,
6600
+ Forbidden: 403,
6601
+ NotFound: 404,
6602
+ MethodNotAllowed: 405,
6603
+ NotAcceptable: 406,
6604
+ ProxyAuthenticationRequired: 407,
6605
+ RequestTimeout: 408,
6606
+ Conflict: 409,
6607
+ Gone: 410,
6608
+ LengthRequired: 411,
6609
+ PreconditionFailed: 412,
6610
+ PayloadTooLarge: 413,
6611
+ UriTooLong: 414,
6612
+ UnsupportedMediaType: 415,
6613
+ RangeNotSatisfiable: 416,
6614
+ ExpectationFailed: 417,
6615
+ ImATeapot: 418,
6616
+ MisdirectedRequest: 421,
6617
+ UnprocessableEntity: 422,
6618
+ Locked: 423,
6619
+ FailedDependency: 424,
6620
+ TooEarly: 425,
6621
+ UpgradeRequired: 426,
6622
+ PreconditionRequired: 428,
6623
+ TooManyRequests: 429,
6624
+ RequestHeaderFieldsTooLarge: 431,
6625
+ UnavailableForLegalReasons: 451,
6626
+ InternalServerError: 500,
6627
+ NotImplemented: 501,
6628
+ BadGateway: 502,
6629
+ ServiceUnavailable: 503,
6630
+ GatewayTimeout: 504,
6631
+ HttpVersionNotSupported: 505,
6632
+ VariantAlsoNegotiates: 506,
6633
+ InsufficientStorage: 507,
6634
+ LoopDetected: 508,
6635
+ NotExtended: 510,
6636
+ NetworkAuthenticationRequired: 511,
6637
+ WebServerIsDown: 521,
6638
+ ConnectionTimedOut: 522,
6639
+ OriginIsUnreachable: 523,
6640
+ TimeoutOccurred: 524,
6641
+ SslHandshakeFailed: 525,
6642
+ InvalidSslCertificate: 526
6643
+ };
6644
+ Object.entries(HttpStatusCode$1).forEach(([key, value]) => {
6645
+ HttpStatusCode$1[value] = key;
6646
+ });
6647
+ function createInstance(defaultConfig) {
6648
+ const context = new Axios$1(defaultConfig);
6649
+ const instance = bind(Axios$1.prototype.request, context);
6650
+ utils$1.extend(instance, Axios$1.prototype, context, { allOwnKeys: true });
6651
+ utils$1.extend(instance, context, null, { allOwnKeys: true });
6652
+ instance.create = function create(instanceConfig) {
6653
+ return createInstance(mergeConfig$1(defaultConfig, instanceConfig));
6654
+ };
6655
+ return instance;
6656
+ }
6657
+ const axios = createInstance(defaults);
6658
+ axios.Axios = Axios$1;
6659
+ axios.CanceledError = CanceledError$1;
6660
+ axios.CancelToken = CancelToken$1;
6661
+ axios.isCancel = isCancel$1;
6662
+ axios.VERSION = VERSION$1;
6663
+ axios.toFormData = toFormData$1;
6664
+ axios.AxiosError = AxiosError$1;
6665
+ axios.Cancel = axios.CanceledError;
6666
+ axios.all = function all(promises) {
6667
+ return Promise.all(promises);
6668
+ };
6669
+ axios.spread = spread$1;
6670
+ axios.isAxiosError = isAxiosError$1;
6671
+ axios.mergeConfig = mergeConfig$1;
6672
+ axios.AxiosHeaders = AxiosHeaders$1;
6673
+ axios.formToJSON = (thing) => formDataToJSON(utils$1.isHTMLForm(thing) ? new FormData(thing) : thing);
6674
+ axios.getAdapter = adapters.getAdapter;
6675
+ axios.HttpStatusCode = HttpStatusCode$1;
6676
+ axios.default = axios;
6677
+ const {
6678
+ Axios: Axios2,
6679
+ AxiosError: AxiosError2,
6680
+ CanceledError: CanceledError2,
6681
+ isCancel,
6682
+ CancelToken: CancelToken2,
6683
+ VERSION,
6684
+ all: all2,
6685
+ Cancel,
6686
+ isAxiosError,
6687
+ spread,
6688
+ toFormData,
6689
+ AxiosHeaders: AxiosHeaders2,
6690
+ HttpStatusCode,
6691
+ formToJSON,
6692
+ getAdapter,
6693
+ mergeConfig
6694
+ } = axios;
6695
+ const axiosApi = axios.create({
6696
+ baseURL: getBaseUrl(),
6697
+ withCredentials: true,
6698
+ headers: {
6699
+ Accept: "application/json, text/plain, */*",
6700
+ "Content-Type": "application/x-www-form-urlencoded;charset=UTF-8",
6701
+ "Access-Control-Allow-Origin": "*"
6702
+ }
6703
+ });
6704
+ axiosApi.interceptors.request.use((config) => __async(void 0, null, function* () {
6705
+ try {
6706
+ config.baseURL = getBaseUrl();
6707
+ } catch (e) {
6708
+ console.error("Axios request error:", e);
6709
+ }
6710
+ return config;
6711
+ }));
6712
+ axiosApi.interceptors.response.use(
6713
+ (response) => {
6714
+ const responseData = response == null ? void 0 : response.data;
6715
+ const dataError = responseData == null ? void 0 : responseData.error;
6716
+ if (dataError && (dataError == null ? void 0 : dataError.code) && dataError.code == 808) {
6717
+ console.error("Password expired!");
6718
+ }
6719
+ return response == null ? void 0 : response.data;
6720
+ },
6721
+ (error) => {
6722
+ const serverResponse = error == null ? void 0 : error.response;
6723
+ const errorStatus = serverResponse == null ? void 0 : serverResponse.status;
6724
+ const responseData = serverResponse == null ? void 0 : serverResponse.data;
6725
+ if (errorStatus === 401) {
6726
+ console.error("Authentication failed!");
6727
+ }
6728
+ switch (errorStatus) {
6729
+ case 404:
6730
+ if (!(responseData == null ? void 0 : responseData.success)) {
6731
+ const message = (responseData == null ? void 0 : responseData.msg) || "Not Found";
6732
+ console.error("Axios 404: ", message);
6733
+ }
6734
+ break;
6735
+ case 401:
6736
+ if (!(responseData == null ? void 0 : responseData.success)) {
6737
+ const message = (responseData == null ? void 0 : responseData.detail) || (responseData == null ? void 0 : responseData.msg);
6738
+ console.error("Axios 401: ", message);
6739
+ }
6740
+ break;
6741
+ case 505:
6742
+ if (!(responseData == null ? void 0 : responseData.success)) {
6743
+ const message = (responseData == null ? void 0 : responseData.error) || "";
6744
+ console.error("Axios 505: ", message);
6745
+ }
6746
+ return responseData;
6747
+ case 0:
6748
+ console.error("Axios sever error!");
6749
+ break;
6750
+ }
6751
+ if (typeof errorStatus === "undefined") {
6752
+ console.error("Unexpected Error");
6753
+ }
6754
+ console.log(error);
6755
+ return Promise.reject(error);
6756
+ }
6757
+ );
6758
+ class SettingPopper extends React.Component {
6759
+ constructor(props) {
6760
+ super(props);
6761
+ __publicField(this, "containerRef");
6762
+ __publicField(this, "popperRef");
6763
+ __publicField(this, "getLanguageOptions", () => __async(this, null, function* () {
6764
+ var _a2;
6765
+ const res = yield axiosApi.get("/email/ai/langlist");
6766
+ if (res == null ? void 0 : res.list) {
6767
+ const langs = (_a2 = Object.keys(res == null ? void 0 : res.list)) == null ? void 0 : _a2.map((_key, i) => {
6768
+ var _a3;
6769
+ const _item = (_a3 = res == null ? void 0 : res.list) == null ? void 0 : _a3[_key];
6770
+ return {
6771
+ value: _key,
6772
+ label: _item == null ? void 0 : _item.name
6773
+ };
6774
+ });
6775
+ this.setState({ languageOptions: langs });
6776
+ }
6777
+ }));
6778
+ __publicField(this, "handleClickOutside", (event) => {
6779
+ const target = event.target;
6780
+ if (this.containerRef.current && !this.containerRef.current.contains(target) && (!this.popperRef.current || !this.popperRef.current.contains(target))) {
6781
+ this.setState({ open: false });
6782
+ }
6783
+ });
6784
+ __publicField(this, "togglePopper", () => {
6785
+ this.setState((prevState) => ({ open: !prevState.open }));
6786
+ });
6787
+ __publicField(this, "handleLangChange", (e) => {
6788
+ const selected = this.state.languageOptions.find(
6789
+ (opt) => opt.value === e.target.value
6790
+ );
6791
+ this.props.setLang(selected || null);
6792
+ });
6793
+ this.state = { open: false, languageOptions: [] };
6794
+ this.containerRef = React.createRef();
6795
+ this.popperRef = React.createRef();
6796
+ this.getLanguageOptions();
6797
+ }
6798
+ componentDidMount() {
6799
+ document.addEventListener("mousedown", this.handleClickOutside);
6800
+ }
6801
+ componentWillUnmount() {
6802
+ document.removeEventListener("mousedown", this.handleClickOutside);
6803
+ }
6804
+ render() {
6805
+ const {
6806
+ lang,
6807
+ originalEmail,
6808
+ setOriginalEmail,
6809
+ getEditorContent,
6810
+ parentRef
6811
+ } = this.props;
6812
+ const { open, languageOptions } = this.state;
6813
+ let popperTop = 0;
6814
+ let popperLeft = 0;
6815
+ let popperWidth = 320;
6816
+ if (open && this.containerRef.current) {
6817
+ const rect = this.containerRef.current.getBoundingClientRect();
6818
+ popperTop = rect.top + (window.scrollY || document.documentElement.scrollTop) - 8;
6819
+ popperLeft = rect.left + (window.scrollX || document.documentElement.scrollLeft);
6820
+ if (parentRef && parentRef.current) {
6821
+ const parentRect = parentRef.current.getBoundingClientRect();
6822
+ popperWidth = parentRect.width - 16;
6823
+ popperLeft = parentRect.left + 8;
6824
+ }
6825
+ }
6826
+ return /* @__PURE__ */ React.createElement(
6827
+ "div",
6828
+ {
6829
+ ref: this.containerRef,
6830
+ style: { position: "relative", display: "inline-block" }
6831
+ },
6832
+ /* @__PURE__ */ React.createElement(
6833
+ "button",
6834
+ {
6835
+ type: "button",
6836
+ onClick: this.togglePopper,
6837
+ className: "icon-button small"
6838
+ },
6839
+ /* @__PURE__ */ React.createElement(Settings, { size: 16 })
6840
+ ),
6841
+ open && this.containerRef.current && ReactDOM.createPortal(
6842
+ /* @__PURE__ */ React.createElement(
6843
+ "div",
6844
+ {
6845
+ ref: this.popperRef,
6846
+ style: {
6847
+ position: "absolute",
6848
+ top: popperTop,
6849
+ left: popperLeft,
6850
+ transform: "translateY(-100%)",
6851
+ zIndex: 1051,
6852
+ background: "#fff",
6853
+ border: "1px solid #ddd",
6854
+ boxShadow: "0px 4px 12px rgba(0, 0, 0, 0.1)",
4094
6855
  borderRadius: 8,
4095
6856
  padding: 16,
4096
6857
  width: popperWidth,
@@ -4121,17 +6882,14 @@ class SettingPopper extends React.Component {
4121
6882
  /* @__PURE__ */ React.createElement(
4122
6883
  "select",
4123
6884
  {
6885
+ name: "language",
4124
6886
  value: lang ? lang.value : "",
4125
- onChange: this.handleLangChange,
4126
- style: {
4127
- padding: "7px 8px",
4128
- borderRadius: 4,
4129
- border: "1px solid #ccc",
4130
- fontSize: 14
4131
- }
6887
+ onChange: this.handleLangChange
4132
6888
  },
4133
6889
  /* @__PURE__ */ React.createElement("option", { value: "", disabled: true }, "Select Language"),
4134
- LANG_OPTIONS.map((opt) => /* @__PURE__ */ React.createElement("option", { key: opt.value, value: opt.value }, opt.label))
6890
+ languageOptions.map((opt) => {
6891
+ return /* @__PURE__ */ React.createElement("option", { key: opt.value, value: opt.value }, opt.label);
6892
+ })
4135
6893
  )
4136
6894
  ),
4137
6895
  /* @__PURE__ */ React.createElement(
@@ -4189,6 +6947,102 @@ class SettingPopper extends React.Component {
4189
6947
  );
4190
6948
  }
4191
6949
  }
6950
+ const AI_LANG_FLAGS = [
6951
+ {
6952
+ label: "English",
6953
+ value: "en",
6954
+ flagCode: "us"
6955
+ },
6956
+ {
6957
+ label: "Korean",
6958
+ value: "ko",
6959
+ flagCode: "kr"
6960
+ },
6961
+ {
6962
+ label: "Vietnamese",
6963
+ value: "vi",
6964
+ flagCode: "vn"
6965
+ },
6966
+ {
6967
+ label: "Indonesian",
6968
+ value: "id",
6969
+ flagCode: "id"
6970
+ },
6971
+ {
6972
+ label: "Chinese-Traditional",
6973
+ value: "zh-cht",
6974
+ flagCode: "cn"
6975
+ },
6976
+ {
6977
+ label: "Chinese-Simplified",
6978
+ value: "zh-chs",
6979
+ flagCode: "cn"
6980
+ }
6981
+ ];
6982
+ const CNFlag = (props) => /* @__PURE__ */ React.createElement("svg", __spreadValues({ viewBox: "0 0 30 20" }, props), /* @__PURE__ */ React.createElement("rect", { fill: "#de2110", width: "30", height: "20" }), /* @__PURE__ */ React.createElement(
6983
+ "path",
6984
+ {
6985
+ fill: "#ffde00",
6986
+ d: "m6 2-1 3.2h3.2l-2.6-2 1 3.2-1.6-1.2-1.6 1.2 1-3.2-2.6 2h3.2l-1-3.2zm4-1 0.4 1.3 1.3 0.1-1.1 0.8 0.4 1.3L10 3.7l-1 0.8 0.4-1.3-1.1-0.8 1.3-0.1 0.4-1.3zm2.5 2.1 0.7 1.2 1.3-0.3-0.7 1.2 0.7 1.2-1.3-0.3-0.7 1.2v-1.4l-1.3-0.3 1.3-0.3v-1.4zm0 4.1-1.3 0.3 1.3 0.3v1.4l0.7-1.2 1.3 0.3-0.7-1.2 0.7-1.2-1.3 0.3-0.7-1.2v1.4zm-2.5 1.7-0.4 1.3-1.3 0.1 1.1 0.8-0.4 1.3 1.1-0.8 1.1 0.8-0.4-1.3 1.1-0.8-1.3-0.1-0.4-1.3z"
6987
+ }
6988
+ ));
6989
+ const IDFlag = (props) => /* @__PURE__ */ React.createElement("svg", __spreadValues({ viewBox: "0 0 3 2" }, props), /* @__PURE__ */ React.createElement("rect", { fill: "#fff", width: "3", height: "2" }), /* @__PURE__ */ React.createElement("rect", { fill: "#ce1126", width: "3", height: "1" }));
6990
+ const KRFlag = (props) => /* @__PURE__ */ React.createElement(
6991
+ "svg",
6992
+ __spreadValues({
6993
+ xmlns: "http://www.w3.org/2000/svg",
6994
+ xmlnsXlink: "http://www.w3.org/1999/xlink",
6995
+ viewBox: "-36 -24 72 48"
6996
+ }, props),
6997
+ /* @__PURE__ */ React.createElement("path", { fill: "#fff", d: "M-36-24h72v48h-72z" }),
6998
+ /* @__PURE__ */ React.createElement("g", { transform: "rotate(-56.31)" }, /* @__PURE__ */ React.createElement("g", { id: "b" }, /* @__PURE__ */ React.createElement(
6999
+ "path",
7000
+ {
7001
+ id: "a",
7002
+ d: "M-6-25H6m-12 3H6m-12 3H6",
7003
+ stroke: "#000",
7004
+ "stroke-width": "2"
7005
+ }
7006
+ ), /* @__PURE__ */ React.createElement("use", { xlinkHref: "#a", y: "44" })), /* @__PURE__ */ React.createElement("path", { stroke: "#fff", d: "M0 17v10" }), /* @__PURE__ */ React.createElement("circle", { fill: "#cd2e3a", r: "12" }), /* @__PURE__ */ React.createElement("path", { fill: "#0047a0", d: "M0-12A6 6 0 000 0a6 6 0 010 12 12 12 0 010-24z" })),
7007
+ /* @__PURE__ */ React.createElement("g", { transform: "rotate(-123.69)" }, /* @__PURE__ */ React.createElement("use", { xlinkHref: "#b" }), /* @__PURE__ */ React.createElement("path", { stroke: "#fff", d: "M0-23.5v3M0 17v3.5m0 3v3" }))
7008
+ );
7009
+ const USFlag = (props) => /* @__PURE__ */ React.createElement("svg", __spreadValues({ viewBox: "0 0 7410 3900" }, props), /* @__PURE__ */ React.createElement("rect", { width: "7410", height: "3900", fill: "#b22234" }), /* @__PURE__ */ React.createElement(
7010
+ "path",
7011
+ {
7012
+ d: "M0,450H7410m0,600H0m0,600H7410m0,600H0m0,600H7410m0,600H0",
7013
+ stroke: "#fff",
7014
+ strokeWidth: "300"
7015
+ }
7016
+ ), /* @__PURE__ */ React.createElement("rect", { width: "2964", height: "2100", fill: "#3c3b6e" }), /* @__PURE__ */ React.createElement("g", { fill: "#fff" }, /* @__PURE__ */ React.createElement("g", { id: "us_s18" }, /* @__PURE__ */ React.createElement("g", { id: "us_s9" }, /* @__PURE__ */ React.createElement("g", { id: "us_s5" }, /* @__PURE__ */ React.createElement("g", { id: "us_s4" }, /* @__PURE__ */ React.createElement(
7017
+ "path",
7018
+ {
7019
+ id: "us_s",
7020
+ d: "M247,90 317.534230,307.082039 132.873218,172.917961H361.126782L176.465770,307.082039z"
7021
+ }
7022
+ ), /* @__PURE__ */ React.createElement("use", { xlinkHref: "#us_s", y: "420" }), /* @__PURE__ */ React.createElement("use", { xlinkHref: "#us_s", y: "840" }), /* @__PURE__ */ React.createElement("use", { xlinkHref: "#us_s", y: "1260" })), /* @__PURE__ */ React.createElement("use", { xlinkHref: "#us_s", y: "1680" })), /* @__PURE__ */ React.createElement("use", { xlinkHref: "#us_s4", x: "247", y: "210" })), /* @__PURE__ */ React.createElement("use", { xlinkHref: "#us_s9", x: "494" })), /* @__PURE__ */ React.createElement("use", { xlinkHref: "#us_s18", x: "988" }), /* @__PURE__ */ React.createElement("use", { xlinkHref: "#us_s9", x: "1976" }), /* @__PURE__ */ React.createElement("use", { xlinkHref: "#us_s5", x: "2470" })));
7023
+ const VNFlag = (props) => /* @__PURE__ */ React.createElement("svg", __spreadValues({ viewBox: "-15 -10 30 20" }, props), /* @__PURE__ */ React.createElement("rect", { fill: "#DA251d", x: "-20", y: "-15", width: "40", height: "30" }), /* @__PURE__ */ React.createElement("g", { id: "vn_g", transform: "translate(0,-6)" }, /* @__PURE__ */ React.createElement(
7024
+ "polyline",
7025
+ {
7026
+ id: "vn_g1",
7027
+ fill: "#FF0",
7028
+ points: "0,0 0,6 4,6",
7029
+ transform: "rotate(18)"
7030
+ }
7031
+ ), /* @__PURE__ */ React.createElement("use", { xlinkHref: "#vn_g1", transform: "scale(-1,1)" })), /* @__PURE__ */ React.createElement("g", { id: "vn_g2", transform: "rotate(72)" }, /* @__PURE__ */ React.createElement("use", { xlinkHref: "#vn_g" }), /* @__PURE__ */ React.createElement("use", { xlinkHref: "#vn_g", transform: "rotate(72)" })), /* @__PURE__ */ React.createElement("use", { xlinkHref: "#vn_g2", transform: "scale(-1,1)" }));
7032
+ const FlagMap = {
7033
+ cn: CNFlag,
7034
+ id: IDFlag,
7035
+ kr: KRFlag,
7036
+ us: USFlag,
7037
+ vn: VNFlag
7038
+ };
7039
+ const CountryFlag = (props) => {
7040
+ const _a2 = props, { flagCode, style } = _a2, rest = __objRest(_a2, ["flagCode", "style"]);
7041
+ if (!flagCode) return null;
7042
+ const FlagComponent = FlagMap[flagCode];
7043
+ if (!FlagComponent) return null;
7044
+ return /* @__PURE__ */ React.createElement(FlagComponent, __spreadValues({ style }, rest));
7045
+ };
4192
7046
  class ChatAIDraft extends React.Component {
4193
7047
  constructor(props) {
4194
7048
  super(props);
@@ -4270,18 +7124,23 @@ class ChatAIDraft extends React.Component {
4270
7124
  this.setState({ originalEmail: email });
4271
7125
  });
4272
7126
  this.rootRef = React.createRef();
7127
+ const lang = (AI_LANG_FLAGS == null ? void 0 : AI_LANG_FLAGS.find((_item) => (_item == null ? void 0 : _item.value) === (props == null ? void 0 : props.defaultLang))) || AI_LANG_FLAGS[0];
4273
7128
  this.state = {
4274
7129
  message: "",
4275
7130
  messages: [],
4276
7131
  isSending: false,
4277
- lang: LANG_OPTIONS[0],
7132
+ lang,
4278
7133
  conversationId: "",
4279
7134
  originalEmail: ""
4280
7135
  };
4281
7136
  }
4282
7137
  render() {
7138
+ var _a2;
4283
7139
  const { onApply, getEditorContent } = this.props;
4284
7140
  const { message, messages, isSending, lang, originalEmail } = this.state;
7141
+ const flagCode = (_a2 = AI_LANG_FLAGS == null ? void 0 : AI_LANG_FLAGS.find(
7142
+ (_item) => (_item == null ? void 0 : _item.value) === (lang == null ? void 0 : lang.value)
7143
+ )) == null ? void 0 : _a2.flagCode;
4285
7144
  return /* @__PURE__ */ React.createElement(
4286
7145
  "div",
4287
7146
  {
@@ -4373,7 +7232,6 @@ class ChatAIDraft extends React.Component {
4373
7232
  display: "flex",
4374
7233
  flexDirection: "row",
4375
7234
  alignItems: "center",
4376
- justifyContent: "space-between",
4377
7235
  width: "100%",
4378
7236
  padding: "8px",
4379
7237
  boxSizing: "border-box"
@@ -4390,13 +7248,21 @@ class ChatAIDraft extends React.Component {
4390
7248
  parentRef: this.rootRef
4391
7249
  }
4392
7250
  ),
7251
+ /* @__PURE__ */ React.createElement(
7252
+ CountryFlag,
7253
+ {
7254
+ flagCode,
7255
+ style: { marginLeft: 4, height: 14 }
7256
+ }
7257
+ ),
4393
7258
  /* @__PURE__ */ React.createElement(
4394
7259
  "button",
4395
7260
  {
4396
7261
  disabled: !message.trim() || isSending,
4397
7262
  onClick: this.handleSubmit,
4398
7263
  className: "icon-button",
4399
- color: "primary"
7264
+ color: "primary",
7265
+ style: { marginLeft: "auto" }
4400
7266
  },
4401
7267
  /* @__PURE__ */ React.createElement(Send, null)
4402
7268
  )
@@ -4407,6 +7273,7 @@ class ChatAIDraft extends React.Component {
4407
7273
  }
4408
7274
  export {
4409
7275
  ChatAIDraft,
7276
+ CountryFlag,
4410
7277
  LoadingCircular,
4411
7278
  LoadingContainer,
4412
7279
  Tooltip,