@freelog/tools-lib 0.1.104 → 0.1.107

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.
@@ -11,423 +11,835 @@ var axios = _interopDefault(require('axios'));
11
11
  var NProgress = _interopDefault(require('nprogress'));
12
12
  require('nprogress/nprogress.css');
13
13
  var CryptoJS = require('crypto-js');
14
+ var i18next = _interopDefault(require('i18next'));
15
+ var Cookies = _interopDefault(require('js-cookie'));
14
16
 
15
- function _regeneratorRuntime() {
16
- /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */
17
+ function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
18
+ try {
19
+ var info = gen[key](arg);
20
+ var value = info.value;
21
+ } catch (error) {
22
+ reject(error);
23
+ return;
24
+ }
17
25
 
18
- _regeneratorRuntime = function () {
19
- return exports;
26
+ if (info.done) {
27
+ resolve(value);
28
+ } else {
29
+ Promise.resolve(value).then(_next, _throw);
30
+ }
31
+ }
32
+
33
+ function _asyncToGenerator(fn) {
34
+ return function () {
35
+ var self = this,
36
+ args = arguments;
37
+ return new Promise(function (resolve, reject) {
38
+ var gen = fn.apply(self, args);
39
+
40
+ function _next(value) {
41
+ asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value);
42
+ }
43
+
44
+ function _throw(err) {
45
+ asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err);
46
+ }
47
+
48
+ _next(undefined);
49
+ });
20
50
  };
51
+ }
52
+
53
+ function _extends() {
54
+ _extends = Object.assign || function (target) {
55
+ for (var i = 1; i < arguments.length; i++) {
56
+ var source = arguments[i];
21
57
 
22
- var exports = {},
23
- Op = Object.prototype,
24
- hasOwn = Op.hasOwnProperty,
25
- $Symbol = "function" == typeof Symbol ? Symbol : {},
26
- iteratorSymbol = $Symbol.iterator || "@@iterator",
27
- asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator",
28
- toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag";
58
+ for (var key in source) {
59
+ if (Object.prototype.hasOwnProperty.call(source, key)) {
60
+ target[key] = source[key];
61
+ }
62
+ }
63
+ }
64
+
65
+ return target;
66
+ };
67
+
68
+ return _extends.apply(this, arguments);
69
+ }
70
+
71
+ function _objectDestructuringEmpty(obj) {
72
+ if (obj == null) throw new TypeError("Cannot destructure undefined");
73
+ }
74
+
75
+ function _objectWithoutPropertiesLoose(source, excluded) {
76
+ if (source == null) return {};
77
+ var target = {};
78
+ var sourceKeys = Object.keys(source);
79
+ var key, i;
80
+
81
+ for (i = 0; i < sourceKeys.length; i++) {
82
+ key = sourceKeys[i];
83
+ if (excluded.indexOf(key) >= 0) continue;
84
+ target[key] = source[key];
85
+ }
86
+
87
+ return target;
88
+ }
89
+
90
+ function createCommonjsModule(fn, module) {
91
+ return module = { exports: {} }, fn(module, module.exports), module.exports;
92
+ }
93
+
94
+ var runtime_1 = createCommonjsModule(function (module) {
95
+ /**
96
+ * Copyright (c) 2014-present, Facebook, Inc.
97
+ *
98
+ * This source code is licensed under the MIT license found in the
99
+ * LICENSE file in the root directory of this source tree.
100
+ */
101
+
102
+ var runtime = (function (exports) {
103
+
104
+ var Op = Object.prototype;
105
+ var hasOwn = Op.hasOwnProperty;
106
+ var undefined$1; // More compressible than void 0.
107
+ var $Symbol = typeof Symbol === "function" ? Symbol : {};
108
+ var iteratorSymbol = $Symbol.iterator || "@@iterator";
109
+ var asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator";
110
+ var toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag";
29
111
 
30
112
  function define(obj, key, value) {
31
- return Object.defineProperty(obj, key, {
113
+ Object.defineProperty(obj, key, {
32
114
  value: value,
33
- enumerable: !0,
34
- configurable: !0,
35
- writable: !0
36
- }), obj[key];
115
+ enumerable: true,
116
+ configurable: true,
117
+ writable: true
118
+ });
119
+ return obj[key];
37
120
  }
38
-
39
121
  try {
122
+ // IE 8 has a broken Object.defineProperty that only works on DOM objects.
40
123
  define({}, "");
41
124
  } catch (err) {
42
- define = function (obj, key, value) {
125
+ define = function(obj, key, value) {
43
126
  return obj[key] = value;
44
127
  };
45
128
  }
46
129
 
47
130
  function wrap(innerFn, outerFn, self, tryLocsList) {
48
- var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator,
49
- generator = Object.create(protoGenerator.prototype),
50
- context = new Context(tryLocsList || []);
51
- return generator._invoke = function (innerFn, self, context) {
52
- var state = "suspendedStart";
53
- return function (method, arg) {
54
- if ("executing" === state) throw new Error("Generator is already running");
55
-
56
- if ("completed" === state) {
57
- if ("throw" === method) throw arg;
58
- return doneResult();
59
- }
60
-
61
- for (context.method = method, context.arg = arg;;) {
62
- var delegate = context.delegate;
131
+ // If outerFn provided and outerFn.prototype is a Generator, then outerFn.prototype instanceof Generator.
132
+ var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator;
133
+ var generator = Object.create(protoGenerator.prototype);
134
+ var context = new Context(tryLocsList || []);
63
135
 
64
- if (delegate) {
65
- var delegateResult = maybeInvokeDelegate(delegate, context);
136
+ // The ._invoke method unifies the implementations of the .next,
137
+ // .throw, and .return methods.
138
+ generator._invoke = makeInvokeMethod(innerFn, self, context);
66
139
 
67
- if (delegateResult) {
68
- if (delegateResult === ContinueSentinel) continue;
69
- return delegateResult;
70
- }
71
- }
72
-
73
- if ("next" === context.method) context.sent = context._sent = context.arg;else if ("throw" === context.method) {
74
- if ("suspendedStart" === state) throw state = "completed", context.arg;
75
- context.dispatchException(context.arg);
76
- } else "return" === context.method && context.abrupt("return", context.arg);
77
- state = "executing";
78
- var record = tryCatch(innerFn, self, context);
79
-
80
- if ("normal" === record.type) {
81
- if (state = context.done ? "completed" : "suspendedYield", record.arg === ContinueSentinel) continue;
82
- return {
83
- value: record.arg,
84
- done: context.done
85
- };
86
- }
87
-
88
- "throw" === record.type && (state = "completed", context.method = "throw", context.arg = record.arg);
89
- }
90
- };
91
- }(innerFn, self, context), generator;
140
+ return generator;
92
141
  }
142
+ exports.wrap = wrap;
93
143
 
144
+ // Try/catch helper to minimize deoptimizations. Returns a completion
145
+ // record like context.tryEntries[i].completion. This interface could
146
+ // have been (and was previously) designed to take a closure to be
147
+ // invoked without arguments, but in all the cases we care about we
148
+ // already have an existing method we want to call, so there's no need
149
+ // to create a new function object. We can even get away with assuming
150
+ // the method takes exactly one argument, since that happens to be true
151
+ // in every case, so we don't have to touch the arguments object. The
152
+ // only additional allocation required is the completion record, which
153
+ // has a stable shape and so hopefully should be cheap to allocate.
94
154
  function tryCatch(fn, obj, arg) {
95
155
  try {
96
- return {
97
- type: "normal",
98
- arg: fn.call(obj, arg)
99
- };
156
+ return { type: "normal", arg: fn.call(obj, arg) };
100
157
  } catch (err) {
101
- return {
102
- type: "throw",
103
- arg: err
104
- };
158
+ return { type: "throw", arg: err };
105
159
  }
106
160
  }
107
161
 
108
- exports.wrap = wrap;
162
+ var GenStateSuspendedStart = "suspendedStart";
163
+ var GenStateSuspendedYield = "suspendedYield";
164
+ var GenStateExecuting = "executing";
165
+ var GenStateCompleted = "completed";
166
+
167
+ // Returning this object from the innerFn has the same effect as
168
+ // breaking out of the dispatch switch statement.
109
169
  var ContinueSentinel = {};
110
170
 
171
+ // Dummy constructor functions that we use as the .constructor and
172
+ // .constructor.prototype properties for functions that return Generator
173
+ // objects. For full spec compliance, you may wish to configure your
174
+ // minifier not to mangle the names of these two functions.
111
175
  function Generator() {}
112
-
113
176
  function GeneratorFunction() {}
114
-
115
177
  function GeneratorFunctionPrototype() {}
116
178
 
179
+ // This is a polyfill for %IteratorPrototype% for environments that
180
+ // don't natively support it.
117
181
  var IteratorPrototype = {};
118
- define(IteratorPrototype, iteratorSymbol, function () {
182
+ IteratorPrototype[iteratorSymbol] = function () {
119
183
  return this;
120
- });
121
- var getProto = Object.getPrototypeOf,
122
- NativeIteratorPrototype = getProto && getProto(getProto(values([])));
123
- NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype);
124
- var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype);
184
+ };
125
185
 
186
+ var getProto = Object.getPrototypeOf;
187
+ var NativeIteratorPrototype = getProto && getProto(getProto(values([])));
188
+ if (NativeIteratorPrototype &&
189
+ NativeIteratorPrototype !== Op &&
190
+ hasOwn.call(NativeIteratorPrototype, iteratorSymbol)) {
191
+ // This environment has a native %IteratorPrototype%; use it instead
192
+ // of the polyfill.
193
+ IteratorPrototype = NativeIteratorPrototype;
194
+ }
195
+
196
+ var Gp = GeneratorFunctionPrototype.prototype =
197
+ Generator.prototype = Object.create(IteratorPrototype);
198
+ GeneratorFunction.prototype = Gp.constructor = GeneratorFunctionPrototype;
199
+ GeneratorFunctionPrototype.constructor = GeneratorFunction;
200
+ GeneratorFunction.displayName = define(
201
+ GeneratorFunctionPrototype,
202
+ toStringTagSymbol,
203
+ "GeneratorFunction"
204
+ );
205
+
206
+ // Helper for defining the .next, .throw, and .return methods of the
207
+ // Iterator interface in terms of a single ._invoke method.
126
208
  function defineIteratorMethods(prototype) {
127
- ["next", "throw", "return"].forEach(function (method) {
128
- define(prototype, method, function (arg) {
209
+ ["next", "throw", "return"].forEach(function(method) {
210
+ define(prototype, method, function(arg) {
129
211
  return this._invoke(method, arg);
130
212
  });
131
213
  });
132
214
  }
133
215
 
216
+ exports.isGeneratorFunction = function(genFun) {
217
+ var ctor = typeof genFun === "function" && genFun.constructor;
218
+ return ctor
219
+ ? ctor === GeneratorFunction ||
220
+ // For the native GeneratorFunction constructor, the best we can
221
+ // do is to check its .name property.
222
+ (ctor.displayName || ctor.name) === "GeneratorFunction"
223
+ : false;
224
+ };
225
+
226
+ exports.mark = function(genFun) {
227
+ if (Object.setPrototypeOf) {
228
+ Object.setPrototypeOf(genFun, GeneratorFunctionPrototype);
229
+ } else {
230
+ genFun.__proto__ = GeneratorFunctionPrototype;
231
+ define(genFun, toStringTagSymbol, "GeneratorFunction");
232
+ }
233
+ genFun.prototype = Object.create(Gp);
234
+ return genFun;
235
+ };
236
+
237
+ // Within the body of any async function, `await x` is transformed to
238
+ // `yield regeneratorRuntime.awrap(x)`, so that the runtime can test
239
+ // `hasOwn.call(value, "__await")` to determine if the yielded value is
240
+ // meant to be awaited.
241
+ exports.awrap = function(arg) {
242
+ return { __await: arg };
243
+ };
244
+
134
245
  function AsyncIterator(generator, PromiseImpl) {
135
246
  function invoke(method, arg, resolve, reject) {
136
247
  var record = tryCatch(generator[method], generator, arg);
248
+ if (record.type === "throw") {
249
+ reject(record.arg);
250
+ } else {
251
+ var result = record.arg;
252
+ var value = result.value;
253
+ if (value &&
254
+ typeof value === "object" &&
255
+ hasOwn.call(value, "__await")) {
256
+ return PromiseImpl.resolve(value.__await).then(function(value) {
257
+ invoke("next", value, resolve, reject);
258
+ }, function(err) {
259
+ invoke("throw", err, resolve, reject);
260
+ });
261
+ }
137
262
 
138
- if ("throw" !== record.type) {
139
- var result = record.arg,
140
- value = result.value;
141
- return value && "object" == typeof value && hasOwn.call(value, "__await") ? PromiseImpl.resolve(value.__await).then(function (value) {
142
- invoke("next", value, resolve, reject);
143
- }, function (err) {
144
- invoke("throw", err, resolve, reject);
145
- }) : PromiseImpl.resolve(value).then(function (unwrapped) {
146
- result.value = unwrapped, resolve(result);
147
- }, function (error) {
263
+ return PromiseImpl.resolve(value).then(function(unwrapped) {
264
+ // When a yielded Promise is resolved, its final value becomes
265
+ // the .value of the Promise<{value,done}> result for the
266
+ // current iteration.
267
+ result.value = unwrapped;
268
+ resolve(result);
269
+ }, function(error) {
270
+ // If a rejected Promise was yielded, throw the rejection back
271
+ // into the async generator function so it can be handled there.
148
272
  return invoke("throw", error, resolve, reject);
149
273
  });
150
274
  }
151
-
152
- reject(record.arg);
153
275
  }
154
276
 
155
277
  var previousPromise;
156
278
 
157
- this._invoke = function (method, arg) {
279
+ function enqueue(method, arg) {
158
280
  function callInvokeWithMethodAndArg() {
159
- return new PromiseImpl(function (resolve, reject) {
281
+ return new PromiseImpl(function(resolve, reject) {
160
282
  invoke(method, arg, resolve, reject);
161
283
  });
162
284
  }
163
285
 
164
- return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg();
286
+ return previousPromise =
287
+ // If enqueue has been called before, then we want to wait until
288
+ // all previous Promises have been resolved before calling invoke,
289
+ // so that results are always delivered in the correct order. If
290
+ // enqueue has not been called before, then it is important to
291
+ // call invoke immediately, without waiting on a callback to fire,
292
+ // so that the async generator function has the opportunity to do
293
+ // any necessary setup in a predictable way. This predictability
294
+ // is why the Promise constructor synchronously invokes its
295
+ // executor callback, and why async functions synchronously
296
+ // execute code before the first await. Since we implement simple
297
+ // async functions in terms of async generators, it is especially
298
+ // important to get this right, even though it requires care.
299
+ previousPromise ? previousPromise.then(
300
+ callInvokeWithMethodAndArg,
301
+ // Avoid propagating failures to Promises returned by later
302
+ // invocations of the iterator.
303
+ callInvokeWithMethodAndArg
304
+ ) : callInvokeWithMethodAndArg();
305
+ }
306
+
307
+ // Define the unified helper method that is used to implement .next,
308
+ // .throw, and .return (see defineIteratorMethods).
309
+ this._invoke = enqueue;
310
+ }
311
+
312
+ defineIteratorMethods(AsyncIterator.prototype);
313
+ AsyncIterator.prototype[asyncIteratorSymbol] = function () {
314
+ return this;
315
+ };
316
+ exports.AsyncIterator = AsyncIterator;
317
+
318
+ // Note that simple async functions are implemented on top of
319
+ // AsyncIterator objects; they just return a Promise for the value of
320
+ // the final result produced by the iterator.
321
+ exports.async = function(innerFn, outerFn, self, tryLocsList, PromiseImpl) {
322
+ if (PromiseImpl === void 0) PromiseImpl = Promise;
323
+
324
+ var iter = new AsyncIterator(
325
+ wrap(innerFn, outerFn, self, tryLocsList),
326
+ PromiseImpl
327
+ );
328
+
329
+ return exports.isGeneratorFunction(outerFn)
330
+ ? iter // If outerFn is a generator, return the full iterator.
331
+ : iter.next().then(function(result) {
332
+ return result.done ? result.value : iter.next();
333
+ });
334
+ };
335
+
336
+ function makeInvokeMethod(innerFn, self, context) {
337
+ var state = GenStateSuspendedStart;
338
+
339
+ return function invoke(method, arg) {
340
+ if (state === GenStateExecuting) {
341
+ throw new Error("Generator is already running");
342
+ }
343
+
344
+ if (state === GenStateCompleted) {
345
+ if (method === "throw") {
346
+ throw arg;
347
+ }
348
+
349
+ // Be forgiving, per 25.3.3.3.3 of the spec:
350
+ // https://people.mozilla.org/~jorendorff/es6-draft.html#sec-generatorresume
351
+ return doneResult();
352
+ }
353
+
354
+ context.method = method;
355
+ context.arg = arg;
356
+
357
+ while (true) {
358
+ var delegate = context.delegate;
359
+ if (delegate) {
360
+ var delegateResult = maybeInvokeDelegate(delegate, context);
361
+ if (delegateResult) {
362
+ if (delegateResult === ContinueSentinel) continue;
363
+ return delegateResult;
364
+ }
365
+ }
366
+
367
+ if (context.method === "next") {
368
+ // Setting context._sent for legacy support of Babel's
369
+ // function.sent implementation.
370
+ context.sent = context._sent = context.arg;
371
+
372
+ } else if (context.method === "throw") {
373
+ if (state === GenStateSuspendedStart) {
374
+ state = GenStateCompleted;
375
+ throw context.arg;
376
+ }
377
+
378
+ context.dispatchException(context.arg);
379
+
380
+ } else if (context.method === "return") {
381
+ context.abrupt("return", context.arg);
382
+ }
383
+
384
+ state = GenStateExecuting;
385
+
386
+ var record = tryCatch(innerFn, self, context);
387
+ if (record.type === "normal") {
388
+ // If an exception is thrown from innerFn, we leave state ===
389
+ // GenStateExecuting and loop back for another invocation.
390
+ state = context.done
391
+ ? GenStateCompleted
392
+ : GenStateSuspendedYield;
393
+
394
+ if (record.arg === ContinueSentinel) {
395
+ continue;
396
+ }
397
+
398
+ return {
399
+ value: record.arg,
400
+ done: context.done
401
+ };
402
+
403
+ } else if (record.type === "throw") {
404
+ state = GenStateCompleted;
405
+ // Dispatch the exception by looping back around to the
406
+ // context.dispatchException(context.arg) call above.
407
+ context.method = "throw";
408
+ context.arg = record.arg;
409
+ }
410
+ }
165
411
  };
166
412
  }
167
413
 
414
+ // Call delegate.iterator[context.method](context.arg) and handle the
415
+ // result, either by returning a { value, done } result from the
416
+ // delegate iterator, or by modifying context.method and context.arg,
417
+ // setting context.delegate to null, and returning the ContinueSentinel.
168
418
  function maybeInvokeDelegate(delegate, context) {
169
419
  var method = delegate.iterator[context.method];
420
+ if (method === undefined$1) {
421
+ // A .throw or .return when the delegate iterator has no .throw
422
+ // method always terminates the yield* loop.
423
+ context.delegate = null;
424
+
425
+ if (context.method === "throw") {
426
+ // Note: ["return"] must be used for ES3 parsing compatibility.
427
+ if (delegate.iterator["return"]) {
428
+ // If the delegate iterator has a return method, give it a
429
+ // chance to clean up.
430
+ context.method = "return";
431
+ context.arg = undefined$1;
432
+ maybeInvokeDelegate(delegate, context);
433
+
434
+ if (context.method === "throw") {
435
+ // If maybeInvokeDelegate(context) changed context.method from
436
+ // "return" to "throw", let that override the TypeError below.
437
+ return ContinueSentinel;
438
+ }
439
+ }
170
440
 
171
- if (undefined === method) {
172
- if (context.delegate = null, "throw" === context.method) {
173
- if (delegate.iterator.return && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method)) return ContinueSentinel;
174
- context.method = "throw", context.arg = new TypeError("The iterator does not provide a 'throw' method");
441
+ context.method = "throw";
442
+ context.arg = new TypeError(
443
+ "The iterator does not provide a 'throw' method");
175
444
  }
176
445
 
177
446
  return ContinueSentinel;
178
447
  }
179
448
 
180
449
  var record = tryCatch(method, delegate.iterator, context.arg);
181
- if ("throw" === record.type) return context.method = "throw", context.arg = record.arg, context.delegate = null, ContinueSentinel;
450
+
451
+ if (record.type === "throw") {
452
+ context.method = "throw";
453
+ context.arg = record.arg;
454
+ context.delegate = null;
455
+ return ContinueSentinel;
456
+ }
457
+
182
458
  var info = record.arg;
183
- return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, "return" !== context.method && (context.method = "next", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = "throw", context.arg = new TypeError("iterator result is not an object"), context.delegate = null, ContinueSentinel);
459
+
460
+ if (! info) {
461
+ context.method = "throw";
462
+ context.arg = new TypeError("iterator result is not an object");
463
+ context.delegate = null;
464
+ return ContinueSentinel;
465
+ }
466
+
467
+ if (info.done) {
468
+ // Assign the result of the finished delegate to the temporary
469
+ // variable specified by delegate.resultName (see delegateYield).
470
+ context[delegate.resultName] = info.value;
471
+
472
+ // Resume execution at the desired location (see delegateYield).
473
+ context.next = delegate.nextLoc;
474
+
475
+ // If context.method was "throw" but the delegate handled the
476
+ // exception, let the outer generator proceed normally. If
477
+ // context.method was "next", forget context.arg since it has been
478
+ // "consumed" by the delegate iterator. If context.method was
479
+ // "return", allow the original .return call to continue in the
480
+ // outer generator.
481
+ if (context.method !== "return") {
482
+ context.method = "next";
483
+ context.arg = undefined$1;
484
+ }
485
+
486
+ } else {
487
+ // Re-yield the result returned by the delegate method.
488
+ return info;
489
+ }
490
+
491
+ // The delegate iterator is finished, so forget it and continue with
492
+ // the outer generator.
493
+ context.delegate = null;
494
+ return ContinueSentinel;
184
495
  }
185
496
 
497
+ // Define Generator.prototype.{next,throw,return} in terms of the
498
+ // unified ._invoke helper method.
499
+ defineIteratorMethods(Gp);
500
+
501
+ define(Gp, toStringTagSymbol, "Generator");
502
+
503
+ // A Generator should always return itself as the iterator object when the
504
+ // @@iterator function is called on it. Some browsers' implementations of the
505
+ // iterator prototype chain incorrectly implement this, causing the Generator
506
+ // object to not be returned from this call. This ensures that doesn't happen.
507
+ // See https://github.com/facebook/regenerator/issues/274 for more details.
508
+ Gp[iteratorSymbol] = function() {
509
+ return this;
510
+ };
511
+
512
+ Gp.toString = function() {
513
+ return "[object Generator]";
514
+ };
515
+
186
516
  function pushTryEntry(locs) {
187
- var entry = {
188
- tryLoc: locs[0]
189
- };
190
- 1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry);
517
+ var entry = { tryLoc: locs[0] };
518
+
519
+ if (1 in locs) {
520
+ entry.catchLoc = locs[1];
521
+ }
522
+
523
+ if (2 in locs) {
524
+ entry.finallyLoc = locs[2];
525
+ entry.afterLoc = locs[3];
526
+ }
527
+
528
+ this.tryEntries.push(entry);
191
529
  }
192
530
 
193
531
  function resetTryEntry(entry) {
194
532
  var record = entry.completion || {};
195
- record.type = "normal", delete record.arg, entry.completion = record;
533
+ record.type = "normal";
534
+ delete record.arg;
535
+ entry.completion = record;
196
536
  }
197
537
 
198
538
  function Context(tryLocsList) {
199
- this.tryEntries = [{
200
- tryLoc: "root"
201
- }], tryLocsList.forEach(pushTryEntry, this), this.reset(!0);
539
+ // The root entry object (effectively a try statement without a catch
540
+ // or a finally block) gives us a place to store values thrown from
541
+ // locations where there is no enclosing try statement.
542
+ this.tryEntries = [{ tryLoc: "root" }];
543
+ tryLocsList.forEach(pushTryEntry, this);
544
+ this.reset(true);
202
545
  }
203
546
 
547
+ exports.keys = function(object) {
548
+ var keys = [];
549
+ for (var key in object) {
550
+ keys.push(key);
551
+ }
552
+ keys.reverse();
553
+
554
+ // Rather than returning an object with a next method, we keep
555
+ // things simple and return the next function itself.
556
+ return function next() {
557
+ while (keys.length) {
558
+ var key = keys.pop();
559
+ if (key in object) {
560
+ next.value = key;
561
+ next.done = false;
562
+ return next;
563
+ }
564
+ }
565
+
566
+ // To avoid creating an additional object, we just hang the .value
567
+ // and .done properties off the next function object itself. This
568
+ // also ensures that the minifier will not anonymize the function.
569
+ next.done = true;
570
+ return next;
571
+ };
572
+ };
573
+
204
574
  function values(iterable) {
205
575
  if (iterable) {
206
576
  var iteratorMethod = iterable[iteratorSymbol];
207
- if (iteratorMethod) return iteratorMethod.call(iterable);
208
- if ("function" == typeof iterable.next) return iterable;
577
+ if (iteratorMethod) {
578
+ return iteratorMethod.call(iterable);
579
+ }
580
+
581
+ if (typeof iterable.next === "function") {
582
+ return iterable;
583
+ }
209
584
 
210
585
  if (!isNaN(iterable.length)) {
211
- var i = -1,
212
- next = function next() {
213
- for (; ++i < iterable.length;) if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next;
586
+ var i = -1, next = function next() {
587
+ while (++i < iterable.length) {
588
+ if (hasOwn.call(iterable, i)) {
589
+ next.value = iterable[i];
590
+ next.done = false;
591
+ return next;
592
+ }
593
+ }
214
594
 
215
- return next.value = undefined, next.done = !0, next;
595
+ next.value = undefined$1;
596
+ next.done = true;
597
+
598
+ return next;
216
599
  };
217
600
 
218
601
  return next.next = next;
219
602
  }
220
603
  }
221
604
 
222
- return {
223
- next: doneResult
224
- };
605
+ // Return an iterator with no values.
606
+ return { next: doneResult };
225
607
  }
608
+ exports.values = values;
226
609
 
227
610
  function doneResult() {
228
- return {
229
- value: undefined,
230
- done: !0
231
- };
611
+ return { value: undefined$1, done: true };
232
612
  }
233
613
 
234
- return GeneratorFunction.prototype = GeneratorFunctionPrototype, define(Gp, "constructor", GeneratorFunctionPrototype), define(GeneratorFunctionPrototype, "constructor", GeneratorFunction), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"), exports.isGeneratorFunction = function (genFun) {
235
- var ctor = "function" == typeof genFun && genFun.constructor;
236
- return !!ctor && (ctor === GeneratorFunction || "GeneratorFunction" === (ctor.displayName || ctor.name));
237
- }, exports.mark = function (genFun) {
238
- return Object.setPrototypeOf ? Object.setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, "GeneratorFunction")), genFun.prototype = Object.create(Gp), genFun;
239
- }, exports.awrap = function (arg) {
240
- return {
241
- __await: arg
242
- };
243
- }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () {
244
- return this;
245
- }), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) {
246
- void 0 === PromiseImpl && (PromiseImpl = Promise);
247
- var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl);
248
- return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) {
249
- return result.done ? result.value : iter.next();
250
- });
251
- }, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, "Generator"), define(Gp, iteratorSymbol, function () {
252
- return this;
253
- }), define(Gp, "toString", function () {
254
- return "[object Generator]";
255
- }), exports.keys = function (object) {
256
- var keys = [];
614
+ Context.prototype = {
615
+ constructor: Context,
257
616
 
258
- for (var key in object) keys.push(key);
617
+ reset: function(skipTempReset) {
618
+ this.prev = 0;
619
+ this.next = 0;
620
+ // Resetting context._sent for legacy support of Babel's
621
+ // function.sent implementation.
622
+ this.sent = this._sent = undefined$1;
623
+ this.done = false;
624
+ this.delegate = null;
625
+
626
+ this.method = "next";
627
+ this.arg = undefined$1;
628
+
629
+ this.tryEntries.forEach(resetTryEntry);
630
+
631
+ if (!skipTempReset) {
632
+ for (var name in this) {
633
+ // Not sure about the optimal order of these conditions:
634
+ if (name.charAt(0) === "t" &&
635
+ hasOwn.call(this, name) &&
636
+ !isNaN(+name.slice(1))) {
637
+ this[name] = undefined$1;
638
+ }
639
+ }
640
+ }
641
+ },
259
642
 
260
- return keys.reverse(), function next() {
261
- for (; keys.length;) {
262
- var key = keys.pop();
263
- if (key in object) return next.value = key, next.done = !1, next;
643
+ stop: function() {
644
+ this.done = true;
645
+
646
+ var rootEntry = this.tryEntries[0];
647
+ var rootRecord = rootEntry.completion;
648
+ if (rootRecord.type === "throw") {
649
+ throw rootRecord.arg;
264
650
  }
265
651
 
266
- return next.done = !0, next;
267
- };
268
- }, exports.values = values, Context.prototype = {
269
- constructor: Context,
270
- reset: function (skipTempReset) {
271
- if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = "next", this.arg = undefined, this.tryEntries.forEach(resetTryEntry), !skipTempReset) for (var name in this) "t" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined);
272
- },
273
- stop: function () {
274
- this.done = !0;
275
- var rootRecord = this.tryEntries[0].completion;
276
- if ("throw" === rootRecord.type) throw rootRecord.arg;
277
652
  return this.rval;
278
653
  },
279
- dispatchException: function (exception) {
280
- if (this.done) throw exception;
281
- var context = this;
282
654
 
655
+ dispatchException: function(exception) {
656
+ if (this.done) {
657
+ throw exception;
658
+ }
659
+
660
+ var context = this;
283
661
  function handle(loc, caught) {
284
- return record.type = "throw", record.arg = exception, context.next = loc, caught && (context.method = "next", context.arg = undefined), !!caught;
662
+ record.type = "throw";
663
+ record.arg = exception;
664
+ context.next = loc;
665
+
666
+ if (caught) {
667
+ // If the dispatched exception was caught by a catch block,
668
+ // then let that catch block handle the exception normally.
669
+ context.method = "next";
670
+ context.arg = undefined$1;
671
+ }
672
+
673
+ return !! caught;
285
674
  }
286
675
 
287
676
  for (var i = this.tryEntries.length - 1; i >= 0; --i) {
288
- var entry = this.tryEntries[i],
289
- record = entry.completion;
290
- if ("root" === entry.tryLoc) return handle("end");
677
+ var entry = this.tryEntries[i];
678
+ var record = entry.completion;
679
+
680
+ if (entry.tryLoc === "root") {
681
+ // Exception thrown outside of any try block that could handle
682
+ // it, so set the completion value of the entire function to
683
+ // throw the exception.
684
+ return handle("end");
685
+ }
291
686
 
292
687
  if (entry.tryLoc <= this.prev) {
293
- var hasCatch = hasOwn.call(entry, "catchLoc"),
294
- hasFinally = hasOwn.call(entry, "finallyLoc");
688
+ var hasCatch = hasOwn.call(entry, "catchLoc");
689
+ var hasFinally = hasOwn.call(entry, "finallyLoc");
295
690
 
296
691
  if (hasCatch && hasFinally) {
297
- if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0);
298
- if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc);
692
+ if (this.prev < entry.catchLoc) {
693
+ return handle(entry.catchLoc, true);
694
+ } else if (this.prev < entry.finallyLoc) {
695
+ return handle(entry.finallyLoc);
696
+ }
697
+
299
698
  } else if (hasCatch) {
300
- if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0);
699
+ if (this.prev < entry.catchLoc) {
700
+ return handle(entry.catchLoc, true);
701
+ }
702
+
703
+ } else if (hasFinally) {
704
+ if (this.prev < entry.finallyLoc) {
705
+ return handle(entry.finallyLoc);
706
+ }
707
+
301
708
  } else {
302
- if (!hasFinally) throw new Error("try statement without catch or finally");
303
- if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc);
709
+ throw new Error("try statement without catch or finally");
304
710
  }
305
711
  }
306
712
  }
307
713
  },
308
- abrupt: function (type, arg) {
714
+
715
+ abrupt: function(type, arg) {
309
716
  for (var i = this.tryEntries.length - 1; i >= 0; --i) {
310
717
  var entry = this.tryEntries[i];
311
-
312
- if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) {
718
+ if (entry.tryLoc <= this.prev &&
719
+ hasOwn.call(entry, "finallyLoc") &&
720
+ this.prev < entry.finallyLoc) {
313
721
  var finallyEntry = entry;
314
722
  break;
315
723
  }
316
724
  }
317
725
 
318
- finallyEntry && ("break" === type || "continue" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null);
726
+ if (finallyEntry &&
727
+ (type === "break" ||
728
+ type === "continue") &&
729
+ finallyEntry.tryLoc <= arg &&
730
+ arg <= finallyEntry.finallyLoc) {
731
+ // Ignore the finally entry if control is not jumping to a
732
+ // location outside the try/catch block.
733
+ finallyEntry = null;
734
+ }
735
+
319
736
  var record = finallyEntry ? finallyEntry.completion : {};
320
- return record.type = type, record.arg = arg, finallyEntry ? (this.method = "next", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record);
737
+ record.type = type;
738
+ record.arg = arg;
739
+
740
+ if (finallyEntry) {
741
+ this.method = "next";
742
+ this.next = finallyEntry.finallyLoc;
743
+ return ContinueSentinel;
744
+ }
745
+
746
+ return this.complete(record);
321
747
  },
322
- complete: function (record, afterLoc) {
323
- if ("throw" === record.type) throw record.arg;
324
- return "break" === record.type || "continue" === record.type ? this.next = record.arg : "return" === record.type ? (this.rval = this.arg = record.arg, this.method = "return", this.next = "end") : "normal" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel;
748
+
749
+ complete: function(record, afterLoc) {
750
+ if (record.type === "throw") {
751
+ throw record.arg;
752
+ }
753
+
754
+ if (record.type === "break" ||
755
+ record.type === "continue") {
756
+ this.next = record.arg;
757
+ } else if (record.type === "return") {
758
+ this.rval = this.arg = record.arg;
759
+ this.method = "return";
760
+ this.next = "end";
761
+ } else if (record.type === "normal" && afterLoc) {
762
+ this.next = afterLoc;
763
+ }
764
+
765
+ return ContinueSentinel;
325
766
  },
326
- finish: function (finallyLoc) {
767
+
768
+ finish: function(finallyLoc) {
327
769
  for (var i = this.tryEntries.length - 1; i >= 0; --i) {
328
770
  var entry = this.tryEntries[i];
329
- if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel;
771
+ if (entry.finallyLoc === finallyLoc) {
772
+ this.complete(entry.completion, entry.afterLoc);
773
+ resetTryEntry(entry);
774
+ return ContinueSentinel;
775
+ }
330
776
  }
331
777
  },
332
- catch: function (tryLoc) {
778
+
779
+ "catch": function(tryLoc) {
333
780
  for (var i = this.tryEntries.length - 1; i >= 0; --i) {
334
781
  var entry = this.tryEntries[i];
335
-
336
782
  if (entry.tryLoc === tryLoc) {
337
783
  var record = entry.completion;
338
-
339
- if ("throw" === record.type) {
784
+ if (record.type === "throw") {
340
785
  var thrown = record.arg;
341
786
  resetTryEntry(entry);
342
787
  }
343
-
344
788
  return thrown;
345
789
  }
346
790
  }
347
791
 
792
+ // The context.catch method must only be called with a location
793
+ // argument that corresponds to a known catch block.
348
794
  throw new Error("illegal catch attempt");
349
795
  },
350
- delegateYield: function (iterable, resultName, nextLoc) {
351
- return this.delegate = {
796
+
797
+ delegateYield: function(iterable, resultName, nextLoc) {
798
+ this.delegate = {
352
799
  iterator: values(iterable),
353
800
  resultName: resultName,
354
801
  nextLoc: nextLoc
355
- }, "next" === this.method && (this.arg = undefined), ContinueSentinel;
356
- }
357
- }, exports;
358
- }
359
-
360
- function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
361
- try {
362
- var info = gen[key](arg);
363
- var value = info.value;
364
- } catch (error) {
365
- reject(error);
366
- return;
367
- }
368
-
369
- if (info.done) {
370
- resolve(value);
371
- } else {
372
- Promise.resolve(value).then(_next, _throw);
373
- }
374
- }
375
-
376
- function _asyncToGenerator(fn) {
377
- return function () {
378
- var self = this,
379
- args = arguments;
380
- return new Promise(function (resolve, reject) {
381
- var gen = fn.apply(self, args);
382
-
383
- function _next(value) {
384
- asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value);
385
- }
802
+ };
386
803
 
387
- function _throw(err) {
388
- asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err);
804
+ if (this.method === "next") {
805
+ // Deliberately forget the last sent value so that we don't
806
+ // accidentally pass it on to the delegate.
807
+ this.arg = undefined$1;
389
808
  }
390
809
 
391
- _next(undefined);
392
- });
393
- };
394
- }
395
-
396
- function _extends() {
397
- _extends = Object.assign ? Object.assign.bind() : function (target) {
398
- for (var i = 1; i < arguments.length; i++) {
399
- var source = arguments[i];
400
-
401
- for (var key in source) {
402
- if (Object.prototype.hasOwnProperty.call(source, key)) {
403
- target[key] = source[key];
404
- }
405
- }
810
+ return ContinueSentinel;
406
811
  }
407
-
408
- return target;
409
812
  };
410
- return _extends.apply(this, arguments);
411
- }
412
-
413
- function _objectDestructuringEmpty(obj) {
414
- if (obj == null) throw new TypeError("Cannot destructure undefined");
415
- }
416
-
417
- function _objectWithoutPropertiesLoose(source, excluded) {
418
- if (source == null) return {};
419
- var target = {};
420
- var sourceKeys = Object.keys(source);
421
- var key, i;
422
-
423
- for (i = 0; i < sourceKeys.length; i++) {
424
- key = sourceKeys[i];
425
- if (excluded.indexOf(key) >= 0) continue;
426
- target[key] = source[key];
427
- }
428
813
 
429
- return target;
814
+ // Regardless of whether this script is executing as a CommonJS module
815
+ // or not, return the runtime object so that we can declare the variable
816
+ // regeneratorRuntime in the outer scope, which allows this module to be
817
+ // injected easily by `bin/regenerator --include-runtime script.js`.
818
+ return exports;
819
+
820
+ }(
821
+ // If this script is executing as a CommonJS module, use module.exports
822
+ // as the regeneratorRuntime namespace. Otherwise create a new empty
823
+ // object. Either way, the resulting object will be used to initialize
824
+ // the regeneratorRuntime variable at the top of this file.
825
+ module.exports
826
+ ));
827
+
828
+ try {
829
+ regeneratorRuntime = runtime;
830
+ } catch (accidentalStrictMode) {
831
+ // This module should not be running in strict mode, so the above
832
+ // assignment should always work unless something is misconfigured. Just
833
+ // in case runtime.js accidentally runs in strict mode, we can escape
834
+ // strict mode using a global Function call. This could conceivably fail
835
+ // if a Content Security Policy forbids using Function, but in that case
836
+ // the proper solution is to fix the accidental strict mode problem. If
837
+ // you've misconfigured your bundler to force strict mode and applied a
838
+ // CSP to forbid Function, and you're not willing to fix either of those
839
+ // problems, please detail your unique predicament in a GitHub issue.
840
+ Function("r", "regeneratorRuntime = r")(runtime);
430
841
  }
842
+ });
431
843
 
432
844
  var _require = /*#__PURE__*/require('@freelog/resource-policy-lang'),
433
845
  compile = _require.compile;
@@ -484,11 +896,15 @@ function completeUrlByDomain(domain) {
484
896
  function policyCodeTranslationToText(_x, _x2) {
485
897
  return _policyCodeTranslationToText.apply(this, arguments);
486
898
  }
899
+ /**
900
+ * 将资源类型关键字数组,转换成标准展示文字
901
+ * @param arr 关键字数组
902
+ */
487
903
 
488
904
  function _policyCodeTranslationToText() {
489
- _policyCodeTranslationToText = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(code, targetType) {
905
+ _policyCodeTranslationToText = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee(code, targetType) {
490
906
  var result, contract, rrr;
491
- return _regeneratorRuntime().wrap(function _callee$(_context) {
907
+ return runtime_1.wrap(function _callee$(_context) {
492
908
  while (1) {
493
909
  switch (_context.prev = _context.next) {
494
910
  case 0:
@@ -538,12 +954,17 @@ function _policyCodeTranslationToText() {
538
954
  return _policyCodeTranslationToText.apply(this, arguments);
539
955
  }
540
956
 
957
+ function resourceTypeKeyArrToResourceType(arr) {
958
+ return arr.join(' / ');
959
+ }
960
+
541
961
  var Format = {
542
962
  __proto__: null,
543
963
  humanizeSize: humanizeSize,
544
964
  formatDateTime: formatDateTime,
545
965
  completeUrlByDomain: completeUrlByDomain,
546
- policyCodeTranslationToText: policyCodeTranslationToText
966
+ policyCodeTranslationToText: policyCodeTranslationToText,
967
+ resourceTypeKeyArrToResourceType: resourceTypeKeyArrToResourceType
547
968
  };
548
969
 
549
970
  // 展品名称
@@ -1322,7 +1743,7 @@ function updateObject(_ref5) {
1322
1743
 
1323
1744
  return FUtil.Request({
1324
1745
  method: 'PUT',
1325
- url: "/v1/storages/objects/" + objectIdOrName,
1746
+ url: "/v2/storages/objects/" + objectIdOrName,
1326
1747
  data: params
1327
1748
  });
1328
1749
  }
@@ -2281,6 +2702,35 @@ var Statistic = {
2281
2702
  transactionsCommon: transactionsCommon
2282
2703
  };
2283
2704
 
2705
+ function configsList(params) {
2706
+ // console.log('####@30984i2o3jdsjflfkjsdl')
2707
+ return FUtil.Request({
2708
+ method: 'POST',
2709
+ url: "/v2/i18n/configs/list",
2710
+ data: params
2711
+ });
2712
+ } // oss保存的翻译
2713
+ // interface ConfigsListParamsType {
2714
+ // key: string;
2715
+ // content: string;
2716
+ // tagIds: string[];
2717
+ // status: 0 | 1 | 2 | 3; // 0:全部 1:待翻译 2:待发布 3:已发布
2718
+ // }
2719
+ //
2720
+ // export function configsList(params: ConfigsListParamsType) {
2721
+ // // console.log('####@30984i2o3jdsjflfkjsdl')
2722
+ // return FUtil.Request({
2723
+ // method: 'POST',
2724
+ // url: `/v2/i18n/configs/list`,
2725
+ // data: params,
2726
+ // });
2727
+ // }
2728
+
2729
+ var I18n = {
2730
+ __proto__: null,
2731
+ configsList: configsList
2732
+ };
2733
+
2284
2734
  var FServiceAPI = {
2285
2735
  Node: Node,
2286
2736
  Exhibit: Exhibit,
@@ -2295,7 +2745,8 @@ var FServiceAPI = {
2295
2745
  Event: Event,
2296
2746
  Activity: Activity,
2297
2747
  TestQualification: TestQualification,
2298
- Statistic: Statistic
2748
+ Statistic: Statistic,
2749
+ I18n: I18n
2299
2750
  };
2300
2751
 
2301
2752
  var codeMessage = {
@@ -2412,10 +2863,10 @@ function request(_x, _x2) {
2412
2863
  // }
2413
2864
 
2414
2865
  function _request() {
2415
- _request = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(config, _temp) {
2866
+ _request = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee(config, _temp) {
2416
2867
  var _ref, _ref$noRedirect, noRedirect, _ref$noErrorAlert, noErrorAlert, result;
2417
2868
 
2418
- return _regeneratorRuntime().wrap(function _callee$(_context) {
2869
+ return runtime_1.wrap(function _callee$(_context) {
2419
2870
  while (1) {
2420
2871
  switch (_context.prev = _context.next) {
2421
2872
  case 0:
@@ -2548,6 +2999,254 @@ var FUtil = {
2548
2999
  Tool: Tool
2549
3000
  };
2550
3001
 
3002
+ var ossJsonUrl = 'https://freelog-i18n.oss-cn-shenzhen.aliyuncs.com/configs/i18n.json';
3003
+ var localStorage_i18nextLng_key = 'locale';
3004
+ var localStorage_i18nextResources_key = 'i18nextResources';
3005
+ var allLanguage = [{
3006
+ value: 'en_US',
3007
+ label: 'English'
3008
+ }, {
3009
+ value: 'zh_CN',
3010
+ label: '简体中文'
3011
+ }];
3012
+ var self;
3013
+
3014
+ var I18nNext = /*#__PURE__*/function () {
3015
+ function I18nNext() {
3016
+ this._loadingData = 'NotStart';
3017
+ this._taskQueue = []; // private _currentLanguage: LanguageKeyType = window.localStorage.getItem(localStorage_i18nextLng_key) as null || 'zh_CN';
3018
+
3019
+ this._currentLanguage = Cookies.get(localStorage_i18nextLng_key) || 'zh_CN';
3020
+ self = this;
3021
+ self.ready();
3022
+ }
3023
+
3024
+ var _proto = I18nNext.prototype;
3025
+
3026
+ _proto.ready = /*#__PURE__*/function () {
3027
+ var _ready = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee2() {
3028
+ var exc, handleTasks, promise;
3029
+ return runtime_1.wrap(function _callee2$(_context2) {
3030
+ while (1) {
3031
+ switch (_context2.prev = _context2.next) {
3032
+ case 0:
3033
+ exc = function exc() {
3034
+ while (self._taskQueue.length > 0) {
3035
+ var task = self._taskQueue.shift();
3036
+
3037
+ task && task();
3038
+ }
3039
+ };
3040
+
3041
+ handleTasks = /*#__PURE__*/function () {
3042
+ var _ref = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee() {
3043
+ return runtime_1.wrap(function _callee$(_context) {
3044
+ while (1) {
3045
+ switch (_context.prev = _context.next) {
3046
+ case 0:
3047
+ if (!(self._loadingData === 'End')) {
3048
+ _context.next = 3;
3049
+ break;
3050
+ }
3051
+
3052
+ exc();
3053
+ return _context.abrupt("return");
3054
+
3055
+ case 3:
3056
+ if (!(self._loadingData === 'Start')) {
3057
+ _context.next = 5;
3058
+ break;
3059
+ }
3060
+
3061
+ return _context.abrupt("return");
3062
+
3063
+ case 5:
3064
+ // NO_START
3065
+ self._loadingData = 'Start';
3066
+ _context.next = 8;
3067
+ return self._handleData();
3068
+
3069
+ case 8:
3070
+ // console.log('######');
3071
+ exc();
3072
+
3073
+ case 9:
3074
+ case "end":
3075
+ return _context.stop();
3076
+ }
3077
+ }
3078
+ }, _callee);
3079
+ }));
3080
+
3081
+ return function handleTasks() {
3082
+ return _ref.apply(this, arguments);
3083
+ };
3084
+ }();
3085
+
3086
+ promise = new Promise(function (resolve) {
3087
+ self._taskQueue.push(resolve);
3088
+ });
3089
+ handleTasks();
3090
+ return _context2.abrupt("return", promise);
3091
+
3092
+ case 5:
3093
+ case "end":
3094
+ return _context2.stop();
3095
+ }
3096
+ }
3097
+ }, _callee2);
3098
+ }));
3099
+
3100
+ function ready() {
3101
+ return _ready.apply(this, arguments);
3102
+ }
3103
+
3104
+ return ready;
3105
+ }();
3106
+
3107
+ _proto.t = function t(key, options) {
3108
+ return i18next.t(key, options);
3109
+ };
3110
+
3111
+ _proto.changeLanguage = function changeLanguage(lng) {
3112
+ // return i18next.changeLanguage(lng);
3113
+ // window.localStorage.setItem(localStorage_i18nextLng_key, lng)
3114
+ Cookies.set(localStorage_i18nextLng_key, lng, {
3115
+ expires: 36525,
3116
+ domain: FUtil.Format.completeUrlByDomain('').replace(/http(s)?:\/\//, '')
3117
+ });
3118
+ };
3119
+
3120
+ _proto.getAllLanguage = function getAllLanguage() {
3121
+ return allLanguage;
3122
+ };
3123
+
3124
+ _proto.getCurrentLanguage = function getCurrentLanguage() {
3125
+ return self._currentLanguage;
3126
+ };
3127
+
3128
+ _proto._handleData = /*#__PURE__*/function () {
3129
+ var _handleData2 = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee3() {
3130
+ var lng, resource, i18nextResources;
3131
+ return runtime_1.wrap(function _callee3$(_context3) {
3132
+ while (1) {
3133
+ switch (_context3.prev = _context3.next) {
3134
+ case 0:
3135
+ lng = self._currentLanguage;
3136
+ resource = window.localStorage.getItem(localStorage_i18nextResources_key); // const resource: string | undefined = Cookies.get(decodeURIComponent(localStorage_i18nextResources_key));
3137
+
3138
+ i18nextResources = resource ? JSON.parse(resource) : null;
3139
+
3140
+ if (i18nextResources) {
3141
+ _context3.next = 9;
3142
+ break;
3143
+ }
3144
+
3145
+ _context3.next = 6;
3146
+ return self._fetchData();
3147
+
3148
+ case 6:
3149
+ i18nextResources = _context3.sent;
3150
+ _context3.next = 10;
3151
+ break;
3152
+
3153
+ case 9:
3154
+ self._fetchData();
3155
+
3156
+ case 10:
3157
+ _context3.next = 12;
3158
+ return i18next.init({
3159
+ // the translations
3160
+ // (tip move them in a JSON file and import them,
3161
+ // or even better, manage them via a UI: https://react.i18next.com/guides/multiple-translation-files#manage-your-translations-with-a-management-gui)
3162
+ resources: i18nextResources,
3163
+ lng: lng,
3164
+ fallbackLng: 'zh_CN',
3165
+ interpolation: {
3166
+ escapeValue: false
3167
+ }
3168
+ });
3169
+
3170
+ case 12:
3171
+ case "end":
3172
+ return _context3.stop();
3173
+ }
3174
+ }
3175
+ }, _callee3);
3176
+ }));
3177
+
3178
+ function _handleData() {
3179
+ return _handleData2.apply(this, arguments);
3180
+ }
3181
+
3182
+ return _handleData;
3183
+ }();
3184
+
3185
+ _proto._fetchData = /*#__PURE__*/function () {
3186
+ var _fetchData2 = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee4() {
3187
+ var res, en_US, zh_CN, _i, _Object$entries, _Object$entries$_i, key, value, result;
3188
+
3189
+ return runtime_1.wrap(function _callee4$(_context4) {
3190
+ while (1) {
3191
+ switch (_context4.prev = _context4.next) {
3192
+ case 0:
3193
+ _context4.next = 2;
3194
+ return axios.get(ossJsonUrl, {
3195
+ withCredentials: false
3196
+ });
3197
+
3198
+ case 2:
3199
+ res = _context4.sent;
3200
+ // console.log(res, 'data09oiw3qjelsfkdfjlsdkfjl');
3201
+ en_US = {};
3202
+ zh_CN = {};
3203
+
3204
+ for (_i = 0, _Object$entries = Object.entries(res); _i < _Object$entries.length; _i++) {
3205
+ _Object$entries$_i = _Object$entries[_i], key = _Object$entries$_i[0], value = _Object$entries$_i[1];
3206
+ // console.log(key, value, 'key, value90iowsldfjlsdkj');
3207
+ en_US[key] = value['en_US'];
3208
+ zh_CN[key] = value['zh_CN'];
3209
+ }
3210
+
3211
+ result = {
3212
+ en_US: {
3213
+ translation: en_US
3214
+ },
3215
+ zh_CN: {
3216
+ translation: zh_CN
3217
+ }
3218
+ }; // console.log(result, 'result093sdolkfjlsdkjl');
3219
+
3220
+ window.localStorage.setItem(localStorage_i18nextResources_key, JSON.stringify(result)); // Cookies.set(localStorage_i18nextResources_key, encodeURIComponent(JSON.stringify(result)), {
3221
+ // expires: 36525,
3222
+ // domain: FUtil.Format.completeUrlByDomain('').replace(/http(s)?:\/\//, ''),
3223
+ // });
3224
+
3225
+ return _context4.abrupt("return", result);
3226
+
3227
+ case 9:
3228
+ case "end":
3229
+ return _context4.stop();
3230
+ }
3231
+ }
3232
+ }, _callee4);
3233
+ }));
3234
+
3235
+ function _fetchData() {
3236
+ return _fetchData2.apply(this, arguments);
3237
+ }
3238
+
3239
+ return _fetchData;
3240
+ }();
3241
+
3242
+ return I18nNext;
3243
+ }();
3244
+
3245
+ var FI18n = {
3246
+ i18nNext: /*#__PURE__*/new I18nNext()
3247
+ };
3248
+
3249
+ exports.FI18n = FI18n;
2551
3250
  exports.FServiceAPI = FServiceAPI;
2552
3251
  exports.FUtil = FUtil;
2553
3252
  //# sourceMappingURL=tools-lib.cjs.development.js.map