orion-design 0.1.49 → 0.1.52

Sign up to get free protection for your applications and to get access to all the features.
Files changed (131) hide show
  1. package/dist/base64-KVpG-D_n.js +103 -0
  2. package/dist/base64-KVpG-D_n.js.map +1 -0
  3. package/dist/components/Button/index.d.ts +2 -41
  4. package/dist/components/Card/index.d.ts +1 -3
  5. package/dist/components/Form/FileInput/FileInput.vue.d.ts +3 -100
  6. package/dist/components/Form/Form.vue.d.ts +2 -70
  7. package/dist/components/Form/LovInput/LovInput.vue.d.ts +21526 -1248
  8. package/dist/components/Form/TableSelect/TableSelect.vue.d.ts +21526 -1248
  9. package/dist/components/Form/index.d.ts +2 -38
  10. package/dist/components/Form/index.js +126 -127
  11. package/dist/components/Form/index.js.map +1 -1
  12. package/dist/components/LovTable/LovPagetable.vue.d.ts +2 -262
  13. package/dist/components/LovTable/LovQuerytable.vue.d.ts +2 -178
  14. package/dist/components/LovTable/index.d.ts +560 -792
  15. package/dist/components/LovTable/index.js +12 -17
  16. package/dist/components/LovTable/index.js.map +1 -1
  17. package/dist/components/Pagetable/Pagetable.d.ts +36 -28
  18. package/dist/components/Pagetable/hooks/usePagetable.d.ts +38 -0
  19. package/dist/components/Pagetable/hooks/usePagetable.js +49 -0
  20. package/dist/components/Pagetable/hooks/usePagetable.js.map +1 -0
  21. package/dist/components/Pagetable/index.d.ts +2 -1
  22. package/dist/components/Pagetable/index.js +5 -2
  23. package/dist/components/Pagetable/index.js.map +1 -1
  24. package/dist/components/Space/index.d.ts +1 -10
  25. package/dist/components/TableSelectPagetable/TableSelectPagetable.vue.d.ts +2 -262
  26. package/dist/components/TableSelectPagetable/index.d.ts +2 -136
  27. package/dist/components/Tabs/index.js +1 -1
  28. package/dist/components/Tree/Tree.vue.d.ts +2 -160
  29. package/dist/components/Tree/index.d.ts +2 -84
  30. package/dist/components/_util/dom/element.js +1 -1
  31. package/dist/components/_util/dom/style.js +1 -1
  32. package/dist/components/_util/error.js +1 -1
  33. package/dist/components/_util/functions.js +1 -1
  34. package/dist/components/_util/index.js +1 -1
  35. package/dist/components/_util/objects.js +1 -1
  36. package/dist/components/_util/strings.js +2 -2
  37. package/dist/components/_util/types.js +2 -2
  38. package/dist/components/_util/vue/install.js +1 -1
  39. package/dist/components/_util/vue/props/runtime.js +1 -1
  40. package/dist/components/_util/vue/refs.js +1 -1
  41. package/dist/components/_util/vue/vnode.js +1 -1
  42. package/dist/components/components.d.ts +1 -2
  43. package/dist/components/components.js +18 -17
  44. package/dist/components/index.d.ts +1 -0
  45. package/dist/components/index.js +42 -38
  46. package/dist/components/index.js.map +1 -1
  47. package/dist/{components-G3_R2B-U.js → components-BvgQJQRM.js} +18 -17
  48. package/dist/{components-G3_R2B-U.js.map → components-BvgQJQRM.js.map} +1 -1
  49. package/dist/{functions-DzLqXvGt.js → functions-LOH6x_02.js} +2 -2
  50. package/dist/functions-LOH6x_02.js.map +1 -0
  51. package/dist/index-BW3nOBfD.js +714 -0
  52. package/dist/index-BW3nOBfD.js.map +1 -0
  53. package/dist/index.js +49 -45
  54. package/dist/index.js.map +1 -1
  55. package/dist/request/disivion/DivisionErrorHandler.d.ts +0 -2
  56. package/dist/request/disivion/DivisionErrorHandler.js +18 -28
  57. package/dist/request/disivion/DivisionErrorHandler.js.map +1 -1
  58. package/dist/request/disivion/index.d.ts +1 -0
  59. package/dist/request/disivion/index.js +73 -168
  60. package/dist/request/disivion/index.js.map +1 -1
  61. package/dist/request/error/ResponseError404.d.ts +7 -0
  62. package/dist/request/error/ResponseError404.js +10 -0
  63. package/dist/request/error/ResponseError404.js.map +1 -0
  64. package/dist/request/error/ResponseError500.d.ts +6 -0
  65. package/dist/request/error/ResponseError500.js +10 -0
  66. package/dist/request/error/ResponseError500.js.map +1 -0
  67. package/dist/request/error/{BizExceptionResponseError.d.ts → ResponseErrorBizException.d.ts} +1 -1
  68. package/dist/request/error/{BizExceptionResponseError.js → ResponseErrorBizException.js} +2 -2
  69. package/dist/request/error/ResponseErrorBizException.js.map +1 -0
  70. package/dist/request/error/{ExceptionResponseError.d.ts → ResponseErrorException.d.ts} +1 -1
  71. package/dist/request/error/{ExceptionResponseError.js → ResponseErrorException.js} +2 -2
  72. package/dist/request/error/ResponseErrorException.js.map +1 -0
  73. package/dist/request/error/{SessionExceptionResponseError.d.ts → ResponseErrorSessionException.d.ts} +1 -1
  74. package/dist/request/error/{SessionExceptionResponseError.js → ResponseErrorSessionException.js} +2 -2
  75. package/dist/request/error/{SessionExceptionResponseError.js.map → ResponseErrorSessionException.js.map} +1 -1
  76. package/dist/request/index.d.ts +12 -3
  77. package/dist/request/index.js +35 -11
  78. package/dist/request/index.js.map +1 -1
  79. package/dist/request/leaf7/Leaf7EncryptRequestParser.d.ts +8 -0
  80. package/dist/request/leaf7/Leaf7EncryptRequestParser.js +28 -0
  81. package/dist/request/leaf7/Leaf7EncryptRequestParser.js.map +1 -0
  82. package/dist/request/leaf7/Leaf7EncryptResponseParser.d.ts +8 -0
  83. package/dist/request/leaf7/Leaf7EncryptResponseParser.js +42 -0
  84. package/dist/request/leaf7/Leaf7EncryptResponseParser.js.map +1 -0
  85. package/dist/request/leaf7/Leaf7ErrorHandler.d.ts +7 -0
  86. package/dist/request/leaf7/Leaf7ErrorHandler.js +51 -0
  87. package/dist/request/leaf7/Leaf7ErrorHandler.js.map +1 -0
  88. package/dist/request/leaf7/Leaf7ResponseParser.d.ts +5 -0
  89. package/dist/request/leaf7/Leaf7ResponseParser.js +17 -0
  90. package/dist/request/leaf7/Leaf7ResponseParser.js.map +1 -0
  91. package/dist/request/leaf7/index.d.ts +20 -0
  92. package/dist/request/leaf7/index.js +130 -0
  93. package/dist/request/leaf7/index.js.map +1 -0
  94. package/dist/request/leaf7/smCrypto/sm2/asn1.d.ts +14 -0
  95. package/dist/request/leaf7/smCrypto/sm2/asn1.js +81 -0
  96. package/dist/request/leaf7/smCrypto/sm2/asn1.js.map +1 -0
  97. package/dist/request/leaf7/smCrypto/sm2/ec.d.ts +119 -0
  98. package/dist/request/leaf7/smCrypto/sm2/ec.js +199 -0
  99. package/dist/request/leaf7/smCrypto/sm2/ec.js.map +1 -0
  100. package/dist/request/leaf7/smCrypto/sm2/index.d.ts +45 -0
  101. package/dist/request/leaf7/smCrypto/sm2/index.js +102 -0
  102. package/dist/request/leaf7/smCrypto/sm2/index.js.map +1 -0
  103. package/dist/request/leaf7/smCrypto/sm2/sm3.d.ts +10 -0
  104. package/dist/request/leaf7/smCrypto/sm2/sm3.js +69 -0
  105. package/dist/request/leaf7/smCrypto/sm2/sm3.js.map +1 -0
  106. package/dist/request/leaf7/smCrypto/sm2/utils.d.ts +66 -0
  107. package/dist/request/leaf7/smCrypto/sm2/utils.js +91 -0
  108. package/dist/request/leaf7/smCrypto/sm2/utils.js.map +1 -0
  109. package/dist/request/leaf7/smCrypto/sm3/index.d.ts +1 -0
  110. package/dist/request/leaf7/smCrypto/sm3/index.js +45 -0
  111. package/dist/request/leaf7/smCrypto/sm3/index.js.map +1 -0
  112. package/dist/request/leaf7/smCrypto/sm4/index.d.ts +5 -0
  113. package/dist/request/leaf7/smCrypto/sm4/index.js +399 -0
  114. package/dist/request/leaf7/smCrypto/sm4/index.js.map +1 -0
  115. package/dist/request/leaf7/smCrypto/smCrypto.d.ts +3 -0
  116. package/dist/request/leaf7/smCrypto/smCrypto.js +9 -0
  117. package/dist/request/leaf7/smCrypto/smCrypto.js.map +1 -0
  118. package/dist/request/leaf7/types.d.ts +11 -0
  119. package/dist/request/leaf7/types.js +2 -0
  120. package/dist/request/leaf7/types.js.map +1 -0
  121. package/dist/request/utils/readBlob.d.ts +1 -0
  122. package/dist/request/utils/readBlob.js +12 -0
  123. package/dist/request/utils/readBlob.js.map +1 -0
  124. package/dist/utils/functions.js +1 -1
  125. package/dist/version/version.d.ts +1 -1
  126. package/dist/version/version.js +1 -1
  127. package/dist/version/version.js.map +1 -1
  128. package/package.json +2 -1
  129. package/dist/functions-DzLqXvGt.js.map +0 -1
  130. package/dist/request/error/BizExceptionResponseError.js.map +0 -1
  131. package/dist/request/error/ExceptionResponseError.js.map +0 -1
@@ -0,0 +1,66 @@
1
+ import { ECCurveFp } from './ec';
2
+ /**
3
+ * 获取公共椭圆曲线
4
+ */
5
+ declare function getGlobalCurve(): ECCurveFp;
6
+ /**
7
+ * 生成ecparam
8
+ */
9
+ declare function generateEcparam(): {
10
+ curve: ECCurveFp;
11
+ G: any;
12
+ n: any;
13
+ };
14
+ /**
15
+ * 生成密钥对:publicKey = privateKey * G
16
+ */
17
+ declare function generateKeyPairHex(a: any, b: any, c: any): {
18
+ privateKey: any;
19
+ publicKey: string;
20
+ };
21
+ /**
22
+ * 生成压缩公钥
23
+ */
24
+ declare function compressPublicKeyHex(s: any): string;
25
+ /**
26
+ * utf8串转16进制串
27
+ */
28
+ declare function utf8ToHex(input: any): string;
29
+ /**
30
+ * 补全16进制字符串
31
+ */
32
+ declare function leftPad(input: any, num: any): any;
33
+ /**
34
+ * 转成16进制串
35
+ */
36
+ declare function arrayToHex(arr: any): any;
37
+ /**
38
+ * 转成utf8串
39
+ */
40
+ declare function arrayToUtf8(arr: any): string;
41
+ /**
42
+ * 转成字节数组
43
+ */
44
+ declare function hexToArray(hexStr: any): never[];
45
+ /**
46
+ * 验证公钥是否为椭圆曲线上的点
47
+ */
48
+ declare function verifyPublicKey(publicKey: any): any;
49
+ /**
50
+ * 验证公钥是否等价,等价返回true
51
+ */
52
+ declare function comparePublicKeyHex(publicKey1: any, publicKey2: any): any;
53
+ declare const _default: {
54
+ getGlobalCurve: typeof getGlobalCurve;
55
+ generateEcparam: typeof generateEcparam;
56
+ generateKeyPairHex: typeof generateKeyPairHex;
57
+ compressPublicKeyHex: typeof compressPublicKeyHex;
58
+ utf8ToHex: typeof utf8ToHex;
59
+ leftPad: typeof leftPad;
60
+ arrayToHex: typeof arrayToHex;
61
+ arrayToUtf8: typeof arrayToUtf8;
62
+ hexToArray: typeof hexToArray;
63
+ verifyPublicKey: typeof verifyPublicKey;
64
+ comparePublicKeyHex: typeof comparePublicKeyHex;
65
+ };
66
+ export default _default;
@@ -0,0 +1,91 @@
1
+ import { j as r } from "../../../../index-BW3nOBfD.js";
2
+ import { ECCurveFp as B } from "./ec.js";
3
+ const p = new r.SecureRandom(), { curve: s, G: C, n: a } = l();
4
+ function h() {
5
+ return s;
6
+ }
7
+ function l() {
8
+ const F = new r.BigInteger("FFFFFFFEFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00000000FFFFFFFFFFFFFFFF", 16), e = new r.BigInteger("FFFFFFFEFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00000000FFFFFFFFFFFFFFFC", 16), t = new r.BigInteger("28E9FA9E9D9F5E344D5A9E4BCF6509A7F39789F515AB8F92DDBCBD414D940E93", 16), n = new B(F, e, t), g = n.decodePointHex("04" + "32C4AE2C1F1981195F9904466A39C9948FE30BBFF2660BE1715A4589334C74C7" + "BC3736A2F4F6779C59BDCEE36B692153D0A9877CC62A474002DF32E52139F0A0"), u = new r.BigInteger("FFFFFFFEFFFFFFFFFFFFFFFFFFFFFFFF7203DF6B21C6052B53BBF40939D54123", 16);
9
+ return { curve: n, G: g, n: u };
10
+ }
11
+ function y(F, e, t) {
12
+ const o = (F ? new r.BigInteger(F, e, t) : new r.BigInteger(a.bitLength(), p)).mod(a.subtract(r.BigInteger.ONE)).add(r.BigInteger.ONE), c = i(o.toString(16), 64), g = C.multiply(o), u = i(g.getX().toBigInteger().toString(16), 64), f = i(g.getY().toBigInteger().toString(16), 64), d = "04" + u + f;
13
+ return { privateKey: c, publicKey: d };
14
+ }
15
+ function E(F) {
16
+ if (F.length !== 130) throw new Error("Invalid public key to compress");
17
+ const e = (F.length - 2) / 2, t = F.substr(2, e), n = new r.BigInteger(F.substr(e + 2, e), 16);
18
+ let o = "03";
19
+ return n.mod(new r.BigInteger("2")).equals(r.BigInteger.ZERO) && (o = "02"), o + t;
20
+ }
21
+ function x(F) {
22
+ F = unescape(encodeURIComponent(F));
23
+ const e = F.length, t = [];
24
+ for (let o = 0; o < e; o++)
25
+ t[o >>> 2] |= (F.charCodeAt(o) & 255) << 24 - o % 4 * 8;
26
+ const n = [];
27
+ for (let o = 0; o < e; o++) {
28
+ const c = t[o >>> 2] >>> 24 - o % 4 * 8 & 255;
29
+ n.push((c >>> 4).toString(16)), n.push((c & 15).toString(16));
30
+ }
31
+ return n.join("");
32
+ }
33
+ function i(F, e) {
34
+ return F.length >= e ? F : new Array(e - F.length + 1).join("0") + F;
35
+ }
36
+ function w(F) {
37
+ return F.map((e) => (e = e.toString(16), e.length === 1 ? "0" + e : e)).join("");
38
+ }
39
+ function I(F) {
40
+ const e = [];
41
+ let t = 0;
42
+ for (let n = 0; n < F.length * 2; n += 2)
43
+ e[n >>> 3] |= parseInt(F[t], 10) << 24 - n % 8 * 4, t++;
44
+ try {
45
+ const n = [];
46
+ for (let o = 0; o < F.length; o++) {
47
+ const c = e[o >>> 2] >>> 24 - o % 4 * 8 & 255;
48
+ n.push(String.fromCharCode(c));
49
+ }
50
+ return decodeURIComponent(escape(n.join("")));
51
+ } catch {
52
+ throw new Error("Malformed UTF-8 data");
53
+ }
54
+ }
55
+ function b(F) {
56
+ const e = [];
57
+ let t = F.length;
58
+ t % 2 !== 0 && (F = i(F, t + 1)), t = F.length;
59
+ for (let n = 0; n < t; n += 2)
60
+ e.push(parseInt(F.substr(n, 2), 16));
61
+ return e;
62
+ }
63
+ function m(F) {
64
+ const e = s.decodePointHex(F);
65
+ if (!e) return !1;
66
+ const t = e.getX();
67
+ return e.getY().square().equals(t.multiply(t.square()).add(t.multiply(s.a)).add(s.b));
68
+ }
69
+ function A(F, e) {
70
+ const t = s.decodePointHex(F);
71
+ if (!t) return !1;
72
+ const n = s.decodePointHex(e);
73
+ return n ? t.equals(n) : !1;
74
+ }
75
+ const D = {
76
+ getGlobalCurve: h,
77
+ generateEcparam: l,
78
+ generateKeyPairHex: y,
79
+ compressPublicKeyHex: E,
80
+ utf8ToHex: x,
81
+ leftPad: i,
82
+ arrayToHex: w,
83
+ arrayToUtf8: I,
84
+ hexToArray: b,
85
+ verifyPublicKey: m,
86
+ comparePublicKeyHex: A
87
+ };
88
+ export {
89
+ D as default
90
+ };
91
+ //# sourceMappingURL=utils.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utils.js","sources":["../../../../../src/request/leaf7/smCrypto/sm2/utils.ts"],"sourcesContent":["import { BigInteger, SecureRandom } from 'jsbn'\r\nimport { ECCurveFp } from './ec'\r\n\r\nconst rng = new SecureRandom()\r\nconst { curve, G, n } = generateEcparam()\r\n\r\n/**\r\n * 获取公共椭圆曲线\r\n */\r\nfunction getGlobalCurve() {\r\n return curve\r\n}\r\n\r\n/**\r\n * 生成ecparam\r\n */\r\nfunction generateEcparam() {\r\n // 椭圆曲线\r\n const p = new BigInteger('FFFFFFFEFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00000000FFFFFFFFFFFFFFFF', 16)\r\n const a = new BigInteger('FFFFFFFEFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00000000FFFFFFFFFFFFFFFC', 16)\r\n const b = new BigInteger('28E9FA9E9D9F5E344D5A9E4BCF6509A7F39789F515AB8F92DDBCBD414D940E93', 16)\r\n const curve = new ECCurveFp(p, a, b)\r\n\r\n // 基点\r\n const gxHex = '32C4AE2C1F1981195F9904466A39C9948FE30BBFF2660BE1715A4589334C74C7'\r\n const gyHex = 'BC3736A2F4F6779C59BDCEE36B692153D0A9877CC62A474002DF32E52139F0A0'\r\n const G = curve.decodePointHex('04' + gxHex + gyHex)\r\n\r\n const n = new BigInteger('FFFFFFFEFFFFFFFFFFFFFFFFFFFFFFFF7203DF6B21C6052B53BBF40939D54123', 16)\r\n\r\n return { curve, G, n }\r\n}\r\n\r\n/**\r\n * 生成密钥对:publicKey = privateKey * G\r\n */\r\nfunction generateKeyPairHex(a, b, c) {\r\n const random = a ? new BigInteger(a, b, c) : new BigInteger(n.bitLength(), rng)\r\n const d = random.mod(n.subtract(BigInteger.ONE)).add(BigInteger.ONE) // 随机数\r\n const privateKey = leftPad(d.toString(16), 64)\r\n\r\n const P = G.multiply(d) // P = dG,p 为公钥,d 为私钥\r\n const Px = leftPad(P.getX().toBigInteger().toString(16), 64)\r\n const Py = leftPad(P.getY().toBigInteger().toString(16), 64)\r\n const publicKey = '04' + Px + Py\r\n\r\n return { privateKey, publicKey }\r\n}\r\n\r\n/**\r\n * 生成压缩公钥\r\n */\r\nfunction compressPublicKeyHex(s) {\r\n if (s.length !== 130) throw new Error('Invalid public key to compress')\r\n\r\n const len = (s.length - 2) / 2\r\n const xHex = s.substr(2, len)\r\n const y = new BigInteger(s.substr(len + 2, len), 16)\r\n\r\n let prefix = '03'\r\n if (y.mod(new BigInteger('2')).equals(BigInteger.ZERO)) prefix = '02'\r\n\r\n return prefix + xHex\r\n}\r\n\r\n/**\r\n * utf8串转16进制串\r\n */\r\nfunction utf8ToHex(input) {\r\n input = unescape(encodeURIComponent(input))\r\n\r\n const length = input.length\r\n\r\n // 转换到字数组\r\n const words = []\r\n for (let i = 0; i < length; i++) {\r\n words[i >>> 2] |= (input.charCodeAt(i) & 0xff) << (24 - (i % 4) * 8)\r\n }\r\n\r\n // 转换到16进制\r\n const hexChars = []\r\n for (let i = 0; i < length; i++) {\r\n const bite = (words[i >>> 2] >>> (24 - (i % 4) * 8)) & 0xff\r\n hexChars.push((bite >>> 4).toString(16))\r\n hexChars.push((bite & 0x0f).toString(16))\r\n }\r\n\r\n return hexChars.join('')\r\n}\r\n\r\n/**\r\n * 补全16进制字符串\r\n */\r\nfunction leftPad(input, num) {\r\n if (input.length >= num) return input\r\n\r\n return new Array(num - input.length + 1).join('0') + input\r\n}\r\n\r\n/**\r\n * 转成16进制串\r\n */\r\nfunction arrayToHex(arr) {\r\n return arr\r\n .map((item) => {\r\n item = item.toString(16)\r\n return item.length === 1 ? '0' + item : item\r\n })\r\n .join('')\r\n}\r\n\r\n/**\r\n * 转成utf8串\r\n */\r\nfunction arrayToUtf8(arr) {\r\n const words = []\r\n let j = 0\r\n for (let i = 0; i < arr.length * 2; i += 2) {\r\n words[i >>> 3] |= parseInt(arr[j], 10) << (24 - (i % 8) * 4)\r\n j++\r\n }\r\n\r\n try {\r\n const latin1Chars = []\r\n\r\n for (let i = 0; i < arr.length; i++) {\r\n const bite = (words[i >>> 2] >>> (24 - (i % 4) * 8)) & 0xff\r\n latin1Chars.push(String.fromCharCode(bite))\r\n }\r\n\r\n return decodeURIComponent(escape(latin1Chars.join('')))\r\n } catch (e) {\r\n throw new Error('Malformed UTF-8 data')\r\n }\r\n}\r\n\r\n/**\r\n * 转成字节数组\r\n */\r\nfunction hexToArray(hexStr) {\r\n const words = []\r\n let hexStrLength = hexStr.length\r\n\r\n if (hexStrLength % 2 !== 0) {\r\n hexStr = leftPad(hexStr, hexStrLength + 1)\r\n }\r\n\r\n hexStrLength = hexStr.length\r\n\r\n for (let i = 0; i < hexStrLength; i += 2) {\r\n words.push(parseInt(hexStr.substr(i, 2), 16))\r\n }\r\n return words\r\n}\r\n\r\n/**\r\n * 验证公钥是否为椭圆曲线上的点\r\n */\r\nfunction verifyPublicKey(publicKey) {\r\n const point = curve.decodePointHex(publicKey)\r\n if (!point) return false\r\n\r\n const x = point.getX()\r\n const y = point.getY()\r\n\r\n // 验证 y^2 是否等于 x^3 + ax + b\r\n return y.square().equals(x.multiply(x.square()).add(x.multiply(curve.a)).add(curve.b))\r\n}\r\n\r\n/**\r\n * 验证公钥是否等价,等价返回true\r\n */\r\nfunction comparePublicKeyHex(publicKey1, publicKey2) {\r\n const point1 = curve.decodePointHex(publicKey1)\r\n if (!point1) return false\r\n\r\n const point2 = curve.decodePointHex(publicKey2)\r\n if (!point2) return false\r\n\r\n return point1.equals(point2)\r\n}\r\n\r\nexport default {\r\n getGlobalCurve,\r\n generateEcparam,\r\n generateKeyPairHex,\r\n compressPublicKeyHex,\r\n utf8ToHex,\r\n leftPad,\r\n arrayToHex,\r\n arrayToUtf8,\r\n hexToArray,\r\n verifyPublicKey,\r\n comparePublicKeyHex,\r\n}\r\n"],"names":["rng","SecureRandom","curve","G","n","generateEcparam","getGlobalCurve","p","BigInteger","a","b","ECCurveFp","generateKeyPairHex","c","d","privateKey","leftPad","P","Px","Py","publicKey","compressPublicKeyHex","s","len","xHex","y","prefix","utf8ToHex","input","length","words","i","hexChars","bite","num","arrayToHex","arr","item","arrayToUtf8","j","latin1Chars","hexToArray","hexStr","hexStrLength","verifyPublicKey","point","x","comparePublicKeyHex","publicKey1","publicKey2","point1","point2","_"],"mappings":";;AAGA,MAAMA,IAAM,IAAIC,EAAAA,gBACV,EAAE,OAAAC,GAAO,GAAAC,GAAG,GAAAC,MAAMC,EAAgB;AAKxC,SAASC,IAAiB;AACjB,SAAAJ;AACT;AAKA,SAASG,IAAkB;AAEzB,QAAME,IAAI,IAAIC,EAAAA,WAAW,oEAAoE,EAAE,GACzFC,IAAI,IAAID,EAAAA,WAAW,oEAAoE,EAAE,GACzFE,IAAI,IAAIF,EAAAA,WAAW,oEAAoE,EAAE,GACzFN,IAAQ,IAAIS,EAAUJ,GAAGE,GAAGC,CAAC,GAK7BP,IAAID,EAAM,eAAe,OAFjB,qEACA,kEACqC,GAE7CE,IAAI,IAAII,EAAAA,WAAW,oEAAoE,EAAE;AAE/F,SAAO,EAAE,OAAAN,GAAO,GAAAC,GAAG,GAAAC;AACrB;AAKA,SAASQ,EAAmBH,GAAGC,GAAGG,GAAG;AAE7B,QAAAC,KADSL,IAAI,IAAID,EAAA,WAAWC,GAAGC,GAAGG,CAAC,IAAI,IAAIL,EAAAA,WAAWJ,EAAE,aAAaJ,CAAG,GAC7D,IAAII,EAAE,SAASI,aAAW,GAAG,CAAC,EAAE,IAAIA,EAAA,WAAW,GAAG,GAC7DO,IAAaC,EAAQF,EAAE,SAAS,EAAE,GAAG,EAAE,GAEvCG,IAAId,EAAE,SAASW,CAAC,GAChBI,IAAKF,EAAQC,EAAE,KAAK,EAAE,aAAe,EAAA,SAAS,EAAE,GAAG,EAAE,GACrDE,IAAKH,EAAQC,EAAE,KAAK,EAAE,aAAe,EAAA,SAA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AAIA,EAAM,CAAC,CAAC;AACvF;AAKA,SAAS6C,EAAoBC,GAAYC,GAAY;AAC7C,QAAAC,IAAShD,EAAM,eAAe8C,CAAU;AAC1C,MAAA,CAACE,EAAe,QAAA;AAEd,QAAAC,IAASjD,EAAM,eAAe+C,CAAU;AAC1C,SAACE,IAEED,EAAO,OAAOC,CAAM,IAFP;AAGtB;AAEA,MAAeC,IAAA;AAAA,EACb,gBAAA9C;AAAA,EACA,iBAAAD;AAAA,EACA,oBAAAO;AAAA,EACA,sBAAAS;AAAA,EACA,WAAAM;AAAA,EACA,SAAAX;AAAA,EACA,YAAAmB;AAAA,EACA,aAAAG;AAAA,EACA,YAAAG;AAAA,EACA,iBAAAG;AAAA,EACA,qBAAAG;AACF;"}
@@ -0,0 +1 @@
1
+ export default function (input: any, options?: any): any;
@@ -0,0 +1,45 @@
1
+ import { sm3 as l, hmac as h } from "../sm2/sm3.js";
2
+ function f(e, r) {
3
+ return e.length >= r ? e : new Array(r - e.length + 1).join("0") + e;
4
+ }
5
+ function s(e) {
6
+ return e.map((r) => (r = r.toString(16), r.length === 1 ? "0" + r : r)).join("");
7
+ }
8
+ function u(e) {
9
+ const r = [];
10
+ let n = e.length;
11
+ n % 2 !== 0 && (e = f(e, n + 1)), n = e.length;
12
+ for (let t = 0; t < n; t += 2)
13
+ r.push(parseInt(e.substr(t, 2), 16));
14
+ return r;
15
+ }
16
+ function a(e) {
17
+ const r = [];
18
+ for (let n = 0, t = e.length; n < t; n++) {
19
+ const o = e.codePointAt(n);
20
+ if (o <= 127)
21
+ r.push(o);
22
+ else if (o <= 2047)
23
+ r.push(192 | o >>> 6), r.push(128 | o & 63);
24
+ else if (o <= 55295 || o >= 57344 && o <= 65535)
25
+ r.push(224 | o >>> 12), r.push(128 | o >>> 6 & 63), r.push(128 | o & 63);
26
+ else if (o >= 65536 && o <= 1114111)
27
+ n++, r.push(240 | o >>> 18 & 28), r.push(128 | o >>> 12 & 63), r.push(128 | o >>> 6 & 63), r.push(128 | o & 63);
28
+ else
29
+ throw r.push(o), new Error("input is not supported");
30
+ }
31
+ return r;
32
+ }
33
+ function c(e, r) {
34
+ if (e = typeof e == "string" ? a(e) : Array.prototype.slice.call(e), r) {
35
+ if ((r.mode || "hmac") !== "hmac") throw new Error("invalid mode");
36
+ let t = r.key;
37
+ if (!t) throw new Error("invalid key");
38
+ return t = typeof t == "string" ? u(t) : Array.prototype.slice.call(t), s(h(e, t));
39
+ }
40
+ return s(l(e));
41
+ }
42
+ export {
43
+ c as default
44
+ };
45
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sources":["../../../../../src/request/leaf7/smCrypto/sm3/index.ts"],"sourcesContent":["import { sm3, hmac } from '../sm2/sm3'\r\n\r\n/**\r\n * 补全16进制字符串\r\n */\r\nfunction leftPad(input, num) {\r\n if (input.length >= num) return input\r\n\r\n return new Array(num - input.length + 1).join('0') + input\r\n}\r\n\r\n/**\r\n * 字节数组转 16 进制串\r\n */\r\nfunction ArrayToHex(arr) {\r\n return arr\r\n .map((item) => {\r\n item = item.toString(16)\r\n return item.length === 1 ? '0' + item : item\r\n })\r\n .join('')\r\n}\r\n\r\n/**\r\n * 转成字节数组\r\n */\r\nfunction hexToArray(hexStr) {\r\n const words = []\r\n let hexStrLength = hexStr.length\r\n\r\n if (hexStrLength % 2 !== 0) {\r\n hexStr = leftPad(hexStr, hexStrLength + 1)\r\n }\r\n\r\n hexStrLength = hexStr.length\r\n\r\n for (let i = 0; i < hexStrLength; i += 2) {\r\n words.push(parseInt(hexStr.substr(i, 2), 16))\r\n }\r\n return words\r\n}\r\n\r\n/**\r\n * utf8 串转字节数组\r\n */\r\nfunction utf8ToArray(str) {\r\n const arr = []\r\n\r\n for (let i = 0, len = str.length; i < len; i++) {\r\n const point = str.codePointAt(i)\r\n\r\n if (point <= 0x007f) {\r\n // 单字节,标量值:00000000 00000000 0zzzzzzz\r\n arr.push(point)\r\n } else if (point <= 0x07ff) {\r\n // 双字节,标量值:00000000 00000yyy yyzzzzzz\r\n arr.push(0xc0 | (point >>> 6)) // 110yyyyy(0xc0-0xdf)\r\n arr.push(0x80 | (point & 0x3f)) // 10zzzzzz(0x80-0xbf)\r\n } else if (point <= 0xd7ff || (point >= 0xe000 && point <= 0xffff)) {\r\n // 三字节:标量值:00000000 xxxxyyyy yyzzzzzz\r\n arr.push(0xe0 | (point >>> 12)) // 1110xxxx(0xe0-0xef)\r\n arr.push(0x80 | ((point >>> 6) & 0x3f)) // 10yyyyyy(0x80-0xbf)\r\n arr.push(0x80 | (point & 0x3f)) // 10zzzzzz(0x80-0xbf)\r\n } else if (point >= 0x010000 && point <= 0x10ffff) {\r\n // 四字节:标量值:000wwwxx xxxxyyyy yyzzzzzz\r\n i++\r\n arr.push(0xf0 | ((point >>> 18) & 0x1c)) // 11110www(0xf0-0xf7)\r\n arr.push(0x80 | ((point >>> 12) & 0x3f)) // 10xxxxxx(0x80-0xbf)\r\n arr.push(0x80 | ((point >>> 6) & 0x3f)) // 10yyyyyy(0x80-0xbf)\r\n arr.push(0x80 | (point & 0x3f)) // 10zzzzzz(0x80-0xbf)\r\n } else {\r\n // 五、六字节,暂时不支持\r\n arr.push(point)\r\n throw new Error('input is not supported')\r\n }\r\n }\r\n\r\n return arr\r\n}\r\n\r\nexport default function (input, options?) {\r\n input = typeof input === 'string' ? utf8ToArray(input) : Array.prototype.slice.call(input)\r\n\r\n if (options) {\r\n const mode = options.mode || 'hmac'\r\n if (mode !== 'hmac') throw new Error('invalid mode')\r\n\r\n let key = options.key\r\n if (!key) throw new Error('invalid key')\r\n\r\n key = typeof key === 'string' ? hexToArray(key) : Array.prototype.slice.call(key)\r\n return ArrayToHex(hmac(input, key))\r\n }\r\n\r\n return ArrayToHex(sm3(input))\r\n}\r\n"],"names":["leftPad","input","num","ArrayToHex","arr","item","hexToArray","hexStr","words","hexStrLength","i","utf8ToArray","str","len","point","sm3","options","key","hmac"],"mappings":";AAKA,SAASA,EAAQC,GAAOC,G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AAK,EAAK,GAClCV,EAAA,KAAK,MAAQU,IAAQ,EAAK;AAAA;AAG9B,YAAAV,EAAI,KAAKU,CAAK,GACR,IAAI,MAAM,wBAAwB;AAAA,EAE5C;AAEO,SAAAV;AACT;AAEA,SAAAW,EAAyBd,GAAOe,GAAU;AAGxC,MAFQf,IAAA,OAAOA,KAAU,WAAWU,EAAYV,CAAK,IAAI,MAAM,UAAU,MAAM,KAAKA,CAAK,GAErFe,GAAS;AAEX,SADaA,EAAQ,QAAQ,YAChB,OAAc,OAAA,IAAI,MAAM,cAAc;AAEnD,QAAIC,IAAMD,EAAQ;AAClB,QAAI,CAACC,EAAW,OAAA,IAAI,MAAM,aAAa;AAEjC,WAAAA,IAAA,OAAOA,KAAQ,WAAWX,EAAWW,CAAG,IAAI,MAAM,UAAU,MAAM,KAAKA,CAAG,GACzEd,EAAWe,EAAKjB,GAAOgB,CAAG,CAAC;AAAA,EACpC;AAEO,SAAAd,EAAWY,EAAId,CAAK,CAAC;AAC9B;"}
@@ -0,0 +1,5 @@
1
+ declare const _default: {
2
+ _s4EN(inArray: any, key: any, options: any): any;
3
+ _s4DE(inArray: any, key: any, options: any): any;
4
+ };
5
+ export default _default;
@@ -0,0 +1,399 @@
1
+ const w = [
2
+ 214,
3
+ 144,
4
+ 233,
5
+ 254,
6
+ 204,
7
+ 225,
8
+ 61,
9
+ 183,
10
+ 22,
11
+ 182,
12
+ 20,
13
+ 194,
14
+ 40,
15
+ 251,
16
+ 44,
17
+ 5,
18
+ 43,
19
+ 103,
20
+ 154,
21
+ 118,
22
+ 42,
23
+ 190,
24
+ 4,
25
+ 195,
26
+ 170,
27
+ 68,
28
+ 19,
29
+ 38,
30
+ 73,
31
+ 134,
32
+ 6,
33
+ 153,
34
+ 156,
35
+ 66,
36
+ 80,
37
+ 244,
38
+ 145,
39
+ 239,
40
+ 152,
41
+ 122,
42
+ 51,
43
+ 84,
44
+ 11,
45
+ 67,
46
+ 237,
47
+ 207,
48
+ 172,
49
+ 98,
50
+ 228,
51
+ 179,
52
+ 28,
53
+ 169,
54
+ 201,
55
+ 8,
56
+ 232,
57
+ 149,
58
+ 128,
59
+ 223,
60
+ 148,
61
+ 250,
62
+ 117,
63
+ 143,
64
+ 63,
65
+ 166,
66
+ 71,
67
+ 7,
68
+ 167,
69
+ 252,
70
+ 243,
71
+ 115,
72
+ 23,
73
+ 186,
74
+ 131,
75
+ 89,
76
+ 60,
77
+ 25,
78
+ 230,
79
+ 133,
80
+ 79,
81
+ 168,
82
+ 104,
83
+ 107,
84
+ 129,
85
+ 178,
86
+ 113,
87
+ 100,
88
+ 218,
89
+ 139,
90
+ 248,
91
+ 235,
92
+ 15,
93
+ 75,
94
+ 112,
95
+ 86,
96
+ 157,
97
+ 53,
98
+ 30,
99
+ 36,
100
+ 14,
101
+ 94,
102
+ 99,
103
+ 88,
104
+ 209,
105
+ 162,
106
+ 37,
107
+ 34,
108
+ 124,
109
+ 59,
110
+ 1,
111
+ 33,
112
+ 120,
113
+ 135,
114
+ 212,
115
+ 0,
116
+ 70,
117
+ 87,
118
+ 159,
119
+ 211,
120
+ 39,
121
+ 82,
122
+ 76,
123
+ 54,
124
+ 2,
125
+ 231,
126
+ 160,
127
+ 196,
128
+ 200,
129
+ 158,
130
+ 234,
131
+ 191,
132
+ 138,
133
+ 210,
134
+ 64,
135
+ 199,
136
+ 56,
137
+ 181,
138
+ 163,
139
+ 247,
140
+ 242,
141
+ 206,
142
+ 249,
143
+ 97,
144
+ 21,
145
+ 161,
146
+ 224,
147
+ 174,
148
+ 93,
149
+ 164,
150
+ 155,
151
+ 52,
152
+ 26,
153
+ 85,
154
+ 173,
155
+ 147,
156
+ 50,
157
+ 48,
158
+ 245,
159
+ 140,
160
+ 177,
161
+ 227,
162
+ 29,
163
+ 246,
164
+ 226,
165
+ 46,
166
+ 130,
167
+ 102,
168
+ 202,
169
+ 96,
170
+ 192,
171
+ 41,
172
+ 35,
173
+ 171,
174
+ 13,
175
+ 83,
176
+ 78,
177
+ 111,
178
+ 213,
179
+ 219,
180
+ 55,
181
+ 69,
182
+ 222,
183
+ 253,
184
+ 142,
185
+ 47,
186
+ 3,
187
+ 255,
188
+ 106,
189
+ 114,
190
+ 109,
191
+ 108,
192
+ 91,
193
+ 81,
194
+ 141,
195
+ 27,
196
+ 175,
197
+ 146,
198
+ 187,
199
+ 221,
200
+ 188,
201
+ 127,
202
+ 17,
203
+ 217,
204
+ 92,
205
+ 65,
206
+ 31,
207
+ 16,
208
+ 90,
209
+ 216,
210
+ 10,
211
+ 193,
212
+ 49,
213
+ 136,
214
+ 165,
215
+ 205,
216
+ 123,
217
+ 189,
218
+ 45,
219
+ 116,
220
+ 208,
221
+ 18,
222
+ 184,
223
+ 229,
224
+ 180,
225
+ 176,
226
+ 137,
227
+ 105,
228
+ 151,
229
+ 74,
230
+ 12,
231
+ 150,
232
+ 119,
233
+ 126,
234
+ 101,
235
+ 185,
236
+ 241,
237
+ 9,
238
+ 197,
239
+ 110,
240
+ 198,
241
+ 132,
242
+ 24,
243
+ 240,
244
+ 125,
245
+ 236,
246
+ 58,
247
+ 220,
248
+ 77,
249
+ 32,
250
+ 121,
251
+ 238,
252
+ 95,
253
+ 62,
254
+ 215,
255
+ 203,
256
+ 57,
257
+ 72
258
+ ], P = [
259
+ 462357,
260
+ 472066609,
261
+ 943670861,
262
+ 1415275113,
263
+ 1886879365,
264
+ 2358483617,
265
+ 2830087869,
266
+ 3301692121,
267
+ 3773296373,
268
+ 4228057617,
269
+ 404694573,
270
+ 876298825,
271
+ 1347903077,
272
+ 1819507329,
273
+ 2291111581,
274
+ 2762715833,
275
+ 3234320085,
276
+ 3705924337,
277
+ 4177462797,
278
+ 337322537,
279
+ 808926789,
280
+ 1280531041,
281
+ 1752135293,
282
+ 2223739545,
283
+ 2695343797,
284
+ 3166948049,
285
+ 3638552301,
286
+ 4110090761,
287
+ 269950501,
288
+ 741554753,
289
+ 1213159005,
290
+ 1684763257
291
+ ];
292
+ function g(t) {
293
+ const e = [];
294
+ for (let o = 0, s = t.length; o < s; o += 2)
295
+ e.push(parseInt(t.substr(o, 2), 16));
296
+ return e;
297
+ }
298
+ function Y(t) {
299
+ return t.map((e) => (e = e.toString(16), e.length === 1 ? "0" + e : e)).join("");
300
+ }
301
+ function B(t) {
302
+ const e = [];
303
+ for (let o = 0, s = t.length; o < s; o++) {
304
+ const i = t.codePointAt(o);
305
+ if (i <= 127)
306
+ e.push(i);
307
+ else if (i <= 2047)
308
+ e.push(192 | i >>> 6), e.push(128 | i & 63);
309
+ else if (i <= 55295 || i >= 57344 && i <= 65535)
310
+ e.push(224 | i >>> 12), e.push(128 | i >>> 6 & 63), e.push(128 | i & 63);
311
+ else if (i >= 65536 && i <= 1114111)
312
+ o++, e.push(240 | i >>> 18 & 28), e.push(128 | i >>> 12 & 63), e.push(128 | i >>> 6 & 63), e.push(128 | i & 63);
313
+ else
314
+ throw e.push(i), new Error("input is not supported");
315
+ }
316
+ return e;
317
+ }
318
+ function m(t) {
319
+ const e = [];
320
+ for (let o = 0, s = t.length; o < s; o++)
321
+ t[o] >= 240 && t[o] <= 247 ? (e.push(String.fromCodePoint(((t[o] & 7) << 18) + ((t[o + 1] & 63) << 12) + ((t[o + 2] & 63) << 6) + (t[o + 3] & 63))), o += 3) : t[o] >= 224 && t[o] <= 239 ? (e.push(String.fromCodePoint(((t[o] & 15) << 12) + ((t[o + 1] & 63) << 6) + (t[o + 2] & 63))), o += 2) : t[o] >= 192 && t[o] <= 223 ? (e.push(String.fromCodePoint(((t[o] & 31) << 6) + (t[o + 1] & 63))), o++) : e.push(String.fromCodePoint(t[o]));
322
+ return e.join("");
323
+ }
324
+ function p(t, e) {
325
+ const o = e & 31;
326
+ return t << o | t >>> 32 - o;
327
+ }
328
+ function h(t) {
329
+ return (w[t >>> 24 & 255] & 255) << 24 | (w[t >>> 16 & 255] & 255) << 16 | (w[t >>> 8 & 255] & 255) << 8 | w[t & 255] & 255;
330
+ }
331
+ function T(t) {
332
+ return t ^ p(t, 2) ^ p(t, 10) ^ p(t, 18) ^ p(t, 24);
333
+ }
334
+ function D(t) {
335
+ return t ^ p(t, 13) ^ p(t, 23);
336
+ }
337
+ function S(t, e, o) {
338
+ const s = new Array(4), i = new Array(4);
339
+ for (let n = 0; n < 4; n++)
340
+ i[0] = t[4 * n] & 255, i[1] = t[4 * n + 1] & 255, i[2] = t[4 * n + 2] & 255, i[3] = t[4 * n + 3] & 255, s[n] = i[0] << 24 | i[1] << 16 | i[2] << 8 | i[3];
341
+ for (let n = 0, f; n < 32; n += 4)
342
+ f = s[1] ^ s[2] ^ s[3] ^ o[n + 0], s[0] ^= T(h(f)), f = s[2] ^ s[3] ^ s[0] ^ o[n + 1], s[1] ^= T(h(f)), f = s[3] ^ s[0] ^ s[1] ^ o[n + 2], s[2] ^= T(h(f)), f = s[0] ^ s[1] ^ s[2] ^ o[n + 3], s[3] ^= T(h(f));
343
+ for (let n = 0; n < 16; n += 4)
344
+ e[n] = s[3 - n / 4] >>> 24 & 255, e[n + 1] = s[3 - n / 4] >>> 16 & 255, e[n + 2] = s[3 - n / 4] >>> 8 & 255, e[n + 3] = s[3 - n / 4] & 255;
345
+ }
346
+ function x(t, e, o) {
347
+ const s = new Array(4), i = new Array(4);
348
+ for (let n = 0; n < 4; n++)
349
+ i[0] = t[0 + 4 * n] & 255, i[1] = t[1 + 4 * n] & 255, i[2] = t[2 + 4 * n] & 255, i[3] = t[3 + 4 * n] & 255, s[n] = i[0] << 24 | i[1] << 16 | i[2] << 8 | i[3];
350
+ s[0] ^= 2746333894, s[1] ^= 1453994832, s[2] ^= 1736282519, s[3] ^= 2993693404;
351
+ for (let n = 0, f; n < 32; n += 4)
352
+ f = s[1] ^ s[2] ^ s[3] ^ P[n + 0], e[n + 0] = s[0] ^= D(h(f)), f = s[2] ^ s[3] ^ s[0] ^ P[n + 1], e[n + 1] = s[1] ^= D(h(f)), f = s[3] ^ s[0] ^ s[1] ^ P[n + 2], e[n + 2] = s[2] ^= D(h(f)), f = s[0] ^ s[1] ^ s[2] ^ P[n + 3], e[n + 3] = s[3] ^= D(h(f));
353
+ if (o === 0)
354
+ for (let n = 0, f; n < 16; n++)
355
+ f = e[n], e[n] = e[31 - n], e[31 - n] = f;
356
+ }
357
+ function L(t, e, o, { padding: s = "pkcs#7", mode: i, iv: n = [], output: f = "string" } = {}) {
358
+ if (i === "cbc" && (typeof n == "string" && (n = g(n)), n.length !== 128 / 8))
359
+ throw new Error("iv is invalid");
360
+ if (typeof e == "string" && (e = g(e)), e.length !== 128 / 8)
361
+ throw new Error("key is invalid");
362
+ if (typeof t == "string" ? o !== 0 ? t = B(t) : t = g(t) : t = [...t], (s === "pkcs#5" || s === "pkcs#7") && o !== 0) {
363
+ const r = 16 - t.length % 16;
364
+ for (let c = 0; c < r; c++) t.push(r);
365
+ }
366
+ const R = new Array(32);
367
+ x(e, R, o);
368
+ const u = [];
369
+ let C = n, O = t.length, E = 0;
370
+ for (; O >= 16; ) {
371
+ const r = t.slice(E, E + 16), c = new Array(16);
372
+ if (i === "cbc")
373
+ for (let l = 0; l < 16; l++)
374
+ o !== 0 && (r[l] ^= C[l]);
375
+ S(r, c, R);
376
+ for (let l = 0; l < 16; l++)
377
+ i === "cbc" && o === 0 && (c[l] ^= C[l]), u[E + l] = c[l];
378
+ i === "cbc" && (o !== 0 ? C = c : C = r), O -= 16, E += 16;
379
+ }
380
+ if ((s === "pkcs#5" || s === "pkcs#7") && o === 0) {
381
+ const r = u.length, c = u[r - 1];
382
+ for (let l = 1; l <= c; l++)
383
+ if (u[r - l] !== c) throw new Error("padding is invalid");
384
+ u.splice(r - c, c);
385
+ }
386
+ return f !== "array" ? o !== 0 ? Y(u) : m(u) : u;
387
+ }
388
+ const j = {
389
+ _s4EN(t, e, o) {
390
+ return L(t, e, 1, o);
391
+ },
392
+ _s4DE(t, e, o) {
393
+ return L(t, e, 0, o);
394
+ }
395
+ };
396
+ export {
397
+ j as default
398
+ };
399
+ //# sourceMappingURL=index.js.map