wao 0.9.2 → 0.10.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/cjs/ao.js +31 -32
- package/cjs/aoconnect-base.js +1 -1
- package/cjs/armem-base.js +104 -53
- package/cjs/armem-web.js +11 -1
- package/cjs/armem.js +8 -1
- package/cjs/build.js +8 -0
- package/cjs/compress.js +165 -0
- package/cjs/lfdb.js +5 -4
- package/cjs/waosm/waosm.js +332 -0
- package/cjs/waosm-node/waosm.js +21 -0
- package/cjs/waosm-node/waosm_bg.js +193 -0
- package/cjs/waosm-node.js +28 -0
- package/esm/ao.js +7 -7
- package/esm/aoconnect-base.js +1 -1
- package/esm/armem-base.js +51 -8
- package/esm/armem-web.js +2 -1
- package/esm/armem.js +2 -1
- package/esm/build.js +7 -0
- package/esm/compress.js +113 -0
- package/esm/lfdb.js +2 -3
- package/esm/waosm/README.md +79 -0
- package/esm/waosm/package.json +14 -0
- package/esm/waosm/waosm.d.ts +46 -0
- package/esm/waosm/waosm.js +264 -0
- package/esm/waosm/waosm_bg.wasm +0 -0
- package/esm/waosm/waosm_bg.wasm.d.ts +10 -0
- package/esm/waosm-node/README.md +79 -0
- package/esm/waosm-node/waosm.d.ts +12 -0
- package/esm/waosm-node/waosm.js +4 -0
- package/esm/waosm-node/waosm_bg.js +171 -0
- package/esm/waosm-node/waosm_bg.wasm +0 -0
- package/esm/waosm-node/waosm_bg.wasm.d.ts +10 -0
- package/esm/waosm-node.js +13 -0
- package/package.json +4 -1
package/cjs/compress.js
ADDED
|
@@ -0,0 +1,165 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.decompress = exports.compress = void 0;
|
|
7
|
+
function _createForOfIteratorHelper(r, e) { var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (!t) { if (Array.isArray(r) || (t = _unsupportedIterableToArray(r)) || e && r && "number" == typeof r.length) { t && (r = t); var _n2 = 0, F = function F() {}; return { s: F, n: function n() { return _n2 >= r.length ? { done: !0 } : { done: !1, value: r[_n2++] }; }, e: function e(r) { throw r; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var o, a = !0, u = !1; return { s: function s() { t = t.call(r); }, n: function n() { var r = t.next(); return a = r.done, r; }, e: function e(r) { u = !0, o = r; }, f: function f() { try { a || null == t["return"] || t["return"](); } finally { if (u) throw o; } } }; }
|
|
8
|
+
function _toArray(r) { return _arrayWithHoles(r) || _iterableToArray(r) || _unsupportedIterableToArray(r) || _nonIterableRest(); }
|
|
9
|
+
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
10
|
+
function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
|
|
11
|
+
function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
|
|
12
|
+
function _iterableToArray(r) { if ("undefined" != typeof Symbol && null != r[Symbol.iterator] || null != r["@@iterator"]) return Array.from(r); }
|
|
13
|
+
function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }
|
|
14
|
+
function toBase256(n) {
|
|
15
|
+
var result = [];
|
|
16
|
+
while (n > 0) {
|
|
17
|
+
result.unshift(n % 256);
|
|
18
|
+
n = Math.floor(n / 256);
|
|
19
|
+
}
|
|
20
|
+
return [result.length].concat(result);
|
|
21
|
+
}
|
|
22
|
+
var _comp = function _comp(arr, _arr, mode) {
|
|
23
|
+
var _nums = null;
|
|
24
|
+
var _elms = null;
|
|
25
|
+
var len = _arr.length;
|
|
26
|
+
var flag = 0;
|
|
27
|
+
if (mode === 1 && _arr[0] !== 0) {
|
|
28
|
+
flag += 100;
|
|
29
|
+
_elms = [_arr[0]];
|
|
30
|
+
} else if (mode === 2) {
|
|
31
|
+
flag += 200;
|
|
32
|
+
_elms = _arr;
|
|
33
|
+
}
|
|
34
|
+
if (len < 10) flag += len;else if (len !== 10) {
|
|
35
|
+
var _toBase = toBase256(len),
|
|
36
|
+
_toBase2 = _toArray(_toBase),
|
|
37
|
+
elm = _toBase2[0],
|
|
38
|
+
nums = _toBase2.slice(1);
|
|
39
|
+
_nums = nums;
|
|
40
|
+
flag += elm * 10;
|
|
41
|
+
if (_nums[0] < 10) flag += _nums.shift();
|
|
42
|
+
}
|
|
43
|
+
arr.push(flag);
|
|
44
|
+
if (_nums) {
|
|
45
|
+
var _iterator = _createForOfIteratorHelper(_nums),
|
|
46
|
+
_step;
|
|
47
|
+
try {
|
|
48
|
+
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
49
|
+
var n = _step.value;
|
|
50
|
+
arr.push(n);
|
|
51
|
+
}
|
|
52
|
+
} catch (err) {
|
|
53
|
+
_iterator.e(err);
|
|
54
|
+
} finally {
|
|
55
|
+
_iterator.f();
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
if (_elms) {
|
|
59
|
+
var _iterator2 = _createForOfIteratorHelper(_elms),
|
|
60
|
+
_step2;
|
|
61
|
+
try {
|
|
62
|
+
for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
|
|
63
|
+
var _n = _step2.value;
|
|
64
|
+
arr.push(_n);
|
|
65
|
+
}
|
|
66
|
+
} catch (err) {
|
|
67
|
+
_iterator2.e(err);
|
|
68
|
+
} finally {
|
|
69
|
+
_iterator2.f();
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
};
|
|
73
|
+
var compress = exports.compress = function compress(d) {
|
|
74
|
+
var _arr = [];
|
|
75
|
+
var mode = 1;
|
|
76
|
+
var prev = null;
|
|
77
|
+
var max = 0;
|
|
78
|
+
var arr = [];
|
|
79
|
+
var _iterator3 = _createForOfIteratorHelper(d),
|
|
80
|
+
_step3;
|
|
81
|
+
try {
|
|
82
|
+
for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {
|
|
83
|
+
var v = _step3.value;
|
|
84
|
+
if (prev === null) _arr.push(v);else if (_arr.length === 1) {
|
|
85
|
+
mode = prev !== v ? 2 : 1;
|
|
86
|
+
_arr.push(v);
|
|
87
|
+
} else {
|
|
88
|
+
if (prev !== v && mode === 1) {
|
|
89
|
+
_comp(arr, _arr, mode);
|
|
90
|
+
_arr = [v];
|
|
91
|
+
mode = 2;
|
|
92
|
+
} else if (prev === v && mode === 2) {
|
|
93
|
+
var last = _arr.pop();
|
|
94
|
+
_comp(arr, _arr, mode);
|
|
95
|
+
_arr = [last, v];
|
|
96
|
+
mode = 1;
|
|
97
|
+
} else {
|
|
98
|
+
_arr.push(v);
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
prev = v;
|
|
102
|
+
}
|
|
103
|
+
} catch (err) {
|
|
104
|
+
_iterator3.e(err);
|
|
105
|
+
} finally {
|
|
106
|
+
_iterator3.f();
|
|
107
|
+
}
|
|
108
|
+
if (_arr.length > 0) _comp(arr, _arr, mode);
|
|
109
|
+
return arr;
|
|
110
|
+
};
|
|
111
|
+
var decompress = exports.decompress = function decompress(d) {
|
|
112
|
+
var arr = [];
|
|
113
|
+
var flag = null;
|
|
114
|
+
var elm = 0;
|
|
115
|
+
var sum = 0;
|
|
116
|
+
var nums = [];
|
|
117
|
+
var first = null;
|
|
118
|
+
var second = null;
|
|
119
|
+
var third = null;
|
|
120
|
+
var _iterator4 = _createForOfIteratorHelper(d),
|
|
121
|
+
_step4;
|
|
122
|
+
try {
|
|
123
|
+
for (_iterator4.s(); !(_step4 = _iterator4.n()).done;) {
|
|
124
|
+
var v = _step4.value;
|
|
125
|
+
if (flag === null) {
|
|
126
|
+
flag = v;
|
|
127
|
+
first = Math.floor(flag / 100);
|
|
128
|
+
second = Math.floor((flag - first * 100) / 10);
|
|
129
|
+
third = flag - first * 100 - second * 10;
|
|
130
|
+
nums = [];
|
|
131
|
+
if (second === 0) {
|
|
132
|
+
nums.push(third === 0 ? 10 : third);
|
|
133
|
+
elm = 0;
|
|
134
|
+
} else if (third !== 0) {
|
|
135
|
+
nums.push(third);
|
|
136
|
+
elm = second - 1;
|
|
137
|
+
} else elm = second;
|
|
138
|
+
console.log(flag, first, second, third, elm, nums);
|
|
139
|
+
} else if (sum === 0) {
|
|
140
|
+
elm -= 1;
|
|
141
|
+
nums.push(v);
|
|
142
|
+
}
|
|
143
|
+
if (sum > 0) {
|
|
144
|
+
if (first === 2) arr.push(v);else if (first === 1) for (var i = 0; i < to10(nums); i++) arr.push(v);
|
|
145
|
+
sum -= 1;
|
|
146
|
+
if (sum === 0) flag = null;
|
|
147
|
+
} else if (elm === 0) {
|
|
148
|
+
if (first === 0) {
|
|
149
|
+
for (var _i = 0; _i < to10(nums); _i++) arr.push(0);
|
|
150
|
+
flag = null;
|
|
151
|
+
} else if (first === 2) sum = to10(nums);else sum = 1;
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
} catch (err) {
|
|
155
|
+
_iterator4.e(err);
|
|
156
|
+
} finally {
|
|
157
|
+
_iterator4.f();
|
|
158
|
+
}
|
|
159
|
+
return new Uint8Array(arr);
|
|
160
|
+
};
|
|
161
|
+
function to10(arr) {
|
|
162
|
+
var num = 0;
|
|
163
|
+
for (var i = 0; i < arr.length; i++) num = num * 256 + arr[i];
|
|
164
|
+
return num;
|
|
165
|
+
}
|
package/cjs/lfdb.js
CHANGED
|
@@ -22,6 +22,7 @@ var _default = exports["default"] = function _default(_this) {
|
|
|
22
22
|
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
23
23
|
while (1) switch (_context.prev = _context.next) {
|
|
24
24
|
case 0:
|
|
25
|
+
console.log(key, val);
|
|
25
26
|
_val = null;
|
|
26
27
|
if (_typeof(val) === "object" && !(0, _ramda.is)(Array, val)) {
|
|
27
28
|
_val = {};
|
|
@@ -61,13 +62,13 @@ var _default = exports["default"] = function _default(_this) {
|
|
|
61
62
|
}
|
|
62
63
|
}
|
|
63
64
|
} else _val = val;
|
|
64
|
-
_context.next =
|
|
65
|
+
_context.next = 5;
|
|
65
66
|
return _localforage["default"].setItem(key, _val);
|
|
66
|
-
case
|
|
67
|
+
case 5:
|
|
67
68
|
_this.keys[key] = true;
|
|
68
|
-
_context.next =
|
|
69
|
+
_context.next = 8;
|
|
69
70
|
return _localforage["default"].setItem("keys", (0, _ramda.keys)(_this.keys));
|
|
70
|
-
case
|
|
71
|
+
case 8:
|
|
71
72
|
case "end":
|
|
72
73
|
return _context.stop();
|
|
73
74
|
}
|
|
@@ -0,0 +1,332 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports["default"] = exports.Decompressor = exports.Compressor = void 0;
|
|
7
|
+
exports.initSync = initSync;
|
|
8
|
+
function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return e; }; var t, e = {}, r = Object.prototype, n = r.hasOwnProperty, o = Object.defineProperty || function (t, e, r) { t[e] = r.value; }, i = "function" == typeof Symbol ? Symbol : {}, a = i.iterator || "@@iterator", c = i.asyncIterator || "@@asyncIterator", u = i.toStringTag || "@@toStringTag"; function define(t, e, r) { return Object.defineProperty(t, e, { value: r, enumerable: !0, configurable: !0, writable: !0 }), t[e]; } try { define({}, ""); } catch (t) { define = function define(t, e, r) { return t[e] = r; }; } function wrap(t, e, r, n) { var i = e && e.prototype instanceof Generator ? e : Generator, a = Object.create(i.prototype), c = new Context(n || []); return o(a, "_invoke", { value: makeInvokeMethod(t, r, c) }), a; } function tryCatch(t, e, r) { try { return { type: "normal", arg: t.call(e, r) }; } catch (t) { return { type: "throw", arg: t }; } } e.wrap = wrap; var h = "suspendedStart", l = "suspendedYield", f = "executing", s = "completed", y = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var p = {}; define(p, a, function () { return this; }); var d = Object.getPrototypeOf, v = d && d(d(values([]))); v && v !== r && n.call(v, a) && (p = v); var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p); function defineIteratorMethods(t) { ["next", "throw", "return"].forEach(function (e) { define(t, e, function (t) { return this._invoke(e, t); }); }); } function AsyncIterator(t, e) { function invoke(r, o, i, a) { var c = tryCatch(t[r], t, o); if ("throw" !== c.type) { var u = c.arg, h = u.value; return h && "object" == _typeof(h) && n.call(h, "__await") ? e.resolve(h.__await).then(function (t) { invoke("next", t, i, a); }, function (t) { invoke("throw", t, i, a); }) : e.resolve(h).then(function (t) { u.value = t, i(u); }, function (t) { return invoke("throw", t, i, a); }); } a(c.arg); } var r; o(this, "_invoke", { value: function value(t, n) { function callInvokeWithMethodAndArg() { return new e(function (e, r) { invoke(t, n, e, r); }); } return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(e, r, n) { var o = h; return function (i, a) { if (o === f) throw Error("Generator is already running"); if (o === s) { if ("throw" === i) throw a; return { value: t, done: !0 }; } for (n.method = i, n.arg = a;;) { var c = n.delegate; if (c) { var u = maybeInvokeDelegate(c, n); if (u) { if (u === y) continue; return u; } } if ("next" === n.method) n.sent = n._sent = n.arg;else if ("throw" === n.method) { if (o === h) throw o = s, n.arg; n.dispatchException(n.arg); } else "return" === n.method && n.abrupt("return", n.arg); o = f; var p = tryCatch(e, r, n); if ("normal" === p.type) { if (o = n.done ? s : l, p.arg === y) continue; return { value: p.arg, done: n.done }; } "throw" === p.type && (o = s, n.method = "throw", n.arg = p.arg); } }; } function maybeInvokeDelegate(e, r) { var n = r.method, o = e.iterator[n]; if (o === t) return r.delegate = null, "throw" === n && e.iterator["return"] && (r.method = "return", r.arg = t, maybeInvokeDelegate(e, r), "throw" === r.method) || "return" !== n && (r.method = "throw", r.arg = new TypeError("The iterator does not provide a '" + n + "' method")), y; var i = tryCatch(o, e.iterator, r.arg); if ("throw" === i.type) return r.method = "throw", r.arg = i.arg, r.delegate = null, y; var a = i.arg; return a ? a.done ? (r[e.resultName] = a.value, r.next = e.nextLoc, "return" !== r.method && (r.method = "next", r.arg = t), r.delegate = null, y) : a : (r.method = "throw", r.arg = new TypeError("iterator result is not an object"), r.delegate = null, y); } function pushTryEntry(t) { var e = { tryLoc: t[0] }; 1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e); } function resetTryEntry(t) { var e = t.completion || {}; e.type = "normal", delete e.arg, t.completion = e; } function Context(t) { this.tryEntries = [{ tryLoc: "root" }], t.forEach(pushTryEntry, this), this.reset(!0); } function values(e) { if (e || "" === e) { var r = e[a]; if (r) return r.call(e); if ("function" == typeof e.next) return e; if (!isNaN(e.length)) { var o = -1, i = function next() { for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next; return next.value = t, next.done = !0, next; }; return i.next = i; } } throw new TypeError(_typeof(e) + " is not iterable"); } return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), o(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, "GeneratorFunction"), e.isGeneratorFunction = function (t) { var e = "function" == typeof t && t.constructor; return !!e && (e === GeneratorFunction || "GeneratorFunction" === (e.displayName || e.name)); }, e.mark = function (t) { return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, "GeneratorFunction")), t.prototype = Object.create(g), t; }, e.awrap = function (t) { return { __await: t }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () { return this; }), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) { void 0 === i && (i = Promise); var a = new AsyncIterator(wrap(t, r, n, o), i); return e.isGeneratorFunction(r) ? a : a.next().then(function (t) { return t.done ? t.value : a.next(); }); }, defineIteratorMethods(g), define(g, u, "Generator"), define(g, a, function () { return this; }), define(g, "toString", function () { return "[object Generator]"; }), e.keys = function (t) { var e = Object(t), r = []; for (var n in e) r.push(n); return r.reverse(), function next() { for (; r.length;) { var t = r.pop(); if (t in e) return next.value = t, next.done = !1, next; } return next.done = !0, next; }; }, e.values = values, Context.prototype = { constructor: Context, reset: function reset(e) { if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = "next", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e) for (var r in this) "t" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t); }, stop: function stop() { this.done = !0; var t = this.tryEntries[0].completion; if ("throw" === t.type) throw t.arg; return this.rval; }, dispatchException: function dispatchException(e) { if (this.done) throw e; var r = this; function handle(n, o) { return a.type = "throw", a.arg = e, r.next = n, o && (r.method = "next", r.arg = t), !!o; } for (var o = this.tryEntries.length - 1; o >= 0; --o) { var i = this.tryEntries[o], a = i.completion; if ("root" === i.tryLoc) return handle("end"); if (i.tryLoc <= this.prev) { var c = n.call(i, "catchLoc"), u = n.call(i, "finallyLoc"); if (c && u) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } else if (c) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); } else { if (!u) throw Error("try statement without catch or finally"); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } } } }, abrupt: function abrupt(t, e) { for (var r = this.tryEntries.length - 1; r >= 0; --r) { var o = this.tryEntries[r]; if (o.tryLoc <= this.prev && n.call(o, "finallyLoc") && this.prev < o.finallyLoc) { var i = o; break; } } i && ("break" === t || "continue" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null); var a = i ? i.completion : {}; return a.type = t, a.arg = e, i ? (this.method = "next", this.next = i.finallyLoc, y) : this.complete(a); }, complete: function complete(t, e) { if ("throw" === t.type) throw t.arg; return "break" === t.type || "continue" === t.type ? this.next = t.arg : "return" === t.type ? (this.rval = this.arg = t.arg, this.method = "return", this.next = "end") : "normal" === t.type && e && (this.next = e), y; }, finish: function finish(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y; } }, "catch": function _catch(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.tryLoc === t) { var n = r.completion; if ("throw" === n.type) { var o = n.arg; resetTryEntry(r); } return o; } } throw Error("illegal catch attempt"); }, delegateYield: function delegateYield(e, r, n) { return this.delegate = { iterator: values(e), resultName: r, nextLoc: n }, "next" === this.method && (this.arg = t), y; } }, e; }
|
|
9
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
10
|
+
function asyncGeneratorStep(n, t, e, r, o, a, c) { try { var i = n[a](c), u = i.value; } catch (n) { return void e(n); } i.done ? t(u) : Promise.resolve(u).then(r, o); }
|
|
11
|
+
function _asyncToGenerator(n) { return function () { var t = this, e = arguments; return new Promise(function (r, o) { var a = n.apply(t, e); function _next(n) { asyncGeneratorStep(a, r, o, _next, _throw, "next", n); } function _throw(n) { asyncGeneratorStep(a, r, o, _next, _throw, "throw", n); } _next(void 0); }); }; }
|
|
12
|
+
function _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); }
|
|
13
|
+
function _defineProperties(e, r) { for (var t = 0; t < r.length; t++) { var o = r[t]; o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey(o.key), o); } }
|
|
14
|
+
function _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), e; }
|
|
15
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
|
|
16
|
+
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
17
|
+
var wasm;
|
|
18
|
+
var heap = new Array(128).fill(undefined);
|
|
19
|
+
heap.push(undefined, null, true, false);
|
|
20
|
+
function getObject(idx) {
|
|
21
|
+
return heap[idx];
|
|
22
|
+
}
|
|
23
|
+
var heap_next = heap.length;
|
|
24
|
+
function addHeapObject(obj) {
|
|
25
|
+
if (heap_next === heap.length) heap.push(heap.length + 1);
|
|
26
|
+
var idx = heap_next;
|
|
27
|
+
heap_next = heap[idx];
|
|
28
|
+
heap[idx] = obj;
|
|
29
|
+
return idx;
|
|
30
|
+
}
|
|
31
|
+
function dropObject(idx) {
|
|
32
|
+
if (idx < 132) return;
|
|
33
|
+
heap[idx] = heap_next;
|
|
34
|
+
heap_next = idx;
|
|
35
|
+
}
|
|
36
|
+
function takeObject(idx) {
|
|
37
|
+
var ret = getObject(idx);
|
|
38
|
+
dropObject(idx);
|
|
39
|
+
return ret;
|
|
40
|
+
}
|
|
41
|
+
var cachedTextDecoder = typeof TextDecoder !== 'undefined' ? new TextDecoder('utf-8', {
|
|
42
|
+
ignoreBOM: true,
|
|
43
|
+
fatal: true
|
|
44
|
+
}) : {
|
|
45
|
+
decode: function decode() {
|
|
46
|
+
throw Error('TextDecoder not available');
|
|
47
|
+
}
|
|
48
|
+
};
|
|
49
|
+
if (typeof TextDecoder !== 'undefined') {
|
|
50
|
+
cachedTextDecoder.decode();
|
|
51
|
+
}
|
|
52
|
+
;
|
|
53
|
+
var cachedUint8ArrayMemory0 = null;
|
|
54
|
+
function getUint8ArrayMemory0() {
|
|
55
|
+
if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) {
|
|
56
|
+
cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer);
|
|
57
|
+
}
|
|
58
|
+
return cachedUint8ArrayMemory0;
|
|
59
|
+
}
|
|
60
|
+
function getStringFromWasm0(ptr, len) {
|
|
61
|
+
ptr = ptr >>> 0;
|
|
62
|
+
return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
|
|
63
|
+
}
|
|
64
|
+
var WASM_VECTOR_LEN = 0;
|
|
65
|
+
function passArray8ToWasm0(arg, malloc) {
|
|
66
|
+
var ptr = malloc(arg.length * 1, 1) >>> 0;
|
|
67
|
+
getUint8ArrayMemory0().set(arg, ptr / 1);
|
|
68
|
+
WASM_VECTOR_LEN = arg.length;
|
|
69
|
+
return ptr;
|
|
70
|
+
}
|
|
71
|
+
var CompressorFinalization = typeof FinalizationRegistry === 'undefined' ? {
|
|
72
|
+
register: function register() {},
|
|
73
|
+
unregister: function unregister() {}
|
|
74
|
+
} : new FinalizationRegistry(function (ptr) {
|
|
75
|
+
return wasm.__wbg_compressor_free(ptr >>> 0, 1);
|
|
76
|
+
});
|
|
77
|
+
var Compressor = exports.Compressor = /*#__PURE__*/function () {
|
|
78
|
+
function Compressor() {
|
|
79
|
+
_classCallCheck(this, Compressor);
|
|
80
|
+
var ret = wasm.compressor_new();
|
|
81
|
+
this.__wbg_ptr = ret >>> 0;
|
|
82
|
+
CompressorFinalization.register(this, this.__wbg_ptr, this);
|
|
83
|
+
return this;
|
|
84
|
+
}
|
|
85
|
+
/**
|
|
86
|
+
* @param {Uint8Array} data
|
|
87
|
+
* @returns {Uint8Array}
|
|
88
|
+
*/
|
|
89
|
+
return _createClass(Compressor, [{
|
|
90
|
+
key: "__destroy_into_raw",
|
|
91
|
+
value: function __destroy_into_raw() {
|
|
92
|
+
var ptr = this.__wbg_ptr;
|
|
93
|
+
this.__wbg_ptr = 0;
|
|
94
|
+
CompressorFinalization.unregister(this);
|
|
95
|
+
return ptr;
|
|
96
|
+
}
|
|
97
|
+
}, {
|
|
98
|
+
key: "free",
|
|
99
|
+
value: function free() {
|
|
100
|
+
var ptr = this.__destroy_into_raw();
|
|
101
|
+
wasm.__wbg_compressor_free(ptr, 0);
|
|
102
|
+
}
|
|
103
|
+
}, {
|
|
104
|
+
key: "compress",
|
|
105
|
+
value: function compress(data) {
|
|
106
|
+
var ptr0 = passArray8ToWasm0(data, wasm.__wbindgen_malloc);
|
|
107
|
+
var len0 = WASM_VECTOR_LEN;
|
|
108
|
+
var ret = wasm.compressor_compress(this.__wbg_ptr, ptr0, len0);
|
|
109
|
+
return takeObject(ret);
|
|
110
|
+
}
|
|
111
|
+
}]);
|
|
112
|
+
}();
|
|
113
|
+
var DecompressorFinalization = typeof FinalizationRegistry === 'undefined' ? {
|
|
114
|
+
register: function register() {},
|
|
115
|
+
unregister: function unregister() {}
|
|
116
|
+
} : new FinalizationRegistry(function (ptr) {
|
|
117
|
+
return wasm.__wbg_decompressor_free(ptr >>> 0, 1);
|
|
118
|
+
});
|
|
119
|
+
var Decompressor = exports.Decompressor = /*#__PURE__*/function () {
|
|
120
|
+
function Decompressor() {
|
|
121
|
+
_classCallCheck(this, Decompressor);
|
|
122
|
+
var ret = wasm.compressor_new();
|
|
123
|
+
this.__wbg_ptr = ret >>> 0;
|
|
124
|
+
DecompressorFinalization.register(this, this.__wbg_ptr, this);
|
|
125
|
+
return this;
|
|
126
|
+
}
|
|
127
|
+
/**
|
|
128
|
+
* @param {Uint8Array} data
|
|
129
|
+
* @returns {Uint8Array}
|
|
130
|
+
*/
|
|
131
|
+
return _createClass(Decompressor, [{
|
|
132
|
+
key: "__destroy_into_raw",
|
|
133
|
+
value: function __destroy_into_raw() {
|
|
134
|
+
var ptr = this.__wbg_ptr;
|
|
135
|
+
this.__wbg_ptr = 0;
|
|
136
|
+
DecompressorFinalization.unregister(this);
|
|
137
|
+
return ptr;
|
|
138
|
+
}
|
|
139
|
+
}, {
|
|
140
|
+
key: "free",
|
|
141
|
+
value: function free() {
|
|
142
|
+
var ptr = this.__destroy_into_raw();
|
|
143
|
+
wasm.__wbg_decompressor_free(ptr, 0);
|
|
144
|
+
}
|
|
145
|
+
}, {
|
|
146
|
+
key: "decompress",
|
|
147
|
+
value: function decompress(data) {
|
|
148
|
+
var ptr0 = passArray8ToWasm0(data, wasm.__wbindgen_malloc);
|
|
149
|
+
var len0 = WASM_VECTOR_LEN;
|
|
150
|
+
var ret = wasm.decompressor_decompress(this.__wbg_ptr, ptr0, len0);
|
|
151
|
+
return takeObject(ret);
|
|
152
|
+
}
|
|
153
|
+
}]);
|
|
154
|
+
}();
|
|
155
|
+
function __wbg_load(_x, _x2) {
|
|
156
|
+
return _wbg_load.apply(this, arguments);
|
|
157
|
+
}
|
|
158
|
+
function _wbg_load() {
|
|
159
|
+
_wbg_load = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(module, imports) {
|
|
160
|
+
var bytes, instance;
|
|
161
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
162
|
+
while (1) switch (_context.prev = _context.next) {
|
|
163
|
+
case 0:
|
|
164
|
+
if (!(typeof Response === 'function' && module instanceof Response)) {
|
|
165
|
+
_context.next = 23;
|
|
166
|
+
break;
|
|
167
|
+
}
|
|
168
|
+
if (!(typeof WebAssembly.instantiateStreaming === 'function')) {
|
|
169
|
+
_context.next = 15;
|
|
170
|
+
break;
|
|
171
|
+
}
|
|
172
|
+
_context.prev = 2;
|
|
173
|
+
_context.next = 5;
|
|
174
|
+
return WebAssembly.instantiateStreaming(module, imports);
|
|
175
|
+
case 5:
|
|
176
|
+
return _context.abrupt("return", _context.sent);
|
|
177
|
+
case 8:
|
|
178
|
+
_context.prev = 8;
|
|
179
|
+
_context.t0 = _context["catch"](2);
|
|
180
|
+
if (!(module.headers.get('Content-Type') != 'application/wasm')) {
|
|
181
|
+
_context.next = 14;
|
|
182
|
+
break;
|
|
183
|
+
}
|
|
184
|
+
console.warn("`WebAssembly.instantiateStreaming` failed because your server does not serve Wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\n", _context.t0);
|
|
185
|
+
_context.next = 15;
|
|
186
|
+
break;
|
|
187
|
+
case 14:
|
|
188
|
+
throw _context.t0;
|
|
189
|
+
case 15:
|
|
190
|
+
_context.next = 17;
|
|
191
|
+
return module.arrayBuffer();
|
|
192
|
+
case 17:
|
|
193
|
+
bytes = _context.sent;
|
|
194
|
+
_context.next = 20;
|
|
195
|
+
return WebAssembly.instantiate(bytes, imports);
|
|
196
|
+
case 20:
|
|
197
|
+
return _context.abrupt("return", _context.sent);
|
|
198
|
+
case 23:
|
|
199
|
+
_context.next = 25;
|
|
200
|
+
return WebAssembly.instantiate(module, imports);
|
|
201
|
+
case 25:
|
|
202
|
+
instance = _context.sent;
|
|
203
|
+
if (!(instance instanceof WebAssembly.Instance)) {
|
|
204
|
+
_context.next = 30;
|
|
205
|
+
break;
|
|
206
|
+
}
|
|
207
|
+
return _context.abrupt("return", {
|
|
208
|
+
instance: instance,
|
|
209
|
+
module: module
|
|
210
|
+
});
|
|
211
|
+
case 30:
|
|
212
|
+
return _context.abrupt("return", instance);
|
|
213
|
+
case 31:
|
|
214
|
+
case "end":
|
|
215
|
+
return _context.stop();
|
|
216
|
+
}
|
|
217
|
+
}, _callee, null, [[2, 8]]);
|
|
218
|
+
}));
|
|
219
|
+
return _wbg_load.apply(this, arguments);
|
|
220
|
+
}
|
|
221
|
+
function __wbg_get_imports() {
|
|
222
|
+
var imports = {};
|
|
223
|
+
imports.wbg = {};
|
|
224
|
+
imports.wbg.__wbg_buffer_609cc3eee51ed158 = function (arg0) {
|
|
225
|
+
var ret = getObject(arg0).buffer;
|
|
226
|
+
return addHeapObject(ret);
|
|
227
|
+
};
|
|
228
|
+
imports.wbg.__wbg_length_a446193dc22c12f8 = function (arg0) {
|
|
229
|
+
var ret = getObject(arg0).length;
|
|
230
|
+
return ret;
|
|
231
|
+
};
|
|
232
|
+
imports.wbg.__wbg_newwithbyteoffsetandlength_d97e637ebe145a9a = function (arg0, arg1, arg2) {
|
|
233
|
+
var ret = new Uint8Array(getObject(arg0), arg1 >>> 0, arg2 >>> 0);
|
|
234
|
+
return addHeapObject(ret);
|
|
235
|
+
};
|
|
236
|
+
imports.wbg.__wbg_newwithlength_a381634e90c276d4 = function (arg0) {
|
|
237
|
+
var ret = new Uint8Array(arg0 >>> 0);
|
|
238
|
+
return addHeapObject(ret);
|
|
239
|
+
};
|
|
240
|
+
imports.wbg.__wbg_set_65595bdd868b3009 = function (arg0, arg1, arg2) {
|
|
241
|
+
getObject(arg0).set(getObject(arg1), arg2 >>> 0);
|
|
242
|
+
};
|
|
243
|
+
imports.wbg.__wbindgen_memory = function () {
|
|
244
|
+
var ret = wasm.memory;
|
|
245
|
+
return addHeapObject(ret);
|
|
246
|
+
};
|
|
247
|
+
imports.wbg.__wbindgen_object_drop_ref = function (arg0) {
|
|
248
|
+
takeObject(arg0);
|
|
249
|
+
};
|
|
250
|
+
imports.wbg.__wbindgen_throw = function (arg0, arg1) {
|
|
251
|
+
throw new Error(getStringFromWasm0(arg0, arg1));
|
|
252
|
+
};
|
|
253
|
+
return imports;
|
|
254
|
+
}
|
|
255
|
+
function __wbg_init_memory(imports, memory) {}
|
|
256
|
+
function __wbg_finalize_init(instance, module) {
|
|
257
|
+
wasm = instance.exports;
|
|
258
|
+
__wbg_init.__wbindgen_wasm_module = module;
|
|
259
|
+
cachedUint8ArrayMemory0 = null;
|
|
260
|
+
return wasm;
|
|
261
|
+
}
|
|
262
|
+
function initSync(module) {
|
|
263
|
+
if (wasm !== undefined) return wasm;
|
|
264
|
+
if (typeof module !== 'undefined') {
|
|
265
|
+
if (Object.getPrototypeOf(module) === Object.prototype) {
|
|
266
|
+
var _module = module;
|
|
267
|
+
module = _module.module;
|
|
268
|
+
} else {
|
|
269
|
+
console.warn('using deprecated parameters for `initSync()`; pass a single object instead');
|
|
270
|
+
}
|
|
271
|
+
}
|
|
272
|
+
var imports = __wbg_get_imports();
|
|
273
|
+
__wbg_init_memory(imports);
|
|
274
|
+
if (!(module instanceof WebAssembly.Module)) {
|
|
275
|
+
module = new WebAssembly.Module(module);
|
|
276
|
+
}
|
|
277
|
+
var instance = new WebAssembly.Instance(module, imports);
|
|
278
|
+
return __wbg_finalize_init(instance, module);
|
|
279
|
+
}
|
|
280
|
+
function __wbg_init(_x3) {
|
|
281
|
+
return _wbg_init.apply(this, arguments);
|
|
282
|
+
}
|
|
283
|
+
function _wbg_init() {
|
|
284
|
+
_wbg_init = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee2(module_or_path) {
|
|
285
|
+
var _module_or_path, imports, _yield$__wbg_load, instance, module;
|
|
286
|
+
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
287
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
288
|
+
case 0:
|
|
289
|
+
if (!(wasm !== undefined)) {
|
|
290
|
+
_context2.next = 2;
|
|
291
|
+
break;
|
|
292
|
+
}
|
|
293
|
+
return _context2.abrupt("return", wasm);
|
|
294
|
+
case 2:
|
|
295
|
+
if (typeof module_or_path !== 'undefined') {
|
|
296
|
+
if (Object.getPrototypeOf(module_or_path) === Object.prototype) {
|
|
297
|
+
_module_or_path = module_or_path;
|
|
298
|
+
module_or_path = _module_or_path.module_or_path;
|
|
299
|
+
} else {
|
|
300
|
+
console.warn('using deprecated parameters for the initialization function; pass a single object instead');
|
|
301
|
+
}
|
|
302
|
+
}
|
|
303
|
+
if (typeof module_or_path === 'undefined') {
|
|
304
|
+
module_or_path = new URL('waosm_bg.wasm', import.meta.url);
|
|
305
|
+
}
|
|
306
|
+
imports = __wbg_get_imports();
|
|
307
|
+
if (typeof module_or_path === 'string' || typeof Request === 'function' && module_or_path instanceof Request || typeof URL === 'function' && module_or_path instanceof URL) {
|
|
308
|
+
module_or_path = fetch(module_or_path);
|
|
309
|
+
}
|
|
310
|
+
__wbg_init_memory(imports);
|
|
311
|
+
_context2.t0 = __wbg_load;
|
|
312
|
+
_context2.next = 10;
|
|
313
|
+
return module_or_path;
|
|
314
|
+
case 10:
|
|
315
|
+
_context2.t1 = _context2.sent;
|
|
316
|
+
_context2.t2 = imports;
|
|
317
|
+
_context2.next = 14;
|
|
318
|
+
return (0, _context2.t0)(_context2.t1, _context2.t2);
|
|
319
|
+
case 14:
|
|
320
|
+
_yield$__wbg_load = _context2.sent;
|
|
321
|
+
instance = _yield$__wbg_load.instance;
|
|
322
|
+
module = _yield$__wbg_load.module;
|
|
323
|
+
return _context2.abrupt("return", __wbg_finalize_init(instance, module));
|
|
324
|
+
case 18:
|
|
325
|
+
case "end":
|
|
326
|
+
return _context2.stop();
|
|
327
|
+
}
|
|
328
|
+
}, _callee2);
|
|
329
|
+
}));
|
|
330
|
+
return _wbg_init.apply(this, arguments);
|
|
331
|
+
}
|
|
332
|
+
var _default = exports["default"] = __wbg_init;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
var wasm = _interopRequireWildcard(require("./waosm_bg.wasm"));
|
|
8
|
+
var _waosm_bg2 = require("./waosm_bg.js");
|
|
9
|
+
Object.keys(_waosm_bg2).forEach(function (key) {
|
|
10
|
+
if (key === "default" || key === "__esModule") return;
|
|
11
|
+
if (key in exports && exports[key] === _waosm_bg2[key]) return;
|
|
12
|
+
Object.defineProperty(exports, key, {
|
|
13
|
+
enumerable: true,
|
|
14
|
+
get: function get() {
|
|
15
|
+
return _waosm_bg2[key];
|
|
16
|
+
}
|
|
17
|
+
});
|
|
18
|
+
});
|
|
19
|
+
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
|
|
20
|
+
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { "default": e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n["default"] = e, t && t.set(e, n), n; }
|
|
21
|
+
(0, _waosm_bg2.__wbg_set_wasm)(wasm);
|