zmdms-utils 0.0.75 → 0.0.76

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.
Files changed (78) hide show
  1. package/dist/es/_virtual/_commonjsHelpers.js +3 -0
  2. package/dist/es/_virtual/_tslib.js +87 -0
  3. package/dist/es/_virtual/decimal.js +7 -0
  4. package/dist/es/_virtual/parseTimeTest.js +3 -0
  5. package/dist/es/_virtual/test.js +3 -0
  6. package/dist/es/auth.d.ts +9 -0
  7. package/dist/es/auth.js +49 -0
  8. package/dist/es/baseUrl.d.ts +23 -0
  9. package/dist/es/baseUrl.js +50 -0
  10. package/dist/es/canvas.d.ts +6 -0
  11. package/dist/es/canvas.js +14 -0
  12. package/dist/es/common.d.ts +81 -0
  13. package/dist/es/common.js +304 -0
  14. package/dist/es/constants.d.ts +20 -0
  15. package/dist/es/constants.js +33 -0
  16. package/dist/es/crypto.d.ts +51 -0
  17. package/dist/es/crypto.js +97 -0
  18. package/dist/es/file.d.ts +127 -0
  19. package/dist/es/file.js +373 -0
  20. package/dist/es/htmlToPdf.d.ts +44 -0
  21. package/dist/es/htmlToPdf.js +84 -0
  22. package/dist/es/locales/i18n.d.ts +15 -0
  23. package/dist/es/locales/t-in-non-react.d.ts +17 -0
  24. package/dist/es/locales/t-options.d.ts +7 -0
  25. package/dist/es/locales/use-translation.d.ts +42 -0
  26. package/dist/es/mainApp.d.ts +36 -0
  27. package/dist/es/mainApp.js +44 -0
  28. package/dist/es/math.d.ts +29 -0
  29. package/dist/es/math.js +147 -0
  30. package/dist/es/microAppCreator.d.ts +46 -0
  31. package/dist/es/microAppCreator.js +89 -0
  32. package/dist/es/node_modules/decimal.js/decimal.js +4896 -0
  33. package/dist/es/node_modules/decimal.js/decimal2.js +4930 -0
  34. package/dist/es/node_modules/html-parse-stringify/dist/html-parse-stringify.module.js +5 -0
  35. package/dist/es/node_modules/i18next/dist/esm/i18next.js +2242 -0
  36. package/dist/es/node_modules/js-base64/base64.js +273 -0
  37. package/dist/es/node_modules/jwt-decode/build/jwt-decode.esm.js +3 -0
  38. package/dist/es/node_modules/mitt/dist/mitt.js +3 -0
  39. package/dist/es/node_modules/pinyin-pro/dist/index.js +12627 -0
  40. package/dist/es/node_modules/react-i18next/dist/es/Trans.js +47 -0
  41. package/dist/es/node_modules/react-i18next/dist/es/TransWithoutContext.js +312 -0
  42. package/dist/es/node_modules/react-i18next/dist/es/context.js +18 -0
  43. package/dist/es/node_modules/react-i18next/dist/es/defaults.js +21 -0
  44. package/dist/es/node_modules/react-i18next/dist/es/i18nInstance.js +7 -0
  45. package/dist/es/node_modules/react-i18next/dist/es/initReactI18next.js +12 -0
  46. package/dist/es/node_modules/react-i18next/dist/es/unescape.js +27 -0
  47. package/dist/es/node_modules/react-i18next/dist/es/useTranslation.js +112 -0
  48. package/dist/es/node_modules/react-i18next/dist/es/utils.js +63 -0
  49. package/dist/es/node_modules/void-elements/index.js +23 -0
  50. package/dist/es/parseTime.d.ts +29 -0
  51. package/dist/es/parseTime.js +189 -0
  52. package/dist/es/parseTimeTest.js +2 -0
  53. package/dist/es/passwordValidate.d.ts +9 -0
  54. package/dist/es/passwordValidate.js +169 -0
  55. package/dist/es/pdf.d.ts +49 -0
  56. package/dist/es/pdf.js +176 -0
  57. package/dist/es/pinyin.js +1 -0
  58. package/dist/es/print.d.ts +23 -0
  59. package/dist/es/print.js +43 -0
  60. package/dist/es/qiankunUtils.d.ts +13 -0
  61. package/dist/es/qiankunUtils.js +32 -0
  62. package/dist/es/request.d.ts +87 -0
  63. package/dist/es/request.js +308 -0
  64. package/dist/es/src/locales/i18n.js +16 -0
  65. package/dist/es/src/locales/t-in-non-react.js +54 -0
  66. package/dist/es/src/locales/t-options.js +20 -0
  67. package/dist/es/src/locales/use-translation.js +60 -0
  68. package/dist/es/src/parseTimeTest.js +288 -0
  69. package/dist/es/src/test.js +245 -0
  70. package/dist/es/test.js +2 -0
  71. package/dist/es/validate.d.ts +26 -0
  72. package/dist/es/validate.js +47 -0
  73. package/dist/es/water.d.ts +53 -0
  74. package/dist/es/water.js +88 -0
  75. package/dist/index.d.ts +26 -0
  76. package/dist/index.js +26 -0
  77. package/package.json +1 -1
  78. package/src/math.ts +1 -1
@@ -0,0 +1,273 @@
1
+ /**
2
+ * base64.ts
3
+ *
4
+ * Licensed under the BSD 3-Clause License.
5
+ * http://opensource.org/licenses/BSD-3-Clause
6
+ *
7
+ * References:
8
+ * http://en.wikipedia.org/wiki/Base64
9
+ *
10
+ * @author Dan Kogai (https://github.com/dankogai)
11
+ */
12
+ const version = '3.7.7';
13
+ /**
14
+ * @deprecated use lowercase `version`.
15
+ */
16
+ const VERSION = version;
17
+ const _hasBuffer = typeof Buffer === 'function';
18
+ const _TD = typeof TextDecoder === 'function' ? new TextDecoder() : undefined;
19
+ const _TE = typeof TextEncoder === 'function' ? new TextEncoder() : undefined;
20
+ const b64ch = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=';
21
+ const b64chs = Array.prototype.slice.call(b64ch);
22
+ const b64tab = ((a) => {
23
+ let tab = {};
24
+ a.forEach((c, i) => tab[c] = i);
25
+ return tab;
26
+ })(b64chs);
27
+ const b64re = /^(?:[A-Za-z\d+\/]{4})*?(?:[A-Za-z\d+\/]{2}(?:==)?|[A-Za-z\d+\/]{3}=?)?$/;
28
+ const _fromCC = String.fromCharCode.bind(String);
29
+ const _U8Afrom = typeof Uint8Array.from === 'function'
30
+ ? Uint8Array.from.bind(Uint8Array)
31
+ : (it) => new Uint8Array(Array.prototype.slice.call(it, 0));
32
+ const _mkUriSafe = (src) => src
33
+ .replace(/=/g, '').replace(/[+\/]/g, (m0) => m0 == '+' ? '-' : '_');
34
+ const _tidyB64 = (s) => s.replace(/[^A-Za-z0-9\+\/]/g, '');
35
+ /**
36
+ * polyfill version of `btoa`
37
+ */
38
+ const btoaPolyfill = (bin) => {
39
+ // console.log('polyfilled');
40
+ let u32, c0, c1, c2, asc = '';
41
+ const pad = bin.length % 3;
42
+ for (let i = 0; i < bin.length;) {
43
+ if ((c0 = bin.charCodeAt(i++)) > 255 ||
44
+ (c1 = bin.charCodeAt(i++)) > 255 ||
45
+ (c2 = bin.charCodeAt(i++)) > 255)
46
+ throw new TypeError('invalid character found');
47
+ u32 = (c0 << 16) | (c1 << 8) | c2;
48
+ asc += b64chs[u32 >> 18 & 63]
49
+ + b64chs[u32 >> 12 & 63]
50
+ + b64chs[u32 >> 6 & 63]
51
+ + b64chs[u32 & 63];
52
+ }
53
+ return pad ? asc.slice(0, pad - 3) + "===".substring(pad) : asc;
54
+ };
55
+ /**
56
+ * does what `window.btoa` of web browsers do.
57
+ * @param {String} bin binary string
58
+ * @returns {string} Base64-encoded string
59
+ */
60
+ const _btoa = typeof btoa === 'function' ? (bin) => btoa(bin)
61
+ : _hasBuffer ? (bin) => Buffer.from(bin, 'binary').toString('base64')
62
+ : btoaPolyfill;
63
+ const _fromUint8Array = _hasBuffer
64
+ ? (u8a) => Buffer.from(u8a).toString('base64')
65
+ : (u8a) => {
66
+ // cf. https://stackoverflow.com/questions/12710001/how-to-convert-uint8-array-to-base64-encoded-string/12713326#12713326
67
+ const maxargs = 0x1000;
68
+ let strs = [];
69
+ for (let i = 0, l = u8a.length; i < l; i += maxargs) {
70
+ strs.push(_fromCC.apply(null, u8a.subarray(i, i + maxargs)));
71
+ }
72
+ return _btoa(strs.join(''));
73
+ };
74
+ /**
75
+ * converts a Uint8Array to a Base64 string.
76
+ * @param {boolean} [urlsafe] URL-and-filename-safe a la RFC4648 §5
77
+ * @returns {string} Base64 string
78
+ */
79
+ const fromUint8Array = (u8a, urlsafe = false) => urlsafe ? _mkUriSafe(_fromUint8Array(u8a)) : _fromUint8Array(u8a);
80
+ // This trick is found broken https://github.com/dankogai/js-base64/issues/130
81
+ // const utob = (src: string) => unescape(encodeURIComponent(src));
82
+ // reverting good old fationed regexp
83
+ const cb_utob = (c) => {
84
+ if (c.length < 2) {
85
+ var cc = c.charCodeAt(0);
86
+ return cc < 0x80 ? c
87
+ : cc < 0x800 ? (_fromCC(0xc0 | (cc >>> 6))
88
+ + _fromCC(0x80 | (cc & 0x3f)))
89
+ : (_fromCC(0xe0 | ((cc >>> 12) & 0x0f))
90
+ + _fromCC(0x80 | ((cc >>> 6) & 0x3f))
91
+ + _fromCC(0x80 | (cc & 0x3f)));
92
+ }
93
+ else {
94
+ var cc = 0x10000
95
+ + (c.charCodeAt(0) - 0xD800) * 0x400
96
+ + (c.charCodeAt(1) - 0xDC00);
97
+ return (_fromCC(0xf0 | ((cc >>> 18) & 0x07))
98
+ + _fromCC(0x80 | ((cc >>> 12) & 0x3f))
99
+ + _fromCC(0x80 | ((cc >>> 6) & 0x3f))
100
+ + _fromCC(0x80 | (cc & 0x3f)));
101
+ }
102
+ };
103
+ const re_utob = /[\uD800-\uDBFF][\uDC00-\uDFFFF]|[^\x00-\x7F]/g;
104
+ /**
105
+ * @deprecated should have been internal use only.
106
+ * @param {string} src UTF-8 string
107
+ * @returns {string} UTF-16 string
108
+ */
109
+ const utob = (u) => u.replace(re_utob, cb_utob);
110
+ //
111
+ const _encode = _hasBuffer
112
+ ? (s) => Buffer.from(s, 'utf8').toString('base64')
113
+ : _TE
114
+ ? (s) => _fromUint8Array(_TE.encode(s))
115
+ : (s) => _btoa(utob(s));
116
+ /**
117
+ * converts a UTF-8-encoded string to a Base64 string.
118
+ * @param {boolean} [urlsafe] if `true` make the result URL-safe
119
+ * @returns {string} Base64 string
120
+ */
121
+ const encode = (src, urlsafe = false) => urlsafe
122
+ ? _mkUriSafe(_encode(src))
123
+ : _encode(src);
124
+ /**
125
+ * converts a UTF-8-encoded string to URL-safe Base64 RFC4648 §5.
126
+ * @returns {string} Base64 string
127
+ */
128
+ const encodeURI = (src) => encode(src, true);
129
+ // This trick is found broken https://github.com/dankogai/js-base64/issues/130
130
+ // const btou = (src: string) => decodeURIComponent(escape(src));
131
+ // reverting good old fationed regexp
132
+ const re_btou = /[\xC0-\xDF][\x80-\xBF]|[\xE0-\xEF][\x80-\xBF]{2}|[\xF0-\xF7][\x80-\xBF]{3}/g;
133
+ const cb_btou = (cccc) => {
134
+ switch (cccc.length) {
135
+ case 4:
136
+ var cp = ((0x07 & cccc.charCodeAt(0)) << 18)
137
+ | ((0x3f & cccc.charCodeAt(1)) << 12)
138
+ | ((0x3f & cccc.charCodeAt(2)) << 6)
139
+ | (0x3f & cccc.charCodeAt(3)), offset = cp - 0x10000;
140
+ return (_fromCC((offset >>> 10) + 0xD800)
141
+ + _fromCC((offset & 0x3FF) + 0xDC00));
142
+ case 3:
143
+ return _fromCC(((0x0f & cccc.charCodeAt(0)) << 12)
144
+ | ((0x3f & cccc.charCodeAt(1)) << 6)
145
+ | (0x3f & cccc.charCodeAt(2)));
146
+ default:
147
+ return _fromCC(((0x1f & cccc.charCodeAt(0)) << 6)
148
+ | (0x3f & cccc.charCodeAt(1)));
149
+ }
150
+ };
151
+ /**
152
+ * @deprecated should have been internal use only.
153
+ * @param {string} src UTF-16 string
154
+ * @returns {string} UTF-8 string
155
+ */
156
+ const btou = (b) => b.replace(re_btou, cb_btou);
157
+ /**
158
+ * polyfill version of `atob`
159
+ */
160
+ const atobPolyfill = (asc) => {
161
+ // console.log('polyfilled');
162
+ asc = asc.replace(/\s+/g, '');
163
+ if (!b64re.test(asc))
164
+ throw new TypeError('malformed base64.');
165
+ asc += '=='.slice(2 - (asc.length & 3));
166
+ let u24, bin = '', r1, r2;
167
+ for (let i = 0; i < asc.length;) {
168
+ u24 = b64tab[asc.charAt(i++)] << 18
169
+ | b64tab[asc.charAt(i++)] << 12
170
+ | (r1 = b64tab[asc.charAt(i++)]) << 6
171
+ | (r2 = b64tab[asc.charAt(i++)]);
172
+ bin += r1 === 64 ? _fromCC(u24 >> 16 & 255)
173
+ : r2 === 64 ? _fromCC(u24 >> 16 & 255, u24 >> 8 & 255)
174
+ : _fromCC(u24 >> 16 & 255, u24 >> 8 & 255, u24 & 255);
175
+ }
176
+ return bin;
177
+ };
178
+ /**
179
+ * does what `window.atob` of web browsers do.
180
+ * @param {String} asc Base64-encoded string
181
+ * @returns {string} binary string
182
+ */
183
+ const _atob = typeof atob === 'function' ? (asc) => atob(_tidyB64(asc))
184
+ : _hasBuffer ? (asc) => Buffer.from(asc, 'base64').toString('binary')
185
+ : atobPolyfill;
186
+ //
187
+ const _toUint8Array = _hasBuffer
188
+ ? (a) => _U8Afrom(Buffer.from(a, 'base64'))
189
+ : (a) => _U8Afrom(_atob(a).split('').map(c => c.charCodeAt(0)));
190
+ /**
191
+ * converts a Base64 string to a Uint8Array.
192
+ */
193
+ const toUint8Array = (a) => _toUint8Array(_unURI(a));
194
+ //
195
+ const _decode = _hasBuffer
196
+ ? (a) => Buffer.from(a, 'base64').toString('utf8')
197
+ : _TD
198
+ ? (a) => _TD.decode(_toUint8Array(a))
199
+ : (a) => btou(_atob(a));
200
+ const _unURI = (a) => _tidyB64(a.replace(/[-_]/g, (m0) => m0 == '-' ? '+' : '/'));
201
+ /**
202
+ * converts a Base64 string to a UTF-8 string.
203
+ * @param {String} src Base64 string. Both normal and URL-safe are supported
204
+ * @returns {string} UTF-8 string
205
+ */
206
+ const decode = (src) => _decode(_unURI(src));
207
+ /**
208
+ * check if a value is a valid Base64 string
209
+ * @param {String} src a value to check
210
+ */
211
+ const isValid = (src) => {
212
+ if (typeof src !== 'string')
213
+ return false;
214
+ const s = src.replace(/\s+/g, '').replace(/={0,2}$/, '');
215
+ return !/[^\s0-9a-zA-Z\+/]/.test(s) || !/[^\s0-9a-zA-Z\-_]/.test(s);
216
+ };
217
+ //
218
+ const _noEnum = (v) => {
219
+ return {
220
+ value: v, enumerable: false, writable: true, configurable: true
221
+ };
222
+ };
223
+ /**
224
+ * extend String.prototype with relevant methods
225
+ */
226
+ const extendString = function () {
227
+ const _add = (name, body) => Object.defineProperty(String.prototype, name, _noEnum(body));
228
+ _add('fromBase64', function () { return decode(this); });
229
+ _add('toBase64', function (urlsafe) { return encode(this, urlsafe); });
230
+ _add('toBase64URI', function () { return encode(this, true); });
231
+ _add('toBase64URL', function () { return encode(this, true); });
232
+ _add('toUint8Array', function () { return toUint8Array(this); });
233
+ };
234
+ /**
235
+ * extend Uint8Array.prototype with relevant methods
236
+ */
237
+ const extendUint8Array = function () {
238
+ const _add = (name, body) => Object.defineProperty(Uint8Array.prototype, name, _noEnum(body));
239
+ _add('toBase64', function (urlsafe) { return fromUint8Array(this, urlsafe); });
240
+ _add('toBase64URI', function () { return fromUint8Array(this, true); });
241
+ _add('toBase64URL', function () { return fromUint8Array(this, true); });
242
+ };
243
+ /**
244
+ * extend Builtin prototypes with relevant methods
245
+ */
246
+ const extendBuiltins = () => {
247
+ extendString();
248
+ extendUint8Array();
249
+ };
250
+ const gBase64 = {
251
+ version: version,
252
+ VERSION: VERSION,
253
+ atob: _atob,
254
+ atobPolyfill: atobPolyfill,
255
+ btoa: _btoa,
256
+ btoaPolyfill: btoaPolyfill,
257
+ fromBase64: decode,
258
+ toBase64: encode,
259
+ encode: encode,
260
+ encodeURI: encodeURI,
261
+ encodeURL: encodeURI,
262
+ utob: utob,
263
+ btou: btou,
264
+ decode: decode,
265
+ isValid: isValid,
266
+ fromUint8Array: fromUint8Array,
267
+ toUint8Array: toUint8Array,
268
+ extendString: extendString,
269
+ extendUint8Array: extendUint8Array,
270
+ extendBuiltins: extendBuiltins
271
+ };
272
+
273
+ export { gBase64 as Base64, VERSION, _atob as atob, atobPolyfill, _btoa as btoa, btoaPolyfill, btou, decode, encode, encodeURI, encodeURI as encodeURL, extendBuiltins, extendString, extendUint8Array, decode as fromBase64, fromUint8Array, isValid, encode as toBase64, toUint8Array, utob, version };
@@ -0,0 +1,3 @@
1
+ function e(e){this.message=e;}e.prototype=new Error,e.prototype.name="InvalidCharacterError";var r="undefined"!=typeof window&&window.atob&&window.atob.bind(window)||function(r){var t=String(r).replace(/=+$/,"");if(t.length%4==1)throw new e("'atob' failed: The string to be decoded is not correctly encoded.");for(var n,o,a=0,i=0,c="";o=t.charAt(i++);~o&&(n=a%4?64*n+o:o,a++%4)?c+=String.fromCharCode(255&n>>(-2*a&6)):0)o="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".indexOf(o);return c};function t(e){var t=e.replace(/-/g,"+").replace(/_/g,"/");switch(t.length%4){case 0:break;case 2:t+="==";break;case 3:t+="=";break;default:throw "Illegal base64url string!"}try{return function(e){return decodeURIComponent(r(e).replace(/(.)/g,(function(e,r){var t=r.charCodeAt(0).toString(16).toUpperCase();return t.length<2&&(t="0"+t),"%"+t})))}(t)}catch(e){return r(t)}}function n(e){this.message=e;}function o(e,r){if("string"!=typeof e)throw new n("Invalid token specified");var o=!0===(r=r||{}).header?0:1;try{return JSON.parse(t(e.split(".")[o]))}catch(e){throw new n("Invalid token specified: "+e.message)}}n.prototype=new Error,n.prototype.name="InvalidTokenError";
2
+
3
+ export { n as InvalidTokenError, o as default };
@@ -0,0 +1,3 @@
1
+ function mitt(n){return {all:n=n||new Map,on:function(t,e){var i=n.get(t);i?i.push(e):n.set(t,[e]);},off:function(t,e){var i=n.get(t);i&&(e?i.splice(i.indexOf(e)>>>0,1):n.set(t,[]));},emit:function(t,e){var i=n.get(t);i&&i.slice().map(function(n){n(e);}),(i=n.get("*"))&&i.slice().map(function(n){n(t,e);});}}}
2
+
3
+ export { mitt as default };