@xyo-network/hash 2.90.11 → 2.90.13

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 (263) hide show
  1. package/dist/browser/BrowserPayloadHasher.d.cts +9 -0
  2. package/dist/browser/BrowserPayloadHasher.d.cts.map +1 -0
  3. package/dist/browser/BrowserPayloadHasher.d.mts +9 -0
  4. package/dist/browser/BrowserPayloadHasher.d.mts.map +1 -0
  5. package/dist/browser/BrowserPayloadHasher.d.ts +9 -0
  6. package/dist/browser/BrowserPayloadHasher.d.ts.map +1 -0
  7. package/dist/browser/NodePayloadHasher.d.cts +5 -0
  8. package/dist/browser/NodePayloadHasher.d.cts.map +1 -0
  9. package/dist/browser/NodePayloadHasher.d.mts +5 -0
  10. package/dist/browser/NodePayloadHasher.d.mts.map +1 -0
  11. package/dist/browser/NodePayloadHasher.d.ts +5 -0
  12. package/dist/browser/NodePayloadHasher.d.ts.map +1 -0
  13. package/dist/browser/PayloadHasher.d.cts +14 -10
  14. package/dist/browser/PayloadHasher.d.cts.map +1 -1
  15. package/dist/browser/PayloadHasher.d.mts +14 -10
  16. package/dist/browser/PayloadHasher.d.mts.map +1 -1
  17. package/dist/browser/PayloadHasher.d.ts +14 -10
  18. package/dist/browser/PayloadHasher.d.ts.map +1 -1
  19. package/dist/browser/createBrowserWorker.d.cts +2 -0
  20. package/dist/browser/createBrowserWorker.d.cts.map +1 -0
  21. package/dist/browser/createBrowserWorker.d.mts +2 -0
  22. package/dist/browser/createBrowserWorker.d.mts.map +1 -0
  23. package/dist/browser/createBrowserWorker.d.ts +2 -0
  24. package/dist/browser/createBrowserWorker.d.ts.map +1 -0
  25. package/dist/browser/createNodeWorker.d.cts +2 -0
  26. package/dist/browser/createNodeWorker.d.cts.map +1 -0
  27. package/dist/browser/createNodeWorker.d.mts +2 -0
  28. package/dist/browser/createNodeWorker.d.mts.map +1 -0
  29. package/dist/browser/createNodeWorker.d.ts +2 -0
  30. package/dist/browser/createNodeWorker.d.ts.map +1 -0
  31. package/dist/browser/index-browser.cjs +99 -107
  32. package/dist/browser/index-browser.cjs.map +1 -1
  33. package/dist/browser/index-browser.d.cts +1 -1
  34. package/dist/browser/index-browser.d.cts.map +1 -1
  35. package/dist/browser/index-browser.d.mts +1 -1
  36. package/dist/browser/index-browser.d.mts.map +1 -1
  37. package/dist/browser/index-browser.d.ts +1 -1
  38. package/dist/browser/index-browser.d.ts.map +1 -1
  39. package/dist/browser/index-browser.js +98 -106
  40. package/dist/browser/index-browser.js.map +1 -1
  41. package/dist/browser/index.d.cts +1 -1
  42. package/dist/browser/index.d.cts.map +1 -1
  43. package/dist/browser/index.d.mts +1 -1
  44. package/dist/browser/index.d.mts.map +1 -1
  45. package/dist/browser/index.d.ts +1 -1
  46. package/dist/browser/index.d.ts.map +1 -1
  47. package/dist/browser/worker/index.cjs +3 -3
  48. package/dist/browser/worker/index.cjs.map +1 -1
  49. package/dist/browser/worker/index.d.cts +3 -3
  50. package/dist/browser/worker/index.d.cts.map +1 -1
  51. package/dist/browser/worker/index.d.mts +3 -3
  52. package/dist/browser/worker/index.d.mts.map +1 -1
  53. package/dist/browser/worker/index.d.ts +3 -3
  54. package/dist/browser/worker/index.d.ts.map +1 -1
  55. package/dist/browser/worker/index.js +3 -3
  56. package/dist/browser/worker/index.js.map +1 -1
  57. package/dist/browser/worker/jsHash-bundle.js +3322 -0
  58. package/dist/browser/worker/jsHash.cjs +17 -20
  59. package/dist/browser/worker/jsHash.cjs.map +1 -1
  60. package/dist/browser/worker/jsHash.d.cts +1 -1
  61. package/dist/browser/worker/jsHash.d.cts.map +1 -1
  62. package/dist/browser/worker/jsHash.d.mts +1 -1
  63. package/dist/browser/worker/jsHash.d.mts.map +1 -1
  64. package/dist/browser/worker/jsHash.d.ts +1 -1
  65. package/dist/browser/worker/jsHash.d.ts.map +1 -1
  66. package/dist/browser/worker/jsHash.js +8 -23
  67. package/dist/browser/worker/jsHash.js.map +1 -1
  68. package/dist/browser/worker/jsHashNode.cjs +37 -0
  69. package/dist/browser/worker/jsHashNode.cjs.map +1 -0
  70. package/dist/browser/worker/jsHashNode.d.cts +2 -0
  71. package/dist/browser/worker/jsHashNode.d.cts.map +1 -0
  72. package/dist/browser/worker/jsHashNode.d.mts +2 -0
  73. package/dist/browser/worker/jsHashNode.d.mts.map +1 -0
  74. package/dist/browser/worker/jsHashNode.d.ts +2 -0
  75. package/dist/browser/worker/jsHashNode.d.ts.map +1 -0
  76. package/dist/browser/worker/jsHashNode.js +25 -0
  77. package/dist/browser/worker/jsHashNode.js.map +1 -0
  78. package/dist/browser/worker/subtleHash-bundle.js +455 -0
  79. package/dist/browser/worker/subtleHash.cjs +6 -31
  80. package/dist/browser/worker/subtleHash.cjs.map +1 -1
  81. package/dist/browser/worker/subtleHash.d.cts +1 -1
  82. package/dist/browser/worker/subtleHash.d.cts.map +1 -1
  83. package/dist/browser/worker/subtleHash.d.mts +1 -1
  84. package/dist/browser/worker/subtleHash.d.mts.map +1 -1
  85. package/dist/browser/worker/subtleHash.d.ts +1 -1
  86. package/dist/browser/worker/subtleHash.d.ts.map +1 -1
  87. package/dist/browser/worker/subtleHash.js +7 -22
  88. package/dist/browser/worker/subtleHash.js.map +1 -1
  89. package/dist/browser/worker/subtleHashNode.cjs +36 -0
  90. package/dist/browser/worker/subtleHashNode.cjs.map +1 -0
  91. package/dist/browser/worker/subtleHashNode.d.cts +2 -0
  92. package/dist/browser/worker/subtleHashNode.d.cts.map +1 -0
  93. package/dist/browser/worker/subtleHashNode.d.mts +2 -0
  94. package/dist/browser/worker/subtleHashNode.d.mts.map +1 -0
  95. package/dist/browser/worker/subtleHashNode.d.ts +2 -0
  96. package/dist/browser/worker/subtleHashNode.d.ts.map +1 -0
  97. package/dist/browser/worker/subtleHashNode.js +24 -0
  98. package/dist/browser/worker/subtleHashNode.js.map +1 -0
  99. package/dist/browser/worker/wasmHash-bundle.js +893 -0
  100. package/dist/browser/worker/wasmHash.cjs +7 -32
  101. package/dist/browser/worker/wasmHash.cjs.map +1 -1
  102. package/dist/browser/worker/wasmHash.d.cts +1 -1
  103. package/dist/browser/worker/wasmHash.d.cts.map +1 -1
  104. package/dist/browser/worker/wasmHash.d.mts +1 -1
  105. package/dist/browser/worker/wasmHash.d.mts.map +1 -1
  106. package/dist/browser/worker/wasmHash.d.ts +1 -1
  107. package/dist/browser/worker/wasmHash.d.ts.map +1 -1
  108. package/dist/browser/worker/wasmHash.js +8 -23
  109. package/dist/browser/worker/wasmHash.js.map +1 -1
  110. package/dist/browser/worker/wasmHashNode.cjs +37 -0
  111. package/dist/browser/worker/wasmHashNode.cjs.map +1 -0
  112. package/dist/browser/worker/wasmHashNode.d.cts +2 -0
  113. package/dist/browser/worker/wasmHashNode.d.cts.map +1 -0
  114. package/dist/browser/worker/wasmHashNode.d.mts +2 -0
  115. package/dist/browser/worker/wasmHashNode.d.mts.map +1 -0
  116. package/dist/browser/worker/wasmHashNode.d.ts +2 -0
  117. package/dist/browser/worker/wasmHashNode.d.ts.map +1 -0
  118. package/dist/browser/worker/wasmHashNode.js +25 -0
  119. package/dist/browser/worker/wasmHashNode.js.map +1 -0
  120. package/dist/node/BrowserPayloadHasher.d.cts +9 -0
  121. package/dist/node/BrowserPayloadHasher.d.cts.map +1 -0
  122. package/dist/node/BrowserPayloadHasher.d.mts +9 -0
  123. package/dist/node/BrowserPayloadHasher.d.mts.map +1 -0
  124. package/dist/node/BrowserPayloadHasher.d.ts +9 -0
  125. package/dist/node/BrowserPayloadHasher.d.ts.map +1 -0
  126. package/dist/node/NodePayloadHasher.d.cts +5 -0
  127. package/dist/node/NodePayloadHasher.d.cts.map +1 -0
  128. package/dist/node/NodePayloadHasher.d.mts +5 -0
  129. package/dist/node/NodePayloadHasher.d.mts.map +1 -0
  130. package/dist/node/NodePayloadHasher.d.ts +5 -0
  131. package/dist/node/NodePayloadHasher.d.ts.map +1 -0
  132. package/dist/node/PayloadHasher.d.cts +14 -10
  133. package/dist/node/PayloadHasher.d.cts.map +1 -1
  134. package/dist/node/PayloadHasher.d.mts +14 -10
  135. package/dist/node/PayloadHasher.d.mts.map +1 -1
  136. package/dist/node/PayloadHasher.d.ts +14 -10
  137. package/dist/node/PayloadHasher.d.ts.map +1 -1
  138. package/dist/node/createBrowserWorker.d.cts +2 -0
  139. package/dist/node/createBrowserWorker.d.cts.map +1 -0
  140. package/dist/node/createBrowserWorker.d.mts +2 -0
  141. package/dist/node/createBrowserWorker.d.mts.map +1 -0
  142. package/dist/node/createBrowserWorker.d.ts +2 -0
  143. package/dist/node/createBrowserWorker.d.ts.map +1 -0
  144. package/dist/node/createNodeWorker.d.cts +2 -0
  145. package/dist/node/createNodeWorker.d.cts.map +1 -0
  146. package/dist/node/createNodeWorker.d.mts +2 -0
  147. package/dist/node/createNodeWorker.d.mts.map +1 -0
  148. package/dist/node/createNodeWorker.d.ts +2 -0
  149. package/dist/node/createNodeWorker.d.ts.map +1 -0
  150. package/dist/node/index-browser.d.cts +1 -1
  151. package/dist/node/index-browser.d.cts.map +1 -1
  152. package/dist/node/index-browser.d.mts +1 -1
  153. package/dist/node/index-browser.d.mts.map +1 -1
  154. package/dist/node/index-browser.d.ts +1 -1
  155. package/dist/node/index-browser.d.ts.map +1 -1
  156. package/dist/node/index.cjs +63 -89
  157. package/dist/node/index.cjs.map +1 -1
  158. package/dist/node/index.d.cts +1 -1
  159. package/dist/node/index.d.cts.map +1 -1
  160. package/dist/node/index.d.mts +1 -1
  161. package/dist/node/index.d.mts.map +1 -1
  162. package/dist/node/index.d.ts +1 -1
  163. package/dist/node/index.d.ts.map +1 -1
  164. package/dist/node/index.js +63 -89
  165. package/dist/node/index.js.map +1 -1
  166. package/dist/node/worker/index.cjs +3 -3
  167. package/dist/node/worker/index.cjs.map +1 -1
  168. package/dist/node/worker/index.d.cts +3 -3
  169. package/dist/node/worker/index.d.cts.map +1 -1
  170. package/dist/node/worker/index.d.mts +3 -3
  171. package/dist/node/worker/index.d.mts.map +1 -1
  172. package/dist/node/worker/index.d.ts +3 -3
  173. package/dist/node/worker/index.d.ts.map +1 -1
  174. package/dist/node/worker/index.js +3 -3
  175. package/dist/node/worker/index.js.map +1 -1
  176. package/dist/node/worker/jsHash.cjs +17 -24
  177. package/dist/node/worker/jsHash.cjs.map +1 -1
  178. package/dist/node/worker/jsHash.d.cts +1 -1
  179. package/dist/node/worker/jsHash.d.cts.map +1 -1
  180. package/dist/node/worker/jsHash.d.mts +1 -1
  181. package/dist/node/worker/jsHash.d.mts.map +1 -1
  182. package/dist/node/worker/jsHash.d.ts +1 -1
  183. package/dist/node/worker/jsHash.d.ts.map +1 -1
  184. package/dist/node/worker/jsHash.js +8 -23
  185. package/dist/node/worker/jsHash.js.map +1 -1
  186. package/dist/node/worker/jsHashNode.cjs +41 -0
  187. package/dist/node/worker/jsHashNode.cjs.map +1 -0
  188. package/dist/node/worker/jsHashNode.d.cts +2 -0
  189. package/dist/node/worker/jsHashNode.d.cts.map +1 -0
  190. package/dist/node/worker/jsHashNode.d.mts +2 -0
  191. package/dist/node/worker/jsHashNode.d.mts.map +1 -0
  192. package/dist/node/worker/jsHashNode.d.ts +2 -0
  193. package/dist/node/worker/jsHashNode.d.ts.map +1 -0
  194. package/dist/node/worker/jsHashNode.js +25 -0
  195. package/dist/node/worker/jsHashNode.js.map +1 -0
  196. package/dist/node/worker/subtleHash.cjs +6 -35
  197. package/dist/node/worker/subtleHash.cjs.map +1 -1
  198. package/dist/node/worker/subtleHash.d.cts +1 -1
  199. package/dist/node/worker/subtleHash.d.cts.map +1 -1
  200. package/dist/node/worker/subtleHash.d.mts +1 -1
  201. package/dist/node/worker/subtleHash.d.mts.map +1 -1
  202. package/dist/node/worker/subtleHash.d.ts +1 -1
  203. package/dist/node/worker/subtleHash.d.ts.map +1 -1
  204. package/dist/node/worker/subtleHash.js +7 -22
  205. package/dist/node/worker/subtleHash.js.map +1 -1
  206. package/dist/node/worker/subtleHashNode.cjs +40 -0
  207. package/dist/node/worker/subtleHashNode.cjs.map +1 -0
  208. package/dist/node/worker/subtleHashNode.d.cts +2 -0
  209. package/dist/node/worker/subtleHashNode.d.cts.map +1 -0
  210. package/dist/node/worker/subtleHashNode.d.mts +2 -0
  211. package/dist/node/worker/subtleHashNode.d.mts.map +1 -0
  212. package/dist/node/worker/subtleHashNode.d.ts +2 -0
  213. package/dist/node/worker/subtleHashNode.d.ts.map +1 -0
  214. package/dist/node/worker/subtleHashNode.js +24 -0
  215. package/dist/node/worker/subtleHashNode.js.map +1 -0
  216. package/dist/node/worker/wasmHash.cjs +7 -36
  217. package/dist/node/worker/wasmHash.cjs.map +1 -1
  218. package/dist/node/worker/wasmHash.d.cts +1 -1
  219. package/dist/node/worker/wasmHash.d.cts.map +1 -1
  220. package/dist/node/worker/wasmHash.d.mts +1 -1
  221. package/dist/node/worker/wasmHash.d.mts.map +1 -1
  222. package/dist/node/worker/wasmHash.d.ts +1 -1
  223. package/dist/node/worker/wasmHash.d.ts.map +1 -1
  224. package/dist/node/worker/wasmHash.js +8 -23
  225. package/dist/node/worker/wasmHash.js.map +1 -1
  226. package/dist/node/worker/wasmHashNode.cjs +41 -0
  227. package/dist/node/worker/wasmHashNode.cjs.map +1 -0
  228. package/dist/node/worker/wasmHashNode.d.cts +2 -0
  229. package/dist/node/worker/wasmHashNode.d.cts.map +1 -0
  230. package/dist/node/worker/wasmHashNode.d.mts +2 -0
  231. package/dist/node/worker/wasmHashNode.d.mts.map +1 -0
  232. package/dist/node/worker/wasmHashNode.d.ts +2 -0
  233. package/dist/node/worker/wasmHashNode.d.ts.map +1 -0
  234. package/dist/node/worker/wasmHashNode.js +25 -0
  235. package/dist/node/worker/wasmHashNode.js.map +1 -0
  236. package/package.json +17 -10
  237. package/src/BrowserPayloadHasher.ts +34 -0
  238. package/src/NodePayloadHasher.ts +8 -0
  239. package/src/PayloadHasher.ts +40 -82
  240. package/src/createBrowserWorker.ts +10 -0
  241. package/src/createNodeWorker.ts +15 -0
  242. package/src/index-browser.ts +1 -1
  243. package/src/index.ts +1 -1
  244. package/src/worker/index.ts +3 -3
  245. package/src/worker/jsHash.ts +9 -12
  246. package/src/worker/jsHashNode.ts +13 -0
  247. package/src/worker/subtleHash.ts +8 -11
  248. package/src/worker/subtleHashNode.ts +12 -0
  249. package/src/worker/wasmHash.ts +9 -12
  250. package/src/worker/wasmHashNode.ts +13 -0
  251. package/dist/browser/PayloadHasher-browser.d.cts +0 -69
  252. package/dist/browser/PayloadHasher-browser.d.cts.map +0 -1
  253. package/dist/browser/PayloadHasher-browser.d.mts +0 -69
  254. package/dist/browser/PayloadHasher-browser.d.mts.map +0 -1
  255. package/dist/browser/PayloadHasher-browser.d.ts +0 -69
  256. package/dist/browser/PayloadHasher-browser.d.ts.map +0 -1
  257. package/dist/node/PayloadHasher-browser.d.cts +0 -69
  258. package/dist/node/PayloadHasher-browser.d.cts.map +0 -1
  259. package/dist/node/PayloadHasher-browser.d.mts +0 -69
  260. package/dist/node/PayloadHasher-browser.d.mts.map +0 -1
  261. package/dist/node/PayloadHasher-browser.d.ts +0 -69
  262. package/dist/node/PayloadHasher-browser.d.ts.map +0 -1
  263. package/src/PayloadHasher-browser.ts +0 -248
@@ -0,0 +1,3322 @@
1
+ "use strict";
2
+ (() => {
3
+ var __create = Object.create;
4
+ var __defProp = Object.defineProperty;
5
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
6
+ var __getOwnPropNames = Object.getOwnPropertyNames;
7
+ var __getProtoOf = Object.getPrototypeOf;
8
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
9
+ var __commonJS = (cb, mod) => function __require() {
10
+ return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
11
+ };
12
+ var __copyProps = (to, from, except, desc) => {
13
+ if (from && typeof from === "object" || typeof from === "function") {
14
+ for (let key of __getOwnPropNames(from))
15
+ if (!__hasOwnProp.call(to, key) && key !== except)
16
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
+ }
18
+ return to;
19
+ };
20
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
+ // If the importer is in node compatibility mode or this is not an ESM
22
+ // file that has been converted to a CommonJS file using a Babel-
23
+ // compatible transform (i.e. "__esModule" has not been set), then set
24
+ // "default" to the CommonJS "module.exports" for node compatibility.
25
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
+ mod
27
+ ));
28
+
29
+ // ../../../../../../node_modules/inherits/inherits_browser.js
30
+ var require_inherits_browser = __commonJS({
31
+ "../../../../../../node_modules/inherits/inherits_browser.js"(exports, module) {
32
+ if (typeof Object.create === "function") {
33
+ module.exports = function inherits(ctor, superCtor) {
34
+ if (superCtor) {
35
+ ctor.super_ = superCtor;
36
+ ctor.prototype = Object.create(superCtor.prototype, {
37
+ constructor: {
38
+ value: ctor,
39
+ enumerable: false,
40
+ writable: true,
41
+ configurable: true
42
+ }
43
+ });
44
+ }
45
+ };
46
+ } else {
47
+ module.exports = function inherits(ctor, superCtor) {
48
+ if (superCtor) {
49
+ ctor.super_ = superCtor;
50
+ var TempCtor = function() {
51
+ };
52
+ TempCtor.prototype = superCtor.prototype;
53
+ ctor.prototype = new TempCtor();
54
+ ctor.prototype.constructor = ctor;
55
+ }
56
+ };
57
+ }
58
+ }
59
+ });
60
+
61
+ // ../../../../../../node_modules/base64-js/index.js
62
+ var require_base64_js = __commonJS({
63
+ "../../../../../../node_modules/base64-js/index.js"(exports) {
64
+ "use strict";
65
+ exports.byteLength = byteLength;
66
+ exports.toByteArray = toByteArray;
67
+ exports.fromByteArray = fromByteArray;
68
+ var lookup = [];
69
+ var revLookup = [];
70
+ var Arr = typeof Uint8Array !== "undefined" ? Uint8Array : Array;
71
+ var code = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
72
+ for (i = 0, len = code.length; i < len; ++i) {
73
+ lookup[i] = code[i];
74
+ revLookup[code.charCodeAt(i)] = i;
75
+ }
76
+ var i;
77
+ var len;
78
+ revLookup["-".charCodeAt(0)] = 62;
79
+ revLookup["_".charCodeAt(0)] = 63;
80
+ function getLens(b64) {
81
+ var len2 = b64.length;
82
+ if (len2 % 4 > 0) {
83
+ throw new Error("Invalid string. Length must be a multiple of 4");
84
+ }
85
+ var validLen = b64.indexOf("=");
86
+ if (validLen === -1)
87
+ validLen = len2;
88
+ var placeHoldersLen = validLen === len2 ? 0 : 4 - validLen % 4;
89
+ return [validLen, placeHoldersLen];
90
+ }
91
+ function byteLength(b64) {
92
+ var lens = getLens(b64);
93
+ var validLen = lens[0];
94
+ var placeHoldersLen = lens[1];
95
+ return (validLen + placeHoldersLen) * 3 / 4 - placeHoldersLen;
96
+ }
97
+ function _byteLength(b64, validLen, placeHoldersLen) {
98
+ return (validLen + placeHoldersLen) * 3 / 4 - placeHoldersLen;
99
+ }
100
+ function toByteArray(b64) {
101
+ var tmp;
102
+ var lens = getLens(b64);
103
+ var validLen = lens[0];
104
+ var placeHoldersLen = lens[1];
105
+ var arr = new Arr(_byteLength(b64, validLen, placeHoldersLen));
106
+ var curByte = 0;
107
+ var len2 = placeHoldersLen > 0 ? validLen - 4 : validLen;
108
+ var i2;
109
+ for (i2 = 0; i2 < len2; i2 += 4) {
110
+ tmp = revLookup[b64.charCodeAt(i2)] << 18 | revLookup[b64.charCodeAt(i2 + 1)] << 12 | revLookup[b64.charCodeAt(i2 + 2)] << 6 | revLookup[b64.charCodeAt(i2 + 3)];
111
+ arr[curByte++] = tmp >> 16 & 255;
112
+ arr[curByte++] = tmp >> 8 & 255;
113
+ arr[curByte++] = tmp & 255;
114
+ }
115
+ if (placeHoldersLen === 2) {
116
+ tmp = revLookup[b64.charCodeAt(i2)] << 2 | revLookup[b64.charCodeAt(i2 + 1)] >> 4;
117
+ arr[curByte++] = tmp & 255;
118
+ }
119
+ if (placeHoldersLen === 1) {
120
+ tmp = revLookup[b64.charCodeAt(i2)] << 10 | revLookup[b64.charCodeAt(i2 + 1)] << 4 | revLookup[b64.charCodeAt(i2 + 2)] >> 2;
121
+ arr[curByte++] = tmp >> 8 & 255;
122
+ arr[curByte++] = tmp & 255;
123
+ }
124
+ return arr;
125
+ }
126
+ function tripletToBase64(num) {
127
+ return lookup[num >> 18 & 63] + lookup[num >> 12 & 63] + lookup[num >> 6 & 63] + lookup[num & 63];
128
+ }
129
+ function encodeChunk(uint8, start, end) {
130
+ var tmp;
131
+ var output = [];
132
+ for (var i2 = start; i2 < end; i2 += 3) {
133
+ tmp = (uint8[i2] << 16 & 16711680) + (uint8[i2 + 1] << 8 & 65280) + (uint8[i2 + 2] & 255);
134
+ output.push(tripletToBase64(tmp));
135
+ }
136
+ return output.join("");
137
+ }
138
+ function fromByteArray(uint8) {
139
+ var tmp;
140
+ var len2 = uint8.length;
141
+ var extraBytes = len2 % 3;
142
+ var parts = [];
143
+ var maxChunkLength = 16383;
144
+ for (var i2 = 0, len22 = len2 - extraBytes; i2 < len22; i2 += maxChunkLength) {
145
+ parts.push(encodeChunk(uint8, i2, i2 + maxChunkLength > len22 ? len22 : i2 + maxChunkLength));
146
+ }
147
+ if (extraBytes === 1) {
148
+ tmp = uint8[len2 - 1];
149
+ parts.push(
150
+ lookup[tmp >> 2] + lookup[tmp << 4 & 63] + "=="
151
+ );
152
+ } else if (extraBytes === 2) {
153
+ tmp = (uint8[len2 - 2] << 8) + uint8[len2 - 1];
154
+ parts.push(
155
+ lookup[tmp >> 10] + lookup[tmp >> 4 & 63] + lookup[tmp << 2 & 63] + "="
156
+ );
157
+ }
158
+ return parts.join("");
159
+ }
160
+ }
161
+ });
162
+
163
+ // ../../../../../../node_modules/ieee754/index.js
164
+ var require_ieee754 = __commonJS({
165
+ "../../../../../../node_modules/ieee754/index.js"(exports) {
166
+ exports.read = function(buffer, offset, isLE, mLen, nBytes) {
167
+ var e, m;
168
+ var eLen = nBytes * 8 - mLen - 1;
169
+ var eMax = (1 << eLen) - 1;
170
+ var eBias = eMax >> 1;
171
+ var nBits = -7;
172
+ var i = isLE ? nBytes - 1 : 0;
173
+ var d = isLE ? -1 : 1;
174
+ var s = buffer[offset + i];
175
+ i += d;
176
+ e = s & (1 << -nBits) - 1;
177
+ s >>= -nBits;
178
+ nBits += eLen;
179
+ for (; nBits > 0; e = e * 256 + buffer[offset + i], i += d, nBits -= 8) {
180
+ }
181
+ m = e & (1 << -nBits) - 1;
182
+ e >>= -nBits;
183
+ nBits += mLen;
184
+ for (; nBits > 0; m = m * 256 + buffer[offset + i], i += d, nBits -= 8) {
185
+ }
186
+ if (e === 0) {
187
+ e = 1 - eBias;
188
+ } else if (e === eMax) {
189
+ return m ? NaN : (s ? -1 : 1) * Infinity;
190
+ } else {
191
+ m = m + Math.pow(2, mLen);
192
+ e = e - eBias;
193
+ }
194
+ return (s ? -1 : 1) * m * Math.pow(2, e - mLen);
195
+ };
196
+ exports.write = function(buffer, value, offset, isLE, mLen, nBytes) {
197
+ var e, m, c;
198
+ var eLen = nBytes * 8 - mLen - 1;
199
+ var eMax = (1 << eLen) - 1;
200
+ var eBias = eMax >> 1;
201
+ var rt = mLen === 23 ? Math.pow(2, -24) - Math.pow(2, -77) : 0;
202
+ var i = isLE ? 0 : nBytes - 1;
203
+ var d = isLE ? 1 : -1;
204
+ var s = value < 0 || value === 0 && 1 / value < 0 ? 1 : 0;
205
+ value = Math.abs(value);
206
+ if (isNaN(value) || value === Infinity) {
207
+ m = isNaN(value) ? 1 : 0;
208
+ e = eMax;
209
+ } else {
210
+ e = Math.floor(Math.log(value) / Math.LN2);
211
+ if (value * (c = Math.pow(2, -e)) < 1) {
212
+ e--;
213
+ c *= 2;
214
+ }
215
+ if (e + eBias >= 1) {
216
+ value += rt / c;
217
+ } else {
218
+ value += rt * Math.pow(2, 1 - eBias);
219
+ }
220
+ if (value * c >= 2) {
221
+ e++;
222
+ c /= 2;
223
+ }
224
+ if (e + eBias >= eMax) {
225
+ m = 0;
226
+ e = eMax;
227
+ } else if (e + eBias >= 1) {
228
+ m = (value * c - 1) * Math.pow(2, mLen);
229
+ e = e + eBias;
230
+ } else {
231
+ m = value * Math.pow(2, eBias - 1) * Math.pow(2, mLen);
232
+ e = 0;
233
+ }
234
+ }
235
+ for (; mLen >= 8; buffer[offset + i] = m & 255, i += d, m /= 256, mLen -= 8) {
236
+ }
237
+ e = e << mLen | m;
238
+ eLen += mLen;
239
+ for (; eLen > 0; buffer[offset + i] = e & 255, i += d, e /= 256, eLen -= 8) {
240
+ }
241
+ buffer[offset + i - d] |= s * 128;
242
+ };
243
+ }
244
+ });
245
+
246
+ // ../../../../../../node_modules/buffer/index.js
247
+ var require_buffer = __commonJS({
248
+ "../../../../../../node_modules/buffer/index.js"(exports) {
249
+ "use strict";
250
+ var base64 = require_base64_js();
251
+ var ieee754 = require_ieee754();
252
+ var customInspectSymbol = typeof Symbol === "function" && typeof Symbol["for"] === "function" ? Symbol["for"]("nodejs.util.inspect.custom") : null;
253
+ exports.Buffer = Buffer2;
254
+ exports.SlowBuffer = SlowBuffer;
255
+ exports.INSPECT_MAX_BYTES = 50;
256
+ var K_MAX_LENGTH = 2147483647;
257
+ exports.kMaxLength = K_MAX_LENGTH;
258
+ Buffer2.TYPED_ARRAY_SUPPORT = typedArraySupport();
259
+ if (!Buffer2.TYPED_ARRAY_SUPPORT && typeof console !== "undefined" && typeof console.error === "function") {
260
+ console.error(
261
+ "This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support."
262
+ );
263
+ }
264
+ function typedArraySupport() {
265
+ try {
266
+ const arr = new Uint8Array(1);
267
+ const proto = { foo: function() {
268
+ return 42;
269
+ } };
270
+ Object.setPrototypeOf(proto, Uint8Array.prototype);
271
+ Object.setPrototypeOf(arr, proto);
272
+ return arr.foo() === 42;
273
+ } catch (e) {
274
+ return false;
275
+ }
276
+ }
277
+ Object.defineProperty(Buffer2.prototype, "parent", {
278
+ enumerable: true,
279
+ get: function() {
280
+ if (!Buffer2.isBuffer(this))
281
+ return void 0;
282
+ return this.buffer;
283
+ }
284
+ });
285
+ Object.defineProperty(Buffer2.prototype, "offset", {
286
+ enumerable: true,
287
+ get: function() {
288
+ if (!Buffer2.isBuffer(this))
289
+ return void 0;
290
+ return this.byteOffset;
291
+ }
292
+ });
293
+ function createBuffer(length) {
294
+ if (length > K_MAX_LENGTH) {
295
+ throw new RangeError('The value "' + length + '" is invalid for option "size"');
296
+ }
297
+ const buf = new Uint8Array(length);
298
+ Object.setPrototypeOf(buf, Buffer2.prototype);
299
+ return buf;
300
+ }
301
+ function Buffer2(arg, encodingOrOffset, length) {
302
+ if (typeof arg === "number") {
303
+ if (typeof encodingOrOffset === "string") {
304
+ throw new TypeError(
305
+ 'The "string" argument must be of type string. Received type number'
306
+ );
307
+ }
308
+ return allocUnsafe(arg);
309
+ }
310
+ return from(arg, encodingOrOffset, length);
311
+ }
312
+ Buffer2.poolSize = 8192;
313
+ function from(value, encodingOrOffset, length) {
314
+ if (typeof value === "string") {
315
+ return fromString(value, encodingOrOffset);
316
+ }
317
+ if (ArrayBuffer.isView(value)) {
318
+ return fromArrayView(value);
319
+ }
320
+ if (value == null) {
321
+ throw new TypeError(
322
+ "The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type " + typeof value
323
+ );
324
+ }
325
+ if (isInstance(value, ArrayBuffer) || value && isInstance(value.buffer, ArrayBuffer)) {
326
+ return fromArrayBuffer(value, encodingOrOffset, length);
327
+ }
328
+ if (typeof SharedArrayBuffer !== "undefined" && (isInstance(value, SharedArrayBuffer) || value && isInstance(value.buffer, SharedArrayBuffer))) {
329
+ return fromArrayBuffer(value, encodingOrOffset, length);
330
+ }
331
+ if (typeof value === "number") {
332
+ throw new TypeError(
333
+ 'The "value" argument must not be of type number. Received type number'
334
+ );
335
+ }
336
+ const valueOf = value.valueOf && value.valueOf();
337
+ if (valueOf != null && valueOf !== value) {
338
+ return Buffer2.from(valueOf, encodingOrOffset, length);
339
+ }
340
+ const b = fromObject(value);
341
+ if (b)
342
+ return b;
343
+ if (typeof Symbol !== "undefined" && Symbol.toPrimitive != null && typeof value[Symbol.toPrimitive] === "function") {
344
+ return Buffer2.from(value[Symbol.toPrimitive]("string"), encodingOrOffset, length);
345
+ }
346
+ throw new TypeError(
347
+ "The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type " + typeof value
348
+ );
349
+ }
350
+ Buffer2.from = function(value, encodingOrOffset, length) {
351
+ return from(value, encodingOrOffset, length);
352
+ };
353
+ Object.setPrototypeOf(Buffer2.prototype, Uint8Array.prototype);
354
+ Object.setPrototypeOf(Buffer2, Uint8Array);
355
+ function assertSize(size) {
356
+ if (typeof size !== "number") {
357
+ throw new TypeError('"size" argument must be of type number');
358
+ } else if (size < 0) {
359
+ throw new RangeError('The value "' + size + '" is invalid for option "size"');
360
+ }
361
+ }
362
+ function alloc(size, fill, encoding) {
363
+ assertSize(size);
364
+ if (size <= 0) {
365
+ return createBuffer(size);
366
+ }
367
+ if (fill !== void 0) {
368
+ return typeof encoding === "string" ? createBuffer(size).fill(fill, encoding) : createBuffer(size).fill(fill);
369
+ }
370
+ return createBuffer(size);
371
+ }
372
+ Buffer2.alloc = function(size, fill, encoding) {
373
+ return alloc(size, fill, encoding);
374
+ };
375
+ function allocUnsafe(size) {
376
+ assertSize(size);
377
+ return createBuffer(size < 0 ? 0 : checked(size) | 0);
378
+ }
379
+ Buffer2.allocUnsafe = function(size) {
380
+ return allocUnsafe(size);
381
+ };
382
+ Buffer2.allocUnsafeSlow = function(size) {
383
+ return allocUnsafe(size);
384
+ };
385
+ function fromString(string, encoding) {
386
+ if (typeof encoding !== "string" || encoding === "") {
387
+ encoding = "utf8";
388
+ }
389
+ if (!Buffer2.isEncoding(encoding)) {
390
+ throw new TypeError("Unknown encoding: " + encoding);
391
+ }
392
+ const length = byteLength(string, encoding) | 0;
393
+ let buf = createBuffer(length);
394
+ const actual = buf.write(string, encoding);
395
+ if (actual !== length) {
396
+ buf = buf.slice(0, actual);
397
+ }
398
+ return buf;
399
+ }
400
+ function fromArrayLike(array) {
401
+ const length = array.length < 0 ? 0 : checked(array.length) | 0;
402
+ const buf = createBuffer(length);
403
+ for (let i = 0; i < length; i += 1) {
404
+ buf[i] = array[i] & 255;
405
+ }
406
+ return buf;
407
+ }
408
+ function fromArrayView(arrayView) {
409
+ if (isInstance(arrayView, Uint8Array)) {
410
+ const copy = new Uint8Array(arrayView);
411
+ return fromArrayBuffer(copy.buffer, copy.byteOffset, copy.byteLength);
412
+ }
413
+ return fromArrayLike(arrayView);
414
+ }
415
+ function fromArrayBuffer(array, byteOffset, length) {
416
+ if (byteOffset < 0 || array.byteLength < byteOffset) {
417
+ throw new RangeError('"offset" is outside of buffer bounds');
418
+ }
419
+ if (array.byteLength < byteOffset + (length || 0)) {
420
+ throw new RangeError('"length" is outside of buffer bounds');
421
+ }
422
+ let buf;
423
+ if (byteOffset === void 0 && length === void 0) {
424
+ buf = new Uint8Array(array);
425
+ } else if (length === void 0) {
426
+ buf = new Uint8Array(array, byteOffset);
427
+ } else {
428
+ buf = new Uint8Array(array, byteOffset, length);
429
+ }
430
+ Object.setPrototypeOf(buf, Buffer2.prototype);
431
+ return buf;
432
+ }
433
+ function fromObject(obj) {
434
+ if (Buffer2.isBuffer(obj)) {
435
+ const len = checked(obj.length) | 0;
436
+ const buf = createBuffer(len);
437
+ if (buf.length === 0) {
438
+ return buf;
439
+ }
440
+ obj.copy(buf, 0, 0, len);
441
+ return buf;
442
+ }
443
+ if (obj.length !== void 0) {
444
+ if (typeof obj.length !== "number" || numberIsNaN(obj.length)) {
445
+ return createBuffer(0);
446
+ }
447
+ return fromArrayLike(obj);
448
+ }
449
+ if (obj.type === "Buffer" && Array.isArray(obj.data)) {
450
+ return fromArrayLike(obj.data);
451
+ }
452
+ }
453
+ function checked(length) {
454
+ if (length >= K_MAX_LENGTH) {
455
+ throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x" + K_MAX_LENGTH.toString(16) + " bytes");
456
+ }
457
+ return length | 0;
458
+ }
459
+ function SlowBuffer(length) {
460
+ if (+length != length) {
461
+ length = 0;
462
+ }
463
+ return Buffer2.alloc(+length);
464
+ }
465
+ Buffer2.isBuffer = function isBuffer(b) {
466
+ return b != null && b._isBuffer === true && b !== Buffer2.prototype;
467
+ };
468
+ Buffer2.compare = function compare(a, b) {
469
+ if (isInstance(a, Uint8Array))
470
+ a = Buffer2.from(a, a.offset, a.byteLength);
471
+ if (isInstance(b, Uint8Array))
472
+ b = Buffer2.from(b, b.offset, b.byteLength);
473
+ if (!Buffer2.isBuffer(a) || !Buffer2.isBuffer(b)) {
474
+ throw new TypeError(
475
+ 'The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array'
476
+ );
477
+ }
478
+ if (a === b)
479
+ return 0;
480
+ let x = a.length;
481
+ let y = b.length;
482
+ for (let i = 0, len = Math.min(x, y); i < len; ++i) {
483
+ if (a[i] !== b[i]) {
484
+ x = a[i];
485
+ y = b[i];
486
+ break;
487
+ }
488
+ }
489
+ if (x < y)
490
+ return -1;
491
+ if (y < x)
492
+ return 1;
493
+ return 0;
494
+ };
495
+ Buffer2.isEncoding = function isEncoding(encoding) {
496
+ switch (String(encoding).toLowerCase()) {
497
+ case "hex":
498
+ case "utf8":
499
+ case "utf-8":
500
+ case "ascii":
501
+ case "latin1":
502
+ case "binary":
503
+ case "base64":
504
+ case "ucs2":
505
+ case "ucs-2":
506
+ case "utf16le":
507
+ case "utf-16le":
508
+ return true;
509
+ default:
510
+ return false;
511
+ }
512
+ };
513
+ Buffer2.concat = function concat(list, length) {
514
+ if (!Array.isArray(list)) {
515
+ throw new TypeError('"list" argument must be an Array of Buffers');
516
+ }
517
+ if (list.length === 0) {
518
+ return Buffer2.alloc(0);
519
+ }
520
+ let i;
521
+ if (length === void 0) {
522
+ length = 0;
523
+ for (i = 0; i < list.length; ++i) {
524
+ length += list[i].length;
525
+ }
526
+ }
527
+ const buffer = Buffer2.allocUnsafe(length);
528
+ let pos = 0;
529
+ for (i = 0; i < list.length; ++i) {
530
+ let buf = list[i];
531
+ if (isInstance(buf, Uint8Array)) {
532
+ if (pos + buf.length > buffer.length) {
533
+ if (!Buffer2.isBuffer(buf))
534
+ buf = Buffer2.from(buf);
535
+ buf.copy(buffer, pos);
536
+ } else {
537
+ Uint8Array.prototype.set.call(
538
+ buffer,
539
+ buf,
540
+ pos
541
+ );
542
+ }
543
+ } else if (!Buffer2.isBuffer(buf)) {
544
+ throw new TypeError('"list" argument must be an Array of Buffers');
545
+ } else {
546
+ buf.copy(buffer, pos);
547
+ }
548
+ pos += buf.length;
549
+ }
550
+ return buffer;
551
+ };
552
+ function byteLength(string, encoding) {
553
+ if (Buffer2.isBuffer(string)) {
554
+ return string.length;
555
+ }
556
+ if (ArrayBuffer.isView(string) || isInstance(string, ArrayBuffer)) {
557
+ return string.byteLength;
558
+ }
559
+ if (typeof string !== "string") {
560
+ throw new TypeError(
561
+ 'The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type ' + typeof string
562
+ );
563
+ }
564
+ const len = string.length;
565
+ const mustMatch = arguments.length > 2 && arguments[2] === true;
566
+ if (!mustMatch && len === 0)
567
+ return 0;
568
+ let loweredCase = false;
569
+ for (; ; ) {
570
+ switch (encoding) {
571
+ case "ascii":
572
+ case "latin1":
573
+ case "binary":
574
+ return len;
575
+ case "utf8":
576
+ case "utf-8":
577
+ return utf8ToBytes(string).length;
578
+ case "ucs2":
579
+ case "ucs-2":
580
+ case "utf16le":
581
+ case "utf-16le":
582
+ return len * 2;
583
+ case "hex":
584
+ return len >>> 1;
585
+ case "base64":
586
+ return base64ToBytes(string).length;
587
+ default:
588
+ if (loweredCase) {
589
+ return mustMatch ? -1 : utf8ToBytes(string).length;
590
+ }
591
+ encoding = ("" + encoding).toLowerCase();
592
+ loweredCase = true;
593
+ }
594
+ }
595
+ }
596
+ Buffer2.byteLength = byteLength;
597
+ function slowToString(encoding, start, end) {
598
+ let loweredCase = false;
599
+ if (start === void 0 || start < 0) {
600
+ start = 0;
601
+ }
602
+ if (start > this.length) {
603
+ return "";
604
+ }
605
+ if (end === void 0 || end > this.length) {
606
+ end = this.length;
607
+ }
608
+ if (end <= 0) {
609
+ return "";
610
+ }
611
+ end >>>= 0;
612
+ start >>>= 0;
613
+ if (end <= start) {
614
+ return "";
615
+ }
616
+ if (!encoding)
617
+ encoding = "utf8";
618
+ while (true) {
619
+ switch (encoding) {
620
+ case "hex":
621
+ return hexSlice(this, start, end);
622
+ case "utf8":
623
+ case "utf-8":
624
+ return utf8Slice(this, start, end);
625
+ case "ascii":
626
+ return asciiSlice(this, start, end);
627
+ case "latin1":
628
+ case "binary":
629
+ return latin1Slice(this, start, end);
630
+ case "base64":
631
+ return base64Slice(this, start, end);
632
+ case "ucs2":
633
+ case "ucs-2":
634
+ case "utf16le":
635
+ case "utf-16le":
636
+ return utf16leSlice(this, start, end);
637
+ default:
638
+ if (loweredCase)
639
+ throw new TypeError("Unknown encoding: " + encoding);
640
+ encoding = (encoding + "").toLowerCase();
641
+ loweredCase = true;
642
+ }
643
+ }
644
+ }
645
+ Buffer2.prototype._isBuffer = true;
646
+ function swap(b, n, m) {
647
+ const i = b[n];
648
+ b[n] = b[m];
649
+ b[m] = i;
650
+ }
651
+ Buffer2.prototype.swap16 = function swap16() {
652
+ const len = this.length;
653
+ if (len % 2 !== 0) {
654
+ throw new RangeError("Buffer size must be a multiple of 16-bits");
655
+ }
656
+ for (let i = 0; i < len; i += 2) {
657
+ swap(this, i, i + 1);
658
+ }
659
+ return this;
660
+ };
661
+ Buffer2.prototype.swap32 = function swap32() {
662
+ const len = this.length;
663
+ if (len % 4 !== 0) {
664
+ throw new RangeError("Buffer size must be a multiple of 32-bits");
665
+ }
666
+ for (let i = 0; i < len; i += 4) {
667
+ swap(this, i, i + 3);
668
+ swap(this, i + 1, i + 2);
669
+ }
670
+ return this;
671
+ };
672
+ Buffer2.prototype.swap64 = function swap64() {
673
+ const len = this.length;
674
+ if (len % 8 !== 0) {
675
+ throw new RangeError("Buffer size must be a multiple of 64-bits");
676
+ }
677
+ for (let i = 0; i < len; i += 8) {
678
+ swap(this, i, i + 7);
679
+ swap(this, i + 1, i + 6);
680
+ swap(this, i + 2, i + 5);
681
+ swap(this, i + 3, i + 4);
682
+ }
683
+ return this;
684
+ };
685
+ Buffer2.prototype.toString = function toString() {
686
+ const length = this.length;
687
+ if (length === 0)
688
+ return "";
689
+ if (arguments.length === 0)
690
+ return utf8Slice(this, 0, length);
691
+ return slowToString.apply(this, arguments);
692
+ };
693
+ Buffer2.prototype.toLocaleString = Buffer2.prototype.toString;
694
+ Buffer2.prototype.equals = function equals(b) {
695
+ if (!Buffer2.isBuffer(b))
696
+ throw new TypeError("Argument must be a Buffer");
697
+ if (this === b)
698
+ return true;
699
+ return Buffer2.compare(this, b) === 0;
700
+ };
701
+ Buffer2.prototype.inspect = function inspect() {
702
+ let str = "";
703
+ const max = exports.INSPECT_MAX_BYTES;
704
+ str = this.toString("hex", 0, max).replace(/(.{2})/g, "$1 ").trim();
705
+ if (this.length > max)
706
+ str += " ... ";
707
+ return "<Buffer " + str + ">";
708
+ };
709
+ if (customInspectSymbol) {
710
+ Buffer2.prototype[customInspectSymbol] = Buffer2.prototype.inspect;
711
+ }
712
+ Buffer2.prototype.compare = function compare(target, start, end, thisStart, thisEnd) {
713
+ if (isInstance(target, Uint8Array)) {
714
+ target = Buffer2.from(target, target.offset, target.byteLength);
715
+ }
716
+ if (!Buffer2.isBuffer(target)) {
717
+ throw new TypeError(
718
+ 'The "target" argument must be one of type Buffer or Uint8Array. Received type ' + typeof target
719
+ );
720
+ }
721
+ if (start === void 0) {
722
+ start = 0;
723
+ }
724
+ if (end === void 0) {
725
+ end = target ? target.length : 0;
726
+ }
727
+ if (thisStart === void 0) {
728
+ thisStart = 0;
729
+ }
730
+ if (thisEnd === void 0) {
731
+ thisEnd = this.length;
732
+ }
733
+ if (start < 0 || end > target.length || thisStart < 0 || thisEnd > this.length) {
734
+ throw new RangeError("out of range index");
735
+ }
736
+ if (thisStart >= thisEnd && start >= end) {
737
+ return 0;
738
+ }
739
+ if (thisStart >= thisEnd) {
740
+ return -1;
741
+ }
742
+ if (start >= end) {
743
+ return 1;
744
+ }
745
+ start >>>= 0;
746
+ end >>>= 0;
747
+ thisStart >>>= 0;
748
+ thisEnd >>>= 0;
749
+ if (this === target)
750
+ return 0;
751
+ let x = thisEnd - thisStart;
752
+ let y = end - start;
753
+ const len = Math.min(x, y);
754
+ const thisCopy = this.slice(thisStart, thisEnd);
755
+ const targetCopy = target.slice(start, end);
756
+ for (let i = 0; i < len; ++i) {
757
+ if (thisCopy[i] !== targetCopy[i]) {
758
+ x = thisCopy[i];
759
+ y = targetCopy[i];
760
+ break;
761
+ }
762
+ }
763
+ if (x < y)
764
+ return -1;
765
+ if (y < x)
766
+ return 1;
767
+ return 0;
768
+ };
769
+ function bidirectionalIndexOf(buffer, val, byteOffset, encoding, dir) {
770
+ if (buffer.length === 0)
771
+ return -1;
772
+ if (typeof byteOffset === "string") {
773
+ encoding = byteOffset;
774
+ byteOffset = 0;
775
+ } else if (byteOffset > 2147483647) {
776
+ byteOffset = 2147483647;
777
+ } else if (byteOffset < -2147483648) {
778
+ byteOffset = -2147483648;
779
+ }
780
+ byteOffset = +byteOffset;
781
+ if (numberIsNaN(byteOffset)) {
782
+ byteOffset = dir ? 0 : buffer.length - 1;
783
+ }
784
+ if (byteOffset < 0)
785
+ byteOffset = buffer.length + byteOffset;
786
+ if (byteOffset >= buffer.length) {
787
+ if (dir)
788
+ return -1;
789
+ else
790
+ byteOffset = buffer.length - 1;
791
+ } else if (byteOffset < 0) {
792
+ if (dir)
793
+ byteOffset = 0;
794
+ else
795
+ return -1;
796
+ }
797
+ if (typeof val === "string") {
798
+ val = Buffer2.from(val, encoding);
799
+ }
800
+ if (Buffer2.isBuffer(val)) {
801
+ if (val.length === 0) {
802
+ return -1;
803
+ }
804
+ return arrayIndexOf(buffer, val, byteOffset, encoding, dir);
805
+ } else if (typeof val === "number") {
806
+ val = val & 255;
807
+ if (typeof Uint8Array.prototype.indexOf === "function") {
808
+ if (dir) {
809
+ return Uint8Array.prototype.indexOf.call(buffer, val, byteOffset);
810
+ } else {
811
+ return Uint8Array.prototype.lastIndexOf.call(buffer, val, byteOffset);
812
+ }
813
+ }
814
+ return arrayIndexOf(buffer, [val], byteOffset, encoding, dir);
815
+ }
816
+ throw new TypeError("val must be string, number or Buffer");
817
+ }
818
+ function arrayIndexOf(arr, val, byteOffset, encoding, dir) {
819
+ let indexSize = 1;
820
+ let arrLength = arr.length;
821
+ let valLength = val.length;
822
+ if (encoding !== void 0) {
823
+ encoding = String(encoding).toLowerCase();
824
+ if (encoding === "ucs2" || encoding === "ucs-2" || encoding === "utf16le" || encoding === "utf-16le") {
825
+ if (arr.length < 2 || val.length < 2) {
826
+ return -1;
827
+ }
828
+ indexSize = 2;
829
+ arrLength /= 2;
830
+ valLength /= 2;
831
+ byteOffset /= 2;
832
+ }
833
+ }
834
+ function read(buf, i2) {
835
+ if (indexSize === 1) {
836
+ return buf[i2];
837
+ } else {
838
+ return buf.readUInt16BE(i2 * indexSize);
839
+ }
840
+ }
841
+ let i;
842
+ if (dir) {
843
+ let foundIndex = -1;
844
+ for (i = byteOffset; i < arrLength; i++) {
845
+ if (read(arr, i) === read(val, foundIndex === -1 ? 0 : i - foundIndex)) {
846
+ if (foundIndex === -1)
847
+ foundIndex = i;
848
+ if (i - foundIndex + 1 === valLength)
849
+ return foundIndex * indexSize;
850
+ } else {
851
+ if (foundIndex !== -1)
852
+ i -= i - foundIndex;
853
+ foundIndex = -1;
854
+ }
855
+ }
856
+ } else {
857
+ if (byteOffset + valLength > arrLength)
858
+ byteOffset = arrLength - valLength;
859
+ for (i = byteOffset; i >= 0; i--) {
860
+ let found = true;
861
+ for (let j = 0; j < valLength; j++) {
862
+ if (read(arr, i + j) !== read(val, j)) {
863
+ found = false;
864
+ break;
865
+ }
866
+ }
867
+ if (found)
868
+ return i;
869
+ }
870
+ }
871
+ return -1;
872
+ }
873
+ Buffer2.prototype.includes = function includes(val, byteOffset, encoding) {
874
+ return this.indexOf(val, byteOffset, encoding) !== -1;
875
+ };
876
+ Buffer2.prototype.indexOf = function indexOf(val, byteOffset, encoding) {
877
+ return bidirectionalIndexOf(this, val, byteOffset, encoding, true);
878
+ };
879
+ Buffer2.prototype.lastIndexOf = function lastIndexOf(val, byteOffset, encoding) {
880
+ return bidirectionalIndexOf(this, val, byteOffset, encoding, false);
881
+ };
882
+ function hexWrite(buf, string, offset, length) {
883
+ offset = Number(offset) || 0;
884
+ const remaining = buf.length - offset;
885
+ if (!length) {
886
+ length = remaining;
887
+ } else {
888
+ length = Number(length);
889
+ if (length > remaining) {
890
+ length = remaining;
891
+ }
892
+ }
893
+ const strLen = string.length;
894
+ if (length > strLen / 2) {
895
+ length = strLen / 2;
896
+ }
897
+ let i;
898
+ for (i = 0; i < length; ++i) {
899
+ const parsed = parseInt(string.substr(i * 2, 2), 16);
900
+ if (numberIsNaN(parsed))
901
+ return i;
902
+ buf[offset + i] = parsed;
903
+ }
904
+ return i;
905
+ }
906
+ function utf8Write(buf, string, offset, length) {
907
+ return blitBuffer(utf8ToBytes(string, buf.length - offset), buf, offset, length);
908
+ }
909
+ function asciiWrite(buf, string, offset, length) {
910
+ return blitBuffer(asciiToBytes(string), buf, offset, length);
911
+ }
912
+ function base64Write(buf, string, offset, length) {
913
+ return blitBuffer(base64ToBytes(string), buf, offset, length);
914
+ }
915
+ function ucs2Write(buf, string, offset, length) {
916
+ return blitBuffer(utf16leToBytes(string, buf.length - offset), buf, offset, length);
917
+ }
918
+ Buffer2.prototype.write = function write(string, offset, length, encoding) {
919
+ if (offset === void 0) {
920
+ encoding = "utf8";
921
+ length = this.length;
922
+ offset = 0;
923
+ } else if (length === void 0 && typeof offset === "string") {
924
+ encoding = offset;
925
+ length = this.length;
926
+ offset = 0;
927
+ } else if (isFinite(offset)) {
928
+ offset = offset >>> 0;
929
+ if (isFinite(length)) {
930
+ length = length >>> 0;
931
+ if (encoding === void 0)
932
+ encoding = "utf8";
933
+ } else {
934
+ encoding = length;
935
+ length = void 0;
936
+ }
937
+ } else {
938
+ throw new Error(
939
+ "Buffer.write(string, encoding, offset[, length]) is no longer supported"
940
+ );
941
+ }
942
+ const remaining = this.length - offset;
943
+ if (length === void 0 || length > remaining)
944
+ length = remaining;
945
+ if (string.length > 0 && (length < 0 || offset < 0) || offset > this.length) {
946
+ throw new RangeError("Attempt to write outside buffer bounds");
947
+ }
948
+ if (!encoding)
949
+ encoding = "utf8";
950
+ let loweredCase = false;
951
+ for (; ; ) {
952
+ switch (encoding) {
953
+ case "hex":
954
+ return hexWrite(this, string, offset, length);
955
+ case "utf8":
956
+ case "utf-8":
957
+ return utf8Write(this, string, offset, length);
958
+ case "ascii":
959
+ case "latin1":
960
+ case "binary":
961
+ return asciiWrite(this, string, offset, length);
962
+ case "base64":
963
+ return base64Write(this, string, offset, length);
964
+ case "ucs2":
965
+ case "ucs-2":
966
+ case "utf16le":
967
+ case "utf-16le":
968
+ return ucs2Write(this, string, offset, length);
969
+ default:
970
+ if (loweredCase)
971
+ throw new TypeError("Unknown encoding: " + encoding);
972
+ encoding = ("" + encoding).toLowerCase();
973
+ loweredCase = true;
974
+ }
975
+ }
976
+ };
977
+ Buffer2.prototype.toJSON = function toJSON() {
978
+ return {
979
+ type: "Buffer",
980
+ data: Array.prototype.slice.call(this._arr || this, 0)
981
+ };
982
+ };
983
+ function base64Slice(buf, start, end) {
984
+ if (start === 0 && end === buf.length) {
985
+ return base64.fromByteArray(buf);
986
+ } else {
987
+ return base64.fromByteArray(buf.slice(start, end));
988
+ }
989
+ }
990
+ function utf8Slice(buf, start, end) {
991
+ end = Math.min(buf.length, end);
992
+ const res = [];
993
+ let i = start;
994
+ while (i < end) {
995
+ const firstByte = buf[i];
996
+ let codePoint = null;
997
+ let bytesPerSequence = firstByte > 239 ? 4 : firstByte > 223 ? 3 : firstByte > 191 ? 2 : 1;
998
+ if (i + bytesPerSequence <= end) {
999
+ let secondByte, thirdByte, fourthByte, tempCodePoint;
1000
+ switch (bytesPerSequence) {
1001
+ case 1:
1002
+ if (firstByte < 128) {
1003
+ codePoint = firstByte;
1004
+ }
1005
+ break;
1006
+ case 2:
1007
+ secondByte = buf[i + 1];
1008
+ if ((secondByte & 192) === 128) {
1009
+ tempCodePoint = (firstByte & 31) << 6 | secondByte & 63;
1010
+ if (tempCodePoint > 127) {
1011
+ codePoint = tempCodePoint;
1012
+ }
1013
+ }
1014
+ break;
1015
+ case 3:
1016
+ secondByte = buf[i + 1];
1017
+ thirdByte = buf[i + 2];
1018
+ if ((secondByte & 192) === 128 && (thirdByte & 192) === 128) {
1019
+ tempCodePoint = (firstByte & 15) << 12 | (secondByte & 63) << 6 | thirdByte & 63;
1020
+ if (tempCodePoint > 2047 && (tempCodePoint < 55296 || tempCodePoint > 57343)) {
1021
+ codePoint = tempCodePoint;
1022
+ }
1023
+ }
1024
+ break;
1025
+ case 4:
1026
+ secondByte = buf[i + 1];
1027
+ thirdByte = buf[i + 2];
1028
+ fourthByte = buf[i + 3];
1029
+ if ((secondByte & 192) === 128 && (thirdByte & 192) === 128 && (fourthByte & 192) === 128) {
1030
+ tempCodePoint = (firstByte & 15) << 18 | (secondByte & 63) << 12 | (thirdByte & 63) << 6 | fourthByte & 63;
1031
+ if (tempCodePoint > 65535 && tempCodePoint < 1114112) {
1032
+ codePoint = tempCodePoint;
1033
+ }
1034
+ }
1035
+ }
1036
+ }
1037
+ if (codePoint === null) {
1038
+ codePoint = 65533;
1039
+ bytesPerSequence = 1;
1040
+ } else if (codePoint > 65535) {
1041
+ codePoint -= 65536;
1042
+ res.push(codePoint >>> 10 & 1023 | 55296);
1043
+ codePoint = 56320 | codePoint & 1023;
1044
+ }
1045
+ res.push(codePoint);
1046
+ i += bytesPerSequence;
1047
+ }
1048
+ return decodeCodePointsArray(res);
1049
+ }
1050
+ var MAX_ARGUMENTS_LENGTH = 4096;
1051
+ function decodeCodePointsArray(codePoints) {
1052
+ const len = codePoints.length;
1053
+ if (len <= MAX_ARGUMENTS_LENGTH) {
1054
+ return String.fromCharCode.apply(String, codePoints);
1055
+ }
1056
+ let res = "";
1057
+ let i = 0;
1058
+ while (i < len) {
1059
+ res += String.fromCharCode.apply(
1060
+ String,
1061
+ codePoints.slice(i, i += MAX_ARGUMENTS_LENGTH)
1062
+ );
1063
+ }
1064
+ return res;
1065
+ }
1066
+ function asciiSlice(buf, start, end) {
1067
+ let ret = "";
1068
+ end = Math.min(buf.length, end);
1069
+ for (let i = start; i < end; ++i) {
1070
+ ret += String.fromCharCode(buf[i] & 127);
1071
+ }
1072
+ return ret;
1073
+ }
1074
+ function latin1Slice(buf, start, end) {
1075
+ let ret = "";
1076
+ end = Math.min(buf.length, end);
1077
+ for (let i = start; i < end; ++i) {
1078
+ ret += String.fromCharCode(buf[i]);
1079
+ }
1080
+ return ret;
1081
+ }
1082
+ function hexSlice(buf, start, end) {
1083
+ const len = buf.length;
1084
+ if (!start || start < 0)
1085
+ start = 0;
1086
+ if (!end || end < 0 || end > len)
1087
+ end = len;
1088
+ let out = "";
1089
+ for (let i = start; i < end; ++i) {
1090
+ out += hexSliceLookupTable[buf[i]];
1091
+ }
1092
+ return out;
1093
+ }
1094
+ function utf16leSlice(buf, start, end) {
1095
+ const bytes = buf.slice(start, end);
1096
+ let res = "";
1097
+ for (let i = 0; i < bytes.length - 1; i += 2) {
1098
+ res += String.fromCharCode(bytes[i] + bytes[i + 1] * 256);
1099
+ }
1100
+ return res;
1101
+ }
1102
+ Buffer2.prototype.slice = function slice(start, end) {
1103
+ const len = this.length;
1104
+ start = ~~start;
1105
+ end = end === void 0 ? len : ~~end;
1106
+ if (start < 0) {
1107
+ start += len;
1108
+ if (start < 0)
1109
+ start = 0;
1110
+ } else if (start > len) {
1111
+ start = len;
1112
+ }
1113
+ if (end < 0) {
1114
+ end += len;
1115
+ if (end < 0)
1116
+ end = 0;
1117
+ } else if (end > len) {
1118
+ end = len;
1119
+ }
1120
+ if (end < start)
1121
+ end = start;
1122
+ const newBuf = this.subarray(start, end);
1123
+ Object.setPrototypeOf(newBuf, Buffer2.prototype);
1124
+ return newBuf;
1125
+ };
1126
+ function checkOffset(offset, ext, length) {
1127
+ if (offset % 1 !== 0 || offset < 0)
1128
+ throw new RangeError("offset is not uint");
1129
+ if (offset + ext > length)
1130
+ throw new RangeError("Trying to access beyond buffer length");
1131
+ }
1132
+ Buffer2.prototype.readUintLE = Buffer2.prototype.readUIntLE = function readUIntLE(offset, byteLength2, noAssert) {
1133
+ offset = offset >>> 0;
1134
+ byteLength2 = byteLength2 >>> 0;
1135
+ if (!noAssert)
1136
+ checkOffset(offset, byteLength2, this.length);
1137
+ let val = this[offset];
1138
+ let mul = 1;
1139
+ let i = 0;
1140
+ while (++i < byteLength2 && (mul *= 256)) {
1141
+ val += this[offset + i] * mul;
1142
+ }
1143
+ return val;
1144
+ };
1145
+ Buffer2.prototype.readUintBE = Buffer2.prototype.readUIntBE = function readUIntBE(offset, byteLength2, noAssert) {
1146
+ offset = offset >>> 0;
1147
+ byteLength2 = byteLength2 >>> 0;
1148
+ if (!noAssert) {
1149
+ checkOffset(offset, byteLength2, this.length);
1150
+ }
1151
+ let val = this[offset + --byteLength2];
1152
+ let mul = 1;
1153
+ while (byteLength2 > 0 && (mul *= 256)) {
1154
+ val += this[offset + --byteLength2] * mul;
1155
+ }
1156
+ return val;
1157
+ };
1158
+ Buffer2.prototype.readUint8 = Buffer2.prototype.readUInt8 = function readUInt8(offset, noAssert) {
1159
+ offset = offset >>> 0;
1160
+ if (!noAssert)
1161
+ checkOffset(offset, 1, this.length);
1162
+ return this[offset];
1163
+ };
1164
+ Buffer2.prototype.readUint16LE = Buffer2.prototype.readUInt16LE = function readUInt16LE(offset, noAssert) {
1165
+ offset = offset >>> 0;
1166
+ if (!noAssert)
1167
+ checkOffset(offset, 2, this.length);
1168
+ return this[offset] | this[offset + 1] << 8;
1169
+ };
1170
+ Buffer2.prototype.readUint16BE = Buffer2.prototype.readUInt16BE = function readUInt16BE(offset, noAssert) {
1171
+ offset = offset >>> 0;
1172
+ if (!noAssert)
1173
+ checkOffset(offset, 2, this.length);
1174
+ return this[offset] << 8 | this[offset + 1];
1175
+ };
1176
+ Buffer2.prototype.readUint32LE = Buffer2.prototype.readUInt32LE = function readUInt32LE(offset, noAssert) {
1177
+ offset = offset >>> 0;
1178
+ if (!noAssert)
1179
+ checkOffset(offset, 4, this.length);
1180
+ return (this[offset] | this[offset + 1] << 8 | this[offset + 2] << 16) + this[offset + 3] * 16777216;
1181
+ };
1182
+ Buffer2.prototype.readUint32BE = Buffer2.prototype.readUInt32BE = function readUInt32BE(offset, noAssert) {
1183
+ offset = offset >>> 0;
1184
+ if (!noAssert)
1185
+ checkOffset(offset, 4, this.length);
1186
+ return this[offset] * 16777216 + (this[offset + 1] << 16 | this[offset + 2] << 8 | this[offset + 3]);
1187
+ };
1188
+ Buffer2.prototype.readBigUInt64LE = defineBigIntMethod(function readBigUInt64LE(offset) {
1189
+ offset = offset >>> 0;
1190
+ validateNumber(offset, "offset");
1191
+ const first = this[offset];
1192
+ const last = this[offset + 7];
1193
+ if (first === void 0 || last === void 0) {
1194
+ boundsError(offset, this.length - 8);
1195
+ }
1196
+ const lo = first + this[++offset] * 2 ** 8 + this[++offset] * 2 ** 16 + this[++offset] * 2 ** 24;
1197
+ const hi = this[++offset] + this[++offset] * 2 ** 8 + this[++offset] * 2 ** 16 + last * 2 ** 24;
1198
+ return BigInt(lo) + (BigInt(hi) << BigInt(32));
1199
+ });
1200
+ Buffer2.prototype.readBigUInt64BE = defineBigIntMethod(function readBigUInt64BE(offset) {
1201
+ offset = offset >>> 0;
1202
+ validateNumber(offset, "offset");
1203
+ const first = this[offset];
1204
+ const last = this[offset + 7];
1205
+ if (first === void 0 || last === void 0) {
1206
+ boundsError(offset, this.length - 8);
1207
+ }
1208
+ const hi = first * 2 ** 24 + this[++offset] * 2 ** 16 + this[++offset] * 2 ** 8 + this[++offset];
1209
+ const lo = this[++offset] * 2 ** 24 + this[++offset] * 2 ** 16 + this[++offset] * 2 ** 8 + last;
1210
+ return (BigInt(hi) << BigInt(32)) + BigInt(lo);
1211
+ });
1212
+ Buffer2.prototype.readIntLE = function readIntLE(offset, byteLength2, noAssert) {
1213
+ offset = offset >>> 0;
1214
+ byteLength2 = byteLength2 >>> 0;
1215
+ if (!noAssert)
1216
+ checkOffset(offset, byteLength2, this.length);
1217
+ let val = this[offset];
1218
+ let mul = 1;
1219
+ let i = 0;
1220
+ while (++i < byteLength2 && (mul *= 256)) {
1221
+ val += this[offset + i] * mul;
1222
+ }
1223
+ mul *= 128;
1224
+ if (val >= mul)
1225
+ val -= Math.pow(2, 8 * byteLength2);
1226
+ return val;
1227
+ };
1228
+ Buffer2.prototype.readIntBE = function readIntBE(offset, byteLength2, noAssert) {
1229
+ offset = offset >>> 0;
1230
+ byteLength2 = byteLength2 >>> 0;
1231
+ if (!noAssert)
1232
+ checkOffset(offset, byteLength2, this.length);
1233
+ let i = byteLength2;
1234
+ let mul = 1;
1235
+ let val = this[offset + --i];
1236
+ while (i > 0 && (mul *= 256)) {
1237
+ val += this[offset + --i] * mul;
1238
+ }
1239
+ mul *= 128;
1240
+ if (val >= mul)
1241
+ val -= Math.pow(2, 8 * byteLength2);
1242
+ return val;
1243
+ };
1244
+ Buffer2.prototype.readInt8 = function readInt8(offset, noAssert) {
1245
+ offset = offset >>> 0;
1246
+ if (!noAssert)
1247
+ checkOffset(offset, 1, this.length);
1248
+ if (!(this[offset] & 128))
1249
+ return this[offset];
1250
+ return (255 - this[offset] + 1) * -1;
1251
+ };
1252
+ Buffer2.prototype.readInt16LE = function readInt16LE(offset, noAssert) {
1253
+ offset = offset >>> 0;
1254
+ if (!noAssert)
1255
+ checkOffset(offset, 2, this.length);
1256
+ const val = this[offset] | this[offset + 1] << 8;
1257
+ return val & 32768 ? val | 4294901760 : val;
1258
+ };
1259
+ Buffer2.prototype.readInt16BE = function readInt16BE(offset, noAssert) {
1260
+ offset = offset >>> 0;
1261
+ if (!noAssert)
1262
+ checkOffset(offset, 2, this.length);
1263
+ const val = this[offset + 1] | this[offset] << 8;
1264
+ return val & 32768 ? val | 4294901760 : val;
1265
+ };
1266
+ Buffer2.prototype.readInt32LE = function readInt32LE(offset, noAssert) {
1267
+ offset = offset >>> 0;
1268
+ if (!noAssert)
1269
+ checkOffset(offset, 4, this.length);
1270
+ return this[offset] | this[offset + 1] << 8 | this[offset + 2] << 16 | this[offset + 3] << 24;
1271
+ };
1272
+ Buffer2.prototype.readInt32BE = function readInt32BE(offset, noAssert) {
1273
+ offset = offset >>> 0;
1274
+ if (!noAssert)
1275
+ checkOffset(offset, 4, this.length);
1276
+ return this[offset] << 24 | this[offset + 1] << 16 | this[offset + 2] << 8 | this[offset + 3];
1277
+ };
1278
+ Buffer2.prototype.readBigInt64LE = defineBigIntMethod(function readBigInt64LE(offset) {
1279
+ offset = offset >>> 0;
1280
+ validateNumber(offset, "offset");
1281
+ const first = this[offset];
1282
+ const last = this[offset + 7];
1283
+ if (first === void 0 || last === void 0) {
1284
+ boundsError(offset, this.length - 8);
1285
+ }
1286
+ const val = this[offset + 4] + this[offset + 5] * 2 ** 8 + this[offset + 6] * 2 ** 16 + (last << 24);
1287
+ return (BigInt(val) << BigInt(32)) + BigInt(first + this[++offset] * 2 ** 8 + this[++offset] * 2 ** 16 + this[++offset] * 2 ** 24);
1288
+ });
1289
+ Buffer2.prototype.readBigInt64BE = defineBigIntMethod(function readBigInt64BE(offset) {
1290
+ offset = offset >>> 0;
1291
+ validateNumber(offset, "offset");
1292
+ const first = this[offset];
1293
+ const last = this[offset + 7];
1294
+ if (first === void 0 || last === void 0) {
1295
+ boundsError(offset, this.length - 8);
1296
+ }
1297
+ const val = (first << 24) + // Overflow
1298
+ this[++offset] * 2 ** 16 + this[++offset] * 2 ** 8 + this[++offset];
1299
+ return (BigInt(val) << BigInt(32)) + BigInt(this[++offset] * 2 ** 24 + this[++offset] * 2 ** 16 + this[++offset] * 2 ** 8 + last);
1300
+ });
1301
+ Buffer2.prototype.readFloatLE = function readFloatLE(offset, noAssert) {
1302
+ offset = offset >>> 0;
1303
+ if (!noAssert)
1304
+ checkOffset(offset, 4, this.length);
1305
+ return ieee754.read(this, offset, true, 23, 4);
1306
+ };
1307
+ Buffer2.prototype.readFloatBE = function readFloatBE(offset, noAssert) {
1308
+ offset = offset >>> 0;
1309
+ if (!noAssert)
1310
+ checkOffset(offset, 4, this.length);
1311
+ return ieee754.read(this, offset, false, 23, 4);
1312
+ };
1313
+ Buffer2.prototype.readDoubleLE = function readDoubleLE(offset, noAssert) {
1314
+ offset = offset >>> 0;
1315
+ if (!noAssert)
1316
+ checkOffset(offset, 8, this.length);
1317
+ return ieee754.read(this, offset, true, 52, 8);
1318
+ };
1319
+ Buffer2.prototype.readDoubleBE = function readDoubleBE(offset, noAssert) {
1320
+ offset = offset >>> 0;
1321
+ if (!noAssert)
1322
+ checkOffset(offset, 8, this.length);
1323
+ return ieee754.read(this, offset, false, 52, 8);
1324
+ };
1325
+ function checkInt(buf, value, offset, ext, max, min) {
1326
+ if (!Buffer2.isBuffer(buf))
1327
+ throw new TypeError('"buffer" argument must be a Buffer instance');
1328
+ if (value > max || value < min)
1329
+ throw new RangeError('"value" argument is out of bounds');
1330
+ if (offset + ext > buf.length)
1331
+ throw new RangeError("Index out of range");
1332
+ }
1333
+ Buffer2.prototype.writeUintLE = Buffer2.prototype.writeUIntLE = function writeUIntLE(value, offset, byteLength2, noAssert) {
1334
+ value = +value;
1335
+ offset = offset >>> 0;
1336
+ byteLength2 = byteLength2 >>> 0;
1337
+ if (!noAssert) {
1338
+ const maxBytes = Math.pow(2, 8 * byteLength2) - 1;
1339
+ checkInt(this, value, offset, byteLength2, maxBytes, 0);
1340
+ }
1341
+ let mul = 1;
1342
+ let i = 0;
1343
+ this[offset] = value & 255;
1344
+ while (++i < byteLength2 && (mul *= 256)) {
1345
+ this[offset + i] = value / mul & 255;
1346
+ }
1347
+ return offset + byteLength2;
1348
+ };
1349
+ Buffer2.prototype.writeUintBE = Buffer2.prototype.writeUIntBE = function writeUIntBE(value, offset, byteLength2, noAssert) {
1350
+ value = +value;
1351
+ offset = offset >>> 0;
1352
+ byteLength2 = byteLength2 >>> 0;
1353
+ if (!noAssert) {
1354
+ const maxBytes = Math.pow(2, 8 * byteLength2) - 1;
1355
+ checkInt(this, value, offset, byteLength2, maxBytes, 0);
1356
+ }
1357
+ let i = byteLength2 - 1;
1358
+ let mul = 1;
1359
+ this[offset + i] = value & 255;
1360
+ while (--i >= 0 && (mul *= 256)) {
1361
+ this[offset + i] = value / mul & 255;
1362
+ }
1363
+ return offset + byteLength2;
1364
+ };
1365
+ Buffer2.prototype.writeUint8 = Buffer2.prototype.writeUInt8 = function writeUInt8(value, offset, noAssert) {
1366
+ value = +value;
1367
+ offset = offset >>> 0;
1368
+ if (!noAssert)
1369
+ checkInt(this, value, offset, 1, 255, 0);
1370
+ this[offset] = value & 255;
1371
+ return offset + 1;
1372
+ };
1373
+ Buffer2.prototype.writeUint16LE = Buffer2.prototype.writeUInt16LE = function writeUInt16LE(value, offset, noAssert) {
1374
+ value = +value;
1375
+ offset = offset >>> 0;
1376
+ if (!noAssert)
1377
+ checkInt(this, value, offset, 2, 65535, 0);
1378
+ this[offset] = value & 255;
1379
+ this[offset + 1] = value >>> 8;
1380
+ return offset + 2;
1381
+ };
1382
+ Buffer2.prototype.writeUint16BE = Buffer2.prototype.writeUInt16BE = function writeUInt16BE(value, offset, noAssert) {
1383
+ value = +value;
1384
+ offset = offset >>> 0;
1385
+ if (!noAssert)
1386
+ checkInt(this, value, offset, 2, 65535, 0);
1387
+ this[offset] = value >>> 8;
1388
+ this[offset + 1] = value & 255;
1389
+ return offset + 2;
1390
+ };
1391
+ Buffer2.prototype.writeUint32LE = Buffer2.prototype.writeUInt32LE = function writeUInt32LE(value, offset, noAssert) {
1392
+ value = +value;
1393
+ offset = offset >>> 0;
1394
+ if (!noAssert)
1395
+ checkInt(this, value, offset, 4, 4294967295, 0);
1396
+ this[offset + 3] = value >>> 24;
1397
+ this[offset + 2] = value >>> 16;
1398
+ this[offset + 1] = value >>> 8;
1399
+ this[offset] = value & 255;
1400
+ return offset + 4;
1401
+ };
1402
+ Buffer2.prototype.writeUint32BE = Buffer2.prototype.writeUInt32BE = function writeUInt32BE(value, offset, noAssert) {
1403
+ value = +value;
1404
+ offset = offset >>> 0;
1405
+ if (!noAssert)
1406
+ checkInt(this, value, offset, 4, 4294967295, 0);
1407
+ this[offset] = value >>> 24;
1408
+ this[offset + 1] = value >>> 16;
1409
+ this[offset + 2] = value >>> 8;
1410
+ this[offset + 3] = value & 255;
1411
+ return offset + 4;
1412
+ };
1413
+ function wrtBigUInt64LE(buf, value, offset, min, max) {
1414
+ checkIntBI(value, min, max, buf, offset, 7);
1415
+ let lo = Number(value & BigInt(4294967295));
1416
+ buf[offset++] = lo;
1417
+ lo = lo >> 8;
1418
+ buf[offset++] = lo;
1419
+ lo = lo >> 8;
1420
+ buf[offset++] = lo;
1421
+ lo = lo >> 8;
1422
+ buf[offset++] = lo;
1423
+ let hi = Number(value >> BigInt(32) & BigInt(4294967295));
1424
+ buf[offset++] = hi;
1425
+ hi = hi >> 8;
1426
+ buf[offset++] = hi;
1427
+ hi = hi >> 8;
1428
+ buf[offset++] = hi;
1429
+ hi = hi >> 8;
1430
+ buf[offset++] = hi;
1431
+ return offset;
1432
+ }
1433
+ function wrtBigUInt64BE(buf, value, offset, min, max) {
1434
+ checkIntBI(value, min, max, buf, offset, 7);
1435
+ let lo = Number(value & BigInt(4294967295));
1436
+ buf[offset + 7] = lo;
1437
+ lo = lo >> 8;
1438
+ buf[offset + 6] = lo;
1439
+ lo = lo >> 8;
1440
+ buf[offset + 5] = lo;
1441
+ lo = lo >> 8;
1442
+ buf[offset + 4] = lo;
1443
+ let hi = Number(value >> BigInt(32) & BigInt(4294967295));
1444
+ buf[offset + 3] = hi;
1445
+ hi = hi >> 8;
1446
+ buf[offset + 2] = hi;
1447
+ hi = hi >> 8;
1448
+ buf[offset + 1] = hi;
1449
+ hi = hi >> 8;
1450
+ buf[offset] = hi;
1451
+ return offset + 8;
1452
+ }
1453
+ Buffer2.prototype.writeBigUInt64LE = defineBigIntMethod(function writeBigUInt64LE(value, offset = 0) {
1454
+ return wrtBigUInt64LE(this, value, offset, BigInt(0), BigInt("0xffffffffffffffff"));
1455
+ });
1456
+ Buffer2.prototype.writeBigUInt64BE = defineBigIntMethod(function writeBigUInt64BE(value, offset = 0) {
1457
+ return wrtBigUInt64BE(this, value, offset, BigInt(0), BigInt("0xffffffffffffffff"));
1458
+ });
1459
+ Buffer2.prototype.writeIntLE = function writeIntLE(value, offset, byteLength2, noAssert) {
1460
+ value = +value;
1461
+ offset = offset >>> 0;
1462
+ if (!noAssert) {
1463
+ const limit = Math.pow(2, 8 * byteLength2 - 1);
1464
+ checkInt(this, value, offset, byteLength2, limit - 1, -limit);
1465
+ }
1466
+ let i = 0;
1467
+ let mul = 1;
1468
+ let sub = 0;
1469
+ this[offset] = value & 255;
1470
+ while (++i < byteLength2 && (mul *= 256)) {
1471
+ if (value < 0 && sub === 0 && this[offset + i - 1] !== 0) {
1472
+ sub = 1;
1473
+ }
1474
+ this[offset + i] = (value / mul >> 0) - sub & 255;
1475
+ }
1476
+ return offset + byteLength2;
1477
+ };
1478
+ Buffer2.prototype.writeIntBE = function writeIntBE(value, offset, byteLength2, noAssert) {
1479
+ value = +value;
1480
+ offset = offset >>> 0;
1481
+ if (!noAssert) {
1482
+ const limit = Math.pow(2, 8 * byteLength2 - 1);
1483
+ checkInt(this, value, offset, byteLength2, limit - 1, -limit);
1484
+ }
1485
+ let i = byteLength2 - 1;
1486
+ let mul = 1;
1487
+ let sub = 0;
1488
+ this[offset + i] = value & 255;
1489
+ while (--i >= 0 && (mul *= 256)) {
1490
+ if (value < 0 && sub === 0 && this[offset + i + 1] !== 0) {
1491
+ sub = 1;
1492
+ }
1493
+ this[offset + i] = (value / mul >> 0) - sub & 255;
1494
+ }
1495
+ return offset + byteLength2;
1496
+ };
1497
+ Buffer2.prototype.writeInt8 = function writeInt8(value, offset, noAssert) {
1498
+ value = +value;
1499
+ offset = offset >>> 0;
1500
+ if (!noAssert)
1501
+ checkInt(this, value, offset, 1, 127, -128);
1502
+ if (value < 0)
1503
+ value = 255 + value + 1;
1504
+ this[offset] = value & 255;
1505
+ return offset + 1;
1506
+ };
1507
+ Buffer2.prototype.writeInt16LE = function writeInt16LE(value, offset, noAssert) {
1508
+ value = +value;
1509
+ offset = offset >>> 0;
1510
+ if (!noAssert)
1511
+ checkInt(this, value, offset, 2, 32767, -32768);
1512
+ this[offset] = value & 255;
1513
+ this[offset + 1] = value >>> 8;
1514
+ return offset + 2;
1515
+ };
1516
+ Buffer2.prototype.writeInt16BE = function writeInt16BE(value, offset, noAssert) {
1517
+ value = +value;
1518
+ offset = offset >>> 0;
1519
+ if (!noAssert)
1520
+ checkInt(this, value, offset, 2, 32767, -32768);
1521
+ this[offset] = value >>> 8;
1522
+ this[offset + 1] = value & 255;
1523
+ return offset + 2;
1524
+ };
1525
+ Buffer2.prototype.writeInt32LE = function writeInt32LE(value, offset, noAssert) {
1526
+ value = +value;
1527
+ offset = offset >>> 0;
1528
+ if (!noAssert)
1529
+ checkInt(this, value, offset, 4, 2147483647, -2147483648);
1530
+ this[offset] = value & 255;
1531
+ this[offset + 1] = value >>> 8;
1532
+ this[offset + 2] = value >>> 16;
1533
+ this[offset + 3] = value >>> 24;
1534
+ return offset + 4;
1535
+ };
1536
+ Buffer2.prototype.writeInt32BE = function writeInt32BE(value, offset, noAssert) {
1537
+ value = +value;
1538
+ offset = offset >>> 0;
1539
+ if (!noAssert)
1540
+ checkInt(this, value, offset, 4, 2147483647, -2147483648);
1541
+ if (value < 0)
1542
+ value = 4294967295 + value + 1;
1543
+ this[offset] = value >>> 24;
1544
+ this[offset + 1] = value >>> 16;
1545
+ this[offset + 2] = value >>> 8;
1546
+ this[offset + 3] = value & 255;
1547
+ return offset + 4;
1548
+ };
1549
+ Buffer2.prototype.writeBigInt64LE = defineBigIntMethod(function writeBigInt64LE(value, offset = 0) {
1550
+ return wrtBigUInt64LE(this, value, offset, -BigInt("0x8000000000000000"), BigInt("0x7fffffffffffffff"));
1551
+ });
1552
+ Buffer2.prototype.writeBigInt64BE = defineBigIntMethod(function writeBigInt64BE(value, offset = 0) {
1553
+ return wrtBigUInt64BE(this, value, offset, -BigInt("0x8000000000000000"), BigInt("0x7fffffffffffffff"));
1554
+ });
1555
+ function checkIEEE754(buf, value, offset, ext, max, min) {
1556
+ if (offset + ext > buf.length)
1557
+ throw new RangeError("Index out of range");
1558
+ if (offset < 0)
1559
+ throw new RangeError("Index out of range");
1560
+ }
1561
+ function writeFloat(buf, value, offset, littleEndian, noAssert) {
1562
+ value = +value;
1563
+ offset = offset >>> 0;
1564
+ if (!noAssert) {
1565
+ checkIEEE754(buf, value, offset, 4, 34028234663852886e22, -34028234663852886e22);
1566
+ }
1567
+ ieee754.write(buf, value, offset, littleEndian, 23, 4);
1568
+ return offset + 4;
1569
+ }
1570
+ Buffer2.prototype.writeFloatLE = function writeFloatLE(value, offset, noAssert) {
1571
+ return writeFloat(this, value, offset, true, noAssert);
1572
+ };
1573
+ Buffer2.prototype.writeFloatBE = function writeFloatBE(value, offset, noAssert) {
1574
+ return writeFloat(this, value, offset, false, noAssert);
1575
+ };
1576
+ function writeDouble(buf, value, offset, littleEndian, noAssert) {
1577
+ value = +value;
1578
+ offset = offset >>> 0;
1579
+ if (!noAssert) {
1580
+ checkIEEE754(buf, value, offset, 8, 17976931348623157e292, -17976931348623157e292);
1581
+ }
1582
+ ieee754.write(buf, value, offset, littleEndian, 52, 8);
1583
+ return offset + 8;
1584
+ }
1585
+ Buffer2.prototype.writeDoubleLE = function writeDoubleLE(value, offset, noAssert) {
1586
+ return writeDouble(this, value, offset, true, noAssert);
1587
+ };
1588
+ Buffer2.prototype.writeDoubleBE = function writeDoubleBE(value, offset, noAssert) {
1589
+ return writeDouble(this, value, offset, false, noAssert);
1590
+ };
1591
+ Buffer2.prototype.copy = function copy(target, targetStart, start, end) {
1592
+ if (!Buffer2.isBuffer(target))
1593
+ throw new TypeError("argument should be a Buffer");
1594
+ if (!start)
1595
+ start = 0;
1596
+ if (!end && end !== 0)
1597
+ end = this.length;
1598
+ if (targetStart >= target.length)
1599
+ targetStart = target.length;
1600
+ if (!targetStart)
1601
+ targetStart = 0;
1602
+ if (end > 0 && end < start)
1603
+ end = start;
1604
+ if (end === start)
1605
+ return 0;
1606
+ if (target.length === 0 || this.length === 0)
1607
+ return 0;
1608
+ if (targetStart < 0) {
1609
+ throw new RangeError("targetStart out of bounds");
1610
+ }
1611
+ if (start < 0 || start >= this.length)
1612
+ throw new RangeError("Index out of range");
1613
+ if (end < 0)
1614
+ throw new RangeError("sourceEnd out of bounds");
1615
+ if (end > this.length)
1616
+ end = this.length;
1617
+ if (target.length - targetStart < end - start) {
1618
+ end = target.length - targetStart + start;
1619
+ }
1620
+ const len = end - start;
1621
+ if (this === target && typeof Uint8Array.prototype.copyWithin === "function") {
1622
+ this.copyWithin(targetStart, start, end);
1623
+ } else {
1624
+ Uint8Array.prototype.set.call(
1625
+ target,
1626
+ this.subarray(start, end),
1627
+ targetStart
1628
+ );
1629
+ }
1630
+ return len;
1631
+ };
1632
+ Buffer2.prototype.fill = function fill(val, start, end, encoding) {
1633
+ if (typeof val === "string") {
1634
+ if (typeof start === "string") {
1635
+ encoding = start;
1636
+ start = 0;
1637
+ end = this.length;
1638
+ } else if (typeof end === "string") {
1639
+ encoding = end;
1640
+ end = this.length;
1641
+ }
1642
+ if (encoding !== void 0 && typeof encoding !== "string") {
1643
+ throw new TypeError("encoding must be a string");
1644
+ }
1645
+ if (typeof encoding === "string" && !Buffer2.isEncoding(encoding)) {
1646
+ throw new TypeError("Unknown encoding: " + encoding);
1647
+ }
1648
+ if (val.length === 1) {
1649
+ const code = val.charCodeAt(0);
1650
+ if (encoding === "utf8" && code < 128 || encoding === "latin1") {
1651
+ val = code;
1652
+ }
1653
+ }
1654
+ } else if (typeof val === "number") {
1655
+ val = val & 255;
1656
+ } else if (typeof val === "boolean") {
1657
+ val = Number(val);
1658
+ }
1659
+ if (start < 0 || this.length < start || this.length < end) {
1660
+ throw new RangeError("Out of range index");
1661
+ }
1662
+ if (end <= start) {
1663
+ return this;
1664
+ }
1665
+ start = start >>> 0;
1666
+ end = end === void 0 ? this.length : end >>> 0;
1667
+ if (!val)
1668
+ val = 0;
1669
+ let i;
1670
+ if (typeof val === "number") {
1671
+ for (i = start; i < end; ++i) {
1672
+ this[i] = val;
1673
+ }
1674
+ } else {
1675
+ const bytes = Buffer2.isBuffer(val) ? val : Buffer2.from(val, encoding);
1676
+ const len = bytes.length;
1677
+ if (len === 0) {
1678
+ throw new TypeError('The value "' + val + '" is invalid for argument "value"');
1679
+ }
1680
+ for (i = 0; i < end - start; ++i) {
1681
+ this[i + start] = bytes[i % len];
1682
+ }
1683
+ }
1684
+ return this;
1685
+ };
1686
+ var errors = {};
1687
+ function E(sym, getMessage, Base) {
1688
+ errors[sym] = class NodeError extends Base {
1689
+ constructor() {
1690
+ super();
1691
+ Object.defineProperty(this, "message", {
1692
+ value: getMessage.apply(this, arguments),
1693
+ writable: true,
1694
+ configurable: true
1695
+ });
1696
+ this.name = `${this.name} [${sym}]`;
1697
+ this.stack;
1698
+ delete this.name;
1699
+ }
1700
+ get code() {
1701
+ return sym;
1702
+ }
1703
+ set code(value) {
1704
+ Object.defineProperty(this, "code", {
1705
+ configurable: true,
1706
+ enumerable: true,
1707
+ value,
1708
+ writable: true
1709
+ });
1710
+ }
1711
+ toString() {
1712
+ return `${this.name} [${sym}]: ${this.message}`;
1713
+ }
1714
+ };
1715
+ }
1716
+ E(
1717
+ "ERR_BUFFER_OUT_OF_BOUNDS",
1718
+ function(name) {
1719
+ if (name) {
1720
+ return `${name} is outside of buffer bounds`;
1721
+ }
1722
+ return "Attempt to access memory outside buffer bounds";
1723
+ },
1724
+ RangeError
1725
+ );
1726
+ E(
1727
+ "ERR_INVALID_ARG_TYPE",
1728
+ function(name, actual) {
1729
+ return `The "${name}" argument must be of type number. Received type ${typeof actual}`;
1730
+ },
1731
+ TypeError
1732
+ );
1733
+ E(
1734
+ "ERR_OUT_OF_RANGE",
1735
+ function(str, range, input) {
1736
+ let msg = `The value of "${str}" is out of range.`;
1737
+ let received = input;
1738
+ if (Number.isInteger(input) && Math.abs(input) > 2 ** 32) {
1739
+ received = addNumericalSeparator(String(input));
1740
+ } else if (typeof input === "bigint") {
1741
+ received = String(input);
1742
+ if (input > BigInt(2) ** BigInt(32) || input < -(BigInt(2) ** BigInt(32))) {
1743
+ received = addNumericalSeparator(received);
1744
+ }
1745
+ received += "n";
1746
+ }
1747
+ msg += ` It must be ${range}. Received ${received}`;
1748
+ return msg;
1749
+ },
1750
+ RangeError
1751
+ );
1752
+ function addNumericalSeparator(val) {
1753
+ let res = "";
1754
+ let i = val.length;
1755
+ const start = val[0] === "-" ? 1 : 0;
1756
+ for (; i >= start + 4; i -= 3) {
1757
+ res = `_${val.slice(i - 3, i)}${res}`;
1758
+ }
1759
+ return `${val.slice(0, i)}${res}`;
1760
+ }
1761
+ function checkBounds(buf, offset, byteLength2) {
1762
+ validateNumber(offset, "offset");
1763
+ if (buf[offset] === void 0 || buf[offset + byteLength2] === void 0) {
1764
+ boundsError(offset, buf.length - (byteLength2 + 1));
1765
+ }
1766
+ }
1767
+ function checkIntBI(value, min, max, buf, offset, byteLength2) {
1768
+ if (value > max || value < min) {
1769
+ const n = typeof min === "bigint" ? "n" : "";
1770
+ let range;
1771
+ if (byteLength2 > 3) {
1772
+ if (min === 0 || min === BigInt(0)) {
1773
+ range = `>= 0${n} and < 2${n} ** ${(byteLength2 + 1) * 8}${n}`;
1774
+ } else {
1775
+ range = `>= -(2${n} ** ${(byteLength2 + 1) * 8 - 1}${n}) and < 2 ** ${(byteLength2 + 1) * 8 - 1}${n}`;
1776
+ }
1777
+ } else {
1778
+ range = `>= ${min}${n} and <= ${max}${n}`;
1779
+ }
1780
+ throw new errors.ERR_OUT_OF_RANGE("value", range, value);
1781
+ }
1782
+ checkBounds(buf, offset, byteLength2);
1783
+ }
1784
+ function validateNumber(value, name) {
1785
+ if (typeof value !== "number") {
1786
+ throw new errors.ERR_INVALID_ARG_TYPE(name, "number", value);
1787
+ }
1788
+ }
1789
+ function boundsError(value, length, type) {
1790
+ if (Math.floor(value) !== value) {
1791
+ validateNumber(value, type);
1792
+ throw new errors.ERR_OUT_OF_RANGE(type || "offset", "an integer", value);
1793
+ }
1794
+ if (length < 0) {
1795
+ throw new errors.ERR_BUFFER_OUT_OF_BOUNDS();
1796
+ }
1797
+ throw new errors.ERR_OUT_OF_RANGE(
1798
+ type || "offset",
1799
+ `>= ${type ? 1 : 0} and <= ${length}`,
1800
+ value
1801
+ );
1802
+ }
1803
+ var INVALID_BASE64_RE = /[^+/0-9A-Za-z-_]/g;
1804
+ function base64clean(str) {
1805
+ str = str.split("=")[0];
1806
+ str = str.trim().replace(INVALID_BASE64_RE, "");
1807
+ if (str.length < 2)
1808
+ return "";
1809
+ while (str.length % 4 !== 0) {
1810
+ str = str + "=";
1811
+ }
1812
+ return str;
1813
+ }
1814
+ function utf8ToBytes(string, units) {
1815
+ units = units || Infinity;
1816
+ let codePoint;
1817
+ const length = string.length;
1818
+ let leadSurrogate = null;
1819
+ const bytes = [];
1820
+ for (let i = 0; i < length; ++i) {
1821
+ codePoint = string.charCodeAt(i);
1822
+ if (codePoint > 55295 && codePoint < 57344) {
1823
+ if (!leadSurrogate) {
1824
+ if (codePoint > 56319) {
1825
+ if ((units -= 3) > -1)
1826
+ bytes.push(239, 191, 189);
1827
+ continue;
1828
+ } else if (i + 1 === length) {
1829
+ if ((units -= 3) > -1)
1830
+ bytes.push(239, 191, 189);
1831
+ continue;
1832
+ }
1833
+ leadSurrogate = codePoint;
1834
+ continue;
1835
+ }
1836
+ if (codePoint < 56320) {
1837
+ if ((units -= 3) > -1)
1838
+ bytes.push(239, 191, 189);
1839
+ leadSurrogate = codePoint;
1840
+ continue;
1841
+ }
1842
+ codePoint = (leadSurrogate - 55296 << 10 | codePoint - 56320) + 65536;
1843
+ } else if (leadSurrogate) {
1844
+ if ((units -= 3) > -1)
1845
+ bytes.push(239, 191, 189);
1846
+ }
1847
+ leadSurrogate = null;
1848
+ if (codePoint < 128) {
1849
+ if ((units -= 1) < 0)
1850
+ break;
1851
+ bytes.push(codePoint);
1852
+ } else if (codePoint < 2048) {
1853
+ if ((units -= 2) < 0)
1854
+ break;
1855
+ bytes.push(
1856
+ codePoint >> 6 | 192,
1857
+ codePoint & 63 | 128
1858
+ );
1859
+ } else if (codePoint < 65536) {
1860
+ if ((units -= 3) < 0)
1861
+ break;
1862
+ bytes.push(
1863
+ codePoint >> 12 | 224,
1864
+ codePoint >> 6 & 63 | 128,
1865
+ codePoint & 63 | 128
1866
+ );
1867
+ } else if (codePoint < 1114112) {
1868
+ if ((units -= 4) < 0)
1869
+ break;
1870
+ bytes.push(
1871
+ codePoint >> 18 | 240,
1872
+ codePoint >> 12 & 63 | 128,
1873
+ codePoint >> 6 & 63 | 128,
1874
+ codePoint & 63 | 128
1875
+ );
1876
+ } else {
1877
+ throw new Error("Invalid code point");
1878
+ }
1879
+ }
1880
+ return bytes;
1881
+ }
1882
+ function asciiToBytes(str) {
1883
+ const byteArray = [];
1884
+ for (let i = 0; i < str.length; ++i) {
1885
+ byteArray.push(str.charCodeAt(i) & 255);
1886
+ }
1887
+ return byteArray;
1888
+ }
1889
+ function utf16leToBytes(str, units) {
1890
+ let c, hi, lo;
1891
+ const byteArray = [];
1892
+ for (let i = 0; i < str.length; ++i) {
1893
+ if ((units -= 2) < 0)
1894
+ break;
1895
+ c = str.charCodeAt(i);
1896
+ hi = c >> 8;
1897
+ lo = c % 256;
1898
+ byteArray.push(lo);
1899
+ byteArray.push(hi);
1900
+ }
1901
+ return byteArray;
1902
+ }
1903
+ function base64ToBytes(str) {
1904
+ return base64.toByteArray(base64clean(str));
1905
+ }
1906
+ function blitBuffer(src, dst, offset, length) {
1907
+ let i;
1908
+ for (i = 0; i < length; ++i) {
1909
+ if (i + offset >= dst.length || i >= src.length)
1910
+ break;
1911
+ dst[i + offset] = src[i];
1912
+ }
1913
+ return i;
1914
+ }
1915
+ function isInstance(obj, type) {
1916
+ return obj instanceof type || obj != null && obj.constructor != null && obj.constructor.name != null && obj.constructor.name === type.name;
1917
+ }
1918
+ function numberIsNaN(obj) {
1919
+ return obj !== obj;
1920
+ }
1921
+ var hexSliceLookupTable = function() {
1922
+ const alphabet = "0123456789abcdef";
1923
+ const table = new Array(256);
1924
+ for (let i = 0; i < 16; ++i) {
1925
+ const i16 = i * 16;
1926
+ for (let j = 0; j < 16; ++j) {
1927
+ table[i16 + j] = alphabet[i] + alphabet[j];
1928
+ }
1929
+ }
1930
+ return table;
1931
+ }();
1932
+ function defineBigIntMethod(fn) {
1933
+ return typeof BigInt === "undefined" ? BufferBigIntNotDefined : fn;
1934
+ }
1935
+ function BufferBigIntNotDefined() {
1936
+ throw new Error("BigInt not supported");
1937
+ }
1938
+ }
1939
+ });
1940
+
1941
+ // ../../../../../../node_modules/safe-buffer/index.js
1942
+ var require_safe_buffer = __commonJS({
1943
+ "../../../../../../node_modules/safe-buffer/index.js"(exports, module) {
1944
+ var buffer = require_buffer();
1945
+ var Buffer2 = buffer.Buffer;
1946
+ function copyProps(src, dst) {
1947
+ for (var key in src) {
1948
+ dst[key] = src[key];
1949
+ }
1950
+ }
1951
+ if (Buffer2.from && Buffer2.alloc && Buffer2.allocUnsafe && Buffer2.allocUnsafeSlow) {
1952
+ module.exports = buffer;
1953
+ } else {
1954
+ copyProps(buffer, exports);
1955
+ exports.Buffer = SafeBuffer;
1956
+ }
1957
+ function SafeBuffer(arg, encodingOrOffset, length) {
1958
+ return Buffer2(arg, encodingOrOffset, length);
1959
+ }
1960
+ SafeBuffer.prototype = Object.create(Buffer2.prototype);
1961
+ copyProps(Buffer2, SafeBuffer);
1962
+ SafeBuffer.from = function(arg, encodingOrOffset, length) {
1963
+ if (typeof arg === "number") {
1964
+ throw new TypeError("Argument must not be a number");
1965
+ }
1966
+ return Buffer2(arg, encodingOrOffset, length);
1967
+ };
1968
+ SafeBuffer.alloc = function(size, fill, encoding) {
1969
+ if (typeof size !== "number") {
1970
+ throw new TypeError("Argument must be a number");
1971
+ }
1972
+ var buf = Buffer2(size);
1973
+ if (fill !== void 0) {
1974
+ if (typeof encoding === "string") {
1975
+ buf.fill(fill, encoding);
1976
+ } else {
1977
+ buf.fill(fill);
1978
+ }
1979
+ } else {
1980
+ buf.fill(0);
1981
+ }
1982
+ return buf;
1983
+ };
1984
+ SafeBuffer.allocUnsafe = function(size) {
1985
+ if (typeof size !== "number") {
1986
+ throw new TypeError("Argument must be a number");
1987
+ }
1988
+ return Buffer2(size);
1989
+ };
1990
+ SafeBuffer.allocUnsafeSlow = function(size) {
1991
+ if (typeof size !== "number") {
1992
+ throw new TypeError("Argument must be a number");
1993
+ }
1994
+ return buffer.SlowBuffer(size);
1995
+ };
1996
+ }
1997
+ });
1998
+
1999
+ // ../../../../../../node_modules/sha.js/hash.js
2000
+ var require_hash = __commonJS({
2001
+ "../../../../../../node_modules/sha.js/hash.js"(exports, module) {
2002
+ var Buffer2 = require_safe_buffer().Buffer;
2003
+ function Hash(blockSize, finalSize) {
2004
+ this._block = Buffer2.alloc(blockSize);
2005
+ this._finalSize = finalSize;
2006
+ this._blockSize = blockSize;
2007
+ this._len = 0;
2008
+ }
2009
+ Hash.prototype.update = function(data, enc) {
2010
+ if (typeof data === "string") {
2011
+ enc = enc || "utf8";
2012
+ data = Buffer2.from(data, enc);
2013
+ }
2014
+ var block = this._block;
2015
+ var blockSize = this._blockSize;
2016
+ var length = data.length;
2017
+ var accum = this._len;
2018
+ for (var offset = 0; offset < length; ) {
2019
+ var assigned = accum % blockSize;
2020
+ var remainder = Math.min(length - offset, blockSize - assigned);
2021
+ for (var i = 0; i < remainder; i++) {
2022
+ block[assigned + i] = data[offset + i];
2023
+ }
2024
+ accum += remainder;
2025
+ offset += remainder;
2026
+ if (accum % blockSize === 0) {
2027
+ this._update(block);
2028
+ }
2029
+ }
2030
+ this._len += length;
2031
+ return this;
2032
+ };
2033
+ Hash.prototype.digest = function(enc) {
2034
+ var rem = this._len % this._blockSize;
2035
+ this._block[rem] = 128;
2036
+ this._block.fill(0, rem + 1);
2037
+ if (rem >= this._finalSize) {
2038
+ this._update(this._block);
2039
+ this._block.fill(0);
2040
+ }
2041
+ var bits = this._len * 8;
2042
+ if (bits <= 4294967295) {
2043
+ this._block.writeUInt32BE(bits, this._blockSize - 4);
2044
+ } else {
2045
+ var lowBits = (bits & 4294967295) >>> 0;
2046
+ var highBits = (bits - lowBits) / 4294967296;
2047
+ this._block.writeUInt32BE(highBits, this._blockSize - 8);
2048
+ this._block.writeUInt32BE(lowBits, this._blockSize - 4);
2049
+ }
2050
+ this._update(this._block);
2051
+ var hash = this._hash();
2052
+ return enc ? hash.toString(enc) : hash;
2053
+ };
2054
+ Hash.prototype._update = function() {
2055
+ throw new Error("_update must be implemented by subclass");
2056
+ };
2057
+ module.exports = Hash;
2058
+ }
2059
+ });
2060
+
2061
+ // ../../../../../../node_modules/sha.js/sha.js
2062
+ var require_sha = __commonJS({
2063
+ "../../../../../../node_modules/sha.js/sha.js"(exports, module) {
2064
+ var inherits = require_inherits_browser();
2065
+ var Hash = require_hash();
2066
+ var Buffer2 = require_safe_buffer().Buffer;
2067
+ var K = [
2068
+ 1518500249,
2069
+ 1859775393,
2070
+ 2400959708 | 0,
2071
+ 3395469782 | 0
2072
+ ];
2073
+ var W = new Array(80);
2074
+ function Sha() {
2075
+ this.init();
2076
+ this._w = W;
2077
+ Hash.call(this, 64, 56);
2078
+ }
2079
+ inherits(Sha, Hash);
2080
+ Sha.prototype.init = function() {
2081
+ this._a = 1732584193;
2082
+ this._b = 4023233417;
2083
+ this._c = 2562383102;
2084
+ this._d = 271733878;
2085
+ this._e = 3285377520;
2086
+ return this;
2087
+ };
2088
+ function rotl5(num) {
2089
+ return num << 5 | num >>> 27;
2090
+ }
2091
+ function rotl30(num) {
2092
+ return num << 30 | num >>> 2;
2093
+ }
2094
+ function ft(s, b, c, d) {
2095
+ if (s === 0)
2096
+ return b & c | ~b & d;
2097
+ if (s === 2)
2098
+ return b & c | b & d | c & d;
2099
+ return b ^ c ^ d;
2100
+ }
2101
+ Sha.prototype._update = function(M) {
2102
+ var W2 = this._w;
2103
+ var a = this._a | 0;
2104
+ var b = this._b | 0;
2105
+ var c = this._c | 0;
2106
+ var d = this._d | 0;
2107
+ var e = this._e | 0;
2108
+ for (var i = 0; i < 16; ++i)
2109
+ W2[i] = M.readInt32BE(i * 4);
2110
+ for (; i < 80; ++i)
2111
+ W2[i] = W2[i - 3] ^ W2[i - 8] ^ W2[i - 14] ^ W2[i - 16];
2112
+ for (var j = 0; j < 80; ++j) {
2113
+ var s = ~~(j / 20);
2114
+ var t = rotl5(a) + ft(s, b, c, d) + e + W2[j] + K[s] | 0;
2115
+ e = d;
2116
+ d = c;
2117
+ c = rotl30(b);
2118
+ b = a;
2119
+ a = t;
2120
+ }
2121
+ this._a = a + this._a | 0;
2122
+ this._b = b + this._b | 0;
2123
+ this._c = c + this._c | 0;
2124
+ this._d = d + this._d | 0;
2125
+ this._e = e + this._e | 0;
2126
+ };
2127
+ Sha.prototype._hash = function() {
2128
+ var H = Buffer2.allocUnsafe(20);
2129
+ H.writeInt32BE(this._a | 0, 0);
2130
+ H.writeInt32BE(this._b | 0, 4);
2131
+ H.writeInt32BE(this._c | 0, 8);
2132
+ H.writeInt32BE(this._d | 0, 12);
2133
+ H.writeInt32BE(this._e | 0, 16);
2134
+ return H;
2135
+ };
2136
+ module.exports = Sha;
2137
+ }
2138
+ });
2139
+
2140
+ // ../../../../../../node_modules/sha.js/sha1.js
2141
+ var require_sha1 = __commonJS({
2142
+ "../../../../../../node_modules/sha.js/sha1.js"(exports, module) {
2143
+ var inherits = require_inherits_browser();
2144
+ var Hash = require_hash();
2145
+ var Buffer2 = require_safe_buffer().Buffer;
2146
+ var K = [
2147
+ 1518500249,
2148
+ 1859775393,
2149
+ 2400959708 | 0,
2150
+ 3395469782 | 0
2151
+ ];
2152
+ var W = new Array(80);
2153
+ function Sha1() {
2154
+ this.init();
2155
+ this._w = W;
2156
+ Hash.call(this, 64, 56);
2157
+ }
2158
+ inherits(Sha1, Hash);
2159
+ Sha1.prototype.init = function() {
2160
+ this._a = 1732584193;
2161
+ this._b = 4023233417;
2162
+ this._c = 2562383102;
2163
+ this._d = 271733878;
2164
+ this._e = 3285377520;
2165
+ return this;
2166
+ };
2167
+ function rotl1(num) {
2168
+ return num << 1 | num >>> 31;
2169
+ }
2170
+ function rotl5(num) {
2171
+ return num << 5 | num >>> 27;
2172
+ }
2173
+ function rotl30(num) {
2174
+ return num << 30 | num >>> 2;
2175
+ }
2176
+ function ft(s, b, c, d) {
2177
+ if (s === 0)
2178
+ return b & c | ~b & d;
2179
+ if (s === 2)
2180
+ return b & c | b & d | c & d;
2181
+ return b ^ c ^ d;
2182
+ }
2183
+ Sha1.prototype._update = function(M) {
2184
+ var W2 = this._w;
2185
+ var a = this._a | 0;
2186
+ var b = this._b | 0;
2187
+ var c = this._c | 0;
2188
+ var d = this._d | 0;
2189
+ var e = this._e | 0;
2190
+ for (var i = 0; i < 16; ++i)
2191
+ W2[i] = M.readInt32BE(i * 4);
2192
+ for (; i < 80; ++i)
2193
+ W2[i] = rotl1(W2[i - 3] ^ W2[i - 8] ^ W2[i - 14] ^ W2[i - 16]);
2194
+ for (var j = 0; j < 80; ++j) {
2195
+ var s = ~~(j / 20);
2196
+ var t = rotl5(a) + ft(s, b, c, d) + e + W2[j] + K[s] | 0;
2197
+ e = d;
2198
+ d = c;
2199
+ c = rotl30(b);
2200
+ b = a;
2201
+ a = t;
2202
+ }
2203
+ this._a = a + this._a | 0;
2204
+ this._b = b + this._b | 0;
2205
+ this._c = c + this._c | 0;
2206
+ this._d = d + this._d | 0;
2207
+ this._e = e + this._e | 0;
2208
+ };
2209
+ Sha1.prototype._hash = function() {
2210
+ var H = Buffer2.allocUnsafe(20);
2211
+ H.writeInt32BE(this._a | 0, 0);
2212
+ H.writeInt32BE(this._b | 0, 4);
2213
+ H.writeInt32BE(this._c | 0, 8);
2214
+ H.writeInt32BE(this._d | 0, 12);
2215
+ H.writeInt32BE(this._e | 0, 16);
2216
+ return H;
2217
+ };
2218
+ module.exports = Sha1;
2219
+ }
2220
+ });
2221
+
2222
+ // ../../../../../../node_modules/sha.js/sha256.js
2223
+ var require_sha256 = __commonJS({
2224
+ "../../../../../../node_modules/sha.js/sha256.js"(exports, module) {
2225
+ var inherits = require_inherits_browser();
2226
+ var Hash = require_hash();
2227
+ var Buffer2 = require_safe_buffer().Buffer;
2228
+ var K = [
2229
+ 1116352408,
2230
+ 1899447441,
2231
+ 3049323471,
2232
+ 3921009573,
2233
+ 961987163,
2234
+ 1508970993,
2235
+ 2453635748,
2236
+ 2870763221,
2237
+ 3624381080,
2238
+ 310598401,
2239
+ 607225278,
2240
+ 1426881987,
2241
+ 1925078388,
2242
+ 2162078206,
2243
+ 2614888103,
2244
+ 3248222580,
2245
+ 3835390401,
2246
+ 4022224774,
2247
+ 264347078,
2248
+ 604807628,
2249
+ 770255983,
2250
+ 1249150122,
2251
+ 1555081692,
2252
+ 1996064986,
2253
+ 2554220882,
2254
+ 2821834349,
2255
+ 2952996808,
2256
+ 3210313671,
2257
+ 3336571891,
2258
+ 3584528711,
2259
+ 113926993,
2260
+ 338241895,
2261
+ 666307205,
2262
+ 773529912,
2263
+ 1294757372,
2264
+ 1396182291,
2265
+ 1695183700,
2266
+ 1986661051,
2267
+ 2177026350,
2268
+ 2456956037,
2269
+ 2730485921,
2270
+ 2820302411,
2271
+ 3259730800,
2272
+ 3345764771,
2273
+ 3516065817,
2274
+ 3600352804,
2275
+ 4094571909,
2276
+ 275423344,
2277
+ 430227734,
2278
+ 506948616,
2279
+ 659060556,
2280
+ 883997877,
2281
+ 958139571,
2282
+ 1322822218,
2283
+ 1537002063,
2284
+ 1747873779,
2285
+ 1955562222,
2286
+ 2024104815,
2287
+ 2227730452,
2288
+ 2361852424,
2289
+ 2428436474,
2290
+ 2756734187,
2291
+ 3204031479,
2292
+ 3329325298
2293
+ ];
2294
+ var W = new Array(64);
2295
+ function Sha256() {
2296
+ this.init();
2297
+ this._w = W;
2298
+ Hash.call(this, 64, 56);
2299
+ }
2300
+ inherits(Sha256, Hash);
2301
+ Sha256.prototype.init = function() {
2302
+ this._a = 1779033703;
2303
+ this._b = 3144134277;
2304
+ this._c = 1013904242;
2305
+ this._d = 2773480762;
2306
+ this._e = 1359893119;
2307
+ this._f = 2600822924;
2308
+ this._g = 528734635;
2309
+ this._h = 1541459225;
2310
+ return this;
2311
+ };
2312
+ function ch(x, y, z) {
2313
+ return z ^ x & (y ^ z);
2314
+ }
2315
+ function maj(x, y, z) {
2316
+ return x & y | z & (x | y);
2317
+ }
2318
+ function sigma0(x) {
2319
+ return (x >>> 2 | x << 30) ^ (x >>> 13 | x << 19) ^ (x >>> 22 | x << 10);
2320
+ }
2321
+ function sigma1(x) {
2322
+ return (x >>> 6 | x << 26) ^ (x >>> 11 | x << 21) ^ (x >>> 25 | x << 7);
2323
+ }
2324
+ function gamma0(x) {
2325
+ return (x >>> 7 | x << 25) ^ (x >>> 18 | x << 14) ^ x >>> 3;
2326
+ }
2327
+ function gamma1(x) {
2328
+ return (x >>> 17 | x << 15) ^ (x >>> 19 | x << 13) ^ x >>> 10;
2329
+ }
2330
+ Sha256.prototype._update = function(M) {
2331
+ var W2 = this._w;
2332
+ var a = this._a | 0;
2333
+ var b = this._b | 0;
2334
+ var c = this._c | 0;
2335
+ var d = this._d | 0;
2336
+ var e = this._e | 0;
2337
+ var f = this._f | 0;
2338
+ var g = this._g | 0;
2339
+ var h = this._h | 0;
2340
+ for (var i = 0; i < 16; ++i)
2341
+ W2[i] = M.readInt32BE(i * 4);
2342
+ for (; i < 64; ++i)
2343
+ W2[i] = gamma1(W2[i - 2]) + W2[i - 7] + gamma0(W2[i - 15]) + W2[i - 16] | 0;
2344
+ for (var j = 0; j < 64; ++j) {
2345
+ var T1 = h + sigma1(e) + ch(e, f, g) + K[j] + W2[j] | 0;
2346
+ var T2 = sigma0(a) + maj(a, b, c) | 0;
2347
+ h = g;
2348
+ g = f;
2349
+ f = e;
2350
+ e = d + T1 | 0;
2351
+ d = c;
2352
+ c = b;
2353
+ b = a;
2354
+ a = T1 + T2 | 0;
2355
+ }
2356
+ this._a = a + this._a | 0;
2357
+ this._b = b + this._b | 0;
2358
+ this._c = c + this._c | 0;
2359
+ this._d = d + this._d | 0;
2360
+ this._e = e + this._e | 0;
2361
+ this._f = f + this._f | 0;
2362
+ this._g = g + this._g | 0;
2363
+ this._h = h + this._h | 0;
2364
+ };
2365
+ Sha256.prototype._hash = function() {
2366
+ var H = Buffer2.allocUnsafe(32);
2367
+ H.writeInt32BE(this._a, 0);
2368
+ H.writeInt32BE(this._b, 4);
2369
+ H.writeInt32BE(this._c, 8);
2370
+ H.writeInt32BE(this._d, 12);
2371
+ H.writeInt32BE(this._e, 16);
2372
+ H.writeInt32BE(this._f, 20);
2373
+ H.writeInt32BE(this._g, 24);
2374
+ H.writeInt32BE(this._h, 28);
2375
+ return H;
2376
+ };
2377
+ module.exports = Sha256;
2378
+ }
2379
+ });
2380
+
2381
+ // ../../../../../../node_modules/sha.js/sha224.js
2382
+ var require_sha224 = __commonJS({
2383
+ "../../../../../../node_modules/sha.js/sha224.js"(exports, module) {
2384
+ var inherits = require_inherits_browser();
2385
+ var Sha256 = require_sha256();
2386
+ var Hash = require_hash();
2387
+ var Buffer2 = require_safe_buffer().Buffer;
2388
+ var W = new Array(64);
2389
+ function Sha224() {
2390
+ this.init();
2391
+ this._w = W;
2392
+ Hash.call(this, 64, 56);
2393
+ }
2394
+ inherits(Sha224, Sha256);
2395
+ Sha224.prototype.init = function() {
2396
+ this._a = 3238371032;
2397
+ this._b = 914150663;
2398
+ this._c = 812702999;
2399
+ this._d = 4144912697;
2400
+ this._e = 4290775857;
2401
+ this._f = 1750603025;
2402
+ this._g = 1694076839;
2403
+ this._h = 3204075428;
2404
+ return this;
2405
+ };
2406
+ Sha224.prototype._hash = function() {
2407
+ var H = Buffer2.allocUnsafe(28);
2408
+ H.writeInt32BE(this._a, 0);
2409
+ H.writeInt32BE(this._b, 4);
2410
+ H.writeInt32BE(this._c, 8);
2411
+ H.writeInt32BE(this._d, 12);
2412
+ H.writeInt32BE(this._e, 16);
2413
+ H.writeInt32BE(this._f, 20);
2414
+ H.writeInt32BE(this._g, 24);
2415
+ return H;
2416
+ };
2417
+ module.exports = Sha224;
2418
+ }
2419
+ });
2420
+
2421
+ // ../../../../../../node_modules/sha.js/sha512.js
2422
+ var require_sha512 = __commonJS({
2423
+ "../../../../../../node_modules/sha.js/sha512.js"(exports, module) {
2424
+ var inherits = require_inherits_browser();
2425
+ var Hash = require_hash();
2426
+ var Buffer2 = require_safe_buffer().Buffer;
2427
+ var K = [
2428
+ 1116352408,
2429
+ 3609767458,
2430
+ 1899447441,
2431
+ 602891725,
2432
+ 3049323471,
2433
+ 3964484399,
2434
+ 3921009573,
2435
+ 2173295548,
2436
+ 961987163,
2437
+ 4081628472,
2438
+ 1508970993,
2439
+ 3053834265,
2440
+ 2453635748,
2441
+ 2937671579,
2442
+ 2870763221,
2443
+ 3664609560,
2444
+ 3624381080,
2445
+ 2734883394,
2446
+ 310598401,
2447
+ 1164996542,
2448
+ 607225278,
2449
+ 1323610764,
2450
+ 1426881987,
2451
+ 3590304994,
2452
+ 1925078388,
2453
+ 4068182383,
2454
+ 2162078206,
2455
+ 991336113,
2456
+ 2614888103,
2457
+ 633803317,
2458
+ 3248222580,
2459
+ 3479774868,
2460
+ 3835390401,
2461
+ 2666613458,
2462
+ 4022224774,
2463
+ 944711139,
2464
+ 264347078,
2465
+ 2341262773,
2466
+ 604807628,
2467
+ 2007800933,
2468
+ 770255983,
2469
+ 1495990901,
2470
+ 1249150122,
2471
+ 1856431235,
2472
+ 1555081692,
2473
+ 3175218132,
2474
+ 1996064986,
2475
+ 2198950837,
2476
+ 2554220882,
2477
+ 3999719339,
2478
+ 2821834349,
2479
+ 766784016,
2480
+ 2952996808,
2481
+ 2566594879,
2482
+ 3210313671,
2483
+ 3203337956,
2484
+ 3336571891,
2485
+ 1034457026,
2486
+ 3584528711,
2487
+ 2466948901,
2488
+ 113926993,
2489
+ 3758326383,
2490
+ 338241895,
2491
+ 168717936,
2492
+ 666307205,
2493
+ 1188179964,
2494
+ 773529912,
2495
+ 1546045734,
2496
+ 1294757372,
2497
+ 1522805485,
2498
+ 1396182291,
2499
+ 2643833823,
2500
+ 1695183700,
2501
+ 2343527390,
2502
+ 1986661051,
2503
+ 1014477480,
2504
+ 2177026350,
2505
+ 1206759142,
2506
+ 2456956037,
2507
+ 344077627,
2508
+ 2730485921,
2509
+ 1290863460,
2510
+ 2820302411,
2511
+ 3158454273,
2512
+ 3259730800,
2513
+ 3505952657,
2514
+ 3345764771,
2515
+ 106217008,
2516
+ 3516065817,
2517
+ 3606008344,
2518
+ 3600352804,
2519
+ 1432725776,
2520
+ 4094571909,
2521
+ 1467031594,
2522
+ 275423344,
2523
+ 851169720,
2524
+ 430227734,
2525
+ 3100823752,
2526
+ 506948616,
2527
+ 1363258195,
2528
+ 659060556,
2529
+ 3750685593,
2530
+ 883997877,
2531
+ 3785050280,
2532
+ 958139571,
2533
+ 3318307427,
2534
+ 1322822218,
2535
+ 3812723403,
2536
+ 1537002063,
2537
+ 2003034995,
2538
+ 1747873779,
2539
+ 3602036899,
2540
+ 1955562222,
2541
+ 1575990012,
2542
+ 2024104815,
2543
+ 1125592928,
2544
+ 2227730452,
2545
+ 2716904306,
2546
+ 2361852424,
2547
+ 442776044,
2548
+ 2428436474,
2549
+ 593698344,
2550
+ 2756734187,
2551
+ 3733110249,
2552
+ 3204031479,
2553
+ 2999351573,
2554
+ 3329325298,
2555
+ 3815920427,
2556
+ 3391569614,
2557
+ 3928383900,
2558
+ 3515267271,
2559
+ 566280711,
2560
+ 3940187606,
2561
+ 3454069534,
2562
+ 4118630271,
2563
+ 4000239992,
2564
+ 116418474,
2565
+ 1914138554,
2566
+ 174292421,
2567
+ 2731055270,
2568
+ 289380356,
2569
+ 3203993006,
2570
+ 460393269,
2571
+ 320620315,
2572
+ 685471733,
2573
+ 587496836,
2574
+ 852142971,
2575
+ 1086792851,
2576
+ 1017036298,
2577
+ 365543100,
2578
+ 1126000580,
2579
+ 2618297676,
2580
+ 1288033470,
2581
+ 3409855158,
2582
+ 1501505948,
2583
+ 4234509866,
2584
+ 1607167915,
2585
+ 987167468,
2586
+ 1816402316,
2587
+ 1246189591
2588
+ ];
2589
+ var W = new Array(160);
2590
+ function Sha512() {
2591
+ this.init();
2592
+ this._w = W;
2593
+ Hash.call(this, 128, 112);
2594
+ }
2595
+ inherits(Sha512, Hash);
2596
+ Sha512.prototype.init = function() {
2597
+ this._ah = 1779033703;
2598
+ this._bh = 3144134277;
2599
+ this._ch = 1013904242;
2600
+ this._dh = 2773480762;
2601
+ this._eh = 1359893119;
2602
+ this._fh = 2600822924;
2603
+ this._gh = 528734635;
2604
+ this._hh = 1541459225;
2605
+ this._al = 4089235720;
2606
+ this._bl = 2227873595;
2607
+ this._cl = 4271175723;
2608
+ this._dl = 1595750129;
2609
+ this._el = 2917565137;
2610
+ this._fl = 725511199;
2611
+ this._gl = 4215389547;
2612
+ this._hl = 327033209;
2613
+ return this;
2614
+ };
2615
+ function Ch(x, y, z) {
2616
+ return z ^ x & (y ^ z);
2617
+ }
2618
+ function maj(x, y, z) {
2619
+ return x & y | z & (x | y);
2620
+ }
2621
+ function sigma0(x, xl) {
2622
+ return (x >>> 28 | xl << 4) ^ (xl >>> 2 | x << 30) ^ (xl >>> 7 | x << 25);
2623
+ }
2624
+ function sigma1(x, xl) {
2625
+ return (x >>> 14 | xl << 18) ^ (x >>> 18 | xl << 14) ^ (xl >>> 9 | x << 23);
2626
+ }
2627
+ function Gamma0(x, xl) {
2628
+ return (x >>> 1 | xl << 31) ^ (x >>> 8 | xl << 24) ^ x >>> 7;
2629
+ }
2630
+ function Gamma0l(x, xl) {
2631
+ return (x >>> 1 | xl << 31) ^ (x >>> 8 | xl << 24) ^ (x >>> 7 | xl << 25);
2632
+ }
2633
+ function Gamma1(x, xl) {
2634
+ return (x >>> 19 | xl << 13) ^ (xl >>> 29 | x << 3) ^ x >>> 6;
2635
+ }
2636
+ function Gamma1l(x, xl) {
2637
+ return (x >>> 19 | xl << 13) ^ (xl >>> 29 | x << 3) ^ (x >>> 6 | xl << 26);
2638
+ }
2639
+ function getCarry(a, b) {
2640
+ return a >>> 0 < b >>> 0 ? 1 : 0;
2641
+ }
2642
+ Sha512.prototype._update = function(M) {
2643
+ var W2 = this._w;
2644
+ var ah = this._ah | 0;
2645
+ var bh = this._bh | 0;
2646
+ var ch = this._ch | 0;
2647
+ var dh = this._dh | 0;
2648
+ var eh = this._eh | 0;
2649
+ var fh = this._fh | 0;
2650
+ var gh = this._gh | 0;
2651
+ var hh = this._hh | 0;
2652
+ var al = this._al | 0;
2653
+ var bl = this._bl | 0;
2654
+ var cl = this._cl | 0;
2655
+ var dl = this._dl | 0;
2656
+ var el = this._el | 0;
2657
+ var fl = this._fl | 0;
2658
+ var gl = this._gl | 0;
2659
+ var hl = this._hl | 0;
2660
+ for (var i = 0; i < 32; i += 2) {
2661
+ W2[i] = M.readInt32BE(i * 4);
2662
+ W2[i + 1] = M.readInt32BE(i * 4 + 4);
2663
+ }
2664
+ for (; i < 160; i += 2) {
2665
+ var xh = W2[i - 15 * 2];
2666
+ var xl = W2[i - 15 * 2 + 1];
2667
+ var gamma0 = Gamma0(xh, xl);
2668
+ var gamma0l = Gamma0l(xl, xh);
2669
+ xh = W2[i - 2 * 2];
2670
+ xl = W2[i - 2 * 2 + 1];
2671
+ var gamma1 = Gamma1(xh, xl);
2672
+ var gamma1l = Gamma1l(xl, xh);
2673
+ var Wi7h = W2[i - 7 * 2];
2674
+ var Wi7l = W2[i - 7 * 2 + 1];
2675
+ var Wi16h = W2[i - 16 * 2];
2676
+ var Wi16l = W2[i - 16 * 2 + 1];
2677
+ var Wil = gamma0l + Wi7l | 0;
2678
+ var Wih = gamma0 + Wi7h + getCarry(Wil, gamma0l) | 0;
2679
+ Wil = Wil + gamma1l | 0;
2680
+ Wih = Wih + gamma1 + getCarry(Wil, gamma1l) | 0;
2681
+ Wil = Wil + Wi16l | 0;
2682
+ Wih = Wih + Wi16h + getCarry(Wil, Wi16l) | 0;
2683
+ W2[i] = Wih;
2684
+ W2[i + 1] = Wil;
2685
+ }
2686
+ for (var j = 0; j < 160; j += 2) {
2687
+ Wih = W2[j];
2688
+ Wil = W2[j + 1];
2689
+ var majh = maj(ah, bh, ch);
2690
+ var majl = maj(al, bl, cl);
2691
+ var sigma0h = sigma0(ah, al);
2692
+ var sigma0l = sigma0(al, ah);
2693
+ var sigma1h = sigma1(eh, el);
2694
+ var sigma1l = sigma1(el, eh);
2695
+ var Kih = K[j];
2696
+ var Kil = K[j + 1];
2697
+ var chh = Ch(eh, fh, gh);
2698
+ var chl = Ch(el, fl, gl);
2699
+ var t1l = hl + sigma1l | 0;
2700
+ var t1h = hh + sigma1h + getCarry(t1l, hl) | 0;
2701
+ t1l = t1l + chl | 0;
2702
+ t1h = t1h + chh + getCarry(t1l, chl) | 0;
2703
+ t1l = t1l + Kil | 0;
2704
+ t1h = t1h + Kih + getCarry(t1l, Kil) | 0;
2705
+ t1l = t1l + Wil | 0;
2706
+ t1h = t1h + Wih + getCarry(t1l, Wil) | 0;
2707
+ var t2l = sigma0l + majl | 0;
2708
+ var t2h = sigma0h + majh + getCarry(t2l, sigma0l) | 0;
2709
+ hh = gh;
2710
+ hl = gl;
2711
+ gh = fh;
2712
+ gl = fl;
2713
+ fh = eh;
2714
+ fl = el;
2715
+ el = dl + t1l | 0;
2716
+ eh = dh + t1h + getCarry(el, dl) | 0;
2717
+ dh = ch;
2718
+ dl = cl;
2719
+ ch = bh;
2720
+ cl = bl;
2721
+ bh = ah;
2722
+ bl = al;
2723
+ al = t1l + t2l | 0;
2724
+ ah = t1h + t2h + getCarry(al, t1l) | 0;
2725
+ }
2726
+ this._al = this._al + al | 0;
2727
+ this._bl = this._bl + bl | 0;
2728
+ this._cl = this._cl + cl | 0;
2729
+ this._dl = this._dl + dl | 0;
2730
+ this._el = this._el + el | 0;
2731
+ this._fl = this._fl + fl | 0;
2732
+ this._gl = this._gl + gl | 0;
2733
+ this._hl = this._hl + hl | 0;
2734
+ this._ah = this._ah + ah + getCarry(this._al, al) | 0;
2735
+ this._bh = this._bh + bh + getCarry(this._bl, bl) | 0;
2736
+ this._ch = this._ch + ch + getCarry(this._cl, cl) | 0;
2737
+ this._dh = this._dh + dh + getCarry(this._dl, dl) | 0;
2738
+ this._eh = this._eh + eh + getCarry(this._el, el) | 0;
2739
+ this._fh = this._fh + fh + getCarry(this._fl, fl) | 0;
2740
+ this._gh = this._gh + gh + getCarry(this._gl, gl) | 0;
2741
+ this._hh = this._hh + hh + getCarry(this._hl, hl) | 0;
2742
+ };
2743
+ Sha512.prototype._hash = function() {
2744
+ var H = Buffer2.allocUnsafe(64);
2745
+ function writeInt64BE(h, l, offset) {
2746
+ H.writeInt32BE(h, offset);
2747
+ H.writeInt32BE(l, offset + 4);
2748
+ }
2749
+ writeInt64BE(this._ah, this._al, 0);
2750
+ writeInt64BE(this._bh, this._bl, 8);
2751
+ writeInt64BE(this._ch, this._cl, 16);
2752
+ writeInt64BE(this._dh, this._dl, 24);
2753
+ writeInt64BE(this._eh, this._el, 32);
2754
+ writeInt64BE(this._fh, this._fl, 40);
2755
+ writeInt64BE(this._gh, this._gl, 48);
2756
+ writeInt64BE(this._hh, this._hl, 56);
2757
+ return H;
2758
+ };
2759
+ module.exports = Sha512;
2760
+ }
2761
+ });
2762
+
2763
+ // ../../../../../../node_modules/sha.js/sha384.js
2764
+ var require_sha384 = __commonJS({
2765
+ "../../../../../../node_modules/sha.js/sha384.js"(exports, module) {
2766
+ var inherits = require_inherits_browser();
2767
+ var SHA512 = require_sha512();
2768
+ var Hash = require_hash();
2769
+ var Buffer2 = require_safe_buffer().Buffer;
2770
+ var W = new Array(160);
2771
+ function Sha384() {
2772
+ this.init();
2773
+ this._w = W;
2774
+ Hash.call(this, 128, 112);
2775
+ }
2776
+ inherits(Sha384, SHA512);
2777
+ Sha384.prototype.init = function() {
2778
+ this._ah = 3418070365;
2779
+ this._bh = 1654270250;
2780
+ this._ch = 2438529370;
2781
+ this._dh = 355462360;
2782
+ this._eh = 1731405415;
2783
+ this._fh = 2394180231;
2784
+ this._gh = 3675008525;
2785
+ this._hh = 1203062813;
2786
+ this._al = 3238371032;
2787
+ this._bl = 914150663;
2788
+ this._cl = 812702999;
2789
+ this._dl = 4144912697;
2790
+ this._el = 4290775857;
2791
+ this._fl = 1750603025;
2792
+ this._gl = 1694076839;
2793
+ this._hl = 3204075428;
2794
+ return this;
2795
+ };
2796
+ Sha384.prototype._hash = function() {
2797
+ var H = Buffer2.allocUnsafe(48);
2798
+ function writeInt64BE(h, l, offset) {
2799
+ H.writeInt32BE(h, offset);
2800
+ H.writeInt32BE(l, offset + 4);
2801
+ }
2802
+ writeInt64BE(this._ah, this._al, 0);
2803
+ writeInt64BE(this._bh, this._bl, 8);
2804
+ writeInt64BE(this._ch, this._cl, 16);
2805
+ writeInt64BE(this._dh, this._dl, 24);
2806
+ writeInt64BE(this._eh, this._el, 32);
2807
+ writeInt64BE(this._fh, this._fl, 40);
2808
+ return H;
2809
+ };
2810
+ module.exports = Sha384;
2811
+ }
2812
+ });
2813
+
2814
+ // ../../../../../../node_modules/sha.js/index.js
2815
+ var require_sha2 = __commonJS({
2816
+ "../../../../../../node_modules/sha.js/index.js"(exports, module) {
2817
+ var exports = module.exports = function SHA(algorithm) {
2818
+ algorithm = algorithm.toLowerCase();
2819
+ var Algorithm = exports[algorithm];
2820
+ if (!Algorithm)
2821
+ throw new Error(algorithm + " is not supported (we accept pull requests)");
2822
+ return new Algorithm();
2823
+ };
2824
+ exports.sha = require_sha();
2825
+ exports.sha1 = require_sha1();
2826
+ exports.sha224 = require_sha224();
2827
+ exports.sha256 = require_sha256();
2828
+ exports.sha384 = require_sha384();
2829
+ exports.sha512 = require_sha512();
2830
+ }
2831
+ });
2832
+
2833
+ // ../../../../../../node_modules/is-observable/index.js
2834
+ var require_is_observable = __commonJS({
2835
+ "../../../../../../node_modules/is-observable/index.js"(exports, module) {
2836
+ "use strict";
2837
+ module.exports = (value) => {
2838
+ if (!value) {
2839
+ return false;
2840
+ }
2841
+ if (typeof Symbol.observable === "symbol" && typeof value[Symbol.observable] === "function") {
2842
+ return value === value[Symbol.observable]();
2843
+ }
2844
+ if (typeof value["@@observable"] === "function") {
2845
+ return value === value["@@observable"]();
2846
+ }
2847
+ return false;
2848
+ };
2849
+ }
2850
+ });
2851
+
2852
+ // ../../../../../../node_modules/threads/dist/serializers.js
2853
+ var require_serializers = __commonJS({
2854
+ "../../../../../../node_modules/threads/dist/serializers.js"(exports) {
2855
+ "use strict";
2856
+ Object.defineProperty(exports, "__esModule", { value: true });
2857
+ exports.DefaultSerializer = exports.extendSerializer = void 0;
2858
+ function extendSerializer(extend, implementation) {
2859
+ const fallbackDeserializer = extend.deserialize.bind(extend);
2860
+ const fallbackSerializer = extend.serialize.bind(extend);
2861
+ return {
2862
+ deserialize(message) {
2863
+ return implementation.deserialize(message, fallbackDeserializer);
2864
+ },
2865
+ serialize(input) {
2866
+ return implementation.serialize(input, fallbackSerializer);
2867
+ }
2868
+ };
2869
+ }
2870
+ exports.extendSerializer = extendSerializer;
2871
+ var DefaultErrorSerializer = {
2872
+ deserialize(message) {
2873
+ return Object.assign(Error(message.message), {
2874
+ name: message.name,
2875
+ stack: message.stack
2876
+ });
2877
+ },
2878
+ serialize(error) {
2879
+ return {
2880
+ __error_marker: "$$error",
2881
+ message: error.message,
2882
+ name: error.name,
2883
+ stack: error.stack
2884
+ };
2885
+ }
2886
+ };
2887
+ var isSerializedError = (thing) => thing && typeof thing === "object" && "__error_marker" in thing && thing.__error_marker === "$$error";
2888
+ exports.DefaultSerializer = {
2889
+ deserialize(message) {
2890
+ if (isSerializedError(message)) {
2891
+ return DefaultErrorSerializer.deserialize(message);
2892
+ } else {
2893
+ return message;
2894
+ }
2895
+ },
2896
+ serialize(input) {
2897
+ if (input instanceof Error) {
2898
+ return DefaultErrorSerializer.serialize(input);
2899
+ } else {
2900
+ return input;
2901
+ }
2902
+ }
2903
+ };
2904
+ }
2905
+ });
2906
+
2907
+ // ../../../../../../node_modules/threads/dist/common.js
2908
+ var require_common = __commonJS({
2909
+ "../../../../../../node_modules/threads/dist/common.js"(exports) {
2910
+ "use strict";
2911
+ Object.defineProperty(exports, "__esModule", { value: true });
2912
+ exports.serialize = exports.deserialize = exports.registerSerializer = void 0;
2913
+ var serializers_1 = require_serializers();
2914
+ var registeredSerializer = serializers_1.DefaultSerializer;
2915
+ function registerSerializer2(serializer) {
2916
+ registeredSerializer = serializers_1.extendSerializer(registeredSerializer, serializer);
2917
+ }
2918
+ exports.registerSerializer = registerSerializer2;
2919
+ function deserialize(message) {
2920
+ return registeredSerializer.deserialize(message);
2921
+ }
2922
+ exports.deserialize = deserialize;
2923
+ function serialize(input) {
2924
+ return registeredSerializer.serialize(input);
2925
+ }
2926
+ exports.serialize = serialize;
2927
+ }
2928
+ });
2929
+
2930
+ // ../../../../../../node_modules/threads/dist/symbols.js
2931
+ var require_symbols = __commonJS({
2932
+ "../../../../../../node_modules/threads/dist/symbols.js"(exports) {
2933
+ "use strict";
2934
+ Object.defineProperty(exports, "__esModule", { value: true });
2935
+ exports.$worker = exports.$transferable = exports.$terminate = exports.$events = exports.$errors = void 0;
2936
+ exports.$errors = Symbol("thread.errors");
2937
+ exports.$events = Symbol("thread.events");
2938
+ exports.$terminate = Symbol("thread.terminate");
2939
+ exports.$transferable = Symbol("thread.transferable");
2940
+ exports.$worker = Symbol("thread.worker");
2941
+ }
2942
+ });
2943
+
2944
+ // ../../../../../../node_modules/threads/dist/transferable.js
2945
+ var require_transferable = __commonJS({
2946
+ "../../../../../../node_modules/threads/dist/transferable.js"(exports) {
2947
+ "use strict";
2948
+ Object.defineProperty(exports, "__esModule", { value: true });
2949
+ exports.Transfer = exports.isTransferDescriptor = void 0;
2950
+ var symbols_1 = require_symbols();
2951
+ function isTransferable(thing) {
2952
+ if (!thing || typeof thing !== "object")
2953
+ return false;
2954
+ return true;
2955
+ }
2956
+ function isTransferDescriptor(thing) {
2957
+ return thing && typeof thing === "object" && thing[symbols_1.$transferable];
2958
+ }
2959
+ exports.isTransferDescriptor = isTransferDescriptor;
2960
+ function Transfer2(payload, transferables) {
2961
+ if (!transferables) {
2962
+ if (!isTransferable(payload))
2963
+ throw Error();
2964
+ transferables = [payload];
2965
+ }
2966
+ return {
2967
+ [symbols_1.$transferable]: true,
2968
+ send: payload,
2969
+ transferables
2970
+ };
2971
+ }
2972
+ exports.Transfer = Transfer2;
2973
+ }
2974
+ });
2975
+
2976
+ // ../../../../../../node_modules/threads/dist/types/messages.js
2977
+ var require_messages = __commonJS({
2978
+ "../../../../../../node_modules/threads/dist/types/messages.js"(exports) {
2979
+ "use strict";
2980
+ Object.defineProperty(exports, "__esModule", { value: true });
2981
+ exports.WorkerMessageType = exports.MasterMessageType = void 0;
2982
+ var MasterMessageType;
2983
+ (function(MasterMessageType2) {
2984
+ MasterMessageType2["cancel"] = "cancel";
2985
+ MasterMessageType2["run"] = "run";
2986
+ })(MasterMessageType = exports.MasterMessageType || (exports.MasterMessageType = {}));
2987
+ var WorkerMessageType;
2988
+ (function(WorkerMessageType2) {
2989
+ WorkerMessageType2["error"] = "error";
2990
+ WorkerMessageType2["init"] = "init";
2991
+ WorkerMessageType2["result"] = "result";
2992
+ WorkerMessageType2["running"] = "running";
2993
+ WorkerMessageType2["uncaughtError"] = "uncaughtError";
2994
+ })(WorkerMessageType = exports.WorkerMessageType || (exports.WorkerMessageType = {}));
2995
+ }
2996
+ });
2997
+
2998
+ // ../../../../../../node_modules/threads/dist/worker/implementation.browser.js
2999
+ var require_implementation_browser = __commonJS({
3000
+ "../../../../../../node_modules/threads/dist/worker/implementation.browser.js"(exports) {
3001
+ "use strict";
3002
+ Object.defineProperty(exports, "__esModule", { value: true });
3003
+ var isWorkerRuntime = function isWorkerRuntime2() {
3004
+ const isWindowContext = typeof self !== "undefined" && typeof Window !== "undefined" && self instanceof Window;
3005
+ return typeof self !== "undefined" && self.postMessage && !isWindowContext ? true : false;
3006
+ };
3007
+ var postMessageToMaster = function postMessageToMaster2(data, transferList) {
3008
+ self.postMessage(data, transferList);
3009
+ };
3010
+ var subscribeToMasterMessages = function subscribeToMasterMessages2(onMessage) {
3011
+ const messageHandler = (messageEvent) => {
3012
+ onMessage(messageEvent.data);
3013
+ };
3014
+ const unsubscribe = () => {
3015
+ self.removeEventListener("message", messageHandler);
3016
+ };
3017
+ self.addEventListener("message", messageHandler);
3018
+ return unsubscribe;
3019
+ };
3020
+ exports.default = {
3021
+ isWorkerRuntime,
3022
+ postMessageToMaster,
3023
+ subscribeToMasterMessages
3024
+ };
3025
+ }
3026
+ });
3027
+
3028
+ // ../../../../../../node_modules/threads/dist/worker/index.js
3029
+ var require_worker = __commonJS({
3030
+ "../../../../../../node_modules/threads/dist/worker/index.js"(exports) {
3031
+ "use strict";
3032
+ var __awaiter = exports && exports.__awaiter || function(thisArg, _arguments, P, generator) {
3033
+ function adopt(value) {
3034
+ return value instanceof P ? value : new P(function(resolve) {
3035
+ resolve(value);
3036
+ });
3037
+ }
3038
+ return new (P || (P = Promise))(function(resolve, reject) {
3039
+ function fulfilled(value) {
3040
+ try {
3041
+ step(generator.next(value));
3042
+ } catch (e) {
3043
+ reject(e);
3044
+ }
3045
+ }
3046
+ function rejected(value) {
3047
+ try {
3048
+ step(generator["throw"](value));
3049
+ } catch (e) {
3050
+ reject(e);
3051
+ }
3052
+ }
3053
+ function step(result) {
3054
+ result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);
3055
+ }
3056
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
3057
+ });
3058
+ };
3059
+ var __importDefault = exports && exports.__importDefault || function(mod) {
3060
+ return mod && mod.__esModule ? mod : { "default": mod };
3061
+ };
3062
+ Object.defineProperty(exports, "__esModule", { value: true });
3063
+ exports.expose = exports.isWorkerRuntime = exports.Transfer = exports.registerSerializer = void 0;
3064
+ var is_observable_1 = __importDefault(require_is_observable());
3065
+ var common_1 = require_common();
3066
+ var transferable_1 = require_transferable();
3067
+ var messages_1 = require_messages();
3068
+ var implementation_1 = __importDefault(require_implementation_browser());
3069
+ var common_2 = require_common();
3070
+ Object.defineProperty(exports, "registerSerializer", { enumerable: true, get: function() {
3071
+ return common_2.registerSerializer;
3072
+ } });
3073
+ var transferable_2 = require_transferable();
3074
+ Object.defineProperty(exports, "Transfer", { enumerable: true, get: function() {
3075
+ return transferable_2.Transfer;
3076
+ } });
3077
+ exports.isWorkerRuntime = implementation_1.default.isWorkerRuntime;
3078
+ var exposeCalled = false;
3079
+ var activeSubscriptions = /* @__PURE__ */ new Map();
3080
+ var isMasterJobCancelMessage = (thing) => thing && thing.type === messages_1.MasterMessageType.cancel;
3081
+ var isMasterJobRunMessage = (thing) => thing && thing.type === messages_1.MasterMessageType.run;
3082
+ var isObservable = (thing) => is_observable_1.default(thing) || isZenObservable(thing);
3083
+ function isZenObservable(thing) {
3084
+ return thing && typeof thing === "object" && typeof thing.subscribe === "function";
3085
+ }
3086
+ function deconstructTransfer(thing) {
3087
+ return transferable_1.isTransferDescriptor(thing) ? { payload: thing.send, transferables: thing.transferables } : { payload: thing, transferables: void 0 };
3088
+ }
3089
+ function postFunctionInitMessage() {
3090
+ const initMessage = {
3091
+ type: messages_1.WorkerMessageType.init,
3092
+ exposed: {
3093
+ type: "function"
3094
+ }
3095
+ };
3096
+ implementation_1.default.postMessageToMaster(initMessage);
3097
+ }
3098
+ function postModuleInitMessage(methodNames) {
3099
+ const initMessage = {
3100
+ type: messages_1.WorkerMessageType.init,
3101
+ exposed: {
3102
+ type: "module",
3103
+ methods: methodNames
3104
+ }
3105
+ };
3106
+ implementation_1.default.postMessageToMaster(initMessage);
3107
+ }
3108
+ function postJobErrorMessage(uid, rawError) {
3109
+ const { payload: error, transferables } = deconstructTransfer(rawError);
3110
+ const errorMessage = {
3111
+ type: messages_1.WorkerMessageType.error,
3112
+ uid,
3113
+ error: common_1.serialize(error)
3114
+ };
3115
+ implementation_1.default.postMessageToMaster(errorMessage, transferables);
3116
+ }
3117
+ function postJobResultMessage(uid, completed, resultValue) {
3118
+ const { payload, transferables } = deconstructTransfer(resultValue);
3119
+ const resultMessage = {
3120
+ type: messages_1.WorkerMessageType.result,
3121
+ uid,
3122
+ complete: completed ? true : void 0,
3123
+ payload
3124
+ };
3125
+ implementation_1.default.postMessageToMaster(resultMessage, transferables);
3126
+ }
3127
+ function postJobStartMessage(uid, resultType) {
3128
+ const startMessage = {
3129
+ type: messages_1.WorkerMessageType.running,
3130
+ uid,
3131
+ resultType
3132
+ };
3133
+ implementation_1.default.postMessageToMaster(startMessage);
3134
+ }
3135
+ function postUncaughtErrorMessage(error) {
3136
+ try {
3137
+ const errorMessage = {
3138
+ type: messages_1.WorkerMessageType.uncaughtError,
3139
+ error: common_1.serialize(error)
3140
+ };
3141
+ implementation_1.default.postMessageToMaster(errorMessage);
3142
+ } catch (subError) {
3143
+ console.error("Not reporting uncaught error back to master thread as it occured while reporting an uncaught error already.\nLatest error:", subError, "\nOriginal error:", error);
3144
+ }
3145
+ }
3146
+ function runFunction(jobUID, fn, args) {
3147
+ return __awaiter(this, void 0, void 0, function* () {
3148
+ let syncResult;
3149
+ try {
3150
+ syncResult = fn(...args);
3151
+ } catch (error) {
3152
+ return postJobErrorMessage(jobUID, error);
3153
+ }
3154
+ const resultType = isObservable(syncResult) ? "observable" : "promise";
3155
+ postJobStartMessage(jobUID, resultType);
3156
+ if (isObservable(syncResult)) {
3157
+ const subscription = syncResult.subscribe((value) => postJobResultMessage(jobUID, false, common_1.serialize(value)), (error) => {
3158
+ postJobErrorMessage(jobUID, common_1.serialize(error));
3159
+ activeSubscriptions.delete(jobUID);
3160
+ }, () => {
3161
+ postJobResultMessage(jobUID, true);
3162
+ activeSubscriptions.delete(jobUID);
3163
+ });
3164
+ activeSubscriptions.set(jobUID, subscription);
3165
+ } else {
3166
+ try {
3167
+ const result = yield syncResult;
3168
+ postJobResultMessage(jobUID, true, common_1.serialize(result));
3169
+ } catch (error) {
3170
+ postJobErrorMessage(jobUID, common_1.serialize(error));
3171
+ }
3172
+ }
3173
+ });
3174
+ }
3175
+ function expose2(exposed) {
3176
+ if (!implementation_1.default.isWorkerRuntime()) {
3177
+ throw Error("expose() called in the master thread.");
3178
+ }
3179
+ if (exposeCalled) {
3180
+ throw Error("expose() called more than once. This is not possible. Pass an object to expose() if you want to expose multiple functions.");
3181
+ }
3182
+ exposeCalled = true;
3183
+ if (typeof exposed === "function") {
3184
+ implementation_1.default.subscribeToMasterMessages((messageData) => {
3185
+ if (isMasterJobRunMessage(messageData) && !messageData.method) {
3186
+ runFunction(messageData.uid, exposed, messageData.args.map(common_1.deserialize));
3187
+ }
3188
+ });
3189
+ postFunctionInitMessage();
3190
+ } else if (typeof exposed === "object" && exposed) {
3191
+ implementation_1.default.subscribeToMasterMessages((messageData) => {
3192
+ if (isMasterJobRunMessage(messageData) && messageData.method) {
3193
+ runFunction(messageData.uid, exposed[messageData.method], messageData.args.map(common_1.deserialize));
3194
+ }
3195
+ });
3196
+ const methodNames = Object.keys(exposed).filter((key) => typeof exposed[key] === "function");
3197
+ postModuleInitMessage(methodNames);
3198
+ } else {
3199
+ throw Error(`Invalid argument passed to expose(). Expected a function or an object, got: ${exposed}`);
3200
+ }
3201
+ implementation_1.default.subscribeToMasterMessages((messageData) => {
3202
+ if (isMasterJobCancelMessage(messageData)) {
3203
+ const jobUID = messageData.uid;
3204
+ const subscription = activeSubscriptions.get(jobUID);
3205
+ if (subscription) {
3206
+ subscription.unsubscribe();
3207
+ activeSubscriptions.delete(jobUID);
3208
+ }
3209
+ }
3210
+ });
3211
+ }
3212
+ exports.expose = expose2;
3213
+ if (typeof self !== "undefined" && typeof self.addEventListener === "function" && implementation_1.default.isWorkerRuntime()) {
3214
+ self.addEventListener("error", (event) => {
3215
+ setTimeout(() => postUncaughtErrorMessage(event.error || event), 250);
3216
+ });
3217
+ self.addEventListener("unhandledrejection", (event) => {
3218
+ const error = event.reason;
3219
+ if (error && typeof error.message === "string") {
3220
+ setTimeout(() => postUncaughtErrorMessage(error), 250);
3221
+ }
3222
+ });
3223
+ }
3224
+ if (typeof process !== "undefined" && typeof process.on === "function" && implementation_1.default.isWorkerRuntime()) {
3225
+ process.on("uncaughtException", (error) => {
3226
+ setTimeout(() => postUncaughtErrorMessage(error), 250);
3227
+ });
3228
+ process.on("unhandledRejection", (error) => {
3229
+ if (error && typeof error.message === "string") {
3230
+ setTimeout(() => postUncaughtErrorMessage(error), 250);
3231
+ }
3232
+ });
3233
+ }
3234
+ }
3235
+ });
3236
+
3237
+ // ../../../../../../node_modules/@xylabs/hex/dist/node/index.js
3238
+ var assertError = (value, assert, defaultMessage) => {
3239
+ if (assert) {
3240
+ const assertString = typeof assert === "string" ? assert : typeof assert === "boolean" ? defaultMessage : assert(value, defaultMessage);
3241
+ if (assertString) {
3242
+ throw new Error(assertString === true ? defaultMessage : assertString);
3243
+ }
3244
+ }
3245
+ return void 0;
3246
+ };
3247
+ var bitsToNibbles = (value) => {
3248
+ const nibbles = value >> 2;
3249
+ if (value !== nibbles << 2)
3250
+ throw new Error("Bits for nibbles must multiple of 4");
3251
+ return nibbles;
3252
+ };
3253
+ var hexRegex = /^[\da-f]+$/i;
3254
+ var hexRegexWithPrefix = /0x[\da-f]+$/i;
3255
+ var isHex = (value, config) => {
3256
+ if (typeof value !== "string")
3257
+ return false;
3258
+ const valueCharLength = (config == null ? void 0 : config.prefix) ? value.length - 2 : value.length;
3259
+ if ((config == null ? void 0 : config.bitLength) !== void 0 && valueCharLength !== bitsToNibbles(config == null ? void 0 : config.bitLength))
3260
+ return false;
3261
+ return (config == null ? void 0 : config.prefix) ? hexRegexWithPrefix.test(value) : hexRegex.test(value);
3262
+ };
3263
+ var hexFromHexString = (value, config = {}) => {
3264
+ const { prefix = false, byteSize = 8 } = config;
3265
+ const nibbleBoundary = bitsToNibbles(byteSize);
3266
+ const unPadded = (value.startsWith("0x") ? value.slice(2) : value).toLowerCase();
3267
+ if (isHex(unPadded)) {
3268
+ const padded = unPadded.padStart(unPadded.length + unPadded.length % nibbleBoundary, "0");
3269
+ return prefix ? `0x${padded}` : padded;
3270
+ } else {
3271
+ throw new Error("Received string is not a value hex");
3272
+ }
3273
+ };
3274
+ var isHash = (value, bitLength = 256) => {
3275
+ return isHex(value, { bitLength });
3276
+ };
3277
+ function asHash(value, assert) {
3278
+ let stringValue = void 0;
3279
+ switch (typeof value) {
3280
+ case "string": {
3281
+ stringValue = hexFromHexString(value);
3282
+ break;
3283
+ }
3284
+ default: {
3285
+ return assert ? assertError(value, assert, `Unsupported type [${typeof value}]`) : void 0;
3286
+ }
3287
+ }
3288
+ return isHash(stringValue) ? stringValue : assertError(value, assert, `Value is not a Hash [${value}]`);
3289
+ }
3290
+
3291
+ // src/worker/jsHash.ts
3292
+ var import_sha = __toESM(require_sha2(), 1);
3293
+
3294
+ // ../../../../../../node_modules/threads/worker.mjs
3295
+ var import_worker = __toESM(require_worker(), 1);
3296
+ var expose = import_worker.default.expose;
3297
+ var registerSerializer = import_worker.default.registerSerializer;
3298
+ var Transfer = import_worker.default.Transfer;
3299
+
3300
+ // src/worker/jsHash.ts
3301
+ expose({
3302
+ hash(data) {
3303
+ return asHash((0, import_sha.default)("sha256").update(data).digest().toString("hex"), true);
3304
+ }
3305
+ });
3306
+ })();
3307
+ /*! Bundled license information:
3308
+
3309
+ ieee754/index.js:
3310
+ (*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> *)
3311
+
3312
+ buffer/index.js:
3313
+ (*!
3314
+ * The buffer module from node.js, for the browser.
3315
+ *
3316
+ * @author Feross Aboukhadijeh <https://feross.org>
3317
+ * @license MIT
3318
+ *)
3319
+
3320
+ safe-buffer/index.js:
3321
+ (*! safe-buffer. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> *)
3322
+ */