@lm_fe/utils 0.1.201 → 0.2.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/constant/index.d.ts +0 -1
- package/dist/helper/AppEnv.d.ts +9 -5
- package/dist/helper/Request/Request.d.ts +1 -1
- package/dist/helper/Request/index.d.ts +3 -7
- package/dist/helper/date_calculator.d.ts +38 -0
- package/dist/helper/index.d.ts +1 -0
- package/dist/helper/moment-help.d.ts +4 -0
- package/dist/helper/small-fn-old.d.ts +10 -45
- package/dist/helper/small-fn.d.ts +3 -0
- package/dist/index.js +371 -3815
- package/dist/types.d.ts +92 -60
- package/package.json +4 -4
- package/dist/index.js.map +0 -1
package/dist/index.js
CHANGED
|
@@ -1,3305 +1,36 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
import
|
|
9
|
-
import
|
|
10
|
-
import
|
|
11
|
-
import
|
|
12
|
-
import _typeof2 from "@babel/runtime/helpers/typeof";
|
|
1
|
+
import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
|
|
2
|
+
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
3
|
+
import _construct from "@babel/runtime/helpers/construct";
|
|
4
|
+
import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
|
|
5
|
+
import _wrapNativeSuper from "@babel/runtime/helpers/wrapNativeSuper";
|
|
6
|
+
import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn";
|
|
7
|
+
import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
|
|
8
|
+
import _inherits from "@babel/runtime/helpers/inherits";
|
|
9
|
+
import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
|
|
10
|
+
import _createClass from "@babel/runtime/helpers/createClass";
|
|
11
|
+
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
13
12
|
var _EventEmitter_Old;
|
|
14
|
-
import
|
|
15
|
-
function
|
|
16
|
-
function
|
|
17
|
-
function
|
|
18
|
-
function
|
|
19
|
-
import
|
|
20
|
-
export
|
|
21
|
-
import store from 'store';
|
|
22
|
-
import
|
|
23
|
-
|
|
24
|
-
import
|
|
25
|
-
import
|
|
26
|
-
import
|
|
27
|
-
import
|
|
28
|
-
import _split from 'lodash/split';
|
|
29
|
-
import _isNumber from 'lodash/isNumber';
|
|
30
|
-
import React, { Suspense } from 'react';
|
|
31
|
-
import { render } from 'react-dom';
|
|
32
|
-
function _typeof$1(o) {
|
|
33
|
-
"@babel/helpers - typeof";
|
|
34
|
-
|
|
35
|
-
return _typeof$1 = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) {
|
|
36
|
-
return typeof o;
|
|
37
|
-
} : function (o) {
|
|
38
|
-
return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o;
|
|
39
|
-
}, _typeof$1(o);
|
|
40
|
-
}
|
|
41
|
-
function toPrimitive(t, r) {
|
|
42
|
-
if ("object" != _typeof$1(t) || !t) return t;
|
|
43
|
-
var e = t[Symbol.toPrimitive];
|
|
44
|
-
if (void 0 !== e) {
|
|
45
|
-
var i = e.call(t, r || "default");
|
|
46
|
-
if ("object" != _typeof$1(i)) return i;
|
|
47
|
-
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
48
|
-
}
|
|
49
|
-
return ("string" === r ? String : Number)(t);
|
|
50
|
-
}
|
|
51
|
-
function toPropertyKey(t) {
|
|
52
|
-
var i = toPrimitive(t, "string");
|
|
53
|
-
return "symbol" == _typeof$1(i) ? i : i + "";
|
|
54
|
-
}
|
|
55
|
-
function _defineProperty(e, r, t) {
|
|
56
|
-
return (r = toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
|
|
57
|
-
value: t,
|
|
58
|
-
enumerable: !0,
|
|
59
|
-
configurable: !0,
|
|
60
|
-
writable: !0
|
|
61
|
-
}) : e[r] = t, e;
|
|
62
|
-
}
|
|
63
|
-
function _defineProperties(e, r) {
|
|
64
|
-
for (var t = 0; t < r.length; t++) {
|
|
65
|
-
var o = r[t];
|
|
66
|
-
o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, toPropertyKey(o.key), o);
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
function _createClass(e, r, t) {
|
|
70
|
-
return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", {
|
|
71
|
-
writable: !1
|
|
72
|
-
}), e;
|
|
73
|
-
}
|
|
74
|
-
function _classCallCheck(a, n) {
|
|
75
|
-
if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function");
|
|
76
|
-
}
|
|
77
|
-
function _assertThisInitialized(e) {
|
|
78
|
-
if (void 0 === e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
|
|
79
|
-
return e;
|
|
80
|
-
}
|
|
81
|
-
function _possibleConstructorReturn(t, e) {
|
|
82
|
-
if (e && ("object" == _typeof$1(e) || "function" == typeof e)) return e;
|
|
83
|
-
if (void 0 !== e) throw new TypeError("Derived constructors may only return object or undefined");
|
|
84
|
-
return _assertThisInitialized(t);
|
|
85
|
-
}
|
|
86
|
-
function _getPrototypeOf(t) {
|
|
87
|
-
return _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function (t) {
|
|
88
|
-
return t.__proto__ || Object.getPrototypeOf(t);
|
|
89
|
-
}, _getPrototypeOf(t);
|
|
90
|
-
}
|
|
91
|
-
function _setPrototypeOf(t, e) {
|
|
92
|
-
return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) {
|
|
93
|
-
return t.__proto__ = e, t;
|
|
94
|
-
}, _setPrototypeOf(t, e);
|
|
95
|
-
}
|
|
96
|
-
function _inherits(t, e) {
|
|
97
|
-
if ("function" != typeof e && null !== e) throw new TypeError("Super expression must either be null or a function");
|
|
98
|
-
t.prototype = Object.create(e && e.prototype, {
|
|
99
|
-
constructor: {
|
|
100
|
-
value: t,
|
|
101
|
-
writable: !0,
|
|
102
|
-
configurable: !0
|
|
103
|
-
}
|
|
104
|
-
}), Object.defineProperty(t, "prototype", {
|
|
105
|
-
writable: !1
|
|
106
|
-
}), e && _setPrototypeOf(t, e);
|
|
107
|
-
}
|
|
108
|
-
function _isNativeFunction(t) {
|
|
109
|
-
try {
|
|
110
|
-
return -1 !== Function.toString.call(t).indexOf("[native code]");
|
|
111
|
-
} catch (n) {
|
|
112
|
-
return "function" == typeof t;
|
|
113
|
-
}
|
|
114
|
-
}
|
|
115
|
-
function _isNativeReflectConstruct$1() {
|
|
116
|
-
try {
|
|
117
|
-
var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {}));
|
|
118
|
-
} catch (t) {}
|
|
119
|
-
return (_isNativeReflectConstruct$1 = function _isNativeReflectConstruct() {
|
|
120
|
-
return !!t;
|
|
121
|
-
})();
|
|
122
|
-
}
|
|
123
|
-
function _construct(t, e, r) {
|
|
124
|
-
if (_isNativeReflectConstruct$1()) return Reflect.construct.apply(null, arguments);
|
|
125
|
-
var o = [null];
|
|
126
|
-
o.push.apply(o, e);
|
|
127
|
-
var p = new (t.bind.apply(t, o))();
|
|
128
|
-
return r && _setPrototypeOf(p, r.prototype), p;
|
|
129
|
-
}
|
|
130
|
-
function _wrapNativeSuper(t) {
|
|
131
|
-
var r = "function" == typeof Map ? new Map() : void 0;
|
|
132
|
-
return _wrapNativeSuper = function _wrapNativeSuper(t) {
|
|
133
|
-
if (null === t || !_isNativeFunction(t)) return t;
|
|
134
|
-
if ("function" != typeof t) throw new TypeError("Super expression must either be null or a function");
|
|
135
|
-
if (void 0 !== r) {
|
|
136
|
-
if (r.has(t)) return r.get(t);
|
|
137
|
-
r.set(t, Wrapper);
|
|
138
|
-
}
|
|
139
|
-
function Wrapper() {
|
|
140
|
-
return _construct(t, arguments, _getPrototypeOf(this).constructor);
|
|
141
|
-
}
|
|
142
|
-
return Wrapper.prototype = Object.create(t.prototype, {
|
|
143
|
-
constructor: {
|
|
144
|
-
value: Wrapper,
|
|
145
|
-
enumerable: !1,
|
|
146
|
-
writable: !0,
|
|
147
|
-
configurable: !0
|
|
148
|
-
}
|
|
149
|
-
}), _setPrototypeOf(Wrapper, t);
|
|
150
|
-
}, _wrapNativeSuper(t);
|
|
151
|
-
}
|
|
152
|
-
function asyncGeneratorStep(n, t, e, r, o, a, c) {
|
|
153
|
-
try {
|
|
154
|
-
var i = n[a](c),
|
|
155
|
-
u = i.value;
|
|
156
|
-
} catch (n) {
|
|
157
|
-
return void e(n);
|
|
158
|
-
}
|
|
159
|
-
i.done ? t(u) : Promise.resolve(u).then(r, o);
|
|
160
|
-
}
|
|
161
|
-
function _asyncToGenerator(n) {
|
|
162
|
-
return function () {
|
|
163
|
-
var t = this,
|
|
164
|
-
e = arguments;
|
|
165
|
-
return new Promise(function (r, o) {
|
|
166
|
-
var a = n.apply(t, e);
|
|
167
|
-
function _next(n) {
|
|
168
|
-
asyncGeneratorStep(a, r, o, _next, _throw, "next", n);
|
|
169
|
-
}
|
|
170
|
-
function _throw(n) {
|
|
171
|
-
asyncGeneratorStep(a, r, o, _next, _throw, "throw", n);
|
|
172
|
-
}
|
|
173
|
-
_next(void 0);
|
|
174
|
-
});
|
|
175
|
-
};
|
|
176
|
-
}
|
|
177
|
-
function _arrayWithHoles(r) {
|
|
178
|
-
if (Array.isArray(r)) return r;
|
|
179
|
-
}
|
|
180
|
-
function _iterableToArrayLimit(r, l) {
|
|
181
|
-
var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"];
|
|
182
|
-
if (null != t) {
|
|
183
|
-
var e,
|
|
184
|
-
n,
|
|
185
|
-
i,
|
|
186
|
-
u,
|
|
187
|
-
a = [],
|
|
188
|
-
f = !0,
|
|
189
|
-
o = !1;
|
|
190
|
-
try {
|
|
191
|
-
if (i = (t = t.call(r)).next, 0 === l) {
|
|
192
|
-
if (Object(t) !== t) return;
|
|
193
|
-
f = !1;
|
|
194
|
-
} else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0);
|
|
195
|
-
} catch (r) {
|
|
196
|
-
o = !0, n = r;
|
|
197
|
-
} finally {
|
|
198
|
-
try {
|
|
199
|
-
if (!f && null != t["return"] && (u = t["return"](), Object(u) !== u)) return;
|
|
200
|
-
} finally {
|
|
201
|
-
if (o) throw n;
|
|
202
|
-
}
|
|
203
|
-
}
|
|
204
|
-
return a;
|
|
205
|
-
}
|
|
206
|
-
}
|
|
207
|
-
function _arrayLikeToArray$1(r, a) {
|
|
208
|
-
(null == a || a > r.length) && (a = r.length);
|
|
209
|
-
for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e];
|
|
210
|
-
return n;
|
|
211
|
-
}
|
|
212
|
-
function _unsupportedIterableToArray$1(r, a) {
|
|
213
|
-
if (r) {
|
|
214
|
-
if ("string" == typeof r) return _arrayLikeToArray$1(r, a);
|
|
215
|
-
var t = {}.toString.call(r).slice(8, -1);
|
|
216
|
-
return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray$1(r, a) : void 0;
|
|
217
|
-
}
|
|
218
|
-
}
|
|
219
|
-
function _nonIterableRest() {
|
|
220
|
-
throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
221
|
-
}
|
|
222
|
-
function _slicedToArray(r, e) {
|
|
223
|
-
return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray$1(r, e) || _nonIterableRest();
|
|
224
|
-
}
|
|
225
|
-
function _arrayWithoutHoles(r) {
|
|
226
|
-
if (Array.isArray(r)) return _arrayLikeToArray$1(r);
|
|
227
|
-
}
|
|
228
|
-
function _iterableToArray(r) {
|
|
229
|
-
if ("undefined" != typeof Symbol && null != r[Symbol.iterator] || null != r["@@iterator"]) return Array.from(r);
|
|
230
|
-
}
|
|
231
|
-
function _nonIterableSpread() {
|
|
232
|
-
throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
233
|
-
}
|
|
234
|
-
function _toConsumableArray(r) {
|
|
235
|
-
return _arrayWithoutHoles(r) || _iterableToArray(r) || _unsupportedIterableToArray$1(r) || _nonIterableSpread();
|
|
236
|
-
}
|
|
237
|
-
var regeneratorRuntime$1 = {
|
|
238
|
-
exports: {}
|
|
239
|
-
};
|
|
240
|
-
var _typeof = {
|
|
241
|
-
exports: {}
|
|
242
|
-
};
|
|
243
|
-
(function (module) {
|
|
244
|
-
function _typeof(o) {
|
|
245
|
-
"@babel/helpers - typeof";
|
|
246
|
-
|
|
247
|
-
return module.exports = _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) {
|
|
248
|
-
return typeof o;
|
|
249
|
-
} : function (o) {
|
|
250
|
-
return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o;
|
|
251
|
-
}, module.exports.__esModule = true, module.exports["default"] = module.exports, _typeof(o);
|
|
252
|
-
}
|
|
253
|
-
module.exports = _typeof, module.exports.__esModule = true, module.exports["default"] = module.exports;
|
|
254
|
-
})(_typeof);
|
|
255
|
-
(function (module) {
|
|
256
|
-
var _typeof$1 = _typeof.exports["default"];
|
|
257
|
-
function _regeneratorRuntime() {
|
|
258
|
-
/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */
|
|
259
|
-
module.exports = _regeneratorRuntime = function _regeneratorRuntime() {
|
|
260
|
-
return e;
|
|
261
|
-
}, module.exports.__esModule = true, module.exports["default"] = module.exports;
|
|
262
|
-
var t,
|
|
263
|
-
e = {},
|
|
264
|
-
r = Object.prototype,
|
|
265
|
-
n = r.hasOwnProperty,
|
|
266
|
-
o = Object.defineProperty || function (t, e, r) {
|
|
267
|
-
t[e] = r.value;
|
|
268
|
-
},
|
|
269
|
-
i = "function" == typeof Symbol ? Symbol : {},
|
|
270
|
-
a = i.iterator || "@@iterator",
|
|
271
|
-
c = i.asyncIterator || "@@asyncIterator",
|
|
272
|
-
u = i.toStringTag || "@@toStringTag";
|
|
273
|
-
function define(t, e, r) {
|
|
274
|
-
return Object.defineProperty(t, e, {
|
|
275
|
-
value: r,
|
|
276
|
-
enumerable: !0,
|
|
277
|
-
configurable: !0,
|
|
278
|
-
writable: !0
|
|
279
|
-
}), t[e];
|
|
280
|
-
}
|
|
281
|
-
try {
|
|
282
|
-
define({}, "");
|
|
283
|
-
} catch (t) {
|
|
284
|
-
define = function define(t, e, r) {
|
|
285
|
-
return t[e] = r;
|
|
286
|
-
};
|
|
287
|
-
}
|
|
288
|
-
function wrap(t, e, r, n) {
|
|
289
|
-
var i = e && e.prototype instanceof Generator ? e : Generator,
|
|
290
|
-
a = Object.create(i.prototype),
|
|
291
|
-
c = new Context(n || []);
|
|
292
|
-
return o(a, "_invoke", {
|
|
293
|
-
value: makeInvokeMethod(t, r, c)
|
|
294
|
-
}), a;
|
|
295
|
-
}
|
|
296
|
-
function tryCatch(t, e, r) {
|
|
297
|
-
try {
|
|
298
|
-
return {
|
|
299
|
-
type: "normal",
|
|
300
|
-
arg: t.call(e, r)
|
|
301
|
-
};
|
|
302
|
-
} catch (t) {
|
|
303
|
-
return {
|
|
304
|
-
type: "throw",
|
|
305
|
-
arg: t
|
|
306
|
-
};
|
|
307
|
-
}
|
|
308
|
-
}
|
|
309
|
-
e.wrap = wrap;
|
|
310
|
-
var h = "suspendedStart",
|
|
311
|
-
l = "suspendedYield",
|
|
312
|
-
f = "executing",
|
|
313
|
-
s = "completed",
|
|
314
|
-
y = {};
|
|
315
|
-
function Generator() {}
|
|
316
|
-
function GeneratorFunction() {}
|
|
317
|
-
function GeneratorFunctionPrototype() {}
|
|
318
|
-
var p = {};
|
|
319
|
-
define(p, a, function () {
|
|
320
|
-
return this;
|
|
321
|
-
});
|
|
322
|
-
var d = Object.getPrototypeOf,
|
|
323
|
-
v = d && d(d(values([])));
|
|
324
|
-
v && v !== r && n.call(v, a) && (p = v);
|
|
325
|
-
var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p);
|
|
326
|
-
function defineIteratorMethods(t) {
|
|
327
|
-
["next", "throw", "return"].forEach(function (e) {
|
|
328
|
-
define(t, e, function (t) {
|
|
329
|
-
return this._invoke(e, t);
|
|
330
|
-
});
|
|
331
|
-
});
|
|
332
|
-
}
|
|
333
|
-
function AsyncIterator(t, e) {
|
|
334
|
-
function invoke(r, o, i, a) {
|
|
335
|
-
var c = tryCatch(t[r], t, o);
|
|
336
|
-
if ("throw" !== c.type) {
|
|
337
|
-
var u = c.arg,
|
|
338
|
-
h = u.value;
|
|
339
|
-
return h && "object" == _typeof$1(h) && n.call(h, "__await") ? e.resolve(h.__await).then(function (t) {
|
|
340
|
-
invoke("next", t, i, a);
|
|
341
|
-
}, function (t) {
|
|
342
|
-
invoke("throw", t, i, a);
|
|
343
|
-
}) : e.resolve(h).then(function (t) {
|
|
344
|
-
u.value = t, i(u);
|
|
345
|
-
}, function (t) {
|
|
346
|
-
return invoke("throw", t, i, a);
|
|
347
|
-
});
|
|
348
|
-
}
|
|
349
|
-
a(c.arg);
|
|
350
|
-
}
|
|
351
|
-
var r;
|
|
352
|
-
o(this, "_invoke", {
|
|
353
|
-
value: function value(t, n) {
|
|
354
|
-
function callInvokeWithMethodAndArg() {
|
|
355
|
-
return new e(function (e, r) {
|
|
356
|
-
invoke(t, n, e, r);
|
|
357
|
-
});
|
|
358
|
-
}
|
|
359
|
-
return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg();
|
|
360
|
-
}
|
|
361
|
-
});
|
|
362
|
-
}
|
|
363
|
-
function makeInvokeMethod(e, r, n) {
|
|
364
|
-
var o = h;
|
|
365
|
-
return function (i, a) {
|
|
366
|
-
if (o === f) throw Error("Generator is already running");
|
|
367
|
-
if (o === s) {
|
|
368
|
-
if ("throw" === i) throw a;
|
|
369
|
-
return {
|
|
370
|
-
value: t,
|
|
371
|
-
done: !0
|
|
372
|
-
};
|
|
373
|
-
}
|
|
374
|
-
for (n.method = i, n.arg = a;;) {
|
|
375
|
-
var c = n.delegate;
|
|
376
|
-
if (c) {
|
|
377
|
-
var u = maybeInvokeDelegate(c, n);
|
|
378
|
-
if (u) {
|
|
379
|
-
if (u === y) continue;
|
|
380
|
-
return u;
|
|
381
|
-
}
|
|
382
|
-
}
|
|
383
|
-
if ("next" === n.method) n.sent = n._sent = n.arg;else if ("throw" === n.method) {
|
|
384
|
-
if (o === h) throw o = s, n.arg;
|
|
385
|
-
n.dispatchException(n.arg);
|
|
386
|
-
} else "return" === n.method && n.abrupt("return", n.arg);
|
|
387
|
-
o = f;
|
|
388
|
-
var p = tryCatch(e, r, n);
|
|
389
|
-
if ("normal" === p.type) {
|
|
390
|
-
if (o = n.done ? s : l, p.arg === y) continue;
|
|
391
|
-
return {
|
|
392
|
-
value: p.arg,
|
|
393
|
-
done: n.done
|
|
394
|
-
};
|
|
395
|
-
}
|
|
396
|
-
"throw" === p.type && (o = s, n.method = "throw", n.arg = p.arg);
|
|
397
|
-
}
|
|
398
|
-
};
|
|
399
|
-
}
|
|
400
|
-
function maybeInvokeDelegate(e, r) {
|
|
401
|
-
var n = r.method,
|
|
402
|
-
o = e.iterator[n];
|
|
403
|
-
if (o === t) return r.delegate = null, "throw" === n && e.iterator["return"] && (r.method = "return", r.arg = t, maybeInvokeDelegate(e, r), "throw" === r.method) || "return" !== n && (r.method = "throw", r.arg = new TypeError("The iterator does not provide a '" + n + "' method")), y;
|
|
404
|
-
var i = tryCatch(o, e.iterator, r.arg);
|
|
405
|
-
if ("throw" === i.type) return r.method = "throw", r.arg = i.arg, r.delegate = null, y;
|
|
406
|
-
var a = i.arg;
|
|
407
|
-
return a ? a.done ? (r[e.resultName] = a.value, r.next = e.nextLoc, "return" !== r.method && (r.method = "next", r.arg = t), r.delegate = null, y) : a : (r.method = "throw", r.arg = new TypeError("iterator result is not an object"), r.delegate = null, y);
|
|
408
|
-
}
|
|
409
|
-
function pushTryEntry(t) {
|
|
410
|
-
var e = {
|
|
411
|
-
tryLoc: t[0]
|
|
412
|
-
};
|
|
413
|
-
1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e);
|
|
414
|
-
}
|
|
415
|
-
function resetTryEntry(t) {
|
|
416
|
-
var e = t.completion || {};
|
|
417
|
-
e.type = "normal", delete e.arg, t.completion = e;
|
|
418
|
-
}
|
|
419
|
-
function Context(t) {
|
|
420
|
-
this.tryEntries = [{
|
|
421
|
-
tryLoc: "root"
|
|
422
|
-
}], t.forEach(pushTryEntry, this), this.reset(!0);
|
|
423
|
-
}
|
|
424
|
-
function values(e) {
|
|
425
|
-
if (e || "" === e) {
|
|
426
|
-
var r = e[a];
|
|
427
|
-
if (r) return r.call(e);
|
|
428
|
-
if ("function" == typeof e.next) return e;
|
|
429
|
-
if (!isNaN(e.length)) {
|
|
430
|
-
var o = -1,
|
|
431
|
-
i = function next() {
|
|
432
|
-
for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next;
|
|
433
|
-
return next.value = t, next.done = !0, next;
|
|
434
|
-
};
|
|
435
|
-
return i.next = i;
|
|
436
|
-
}
|
|
437
|
-
}
|
|
438
|
-
throw new TypeError(_typeof$1(e) + " is not iterable");
|
|
439
|
-
}
|
|
440
|
-
return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, "constructor", {
|
|
441
|
-
value: GeneratorFunctionPrototype,
|
|
442
|
-
configurable: !0
|
|
443
|
-
}), o(GeneratorFunctionPrototype, "constructor", {
|
|
444
|
-
value: GeneratorFunction,
|
|
445
|
-
configurable: !0
|
|
446
|
-
}), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, "GeneratorFunction"), e.isGeneratorFunction = function (t) {
|
|
447
|
-
var e = "function" == typeof t && t.constructor;
|
|
448
|
-
return !!e && (e === GeneratorFunction || "GeneratorFunction" === (e.displayName || e.name));
|
|
449
|
-
}, e.mark = function (t) {
|
|
450
|
-
return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, "GeneratorFunction")), t.prototype = Object.create(g), t;
|
|
451
|
-
}, e.awrap = function (t) {
|
|
452
|
-
return {
|
|
453
|
-
__await: t
|
|
454
|
-
};
|
|
455
|
-
}, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () {
|
|
456
|
-
return this;
|
|
457
|
-
}), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) {
|
|
458
|
-
void 0 === i && (i = Promise);
|
|
459
|
-
var a = new AsyncIterator(wrap(t, r, n, o), i);
|
|
460
|
-
return e.isGeneratorFunction(r) ? a : a.next().then(function (t) {
|
|
461
|
-
return t.done ? t.value : a.next();
|
|
462
|
-
});
|
|
463
|
-
}, defineIteratorMethods(g), define(g, u, "Generator"), define(g, a, function () {
|
|
464
|
-
return this;
|
|
465
|
-
}), define(g, "toString", function () {
|
|
466
|
-
return "[object Generator]";
|
|
467
|
-
}), e.keys = function (t) {
|
|
468
|
-
var e = Object(t),
|
|
469
|
-
r = [];
|
|
470
|
-
for (var n in e) r.push(n);
|
|
471
|
-
return r.reverse(), function next() {
|
|
472
|
-
for (; r.length;) {
|
|
473
|
-
var t = r.pop();
|
|
474
|
-
if (t in e) return next.value = t, next.done = !1, next;
|
|
475
|
-
}
|
|
476
|
-
return next.done = !0, next;
|
|
477
|
-
};
|
|
478
|
-
}, e.values = values, Context.prototype = {
|
|
479
|
-
constructor: Context,
|
|
480
|
-
reset: function reset(e) {
|
|
481
|
-
if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = "next", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e) for (var r in this) "t" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t);
|
|
482
|
-
},
|
|
483
|
-
stop: function stop() {
|
|
484
|
-
this.done = !0;
|
|
485
|
-
var t = this.tryEntries[0].completion;
|
|
486
|
-
if ("throw" === t.type) throw t.arg;
|
|
487
|
-
return this.rval;
|
|
488
|
-
},
|
|
489
|
-
dispatchException: function dispatchException(e) {
|
|
490
|
-
if (this.done) throw e;
|
|
491
|
-
var r = this;
|
|
492
|
-
function handle(n, o) {
|
|
493
|
-
return a.type = "throw", a.arg = e, r.next = n, o && (r.method = "next", r.arg = t), !!o;
|
|
494
|
-
}
|
|
495
|
-
for (var o = this.tryEntries.length - 1; o >= 0; --o) {
|
|
496
|
-
var i = this.tryEntries[o],
|
|
497
|
-
a = i.completion;
|
|
498
|
-
if ("root" === i.tryLoc) return handle("end");
|
|
499
|
-
if (i.tryLoc <= this.prev) {
|
|
500
|
-
var c = n.call(i, "catchLoc"),
|
|
501
|
-
u = n.call(i, "finallyLoc");
|
|
502
|
-
if (c && u) {
|
|
503
|
-
if (this.prev < i.catchLoc) return handle(i.catchLoc, !0);
|
|
504
|
-
if (this.prev < i.finallyLoc) return handle(i.finallyLoc);
|
|
505
|
-
} else if (c) {
|
|
506
|
-
if (this.prev < i.catchLoc) return handle(i.catchLoc, !0);
|
|
507
|
-
} else {
|
|
508
|
-
if (!u) throw Error("try statement without catch or finally");
|
|
509
|
-
if (this.prev < i.finallyLoc) return handle(i.finallyLoc);
|
|
510
|
-
}
|
|
511
|
-
}
|
|
512
|
-
}
|
|
513
|
-
},
|
|
514
|
-
abrupt: function abrupt(t, e) {
|
|
515
|
-
for (var r = this.tryEntries.length - 1; r >= 0; --r) {
|
|
516
|
-
var o = this.tryEntries[r];
|
|
517
|
-
if (o.tryLoc <= this.prev && n.call(o, "finallyLoc") && this.prev < o.finallyLoc) {
|
|
518
|
-
var i = o;
|
|
519
|
-
break;
|
|
520
|
-
}
|
|
521
|
-
}
|
|
522
|
-
i && ("break" === t || "continue" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null);
|
|
523
|
-
var a = i ? i.completion : {};
|
|
524
|
-
return a.type = t, a.arg = e, i ? (this.method = "next", this.next = i.finallyLoc, y) : this.complete(a);
|
|
525
|
-
},
|
|
526
|
-
complete: function complete(t, e) {
|
|
527
|
-
if ("throw" === t.type) throw t.arg;
|
|
528
|
-
return "break" === t.type || "continue" === t.type ? this.next = t.arg : "return" === t.type ? (this.rval = this.arg = t.arg, this.method = "return", this.next = "end") : "normal" === t.type && e && (this.next = e), y;
|
|
529
|
-
},
|
|
530
|
-
finish: function finish(t) {
|
|
531
|
-
for (var e = this.tryEntries.length - 1; e >= 0; --e) {
|
|
532
|
-
var r = this.tryEntries[e];
|
|
533
|
-
if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y;
|
|
534
|
-
}
|
|
535
|
-
},
|
|
536
|
-
"catch": function _catch(t) {
|
|
537
|
-
for (var e = this.tryEntries.length - 1; e >= 0; --e) {
|
|
538
|
-
var r = this.tryEntries[e];
|
|
539
|
-
if (r.tryLoc === t) {
|
|
540
|
-
var n = r.completion;
|
|
541
|
-
if ("throw" === n.type) {
|
|
542
|
-
var o = n.arg;
|
|
543
|
-
resetTryEntry(r);
|
|
544
|
-
}
|
|
545
|
-
return o;
|
|
546
|
-
}
|
|
547
|
-
}
|
|
548
|
-
throw Error("illegal catch attempt");
|
|
549
|
-
},
|
|
550
|
-
delegateYield: function delegateYield(e, r, n) {
|
|
551
|
-
return this.delegate = {
|
|
552
|
-
iterator: values(e),
|
|
553
|
-
resultName: r,
|
|
554
|
-
nextLoc: n
|
|
555
|
-
}, "next" === this.method && (this.arg = t), y;
|
|
556
|
-
}
|
|
557
|
-
}, e;
|
|
558
|
-
}
|
|
559
|
-
module.exports = _regeneratorRuntime, module.exports.__esModule = true, module.exports["default"] = module.exports;
|
|
560
|
-
})(regeneratorRuntime$1);
|
|
561
|
-
|
|
562
|
-
// TODO(Babel 8): Remove this file.
|
|
563
|
-
|
|
564
|
-
var runtime = regeneratorRuntime$1.exports();
|
|
565
|
-
var regenerator = runtime;
|
|
566
|
-
|
|
567
|
-
// Copied from https://github.com/facebook/regenerator/blob/main/packages/runtime/runtime.js#L736=
|
|
568
|
-
try {
|
|
569
|
-
regeneratorRuntime = runtime;
|
|
570
|
-
} catch (accidentalStrictMode) {
|
|
571
|
-
if ((typeof globalThis === "undefined" ? "undefined" : _typeof2(globalThis)) === "object") {
|
|
572
|
-
globalThis.regeneratorRuntime = runtime;
|
|
573
|
-
} else {
|
|
574
|
-
Function("r", "regeneratorRuntime = r")(runtime);
|
|
575
|
-
}
|
|
576
|
-
}
|
|
577
|
-
function ownKeys(e, r) {
|
|
578
|
-
var t = Object.keys(e);
|
|
579
|
-
if (Object.getOwnPropertySymbols) {
|
|
580
|
-
var o = Object.getOwnPropertySymbols(e);
|
|
581
|
-
r && (o = o.filter(function (r) {
|
|
582
|
-
return Object.getOwnPropertyDescriptor(e, r).enumerable;
|
|
583
|
-
})), t.push.apply(t, o);
|
|
584
|
-
}
|
|
585
|
-
return t;
|
|
586
|
-
}
|
|
587
|
-
function _objectSpread(e) {
|
|
588
|
-
for (var r = 1; r < arguments.length; r++) {
|
|
589
|
-
var t = null != arguments[r] ? arguments[r] : {};
|
|
590
|
-
r % 2 ? ownKeys(Object(t), !0).forEach(function (r) {
|
|
591
|
-
_defineProperty(e, r, t[r]);
|
|
592
|
-
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) {
|
|
593
|
-
Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r));
|
|
594
|
-
});
|
|
595
|
-
}
|
|
596
|
-
return e;
|
|
597
|
-
}
|
|
598
|
-
function _callSuper(t, o, e) {
|
|
599
|
-
return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e));
|
|
600
|
-
}
|
|
601
|
-
function _isNativeReflectConstruct() {
|
|
602
|
-
try {
|
|
603
|
-
var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {}));
|
|
604
|
-
} catch (t) {}
|
|
605
|
-
return (_isNativeReflectConstruct = function _isNativeReflectConstruct() {
|
|
606
|
-
return !!t;
|
|
607
|
-
})();
|
|
608
|
-
}
|
|
609
|
-
function _createForOfIteratorHelper(r, e) {
|
|
610
|
-
var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"];
|
|
611
|
-
if (!t) {
|
|
612
|
-
if (Array.isArray(r) || (t = _unsupportedIterableToArray(r)) || e && r && "number" == typeof r.length) {
|
|
613
|
-
t && (r = t);
|
|
614
|
-
var _n = 0,
|
|
615
|
-
F = function F() {};
|
|
616
|
-
return {
|
|
617
|
-
s: F,
|
|
618
|
-
n: function n() {
|
|
619
|
-
return _n >= r.length ? {
|
|
620
|
-
done: !0
|
|
621
|
-
} : {
|
|
622
|
-
done: !1,
|
|
623
|
-
value: r[_n++]
|
|
624
|
-
};
|
|
625
|
-
},
|
|
626
|
-
e: function e(r) {
|
|
627
|
-
throw r;
|
|
628
|
-
},
|
|
629
|
-
f: F
|
|
630
|
-
};
|
|
631
|
-
}
|
|
632
|
-
throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
633
|
-
}
|
|
634
|
-
var o,
|
|
635
|
-
a = !0,
|
|
636
|
-
u = !1;
|
|
637
|
-
return {
|
|
638
|
-
s: function s() {
|
|
639
|
-
t = t.call(r);
|
|
640
|
-
},
|
|
641
|
-
n: function n() {
|
|
642
|
-
var r = t.next();
|
|
643
|
-
return a = r.done, r;
|
|
644
|
-
},
|
|
645
|
-
e: function e(r) {
|
|
646
|
-
u = !0, o = r;
|
|
647
|
-
},
|
|
648
|
-
f: function f() {
|
|
649
|
-
try {
|
|
650
|
-
a || null == t["return"] || t["return"]();
|
|
651
|
-
} finally {
|
|
652
|
-
if (u) throw o;
|
|
653
|
-
}
|
|
654
|
-
}
|
|
655
|
-
};
|
|
656
|
-
}
|
|
657
|
-
function _unsupportedIterableToArray(r, a) {
|
|
658
|
-
if (r) {
|
|
659
|
-
if ("string" == typeof r) return _arrayLikeToArray(r, a);
|
|
660
|
-
var t = {}.toString.call(r).slice(8, -1);
|
|
661
|
-
return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0;
|
|
662
|
-
}
|
|
663
|
-
}
|
|
664
|
-
function _arrayLikeToArray(r, a) {
|
|
665
|
-
(null == a || a > r.length) && (a = r.length);
|
|
666
|
-
for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e];
|
|
667
|
-
return n;
|
|
668
|
-
}
|
|
669
|
-
var isSymbol = function isSymbol(value) {
|
|
670
|
-
return !!value && value.constructor === Symbol;
|
|
671
|
-
};
|
|
672
|
-
var isArray = Array.isArray;
|
|
673
|
-
var isObject = function isObject(value) {
|
|
674
|
-
return !!value && value.constructor === Object;
|
|
675
|
-
};
|
|
676
|
-
var isPrimitive = function isPrimitive(value) {
|
|
677
|
-
return value === void 0 || value === null || _typeof$1(value) !== "object" && typeof value !== "function";
|
|
678
|
-
};
|
|
679
|
-
var isFunction = function isFunction(value) {
|
|
680
|
-
return !!(value && value.constructor && value.call && value.apply);
|
|
681
|
-
};
|
|
682
|
-
var isString = function isString(value) {
|
|
683
|
-
return typeof value === "string" || value instanceof String;
|
|
684
|
-
};
|
|
685
|
-
var isInt = function isInt(value) {
|
|
686
|
-
return isNumber(value) && value % 1 === 0;
|
|
687
|
-
};
|
|
688
|
-
var isFloat = function isFloat(value) {
|
|
689
|
-
return isNumber(value) && value % 1 !== 0;
|
|
690
|
-
};
|
|
691
|
-
var isNumber = function isNumber(value) {
|
|
692
|
-
try {
|
|
693
|
-
return Number(value) === value;
|
|
694
|
-
} catch (_unused) {
|
|
695
|
-
return false;
|
|
696
|
-
}
|
|
697
|
-
};
|
|
698
|
-
var isDate = function isDate(value) {
|
|
699
|
-
return Object.prototype.toString.call(value) === "[object Date]";
|
|
700
|
-
};
|
|
701
|
-
var isPromise = function isPromise(value) {
|
|
702
|
-
if (!value) return false;
|
|
703
|
-
if (!value.then) return false;
|
|
704
|
-
if (!isFunction(value.then)) return false;
|
|
705
|
-
return true;
|
|
706
|
-
};
|
|
707
|
-
var isEmpty = function isEmpty(value) {
|
|
708
|
-
if (value === true || value === false) return true;
|
|
709
|
-
if (value === null || value === void 0) return true;
|
|
710
|
-
if (isNumber(value)) return value === 0;
|
|
711
|
-
if (isDate(value)) return isNaN(value.getTime());
|
|
712
|
-
if (isFunction(value)) return false;
|
|
713
|
-
if (isSymbol(value)) return false;
|
|
714
|
-
var length = value.length;
|
|
715
|
-
if (isNumber(length)) return length === 0;
|
|
716
|
-
var size = value.size;
|
|
717
|
-
if (isNumber(size)) return size === 0;
|
|
718
|
-
var keys = Object.keys(value).length;
|
|
719
|
-
return keys === 0;
|
|
720
|
-
};
|
|
721
|
-
var _isEqual = function isEqual(x, y) {
|
|
722
|
-
if (Object.is(x, y)) return true;
|
|
723
|
-
if (x instanceof Date && y instanceof Date) {
|
|
724
|
-
return x.getTime() === y.getTime();
|
|
725
|
-
}
|
|
726
|
-
if (x instanceof RegExp && y instanceof RegExp) {
|
|
727
|
-
return x.toString() === y.toString();
|
|
728
|
-
}
|
|
729
|
-
if (_typeof$1(x) !== "object" || x === null || _typeof$1(y) !== "object" || y === null) {
|
|
730
|
-
return false;
|
|
731
|
-
}
|
|
732
|
-
var keysX = Reflect.ownKeys(x);
|
|
733
|
-
var keysY = Reflect.ownKeys(y);
|
|
734
|
-
if (keysX.length !== keysY.length) return false;
|
|
735
|
-
for (var i = 0; i < keysX.length; i++) {
|
|
736
|
-
if (!Reflect.has(y, keysX[i])) return false;
|
|
737
|
-
if (!_isEqual(x[keysX[i]], y[keysX[i]])) return false;
|
|
738
|
-
}
|
|
739
|
-
return true;
|
|
740
|
-
};
|
|
741
|
-
var group = function group(array, getGroupId) {
|
|
742
|
-
return array.reduce(function (acc, item) {
|
|
743
|
-
var groupId = getGroupId(item);
|
|
744
|
-
if (!acc[groupId]) acc[groupId] = [];
|
|
745
|
-
acc[groupId].push(item);
|
|
746
|
-
return acc;
|
|
747
|
-
}, {});
|
|
748
|
-
};
|
|
749
|
-
function zip() {
|
|
750
|
-
for (var _len = arguments.length, arrays = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
751
|
-
arrays[_key] = arguments[_key];
|
|
752
|
-
}
|
|
753
|
-
if (!arrays || !arrays.length) return [];
|
|
754
|
-
return new Array(Math.max.apply(Math, _toConsumableArray(arrays.map(function (_ref) {
|
|
755
|
-
var length = _ref.length;
|
|
756
|
-
return length;
|
|
757
|
-
})))).fill([]).map(function (_, idx) {
|
|
758
|
-
return arrays.map(function (array) {
|
|
759
|
-
return array[idx];
|
|
760
|
-
});
|
|
761
|
-
});
|
|
762
|
-
}
|
|
763
|
-
function zipToObject(keys, values) {
|
|
764
|
-
if (!keys || !keys.length) {
|
|
765
|
-
return {};
|
|
766
|
-
}
|
|
767
|
-
var getValue = isFunction(values) ? values : isArray(values) ? function (_k, i) {
|
|
768
|
-
return values[i];
|
|
769
|
-
} : function (_k, _i) {
|
|
770
|
-
return values;
|
|
771
|
-
};
|
|
772
|
-
return keys.reduce(function (acc, key, idx) {
|
|
773
|
-
acc[key] = getValue(key, idx);
|
|
774
|
-
return acc;
|
|
775
|
-
}, {});
|
|
776
|
-
}
|
|
777
|
-
var boil = function boil(array, compareFunc) {
|
|
778
|
-
var _array$length;
|
|
779
|
-
if (!array || ((_array$length = array.length) !== null && _array$length !== void 0 ? _array$length : 0) === 0) return null;
|
|
780
|
-
return array.reduce(compareFunc);
|
|
781
|
-
};
|
|
782
|
-
function sum(array, fn) {
|
|
783
|
-
return (array || []).reduce(function (acc, item) {
|
|
784
|
-
return acc + (fn ? fn(item) : item);
|
|
785
|
-
}, 0);
|
|
786
|
-
}
|
|
787
|
-
var first = function first(array) {
|
|
788
|
-
var defaultValue = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : void 0;
|
|
789
|
-
return (array === null || array === void 0 ? void 0 : array.length) > 0 ? array[0] : defaultValue;
|
|
790
|
-
};
|
|
791
|
-
var last = function last(array) {
|
|
792
|
-
var defaultValue = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : void 0;
|
|
793
|
-
return (array === null || array === void 0 ? void 0 : array.length) > 0 ? array[array.length - 1] : defaultValue;
|
|
794
|
-
};
|
|
795
|
-
var sort = function sort(array, getter) {
|
|
796
|
-
var desc = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
|
|
797
|
-
if (!array) return [];
|
|
798
|
-
var asc = function asc(a, b) {
|
|
799
|
-
return getter(a) - getter(b);
|
|
800
|
-
};
|
|
801
|
-
var dsc = function dsc(a, b) {
|
|
802
|
-
return getter(b) - getter(a);
|
|
803
|
-
};
|
|
804
|
-
return array.slice().sort(desc === true ? dsc : asc);
|
|
805
|
-
};
|
|
806
|
-
var alphabetical = function alphabetical(array, getter) {
|
|
807
|
-
var dir = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : "asc";
|
|
808
|
-
if (!array) return [];
|
|
809
|
-
var asc = function asc(a, b) {
|
|
810
|
-
return "".concat(getter(a)).localeCompare(getter(b));
|
|
811
|
-
};
|
|
812
|
-
var dsc = function dsc(a, b) {
|
|
813
|
-
return "".concat(getter(b)).localeCompare(getter(a));
|
|
814
|
-
};
|
|
815
|
-
return array.slice().sort(dir === "desc" ? dsc : asc);
|
|
816
|
-
};
|
|
817
|
-
var counting = function counting(list2, identity) {
|
|
818
|
-
if (!list2) return {};
|
|
819
|
-
return list2.reduce(function (acc, item) {
|
|
820
|
-
var _acc$id;
|
|
821
|
-
var id = identity(item);
|
|
822
|
-
acc[id] = ((_acc$id = acc[id]) !== null && _acc$id !== void 0 ? _acc$id : 0) + 1;
|
|
823
|
-
return acc;
|
|
824
|
-
}, {});
|
|
825
|
-
};
|
|
826
|
-
var replace = function replace(list2, newItem, match) {
|
|
827
|
-
if (!list2) return [];
|
|
828
|
-
if (newItem === void 0) return _toConsumableArray(list2);
|
|
829
|
-
for (var idx = 0; idx < list2.length; idx++) {
|
|
830
|
-
var item = list2[idx];
|
|
831
|
-
if (match(item, idx)) {
|
|
832
|
-
return [].concat(_toConsumableArray(list2.slice(0, idx)), [newItem], _toConsumableArray(list2.slice(idx + 1, list2.length)));
|
|
833
|
-
}
|
|
834
|
-
}
|
|
835
|
-
return _toConsumableArray(list2);
|
|
836
|
-
};
|
|
837
|
-
var objectify = function objectify(array, getKey) {
|
|
838
|
-
var getValue = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : function (item) {
|
|
839
|
-
return item;
|
|
840
|
-
};
|
|
841
|
-
return array.reduce(function (acc, item) {
|
|
842
|
-
acc[getKey(item)] = getValue(item);
|
|
843
|
-
return acc;
|
|
844
|
-
}, {});
|
|
845
|
-
};
|
|
846
|
-
var select = function select(array, mapper, condition) {
|
|
847
|
-
if (!array) return [];
|
|
848
|
-
return array.reduce(function (acc, item, index) {
|
|
849
|
-
if (!condition(item, index)) return acc;
|
|
850
|
-
acc.push(mapper(item, index));
|
|
851
|
-
return acc;
|
|
852
|
-
}, []);
|
|
853
|
-
};
|
|
854
|
-
function max(array, getter) {
|
|
855
|
-
var get = getter !== null && getter !== void 0 ? getter : function (v) {
|
|
856
|
-
return v;
|
|
857
|
-
};
|
|
858
|
-
return boil(array, function (a, b) {
|
|
859
|
-
return get(a) > get(b) ? a : b;
|
|
860
|
-
});
|
|
861
|
-
}
|
|
862
|
-
function min(array, getter) {
|
|
863
|
-
var get = getter !== null && getter !== void 0 ? getter : function (v) {
|
|
864
|
-
return v;
|
|
865
|
-
};
|
|
866
|
-
return boil(array, function (a, b) {
|
|
867
|
-
return get(a) < get(b) ? a : b;
|
|
868
|
-
});
|
|
869
|
-
}
|
|
870
|
-
var cluster = function cluster(list2) {
|
|
871
|
-
var size = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 2;
|
|
872
|
-
var clusterCount = Math.ceil(list2.length / size);
|
|
873
|
-
return new Array(clusterCount).fill(null).map(function (_c, i) {
|
|
874
|
-
return list2.slice(i * size, i * size + size);
|
|
875
|
-
});
|
|
876
|
-
};
|
|
877
|
-
var unique = function unique(array, toKey) {
|
|
878
|
-
var valueMap = array.reduce(function (acc, item) {
|
|
879
|
-
var key = toKey ? toKey(item) : item;
|
|
880
|
-
if (acc[key]) return acc;
|
|
881
|
-
acc[key] = item;
|
|
882
|
-
return acc;
|
|
883
|
-
}, {});
|
|
884
|
-
return Object.values(valueMap);
|
|
885
|
-
};
|
|
886
|
-
function range(startOrLength, end) {
|
|
887
|
-
var valueOrMapper = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : function (i) {
|
|
888
|
-
return i;
|
|
889
|
-
};
|
|
890
|
-
var step = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 1;
|
|
891
|
-
return /*#__PURE__*/regenerator.mark(function _callee() {
|
|
892
|
-
var mapper, start, _final, i;
|
|
893
|
-
return regenerator.wrap(function _callee$(_context) {
|
|
894
|
-
while (1) switch (_context.prev = _context.next) {
|
|
895
|
-
case 0:
|
|
896
|
-
mapper = isFunction(valueOrMapper) ? valueOrMapper : function () {
|
|
897
|
-
return valueOrMapper;
|
|
898
|
-
};
|
|
899
|
-
start = end ? startOrLength : 0;
|
|
900
|
-
_final = end !== null && end !== void 0 ? end : startOrLength;
|
|
901
|
-
i = start;
|
|
902
|
-
case 4:
|
|
903
|
-
if (!(i <= _final)) {
|
|
904
|
-
_context.next = 12;
|
|
905
|
-
break;
|
|
906
|
-
}
|
|
907
|
-
_context.next = 7;
|
|
908
|
-
return mapper(i);
|
|
909
|
-
case 7:
|
|
910
|
-
if (!(i + step > _final)) {
|
|
911
|
-
_context.next = 9;
|
|
912
|
-
break;
|
|
913
|
-
}
|
|
914
|
-
return _context.abrupt("break", 12);
|
|
915
|
-
case 9:
|
|
916
|
-
i += step;
|
|
917
|
-
_context.next = 4;
|
|
918
|
-
break;
|
|
919
|
-
case 12:
|
|
920
|
-
case "end":
|
|
921
|
-
return _context.stop();
|
|
922
|
-
}
|
|
923
|
-
}, _callee);
|
|
924
|
-
})();
|
|
925
|
-
}
|
|
926
|
-
var list = function list(startOrLength, end, valueOrMapper, step) {
|
|
927
|
-
return Array.from(range(startOrLength, end, valueOrMapper, step));
|
|
928
|
-
};
|
|
929
|
-
var flat = function flat(lists) {
|
|
930
|
-
return lists.reduce(function (acc, list2) {
|
|
931
|
-
acc.push.apply(acc, _toConsumableArray(list2));
|
|
932
|
-
return acc;
|
|
933
|
-
}, []);
|
|
934
|
-
};
|
|
935
|
-
var intersects = function intersects(listA, listB, identity) {
|
|
936
|
-
if (!listA || !listB) return false;
|
|
937
|
-
var ident = identity !== null && identity !== void 0 ? identity : function (x) {
|
|
938
|
-
return x;
|
|
939
|
-
};
|
|
940
|
-
var dictB = listB.reduce(function (acc, item) {
|
|
941
|
-
acc[ident(item)] = true;
|
|
942
|
-
return acc;
|
|
943
|
-
}, {});
|
|
944
|
-
return listA.some(function (value) {
|
|
945
|
-
return dictB[ident(value)];
|
|
946
|
-
});
|
|
947
|
-
};
|
|
948
|
-
var fork = function fork(list2, condition) {
|
|
949
|
-
if (!list2) return [[], []];
|
|
950
|
-
return list2.reduce(function (acc, item) {
|
|
951
|
-
var _acc = _slicedToArray(acc, 2),
|
|
952
|
-
a = _acc[0],
|
|
953
|
-
b = _acc[1];
|
|
954
|
-
if (condition(item)) {
|
|
955
|
-
return [[].concat(_toConsumableArray(a), [item]), b];
|
|
956
|
-
} else {
|
|
957
|
-
return [a, [].concat(_toConsumableArray(b), [item])];
|
|
958
|
-
}
|
|
959
|
-
}, [[], []]);
|
|
960
|
-
};
|
|
961
|
-
var merge = function merge(root, others, matcher) {
|
|
962
|
-
if (!others && !root) return [];
|
|
963
|
-
if (!others) return root;
|
|
964
|
-
if (!root) return [];
|
|
965
|
-
if (!matcher) return root;
|
|
966
|
-
return root.reduce(function (acc, r) {
|
|
967
|
-
var matched = others.find(function (o) {
|
|
968
|
-
return matcher(r) === matcher(o);
|
|
969
|
-
});
|
|
970
|
-
if (matched) acc.push(matched);else acc.push(r);
|
|
971
|
-
return acc;
|
|
972
|
-
}, []);
|
|
973
|
-
};
|
|
974
|
-
var replaceOrAppend = function replaceOrAppend(list2, newItem, match) {
|
|
975
|
-
if (!list2 && !newItem) return [];
|
|
976
|
-
if (!newItem) return _toConsumableArray(list2);
|
|
977
|
-
if (!list2) return [newItem];
|
|
978
|
-
for (var idx = 0; idx < list2.length; idx++) {
|
|
979
|
-
var item = list2[idx];
|
|
980
|
-
if (match(item, idx)) {
|
|
981
|
-
return [].concat(_toConsumableArray(list2.slice(0, idx)), [newItem], _toConsumableArray(list2.slice(idx + 1, list2.length)));
|
|
982
|
-
}
|
|
983
|
-
}
|
|
984
|
-
return [].concat(_toConsumableArray(list2), [newItem]);
|
|
985
|
-
};
|
|
986
|
-
var toggle = function toggle(list2, item, toKey, options) {
|
|
987
|
-
var _options$strategy;
|
|
988
|
-
if (!list2 && !item) return [];
|
|
989
|
-
if (!list2) return [item];
|
|
990
|
-
if (!item) return _toConsumableArray(list2);
|
|
991
|
-
var matcher = toKey ? function (x, idx) {
|
|
992
|
-
return toKey(x, idx) === toKey(item, idx);
|
|
993
|
-
} : function (x) {
|
|
994
|
-
return x === item;
|
|
995
|
-
};
|
|
996
|
-
var existing = list2.find(matcher);
|
|
997
|
-
if (existing) return list2.filter(function (x, idx) {
|
|
998
|
-
return !matcher(x, idx);
|
|
999
|
-
});
|
|
1000
|
-
var strategy = (_options$strategy = options === null || options === void 0 ? void 0 : options.strategy) !== null && _options$strategy !== void 0 ? _options$strategy : "append";
|
|
1001
|
-
if (strategy === "append") return [].concat(_toConsumableArray(list2), [item]);
|
|
1002
|
-
return [item].concat(_toConsumableArray(list2));
|
|
1003
|
-
};
|
|
1004
|
-
var sift = function sift(list2) {
|
|
1005
|
-
var _list2$filter;
|
|
1006
|
-
return (_list2$filter = list2 === null || list2 === void 0 ? void 0 : list2.filter(function (x) {
|
|
1007
|
-
return !!x;
|
|
1008
|
-
})) !== null && _list2$filter !== void 0 ? _list2$filter : [];
|
|
1009
|
-
};
|
|
1010
|
-
var iterate = function iterate(count, func, initValue) {
|
|
1011
|
-
var value = initValue;
|
|
1012
|
-
for (var i = 1; i <= count; i++) {
|
|
1013
|
-
value = func(value, i);
|
|
1014
|
-
}
|
|
1015
|
-
return value;
|
|
1016
|
-
};
|
|
1017
|
-
var diff = function diff(root, other) {
|
|
1018
|
-
var identity = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : function (t) {
|
|
1019
|
-
return t;
|
|
1020
|
-
};
|
|
1021
|
-
if (!(root !== null && root !== void 0 && root.length) && !(other !== null && other !== void 0 && other.length)) return [];
|
|
1022
|
-
if ((root === null || root === void 0 ? void 0 : root.length) === void 0) return _toConsumableArray(other);
|
|
1023
|
-
if (!(other !== null && other !== void 0 && other.length)) return _toConsumableArray(root);
|
|
1024
|
-
var bKeys = other.reduce(function (acc, item) {
|
|
1025
|
-
acc[identity(item)] = true;
|
|
1026
|
-
return acc;
|
|
1027
|
-
}, {});
|
|
1028
|
-
return root.filter(function (a) {
|
|
1029
|
-
return !bKeys[identity(a)];
|
|
1030
|
-
});
|
|
1031
|
-
};
|
|
1032
|
-
function shift(arr, n) {
|
|
1033
|
-
if (arr.length === 0) return arr;
|
|
1034
|
-
var shiftNumber = n % arr.length;
|
|
1035
|
-
if (shiftNumber === 0) return arr;
|
|
1036
|
-
return [].concat(_toConsumableArray(arr.slice(-shiftNumber, arr.length)), _toConsumableArray(arr.slice(0, -shiftNumber)));
|
|
1037
|
-
}
|
|
1038
|
-
var reduce = /*#__PURE__*/function () {
|
|
1039
|
-
var _ref2 = _asyncToGenerator(/*#__PURE__*/regenerator.mark(function _callee2(array, asyncReducer, initValue) {
|
|
1040
|
-
var initProvided, iter, value, _iterator, _step, _step$value, i, item;
|
|
1041
|
-
return regenerator.wrap(function _callee2$(_context2) {
|
|
1042
|
-
while (1) switch (_context2.prev = _context2.next) {
|
|
1043
|
-
case 0:
|
|
1044
|
-
initProvided = initValue !== void 0;
|
|
1045
|
-
if (!(!initProvided && (array === null || array === void 0 ? void 0 : array.length) < 1)) {
|
|
1046
|
-
_context2.next = 3;
|
|
1047
|
-
break;
|
|
1048
|
-
}
|
|
1049
|
-
throw new Error("Cannot reduce empty array with no init value");
|
|
1050
|
-
case 3:
|
|
1051
|
-
iter = initProvided ? array : array.slice(1);
|
|
1052
|
-
value = initProvided ? initValue : array[0];
|
|
1053
|
-
_iterator = _createForOfIteratorHelper(iter.entries());
|
|
1054
|
-
_context2.prev = 6;
|
|
1055
|
-
_iterator.s();
|
|
1056
|
-
case 8:
|
|
1057
|
-
if ((_step = _iterator.n()).done) {
|
|
1058
|
-
_context2.next = 15;
|
|
1059
|
-
break;
|
|
1060
|
-
}
|
|
1061
|
-
_step$value = _slicedToArray(_step.value, 2), i = _step$value[0], item = _step$value[1];
|
|
1062
|
-
_context2.next = 12;
|
|
1063
|
-
return asyncReducer(value, item, i);
|
|
1064
|
-
case 12:
|
|
1065
|
-
value = _context2.sent;
|
|
1066
|
-
case 13:
|
|
1067
|
-
_context2.next = 8;
|
|
1068
|
-
break;
|
|
1069
|
-
case 15:
|
|
1070
|
-
_context2.next = 20;
|
|
1071
|
-
break;
|
|
1072
|
-
case 17:
|
|
1073
|
-
_context2.prev = 17;
|
|
1074
|
-
_context2.t0 = _context2["catch"](6);
|
|
1075
|
-
_iterator.e(_context2.t0);
|
|
1076
|
-
case 20:
|
|
1077
|
-
_context2.prev = 20;
|
|
1078
|
-
_iterator.f();
|
|
1079
|
-
return _context2.finish(20);
|
|
1080
|
-
case 23:
|
|
1081
|
-
return _context2.abrupt("return", value);
|
|
1082
|
-
case 24:
|
|
1083
|
-
case "end":
|
|
1084
|
-
return _context2.stop();
|
|
1085
|
-
}
|
|
1086
|
-
}, _callee2, null, [[6, 17, 20, 23]]);
|
|
1087
|
-
}));
|
|
1088
|
-
return function reduce(_x, _x2, _x3) {
|
|
1089
|
-
return _ref2.apply(this, arguments);
|
|
1090
|
-
};
|
|
1091
|
-
}();
|
|
1092
|
-
var map = /*#__PURE__*/function () {
|
|
1093
|
-
var _ref3 = _asyncToGenerator(/*#__PURE__*/regenerator.mark(function _callee3(array, asyncMapFunc) {
|
|
1094
|
-
var result, index, _iterator2, _step2, value, newValue;
|
|
1095
|
-
return regenerator.wrap(function _callee3$(_context3) {
|
|
1096
|
-
while (1) switch (_context3.prev = _context3.next) {
|
|
1097
|
-
case 0:
|
|
1098
|
-
if (array) {
|
|
1099
|
-
_context3.next = 2;
|
|
1100
|
-
break;
|
|
1101
|
-
}
|
|
1102
|
-
return _context3.abrupt("return", []);
|
|
1103
|
-
case 2:
|
|
1104
|
-
result = [];
|
|
1105
|
-
index = 0;
|
|
1106
|
-
_iterator2 = _createForOfIteratorHelper(array);
|
|
1107
|
-
_context3.prev = 5;
|
|
1108
|
-
_iterator2.s();
|
|
1109
|
-
case 7:
|
|
1110
|
-
if ((_step2 = _iterator2.n()).done) {
|
|
1111
|
-
_context3.next = 15;
|
|
1112
|
-
break;
|
|
1113
|
-
}
|
|
1114
|
-
value = _step2.value;
|
|
1115
|
-
_context3.next = 11;
|
|
1116
|
-
return asyncMapFunc(value, index++);
|
|
1117
|
-
case 11:
|
|
1118
|
-
newValue = _context3.sent;
|
|
1119
|
-
result.push(newValue);
|
|
1120
|
-
case 13:
|
|
1121
|
-
_context3.next = 7;
|
|
1122
|
-
break;
|
|
1123
|
-
case 15:
|
|
1124
|
-
_context3.next = 20;
|
|
1125
|
-
break;
|
|
1126
|
-
case 17:
|
|
1127
|
-
_context3.prev = 17;
|
|
1128
|
-
_context3.t0 = _context3["catch"](5);
|
|
1129
|
-
_iterator2.e(_context3.t0);
|
|
1130
|
-
case 20:
|
|
1131
|
-
_context3.prev = 20;
|
|
1132
|
-
_iterator2.f();
|
|
1133
|
-
return _context3.finish(20);
|
|
1134
|
-
case 23:
|
|
1135
|
-
return _context3.abrupt("return", result);
|
|
1136
|
-
case 24:
|
|
1137
|
-
case "end":
|
|
1138
|
-
return _context3.stop();
|
|
1139
|
-
}
|
|
1140
|
-
}, _callee3, null, [[5, 17, 20, 23]]);
|
|
1141
|
-
}));
|
|
1142
|
-
return function map(_x4, _x5) {
|
|
1143
|
-
return _ref3.apply(this, arguments);
|
|
1144
|
-
};
|
|
1145
|
-
}();
|
|
1146
|
-
var defer = /*#__PURE__*/function () {
|
|
1147
|
-
var _ref4 = _asyncToGenerator(/*#__PURE__*/regenerator.mark(function _callee4(func) {
|
|
1148
|
-
var callbacks, register, _yield$tryit, _yield$tryit2, err, response, _i2, _callbacks, _callbacks$_i, fn, rethrow, _yield$tryit3, _yield$tryit4, rethrown;
|
|
1149
|
-
return regenerator.wrap(function _callee4$(_context4) {
|
|
1150
|
-
while (1) switch (_context4.prev = _context4.next) {
|
|
1151
|
-
case 0:
|
|
1152
|
-
callbacks = [];
|
|
1153
|
-
register = function register(fn, options) {
|
|
1154
|
-
var _options$rethrow;
|
|
1155
|
-
return callbacks.push({
|
|
1156
|
-
fn: fn,
|
|
1157
|
-
rethrow: (_options$rethrow = options === null || options === void 0 ? void 0 : options.rethrow) !== null && _options$rethrow !== void 0 ? _options$rethrow : false
|
|
1158
|
-
});
|
|
1159
|
-
};
|
|
1160
|
-
_context4.next = 4;
|
|
1161
|
-
return tryit(func)(register);
|
|
1162
|
-
case 4:
|
|
1163
|
-
_yield$tryit = _context4.sent;
|
|
1164
|
-
_yield$tryit2 = _slicedToArray(_yield$tryit, 2);
|
|
1165
|
-
err = _yield$tryit2[0];
|
|
1166
|
-
response = _yield$tryit2[1];
|
|
1167
|
-
_i2 = 0, _callbacks = callbacks;
|
|
1168
|
-
case 9:
|
|
1169
|
-
if (!(_i2 < _callbacks.length)) {
|
|
1170
|
-
_context4.next = 21;
|
|
1171
|
-
break;
|
|
1172
|
-
}
|
|
1173
|
-
_callbacks$_i = _callbacks[_i2], fn = _callbacks$_i.fn, rethrow = _callbacks$_i.rethrow;
|
|
1174
|
-
_context4.next = 13;
|
|
1175
|
-
return tryit(fn)(err);
|
|
1176
|
-
case 13:
|
|
1177
|
-
_yield$tryit3 = _context4.sent;
|
|
1178
|
-
_yield$tryit4 = _slicedToArray(_yield$tryit3, 1);
|
|
1179
|
-
rethrown = _yield$tryit4[0];
|
|
1180
|
-
if (!(rethrown && rethrow)) {
|
|
1181
|
-
_context4.next = 18;
|
|
1182
|
-
break;
|
|
1183
|
-
}
|
|
1184
|
-
throw rethrown;
|
|
1185
|
-
case 18:
|
|
1186
|
-
_i2++;
|
|
1187
|
-
_context4.next = 9;
|
|
1188
|
-
break;
|
|
1189
|
-
case 21:
|
|
1190
|
-
if (!err) {
|
|
1191
|
-
_context4.next = 23;
|
|
1192
|
-
break;
|
|
1193
|
-
}
|
|
1194
|
-
throw err;
|
|
1195
|
-
case 23:
|
|
1196
|
-
return _context4.abrupt("return", response);
|
|
1197
|
-
case 24:
|
|
1198
|
-
case "end":
|
|
1199
|
-
return _context4.stop();
|
|
1200
|
-
}
|
|
1201
|
-
}, _callee4);
|
|
1202
|
-
}));
|
|
1203
|
-
return function defer(_x6) {
|
|
1204
|
-
return _ref4.apply(this, arguments);
|
|
1205
|
-
};
|
|
1206
|
-
}();
|
|
1207
|
-
var AggregateError = /*#__PURE__*/function (_Error) {
|
|
1208
|
-
function AggregateError() {
|
|
1209
|
-
var _errors$find$name, _errors$find, _errors$find$stack, _errors$find2;
|
|
1210
|
-
var _this;
|
|
1211
|
-
var errors = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
|
1212
|
-
_classCallCheck(this, AggregateError);
|
|
1213
|
-
_this = _callSuper(this, AggregateError);
|
|
1214
|
-
var name = (_errors$find$name = (_errors$find = errors.find(function (e) {
|
|
1215
|
-
return e.name;
|
|
1216
|
-
})) === null || _errors$find === void 0 ? void 0 : _errors$find.name) !== null && _errors$find$name !== void 0 ? _errors$find$name : "";
|
|
1217
|
-
_this.name = "AggregateError(".concat(name, "...)");
|
|
1218
|
-
_this.message = "AggregateError with ".concat(errors.length, " errors");
|
|
1219
|
-
_this.stack = (_errors$find$stack = (_errors$find2 = errors.find(function (e) {
|
|
1220
|
-
return e.stack;
|
|
1221
|
-
})) === null || _errors$find2 === void 0 ? void 0 : _errors$find2.stack) !== null && _errors$find$stack !== void 0 ? _errors$find$stack : _this.stack;
|
|
1222
|
-
_this.errors = errors;
|
|
1223
|
-
return _this;
|
|
1224
|
-
}
|
|
1225
|
-
_inherits(AggregateError, _Error);
|
|
1226
|
-
return _createClass(AggregateError);
|
|
1227
|
-
}(/*#__PURE__*/_wrapNativeSuper(Error));
|
|
1228
|
-
var parallel = /*#__PURE__*/function () {
|
|
1229
|
-
var _ref5 = _asyncToGenerator(/*#__PURE__*/regenerator.mark(function _callee6(limit, array, func) {
|
|
1230
|
-
var work, processor, queues, itemResults, _fork, _fork2, errors, results;
|
|
1231
|
-
return regenerator.wrap(function _callee6$(_context6) {
|
|
1232
|
-
while (1) switch (_context6.prev = _context6.next) {
|
|
1233
|
-
case 0:
|
|
1234
|
-
work = array.map(function (item, index) {
|
|
1235
|
-
return {
|
|
1236
|
-
index: index,
|
|
1237
|
-
item: item
|
|
1238
|
-
};
|
|
1239
|
-
});
|
|
1240
|
-
processor = /*#__PURE__*/function () {
|
|
1241
|
-
var _ref6 = _asyncToGenerator(/*#__PURE__*/regenerator.mark(function _callee5(res) {
|
|
1242
|
-
var results2, next, _yield$tryit5, _yield$tryit6, error, result;
|
|
1243
|
-
return regenerator.wrap(function _callee5$(_context5) {
|
|
1244
|
-
while (1) switch (_context5.prev = _context5.next) {
|
|
1245
|
-
case 0:
|
|
1246
|
-
results2 = [];
|
|
1247
|
-
case 1:
|
|
1248
|
-
next = work.pop();
|
|
1249
|
-
if (next) {
|
|
1250
|
-
_context5.next = 5;
|
|
1251
|
-
break;
|
|
1252
|
-
}
|
|
1253
|
-
return _context5.abrupt("return", res(results2));
|
|
1254
|
-
case 5:
|
|
1255
|
-
_context5.next = 7;
|
|
1256
|
-
return tryit(func)(next.item);
|
|
1257
|
-
case 7:
|
|
1258
|
-
_yield$tryit5 = _context5.sent;
|
|
1259
|
-
_yield$tryit6 = _slicedToArray(_yield$tryit5, 2);
|
|
1260
|
-
error = _yield$tryit6[0];
|
|
1261
|
-
result = _yield$tryit6[1];
|
|
1262
|
-
results2.push({
|
|
1263
|
-
error: error,
|
|
1264
|
-
result: result,
|
|
1265
|
-
index: next.index
|
|
1266
|
-
});
|
|
1267
|
-
_context5.next = 1;
|
|
1268
|
-
break;
|
|
1269
|
-
case 14:
|
|
1270
|
-
case "end":
|
|
1271
|
-
return _context5.stop();
|
|
1272
|
-
}
|
|
1273
|
-
}, _callee5);
|
|
1274
|
-
}));
|
|
1275
|
-
return function processor(_x10) {
|
|
1276
|
-
return _ref6.apply(this, arguments);
|
|
1277
|
-
};
|
|
1278
|
-
}();
|
|
1279
|
-
queues = list(1, limit).map(function () {
|
|
1280
|
-
return new Promise(processor);
|
|
1281
|
-
});
|
|
1282
|
-
_context6.next = 5;
|
|
1283
|
-
return Promise.all(queues);
|
|
1284
|
-
case 5:
|
|
1285
|
-
itemResults = _context6.sent;
|
|
1286
|
-
_fork = fork(sort(itemResults.flat(), function (r) {
|
|
1287
|
-
return r.index;
|
|
1288
|
-
}), function (x) {
|
|
1289
|
-
return !!x.error;
|
|
1290
|
-
}), _fork2 = _slicedToArray(_fork, 2), errors = _fork2[0], results = _fork2[1];
|
|
1291
|
-
if (!(errors.length > 0)) {
|
|
1292
|
-
_context6.next = 9;
|
|
1293
|
-
break;
|
|
1294
|
-
}
|
|
1295
|
-
throw new AggregateError(errors.map(function (error) {
|
|
1296
|
-
return error.error;
|
|
1297
|
-
}));
|
|
1298
|
-
case 9:
|
|
1299
|
-
return _context6.abrupt("return", results.map(function (r) {
|
|
1300
|
-
return r.result;
|
|
1301
|
-
}));
|
|
1302
|
-
case 10:
|
|
1303
|
-
case "end":
|
|
1304
|
-
return _context6.stop();
|
|
1305
|
-
}
|
|
1306
|
-
}, _callee6);
|
|
1307
|
-
}));
|
|
1308
|
-
return function parallel(_x7, _x8, _x9) {
|
|
1309
|
-
return _ref5.apply(this, arguments);
|
|
1310
|
-
};
|
|
1311
|
-
}();
|
|
1312
|
-
function all(_x11) {
|
|
1313
|
-
return _all.apply(this, arguments);
|
|
1314
|
-
}
|
|
1315
|
-
function _all() {
|
|
1316
|
-
_all = _asyncToGenerator(/*#__PURE__*/regenerator.mark(function _callee11(promises) {
|
|
1317
|
-
var entries, results, exceptions;
|
|
1318
|
-
return regenerator.wrap(function _callee11$(_context11) {
|
|
1319
|
-
while (1) switch (_context11.prev = _context11.next) {
|
|
1320
|
-
case 0:
|
|
1321
|
-
entries = isArray(promises) ? promises.map(function (p) {
|
|
1322
|
-
return [null, p];
|
|
1323
|
-
}) : Object.entries(promises);
|
|
1324
|
-
_context11.next = 3;
|
|
1325
|
-
return Promise.all(entries.map(function (_ref19) {
|
|
1326
|
-
var _ref20 = _slicedToArray(_ref19, 2),
|
|
1327
|
-
key = _ref20[0],
|
|
1328
|
-
value = _ref20[1];
|
|
1329
|
-
return value.then(function (result) {
|
|
1330
|
-
return {
|
|
1331
|
-
result: result,
|
|
1332
|
-
exc: null,
|
|
1333
|
-
key: key
|
|
1334
|
-
};
|
|
1335
|
-
})["catch"](function (exc) {
|
|
1336
|
-
return {
|
|
1337
|
-
result: null,
|
|
1338
|
-
exc: exc,
|
|
1339
|
-
key: key
|
|
1340
|
-
};
|
|
1341
|
-
});
|
|
1342
|
-
}));
|
|
1343
|
-
case 3:
|
|
1344
|
-
results = _context11.sent;
|
|
1345
|
-
exceptions = results.filter(function (r) {
|
|
1346
|
-
return r.exc;
|
|
1347
|
-
});
|
|
1348
|
-
if (!(exceptions.length > 0)) {
|
|
1349
|
-
_context11.next = 7;
|
|
1350
|
-
break;
|
|
1351
|
-
}
|
|
1352
|
-
throw new AggregateError(exceptions.map(function (e) {
|
|
1353
|
-
return e.exc;
|
|
1354
|
-
}));
|
|
1355
|
-
case 7:
|
|
1356
|
-
if (!isArray(promises)) {
|
|
1357
|
-
_context11.next = 9;
|
|
1358
|
-
break;
|
|
1359
|
-
}
|
|
1360
|
-
return _context11.abrupt("return", results.map(function (r) {
|
|
1361
|
-
return r.result;
|
|
1362
|
-
}));
|
|
1363
|
-
case 9:
|
|
1364
|
-
return _context11.abrupt("return", results.reduce(function (acc, item) {
|
|
1365
|
-
return _objectSpread(_objectSpread({}, acc), {}, _defineProperty({}, item.key, item.result));
|
|
1366
|
-
}, {}));
|
|
1367
|
-
case 10:
|
|
1368
|
-
case "end":
|
|
1369
|
-
return _context11.stop();
|
|
1370
|
-
}
|
|
1371
|
-
}, _callee11);
|
|
1372
|
-
}));
|
|
1373
|
-
return _all.apply(this, arguments);
|
|
1374
|
-
}
|
|
1375
|
-
var retry = /*#__PURE__*/function () {
|
|
1376
|
-
var _ref7 = _asyncToGenerator(/*#__PURE__*/regenerator.mark(function _callee7(options, func) {
|
|
1377
|
-
var _options$times, _options$backoff;
|
|
1378
|
-
var times, delay, backoff, _iterator3, _step3, i, _yield$tryit7, _yield$tryit8, err, result;
|
|
1379
|
-
return regenerator.wrap(function _callee7$(_context7) {
|
|
1380
|
-
while (1) switch (_context7.prev = _context7.next) {
|
|
1381
|
-
case 0:
|
|
1382
|
-
times = (_options$times = options === null || options === void 0 ? void 0 : options.times) !== null && _options$times !== void 0 ? _options$times : 3;
|
|
1383
|
-
delay = options === null || options === void 0 ? void 0 : options.delay;
|
|
1384
|
-
backoff = (_options$backoff = options === null || options === void 0 ? void 0 : options.backoff) !== null && _options$backoff !== void 0 ? _options$backoff : null;
|
|
1385
|
-
_iterator3 = _createForOfIteratorHelper(range(1, times));
|
|
1386
|
-
_context7.prev = 4;
|
|
1387
|
-
_iterator3.s();
|
|
1388
|
-
case 6:
|
|
1389
|
-
if ((_step3 = _iterator3.n()).done) {
|
|
1390
|
-
_context7.next = 28;
|
|
1391
|
-
break;
|
|
1392
|
-
}
|
|
1393
|
-
i = _step3.value;
|
|
1394
|
-
_context7.next = 10;
|
|
1395
|
-
return tryit(func)(function (err2) {
|
|
1396
|
-
throw {
|
|
1397
|
-
_exited: err2
|
|
1398
|
-
};
|
|
1399
|
-
});
|
|
1400
|
-
case 10:
|
|
1401
|
-
_yield$tryit7 = _context7.sent;
|
|
1402
|
-
_yield$tryit8 = _slicedToArray(_yield$tryit7, 2);
|
|
1403
|
-
err = _yield$tryit8[0];
|
|
1404
|
-
result = _yield$tryit8[1];
|
|
1405
|
-
if (err) {
|
|
1406
|
-
_context7.next = 16;
|
|
1407
|
-
break;
|
|
1408
|
-
}
|
|
1409
|
-
return _context7.abrupt("return", result);
|
|
1410
|
-
case 16:
|
|
1411
|
-
if (!err._exited) {
|
|
1412
|
-
_context7.next = 18;
|
|
1413
|
-
break;
|
|
1414
|
-
}
|
|
1415
|
-
throw err._exited;
|
|
1416
|
-
case 18:
|
|
1417
|
-
if (!(i === times)) {
|
|
1418
|
-
_context7.next = 20;
|
|
1419
|
-
break;
|
|
1420
|
-
}
|
|
1421
|
-
throw err;
|
|
1422
|
-
case 20:
|
|
1423
|
-
if (!delay) {
|
|
1424
|
-
_context7.next = 23;
|
|
1425
|
-
break;
|
|
1426
|
-
}
|
|
1427
|
-
_context7.next = 23;
|
|
1428
|
-
return sleep(delay);
|
|
1429
|
-
case 23:
|
|
1430
|
-
if (!backoff) {
|
|
1431
|
-
_context7.next = 26;
|
|
1432
|
-
break;
|
|
1433
|
-
}
|
|
1434
|
-
_context7.next = 26;
|
|
1435
|
-
return sleep(backoff(i));
|
|
1436
|
-
case 26:
|
|
1437
|
-
_context7.next = 6;
|
|
1438
|
-
break;
|
|
1439
|
-
case 28:
|
|
1440
|
-
_context7.next = 33;
|
|
1441
|
-
break;
|
|
1442
|
-
case 30:
|
|
1443
|
-
_context7.prev = 30;
|
|
1444
|
-
_context7.t0 = _context7["catch"](4);
|
|
1445
|
-
_iterator3.e(_context7.t0);
|
|
1446
|
-
case 33:
|
|
1447
|
-
_context7.prev = 33;
|
|
1448
|
-
_iterator3.f();
|
|
1449
|
-
return _context7.finish(33);
|
|
1450
|
-
case 36:
|
|
1451
|
-
return _context7.abrupt("return", void 0);
|
|
1452
|
-
case 37:
|
|
1453
|
-
case "end":
|
|
1454
|
-
return _context7.stop();
|
|
1455
|
-
}
|
|
1456
|
-
}, _callee7, null, [[4, 30, 33, 36]]);
|
|
1457
|
-
}));
|
|
1458
|
-
return function retry(_x12, _x13) {
|
|
1459
|
-
return _ref7.apply(this, arguments);
|
|
1460
|
-
};
|
|
1461
|
-
}();
|
|
1462
|
-
var sleep = function sleep(milliseconds) {
|
|
1463
|
-
return new Promise(function (res) {
|
|
1464
|
-
return setTimeout(res, milliseconds);
|
|
1465
|
-
});
|
|
1466
|
-
};
|
|
1467
|
-
var tryit = function tryit(func) {
|
|
1468
|
-
return function () {
|
|
1469
|
-
try {
|
|
1470
|
-
var result = func.apply(void 0, arguments);
|
|
1471
|
-
if (isPromise(result)) {
|
|
1472
|
-
return result.then(function (value) {
|
|
1473
|
-
return [void 0, value];
|
|
1474
|
-
})["catch"](function (err) {
|
|
1475
|
-
return [err, void 0];
|
|
1476
|
-
});
|
|
1477
|
-
}
|
|
1478
|
-
return [void 0, result];
|
|
1479
|
-
} catch (err) {
|
|
1480
|
-
return [err, void 0];
|
|
1481
|
-
}
|
|
1482
|
-
};
|
|
1483
|
-
};
|
|
1484
|
-
var guard = function guard(func, shouldGuard) {
|
|
1485
|
-
var _guard = function _guard(err) {
|
|
1486
|
-
if (shouldGuard && !shouldGuard(err)) throw err;
|
|
1487
|
-
return void 0;
|
|
1488
|
-
};
|
|
1489
|
-
var isPromise2 = function isPromise2(result) {
|
|
1490
|
-
return result instanceof Promise;
|
|
1491
|
-
};
|
|
1492
|
-
try {
|
|
1493
|
-
var result = func();
|
|
1494
|
-
return isPromise2(result) ? result["catch"](_guard) : result;
|
|
1495
|
-
} catch (err) {
|
|
1496
|
-
return _guard(err);
|
|
1497
|
-
}
|
|
1498
|
-
};
|
|
1499
|
-
function chain() {
|
|
1500
|
-
for (var _len2 = arguments.length, funcs = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
|
|
1501
|
-
funcs[_key2] = arguments[_key2];
|
|
1502
|
-
}
|
|
1503
|
-
return function () {
|
|
1504
|
-
return funcs.slice(1).reduce(function (acc, fn) {
|
|
1505
|
-
return fn(acc);
|
|
1506
|
-
}, funcs[0].apply(funcs, arguments));
|
|
1507
|
-
};
|
|
1508
|
-
}
|
|
1509
|
-
function compose() {
|
|
1510
|
-
for (var _len3 = arguments.length, funcs = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {
|
|
1511
|
-
funcs[_key3] = arguments[_key3];
|
|
1512
|
-
}
|
|
1513
|
-
return funcs.reverse().reduce(function (acc, fn) {
|
|
1514
|
-
return fn(acc);
|
|
1515
|
-
});
|
|
1516
|
-
}
|
|
1517
|
-
var partial = function partial(fn) {
|
|
1518
|
-
for (var _len4 = arguments.length, args = new Array(_len4 > 1 ? _len4 - 1 : 0), _key4 = 1; _key4 < _len4; _key4++) {
|
|
1519
|
-
args[_key4 - 1] = arguments[_key4];
|
|
1520
|
-
}
|
|
1521
|
-
return function () {
|
|
1522
|
-
for (var _len5 = arguments.length, rest = new Array(_len5), _key5 = 0; _key5 < _len5; _key5++) {
|
|
1523
|
-
rest[_key5] = arguments[_key5];
|
|
1524
|
-
}
|
|
1525
|
-
return fn.apply(void 0, [].concat(args, rest));
|
|
1526
|
-
};
|
|
1527
|
-
};
|
|
1528
|
-
var partob = function partob(fn, argobj) {
|
|
1529
|
-
return function (restobj) {
|
|
1530
|
-
return fn(_objectSpread(_objectSpread({}, argobj), restobj));
|
|
1531
|
-
};
|
|
1532
|
-
};
|
|
1533
|
-
var proxied = function proxied(handler) {
|
|
1534
|
-
return new Proxy({}, {
|
|
1535
|
-
get: function get(target, propertyName) {
|
|
1536
|
-
return handler(propertyName);
|
|
1537
|
-
}
|
|
1538
|
-
});
|
|
1539
|
-
};
|
|
1540
|
-
var memoize = function memoize(cache, func, keyFunc, ttl) {
|
|
1541
|
-
return function callWithMemo() {
|
|
1542
|
-
for (var _len6 = arguments.length, args = new Array(_len6), _key6 = 0; _key6 < _len6; _key6++) {
|
|
1543
|
-
args[_key6] = arguments[_key6];
|
|
1544
|
-
}
|
|
1545
|
-
var key = keyFunc ? keyFunc.apply(void 0, args) : JSON.stringify({
|
|
1546
|
-
args: args
|
|
1547
|
-
});
|
|
1548
|
-
var existing = cache[key];
|
|
1549
|
-
if (existing !== void 0) {
|
|
1550
|
-
if (!existing.exp) return existing.value;
|
|
1551
|
-
if (existing.exp > new Date().getTime()) {
|
|
1552
|
-
return existing.value;
|
|
1553
|
-
}
|
|
1554
|
-
}
|
|
1555
|
-
var result = func.apply(void 0, args);
|
|
1556
|
-
cache[key] = {
|
|
1557
|
-
exp: ttl ? new Date().getTime() + ttl : null,
|
|
1558
|
-
value: result
|
|
1559
|
-
};
|
|
1560
|
-
return result;
|
|
1561
|
-
};
|
|
1562
|
-
};
|
|
1563
|
-
var memo = function memo(func) {
|
|
1564
|
-
var _options$key, _options$ttl;
|
|
1565
|
-
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
1566
|
-
return memoize({}, func, (_options$key = options.key) !== null && _options$key !== void 0 ? _options$key : null, (_options$ttl = options.ttl) !== null && _options$ttl !== void 0 ? _options$ttl : null);
|
|
1567
|
-
};
|
|
1568
|
-
var debounce = function debounce(_ref8, func) {
|
|
1569
|
-
var delay = _ref8.delay;
|
|
1570
|
-
var timer = void 0;
|
|
1571
|
-
var active = true;
|
|
1572
|
-
var debounced = function debounced() {
|
|
1573
|
-
for (var _len7 = arguments.length, args = new Array(_len7), _key7 = 0; _key7 < _len7; _key7++) {
|
|
1574
|
-
args[_key7] = arguments[_key7];
|
|
1575
|
-
}
|
|
1576
|
-
if (active) {
|
|
1577
|
-
clearTimeout(timer);
|
|
1578
|
-
timer = setTimeout(function () {
|
|
1579
|
-
active && func.apply(void 0, args);
|
|
1580
|
-
timer = void 0;
|
|
1581
|
-
}, delay);
|
|
1582
|
-
} else {
|
|
1583
|
-
func.apply(void 0, args);
|
|
1584
|
-
}
|
|
1585
|
-
};
|
|
1586
|
-
debounced.isPending = function () {
|
|
1587
|
-
return timer !== void 0;
|
|
1588
|
-
};
|
|
1589
|
-
debounced.cancel = function () {
|
|
1590
|
-
active = false;
|
|
1591
|
-
};
|
|
1592
|
-
debounced.flush = function () {
|
|
1593
|
-
return func.apply(void 0, arguments);
|
|
1594
|
-
};
|
|
1595
|
-
return debounced;
|
|
1596
|
-
};
|
|
1597
|
-
var throttle = function throttle(_ref9, func) {
|
|
1598
|
-
var interval = _ref9.interval;
|
|
1599
|
-
var ready = true;
|
|
1600
|
-
var timer = void 0;
|
|
1601
|
-
var throttled = function throttled() {
|
|
1602
|
-
if (!ready) return;
|
|
1603
|
-
func.apply(void 0, arguments);
|
|
1604
|
-
ready = false;
|
|
1605
|
-
timer = setTimeout(function () {
|
|
1606
|
-
ready = true;
|
|
1607
|
-
timer = void 0;
|
|
1608
|
-
}, interval);
|
|
1609
|
-
};
|
|
1610
|
-
throttled.isThrottled = function () {
|
|
1611
|
-
return timer !== void 0;
|
|
1612
|
-
};
|
|
1613
|
-
return throttled;
|
|
1614
|
-
};
|
|
1615
|
-
var callable = function callable(obj, fn) {
|
|
1616
|
-
var FUNC = function FUNC() {};
|
|
1617
|
-
return new Proxy(Object.assign(FUNC, obj), {
|
|
1618
|
-
get: function get(target, key) {
|
|
1619
|
-
return target[key];
|
|
1620
|
-
},
|
|
1621
|
-
set: function set(target, key, value) {
|
|
1622
|
-
target[key] = value;
|
|
1623
|
-
return true;
|
|
1624
|
-
},
|
|
1625
|
-
apply: function apply(target, self, args) {
|
|
1626
|
-
return fn(Object.assign({}, target)).apply(void 0, _toConsumableArray(args));
|
|
1627
|
-
}
|
|
1628
|
-
});
|
|
1629
|
-
};
|
|
1630
|
-
function inRange(number, start, end) {
|
|
1631
|
-
var isTypeSafe = typeof number === "number" && typeof start === "number" && (typeof end === "undefined" || typeof end === "number");
|
|
1632
|
-
if (!isTypeSafe) {
|
|
1633
|
-
return false;
|
|
1634
|
-
}
|
|
1635
|
-
if (typeof end === "undefined") {
|
|
1636
|
-
end = start;
|
|
1637
|
-
start = 0;
|
|
1638
|
-
}
|
|
1639
|
-
return number >= Math.min(start, end) && number < Math.max(start, end);
|
|
1640
|
-
}
|
|
1641
|
-
var toFloat = function toFloat(value, defaultValue) {
|
|
1642
|
-
var def = defaultValue === void 0 ? 0 : defaultValue;
|
|
1643
|
-
if (value === null || value === void 0) {
|
|
1644
|
-
return def;
|
|
1645
|
-
}
|
|
1646
|
-
var result = parseFloat(value);
|
|
1647
|
-
return isNaN(result) ? def : result;
|
|
1648
|
-
};
|
|
1649
|
-
var toInt = function toInt(value, defaultValue) {
|
|
1650
|
-
var def = defaultValue === void 0 ? 0 : defaultValue;
|
|
1651
|
-
if (value === null || value === void 0) {
|
|
1652
|
-
return def;
|
|
1653
|
-
}
|
|
1654
|
-
var result = parseInt(value);
|
|
1655
|
-
return isNaN(result) ? def : result;
|
|
1656
|
-
};
|
|
1657
|
-
var shake = function shake(obj) {
|
|
1658
|
-
var filter = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : function (x) {
|
|
1659
|
-
return x === void 0;
|
|
1660
|
-
};
|
|
1661
|
-
if (!obj) return {};
|
|
1662
|
-
var keys2 = Object.keys(obj);
|
|
1663
|
-
return keys2.reduce(function (acc, key) {
|
|
1664
|
-
if (filter(obj[key])) {
|
|
1665
|
-
return acc;
|
|
1666
|
-
} else {
|
|
1667
|
-
acc[key] = obj[key];
|
|
1668
|
-
return acc;
|
|
1669
|
-
}
|
|
1670
|
-
}, {});
|
|
1671
|
-
};
|
|
1672
|
-
var mapKeys = function mapKeys(obj, mapFunc) {
|
|
1673
|
-
var keys2 = Object.keys(obj);
|
|
1674
|
-
return keys2.reduce(function (acc, key) {
|
|
1675
|
-
acc[mapFunc(key, obj[key])] = obj[key];
|
|
1676
|
-
return acc;
|
|
1677
|
-
}, {});
|
|
1678
|
-
};
|
|
1679
|
-
var mapValues = function mapValues(obj, mapFunc) {
|
|
1680
|
-
var keys2 = Object.keys(obj);
|
|
1681
|
-
return keys2.reduce(function (acc, key) {
|
|
1682
|
-
acc[key] = mapFunc(obj[key], key);
|
|
1683
|
-
return acc;
|
|
1684
|
-
}, {});
|
|
1685
|
-
};
|
|
1686
|
-
var mapEntries = function mapEntries(obj, toEntry) {
|
|
1687
|
-
if (!obj) return {};
|
|
1688
|
-
return Object.entries(obj).reduce(function (acc, _ref10) {
|
|
1689
|
-
var _ref11 = _slicedToArray(_ref10, 2),
|
|
1690
|
-
key = _ref11[0],
|
|
1691
|
-
value = _ref11[1];
|
|
1692
|
-
var _toEntry = toEntry(key, value),
|
|
1693
|
-
_toEntry2 = _slicedToArray(_toEntry, 2),
|
|
1694
|
-
newKey = _toEntry2[0],
|
|
1695
|
-
newValue = _toEntry2[1];
|
|
1696
|
-
acc[newKey] = newValue;
|
|
1697
|
-
return acc;
|
|
1698
|
-
}, {});
|
|
1699
|
-
};
|
|
1700
|
-
var invert = function invert(obj) {
|
|
1701
|
-
if (!obj) return {};
|
|
1702
|
-
var keys2 = Object.keys(obj);
|
|
1703
|
-
return keys2.reduce(function (acc, key) {
|
|
1704
|
-
acc[obj[key]] = key;
|
|
1705
|
-
return acc;
|
|
1706
|
-
}, {});
|
|
1707
|
-
};
|
|
1708
|
-
var lowerize = function lowerize(obj) {
|
|
1709
|
-
return mapKeys(obj, function (k) {
|
|
1710
|
-
return k.toLowerCase();
|
|
1711
|
-
});
|
|
1712
|
-
};
|
|
1713
|
-
var upperize = function upperize(obj) {
|
|
1714
|
-
return mapKeys(obj, function (k) {
|
|
1715
|
-
return k.toUpperCase();
|
|
1716
|
-
});
|
|
1717
|
-
};
|
|
1718
|
-
var clone = function clone(obj) {
|
|
1719
|
-
if (isPrimitive(obj)) {
|
|
1720
|
-
return obj;
|
|
1721
|
-
}
|
|
1722
|
-
if (typeof obj === "function") {
|
|
1723
|
-
return obj.bind({});
|
|
1724
|
-
}
|
|
1725
|
-
var newObj = new obj.constructor();
|
|
1726
|
-
Object.getOwnPropertyNames(obj).forEach(function (prop) {
|
|
1727
|
-
newObj[prop] = obj[prop];
|
|
1728
|
-
});
|
|
1729
|
-
return newObj;
|
|
1730
|
-
};
|
|
1731
|
-
var listify = function listify(obj, toItem) {
|
|
1732
|
-
if (!obj) return [];
|
|
1733
|
-
var entries = Object.entries(obj);
|
|
1734
|
-
if (entries.length === 0) return [];
|
|
1735
|
-
return entries.reduce(function (acc, entry) {
|
|
1736
|
-
acc.push(toItem(entry[0], entry[1]));
|
|
1737
|
-
return acc;
|
|
1738
|
-
}, []);
|
|
1739
|
-
};
|
|
1740
|
-
var pick = function pick(obj, keys2) {
|
|
1741
|
-
if (!obj) return {};
|
|
1742
|
-
return keys2.reduce(function (acc, key) {
|
|
1743
|
-
if (Object.prototype.hasOwnProperty.call(obj, key)) acc[key] = obj[key];
|
|
1744
|
-
return acc;
|
|
1745
|
-
}, {});
|
|
1746
|
-
};
|
|
1747
|
-
var omit = function omit(obj, keys2) {
|
|
1748
|
-
if (!obj) return {};
|
|
1749
|
-
if (!keys2 || keys2.length === 0) return obj;
|
|
1750
|
-
return keys2.reduce(function (acc, key) {
|
|
1751
|
-
delete acc[key];
|
|
1752
|
-
return acc;
|
|
1753
|
-
}, _objectSpread({}, obj));
|
|
1754
|
-
};
|
|
1755
|
-
var get$1 = function get$1(value, path, defaultValue) {
|
|
1756
|
-
var segments = path.split(/[\.\[\]]/g);
|
|
1757
|
-
var current = value;
|
|
1758
|
-
var _iterator4 = _createForOfIteratorHelper(segments),
|
|
1759
|
-
_step4;
|
|
1760
|
-
try {
|
|
1761
|
-
for (_iterator4.s(); !(_step4 = _iterator4.n()).done;) {
|
|
1762
|
-
var key = _step4.value;
|
|
1763
|
-
if (current === null) return defaultValue;
|
|
1764
|
-
if (current === void 0) return defaultValue;
|
|
1765
|
-
var dequoted = key.replace(/['"]/g, "");
|
|
1766
|
-
if (dequoted.trim() === "") continue;
|
|
1767
|
-
current = current[dequoted];
|
|
1768
|
-
}
|
|
1769
|
-
} catch (err) {
|
|
1770
|
-
_iterator4.e(err);
|
|
1771
|
-
} finally {
|
|
1772
|
-
_iterator4.f();
|
|
1773
|
-
}
|
|
1774
|
-
if (current === void 0) return defaultValue;
|
|
1775
|
-
return current;
|
|
1776
|
-
};
|
|
1777
|
-
var set = function set(initial, path, value) {
|
|
1778
|
-
if (!initial) return {};
|
|
1779
|
-
if (!path || value === void 0) return initial;
|
|
1780
|
-
var segments = path.split(/[\.\[\]]/g).filter(function (x) {
|
|
1781
|
-
return !!x.trim();
|
|
1782
|
-
});
|
|
1783
|
-
var _set2 = function _set(node) {
|
|
1784
|
-
if (segments.length > 1) {
|
|
1785
|
-
var key = segments.shift();
|
|
1786
|
-
var nextIsNum = toInt(segments[0], null) === null ? false : true;
|
|
1787
|
-
node[key] = node[key] === void 0 ? nextIsNum ? [] : {} : node[key];
|
|
1788
|
-
_set2(node[key]);
|
|
1789
|
-
} else {
|
|
1790
|
-
node[segments[0]] = value;
|
|
1791
|
-
}
|
|
1792
|
-
};
|
|
1793
|
-
var cloned = clone(initial);
|
|
1794
|
-
_set2(cloned);
|
|
1795
|
-
return cloned;
|
|
1796
|
-
};
|
|
1797
|
-
var _assign = function assign(initial, override) {
|
|
1798
|
-
var _ref12;
|
|
1799
|
-
if (!initial || !override) return (_ref12 = initial !== null && initial !== void 0 ? initial : override) !== null && _ref12 !== void 0 ? _ref12 : {};
|
|
1800
|
-
return Object.entries(_objectSpread(_objectSpread({}, initial), override)).reduce(function (acc, _ref13) {
|
|
1801
|
-
var _ref14 = _slicedToArray(_ref13, 2),
|
|
1802
|
-
key = _ref14[0],
|
|
1803
|
-
value = _ref14[1];
|
|
1804
|
-
return _objectSpread(_objectSpread({}, acc), {}, _defineProperty({}, key, function () {
|
|
1805
|
-
if (isObject(initial[key])) return _assign(initial[key], value);
|
|
1806
|
-
return value;
|
|
1807
|
-
}()));
|
|
1808
|
-
}, {});
|
|
1809
|
-
};
|
|
1810
|
-
var keys = function keys(value) {
|
|
1811
|
-
if (!value) return [];
|
|
1812
|
-
var _getKeys = function getKeys(nested, paths) {
|
|
1813
|
-
if (isObject(nested)) {
|
|
1814
|
-
return Object.entries(nested).flatMap(function (_ref15) {
|
|
1815
|
-
var _ref16 = _slicedToArray(_ref15, 2),
|
|
1816
|
-
k = _ref16[0],
|
|
1817
|
-
v = _ref16[1];
|
|
1818
|
-
return _getKeys(v, [].concat(_toConsumableArray(paths), [k]));
|
|
1819
|
-
});
|
|
1820
|
-
}
|
|
1821
|
-
if (isArray(nested)) {
|
|
1822
|
-
return nested.flatMap(function (item, i) {
|
|
1823
|
-
return _getKeys(item, [].concat(_toConsumableArray(paths), ["".concat(i)]));
|
|
1824
|
-
});
|
|
1825
|
-
}
|
|
1826
|
-
return [paths.join(".")];
|
|
1827
|
-
};
|
|
1828
|
-
return _getKeys(value, []);
|
|
1829
|
-
};
|
|
1830
|
-
var crush = function crush(value) {
|
|
1831
|
-
if (!value) return {};
|
|
1832
|
-
return objectify(keys(value), function (k) {
|
|
1833
|
-
return k;
|
|
1834
|
-
}, function (k) {
|
|
1835
|
-
return get$1(value, k);
|
|
1836
|
-
});
|
|
1837
|
-
};
|
|
1838
|
-
var construct = function construct(obj) {
|
|
1839
|
-
if (!obj) return {};
|
|
1840
|
-
return Object.keys(obj).reduce(function (acc, path) {
|
|
1841
|
-
return set(acc, path, obj[path]);
|
|
1842
|
-
}, {});
|
|
1843
|
-
};
|
|
1844
|
-
var random = function random(min, max) {
|
|
1845
|
-
return Math.floor(Math.random() * (max - min + 1) + min);
|
|
1846
|
-
};
|
|
1847
|
-
var draw = function draw(array) {
|
|
1848
|
-
var max = array.length;
|
|
1849
|
-
if (max === 0) {
|
|
1850
|
-
return null;
|
|
1851
|
-
}
|
|
1852
|
-
var index = random(0, max - 1);
|
|
1853
|
-
return array[index];
|
|
1854
|
-
};
|
|
1855
|
-
var shuffle = function shuffle(array) {
|
|
1856
|
-
return array.map(function (a) {
|
|
1857
|
-
return {
|
|
1858
|
-
rand: Math.random(),
|
|
1859
|
-
value: a
|
|
1860
|
-
};
|
|
1861
|
-
}).sort(function (a, b) {
|
|
1862
|
-
return a.rand - b.rand;
|
|
1863
|
-
}).map(function (a) {
|
|
1864
|
-
return a.value;
|
|
1865
|
-
});
|
|
1866
|
-
};
|
|
1867
|
-
var uid = function uid(length) {
|
|
1868
|
-
var specials = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : "";
|
|
1869
|
-
var characters = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789" + specials;
|
|
1870
|
-
return iterate(length, function (acc) {
|
|
1871
|
-
return acc + characters.charAt(random(0, characters.length - 1));
|
|
1872
|
-
}, "");
|
|
1873
|
-
};
|
|
1874
|
-
var series = function series(items) {
|
|
1875
|
-
var toKey = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : function (item) {
|
|
1876
|
-
return "".concat(item);
|
|
1877
|
-
};
|
|
1878
|
-
var _items$reduce = items.reduce(function (acc, item, idx) {
|
|
1879
|
-
return {
|
|
1880
|
-
indexesByKey: _objectSpread(_objectSpread({}, acc.indexesByKey), {}, _defineProperty({}, toKey(item), idx)),
|
|
1881
|
-
itemsByIndex: _objectSpread(_objectSpread({}, acc.itemsByIndex), {}, _defineProperty({}, idx, item))
|
|
1882
|
-
};
|
|
1883
|
-
}, {
|
|
1884
|
-
indexesByKey: {},
|
|
1885
|
-
itemsByIndex: {}
|
|
1886
|
-
}),
|
|
1887
|
-
indexesByKey = _items$reduce.indexesByKey,
|
|
1888
|
-
itemsByIndex = _items$reduce.itemsByIndex;
|
|
1889
|
-
var min = function min(a, b) {
|
|
1890
|
-
return indexesByKey[toKey(a)] < indexesByKey[toKey(b)] ? a : b;
|
|
1891
|
-
};
|
|
1892
|
-
var max = function max(a, b) {
|
|
1893
|
-
return indexesByKey[toKey(a)] > indexesByKey[toKey(b)] ? a : b;
|
|
1894
|
-
};
|
|
1895
|
-
var first = function first() {
|
|
1896
|
-
return itemsByIndex[0];
|
|
1897
|
-
};
|
|
1898
|
-
var last = function last() {
|
|
1899
|
-
return itemsByIndex[items.length - 1];
|
|
1900
|
-
};
|
|
1901
|
-
var next = function next(current, defaultValue) {
|
|
1902
|
-
var _ref17, _itemsByIndex;
|
|
1903
|
-
return (_ref17 = (_itemsByIndex = itemsByIndex[indexesByKey[toKey(current)] + 1]) !== null && _itemsByIndex !== void 0 ? _itemsByIndex : defaultValue) !== null && _ref17 !== void 0 ? _ref17 : first();
|
|
1904
|
-
};
|
|
1905
|
-
var previous = function previous(current, defaultValue) {
|
|
1906
|
-
var _ref18, _itemsByIndex2;
|
|
1907
|
-
return (_ref18 = (_itemsByIndex2 = itemsByIndex[indexesByKey[toKey(current)] - 1]) !== null && _itemsByIndex2 !== void 0 ? _itemsByIndex2 : defaultValue) !== null && _ref18 !== void 0 ? _ref18 : last();
|
|
1908
|
-
};
|
|
1909
|
-
var spin = function spin(current, num) {
|
|
1910
|
-
if (num === 0) return current;
|
|
1911
|
-
var abs = Math.abs(num);
|
|
1912
|
-
var rel = abs > items.length ? abs % items.length : abs;
|
|
1913
|
-
return list(0, rel - 1).reduce(function (acc) {
|
|
1914
|
-
return num > 0 ? next(acc) : previous(acc);
|
|
1915
|
-
}, current);
|
|
1916
|
-
};
|
|
1917
|
-
return {
|
|
1918
|
-
min: min,
|
|
1919
|
-
max: max,
|
|
1920
|
-
first: first,
|
|
1921
|
-
last: last,
|
|
1922
|
-
next: next,
|
|
1923
|
-
previous: previous,
|
|
1924
|
-
spin: spin
|
|
1925
|
-
};
|
|
1926
|
-
};
|
|
1927
|
-
var capitalize = function capitalize(str) {
|
|
1928
|
-
if (!str || str.length === 0) return "";
|
|
1929
|
-
var lower = str.toLowerCase();
|
|
1930
|
-
return lower.substring(0, 1).toUpperCase() + lower.substring(1, lower.length);
|
|
1931
|
-
};
|
|
1932
|
-
var camel = function camel(str) {
|
|
1933
|
-
var _str$replace$split$ma, _str$replace;
|
|
1934
|
-
var parts = (_str$replace$split$ma = str === null || str === void 0 || (_str$replace = str.replace(/([A-Z])+/g, capitalize)) === null || _str$replace === void 0 ? void 0 : _str$replace.split(/(?=[A-Z])|[\.\-\s_]/).map(function (x) {
|
|
1935
|
-
return x.toLowerCase();
|
|
1936
|
-
})) !== null && _str$replace$split$ma !== void 0 ? _str$replace$split$ma : [];
|
|
1937
|
-
if (parts.length === 0) return "";
|
|
1938
|
-
if (parts.length === 1) return parts[0];
|
|
1939
|
-
return parts.reduce(function (acc, part) {
|
|
1940
|
-
return "".concat(acc).concat(part.charAt(0).toUpperCase()).concat(part.slice(1));
|
|
1941
|
-
});
|
|
1942
|
-
};
|
|
1943
|
-
var snake = function snake(str, options) {
|
|
1944
|
-
var _str$replace$split$ma2;
|
|
1945
|
-
var parts = (_str$replace$split$ma2 = str === null || str === void 0 ? void 0 : str.replace(/([A-Z])+/g, capitalize).split(/(?=[A-Z])|[\.\-\s_]/).map(function (x) {
|
|
1946
|
-
return x.toLowerCase();
|
|
1947
|
-
})) !== null && _str$replace$split$ma2 !== void 0 ? _str$replace$split$ma2 : [];
|
|
1948
|
-
if (parts.length === 0) return "";
|
|
1949
|
-
if (parts.length === 1) return parts[0];
|
|
1950
|
-
var result = parts.reduce(function (acc, part) {
|
|
1951
|
-
return "".concat(acc, "_").concat(part.toLowerCase());
|
|
1952
|
-
});
|
|
1953
|
-
return (options === null || options === void 0 ? void 0 : options.splitOnNumber) === false ? result : result.replace(/([A-Za-z]{1}[0-9]{1})/, function (val) {
|
|
1954
|
-
return "".concat(val[0], "_").concat(val[1]);
|
|
1955
|
-
});
|
|
1956
|
-
};
|
|
1957
|
-
var dash = function dash(str) {
|
|
1958
|
-
var _str$replace$split$ma3, _str$replace2;
|
|
1959
|
-
var parts = (_str$replace$split$ma3 = str === null || str === void 0 || (_str$replace2 = str.replace(/([A-Z])+/g, capitalize)) === null || _str$replace2 === void 0 ? void 0 : _str$replace2.split(/(?=[A-Z])|[\.\-\s_]/).map(function (x) {
|
|
1960
|
-
return x.toLowerCase();
|
|
1961
|
-
})) !== null && _str$replace$split$ma3 !== void 0 ? _str$replace$split$ma3 : [];
|
|
1962
|
-
if (parts.length === 0) return "";
|
|
1963
|
-
if (parts.length === 1) return parts[0];
|
|
1964
|
-
return parts.reduce(function (acc, part) {
|
|
1965
|
-
return "".concat(acc, "-").concat(part.toLowerCase());
|
|
1966
|
-
});
|
|
1967
|
-
};
|
|
1968
|
-
var pascal = function pascal(str) {
|
|
1969
|
-
var _str$split$map;
|
|
1970
|
-
var parts = (_str$split$map = str === null || str === void 0 ? void 0 : str.split(/[\.\-\s_]/).map(function (x) {
|
|
1971
|
-
return x.toLowerCase();
|
|
1972
|
-
})) !== null && _str$split$map !== void 0 ? _str$split$map : [];
|
|
1973
|
-
if (parts.length === 0) return "";
|
|
1974
|
-
return parts.map(function (str2) {
|
|
1975
|
-
return str2.charAt(0).toUpperCase() + str2.slice(1);
|
|
1976
|
-
}).join("");
|
|
1977
|
-
};
|
|
1978
|
-
var title = function title(str) {
|
|
1979
|
-
if (!str) return "";
|
|
1980
|
-
return str.split(/(?=[A-Z])|[\.\-\s_]/).map(function (s) {
|
|
1981
|
-
return s.trim();
|
|
1982
|
-
}).filter(function (s) {
|
|
1983
|
-
return !!s;
|
|
1984
|
-
}).map(function (s) {
|
|
1985
|
-
return capitalize(s.toLowerCase());
|
|
1986
|
-
}).join(" ");
|
|
1987
|
-
};
|
|
1988
|
-
var template = function template(str, data) {
|
|
1989
|
-
var regex = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : /\{\{(.+?)\}\}/g;
|
|
1990
|
-
return Array.from(str.matchAll(regex)).reduce(function (acc, match) {
|
|
1991
|
-
return acc.replace(match[0], data[match[1]]);
|
|
1992
|
-
}, str);
|
|
1993
|
-
};
|
|
1994
|
-
var trim = function trim(str) {
|
|
1995
|
-
var charsToTrim = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : " ";
|
|
1996
|
-
if (!str) return "";
|
|
1997
|
-
var toTrim = charsToTrim.replace(/[\W]{1}/g, "\\$&");
|
|
1998
|
-
var regex = new RegExp("^[".concat(toTrim, "]+|[").concat(toTrim, "]+$"), "g");
|
|
1999
|
-
return str.replace(regex, "");
|
|
2000
|
-
};
|
|
2001
|
-
function get(value, path, defaultValue) {
|
|
2002
|
-
//@ts-ignore
|
|
2003
|
-
var direct_value = value === null || value === void 0 ? void 0 : value[path];
|
|
2004
|
-
if (direct_value) return direct_value;
|
|
2005
|
-
return get$1(value, path, defaultValue);
|
|
2006
|
-
}
|
|
2007
|
-
function identity(value) {
|
|
2008
|
-
return value;
|
|
2009
|
-
}
|
|
2010
|
-
var symbolProto = Symbol ? Symbol.prototype : undefined;
|
|
2011
|
-
var symbolToString = symbolProto ? symbolProto.toString : undefined;
|
|
2012
|
-
var INFINITY = 1 / 0;
|
|
2013
|
-
function isBoolean(value) {
|
|
2014
|
-
return value === true || value === false;
|
|
2015
|
-
}
|
|
2016
|
-
function isObjectLike(value) {
|
|
2017
|
-
return value != null && _typeof$1(value) == 'object';
|
|
2018
|
-
}
|
|
2019
|
-
function isNull(value) {
|
|
2020
|
-
return value === null;
|
|
2021
|
-
}
|
|
2022
|
-
function size(value) {
|
|
2023
|
-
if (isString(value) || isArray(value)) return value.length;
|
|
2024
|
-
if (isObject(value)) return Object.keys(value).length;
|
|
2025
|
-
return 0;
|
|
2026
|
-
}
|
|
2027
|
-
function isNil(value) {
|
|
2028
|
-
return value == null;
|
|
2029
|
-
}
|
|
2030
|
-
function toString(value) {
|
|
2031
|
-
return value == null ? '' : baseToString(value);
|
|
2032
|
-
}
|
|
2033
|
-
function baseToString(value) {
|
|
2034
|
-
// Exit early for strings to avoid a performance hit in some environments.
|
|
2035
|
-
if (typeof value == 'string') {
|
|
2036
|
-
return value;
|
|
2037
|
-
}
|
|
2038
|
-
if (isArray(value)) {
|
|
2039
|
-
// Recursively convert values (susceptible to call stack limits).
|
|
2040
|
-
return arrayMap(value, baseToString) + '';
|
|
2041
|
-
}
|
|
2042
|
-
if (isSymbol(value)) {
|
|
2043
|
-
return symbolToString ? symbolToString.call(value) : '';
|
|
2044
|
-
}
|
|
2045
|
-
var result = value + '';
|
|
2046
|
-
return result == '0' && 1 / value == -INFINITY ? '-0' : result;
|
|
2047
|
-
}
|
|
2048
|
-
function arrayMap(array, iteratee) {
|
|
2049
|
-
var index = -1,
|
|
2050
|
-
length = array == null ? 0 : array.length,
|
|
2051
|
-
result = Array(length);
|
|
2052
|
-
while (++index < length) {
|
|
2053
|
-
result[index] = iteratee(array[index], index, array);
|
|
2054
|
-
}
|
|
2055
|
-
return result;
|
|
2056
|
-
}
|
|
2057
|
-
function cloneDeep(value) {
|
|
2058
|
-
try {
|
|
2059
|
-
return JSON.parse(JSON.stringify(value));
|
|
2060
|
-
} catch (error) {
|
|
2061
|
-
return null;
|
|
2062
|
-
}
|
|
2063
|
-
}
|
|
2064
|
-
function hasOwn(obj, key) {
|
|
2065
|
-
return Object.prototype.hasOwnProperty.call(obj, key);
|
|
2066
|
-
}
|
|
2067
|
-
function safe_json_parse(str) {
|
|
2068
|
-
var retOnErr = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
|
|
2069
|
-
if (!str) return retOnErr;
|
|
2070
|
-
if (isObject(str) || isArray(str)) return str;
|
|
2071
|
-
if (!isString(str)) return retOnErr;
|
|
2072
|
-
try {
|
|
2073
|
-
var v = JSON.parse(str);
|
|
2074
|
-
return isObject(v) || Array.isArray(v) ? v : retOnErr;
|
|
2075
|
-
} catch (error) {
|
|
2076
|
-
return retOnErr;
|
|
2077
|
-
}
|
|
2078
|
-
}
|
|
2079
|
-
function safe_json_stringify(obj) {
|
|
2080
|
-
if (isString(obj) && safe_json_parse(obj)) {
|
|
2081
|
-
return obj;
|
|
2082
|
-
}
|
|
2083
|
-
return JSON.stringify(obj);
|
|
2084
|
-
}
|
|
2085
|
-
function safe_json_parse_arr(str) {
|
|
2086
|
-
var retOnErr = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
|
|
2087
|
-
if (!str) return retOnErr;
|
|
2088
|
-
if (Array.isArray(str)) return str;
|
|
2089
|
-
if (!isString(str)) return retOnErr;
|
|
2090
|
-
try {
|
|
2091
|
-
var v = JSON.parse(str);
|
|
2092
|
-
return Array.isArray(v) ? v : retOnErr;
|
|
2093
|
-
} catch (error) {
|
|
2094
|
-
return retOnErr;
|
|
2095
|
-
}
|
|
2096
|
-
}
|
|
2097
|
-
|
|
2098
|
-
/******************************************************************************
|
|
2099
|
-
Copyright (c) Microsoft Corporation.
|
|
2100
|
-
|
|
2101
|
-
Permission to use, copy, modify, and/or distribute this software for any
|
|
2102
|
-
purpose with or without fee is hereby granted.
|
|
2103
|
-
|
|
2104
|
-
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
2105
|
-
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
2106
|
-
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
2107
|
-
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
2108
|
-
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
2109
|
-
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
2110
|
-
PERFORMANCE OF THIS SOFTWARE.
|
|
2111
|
-
***************************************************************************** */
|
|
2112
|
-
function __awaiter(thisArg, _arguments, P, generator) {
|
|
2113
|
-
function adopt(value) {
|
|
2114
|
-
return value instanceof P ? value : new P(function (resolve) {
|
|
2115
|
-
resolve(value);
|
|
2116
|
-
});
|
|
2117
|
-
}
|
|
2118
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
2119
|
-
function fulfilled(value) {
|
|
2120
|
-
try {
|
|
2121
|
-
step(generator.next(value));
|
|
2122
|
-
} catch (e) {
|
|
2123
|
-
reject(e);
|
|
2124
|
-
}
|
|
2125
|
-
}
|
|
2126
|
-
function rejected(value) {
|
|
2127
|
-
try {
|
|
2128
|
-
step(generator["throw"](value));
|
|
2129
|
-
} catch (e) {
|
|
2130
|
-
reject(e);
|
|
2131
|
-
}
|
|
2132
|
-
}
|
|
2133
|
-
function step(result) {
|
|
2134
|
-
result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);
|
|
2135
|
-
}
|
|
2136
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
2137
|
-
});
|
|
2138
|
-
}
|
|
2139
|
-
typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
|
|
2140
|
-
var e = new Error(message);
|
|
2141
|
-
return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
|
|
2142
|
-
};
|
|
2143
|
-
|
|
2144
|
-
// export function sleep(sec: number) {
|
|
2145
|
-
// return new Promise<void>((resolve) => setTimeout(resolve, sec * 1000))
|
|
2146
|
-
// }
|
|
2147
|
-
function get_global() {
|
|
2148
|
-
var _a;
|
|
2149
|
-
try {
|
|
2150
|
-
return (_a = globalThis !== null && globalThis !== void 0 ? globalThis : window) !== null && _a !== void 0 ? _a : global;
|
|
2151
|
-
} catch (error) {
|
|
2152
|
-
return {};
|
|
2153
|
-
}
|
|
2154
|
-
}
|
|
2155
|
-
function getSearchParamsValue(key) {
|
|
2156
|
-
var _a, _b;
|
|
2157
|
-
var url = new URL(location.toString());
|
|
2158
|
-
return (_b = (_a = url === null || url === void 0 ? void 0 : url.searchParams) === null || _a === void 0 ? void 0 : _a.get(key)) !== null && _b !== void 0 ? _b : null;
|
|
2159
|
-
}
|
|
2160
|
-
function getSearchParamsAll(url) {
|
|
2161
|
-
var _url = url !== null && url !== void 0 ? url : new URL(location.href);
|
|
2162
|
-
var searchParams = _url ? _toConsumableArray(_url.searchParams.entries()).reduce(function (a, b) {
|
|
2163
|
-
return Object.assign(a, _defineProperty({}, b[0], b[1]));
|
|
2164
|
-
}, {}) : {};
|
|
2165
|
-
return searchParams;
|
|
2166
|
-
}
|
|
2167
|
-
function setSearchParamsValue(key, value) {
|
|
2168
|
-
var _a;
|
|
2169
|
-
var url = new URL(location.toString());
|
|
2170
|
-
(_a = url === null || url === void 0 ? void 0 : url.searchParams) === null || _a === void 0 ? void 0 : _a.set(key, "".concat(value));
|
|
2171
|
-
return url;
|
|
2172
|
-
}
|
|
2173
|
-
function setSearchParamsAll(data) {
|
|
2174
|
-
var _url = new URL(location.href);
|
|
2175
|
-
Object.keys(data).forEach(function (k) {
|
|
2176
|
-
var _a;
|
|
2177
|
-
(_a = _url === null || _url === void 0 ? void 0 : _url.searchParams) === null || _a === void 0 ? void 0 : _a.set(k, "".concat(data[k]));
|
|
2178
|
-
});
|
|
2179
|
-
return _url;
|
|
2180
|
-
}
|
|
2181
|
-
function scrollIntoView(symbol) {
|
|
2182
|
-
var finder = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : document.querySelector.bind(document);
|
|
2183
|
-
var dom = finder(symbol);
|
|
2184
|
-
var scrollIntoViewIfNeeded = dom === null || dom === void 0 ? void 0 : dom.scrollIntoViewIfNeeded;
|
|
2185
|
-
if (scrollIntoViewIfNeeded) {
|
|
2186
|
-
scrollIntoViewIfNeeded.call(dom);
|
|
2187
|
-
} else {
|
|
2188
|
-
dom === null || dom === void 0 ? void 0 : dom.scrollIntoView({
|
|
2189
|
-
behavior: 'smooth'
|
|
2190
|
-
});
|
|
2191
|
-
}
|
|
2192
|
-
}
|
|
2193
|
-
function base64ToBinary(data, type) {
|
|
2194
|
-
var raw = get_global().atob(data);
|
|
2195
|
-
var uInt8Array = new Uint8Array(raw.length);
|
|
2196
|
-
for (var i = 0; i < raw.length; i++) {
|
|
2197
|
-
uInt8Array[i] = raw.charCodeAt(i);
|
|
2198
|
-
}
|
|
2199
|
-
return new Blob([uInt8Array], {
|
|
2200
|
-
type: type
|
|
2201
|
-
});
|
|
2202
|
-
}
|
|
2203
|
-
function downloadFile(content) {
|
|
2204
|
-
var filename = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '问卷答题情况.xlsx';
|
|
2205
|
-
var type = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 'application/vnd.ms-excel';
|
|
2206
|
-
var isBase64 = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
|
|
2207
|
-
var eleLink = document.createElement('a');
|
|
2208
|
-
eleLink.download = filename;
|
|
2209
|
-
eleLink.style.display = 'none';
|
|
2210
|
-
var blob = typeof content === 'string' ? isBase64 ? base64ToBinary(content, type) : new Blob([content], {
|
|
2211
|
-
type: type
|
|
2212
|
-
}) : content;
|
|
2213
|
-
eleLink.href = URL.createObjectURL(blob);
|
|
2214
|
-
document.body.appendChild(eleLink);
|
|
2215
|
-
eleLink.click();
|
|
2216
|
-
document.body.removeChild(eleLink);
|
|
2217
|
-
}
|
|
2218
|
-
function uuid() {
|
|
2219
|
-
var temp_url = URL.createObjectURL(new Blob());
|
|
2220
|
-
var uuid = temp_url.toString();
|
|
2221
|
-
URL.revokeObjectURL(temp_url);
|
|
2222
|
-
return uuid.slice(uuid.lastIndexOf("/") + 1);
|
|
2223
|
-
}
|
|
2224
|
-
function randomHex() {
|
|
2225
|
-
var hex = ~~(Math.random() * 16);
|
|
2226
|
-
return hex;
|
|
2227
|
-
}
|
|
2228
|
-
function charToUTF8(_char) {
|
|
2229
|
-
var encoder = new TextEncoder();
|
|
2230
|
-
var uint8Array = encoder.encode(_char[0]);
|
|
2231
|
-
return Array.from(uint8Array);
|
|
2232
|
-
}
|
|
2233
|
-
function charToUnicode(_char2) {
|
|
2234
|
-
// ES6 之后可以用 String.prototype.codePointAt() 从字符返回对应的码点
|
|
2235
|
-
var u = _char2.charCodeAt(0);
|
|
2236
|
-
var u1 = _char2.charCodeAt(0);
|
|
2237
|
-
var u2 = _char2.charCodeAt(1);
|
|
2238
|
-
if (u1 >= 0xD800 && u1 <= 0xDBFF && u2 >= 0xDC00 && u2 <= 0xDFFF) {
|
|
2239
|
-
u = (u1 - 0xD800 << 10 | u2 - 0xDC00) + 0x10000;
|
|
2240
|
-
}
|
|
2241
|
-
return u;
|
|
2242
|
-
}
|
|
2243
|
-
// 先转 utf-8 再 decode
|
|
2244
|
-
function unicodeToChar(u) {
|
|
2245
|
-
var arr = unicode_to_UTF8(u);
|
|
2246
|
-
if (!arr) return null;
|
|
2247
|
-
var decoder = new TextDecoder();
|
|
2248
|
-
var ui8 = new Uint8Array(arr);
|
|
2249
|
-
return decoder.decode(ui8);
|
|
2250
|
-
}
|
|
2251
|
-
function unicode_to_UTF8(u) {
|
|
2252
|
-
var arr = null; //utf8;
|
|
2253
|
-
if (u <= 0x7F) {
|
|
2254
|
-
arr = [u & 0xFF];
|
|
2255
|
-
} else if (u <= 0x07FF) {
|
|
2256
|
-
arr = [u >> 6 & 0x1F | 0xC0, u & 0x3F | 0x80];
|
|
2257
|
-
} else if (u <= 0xFFFF) {
|
|
2258
|
-
arr = [u >> 12 & 0x0F | 0xE0, u >> 6 & 0x3F | 0x80, u & 0x3F | 0x80];
|
|
2259
|
-
} else if (u <= 0x10FFFF) {
|
|
2260
|
-
arr = [u >> 18 & 0x07 | 0xF0, u >> 12 & 0x3F | 0x80, u >> 6 & 0x3F | 0x80, u & 0x3F | 0x80];
|
|
2261
|
-
}
|
|
2262
|
-
if (!arr) return null;
|
|
2263
|
-
return arr;
|
|
2264
|
-
}
|
|
2265
|
-
function getFilledArray(n) {
|
|
2266
|
-
return Array(n).fill(0);
|
|
2267
|
-
}
|
|
2268
|
-
function copyText(text) {
|
|
2269
|
-
var textareaC = document.createElement('textarea');
|
|
2270
|
-
textareaC.setAttribute('readonly', 'readonly');
|
|
2271
|
-
textareaC.value = text;
|
|
2272
|
-
document.body.appendChild(textareaC);
|
|
2273
|
-
textareaC.select();
|
|
2274
|
-
var res = document.execCommand('copy');
|
|
2275
|
-
document.body.removeChild(textareaC);
|
|
2276
|
-
return res;
|
|
2277
|
-
}
|
|
2278
|
-
function safeExec(fn) {
|
|
2279
|
-
for (var _len8 = arguments.length, args = new Array(_len8 > 1 ? _len8 - 1 : 0), _key8 = 1; _key8 < _len8; _key8++) {
|
|
2280
|
-
args[_key8 - 1] = arguments[_key8];
|
|
2281
|
-
}
|
|
2282
|
-
return isFunction(fn) ? fn.apply(void 0, args) : null;
|
|
2283
|
-
}
|
|
2284
|
-
function safeGetFromFuncOrData(fn) {
|
|
2285
|
-
var _a;
|
|
2286
|
-
return (_a = safeExec(fn)) !== null && _a !== void 0 ? _a : fn;
|
|
2287
|
-
}
|
|
2288
|
-
function numberLikeCompare(a, b) {
|
|
2289
|
-
if (a === b) return true;
|
|
2290
|
-
if (isString(a) && isString(b)) {
|
|
2291
|
-
return a === b;
|
|
2292
|
-
}
|
|
2293
|
-
if (isNil(a) || isNil(b)) return false;
|
|
2294
|
-
if (isObject(a) || isObject(b)) return false;
|
|
2295
|
-
if (isBoolean(a) && !isBoolean(b)) return false;
|
|
2296
|
-
if (isBoolean(b) && !isBoolean(a)) return false;
|
|
2297
|
-
if (toInt(a, NaN) === toInt(b, NaN)) return true;
|
|
2298
|
-
if (toFloat(a, NaN) === toFloat(b, NaN)) return true;
|
|
2299
|
-
if (toString(a) === toString(b)) return true;
|
|
2300
|
-
return false;
|
|
2301
|
-
}
|
|
2302
|
-
function warpBase64Type(str, type) {
|
|
2303
|
-
if (!str) return str;
|
|
2304
|
-
if (type === 'img') {
|
|
2305
|
-
return str.startsWith('data:image/png;base64,') ? str : "data:image/png;base64,".concat(str);
|
|
2306
|
-
}
|
|
2307
|
-
if (type === 'pdf') {
|
|
2308
|
-
return str.startsWith('data:application/json;base64,') ? str : "data:application/json;base64,".concat(str);
|
|
2309
|
-
}
|
|
2310
|
-
return str;
|
|
2311
|
-
}
|
|
2312
|
-
function safe_number_parse(value) {
|
|
2313
|
-
var defaultValue = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : NaN;
|
|
2314
|
-
if (isNumber(value) && !isNaN(value)) return value;
|
|
2315
|
-
var rawParse = Number(value);
|
|
2316
|
-
return isNaN(rawParse) ? defaultValue : rawParse;
|
|
2317
|
-
}
|
|
2318
|
-
function expect_array(value) {
|
|
2319
|
-
var default_v = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
|
|
2320
|
-
if (!Array.isArray(value)) {
|
|
2321
|
-
if (Array.isArray(default_v)) return default_v;
|
|
2322
|
-
return [];
|
|
2323
|
-
}
|
|
2324
|
-
return value;
|
|
2325
|
-
}
|
|
2326
|
-
// 生成包含字符的 svg 转义字符串
|
|
2327
|
-
function gen_encoded_char_svg(props) {
|
|
2328
|
-
var _char3 = props["char"],
|
|
2329
|
-
_props$size = props.size,
|
|
2330
|
-
size = _props$size === void 0 ? 12 : _props$size,
|
|
2331
|
-
_props$color = props.color,
|
|
2332
|
-
color = _props$color === void 0 ? 'cc0000' : _props$color;
|
|
2333
|
-
var _color = (color === null || color === void 0 ? void 0 : color.startsWith('#')) ? color.slice(1) : color;
|
|
2334
|
-
return "data:image/svg+xml,%3Csvg \n width='".concat(size + 2, "' height='").concat(size + 2, "' \n xmlns='http://www.w3.org/2000/svg'%3E%3Ctext x='50%25' y='50%25' \n font-size='").concat(size, "' \n fill='%23").concat(_color, "' \n font-weight='bold'\n text-anchor='middle' \n dominant-baseline='middle'%3E").concat(_char3, "%3C/text%3E%3C/svg%3E");
|
|
2335
|
-
}
|
|
2336
|
-
function base64_to_image(base64img) {
|
|
2337
|
-
return new Promise(function (res, rej) {
|
|
2338
|
-
if (!base64img) res(null);
|
|
2339
|
-
var img = new Image();
|
|
2340
|
-
img.onload = function () {
|
|
2341
|
-
res(img);
|
|
2342
|
-
};
|
|
2343
|
-
img.src = base64img;
|
|
2344
|
-
});
|
|
2345
|
-
}
|
|
2346
|
-
function image_to_base64(img_el) {
|
|
2347
|
-
if (!img_el) return null;
|
|
2348
|
-
var c = document.createElement('canvas');
|
|
2349
|
-
c.width = img_el.width;
|
|
2350
|
-
c.height = img_el.height;
|
|
2351
|
-
var ctx = c.getContext('2d');
|
|
2352
|
-
ctx === null || ctx === void 0 ? void 0 : ctx.drawImage(img_el, 0, 0, img_el.width, img_el.height);
|
|
2353
|
-
var base64 = c.toDataURL('image/png');
|
|
2354
|
-
return base64;
|
|
2355
|
-
}
|
|
2356
|
-
function filter_obj_to_url_search(obj) {
|
|
2357
|
-
if (!obj) return {};
|
|
2358
|
-
var clone_one = {};
|
|
2359
|
-
keys(obj).forEach(function (k) {
|
|
2360
|
-
var v = obj[k];
|
|
2361
|
-
if (isNumber(v) || isBoolean(v) || isString(v) || isNull(v)) {
|
|
2362
|
-
clone_one[k] = v;
|
|
2363
|
-
}
|
|
2364
|
-
});
|
|
2365
|
-
return clone_one;
|
|
2366
|
-
}
|
|
2367
|
-
function safe_async_call(cb) {
|
|
2368
|
-
for (var _len9 = arguments.length, args = new Array(_len9 > 1 ? _len9 - 1 : 0), _key9 = 1; _key9 < _len9; _key9++) {
|
|
2369
|
-
args[_key9 - 1] = arguments[_key9];
|
|
2370
|
-
}
|
|
2371
|
-
return __awaiter(this, void 0, void 0, /*#__PURE__*/regenerator.mark(function _callee8() {
|
|
2372
|
-
return regenerator.wrap(function _callee8$(_context8) {
|
|
2373
|
-
while (1) switch (_context8.prev = _context8.next) {
|
|
2374
|
-
case 0:
|
|
2375
|
-
if (isFunction(cb)) {
|
|
2376
|
-
_context8.next = 2;
|
|
2377
|
-
break;
|
|
2378
|
-
}
|
|
2379
|
-
return _context8.abrupt("return", null);
|
|
2380
|
-
case 2:
|
|
2381
|
-
_context8.next = 4;
|
|
2382
|
-
return Promise.resolve(cb.apply(void 0, args));
|
|
2383
|
-
case 4:
|
|
2384
|
-
return _context8.abrupt("return", _context8.sent);
|
|
2385
|
-
case 5:
|
|
2386
|
-
case "end":
|
|
2387
|
-
return _context8.stop();
|
|
2388
|
-
}
|
|
2389
|
-
}, _callee8);
|
|
2390
|
-
}));
|
|
2391
|
-
}
|
|
2392
|
-
var global_cache_map = {};
|
|
2393
|
-
function cache_fetch(key_1, cb_1) {
|
|
2394
|
-
return __awaiter(this, arguments, void 0, function (key, cb) {
|
|
2395
|
-
var deep = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
|
|
2396
|
-
return /*#__PURE__*/regenerator.mark(function _callee9() {
|
|
2397
|
-
var raw;
|
|
2398
|
-
return regenerator.wrap(function _callee9$(_context9) {
|
|
2399
|
-
while (1) switch (_context9.prev = _context9.next) {
|
|
2400
|
-
case 0:
|
|
2401
|
-
_context9.next = 2;
|
|
2402
|
-
return cache_fetch_inner(key, cb);
|
|
2403
|
-
case 2:
|
|
2404
|
-
raw = _context9.sent;
|
|
2405
|
-
return _context9.abrupt("return", deep ? cloneDeep(raw) : raw);
|
|
2406
|
-
case 4:
|
|
2407
|
-
case "end":
|
|
2408
|
-
return _context9.stop();
|
|
2409
|
-
}
|
|
2410
|
-
}, _callee9);
|
|
2411
|
-
})();
|
|
2412
|
-
});
|
|
2413
|
-
}
|
|
2414
|
-
function cache_fetch_inner(key, cb) {
|
|
2415
|
-
return __awaiter(this, void 0, void 0, /*#__PURE__*/regenerator.mark(function _callee10() {
|
|
2416
|
-
var _a, conf;
|
|
2417
|
-
return regenerator.wrap(function _callee10$(_context10) {
|
|
2418
|
-
while (1) switch (_context10.prev = _context10.next) {
|
|
2419
|
-
case 0:
|
|
2420
|
-
conf = global_cache_map[key] = (_a = global_cache_map[key]) !== null && _a !== void 0 ? _a : {};
|
|
2421
|
-
if (!conf.cache) {
|
|
2422
|
-
_context10.next = 3;
|
|
2423
|
-
break;
|
|
2424
|
-
}
|
|
2425
|
-
return _context10.abrupt("return", conf.cache);
|
|
2426
|
-
case 3:
|
|
2427
|
-
if (!conf.cache_promise) {
|
|
2428
|
-
_context10.next = 5;
|
|
2429
|
-
break;
|
|
2430
|
-
}
|
|
2431
|
-
return _context10.abrupt("return", conf.cache_promise);
|
|
2432
|
-
case 5:
|
|
2433
|
-
return _context10.abrupt("return", conf.cache_promise = cb().then(function (r) {
|
|
2434
|
-
return conf.cache = r;
|
|
2435
|
-
}));
|
|
2436
|
-
case 6:
|
|
2437
|
-
case "end":
|
|
2438
|
-
return _context10.stop();
|
|
2439
|
-
}
|
|
2440
|
-
}, _callee10);
|
|
2441
|
-
}));
|
|
2442
|
-
}
|
|
2443
|
-
function speculate_on_display(value) {
|
|
2444
|
-
if (!value) return '';
|
|
2445
|
-
if (isNumber(value)) return value + '';
|
|
2446
|
-
if (Array.isArray(value)) {
|
|
2447
|
-
var item0 = value[0];
|
|
2448
|
-
return (item0 === null || item0 === void 0 ? void 0 : item0.label) || (item0 === null || item0 === void 0 ? void 0 : item0.value);
|
|
2449
|
-
}
|
|
2450
|
-
if (isObjectLike(value)) {
|
|
2451
|
-
return value.label || value.value;
|
|
2452
|
-
}
|
|
2453
|
-
if (isString(value)) {
|
|
2454
|
-
var obj = safe_json_parse(value);
|
|
2455
|
-
return speculate_on_display(obj) || value;
|
|
2456
|
-
}
|
|
2457
|
-
return '';
|
|
2458
|
-
}
|
|
2459
|
-
// 00:00 00:05 ... 23:55
|
|
2460
|
-
function getFuckTimeInterval() {
|
|
2461
|
-
var star_hour = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
|
|
2462
|
-
var end_hour = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 24;
|
|
2463
|
-
var min_interval = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 5;
|
|
2464
|
-
return Array(end_hour - star_hour).fill(0).map(function (_, hour) {
|
|
2465
|
-
var hour_str = (hour + star_hour).toString().padStart(2, '0');
|
|
2466
|
-
var min_counts = 60 / min_interval;
|
|
2467
|
-
return Array(min_counts).fill(0).map(function (_, min) {
|
|
2468
|
-
var min_str = (min * min_interval).toString().padStart(2, '0');
|
|
2469
|
-
return "".concat(hour_str, ":").concat(min_str);
|
|
2470
|
-
});
|
|
2471
|
-
}).flat();
|
|
2472
|
-
}
|
|
2473
|
-
// export function getTimeSlice(hour = 24, isShowSecond = false) {
|
|
2474
|
-
// const hourArr = Array(hour).fill(0) as number[]
|
|
2475
|
-
// const minuteArr = Array(60).fill(0) as number[]
|
|
2476
|
-
// return hourArr.reduce((sum, h, hIdx) => {
|
|
2477
|
-
// return [...sum, ...minuteArr.map((m, mIdx) => `${hIdx}:${mIdx}`)]
|
|
2478
|
-
// }, [] as string[])
|
|
2479
|
-
// }
|
|
2480
|
-
var word = [['abundant', ' 丰富的', '/əˈbʌndənt/'], ['eloquent', ' 雄辩的', '/ˈeləkwənt/'], ['meticulous', ' 细致的', '/məˈtɪkjʊləs/'], ['resilient', ' 有韧性的', '/rɪˈzɪliənt/'], ['versatile', ' 多才多艺的', '/ˈvɜːsətaɪl/'], ['pragmatic', ' 务实的', '/præɡˈmætɪk/'], ['inevitable', ' 不可避免的', '/ɪˈnevɪtəbl/'], ['ambiguous', ' 模棱两可的', '/æmˈbɪɡjuəs/'], ['spontaneous', ' 自发的', '/spɒnˈteɪniəs/'], ['conscientious', ' 认真的', '/ˌkɒnʃiˈenʃəs/'], ['impeccable', ' 无瑕疵的', '/ɪmˈpekəbl/'], ['tenacious', ' 顽强的', '/təˈneɪʃəs/'], ['prolific', ' 多产的', '/prəˈlɪfɪk/']];
|
|
2481
|
-
function random_word() {
|
|
2482
|
-
return word[Math.random() * word.length | 0];
|
|
2483
|
-
}
|
|
2484
|
-
function confirm_operation() {
|
|
2485
|
-
var word = random_word();
|
|
2486
|
-
return prompt("\u8BF7\u8F93\u5165 ".concat(word[0], "\uFF08").concat(word[2], " adj.").concat(word[1], "\uFF09 \u4EE5\u786E\u8BA4\u4F60\u7684\u64CD\u4F5C")) === word[0];
|
|
2487
|
-
}
|
|
2488
|
-
// ES6 新增的方法
|
|
2489
|
-
// '😎'.charCodeAt(0).toString(16) == 'd83d' // UTF-16 码元
|
|
2490
|
-
// '😎'.charCodeAt(1).toString(16) == 'de0e'
|
|
2491
|
-
// '😎'.codePointAt(0)?.toString(16) == '1f60e'// Unicode 码点
|
|
2492
|
-
function simple_encrypt(data) {
|
|
2493
|
-
if (!data) return null;
|
|
2494
|
-
return JSON.stringify(data).split('').map(function (_, idx) {
|
|
2495
|
-
return ~_.charCodeAt(0) + idx * 119;
|
|
2496
|
-
});
|
|
2497
|
-
}
|
|
2498
|
-
function simple_decrypt(code) {
|
|
2499
|
-
if (!code) return null;
|
|
2500
|
-
var str = expect_array(code).map(function (_, idx) {
|
|
2501
|
-
return String.fromCharCode(~(_ - idx * 119));
|
|
2502
|
-
}).join('');
|
|
2503
|
-
return safe_json_parse(str);
|
|
2504
|
-
}
|
|
2505
|
-
var SP = '@@';
|
|
2506
|
-
function simple_encrypt_str(data) {
|
|
2507
|
-
var sp = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : SP;
|
|
2508
|
-
if (!data || !isString(data)) return null;
|
|
2509
|
-
return data.split('').map(function (_, idx) {
|
|
2510
|
-
return ~_.charCodeAt(0) + idx * 119;
|
|
2511
|
-
}).join(sp);
|
|
2512
|
-
}
|
|
2513
|
-
function simple_decrypt_str(code) {
|
|
2514
|
-
var sp = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : SP;
|
|
2515
|
-
if (!code || !isString(code) || !code.includes(sp)) return null;
|
|
2516
|
-
var str = code.split(sp).map(function (_, idx) {
|
|
2517
|
-
return String.fromCharCode(~(+_ - idx * 119));
|
|
2518
|
-
}).join('');
|
|
2519
|
-
return str;
|
|
2520
|
-
}
|
|
2521
|
-
function text_ellipsis(text, max) {
|
|
2522
|
-
if (!text || !isNumber(max)) return '';
|
|
2523
|
-
if (text.length <= max) return text;
|
|
2524
|
-
return text.slice(0, max) + '...';
|
|
2525
|
-
}
|
|
2526
|
-
Object.assign(get_global(), {
|
|
2527
|
-
safe_async_call: safe_async_call,
|
|
2528
|
-
simple_decrypt_str: simple_decrypt_str,
|
|
2529
|
-
simple_encrypt_str: simple_encrypt_str
|
|
2530
|
-
});
|
|
2531
|
-
// safe_check()
|
|
2532
|
-
|
|
2533
|
-
function getFn(format) {
|
|
2534
|
-
function f(s) {
|
|
2535
|
-
if (isFunction(s === null || s === void 0 ? void 0 : s.format)) {
|
|
2536
|
-
var res = s.format(format);
|
|
2537
|
-
if (isString(res)) return res;
|
|
2538
|
-
}
|
|
2539
|
-
var a = dayjs(s);
|
|
2540
|
-
return a.isValid() ? a.format(format) : null;
|
|
2541
|
-
}
|
|
2542
|
-
return Object.assign(f, {
|
|
2543
|
-
format: format
|
|
2544
|
-
});
|
|
2545
|
-
}
|
|
2546
|
-
function getMomentObj(s) {
|
|
2547
|
-
return dayjs(s);
|
|
2548
|
-
}
|
|
2549
|
-
var formatDate = getFn('YYYY-MM-DD');
|
|
2550
|
-
var formatDateTime = getFn('YYYY-MM-DD HH:mm:ss');
|
|
2551
|
-
var formatDateTimeNoSecond = getFn('YYYY-MM-DD HH:mm');
|
|
2552
|
-
var formatTime = getFn('HH:mm:ss');
|
|
2553
|
-
function start() {
|
|
2554
|
-
var m = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : dayjs;
|
|
2555
|
-
return m().set('hour', 0).set('minute', 0).set('second', 0);
|
|
2556
|
-
}
|
|
2557
|
-
function end() {
|
|
2558
|
-
var m = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : dayjs;
|
|
2559
|
-
return m().set('hour', 23).set('minute', 59).set('second', 59);
|
|
2560
|
-
}
|
|
2561
|
-
function getMomentRange() {
|
|
2562
|
-
var m = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : dayjs;
|
|
2563
|
-
return {
|
|
2564
|
-
昨天: [start(m).add(-1, 'day'), end(m).add(-1, 'day')],
|
|
2565
|
-
今天: [start(m), end(m)],
|
|
2566
|
-
明天: [start(m).add(1, 'day'), end(m).add(1, 'day')],
|
|
2567
|
-
上周: [start(m).add(-1, 'week').startOf('week'), end(m).add(-1, 'week').endOf('week')],
|
|
2568
|
-
// 这周: [start(m).startOf('week'), end(m).endOf('week')] as DT,
|
|
2569
|
-
近一周: [start(m).add(-1, 'week').add(1, 'day'), end(m)],
|
|
2570
|
-
下周: [start(m).add(1, 'week').startOf('week'), end(m).add(1, 'week').endOf('week')],
|
|
2571
|
-
上月: [start(m).add(-1, 'month').startOf('month'), end(m).add(-1, 'month').endOf('month')],
|
|
2572
|
-
// 这月: [start(m).startOf('month'), end(m).endOf('month')] as DT,
|
|
2573
|
-
近一月: [start(m).add(-1, 'month').add(1, 'day'), end(m)],
|
|
2574
|
-
下月: [start(m).add(1, 'month').startOf('month'), end(m).add(1, 'month').endOf('month')],
|
|
2575
|
-
近一年: [start(m).add(-1, 'year').add(1, 'day'), end(m)],
|
|
2576
|
-
年初至今: [start(m).startOf('year'), end(m)]
|
|
2577
|
-
};
|
|
2578
|
-
}
|
|
2579
|
-
function presets_date() {
|
|
2580
|
-
return [{
|
|
2581
|
-
label: '一月前',
|
|
2582
|
-
value: start().add(-1, 'month')
|
|
2583
|
-
}, {
|
|
2584
|
-
label: '一周前',
|
|
2585
|
-
value: start().add(-1, 'week')
|
|
2586
|
-
}, {
|
|
2587
|
-
label: '一天前',
|
|
2588
|
-
value: start().add(-1, 'day')
|
|
2589
|
-
}, {
|
|
2590
|
-
label: '一天后',
|
|
2591
|
-
value: start().add(1, 'day')
|
|
2592
|
-
}, {
|
|
2593
|
-
label: '两天后',
|
|
2594
|
-
value: start().add(2, 'day')
|
|
2595
|
-
}, {
|
|
2596
|
-
label: '三天后',
|
|
2597
|
-
value: start().add(3, 'day')
|
|
2598
|
-
}, {
|
|
2599
|
-
label: '一周后',
|
|
2600
|
-
value: start().add(1, 'week')
|
|
2601
|
-
}, {
|
|
2602
|
-
label: '两周后',
|
|
2603
|
-
value: start().add(2, 'week')
|
|
2604
|
-
}, {
|
|
2605
|
-
label: '一月后',
|
|
2606
|
-
value: start().add(1, 'month')
|
|
2607
|
-
}, {
|
|
2608
|
-
label: '两月后',
|
|
2609
|
-
value: start().add(2, 'month')
|
|
2610
|
-
}, {
|
|
2611
|
-
label: '半年后',
|
|
2612
|
-
value: start().add(6, 'month')
|
|
2613
|
-
}];
|
|
2614
|
-
}
|
|
2615
|
-
function isMoment(m) {
|
|
2616
|
-
return isFunction(m.format);
|
|
2617
|
-
}
|
|
2618
|
-
/**
|
|
2619
|
-
* 获取若干天后的日期
|
|
2620
|
-
*/
|
|
2621
|
-
function getFutureDate(num) {
|
|
2622
|
-
return dayjs().add(num, 'days').format('YYYY-MM-DD');
|
|
2623
|
-
}
|
|
2624
|
-
function dayjs_quarter(input, which_quarter) {
|
|
2625
|
-
if (typeof which_quarter !== 'undefined') {
|
|
2626
|
-
// 设置季度:调整月份至目标季度的第一个月,并保持其他部分不变
|
|
2627
|
-
var targetMonth = (which_quarter - 1) * 3;
|
|
2628
|
-
var adjustedDate = input.month(targetMonth);
|
|
2629
|
-
return [adjustedDate, which_quarter];
|
|
2630
|
-
} else {
|
|
2631
|
-
// 获取当前季度:根据月份计算季度(1-4)
|
|
2632
|
-
var currentMonth = input.month(); // 0-11
|
|
2633
|
-
var currentQuarter = Math.floor(currentMonth / 3) + 1;
|
|
2634
|
-
return [input, currentQuarter];
|
|
2635
|
-
}
|
|
2636
|
-
}
|
|
2637
|
-
function diff_between(a, b, unit) {
|
|
2638
|
-
var _float = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : true;
|
|
2639
|
-
return dayjs(a).diff(dayjs(b), unit, _float);
|
|
2640
|
-
}
|
|
2641
|
-
var colorMap = {
|
|
2642
|
-
'log': '#1475b2',
|
|
2643
|
-
'warn': '#f89c1e',
|
|
2644
|
-
'error': '#ed7961'
|
|
2645
|
-
};
|
|
2646
|
-
var big_txt_style = 'color:#1772F6;font-weight:bold;font-size:6em;padding:10px 20%;text-shadow:0.7px -1px 0 rgb(255 255 255 / 100%),1.4px -2px 0 rgb(255 255 255 / 96%),2px -3px 0 rgb(255 255 255 / 92%),2.8px -4px 0 rgb(255 255 255 / 88%),-1px 1px 2px rgb(0 0 0 / 70%),-2px 2px 4px rgb(0 0 0 / 70%),-3px 3px 6px rgb(0 0 0 / 70%);background: linear-gradient(to right top,oklab(58.2% -0.04 -0.21),oklab(58.2% -0.376 -0.21));';
|
|
2647
|
-
var MyLog = /*#__PURE__*/function () {
|
|
2648
|
-
function MyLog(e) {
|
|
2649
|
-
_classCallCheck(this, MyLog);
|
|
2650
|
-
Object.defineProperty(this, "env", {
|
|
2651
|
-
enumerable: true,
|
|
2652
|
-
configurable: true,
|
|
2653
|
-
writable: true,
|
|
2654
|
-
value: void 0
|
|
2655
|
-
});
|
|
2656
|
-
this.env = e;
|
|
2657
|
-
}
|
|
2658
|
-
return _createClass(MyLog, [{
|
|
2659
|
-
key: "_logMsg",
|
|
2660
|
-
value: function _logMsg() {
|
|
2661
|
-
var type = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'log';
|
|
2662
|
-
var _a;
|
|
2663
|
-
var fn = (_a = MyLog._handler) === null || _a === void 0 ? void 0 : _a[type];
|
|
2664
|
-
if (!fn || !isFunction(fn)) return;
|
|
2665
|
-
for (var _len10 = arguments.length, msg = new Array(_len10 > 1 ? _len10 - 1 : 0), _key10 = 1; _key10 < _len10; _key10++) {
|
|
2666
|
-
msg[_key10 - 1] = arguments[_key10];
|
|
2667
|
-
}
|
|
2668
|
-
fn.apply(void 0, ["%c ".concat(this.env, " %c ").concat(formatDateTime(), " "), "padding: 1px; border-radius:3px 0 0 3px; color: #fff; background: ".concat(colorMap[type], ";"), "padding: 1px; border-radius: 0 3px 3px 0; color: #fff; background: #606060;"].concat(msg));
|
|
2669
|
-
}
|
|
2670
|
-
}, {
|
|
2671
|
-
key: "logBig",
|
|
2672
|
-
value: function logBig(t) {
|
|
2673
|
-
var _a;
|
|
2674
|
-
var fn = (_a = MyLog._handler) === null || _a === void 0 ? void 0 : _a.log;
|
|
2675
|
-
if (!fn || !isFunction(fn)) return;
|
|
2676
|
-
fn("%c".concat(t), big_txt_style);
|
|
2677
|
-
}
|
|
2678
|
-
}, {
|
|
2679
|
-
key: "log",
|
|
2680
|
-
value: function log() {
|
|
2681
|
-
for (var _len11 = arguments.length, msg = new Array(_len11), _key11 = 0; _key11 < _len11; _key11++) {
|
|
2682
|
-
msg[_key11] = arguments[_key11];
|
|
2683
|
-
}
|
|
2684
|
-
this._logMsg.apply(this, ['log'].concat(msg));
|
|
2685
|
-
}
|
|
2686
|
-
}, {
|
|
2687
|
-
key: "warn",
|
|
2688
|
-
value: function warn() {
|
|
2689
|
-
for (var _len12 = arguments.length, msg = new Array(_len12), _key12 = 0; _key12 < _len12; _key12++) {
|
|
2690
|
-
msg[_key12] = arguments[_key12];
|
|
2691
|
-
}
|
|
2692
|
-
this._logMsg.apply(this, ['warn'].concat(msg));
|
|
2693
|
-
}
|
|
2694
|
-
}, {
|
|
2695
|
-
key: "error",
|
|
2696
|
-
value: function error() {
|
|
2697
|
-
for (var _len13 = arguments.length, msg = new Array(_len13), _key13 = 0; _key13 < _len13; _key13++) {
|
|
2698
|
-
msg[_key13] = arguments[_key13];
|
|
2699
|
-
}
|
|
2700
|
-
this._logMsg.apply(this, ['error'].concat(msg));
|
|
2701
|
-
}
|
|
2702
|
-
}], [{
|
|
2703
|
-
key: "handler",
|
|
2704
|
-
set: function set(v) {
|
|
2705
|
-
if (!v) return;
|
|
2706
|
-
MyLog._handler = Object.assign(Object.assign({}, MyLog._handler), v);
|
|
2707
|
-
}
|
|
2708
|
-
}]);
|
|
2709
|
-
}();
|
|
2710
|
-
Object.defineProperty(MyLog, "_handler", {
|
|
2711
|
-
enumerable: true,
|
|
2712
|
-
configurable: true,
|
|
2713
|
-
writable: true,
|
|
2714
|
-
value: console
|
|
2715
|
-
});
|
|
2716
|
-
MyLog.handler = console;
|
|
2717
|
-
var EventEmitter = /*#__PURE__*/function () {
|
|
2718
|
-
function EventEmitter() {
|
|
2719
|
-
_classCallCheck(this, EventEmitter);
|
|
2720
|
-
Object.defineProperty(this, "events", {
|
|
2721
|
-
enumerable: true,
|
|
2722
|
-
configurable: true,
|
|
2723
|
-
writable: true,
|
|
2724
|
-
value: {}
|
|
2725
|
-
});
|
|
2726
|
-
}
|
|
2727
|
-
return _createClass(EventEmitter, [{
|
|
2728
|
-
key: "addListener",
|
|
2729
|
-
value: function addListener(event, listener) {
|
|
2730
|
-
var existing = this.events[event];
|
|
2731
|
-
if (!existing) {
|
|
2732
|
-
this.events[event] = existing = [];
|
|
2733
|
-
}
|
|
2734
|
-
existing.includes(listener) || existing.push(listener);
|
|
2735
|
-
return this;
|
|
2736
|
-
}
|
|
2737
|
-
}, {
|
|
2738
|
-
key: "on",
|
|
2739
|
-
value: function on(event, listener) {
|
|
2740
|
-
// this.off(event, listener)
|
|
2741
|
-
return this.addListener(event, listener);
|
|
2742
|
-
}
|
|
2743
|
-
}, {
|
|
2744
|
-
key: "on_cb",
|
|
2745
|
-
value: function on_cb(event, listener) {
|
|
2746
|
-
// this.off(event, listener)
|
|
2747
|
-
this.addListener(event, listener);
|
|
2748
|
-
return listener;
|
|
2749
|
-
}
|
|
2750
|
-
}, {
|
|
2751
|
-
key: "on_rm",
|
|
2752
|
-
value: function on_rm(event, listener) {
|
|
2753
|
-
var _this2 = this;
|
|
2754
|
-
// this.off(event, listener)
|
|
2755
|
-
this.addListener(event, listener);
|
|
2756
|
-
return function () {
|
|
2757
|
-
_this2.off(event, listener);
|
|
2758
|
-
};
|
|
2759
|
-
}
|
|
2760
|
-
}, {
|
|
2761
|
-
key: "emit",
|
|
2762
|
-
value: function emit(event) {
|
|
2763
|
-
for (var _len14 = arguments.length, args = new Array(_len14 > 1 ? _len14 - 1 : 0), _key14 = 1; _key14 < _len14; _key14++) {
|
|
2764
|
-
args[_key14 - 1] = arguments[_key14];
|
|
2765
|
-
}
|
|
2766
|
-
var existing = this.events[event];
|
|
2767
|
-
// EventEmitter.logger.log({ event, args })
|
|
2768
|
-
if (!existing) {
|
|
2769
|
-
return false;
|
|
2770
|
-
}
|
|
2771
|
-
existing.forEach(function (fn) {
|
|
2772
|
-
fn.apply(void 0, args);
|
|
2773
|
-
});
|
|
2774
|
-
return true;
|
|
2775
|
-
}
|
|
2776
|
-
}, {
|
|
2777
|
-
key: "removeAllListeners",
|
|
2778
|
-
value: function removeAllListeners(event) {
|
|
2779
|
-
this.events[event] = [];
|
|
2780
|
-
return this;
|
|
2781
|
-
}
|
|
2782
|
-
}, {
|
|
2783
|
-
key: "off",
|
|
2784
|
-
value: function off(event, listener) {
|
|
2785
|
-
var existing = this.events[event];
|
|
2786
|
-
if (!existing) {
|
|
2787
|
-
return this;
|
|
2788
|
-
}
|
|
2789
|
-
var index = existing.findIndex(function (_) {
|
|
2790
|
-
return _ === listener;
|
|
2791
|
-
});
|
|
2792
|
-
if (index < 0) {
|
|
2793
|
-
return this;
|
|
2794
|
-
}
|
|
2795
|
-
existing.splice(index, 1);
|
|
2796
|
-
return this;
|
|
2797
|
-
}
|
|
2798
|
-
}, {
|
|
2799
|
-
key: "once",
|
|
2800
|
-
value: function once(event, listener) {
|
|
2801
|
-
var _this3 = this;
|
|
2802
|
-
var _fn = function fn() {
|
|
2803
|
-
listener.apply(void 0, arguments);
|
|
2804
|
-
_this3.off(event, _fn);
|
|
2805
|
-
};
|
|
2806
|
-
this.on(event, _fn);
|
|
2807
|
-
return this;
|
|
2808
|
-
}
|
|
2809
|
-
}, {
|
|
2810
|
-
key: "prependListener",
|
|
2811
|
-
value: function prependListener(event, listener) {
|
|
2812
|
-
return this;
|
|
2813
|
-
}
|
|
2814
|
-
}, {
|
|
2815
|
-
key: "prependOnceListener",
|
|
2816
|
-
value: function prependOnceListener(event, listener) {
|
|
2817
|
-
return this;
|
|
2818
|
-
}
|
|
2819
|
-
}, {
|
|
2820
|
-
key: "removeListener",
|
|
2821
|
-
value: function removeListener(event, listener) {
|
|
2822
|
-
return this;
|
|
2823
|
-
}
|
|
2824
|
-
}, {
|
|
2825
|
-
key: "setMaxListeners",
|
|
2826
|
-
value: function setMaxListeners(n) {
|
|
2827
|
-
return this;
|
|
2828
|
-
}
|
|
2829
|
-
}, {
|
|
2830
|
-
key: "getMaxListeners",
|
|
2831
|
-
value: function getMaxListeners() {
|
|
2832
|
-
return 0;
|
|
2833
|
-
}
|
|
2834
|
-
}, {
|
|
2835
|
-
key: "listeners",
|
|
2836
|
-
value: function listeners(event) {
|
|
2837
|
-
return [];
|
|
2838
|
-
}
|
|
2839
|
-
}, {
|
|
2840
|
-
key: "rawListeners",
|
|
2841
|
-
value: function rawListeners(event) {
|
|
2842
|
-
return [];
|
|
2843
|
-
}
|
|
2844
|
-
}, {
|
|
2845
|
-
key: "eventNames",
|
|
2846
|
-
value: function eventNames() {
|
|
2847
|
-
return [];
|
|
2848
|
-
}
|
|
2849
|
-
}, {
|
|
2850
|
-
key: "listenerCount",
|
|
2851
|
-
value: function listenerCount(type) {
|
|
2852
|
-
return 0;
|
|
2853
|
-
}
|
|
2854
|
-
}]);
|
|
2855
|
-
}();
|
|
2856
|
-
Object.defineProperty(EventEmitter, "logger", {
|
|
2857
|
-
enumerable: true,
|
|
2858
|
-
configurable: true,
|
|
2859
|
-
writable: true,
|
|
2860
|
-
value: new MyLog('EventEmitter')
|
|
2861
|
-
});
|
|
2862
|
-
var EMPTY_PLACEHOLDER$1 = '-';
|
|
2863
|
-
var TOKEN_KEY$1 = 'Σ(っ °Д °;)っ';
|
|
2864
|
-
var ARG_URS1_KEY$1 = 'usr1';
|
|
2865
|
-
var ARG_URS2_KEY$1 = 'usr2';
|
|
2866
|
-
var noop = function noop() {};
|
|
2867
|
-
var ROMAN_NUMERALS = {
|
|
2868
|
-
1: 'Ⅰ',
|
|
2869
|
-
2: 'Ⅱ',
|
|
2870
|
-
3: 'Ⅲ',
|
|
2871
|
-
4: 'Ⅳ',
|
|
2872
|
-
5: 'Ⅴ',
|
|
2873
|
-
6: 'Ⅵ',
|
|
2874
|
-
7: 'Ⅶ',
|
|
2875
|
-
8: 'Ⅷ',
|
|
2876
|
-
9: 'Ⅷ',
|
|
2877
|
-
10: 'Ⅹ'
|
|
2878
|
-
};
|
|
2879
|
-
var selectOptionMap = {};
|
|
2880
|
-
var REGE_AutoComplete = /\<(.*)\>a$/;
|
|
2881
|
-
var REGE_MyCheckbox = /\<(.*)\>c$/;
|
|
2882
|
-
var REGE_MySelect = /\<(.*)\>s$/;
|
|
2883
|
-
var REGE_EXCLUSIVE = /^(.*)\<(.*)\>(.*)#$/;
|
|
2884
|
-
var optionKey其他 = 99;
|
|
2885
|
-
var optionKey不详 = 100;
|
|
2886
|
-
var optionKey否 = 0;
|
|
2887
|
-
var defalutSp = [{
|
|
2888
|
-
label: '不详',
|
|
2889
|
-
value: optionKey不详
|
|
2890
|
-
}, {
|
|
2891
|
-
label: '其他',
|
|
2892
|
-
value: optionKey其他,
|
|
2893
|
-
inputType: 'MyInput'
|
|
2894
|
-
}, {
|
|
2895
|
-
label: '其它',
|
|
2896
|
-
value: optionKey其他,
|
|
2897
|
-
inputType: 'MyInput'
|
|
2898
|
-
}, {
|
|
2899
|
-
label: '无',
|
|
2900
|
-
value: optionKey否,
|
|
2901
|
-
exclusive: true
|
|
2902
|
-
}, {
|
|
2903
|
-
label: '否',
|
|
2904
|
-
value: optionKey否,
|
|
2905
|
-
exclusive: true
|
|
2906
|
-
}];
|
|
2907
|
-
function _getSimpleOptions(_arr) {
|
|
2908
|
-
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
2909
|
-
var arr = parseList(_arr);
|
|
2910
|
-
var _options$sp = options.sp,
|
|
2911
|
-
sp = _options$sp === void 0 ? [] : _options$sp,
|
|
2912
|
-
_options$start = options.start,
|
|
2913
|
-
start = _options$start === void 0 ? 1 : _options$start,
|
|
2914
|
-
_options$useDefault = options.useDefault,
|
|
2915
|
-
useDefault = _options$useDefault === void 0 ? true : _options$useDefault,
|
|
2916
|
-
useString = options.useString;
|
|
2917
|
-
var index = start;
|
|
2918
|
-
var opt = arr.map(function (_label, idx) {
|
|
2919
|
-
var _a, _b;
|
|
2920
|
-
var preset = presetInput(_label);
|
|
2921
|
-
var label = (_a = preset.label) !== null && _a !== void 0 ? _a : _label;
|
|
2922
|
-
var _defaultSpItem = useDefault ? defalutSp.find(function (s) {
|
|
2923
|
-
return label === s.label;
|
|
2924
|
-
}) : null;
|
|
2925
|
-
var _spItem = sp.find(function (s) {
|
|
2926
|
-
return label === s.label;
|
|
2927
|
-
});
|
|
2928
|
-
var spItem = (_b = _spItem !== null && _spItem !== void 0 ? _spItem : _defaultSpItem) !== null && _b !== void 0 ? _b : {};
|
|
2929
|
-
if (spItem.value && useString) {
|
|
2930
|
-
spItem.value = spItem.value.toString();
|
|
2931
|
-
}
|
|
2932
|
-
var _value = _defaultSpItem ? index : index++;
|
|
2933
|
-
return Object.assign({
|
|
2934
|
-
label: label,
|
|
2935
|
-
value: useString ? _value.toString() : _value,
|
|
2936
|
-
inputType: preset.inputType,
|
|
2937
|
-
props: preset.props,
|
|
2938
|
-
exclusive: preset.exclusive,
|
|
2939
|
-
parentheses: preset.parentheses,
|
|
2940
|
-
prefix: preset.prefix,
|
|
2941
|
-
suffix: preset.suffix
|
|
2942
|
-
}, spItem);
|
|
2943
|
-
});
|
|
2944
|
-
return opt;
|
|
2945
|
-
}
|
|
2946
|
-
function getSimpleOptions(_arr) {
|
|
2947
|
-
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
2948
|
-
var ret = typeof _arr === 'function' ? function () {
|
|
2949
|
-
return _getSimpleOptions(_arr(), options);
|
|
2950
|
-
} : _getSimpleOptions(_arr, options);
|
|
2951
|
-
return ret;
|
|
2952
|
-
}
|
|
2953
|
-
function _getSameOptions(_arr) {
|
|
2954
|
-
var arr = parseList(_arr);
|
|
2955
|
-
return arr.map(function (label) {
|
|
2956
|
-
return {
|
|
2957
|
-
label: label,
|
|
2958
|
-
value: label
|
|
2959
|
-
};
|
|
2960
|
-
});
|
|
2961
|
-
}
|
|
2962
|
-
function getSameOptions(_arr) {
|
|
2963
|
-
var ret = typeof _arr === 'function' ? function () {
|
|
2964
|
-
return _getSameOptions(_arr());
|
|
2965
|
-
} : _getSameOptions(_arr);
|
|
2966
|
-
return ret;
|
|
2967
|
-
}
|
|
2968
|
-
function getDualModeOptions(arr, options) {
|
|
2969
|
-
return [getSimpleOptions(arr, options), getSameOptions(arr)];
|
|
2970
|
-
}
|
|
2971
|
-
function parseList(arr) {
|
|
2972
|
-
if (!arr) return [];
|
|
2973
|
-
var _arr = [];
|
|
2974
|
-
var split1 = [];
|
|
2975
|
-
if (Array.isArray(arr)) {
|
|
2976
|
-
_arr = arr;
|
|
2977
|
-
} else if ((split1 = arr.split(',')) && split1.length > 1) {
|
|
2978
|
-
_arr = split1;
|
|
2979
|
-
} else if ((split1 = arr.split('、')) && split1.length > 1) {
|
|
2980
|
-
_arr = split1;
|
|
2981
|
-
}
|
|
2982
|
-
return _arr;
|
|
2983
|
-
}
|
|
2984
|
-
function presetInput(_label) {
|
|
2985
|
-
if (!_label) return {
|
|
2986
|
-
label: _label
|
|
2987
|
-
};
|
|
2988
|
-
var withInput = (_label === null || _label === void 0 ? void 0 : _label.endsWith('|i')) || (_label === null || _label === void 0 ? void 0 : _label.endsWith('i'));
|
|
2989
|
-
if (withInput) {
|
|
2990
|
-
return {
|
|
2991
|
-
inputType: 'Input',
|
|
2992
|
-
label: _label.slice(0, -1)
|
|
2993
|
-
};
|
|
2994
|
-
}
|
|
2995
|
-
var useAuto = REGE_AutoComplete.exec(_label);
|
|
2996
|
-
if (useAuto) {
|
|
2997
|
-
return {
|
|
2998
|
-
inputType: 'MA',
|
|
2999
|
-
label: _label.slice(0, useAuto.index),
|
|
3000
|
-
props: {
|
|
3001
|
-
options: useAuto[1]
|
|
3002
|
-
}
|
|
3003
|
-
};
|
|
3004
|
-
}
|
|
3005
|
-
var useCheckbox = REGE_MyCheckbox.exec(_label);
|
|
3006
|
-
if (useCheckbox) {
|
|
3007
|
-
var config = useCheckbox[1];
|
|
3008
|
-
var arr = config.split('|');
|
|
3009
|
-
var options = arr[0];
|
|
3010
|
-
var marshal = arr[1] ? Number(arr[1]) : undefined;
|
|
3011
|
-
var type = arr[2] || undefined;
|
|
3012
|
-
return {
|
|
3013
|
-
inputType: 'MC',
|
|
3014
|
-
label: _label.slice(0, useCheckbox.index),
|
|
3015
|
-
props: {
|
|
3016
|
-
options: options,
|
|
3017
|
-
marshal: marshal,
|
|
3018
|
-
type: type
|
|
3019
|
-
}
|
|
3020
|
-
};
|
|
3021
|
-
}
|
|
3022
|
-
var useSelect = REGE_MySelect.exec(_label);
|
|
3023
|
-
if (useSelect) {
|
|
3024
|
-
var _config = useSelect[1];
|
|
3025
|
-
var _arr2 = _config.split('|');
|
|
3026
|
-
var _options = _arr2[0];
|
|
3027
|
-
var _marshal = _arr2[1] ? Number(_arr2[1]) : undefined;
|
|
3028
|
-
var mode = _arr2[2] || undefined;
|
|
3029
|
-
return {
|
|
3030
|
-
inputType: 'MS',
|
|
3031
|
-
label: _label.slice(0, useSelect.index),
|
|
3032
|
-
props: {
|
|
3033
|
-
options: _options,
|
|
3034
|
-
marshal: _marshal,
|
|
3035
|
-
mode: mode
|
|
3036
|
-
}
|
|
3037
|
-
};
|
|
3038
|
-
}
|
|
3039
|
-
// 文字<exclusive|parentheses|prefix|suffix>MyInput#
|
|
3040
|
-
var useExclusive = REGE_EXCLUSIVE.exec(_label);
|
|
3041
|
-
if (useExclusive) {
|
|
3042
|
-
var label = useExclusive[1];
|
|
3043
|
-
var _config2 = useExclusive[2];
|
|
3044
|
-
var _arr3 = _config2.split('|');
|
|
3045
|
-
var inputType = useExclusive[3];
|
|
3046
|
-
var exclusive = _arr3[0] ? Boolean(_arr3[0]) : undefined;
|
|
3047
|
-
var parentheses = _arr3[1] ? Boolean(_arr3[1]) : undefined;
|
|
3048
|
-
var prefix = _arr3[2];
|
|
3049
|
-
var suffix = _arr3[3];
|
|
3050
|
-
// mchcLogger.log('useExclusive', { useExclusive, exclusive, parentheses, prefix, suffix, inputType, label, _label })
|
|
3051
|
-
return {
|
|
3052
|
-
exclusive: exclusive,
|
|
3053
|
-
parentheses: parentheses,
|
|
3054
|
-
prefix: prefix,
|
|
3055
|
-
suffix: suffix,
|
|
3056
|
-
inputType: inputType,
|
|
3057
|
-
label: label
|
|
3058
|
-
};
|
|
3059
|
-
}
|
|
3060
|
-
return {
|
|
3061
|
-
label: _label
|
|
3062
|
-
};
|
|
3063
|
-
}
|
|
3064
|
-
function getPresetOptions(key) {
|
|
3065
|
-
var pure = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
3066
|
-
var _a, _b;
|
|
3067
|
-
var options = (_b = (_a = selectOptionMap[key]) === null || _a === void 0 ? void 0 : _a.call(selectOptionMap)) !== null && _b !== void 0 ? _b : [];
|
|
3068
|
-
return pure ? options.map(function (_) {
|
|
3069
|
-
return Object.assign(Object.assign({}, _), {
|
|
3070
|
-
inputType: undefined
|
|
3071
|
-
});
|
|
3072
|
-
}) : options;
|
|
3073
|
-
}
|
|
3074
|
-
function getOptionLabel(k, value) {
|
|
3075
|
-
var defaultLabel = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : '';
|
|
3076
|
-
var _a, _b, _c, _d;
|
|
3077
|
-
var options = (_b = (_a = selectOptionMap[k]) === null || _a === void 0 ? void 0 : _a.call(selectOptionMap)) !== null && _b !== void 0 ? _b : [];
|
|
3078
|
-
return (_d = (_c = options.find(function (_) {
|
|
3079
|
-
return _.value === value;
|
|
3080
|
-
})) === null || _c === void 0 ? void 0 : _c.label) !== null && _d !== void 0 ? _d : defaultLabel;
|
|
3081
|
-
}
|
|
3082
|
-
function getOptionValue(k, label) {
|
|
3083
|
-
var _a, _b, _c;
|
|
3084
|
-
var options = (_b = (_a = selectOptionMap[k]) === null || _a === void 0 ? void 0 : _a.call(selectOptionMap)) !== null && _b !== void 0 ? _b : [];
|
|
3085
|
-
return (_c = options.find(function (_) {
|
|
3086
|
-
return _.label === label;
|
|
3087
|
-
})) === null || _c === void 0 ? void 0 : _c.value;
|
|
3088
|
-
}
|
|
3089
|
-
// merge options
|
|
3090
|
-
function merge_preset_options(ops) {
|
|
3091
|
-
Object.assign(selectOptionMap, ops);
|
|
3092
|
-
}
|
|
3093
|
-
var dic_map = {};
|
|
3094
|
-
function getDictionaries() {
|
|
3095
|
-
return dic_map;
|
|
3096
|
-
}
|
|
3097
|
-
/**
|
|
3098
|
-
*
|
|
3099
|
-
* @param value 枚举值value
|
|
3100
|
-
* @param type string 字典类型
|
|
3101
|
-
*/
|
|
3102
|
-
function getDictionariesEnumerations(type) {
|
|
3103
|
-
var _a;
|
|
3104
|
-
var dictionaries = getDictionaries();
|
|
3105
|
-
var object = dictionaries === null || dictionaries === void 0 ? void 0 : dictionaries[type];
|
|
3106
|
-
if (!object) {
|
|
3107
|
-
console.warn("\u5B57\u5178 ".concat(type, " \u4E0D\u5B58\u5728!"));
|
|
3108
|
-
return [];
|
|
3109
|
-
}
|
|
3110
|
-
var enumerations = (_a = object === null || object === void 0 ? void 0 : object.enumerations) !== null && _a !== void 0 ? _a : [];
|
|
3111
|
-
return enumerations;
|
|
3112
|
-
}
|
|
3113
|
-
/**
|
|
3114
|
-
*
|
|
3115
|
-
* @param value 枚举值value
|
|
3116
|
-
* @param type string 字典类型
|
|
3117
|
-
*/
|
|
3118
|
-
function getDictionaryLabel(type, value) {
|
|
3119
|
-
var enumerations = getDictionariesEnumerations(type);
|
|
3120
|
-
var item = enumerations.find(function (_) {
|
|
3121
|
-
return _.value === +value;
|
|
3122
|
-
});
|
|
3123
|
-
if (!item) {
|
|
3124
|
-
return null;
|
|
3125
|
-
}
|
|
3126
|
-
return item.label;
|
|
3127
|
-
}
|
|
3128
|
-
/**
|
|
3129
|
-
*
|
|
3130
|
-
* @param label 枚举值value
|
|
3131
|
-
* @param type string 字典类型
|
|
3132
|
-
*/
|
|
3133
|
-
function getDictionaryValue(type, label) {
|
|
3134
|
-
var enumerations = getDictionariesEnumerations(type);
|
|
3135
|
-
var item = enumerations.find(function (_) {
|
|
3136
|
-
return _.label === label;
|
|
3137
|
-
});
|
|
3138
|
-
if (!item) {
|
|
3139
|
-
return null;
|
|
3140
|
-
}
|
|
3141
|
-
return item.value;
|
|
3142
|
-
}
|
|
3143
|
-
// merge dic
|
|
3144
|
-
function merge_dict(ops) {
|
|
3145
|
-
Object.assign(dic_map, ops);
|
|
3146
|
-
}
|
|
3147
|
-
function create_load_src() {
|
|
3148
|
-
var cache = {};
|
|
3149
|
-
var head_el = document.getElementsByTagName("head")[0] || document.documentElement;
|
|
3150
|
-
function exec(options, node) {
|
|
3151
|
-
var opt;
|
|
3152
|
-
if (typeof options === "string") {
|
|
3153
|
-
opt = {
|
|
3154
|
-
url: options,
|
|
3155
|
-
debug: false
|
|
3156
|
-
};
|
|
3157
|
-
} else {
|
|
3158
|
-
opt = options;
|
|
3159
|
-
}
|
|
3160
|
-
var cacheId = opt.id || opt.url;
|
|
3161
|
-
var cacheEntry = cache[cacheId];
|
|
3162
|
-
if (cacheEntry) {
|
|
3163
|
-
if (!!opt.debug) {
|
|
3164
|
-
console.log("load-js: cache hit", cacheId);
|
|
3165
|
-
}
|
|
3166
|
-
return cacheEntry;
|
|
3167
|
-
} else if (opt.allowExternal !== false) {
|
|
3168
|
-
var el = getScriptById(opt.id) || getScriptByUrl(opt.url);
|
|
3169
|
-
if (el) {
|
|
3170
|
-
var promise = Promise.resolve(el);
|
|
3171
|
-
if (cacheId) {
|
|
3172
|
-
cache[cacheId] = promise;
|
|
3173
|
-
}
|
|
3174
|
-
return promise;
|
|
3175
|
-
}
|
|
3176
|
-
}
|
|
3177
|
-
if (!opt.url && !opt.text) {
|
|
3178
|
-
throw new Error("load-js: must provide a url or text to load");
|
|
3179
|
-
}
|
|
3180
|
-
var pending = (opt.url ? loadScript : runScript)(node, createEl(opt));
|
|
3181
|
-
if (cacheId && opt.cache !== false) {
|
|
3182
|
-
cache[cacheId] = pending;
|
|
3183
|
-
}
|
|
3184
|
-
return pending;
|
|
3185
|
-
}
|
|
3186
|
-
function runScript(head, el) {
|
|
3187
|
-
head.appendChild(el);
|
|
3188
|
-
return Promise.resolve(el);
|
|
3189
|
-
}
|
|
3190
|
-
function loadScript(head, el) {
|
|
3191
|
-
return new Promise(function (resolve, reject) {
|
|
3192
|
-
// Handle Script loading
|
|
3193
|
-
var done = false;
|
|
3194
|
-
// Attach handlers for all browsers.
|
|
3195
|
-
//
|
|
3196
|
-
// References:
|
|
3197
|
-
// http://stackoverflow.com/questions/4845762/onload-handler-for-script-tag-in-internet-explorer
|
|
3198
|
-
// http://stevesouders.com/efws/script-onload.php
|
|
3199
|
-
// https://www.html5rocks.com/en/tutorials/speed/script-loading/
|
|
3200
|
-
//
|
|
3201
|
-
//@ts-ignore
|
|
3202
|
-
el.onload = el.onreadystatechange = function () {
|
|
3203
|
-
//@ts-ignore
|
|
3204
|
-
if (!done && (!el.readyState || el.readyState === "loaded" || el.readyState === "complete")) {
|
|
3205
|
-
done = true;
|
|
3206
|
-
// Handle memory leak in IE
|
|
3207
|
-
//@ts-ignore
|
|
3208
|
-
el.onload = el.onreadystatechange = null;
|
|
3209
|
-
resolve(el);
|
|
3210
|
-
}
|
|
3211
|
-
};
|
|
3212
|
-
el.onerror = reject;
|
|
3213
|
-
head.appendChild(el);
|
|
3214
|
-
});
|
|
3215
|
-
}
|
|
3216
|
-
function createEl(opt) {
|
|
3217
|
-
var _a;
|
|
3218
|
-
if ((_a = opt.url) === null || _a === void 0 ? void 0 : _a.endsWith('css')) {
|
|
3219
|
-
return createLink(opt);
|
|
3220
|
-
}
|
|
3221
|
-
if (opt.type === 'text/css') {
|
|
3222
|
-
return createStyle(opt);
|
|
3223
|
-
}
|
|
3224
|
-
return createScript(opt);
|
|
3225
|
-
}
|
|
3226
|
-
function createScript(options) {
|
|
3227
|
-
var el = document.createElement("script");
|
|
3228
|
-
el.charset = options.charset || "utf-8";
|
|
3229
|
-
el.type = options.type || "text/javascript";
|
|
3230
|
-
el.async = !!options.async;
|
|
3231
|
-
el.id = options.id || options.url;
|
|
3232
|
-
//@ts-ignore
|
|
3233
|
-
el.loadJS = "watermark";
|
|
3234
|
-
if (options.url) {
|
|
3235
|
-
el.src = options.url;
|
|
3236
|
-
}
|
|
3237
|
-
if (options.text) {
|
|
3238
|
-
el.text = options.text;
|
|
3239
|
-
}
|
|
3240
|
-
return el;
|
|
3241
|
-
}
|
|
3242
|
-
function createLink(options) {
|
|
3243
|
-
var el = document.createElement("link");
|
|
3244
|
-
el.charset = options.charset || "utf-8";
|
|
3245
|
-
el.type = options.type || "text/css";
|
|
3246
|
-
el.id = options.id || options.url;
|
|
3247
|
-
el.rel = 'stylesheet';
|
|
3248
|
-
//@ts-ignore
|
|
3249
|
-
el.loadJS = "watermark";
|
|
3250
|
-
if (options.url) {
|
|
3251
|
-
el.href = options.url;
|
|
3252
|
-
}
|
|
3253
|
-
console.log('createLink', {
|
|
3254
|
-
options: options,
|
|
3255
|
-
el: el
|
|
3256
|
-
});
|
|
3257
|
-
return el;
|
|
3258
|
-
}
|
|
3259
|
-
function createStyle(options) {
|
|
3260
|
-
var el = document.createElement("style");
|
|
3261
|
-
el.id = options.id || options.text;
|
|
3262
|
-
//@ts-ignore
|
|
3263
|
-
el.loadJS = "watermark";
|
|
3264
|
-
if (options.text) {
|
|
3265
|
-
el.textContent = options.text;
|
|
3266
|
-
}
|
|
3267
|
-
return el;
|
|
3268
|
-
}
|
|
3269
|
-
function getScriptById(id) {
|
|
3270
|
-
var el = id && document.getElementById(id);
|
|
3271
|
-
//@ts-ignore
|
|
3272
|
-
if (el && el.loadJS !== "watermark") {
|
|
3273
|
-
console.warn("load-js: duplicate script with id:", id);
|
|
3274
|
-
return el;
|
|
3275
|
-
}
|
|
3276
|
-
}
|
|
3277
|
-
function getScriptByUrl(url) {
|
|
3278
|
-
var el = url && document.querySelector("script[src='" + url + "']");
|
|
3279
|
-
//@ts-ignore
|
|
3280
|
-
if (el && el.loadJS !== "watermark") {
|
|
3281
|
-
console.warn("load-js: duplicate script with url:", url);
|
|
3282
|
-
return el;
|
|
3283
|
-
}
|
|
3284
|
-
}
|
|
3285
|
-
return function load(items) {
|
|
3286
|
-
var node = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : head_el;
|
|
3287
|
-
return items instanceof Array ? Promise.all(items.map(function (_) {
|
|
3288
|
-
return exec(_, node);
|
|
3289
|
-
})) : exec(items, node);
|
|
3290
|
-
};
|
|
3291
|
-
}
|
|
3292
|
-
var load_src_ = create_load_src();
|
|
3293
|
-
function load_src(items, node) {
|
|
3294
|
-
return load_src_(items, node);
|
|
3295
|
-
}
|
|
13
|
+
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
14
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
15
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
16
|
+
function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
|
|
17
|
+
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
|
|
18
|
+
import { EventEmitter, get as _get, getSearchParamsValue, MyLog, simple_decrypt, simple_encrypt, getMomentObj, formatDate, formatDateTime, isString, toFloat, diff_between, isNumber, EMPTY_PLACEHOLDER, toInt, identity } from '@noah-libjs/utils';
|
|
19
|
+
export * from '@noah-libjs/utils';
|
|
20
|
+
import store from 'store';
|
|
21
|
+
import { createInstance, Request, request as request$1 } from '@noah-libjs/request';
|
|
22
|
+
export * from '@noah-libjs/request';
|
|
23
|
+
import ReconnectingWebSocket from 'reconnecting-websocket';
|
|
24
|
+
import dayjs from 'dayjs';
|
|
25
|
+
import React, { Suspense } from 'react';
|
|
26
|
+
import { render } from 'react-dom';
|
|
3296
27
|
|
|
3297
28
|
// legacy
|
|
3298
29
|
var EventEmitter_Old = /*#__PURE__*/function () {
|
|
3299
30
|
function EventEmitter_Old() {
|
|
3300
|
-
|
|
31
|
+
_classCallCheck(this, EventEmitter_Old);
|
|
3301
32
|
}
|
|
3302
|
-
return
|
|
33
|
+
return _createClass(EventEmitter_Old, null, [{
|
|
3303
34
|
key: "getCb",
|
|
3304
35
|
value: function getCb(e) {
|
|
3305
36
|
var _EventEmitter_Old$eve;
|
|
@@ -3316,8 +47,8 @@ _EventEmitter_Old = EventEmitter_Old;
|
|
|
3316
47
|
/**
|
|
3317
48
|
* 事件集
|
|
3318
49
|
*/
|
|
3319
|
-
|
|
3320
|
-
|
|
50
|
+
_defineProperty(EventEmitter_Old, "events", new Map());
|
|
51
|
+
_defineProperty(EventEmitter_Old, "dispatch", function (event, data) {
|
|
3321
52
|
if (!_EventEmitter_Old.events.get(event)) {
|
|
3322
53
|
return;
|
|
3323
54
|
}
|
|
@@ -3329,7 +60,7 @@ _defineProperty2(EventEmitter_Old, "dispatch", function (event, data) {
|
|
|
3329
60
|
/**
|
|
3330
61
|
* 订阅事件
|
|
3331
62
|
*/
|
|
3332
|
-
|
|
63
|
+
_defineProperty(EventEmitter_Old, "subscribe", function (event, callback) {
|
|
3333
64
|
var callbacks = _EventEmitter_Old.getCb(event);
|
|
3334
65
|
if (!callbacks) {
|
|
3335
66
|
callbacks = Array();
|
|
@@ -3340,7 +71,7 @@ _defineProperty2(EventEmitter_Old, "subscribe", function (event, callback) {
|
|
|
3340
71
|
/**
|
|
3341
72
|
* 取消事件订阅
|
|
3342
73
|
*/
|
|
3343
|
-
|
|
74
|
+
_defineProperty(EventEmitter_Old, "unSubscribe", function (event, callback) {
|
|
3344
75
|
var callbacks = _EventEmitter_Old.getCb(event);
|
|
3345
76
|
if (callbacks) {
|
|
3346
77
|
var index = callbacks.indexOf(callback, 0);
|
|
@@ -3353,34 +84,34 @@ _defineProperty2(EventEmitter_Old, "unSubscribe", function (event, callback) {
|
|
|
3353
84
|
var event = new EventEmitter();
|
|
3354
85
|
var EventBus = /*#__PURE__*/function (_EventEmitter) {
|
|
3355
86
|
function EventBus(key, data) {
|
|
3356
|
-
var
|
|
3357
|
-
|
|
3358
|
-
|
|
3359
|
-
|
|
3360
|
-
|
|
3361
|
-
|
|
3362
|
-
var bus =
|
|
3363
|
-
|
|
3364
|
-
data = data || store.get(
|
|
3365
|
-
var busData =
|
|
3366
|
-
|
|
87
|
+
var _this;
|
|
88
|
+
_classCallCheck(this, EventBus);
|
|
89
|
+
_this = _callSuper(this, EventBus);
|
|
90
|
+
_defineProperty(_this, "_data", void 0);
|
|
91
|
+
_defineProperty(_this, "key", void 0);
|
|
92
|
+
_defineProperty(_this, "timeId", void 0);
|
|
93
|
+
var bus = _this;
|
|
94
|
+
_this.key = key;
|
|
95
|
+
data = data || store.get(_this.genStorePersistKey) || {};
|
|
96
|
+
var busData = _this._data = _objectSpread({}, data);
|
|
97
|
+
_this.persisitEventStore();
|
|
3367
98
|
Object.defineProperties(data, Object.keys(data).reduce(function (a, k) {
|
|
3368
|
-
return Object.assign(a,
|
|
99
|
+
return Object.assign(a, _defineProperty({}, k, {
|
|
3369
100
|
get: function get() {
|
|
3370
101
|
return busData[k];
|
|
3371
102
|
},
|
|
3372
103
|
set: function set(val) {
|
|
3373
104
|
//@ts-ignore
|
|
3374
105
|
busData[k] = val;
|
|
3375
|
-
bus.emit('change', k,
|
|
106
|
+
bus.emit('change', k, _objectSpread({}, busData));
|
|
3376
107
|
},
|
|
3377
108
|
enumerable: true
|
|
3378
109
|
}));
|
|
3379
110
|
}, {}));
|
|
3380
|
-
return
|
|
111
|
+
return _this;
|
|
3381
112
|
}
|
|
3382
|
-
|
|
3383
|
-
return
|
|
113
|
+
_inherits(EventBus, _EventEmitter);
|
|
114
|
+
return _createClass(EventBus, [{
|
|
3384
115
|
key: "data",
|
|
3385
116
|
get: function get() {
|
|
3386
117
|
return this._data;
|
|
@@ -3392,12 +123,12 @@ var EventBus = /*#__PURE__*/function (_EventEmitter) {
|
|
|
3392
123
|
}, {
|
|
3393
124
|
key: "persisitEventStore",
|
|
3394
125
|
value: function persisitEventStore() {
|
|
3395
|
-
var
|
|
126
|
+
var _this2 = this;
|
|
3396
127
|
this.key && this.on('change', function (_, val) {
|
|
3397
|
-
if (
|
|
3398
|
-
|
|
3399
|
-
store.set(
|
|
3400
|
-
|
|
128
|
+
if (_this2.timeId) clearTimeout(_this2.timeId);
|
|
129
|
+
_this2.timeId = setTimeout(function () {
|
|
130
|
+
store.set(_this2.genStorePersistKey, val);
|
|
131
|
+
_this2.timeId = undefined;
|
|
3401
132
|
}, 1000);
|
|
3402
133
|
});
|
|
3403
134
|
}
|
|
@@ -3415,29 +146,28 @@ function makeEventStore(key, data) {
|
|
|
3415
146
|
});
|
|
3416
147
|
}
|
|
3417
148
|
var TOKEN_KEY = 'Σ(っ °Д °;)っ';
|
|
3418
|
-
var EMPTY_PLACEHOLDER = '-';
|
|
3419
149
|
var ARG_URS1_KEY = 'usr1';
|
|
3420
150
|
var ARG_URS2_KEY = 'usr2';
|
|
3421
151
|
var tokenPrefix = ['Bearer', 'captcha'];
|
|
3422
152
|
function isStartWithTokenPrefix(token) {
|
|
3423
|
-
if (!token) return false;
|
|
153
|
+
if (!(token !== null && token !== void 0 && token.startsWith)) return false;
|
|
3424
154
|
return tokenPrefix.some(function (_) {
|
|
3425
155
|
return token.startsWith("".concat(_, " "));
|
|
3426
156
|
});
|
|
3427
157
|
}
|
|
3428
158
|
var AppEnv = /*#__PURE__*/function () {
|
|
3429
159
|
function AppEnv(appName) {
|
|
3430
|
-
|
|
3431
|
-
|
|
3432
|
-
|
|
3433
|
-
|
|
3434
|
-
|
|
160
|
+
_classCallCheck(this, AppEnv);
|
|
161
|
+
_defineProperty(this, "_appName", void 0);
|
|
162
|
+
_defineProperty(this, "_globalCache", {});
|
|
163
|
+
_defineProperty(this, "_isDev", void 0);
|
|
164
|
+
_defineProperty(this, "logger", new MyLog('AppEnv'));
|
|
3435
165
|
this.appName = appName;
|
|
3436
166
|
}
|
|
3437
|
-
return
|
|
167
|
+
return _createClass(AppEnv, [{
|
|
3438
168
|
key: "defineGlobalCacheProperty",
|
|
3439
169
|
value: function defineGlobalCacheProperty(k, d) {
|
|
3440
|
-
Object.defineProperty(this._globalCache, k,
|
|
170
|
+
Object.defineProperty(this._globalCache, k, _objectSpread(_objectSpread({}, d), {}, {
|
|
3441
171
|
configurable: true
|
|
3442
172
|
}));
|
|
3443
173
|
}
|
|
@@ -3480,6 +210,11 @@ var AppEnv = /*#__PURE__*/function () {
|
|
|
3480
210
|
value: function is(type) {
|
|
3481
211
|
return this.appName === type;
|
|
3482
212
|
}
|
|
213
|
+
}, {
|
|
214
|
+
key: "not",
|
|
215
|
+
value: function not(type) {
|
|
216
|
+
return this.appName !== type;
|
|
217
|
+
}
|
|
3483
218
|
}, {
|
|
3484
219
|
key: "in",
|
|
3485
220
|
value: function _in(types) {
|
|
@@ -3488,14 +223,24 @@ var AppEnv = /*#__PURE__*/function () {
|
|
|
3488
223
|
}, {
|
|
3489
224
|
key: "isSp",
|
|
3490
225
|
get: function get() {
|
|
3491
|
-
var
|
|
3492
|
-
var sp = (_ref21 = (_ref22 = (_getSearchParamsValue = getSearchParamsValue('sp')) !== null && _getSearchParamsValue !== void 0 ? _getSearchParamsValue : getSearchParamsValue('SP')) !== null && _ref22 !== void 0 ? _ref22 : location.pathname.startsWith('/view')) !== null && _ref21 !== void 0 ? _ref21 : location.pathname.startsWith('/single');
|
|
226
|
+
var sp = getSearchParamsValue('sp') || getSearchParamsValue('SP') || this.is_single;
|
|
3493
227
|
return !!sp;
|
|
3494
228
|
}
|
|
229
|
+
}, {
|
|
230
|
+
key: "is_single",
|
|
231
|
+
get: function get() {
|
|
232
|
+
return location.pathname.includes('/single') || location.pathname.includes('/view');
|
|
233
|
+
}
|
|
234
|
+
}, {
|
|
235
|
+
key: "is_new",
|
|
236
|
+
get: function get() {
|
|
237
|
+
return [location.pathname, location.pathname.includes('/single'), location.pathname.includes('/view')];
|
|
238
|
+
}
|
|
3495
239
|
}, {
|
|
3496
240
|
key: "isDev",
|
|
3497
241
|
get: function get() {
|
|
3498
|
-
|
|
242
|
+
var _this$_isDev;
|
|
243
|
+
return (_this$_isDev = this._isDev) !== null && _this$_isDev !== void 0 ? _this$_isDev : false;
|
|
3499
244
|
},
|
|
3500
245
|
set: function set(value) {
|
|
3501
246
|
this._isDev = value;
|
|
@@ -3527,19 +272,14 @@ var AppEnv = /*#__PURE__*/function () {
|
|
|
3527
272
|
}, {
|
|
3528
273
|
key: "loginRemember",
|
|
3529
274
|
get: function get() {
|
|
3530
|
-
|
|
3531
|
-
return String.fromCharCode(~_);
|
|
3532
|
-
}).join('');
|
|
3533
|
-
return safe_json_parse(str);
|
|
275
|
+
return simple_decrypt(this.store.get(this.loginRememberKey));
|
|
3534
276
|
},
|
|
3535
277
|
set: function set(value) {
|
|
3536
278
|
if (!value) {
|
|
3537
279
|
this.store.set(this.loginRememberKey, null);
|
|
3538
280
|
return;
|
|
3539
281
|
}
|
|
3540
|
-
var str =
|
|
3541
|
-
return ~_.charCodeAt(0);
|
|
3542
|
-
});
|
|
282
|
+
var str = simple_encrypt(value);
|
|
3543
283
|
this.store.set(this.loginRememberKey, str);
|
|
3544
284
|
}
|
|
3545
285
|
}, {
|
|
@@ -3568,7 +308,7 @@ var AppEnv = /*#__PURE__*/function () {
|
|
|
3568
308
|
key: "reload",
|
|
3569
309
|
value: function reload(path) {
|
|
3570
310
|
if (path) {
|
|
3571
|
-
window.location.href = path;
|
|
311
|
+
window.location.href = path.toString();
|
|
3572
312
|
} else {
|
|
3573
313
|
location.reload();
|
|
3574
314
|
}
|
|
@@ -3594,336 +334,64 @@ var AppEnv = /*#__PURE__*/function () {
|
|
|
3594
334
|
}
|
|
3595
335
|
}, {
|
|
3596
336
|
key: "getToken",
|
|
3597
|
-
value: function getToken() {
|
|
3598
|
-
return this.store.get(this.tokenKey) || this.getTokenFromSearchParam();
|
|
3599
|
-
}
|
|
3600
|
-
}, {
|
|
3601
|
-
key: "getTokenFromSearchParam",
|
|
3602
|
-
value: function getTokenFromSearchParam() {
|
|
3603
|
-
var url = new URL(location.toString());
|
|
3604
|
-
return url.searchParams.get(this.tokenKey);
|
|
3605
|
-
}
|
|
3606
|
-
}, {
|
|
3607
|
-
key: "setTokenToSearchParam",
|
|
3608
|
-
value: function setTokenToSearchParam(url) {
|
|
3609
|
-
url.searchParams.set(this.tokenKey, this.getToken() || '');
|
|
3610
|
-
return url;
|
|
3611
|
-
}
|
|
3612
|
-
}, {
|
|
3613
|
-
key: "removeToken",
|
|
3614
|
-
value: function removeToken() {
|
|
3615
|
-
this.store.remove(this.tokenKey);
|
|
3616
|
-
}
|
|
3617
|
-
}, {
|
|
3618
|
-
key: "is_fullscreen",
|
|
3619
|
-
get: function get() {
|
|
3620
|
-
return !!document.fullscreenElement;
|
|
3621
|
-
}
|
|
3622
|
-
}], [{
|
|
3623
|
-
key: "singleton",
|
|
3624
|
-
get: function get() {
|
|
3625
|
-
var _window$mchc_env;
|
|
3626
|
-
return (_window$mchc_env = window.mchc_env) !== null && _window$mchc_env !== void 0 ? _window$mchc_env : appEnv;
|
|
3627
|
-
}
|
|
3628
|
-
}]);
|
|
3629
|
-
}();
|
|
3630
|
-
var appEnv = new AppEnv('mchc_env');
|
|
3631
|
-
window.appEnv = appEnv;
|
|
3632
|
-
function getHappyConfig() {
|
|
3633
|
-
var pathname = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : location.pathname;
|
|
3634
|
-
var url = new URL(location.origin + pathname);
|
|
3635
|
-
var arr = pathname.split('/').filter(function (_) {
|
|
3636
|
-
return _;
|
|
3637
|
-
});
|
|
3638
|
-
var first = arr[0];
|
|
3639
|
-
if (first === 'happy' && arr.length > 2) {
|
|
3640
|
-
var _arg$split;
|
|
3641
|
-
arr.shift();
|
|
3642
|
-
var _arg = arr.pop();
|
|
3643
|
-
var args = (_arg$split = _arg === null || _arg === void 0 ? void 0 : _arg.split(',')) !== null && _arg$split !== void 0 ? _arg$split : [];
|
|
3644
|
-
var path = "/".concat(arr.join('/'));
|
|
3645
|
-
return _defineProperty2(_defineProperty2({
|
|
3646
|
-
path: path,
|
|
3647
|
-
args: args,
|
|
3648
|
-
search: url.search
|
|
3649
|
-
}, ARG_URS1_KEY, args[0]), ARG_URS2_KEY, args[1]);
|
|
3650
|
-
}
|
|
3651
|
-
return null;
|
|
3652
|
-
}
|
|
3653
|
-
function genHappyPath(path) {
|
|
3654
|
-
var arg = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
|
|
3655
|
-
var search = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : "";
|
|
3656
|
-
var arr = path.split('/').filter(function (_) {
|
|
3657
|
-
return _;
|
|
3658
|
-
});
|
|
3659
|
-
var _search = search !== null && search !== void 0 && search.startsWith('?') ? search : "?".concat(search);
|
|
3660
|
-
return "/happy/".concat(arr.join('/'), "/").concat(arg.join(',')).concat(_search);
|
|
3661
|
-
}
|
|
3662
|
-
function get_global_happy_arg(key) {
|
|
3663
|
-
var happyConfig = getHappyConfig(location.pathname);
|
|
3664
|
-
var conf = AppEnv.singleton.tail_global_cache('happy_conf');
|
|
3665
|
-
return (conf === null || conf === void 0 ? void 0 : conf[key]) || getSearchParamsValue(key) || (happyConfig === null || happyConfig === void 0 ? void 0 : happyConfig[key]);
|
|
3666
|
-
}
|
|
3667
|
-
function transmit_happy(path) {
|
|
3668
|
-
var search = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : "";
|
|
3669
|
-
var happyPath = getHappyConfig();
|
|
3670
|
-
return genHappyPath(path, happyPath === null || happyPath === void 0 ? void 0 : happyPath.args, search || (happyPath === null || happyPath === void 0 ? void 0 : happyPath.search));
|
|
3671
|
-
}
|
|
3672
|
-
function transmit_happy_pre(url) {
|
|
3673
|
-
var pre = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
|
|
3674
|
-
var _pre = pre !== null && pre !== void 0 && pre.startsWith('/') ? pre : "/".concat(pre);
|
|
3675
|
-
_pre = _pre === '/' ? '' : _pre;
|
|
3676
|
-
var arr = url.split('?').filter(_identity);
|
|
3677
|
-
var slash = url.startsWith('/') ? '' : '/';
|
|
3678
|
-
return transmit_happy("".concat(_pre).concat(slash).concat(arr[0]), arr[1]);
|
|
3679
|
-
}
|
|
3680
|
-
var codeMessage = {
|
|
3681
|
-
200: '服务器成功返回请求的数据。',
|
|
3682
|
-
201: '新建或修改数据成功。',
|
|
3683
|
-
202: '一个请求已经进入后台排队(异步任务)。',
|
|
3684
|
-
204: '删除数据成功。',
|
|
3685
|
-
400: '发出的请求有错误,服务器没有进行新建或修改数据的操作。',
|
|
3686
|
-
401: '用户没有权限(令牌、用户名、密码错误)。',
|
|
3687
|
-
403: '用户得到授权,但是访问是被禁止的。',
|
|
3688
|
-
404: '发出的请求针对的是不存在的记录,服务器没有进行操作。',
|
|
3689
|
-
406: '请求的格式不可得。',
|
|
3690
|
-
410: '请求的资源被永久删除,且不会再得到的。',
|
|
3691
|
-
422: '当创建一个对象时,发生一个验证错误。',
|
|
3692
|
-
500: '服务器发生错误,请检查服务器。',
|
|
3693
|
-
502: '网关错误。',
|
|
3694
|
-
503: '服务不可用,服务器暂时过载或维护。',
|
|
3695
|
-
504: '网关超时。'
|
|
3696
|
-
};
|
|
3697
|
-
var Request = /*#__PURE__*/function (_EventEmitter2) {
|
|
3698
|
-
function Request() {
|
|
3699
|
-
var _this6;
|
|
3700
|
-
var config = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
3701
|
-
_classCallCheck2(this, Request);
|
|
3702
|
-
_this6 = _callSuper2(this, Request);
|
|
3703
|
-
_defineProperty2(_this6, "ins", void 0);
|
|
3704
|
-
_defineProperty2(_this6, "get", void 0);
|
|
3705
|
-
_defineProperty2(_this6, "delete", void 0);
|
|
3706
|
-
_defineProperty2(_this6, "head", void 0);
|
|
3707
|
-
_defineProperty2(_this6, "post", void 0);
|
|
3708
|
-
_defineProperty2(_this6, "put", void 0);
|
|
3709
|
-
_this6.spawn(config);
|
|
3710
|
-
return _this6;
|
|
3711
|
-
}
|
|
3712
|
-
_inherits2(Request, _EventEmitter2);
|
|
3713
|
-
return _createClass2(Request, [{
|
|
3714
|
-
key: "displayMsg",
|
|
3715
|
-
value: function displayMsg(res) {
|
|
3716
|
-
var isSuccessful = Request.checkRTCode(res);
|
|
3717
|
-
var msg = Request.getMsg(res);
|
|
3718
|
-
if (!msg) return;
|
|
3719
|
-
this.emit('message', isSuccessful, msg, res);
|
|
3720
|
-
// if (isSuccessful) {
|
|
3721
|
-
// message.success(msg)
|
|
3722
|
-
// } else {
|
|
3723
|
-
// message.warning(msg)
|
|
3724
|
-
// }
|
|
3725
|
-
}
|
|
3726
|
-
}, {
|
|
3727
|
-
key: "spawn",
|
|
3728
|
-
value: function spawn() {
|
|
3729
|
-
var spawnConfig = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
3730
|
-
var ins = this.gen(spawnConfig);
|
|
3731
|
-
this.ins = ins;
|
|
3732
|
-
utils.extend(this, Axios.prototype, this.ins);
|
|
3733
|
-
return this.ins;
|
|
3734
|
-
}
|
|
3735
|
-
}, {
|
|
3736
|
-
key: "gen",
|
|
3737
|
-
value: function gen() {
|
|
3738
|
-
var _this7 = this;
|
|
3739
|
-
var spawnConfig = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
3740
|
-
var _spawnConfig$config = spawnConfig.config,
|
|
3741
|
-
config = _spawnConfig$config === void 0 ? {} : _spawnConfig$config,
|
|
3742
|
-
_spawnConfig$onReques = spawnConfig.onRequest,
|
|
3743
|
-
onRequest = _spawnConfig$onReques === void 0 ? function (value) {
|
|
3744
|
-
return value;
|
|
3745
|
-
} : _spawnConfig$onReques,
|
|
3746
|
-
_spawnConfig$onRespon = spawnConfig.onResponse,
|
|
3747
|
-
onResponse = _spawnConfig$onRespon === void 0 ? function (value) {
|
|
3748
|
-
return value;
|
|
3749
|
-
} : _spawnConfig$onRespon,
|
|
3750
|
-
_spawnConfig$onReject = spawnConfig.onRejected,
|
|
3751
|
-
onRejected = _spawnConfig$onReject === void 0 ? function (error) {
|
|
3752
|
-
return Promise.reject(error);
|
|
3753
|
-
} : _spawnConfig$onReject;
|
|
3754
|
-
var ins = axios.create(config);
|
|
3755
|
-
var _onErr = function _onErr(e) {
|
|
3756
|
-
_this7.emit('responseErr', e);
|
|
3757
|
-
config.logger && Request.logger.error(e);
|
|
3758
|
-
return onRejected(e);
|
|
3759
|
-
};
|
|
3760
|
-
ins.interceptors.request.use(function (config) {
|
|
3761
|
-
var _config$params;
|
|
3762
|
-
_this7.emit('beforeRequest', config);
|
|
3763
|
-
// TODO: remove
|
|
3764
|
-
config.headers.Authorization = config.headers.Authorization || appEnv.token || '';
|
|
3765
|
-
var params = config.params = (_config$params = config.params) !== null && _config$params !== void 0 ? _config$params : {};
|
|
3766
|
-
// params.pathname = location.pathname
|
|
3767
|
-
if (!config.ignore_usr) {
|
|
3768
|
-
params.usr1 = get_global_happy_arg('usr1');
|
|
3769
|
-
params.usr2 = get_global_happy_arg('usr2');
|
|
3770
|
-
}
|
|
3771
|
-
if (!config.ignore_env && window.mchcEnv) {
|
|
3772
|
-
var env_key = window.mchcEnv.env_key;
|
|
3773
|
-
params.lmenv = env_key;
|
|
3774
|
-
config.headers.Lmenv = env_key;
|
|
3775
|
-
}
|
|
3776
|
-
return onRequest(config);
|
|
3777
|
-
});
|
|
3778
|
-
ins.interceptors.response.use(function (response) {
|
|
3779
|
-
var axiosConfig = response.config,
|
|
3780
|
-
headers = response.headers;
|
|
3781
|
-
var config = axiosConfig;
|
|
3782
|
-
var url = config.url,
|
|
3783
|
-
data = config.data,
|
|
3784
|
-
params = config.params,
|
|
3785
|
-
method = config.method,
|
|
3786
|
-
logger = config.logger,
|
|
3787
|
-
unboxing = config.unboxing;
|
|
3788
|
-
_this7.displayMsg(response);
|
|
3789
|
-
if (Request.checkRTCode(response)) {
|
|
3790
|
-
logger && Request.logger.log({
|
|
3791
|
-
url: url,
|
|
3792
|
-
data: data,
|
|
3793
|
-
params: params,
|
|
3794
|
-
method: method
|
|
3795
|
-
}, response.data);
|
|
3796
|
-
_this7.emit('afterResponse', response);
|
|
3797
|
-
var isSameOrigin = url !== null && url !== void 0 && url.startsWith('http') ? new URL(url).origin === location.origin : true;
|
|
3798
|
-
if (isSameOrigin) {
|
|
3799
|
-
var token = headers['Authorization'] || headers['authorization'];
|
|
3800
|
-
appEnv.token = token;
|
|
3801
|
-
AppEnv.singleton.token = token;
|
|
3802
|
-
}
|
|
3803
|
-
if (unboxing) {
|
|
3804
|
-
response.data = doUnboxing(response.data);
|
|
3805
|
-
}
|
|
3806
|
-
return onResponse(response);
|
|
3807
|
-
}
|
|
3808
|
-
var e = Request.createErr(response);
|
|
3809
|
-
return _onErr(e);
|
|
3810
|
-
}, function (error) {
|
|
3811
|
-
Request.logger.error('请求出错:', {
|
|
3812
|
-
error: error
|
|
3813
|
-
});
|
|
3814
|
-
var response = error === null || error === void 0 ? void 0 : error.response;
|
|
3815
|
-
var e = Request.createErr(response, error);
|
|
3816
|
-
return _onErr(e);
|
|
3817
|
-
});
|
|
3818
|
-
return ins;
|
|
3819
|
-
}
|
|
3820
|
-
}], [{
|
|
3821
|
-
key: "checkRTCode",
|
|
3822
|
-
value: function checkRTCode(res) {
|
|
3823
|
-
var _res$data, _res$data2, _res$data3, _res$data4;
|
|
3824
|
-
if (!res) return false;
|
|
3825
|
-
var headerCode = res.headers['lm-code'];
|
|
3826
|
-
var rawCode = (_res$data = res.data) !== null && _res$data !== void 0 && _res$data.id ? 200 : (_res$data2 = res.data) === null || _res$data2 === void 0 ? void 0 : _res$data2.code;
|
|
3827
|
-
// 某些数据返回 status
|
|
3828
|
-
var rawStatus = (_res$data3 = res.data) !== null && _res$data3 !== void 0 && _res$data3.id ? 200 : (_res$data4 = res.data) === null || _res$data4 === void 0 ? void 0 : _res$data4.status;
|
|
3829
|
-
var _code = typeof rawCode === 'number' ? rawCode : rawStatus !== null && rawStatus !== void 0 ? rawStatus : 1;
|
|
3830
|
-
var code = headerCode ? Number(headerCode) : _code;
|
|
3831
|
-
// console.log('isSuccessful', { headerCode, _code,h:res.headers})
|
|
3832
|
-
return Request.CONFIG.successCode.includes(code);
|
|
337
|
+
value: function getToken() {
|
|
338
|
+
return this.store.get(this.tokenKey) || this.getTokenFromSearchParam();
|
|
3833
339
|
}
|
|
3834
340
|
}, {
|
|
3835
|
-
key: "
|
|
3836
|
-
value: function
|
|
3837
|
-
var
|
|
3838
|
-
|
|
3839
|
-
var rawMessage = (error === null || error === void 0 ? void 0 : error.message) === 'Network Error' ? '网络连接异常 ' : '';
|
|
3840
|
-
var msg = (_ref24 = (_ref25 = (_Request$getMsg = Request.getMsg(res)) !== null && _Request$getMsg !== void 0 ? _Request$getMsg : codeMessage[status]) !== null && _ref25 !== void 0 ? _ref25 : rawMessage) !== null && _ref24 !== void 0 ? _ref24 : '未知错误';
|
|
3841
|
-
return msg;
|
|
341
|
+
key: "getTokenFromSearchParam",
|
|
342
|
+
value: function getTokenFromSearchParam() {
|
|
343
|
+
var url = new URL(location.toString());
|
|
344
|
+
return url.searchParams.get(this.tokenKey);
|
|
3842
345
|
}
|
|
3843
346
|
}, {
|
|
3844
|
-
key: "
|
|
3845
|
-
value: function
|
|
3846
|
-
|
|
3847
|
-
return
|
|
3848
|
-
error: error,
|
|
3849
|
-
msg: Request.genErrMsg(res, error),
|
|
3850
|
-
url: res === null || res === void 0 || (_res$config = res.config) === null || _res$config === void 0 ? void 0 : _res$config.url,
|
|
3851
|
-
data: res === null || res === void 0 ? void 0 : res.data,
|
|
3852
|
-
status: res === null || res === void 0 ? void 0 : res.status
|
|
3853
|
-
};
|
|
347
|
+
key: "setTokenToSearchParam",
|
|
348
|
+
value: function setTokenToSearchParam(url) {
|
|
349
|
+
url.searchParams.set(this.tokenKey, this.getToken() || '');
|
|
350
|
+
return url;
|
|
3854
351
|
}
|
|
3855
352
|
}, {
|
|
3856
|
-
key: "
|
|
3857
|
-
value: function
|
|
3858
|
-
|
|
3859
|
-
var _res$config2 = res === null || res === void 0 ? void 0 : res.config,
|
|
3860
|
-
_res$config2$showMsg = _res$config2.showMsg,
|
|
3861
|
-
showMsg = _res$config2$showMsg === void 0 ? true : _res$config2$showMsg,
|
|
3862
|
-
successText = _res$config2.successText,
|
|
3863
|
-
errText = _res$config2.errText;
|
|
3864
|
-
var remoteMsg = showMsg ? Request.getRemoteMessage(res) : '';
|
|
3865
|
-
var isSuccessful = Request.checkRTCode(res);
|
|
3866
|
-
var configMsg = isSuccessful ? successText : errText;
|
|
3867
|
-
return configMsg !== null && configMsg !== void 0 ? configMsg : remoteMsg;
|
|
353
|
+
key: "removeToken",
|
|
354
|
+
value: function removeToken() {
|
|
355
|
+
this.store.remove(this.tokenKey);
|
|
3868
356
|
}
|
|
3869
357
|
}, {
|
|
3870
|
-
key: "
|
|
3871
|
-
|
|
3872
|
-
|
|
3873
|
-
|
|
3874
|
-
|
|
3875
|
-
|
|
358
|
+
key: "is_fullscreen",
|
|
359
|
+
get: function get() {
|
|
360
|
+
return !!document.fullscreenElement;
|
|
361
|
+
}
|
|
362
|
+
}], [{
|
|
363
|
+
key: "singleton",
|
|
364
|
+
get: function get() {
|
|
365
|
+
var _window$mchc_env;
|
|
366
|
+
return (_window$mchc_env = window.mchc_env) !== null && _window$mchc_env !== void 0 ? _window$mchc_env : appEnv;
|
|
3876
367
|
}
|
|
3877
368
|
}, {
|
|
3878
|
-
key: "
|
|
3879
|
-
|
|
3880
|
-
|
|
3881
|
-
var headerMessageRaw = res.headers['lm-message'];
|
|
3882
|
-
var headerMessage = headerMessageRaw ? decodeURIComponent(headerMessageRaw) : undefined;
|
|
3883
|
-
return headerMessage;
|
|
369
|
+
key: "client_mode",
|
|
370
|
+
get: function get() {
|
|
371
|
+
return !!_get(window, 'client_mode');
|
|
3884
372
|
}
|
|
3885
373
|
}]);
|
|
3886
|
-
}(
|
|
3887
|
-
|
|
3888
|
-
|
|
3889
|
-
});
|
|
3890
|
-
_defineProperty2(Request, "logger", new MyLog('Request'));
|
|
3891
|
-
function doUnboxing(res) {
|
|
3892
|
-
var isBoxing = typeof (res === null || res === void 0 ? void 0 : res.code) === 'number' && !!res.data;
|
|
3893
|
-
if (isBoxing) {
|
|
3894
|
-
return res.data;
|
|
3895
|
-
}
|
|
3896
|
-
return res;
|
|
3897
|
-
}
|
|
3898
|
-
function createInstance() {
|
|
3899
|
-
var defaultConfig = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
3900
|
-
var instance = bind(Axios.prototype.request, request.ins);
|
|
3901
|
-
utils.extend(instance, Axios.prototype, request.ins);
|
|
3902
|
-
utils.extend(instance, request.ins);
|
|
3903
|
-
return instance;
|
|
3904
|
-
}
|
|
3905
|
-
var request = new Request();
|
|
374
|
+
}();
|
|
375
|
+
var appEnv = new AppEnv('mchc_env');
|
|
376
|
+
window.appEnv = appEnv;
|
|
3906
377
|
var rawRequest = createInstance({});
|
|
3907
378
|
var asRequest = new Request({
|
|
3908
379
|
config: {
|
|
3909
380
|
baseURL: '/as'
|
|
3910
381
|
}
|
|
3911
382
|
});
|
|
3912
|
-
|
|
3913
|
-
|
|
3914
|
-
baseURL: '/'
|
|
3915
|
-
}
|
|
3916
|
-
});
|
|
383
|
+
// export const fubaoRequest = new Request({ config: { baseURL: '/' } })
|
|
384
|
+
var fubaoRequest = request$1;
|
|
3917
385
|
var EnumItem = /*#__PURE__*/function (_Array) {
|
|
3918
386
|
function EnumItem() {
|
|
3919
|
-
|
|
3920
|
-
for (var
|
|
3921
|
-
data[
|
|
387
|
+
_classCallCheck(this, EnumItem);
|
|
388
|
+
for (var _len = arguments.length, data = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
389
|
+
data[_key] = arguments[_key];
|
|
3922
390
|
}
|
|
3923
|
-
return
|
|
391
|
+
return _callSuper(this, EnumItem, [].concat(data));
|
|
3924
392
|
}
|
|
3925
|
-
|
|
3926
|
-
return
|
|
393
|
+
_inherits(EnumItem, _Array);
|
|
394
|
+
return _createClass(EnumItem, [{
|
|
3927
395
|
key: "getValue",
|
|
3928
396
|
value: function getValue(label) {
|
|
3929
397
|
var _this$find;
|
|
@@ -3960,20 +428,20 @@ var EnumItem = /*#__PURE__*/function (_Array) {
|
|
|
3960
428
|
}, {
|
|
3961
429
|
key: "getMultiLabel",
|
|
3962
430
|
value: function getMultiLabel(value) {
|
|
3963
|
-
var
|
|
431
|
+
var _this3 = this;
|
|
3964
432
|
if (!value) return [];
|
|
3965
433
|
return value.split(',').map(function (_) {
|
|
3966
434
|
return +_;
|
|
3967
435
|
}).filter(function (_) {
|
|
3968
436
|
return _ !== NaN;
|
|
3969
437
|
}).map(function (_) {
|
|
3970
|
-
return
|
|
438
|
+
return _this3.getLabel(_);
|
|
3971
439
|
});
|
|
3972
440
|
}
|
|
3973
441
|
}]);
|
|
3974
|
-
}(/*#__PURE__*/
|
|
442
|
+
}(/*#__PURE__*/_wrapNativeSuper(Array));
|
|
3975
443
|
function genEnum(data) {
|
|
3976
|
-
return
|
|
444
|
+
return _construct(EnumItem, _toConsumableArray(Object.keys(data).map(function (_) {
|
|
3977
445
|
return {
|
|
3978
446
|
label: _,
|
|
3979
447
|
value: data[_]
|
|
@@ -3982,12 +450,12 @@ function genEnum(data) {
|
|
|
3982
450
|
}
|
|
3983
451
|
function formatRangeMoment(data, formater, cKeys) {
|
|
3984
452
|
var entries = Object.entries(data);
|
|
3985
|
-
return entries.reduce(function (a,
|
|
3986
|
-
var
|
|
3987
|
-
k =
|
|
3988
|
-
v =
|
|
453
|
+
return entries.reduce(function (a, _ref, idx) {
|
|
454
|
+
var _ref2 = _slicedToArray(_ref, 2),
|
|
455
|
+
k = _ref2[0],
|
|
456
|
+
v = _ref2[1];
|
|
3989
457
|
if (!v) return a;
|
|
3990
|
-
return
|
|
458
|
+
return _objectSpread(_objectSpread({}, a), {}, _defineProperty(_defineProperty({}, "".concat(k, ".").concat(cKeys[0]), formater(v[0])), "".concat(k, ".").concat(cKeys[1]), formater(v[1])));
|
|
3991
459
|
}, {});
|
|
3992
460
|
}
|
|
3993
461
|
function formatRangeDate(data) {
|
|
@@ -3998,21 +466,41 @@ function formatRangeDateTime(data) {
|
|
|
3998
466
|
var cKeys = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : ['greaterOrEqualThan', 'lessOrEqualThan'];
|
|
3999
467
|
return formatRangeMoment(data, formatDateTime, cKeys);
|
|
4000
468
|
}
|
|
469
|
+
function diff_hour_minute(inputA, inputB) {
|
|
470
|
+
var a = getMomentObj(inputA);
|
|
471
|
+
var b = getMomentObj(inputB);
|
|
472
|
+
var a_without_sec = a.set('second', 0);
|
|
473
|
+
var b_without_sec = b.set('second', 0);
|
|
474
|
+
var diff = a_without_sec.isValid() && b_without_sec.isValid() ? a_without_sec.diff(b_without_sec, 'minute') : null;
|
|
475
|
+
return getHourAndMinute(diff);
|
|
476
|
+
}
|
|
477
|
+
function getHourAndMinute(minutes) {
|
|
478
|
+
if (!minutes || minutes < 0) return {
|
|
479
|
+
h: 0,
|
|
480
|
+
m: 0
|
|
481
|
+
};
|
|
482
|
+
var h = Math.floor(minutes / 60);
|
|
483
|
+
var m = minutes % 60;
|
|
484
|
+
return {
|
|
485
|
+
h: h,
|
|
486
|
+
m: m
|
|
487
|
+
};
|
|
488
|
+
}
|
|
4001
489
|
|
|
4002
490
|
// {name: KKK, c: T }
|
|
4003
|
-
var BaseWsService = /*#__PURE__*/function (
|
|
491
|
+
var BaseWsService = /*#__PURE__*/function (_EventEmitter2) {
|
|
4004
492
|
function BaseWsService(url) {
|
|
4005
|
-
var
|
|
4006
|
-
|
|
4007
|
-
|
|
4008
|
-
|
|
4009
|
-
|
|
4010
|
-
|
|
4011
|
-
|
|
4012
|
-
return
|
|
493
|
+
var _this4;
|
|
494
|
+
_classCallCheck(this, BaseWsService);
|
|
495
|
+
_this4 = _callSuper(this, BaseWsService);
|
|
496
|
+
_defineProperty(_this4, "wsService", void 0);
|
|
497
|
+
_defineProperty(_this4, "_url", void 0);
|
|
498
|
+
_defineProperty(_this4, "_logger", new MyLog('BaseWsService'));
|
|
499
|
+
_this4._url = url;
|
|
500
|
+
return _this4;
|
|
4013
501
|
}
|
|
4014
|
-
|
|
4015
|
-
return
|
|
502
|
+
_inherits(BaseWsService, _EventEmitter2);
|
|
503
|
+
return _createClass(BaseWsService, [{
|
|
4016
504
|
key: "isOpen",
|
|
4017
505
|
get: function get() {
|
|
4018
506
|
var _this$wsService;
|
|
@@ -4023,7 +511,7 @@ var BaseWsService = /*#__PURE__*/function (_EventEmitter3) {
|
|
|
4023
511
|
value: function _send(data) {
|
|
4024
512
|
if (this.isOpen) {
|
|
4025
513
|
var _this$wsService2;
|
|
4026
|
-
(_this$wsService2 = this.wsService) === null || _this$wsService2 === void 0 || _this$wsService2.send(
|
|
514
|
+
(_this$wsService2 = this.wsService) === null || _this$wsService2 === void 0 || _this$wsService2.send(isString(data) ? data : JSON.stringify(data));
|
|
4027
515
|
} else {
|
|
4028
516
|
this._logger.error('未连接');
|
|
4029
517
|
}
|
|
@@ -4056,7 +544,7 @@ var BaseWsService = /*#__PURE__*/function (_EventEmitter3) {
|
|
|
4056
544
|
}, {
|
|
4057
545
|
key: "connect",
|
|
4058
546
|
value: function connect() {
|
|
4059
|
-
var
|
|
547
|
+
var _this5 = this;
|
|
4060
548
|
this._logger.log('connect', {
|
|
4061
549
|
ins: this
|
|
4062
550
|
});
|
|
@@ -4067,30 +555,30 @@ var BaseWsService = /*#__PURE__*/function (_EventEmitter3) {
|
|
|
4067
555
|
if (!appEnv.rawToken) {
|
|
4068
556
|
rej();
|
|
4069
557
|
}
|
|
4070
|
-
|
|
558
|
+
_this5._logger.log('开始连接');
|
|
4071
559
|
var options = {
|
|
4072
560
|
connectionTimeout: 10000
|
|
4073
561
|
};
|
|
4074
|
-
|
|
4075
|
-
|
|
4076
|
-
|
|
4077
|
-
|
|
562
|
+
_this5.wsService = new ReconnectingWebSocket(_this5._url, [], options);
|
|
563
|
+
_this5.wsService.addEventListener('open', function (e) {
|
|
564
|
+
_this5.emit('open', e);
|
|
565
|
+
_this5._logger.log('open', {
|
|
4078
566
|
e: e,
|
|
4079
|
-
ins:
|
|
567
|
+
ins: _this5
|
|
4080
568
|
});
|
|
4081
|
-
res(
|
|
569
|
+
res(_this5);
|
|
4082
570
|
});
|
|
4083
|
-
|
|
571
|
+
_this5.wsService.addEventListener('error', function (e) {
|
|
4084
572
|
// this._logger.log('error', { e, ins: this })
|
|
4085
|
-
|
|
573
|
+
_this5.emit('error', e);
|
|
4086
574
|
rej();
|
|
4087
575
|
});
|
|
4088
|
-
|
|
576
|
+
_this5.wsService.addEventListener('close', function (e) {
|
|
4089
577
|
// this._logger.log('close', { e, ins: this })
|
|
4090
|
-
|
|
578
|
+
_this5.emit('close', e);
|
|
4091
579
|
rej();
|
|
4092
580
|
});
|
|
4093
|
-
|
|
581
|
+
_this5.wsService.addEventListener('message', _this5._messageHandler.bind(_this5));
|
|
4094
582
|
});
|
|
4095
583
|
}
|
|
4096
584
|
}]);
|
|
@@ -4101,51 +589,23 @@ function getTimeSlice() {
|
|
|
4101
589
|
var hourArr = Array(hour).fill(0);
|
|
4102
590
|
var minuteArr = Array(60).fill(0);
|
|
4103
591
|
return hourArr.reduce(function (sum, h, hIdx) {
|
|
4104
|
-
return [].concat(
|
|
592
|
+
return [].concat(_toConsumableArray(sum), _toConsumableArray(minuteArr.map(function (m, mIdx) {
|
|
4105
593
|
return "".concat(hIdx, ":").concat(mIdx);
|
|
4106
594
|
})));
|
|
4107
595
|
}, []);
|
|
4108
596
|
}
|
|
597
|
+
function is_fuck_abnormal(conf) {
|
|
598
|
+
return (conf === null || conf === void 0 ? void 0 : conf.isNormal) === 'false';
|
|
599
|
+
}
|
|
4109
600
|
|
|
4110
601
|
/**
|
|
4111
602
|
* 计算BMI
|
|
4112
603
|
*/
|
|
4113
604
|
function getBMI(weight, height) {
|
|
4114
605
|
if (!weight || !height) return 0;
|
|
4115
|
-
return (weight / (height * height) * 10000).toFixed(2);
|
|
4116
|
-
}
|
|
4117
|
-
/**
|
|
4118
|
-
* 计算孕周
|
|
4119
|
-
* gesDate:预产期-B超
|
|
4120
|
-
* date:产检/报告日期
|
|
4121
|
-
*/
|
|
4122
|
-
function getGesWeek(gesDate, date) {
|
|
4123
|
-
var diffDays = 280 - dayjs(gesDate).diff(dayjs(date), 'days');
|
|
4124
|
-
var weeks = Math.floor(diffDays / 7);
|
|
4125
|
-
var days = diffDays % 7;
|
|
4126
|
-
return days === 0 ? "".concat(weeks) : "".concat(weeks, "+").concat(days);
|
|
4127
|
-
}
|
|
4128
|
-
/**
|
|
4129
|
-
* 计算停经孕周
|
|
4130
|
-
* @param checkData 当前日期
|
|
4131
|
-
* @param lmp 末次月经
|
|
4132
|
-
* @returns
|
|
4133
|
-
*/
|
|
4134
|
-
var menopauseWeek = function menopauseWeek(checkData, lmp) {
|
|
4135
|
-
var diffDays = dayjs(checkData).diff(dayjs(lmp), 'days');
|
|
4136
|
-
var weeks = Math.floor(diffDays / 7);
|
|
4137
|
-
var days = diffDays % 7;
|
|
4138
|
-
return days === 0 ? "".concat(weeks) : "".concat(weeks, "+").concat(days);
|
|
4139
|
-
};
|
|
4140
|
-
/**
|
|
4141
|
-
* 计算孕周对应的天数
|
|
4142
|
-
*/
|
|
4143
|
-
function getGestationalDays(gestationalWeek) {
|
|
4144
|
-
var arr = _split(gestationalWeek, '+');
|
|
4145
|
-
var weeks = Number(arr[0]) || 0;
|
|
4146
|
-
var days = Number(arr[1]) || 0;
|
|
4147
|
-
return weeks * 7 + days;
|
|
606
|
+
return toFloat((weight / (height * height) * 10000).toFixed(2));
|
|
4148
607
|
}
|
|
608
|
+
var calc_bmi = getBMI;
|
|
4149
609
|
/**
|
|
4150
610
|
* 获取本周五、下周五、下下周五时间
|
|
4151
611
|
*/
|
|
@@ -4159,56 +619,15 @@ function getOrderTime(orderDate) {
|
|
|
4159
619
|
}
|
|
4160
620
|
return dayjs(new Date());
|
|
4161
621
|
}
|
|
4162
|
-
/**
|
|
4163
|
-
* 根据末次月经计算预产期B超
|
|
4164
|
-
*/
|
|
4165
|
-
function getExpected(date) {
|
|
4166
|
-
var addDays = 280 - dayjs().diff(dayjs(date), 'days');
|
|
4167
|
-
return dayjs().add(addDays, 'days').format('YYYY-MM-DD');
|
|
4168
|
-
}
|
|
4169
622
|
/**
|
|
4170
623
|
* 计算两个日期相隔的年数
|
|
4171
624
|
*/
|
|
4172
|
-
function getDiffYears(
|
|
4173
|
-
return
|
|
4174
|
-
}
|
|
4175
|
-
/**
|
|
4176
|
-
* 获取两个字符串日期 YYYY-MM-dd 间隔的天数
|
|
4177
|
-
* 始终返回一个正数
|
|
4178
|
-
*/
|
|
4179
|
-
var getDays = function getDays(str1, str2) {
|
|
4180
|
-
var dateReg = /^\d{4}\-\d{2}\-\d{2}$/;
|
|
4181
|
-
if (!dateReg.test(str1) || !dateReg.test(str2)) {
|
|
4182
|
-
console.warn("Date's format is not YYYY-MM-dd");
|
|
4183
|
-
return -1;
|
|
4184
|
-
}
|
|
4185
|
-
var time1 = new Date(str1).getTime();
|
|
4186
|
-
var time2 = new Date(str2).getTime();
|
|
4187
|
-
return Math.abs(~~(time2 - time1) / 1000 / 3600 / 24);
|
|
4188
|
-
};
|
|
4189
|
-
/**
|
|
4190
|
-
* 根据 预产期B超 日期获取孕周
|
|
4191
|
-
* 得出 ${孕周周数}+${孕周天数}
|
|
4192
|
-
* 预产期B超
|
|
4193
|
-
*/
|
|
4194
|
-
var getGestationalWeekBySureEdd = function getGestationalWeekBySureEdd(sureEdd) {
|
|
4195
|
-
if (!sureEdd) return '';
|
|
4196
|
-
var today = new Date();
|
|
4197
|
-
var todayStr = "".concat(today.getFullYear(), "-").concat(today.getMonth() > 9 ? today.getMonth() + 1 : "0".concat(today.getMonth() + 1), "-").concat(today.getDate() > 9 ? today.getDate() : "0".concat(today.getDate()));
|
|
4198
|
-
var days = getDays(sureEdd, todayStr);
|
|
4199
|
-
// 这里会出现孕周为负数的情况
|
|
4200
|
-
var gestationalWeek = "".concat((280 - days) / 7 >>> 0, "+").concat((280 - days) % 7);
|
|
4201
|
-
return gestationalWeek;
|
|
4202
|
-
};
|
|
4203
|
-
/**
|
|
4204
|
-
* 根据末次月经计算预产期B超
|
|
4205
|
-
*/
|
|
4206
|
-
function calEddByLmp(lmp) {
|
|
4207
|
-
return dayjs(lmp).add(280, 'days');
|
|
625
|
+
function getDiffYears(a, b) {
|
|
626
|
+
return diff_between(a, b, 'years');
|
|
4208
627
|
}
|
|
4209
628
|
/**根据出生日期计算年龄 */
|
|
4210
629
|
function GetAgeByBirthDay(strBirthday) {
|
|
4211
|
-
if (!
|
|
630
|
+
if (!isString(strBirthday)) return null;
|
|
4212
631
|
var returnAge;
|
|
4213
632
|
var strBirthdayArr = strBirthday.split('-');
|
|
4214
633
|
var birthYear = strBirthdayArr[0];
|
|
@@ -4245,33 +664,33 @@ function GetAgeByBirthDay(strBirthday) {
|
|
|
4245
664
|
return returnAge; //返回周岁年龄
|
|
4246
665
|
}
|
|
4247
666
|
var getDataSource = /*#__PURE__*/function () {
|
|
4248
|
-
var
|
|
667
|
+
var _ref3 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee(url, params, processFromApi) {
|
|
4249
668
|
var _data$data;
|
|
4250
669
|
var response, data, headers, count, _data;
|
|
4251
|
-
return
|
|
4252
|
-
while (1) switch (
|
|
670
|
+
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
671
|
+
while (1) switch (_context.prev = _context.next) {
|
|
4253
672
|
case 0:
|
|
4254
|
-
|
|
4255
|
-
return request.get(url, {
|
|
673
|
+
_context.next = 2;
|
|
674
|
+
return request$1.get(url, {
|
|
4256
675
|
params: params
|
|
4257
676
|
});
|
|
4258
677
|
case 2:
|
|
4259
|
-
response =
|
|
678
|
+
response = _context.sent;
|
|
4260
679
|
data = response.data, headers = response.headers;
|
|
4261
680
|
count = headers['x-total-count'];
|
|
4262
681
|
_data = (_data$data = data.data) !== null && _data$data !== void 0 ? _data$data : data;
|
|
4263
|
-
return
|
|
682
|
+
return _context.abrupt("return", {
|
|
4264
683
|
count: count,
|
|
4265
684
|
data: processFromApi ? processFromApi(_data) : _data
|
|
4266
685
|
});
|
|
4267
686
|
case 7:
|
|
4268
687
|
case "end":
|
|
4269
|
-
return
|
|
688
|
+
return _context.stop();
|
|
4270
689
|
}
|
|
4271
|
-
},
|
|
690
|
+
}, _callee);
|
|
4272
691
|
}));
|
|
4273
|
-
return function getDataSource(
|
|
4274
|
-
return
|
|
692
|
+
return function getDataSource(_x, _x2, _x3) {
|
|
693
|
+
return _ref3.apply(this, arguments);
|
|
4275
694
|
};
|
|
4276
695
|
}();
|
|
4277
696
|
function gen_id_form_item_config() {
|
|
@@ -4279,46 +698,32 @@ function gen_id_form_item_config() {
|
|
|
4279
698
|
return {
|
|
4280
699
|
inputType: 'id',
|
|
4281
700
|
dataIndex: name,
|
|
4282
|
-
name: name
|
|
701
|
+
name: name,
|
|
702
|
+
form_hidden: true
|
|
4283
703
|
};
|
|
4284
704
|
}
|
|
4285
|
-
// 末次月经开始算
|
|
4286
|
-
var calGestationalWeekByLmp = function calGestationalWeekByLmp(lmp) {
|
|
4287
|
-
var defaultDate = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : dayjs().endOf('day');
|
|
4288
|
-
var diffWeek = defaultDate.diff(lmp, 'week');
|
|
4289
|
-
var diffDay = defaultDate.diff(lmp, 'day');
|
|
4290
|
-
return "".concat(diffWeek, "+").concat(diffDay % 7);
|
|
4291
|
-
};
|
|
4292
|
-
// 预产期B超开始算
|
|
4293
|
-
var calGestationalWeekBySureEdd = function calGestationalWeekBySureEdd(sureEdd) {
|
|
4294
|
-
var defaultDate = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : dayjs().endOf('day');
|
|
4295
|
-
var sureEddMoment = dayjs(sureEdd).startOf('day');
|
|
4296
|
-
var startDate = sureEddMoment.subtract(280, 'days');
|
|
4297
|
-
var diffWeek = defaultDate.diff(startDate, 'week');
|
|
4298
|
-
var diffDay = defaultDate.diff(startDate, 'day');
|
|
4299
|
-
if (diffDay % 7 === 0) {
|
|
4300
|
-
return diffWeek;
|
|
4301
|
-
}
|
|
4302
|
-
return "".concat(diffWeek, "+").concat(diffDay % 7);
|
|
4303
|
-
};
|
|
4304
705
|
function format_gp(data) {
|
|
4305
706
|
var gravidity = data.gravidity,
|
|
4306
707
|
parity = data.parity;
|
|
4307
|
-
if (!
|
|
708
|
+
if (!isNumber(gravidity) || !isNumber(parity)) return EMPTY_PLACEHOLDER;
|
|
4308
709
|
return "".concat(gravidity, "/").concat(parity);
|
|
4309
710
|
}
|
|
4310
|
-
function
|
|
4311
|
-
|
|
4312
|
-
week: 0,
|
|
4313
|
-
day: 0
|
|
4314
|
-
};
|
|
4315
|
-
if (!weekStr) return result;
|
|
711
|
+
function unmarshal_gestationWeek(weekStr) {
|
|
712
|
+
if (!weekStr) return null;
|
|
4316
713
|
var arr = weekStr.split('+');
|
|
4317
|
-
|
|
4318
|
-
|
|
4319
|
-
|
|
714
|
+
var week = toInt(arr[0], 0);
|
|
715
|
+
var day = toInt(arr[1], 0);
|
|
716
|
+
var days = week * 7 + day;
|
|
717
|
+
if ([week, day, days].some(function (_) {
|
|
718
|
+
return isNaN(_);
|
|
719
|
+
})) return null;
|
|
720
|
+
return {
|
|
721
|
+
day: day,
|
|
722
|
+
days: days,
|
|
723
|
+
week: week
|
|
724
|
+
};
|
|
4320
725
|
}
|
|
4321
|
-
function
|
|
726
|
+
function marshal_gestationWeek(week, day) {
|
|
4322
727
|
if (!week && !day) {
|
|
4323
728
|
return '0';
|
|
4324
729
|
}
|
|
@@ -4341,7 +746,7 @@ var Browser = function (window, _System) {
|
|
|
4341
746
|
clientHeight: window.document.body.clientHeight,
|
|
4342
747
|
name: "",
|
|
4343
748
|
type: ""
|
|
4344
|
-
},
|
|
749
|
+
}, _defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_System, "version", ""), "shell", function shell() {
|
|
4345
750
|
return "";
|
|
4346
751
|
}), "agent", agent), "isIE", /msie/.test(agent)), "isGecko", agent.indexOf("gecko") > 0 && agent.indexOf("like gecko") < 0), "isWebkit", agent.indexOf("webkit") > 0), "isStrict", document.compatMode === "CSS1Compat"), "supportSubTitle", function supportSubTitle() {
|
|
4347
752
|
return "track" in document.createElement("track");
|
|
@@ -4355,7 +760,7 @@ var Browser = function (window, _System) {
|
|
|
4355
760
|
console.log("error");
|
|
4356
761
|
return IEMode;
|
|
4357
762
|
}
|
|
4358
|
-
}),
|
|
763
|
+
}), _defineProperty(_defineProperty(_System, "operaVersion", function operaVersion() {
|
|
4359
764
|
try {
|
|
4360
765
|
if (window.opera) {
|
|
4361
766
|
var _agent$match2;
|
|
@@ -4373,12 +778,12 @@ var Browser = function (window, _System) {
|
|
|
4373
778
|
if (arguments.length === 1 && typeof arguments[0] === "string") {
|
|
4374
779
|
var _version$indexOf;
|
|
4375
780
|
var version = arguments[0];
|
|
4376
|
-
var
|
|
4377
|
-
var
|
|
4378
|
-
if (
|
|
4379
|
-
|
|
4380
|
-
if (
|
|
4381
|
-
return version.substr(0,
|
|
781
|
+
var start = (_version$indexOf = version.indexOf(".")) !== null && _version$indexOf !== void 0 ? _version$indexOf : -1;
|
|
782
|
+
var end = -1;
|
|
783
|
+
if (start > 0) {
|
|
784
|
+
end = version.indexOf(".", start + 1);
|
|
785
|
+
if (end !== -1) {
|
|
786
|
+
return version.substr(0, end);
|
|
4382
787
|
}
|
|
4383
788
|
}
|
|
4384
789
|
return version;
|
|
@@ -4425,8 +830,8 @@ var Browser = function (window, _System) {
|
|
|
4425
830
|
}
|
|
4426
831
|
//百度浏览器
|
|
4427
832
|
if (agent.indexOf("bidubrowser") > 0) {
|
|
4428
|
-
var
|
|
4429
|
-
System.version = (
|
|
833
|
+
var _ref4, _agent$match$, _agent$match9, _agent$match10;
|
|
834
|
+
System.version = (_ref4 = (_agent$match$ = (_agent$match9 = agent.match(/bidubrowser\/([\d.]+)/)) === null || _agent$match9 === void 0 ? void 0 : _agent$match9[1]) !== null && _agent$match$ !== void 0 ? _agent$match$ : (_agent$match10 = agent.match(/chrome\/([\d.]+)/)) === null || _agent$match10 === void 0 ? void 0 : _agent$match10[1]) !== null && _ref4 !== void 0 ? _ref4 : "0";
|
|
4430
835
|
return "百度浏览器";
|
|
4431
836
|
}
|
|
4432
837
|
//360极速浏览器和360安全浏览器
|
|
@@ -4458,6 +863,58 @@ var isIE = function isIE() {
|
|
|
4458
863
|
return false;
|
|
4459
864
|
}
|
|
4460
865
|
};
|
|
866
|
+
var h_key = '/happy';
|
|
867
|
+
function getHappyConfig() {
|
|
868
|
+
var pathname = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : location.pathname;
|
|
869
|
+
var url = new URL(location.origin + pathname);
|
|
870
|
+
if (!pathname.includes(h_key)) return null;
|
|
871
|
+
var h_idx = pathname.indexOf(h_key);
|
|
872
|
+
var real_path = pathname.substring(h_idx);
|
|
873
|
+
var arr = real_path.split('/').filter(function (_) {
|
|
874
|
+
return _;
|
|
875
|
+
});
|
|
876
|
+
var first = arr[0];
|
|
877
|
+
if (first === 'happy' && arr.length > 2) {
|
|
878
|
+
var _arg$split;
|
|
879
|
+
arr.shift();
|
|
880
|
+
var _arg = arr.pop();
|
|
881
|
+
var args = (_arg$split = _arg === null || _arg === void 0 ? void 0 : _arg.split(',')) !== null && _arg$split !== void 0 ? _arg$split : [];
|
|
882
|
+
var path = "/".concat(arr.join('/'));
|
|
883
|
+
return _defineProperty(_defineProperty({
|
|
884
|
+
path: path,
|
|
885
|
+
args: args,
|
|
886
|
+
search: url.search
|
|
887
|
+
}, ARG_URS1_KEY, args[0]), ARG_URS2_KEY, args[1]);
|
|
888
|
+
}
|
|
889
|
+
return null;
|
|
890
|
+
}
|
|
891
|
+
function genHappyPath(path) {
|
|
892
|
+
var arg = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
|
|
893
|
+
var search = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : "";
|
|
894
|
+
var arr = path.split('/').filter(function (_) {
|
|
895
|
+
return _;
|
|
896
|
+
});
|
|
897
|
+
var _search = search !== null && search !== void 0 && search.startsWith('?') ? search : "?".concat(search);
|
|
898
|
+
return "".concat(h_key, "/").concat(arr.join('/'), "/").concat(arg.join(',')).concat(_search);
|
|
899
|
+
}
|
|
900
|
+
function get_global_happy_arg(key) {
|
|
901
|
+
var happyConfig = getHappyConfig(location.pathname);
|
|
902
|
+
var conf = AppEnv.singleton.tail_global_cache('happy_conf');
|
|
903
|
+
return (conf === null || conf === void 0 ? void 0 : conf[key]) || getSearchParamsValue(key) || (happyConfig === null || happyConfig === void 0 ? void 0 : happyConfig[key]);
|
|
904
|
+
}
|
|
905
|
+
function transmit_happy(path) {
|
|
906
|
+
var search = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : "";
|
|
907
|
+
var happyPath = getHappyConfig();
|
|
908
|
+
return genHappyPath(path, happyPath === null || happyPath === void 0 ? void 0 : happyPath.args, search || (happyPath === null || happyPath === void 0 ? void 0 : happyPath.search));
|
|
909
|
+
}
|
|
910
|
+
function transmit_happy_pre(url) {
|
|
911
|
+
var pre = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
|
|
912
|
+
var _pre = pre !== null && pre !== void 0 && pre.startsWith('/') ? pre : "/".concat(pre);
|
|
913
|
+
_pre = _pre === '/' ? '' : _pre;
|
|
914
|
+
var arr = url.split('?').filter(identity);
|
|
915
|
+
var slash = url.startsWith('/') ? '' : '/';
|
|
916
|
+
return transmit_happy("".concat(_pre).concat(slash).concat(arr[0]), arr[1]);
|
|
917
|
+
}
|
|
4461
918
|
function _registerEvent(target, eventType, cb) {
|
|
4462
919
|
if (target.addEventListener) {
|
|
4463
920
|
target.addEventListener(eventType, cb);
|
|
@@ -4694,5 +1151,104 @@ function TempNode(props) {
|
|
|
4694
1151
|
fallback: /*#__PURE__*/React.createElement("div", null)
|
|
4695
1152
|
}, /*#__PURE__*/React.createElement(Comp, null));
|
|
4696
1153
|
}
|
|
4697
|
-
|
|
4698
|
-
|
|
1154
|
+
|
|
1155
|
+
/**
|
|
1156
|
+
* 计算孕周
|
|
1157
|
+
* gesDate:预产期-B超
|
|
1158
|
+
* date:产检/报告日期
|
|
1159
|
+
*/
|
|
1160
|
+
function getGesWeek(gesDate, date) {
|
|
1161
|
+
var diffDays = 280 - dayjs(gesDate).diff(dayjs(date), 'days');
|
|
1162
|
+
var weeks = Math.floor(diffDays / 7);
|
|
1163
|
+
var days = diffDays % 7;
|
|
1164
|
+
return days === 0 ? "".concat(weeks) : "".concat(weeks, "+").concat(days);
|
|
1165
|
+
}
|
|
1166
|
+
/**
|
|
1167
|
+
* 计算停经孕周
|
|
1168
|
+
* @param checkData 当前日期
|
|
1169
|
+
* @param lmp 末次月经
|
|
1170
|
+
* @returns
|
|
1171
|
+
*/
|
|
1172
|
+
var menopauseWeek = function menopauseWeek(checkData, lmp) {
|
|
1173
|
+
var diffDays = dayjs(checkData).diff(dayjs(lmp), 'days');
|
|
1174
|
+
var weeks = Math.floor(diffDays / 7);
|
|
1175
|
+
var days = diffDays % 7;
|
|
1176
|
+
return days === 0 ? "".concat(weeks) : "".concat(weeks, "+").concat(days);
|
|
1177
|
+
};
|
|
1178
|
+
/**
|
|
1179
|
+
* 计算孕周对应的天数
|
|
1180
|
+
*/
|
|
1181
|
+
function getGestationalDays(gestationalWeek) {
|
|
1182
|
+
if (!isString(gestationalWeek)) return 0;
|
|
1183
|
+
var arr = gestationalWeek.split('+');
|
|
1184
|
+
var weeks = Number(arr[0]) || 0;
|
|
1185
|
+
var days = Number(arr[1]) || 0;
|
|
1186
|
+
return weeks * 7 + days;
|
|
1187
|
+
}
|
|
1188
|
+
/**
|
|
1189
|
+
* 根据末次月经计算预产期B超
|
|
1190
|
+
*/
|
|
1191
|
+
function getExpected(date) {
|
|
1192
|
+
var addDays = 280 - dayjs().diff(dayjs(date), 'days');
|
|
1193
|
+
return dayjs().add(addDays, 'days').format('YYYY-MM-DD');
|
|
1194
|
+
}
|
|
1195
|
+
/**
|
|
1196
|
+
* 根据 预产期B超 日期获取孕周
|
|
1197
|
+
* 得出 ${孕周周数}+${孕周天数}
|
|
1198
|
+
* 预产期B超
|
|
1199
|
+
*/
|
|
1200
|
+
var getGestationalWeekBySureEdd = function getGestationalWeekBySureEdd(sureEdd) {
|
|
1201
|
+
if (!sureEdd) return '';
|
|
1202
|
+
var today = new Date();
|
|
1203
|
+
var todayStr = "".concat(today.getFullYear(), "-").concat(today.getMonth() > 9 ? today.getMonth() + 1 : "0".concat(today.getMonth() + 1), "-").concat(today.getDate() > 9 ? today.getDate() : "0".concat(today.getDate()));
|
|
1204
|
+
var days = dayjs(sureEdd).diff(dayjs(todayStr));
|
|
1205
|
+
// 这里会出现孕周为负数的情况
|
|
1206
|
+
var gestationalWeek = "".concat((280 - days) / 7 >>> 0, "+").concat((280 - days) % 7);
|
|
1207
|
+
return gestationalWeek;
|
|
1208
|
+
};
|
|
1209
|
+
/**
|
|
1210
|
+
* 根据末次月经计算预产期B超
|
|
1211
|
+
*/
|
|
1212
|
+
function calEddByLmp(lmp) {
|
|
1213
|
+
return dayjs(lmp).add(280, 'days');
|
|
1214
|
+
}
|
|
1215
|
+
function cal_edd_by_lmp(lmp) {
|
|
1216
|
+
return dayjs(lmp).add(280, 'days').format(formatDate.format);
|
|
1217
|
+
}
|
|
1218
|
+
function calc_edd_by_IVF(移植时间, 天数) {
|
|
1219
|
+
var num = toInt(天数);
|
|
1220
|
+
if (isNaN(num)) return null;
|
|
1221
|
+
var 孕0 = dayjs(移植时间).subtract(14 + +天数, 'days');
|
|
1222
|
+
var 预产期B超时间 = 孕0.add(280, 'days');
|
|
1223
|
+
return formatDate(预产期B超时间);
|
|
1224
|
+
}
|
|
1225
|
+
// 通过 nt 检查的检查日期和如孕天数推算预产期
|
|
1226
|
+
function calc_edd_by_ntExam(checkdate, gestationalWeek) {
|
|
1227
|
+
if (!gestationalWeek && !checkdate) {
|
|
1228
|
+
return null;
|
|
1229
|
+
}
|
|
1230
|
+
var week_data = unmarshal_gestationWeek(gestationalWeek);
|
|
1231
|
+
if (!week_data) return null;
|
|
1232
|
+
var ntEdd = dayjs(checkdate).add(280 - week_data.days, 'days');
|
|
1233
|
+
return formatDate(ntEdd);
|
|
1234
|
+
}
|
|
1235
|
+
// 末次月经开始算
|
|
1236
|
+
var calGestationalWeekByLmp = function calGestationalWeekByLmp(lmp) {
|
|
1237
|
+
var defaultDate = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : dayjs().endOf('day');
|
|
1238
|
+
var diffWeek = defaultDate.diff(lmp, 'week');
|
|
1239
|
+
var diffDay = defaultDate.diff(lmp, 'day');
|
|
1240
|
+
return "".concat(diffWeek, "+").concat(diffDay % 7);
|
|
1241
|
+
};
|
|
1242
|
+
// 预产期B超开始算
|
|
1243
|
+
var calGestationalWeekBySureEdd = function calGestationalWeekBySureEdd(sureEdd) {
|
|
1244
|
+
var defaultDate = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : dayjs().endOf('day');
|
|
1245
|
+
var sureEddMoment = dayjs(sureEdd).startOf('day');
|
|
1246
|
+
var startDate = sureEddMoment.subtract(280, 'days');
|
|
1247
|
+
var diffWeek = defaultDate.diff(startDate, 'week');
|
|
1248
|
+
var diffDay = defaultDate.diff(startDate, 'day');
|
|
1249
|
+
if (diffDay % 7 === 0) {
|
|
1250
|
+
return diffWeek;
|
|
1251
|
+
}
|
|
1252
|
+
return "".concat(diffWeek, "+").concat(diffDay % 7);
|
|
1253
|
+
};
|
|
1254
|
+
export { AppEnv, BaseWsService, Browser, EnumItem, EventBus, EventEmitter_Old, GetAgeByBirthDay, appEnv, asRequest, calEddByLmp, calGestationalWeekByLmp, calGestationalWeekBySureEdd, cal_edd_by_lmp, calc_bmi, calc_edd_by_IVF, calc_edd_by_ntExam, diff_hour_minute, event, formatRangeDate, formatRangeDateTime, format_gp, fubaoRequest, genEnum, genHappyPath, gen_id_form_item_config, getBMI, getChromeVersion, getDataSource, getDiffYears, getExpected, getGesWeek, getGestationalDays, getGestationalWeekBySureEdd, getHappyConfig, getOrderTime, getTimeSlice, get_global_happy_arg, isIE, is_fuck_abnormal, makeEventStore, marshal_gestationWeek, menopauseWeek, protocolCheck, rawRequest, temp_reander, transmit_happy, transmit_happy_pre, unmarshal_gestationWeek };
|