js-confuser 2.0.0-alpha.2 → 2.0.0-alpha.3
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/CHANGELOG.md +24 -6
- package/dist/constants.js +6 -2
- package/dist/index.js +12 -0
- package/dist/obfuscator.js +117 -6
- package/dist/order.js +0 -1
- package/dist/probability.js +1 -96
- package/dist/templates/getGlobalTemplate.js +4 -1
- package/dist/templates/stringCompressionTemplate.js +3 -3
- package/dist/templates/tamperProtectionTemplates.js +1 -1
- package/dist/templates/template.js +17 -12
- package/dist/transforms/controlFlowFlattening.js +2 -6
- package/dist/transforms/deadCode.js +8 -15
- package/dist/transforms/dispatcher.js +1 -2
- package/dist/transforms/extraction/duplicateLiteralsRemoval.js +5 -0
- package/dist/transforms/extraction/objectExtraction.js +1 -2
- package/dist/transforms/finalizer.js +1 -1
- package/dist/transforms/flatten.js +2 -19
- package/dist/transforms/identifier/globalConcealing.js +1 -2
- package/dist/transforms/identifier/movedDeclarations.js +12 -5
- package/dist/transforms/identifier/renameVariables.js +7 -6
- package/dist/transforms/lock/lock.js +9 -2
- package/dist/transforms/minify.js +14 -1
- package/dist/transforms/opaquePredicates.js +5 -6
- package/dist/transforms/pack.js +5 -0
- package/dist/transforms/plugin.js +20 -39
- package/dist/transforms/renameLabels.js +1 -2
- package/dist/transforms/rgf.js +29 -11
- package/dist/transforms/shuffle.js +10 -11
- package/dist/transforms/string/stringCompression.js +14 -10
- package/dist/transforms/string/stringConcealing.js +4 -4
- package/dist/transforms/string/stringEncoding.js +4 -2
- package/dist/transforms/string/stringSplitting.js +4 -2
- package/dist/transforms/variableMasking.js +1 -2
- package/dist/utils/NameGen.js +3 -2
- package/dist/utils/PredicateGen.js +62 -0
- package/dist/utils/ast-utils.js +24 -9
- package/dist/validateOptions.js +2 -2
- package/package.json +2 -2
- package/src/constants.ts +6 -5
- package/src/index.ts +1 -0
- package/src/obfuscator.ts +148 -7
- package/src/options.ts +14 -6
- package/src/order.ts +0 -2
- package/src/probability.ts +0 -110
- package/src/templates/getGlobalTemplate.ts +5 -1
- package/src/templates/stringCompressionTemplate.ts +4 -28
- package/src/templates/tamperProtectionTemplates.ts +7 -3
- package/src/templates/template.ts +5 -3
- package/src/transforms/controlFlowFlattening.ts +2 -7
- package/src/transforms/deadCode.ts +11 -23
- package/src/transforms/dispatcher.ts +1 -2
- package/src/transforms/extraction/duplicateLiteralsRemoval.ts +10 -1
- package/src/transforms/extraction/objectExtraction.ts +1 -2
- package/src/transforms/finalizer.ts +1 -1
- package/src/transforms/flatten.ts +3 -22
- package/src/transforms/identifier/globalConcealing.ts +4 -2
- package/src/transforms/identifier/movedDeclarations.ts +18 -6
- package/src/transforms/identifier/renameVariables.ts +10 -6
- package/src/transforms/lock/lock.ts +14 -3
- package/src/transforms/minify.ts +24 -2
- package/src/transforms/opaquePredicates.ts +5 -8
- package/src/transforms/pack.ts +6 -0
- package/src/transforms/plugin.ts +47 -69
- package/src/transforms/renameLabels.ts +1 -2
- package/src/transforms/rgf.ts +39 -14
- package/src/transforms/shuffle.ts +28 -26
- package/src/transforms/string/encoding.ts +1 -1
- package/src/transforms/string/stringCompression.ts +22 -13
- package/src/transforms/string/stringConcealing.ts +11 -7
- package/src/transforms/string/stringEncoding.ts +6 -2
- package/src/transforms/string/stringSplitting.ts +9 -4
- package/src/transforms/variableMasking.ts +1 -2
- package/src/utils/NameGen.ts +4 -2
- package/src/utils/PredicateGen.ts +61 -0
- package/src/utils/ast-utils.ts +16 -9
- package/src/validateOptions.ts +7 -4
- package/src/transforms/functionOutlining.ts +0 -225
- package/src/utils/ControlObject.ts +0 -141
package/CHANGELOG.md
CHANGED
|
@@ -3,10 +3,12 @@
|
|
|
3
3
|
|
|
4
4
|
**⚠️ Warning: This an alpha release. This version is not stable and the likelihood of encountering bugs is significantly higher.**
|
|
5
5
|
|
|
6
|
-
### Complete rewrite of JS-Confuser using Babel!
|
|
6
|
+
### Complete rewrite of JS-Confuser using Babel! 🎉
|
|
7
7
|
|
|
8
8
|
**⚠️ Breaking changes**
|
|
9
9
|
|
|
10
|
+
> Check out the [Migration guide](./Migration.md) on how to properly update from 1.X to 2.0. The obfuscation upgrades in 2.0 are worth the small refactoring.
|
|
11
|
+
|
|
10
12
|
- Revamped API Interface
|
|
11
13
|
|
|
12
14
|
- - JSConfuser.obfuscate() resolves to an object
|
|
@@ -17,13 +19,29 @@
|
|
|
17
19
|
|
|
18
20
|
- Renamed `Stack` to `Variable Masking`
|
|
19
21
|
|
|
22
|
+
- Added configurable limits to options:
|
|
23
|
+
|
|
24
|
+
```js
|
|
25
|
+
const options = {
|
|
26
|
+
target: "node",
|
|
27
|
+
|
|
28
|
+
rgf: {
|
|
29
|
+
value: 0.5, // = 50% of eligible functions
|
|
30
|
+
limit: 10 // Maximum of 10 changes for performance reasons
|
|
31
|
+
},
|
|
32
|
+
|
|
33
|
+
// Original format is still valid (No limit applied)
|
|
34
|
+
rgf: 0.5
|
|
35
|
+
}
|
|
36
|
+
```
|
|
37
|
+
|
|
20
38
|
### 2.0 Changes
|
|
21
39
|
|
|
22
|
-
- Added Custom String Encoding and Custom Lock Code options
|
|
40
|
+
- Added [Custom String Encoding](https://new--confuser.netlify.app/docs/options/customStringEncodings) and [Custom Lock Code](https://new--confuser.netlify.app/docs/options/customLocks) options
|
|
23
41
|
|
|
24
|
-
- Added `Rename Labels` Learn more here
|
|
42
|
+
- Added `Rename Labels` [Learn more here](https://new--confuser.netlify.app/docs/options/renamelabels#rename-labels)
|
|
25
43
|
|
|
26
|
-
- Added `Pack` Learn more here
|
|
44
|
+
- Added `Pack` [Learn more here](https://new--confuser.netlify.app/docs/options/pack#pack)
|
|
27
45
|
|
|
28
46
|
- RGF no longers uses `new Function` instead uses `eval`
|
|
29
47
|
|
|
@@ -49,7 +67,7 @@
|
|
|
49
67
|
|
|
50
68
|
- - [Regular expressions](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_expressions) are now obfuscated (First converted into equivalent RegExp() constructor calls)
|
|
51
69
|
|
|
52
|
-
- - `String Compression` now uses
|
|
70
|
+
- - `String Compression` now uses LZ-string compression ([lz-string](https://www.npmjs.com/package/lz-string))
|
|
53
71
|
|
|
54
72
|
### JS-Confuser.com Revamp
|
|
55
73
|
|
|
@@ -61,7 +79,7 @@ The previous version will remain available: [old--confuser.netlify.com](https://
|
|
|
61
79
|
|
|
62
80
|
- Removed `ES5` option - Use Babel Instead
|
|
63
81
|
|
|
64
|
-
- Removed `Browser Lock` and `OS Lock` - Use Custom Locks instead
|
|
82
|
+
- Removed `Browser Lock` and `OS Lock` - Use [Custom Locks](https://new--confuser.netlify.app/docs/options/customlocks#custom-locks) instead
|
|
65
83
|
|
|
66
84
|
- Removed `Shuffle`'s Hash option
|
|
67
85
|
|
package/dist/constants.js
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.variableFunctionName = exports.reservedObjectPrototype = exports.reservedKeywords = exports.reservedIdentifiers = exports.predictableFunctionTag = exports.placeholderVariablePrefix = exports.noRenameVariablePrefix = exports.WITH_STATEMENT = exports.UNSAFE = exports.SKIP = exports.PREDICTABLE = exports.NO_RENAME = exports.
|
|
6
|
+
exports.variableFunctionName = exports.reservedObjectPrototype = exports.reservedKeywords = exports.reservedIdentifiers = exports.predictableFunctionTag = exports.placeholderVariablePrefix = exports.noRenameVariablePrefix = exports.WITH_STATEMENT = exports.UNSAFE = exports.SKIP = exports.PREDICTABLE = exports.NO_RENAME = exports.NO_REMOVE = exports.MULTI_TRANSFORM = exports.GEN_NODE = exports.FN_LENGTH = void 0;
|
|
7
7
|
var predictableFunctionTag = exports.predictableFunctionTag = "__JS_PREDICT__";
|
|
8
8
|
|
|
9
9
|
/**
|
|
@@ -34,7 +34,6 @@ var SKIP = exports.SKIP = Symbol("skip");
|
|
|
34
34
|
* Saves the original length of a function.
|
|
35
35
|
*/
|
|
36
36
|
var FN_LENGTH = exports.FN_LENGTH = Symbol("fnLength");
|
|
37
|
-
var CONTROL_OBJECTS = exports.CONTROL_OBJECTS = Symbol("controlObjects");
|
|
38
37
|
var NO_RENAME = exports.NO_RENAME = Symbol("noRename");
|
|
39
38
|
|
|
40
39
|
/**
|
|
@@ -60,6 +59,11 @@ var MULTI_TRANSFORM = exports.MULTI_TRANSFORM = Symbol("multiTransform");
|
|
|
60
59
|
*/
|
|
61
60
|
var WITH_STATEMENT = exports.WITH_STATEMENT = Symbol("withStatement");
|
|
62
61
|
|
|
62
|
+
/**
|
|
63
|
+
* Tells minify to not remove the node.
|
|
64
|
+
*/
|
|
65
|
+
var NO_REMOVE = exports.NO_REMOVE = Symbol("noRemove");
|
|
66
|
+
|
|
63
67
|
/**
|
|
64
68
|
* Symbols describe precomputed semantics of a node, allowing the obfuscator to make the best choices for the node.
|
|
65
69
|
*/
|
package/dist/index.js
CHANGED
|
@@ -3,10 +3,22 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
+
Object.defineProperty(exports, "Template", {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
get: function get() {
|
|
9
|
+
return _template["default"];
|
|
10
|
+
}
|
|
11
|
+
});
|
|
6
12
|
exports["default"] = void 0;
|
|
7
13
|
exports.obfuscate = obfuscate;
|
|
8
14
|
exports.obfuscateAST = obfuscateAST;
|
|
9
15
|
exports.obfuscateWithProfiler = obfuscateWithProfiler;
|
|
16
|
+
Object.defineProperty(exports, "presets", {
|
|
17
|
+
enumerable: true,
|
|
18
|
+
get: function get() {
|
|
19
|
+
return _presets["default"];
|
|
20
|
+
}
|
|
21
|
+
});
|
|
10
22
|
var _obfuscator = _interopRequireDefault(require("./obfuscator"));
|
|
11
23
|
var _presets = _interopRequireDefault(require("./presets"));
|
|
12
24
|
var _template = _interopRequireDefault(require("./templates/template"));
|
package/dist/obfuscator.js
CHANGED
|
@@ -9,7 +9,6 @@ var _generator = _interopRequireDefault(require("@babel/generator"));
|
|
|
9
9
|
var _traverse = _interopRequireDefault(require("@babel/traverse"));
|
|
10
10
|
var _parser = require("@babel/parser");
|
|
11
11
|
var _validateOptions = require("./validateOptions");
|
|
12
|
-
var _probability = require("./probability");
|
|
13
12
|
var _NameGen = require("./utils/NameGen");
|
|
14
13
|
var _order = require("./order");
|
|
15
14
|
var _plugin = require("./transforms/plugin");
|
|
@@ -19,7 +18,6 @@ var _variableMasking = _interopRequireDefault(require("./transforms/variableMask
|
|
|
19
18
|
var _dispatcher = _interopRequireDefault(require("./transforms/dispatcher"));
|
|
20
19
|
var _duplicateLiteralsRemoval = _interopRequireDefault(require("./transforms/extraction/duplicateLiteralsRemoval"));
|
|
21
20
|
var _objectExtraction = _interopRequireDefault(require("./transforms/extraction/objectExtraction"));
|
|
22
|
-
var _functionOutlining = _interopRequireDefault(require("./transforms/functionOutlining"));
|
|
23
21
|
var _globalConcealing = _interopRequireDefault(require("./transforms/identifier/globalConcealing"));
|
|
24
22
|
var _stringCompression = _interopRequireDefault(require("./transforms/string/stringCompression"));
|
|
25
23
|
var _deadCode = _interopRequireDefault(require("./transforms/deadCode"));
|
|
@@ -39,6 +37,7 @@ var _minify = _interopRequireDefault(require("./transforms/minify"));
|
|
|
39
37
|
var _finalizer = _interopRequireDefault(require("./transforms/finalizer"));
|
|
40
38
|
var _integrity = _interopRequireDefault(require("./transforms/lock/integrity"));
|
|
41
39
|
var _pack = _interopRequireDefault(require("./transforms/pack"));
|
|
40
|
+
var _objectUtils = require("./utils/object-utils");
|
|
42
41
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; }
|
|
43
42
|
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; }
|
|
44
43
|
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); }
|
|
@@ -87,12 +86,13 @@ var Obfuscator = exports["default"] = /*#__PURE__*/function () {
|
|
|
87
86
|
}
|
|
88
87
|
});
|
|
89
88
|
_defineProperty(this, "index", 0);
|
|
89
|
+
_defineProperty(this, "probabilityMapCounter", new WeakMap());
|
|
90
90
|
this.parentObfuscator = parentObfuscator;
|
|
91
91
|
(0, _validateOptions.validateOptions)(userOptions);
|
|
92
92
|
this.options = (0, _validateOptions.applyDefaultsToOptions)(_objectSpread({}, userOptions));
|
|
93
93
|
this.nameGen = new _NameGen.NameGen(this.options.identifierGenerator);
|
|
94
94
|
var shouldAddLockTransform = this.options.lock && (Object.keys(this.options.lock).filter(function (key) {
|
|
95
|
-
return key !== "customLocks" &&
|
|
95
|
+
return key !== "customLocks" && _this.isProbabilityMapProbable(_this.options.lock[key]);
|
|
96
96
|
}).length > 0 || this.options.lock.customLocks.length > 0);
|
|
97
97
|
var allPlugins = [];
|
|
98
98
|
var push = function push(probabilityMap) {
|
|
@@ -100,7 +100,7 @@ var Obfuscator = exports["default"] = /*#__PURE__*/function () {
|
|
|
100
100
|
pluginFns[_key - 1] = arguments[_key];
|
|
101
101
|
}
|
|
102
102
|
_this.totalPossibleTransforms += pluginFns.length;
|
|
103
|
-
if (!
|
|
103
|
+
if (!_this.isProbabilityMapProbable(probabilityMap)) return;
|
|
104
104
|
allPlugins.push.apply(allPlugins, pluginFns);
|
|
105
105
|
};
|
|
106
106
|
push(true, _preparation["default"]);
|
|
@@ -114,10 +114,12 @@ var Obfuscator = exports["default"] = /*#__PURE__*/function () {
|
|
|
114
114
|
push(this.options.calculator, _calculator["default"]);
|
|
115
115
|
push(this.options.globalConcealing, _globalConcealing["default"]);
|
|
116
116
|
push(this.options.opaquePredicates, _opaquePredicates["default"]);
|
|
117
|
-
push(this.options.functionOutlining, _functionOutlining["default"]);
|
|
118
117
|
push(this.options.stringSplitting, _stringSplitting["default"]);
|
|
119
118
|
push(this.options.stringConcealing, _stringConcealing["default"]);
|
|
120
|
-
|
|
119
|
+
// String Compression is only applied to the main obfuscator
|
|
120
|
+
// Any RGF functions will not have string compression due to the size of the decompression function
|
|
121
|
+
|
|
122
|
+
push(!parentObfuscator && this.options.stringCompression, _stringCompression["default"]);
|
|
121
123
|
push(this.options.variableMasking, _variableMasking["default"]);
|
|
122
124
|
push(this.options.duplicateLiteralsRemoval, _duplicateLiteralsRemoval["default"]);
|
|
123
125
|
push(this.options.shuffle, _shuffle["default"]);
|
|
@@ -311,6 +313,115 @@ var Obfuscator = exports["default"] = /*#__PURE__*/function () {
|
|
|
311
313
|
/**
|
|
312
314
|
* Generates code from an AST using `@babel/generator`
|
|
313
315
|
*/
|
|
316
|
+
}, {
|
|
317
|
+
key: "computeProbabilityMap",
|
|
318
|
+
value:
|
|
319
|
+
/**
|
|
320
|
+
* Evaluates a ProbabilityMap.
|
|
321
|
+
* @param map The setting object.
|
|
322
|
+
* @param customFnArgs Args given to user-implemented function, such as a variable name.
|
|
323
|
+
*/
|
|
324
|
+
function computeProbabilityMap(map) {
|
|
325
|
+
for (var _len2 = arguments.length, customImplementationArgs = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
|
|
326
|
+
customImplementationArgs[_key2 - 1] = arguments[_key2];
|
|
327
|
+
}
|
|
328
|
+
// Check if this probability map uses the {value: ..., limit: ...} format
|
|
329
|
+
if (_typeof(map) === "object" && map && "value" in map) {
|
|
330
|
+
// Check for the limit property
|
|
331
|
+
if ("limit" in map && typeof map.limit === "number" && map.limit >= 0) {
|
|
332
|
+
// Check if the limit has been reached
|
|
333
|
+
if (this.probabilityMapCounter.get(map) >= map.limit) {
|
|
334
|
+
return false;
|
|
335
|
+
}
|
|
336
|
+
}
|
|
337
|
+
var value = this.computeProbabilityMap.apply(this, [map.value].concat(customImplementationArgs));
|
|
338
|
+
if (value) {
|
|
339
|
+
// Increment the counter for this map
|
|
340
|
+
this.probabilityMapCounter.set(map, this.probabilityMapCounter.get(map) + 1 || 1);
|
|
341
|
+
}
|
|
342
|
+
return value;
|
|
343
|
+
}
|
|
344
|
+
if (!map) {
|
|
345
|
+
return false;
|
|
346
|
+
}
|
|
347
|
+
if (map === true || map === 1) {
|
|
348
|
+
return true;
|
|
349
|
+
}
|
|
350
|
+
if (typeof map === "number") {
|
|
351
|
+
return Math.random() < map;
|
|
352
|
+
}
|
|
353
|
+
if (typeof map === "function") {
|
|
354
|
+
return map.apply(void 0, customImplementationArgs);
|
|
355
|
+
}
|
|
356
|
+
if (typeof map === "string") {
|
|
357
|
+
return map;
|
|
358
|
+
}
|
|
359
|
+
var asObject = {};
|
|
360
|
+
if (Array.isArray(map)) {
|
|
361
|
+
map.forEach(function (x) {
|
|
362
|
+
asObject[x.toString()] = 1;
|
|
363
|
+
});
|
|
364
|
+
} else {
|
|
365
|
+
asObject = map;
|
|
366
|
+
}
|
|
367
|
+
var total = Object.values(asObject).reduce(function (a, b) {
|
|
368
|
+
return a + b;
|
|
369
|
+
});
|
|
370
|
+
var percentages = (0, _objectUtils.createObject)(Object.keys(asObject), Object.values(asObject).map(function (x) {
|
|
371
|
+
return x / total;
|
|
372
|
+
}));
|
|
373
|
+
var ticket = Math.random();
|
|
374
|
+
var count = 0;
|
|
375
|
+
var winner = null;
|
|
376
|
+
Object.keys(percentages).forEach(function (key) {
|
|
377
|
+
var x = Number(percentages[key]);
|
|
378
|
+
if (ticket >= count && ticket < count + x) {
|
|
379
|
+
winner = key;
|
|
380
|
+
}
|
|
381
|
+
count += x;
|
|
382
|
+
});
|
|
383
|
+
return winner;
|
|
384
|
+
}
|
|
385
|
+
|
|
386
|
+
/**
|
|
387
|
+
* Determines if a probability map can return a positive result (true, or some string mode).
|
|
388
|
+
* - Negative probability maps are used to remove transformations from running entirely.
|
|
389
|
+
* @param map
|
|
390
|
+
*/
|
|
391
|
+
}, {
|
|
392
|
+
key: "isProbabilityMapProbable",
|
|
393
|
+
value: function isProbabilityMapProbable(map) {
|
|
394
|
+
(0, _assert.ok)(!Number.isNaN(map), "Numbers cannot be NaN");
|
|
395
|
+
if (!map || typeof map === "undefined") {
|
|
396
|
+
return false;
|
|
397
|
+
}
|
|
398
|
+
if (typeof map === "function") {
|
|
399
|
+
return true;
|
|
400
|
+
}
|
|
401
|
+
if (typeof map === "number") {
|
|
402
|
+
if (map > 1 || map < 0) {
|
|
403
|
+
throw new Error("Numbers must be between 0 and 1 for 0% - 100%");
|
|
404
|
+
}
|
|
405
|
+
}
|
|
406
|
+
if (Array.isArray(map)) {
|
|
407
|
+
(0, _assert.ok)(map.length != 0, "Empty arrays are not allowed for options. Use false instead.");
|
|
408
|
+
if (map.length == 1) {
|
|
409
|
+
return !!map[0];
|
|
410
|
+
}
|
|
411
|
+
}
|
|
412
|
+
if (_typeof(map) === "object") {
|
|
413
|
+
if (map instanceof Date) return true;
|
|
414
|
+
if (map instanceof RegExp) return true;
|
|
415
|
+
if ("value" in map && !map.value) return false;
|
|
416
|
+
if ("limit" in map && map.limit === 0) return false;
|
|
417
|
+
var keys = Object.keys(map);
|
|
418
|
+
(0, _assert.ok)(keys.length != 0, "Empty objects are not allowed for options. Use false instead.");
|
|
419
|
+
if (keys.length == 1) {
|
|
420
|
+
return !!map[keys[0]];
|
|
421
|
+
}
|
|
422
|
+
}
|
|
423
|
+
return true;
|
|
424
|
+
}
|
|
314
425
|
}], [{
|
|
315
426
|
key: "generateCode",
|
|
316
427
|
value: function generateCode(ast) {
|
package/dist/order.js
CHANGED
|
@@ -26,7 +26,6 @@ var Order = exports.Order = /*#__PURE__*/function (Order) {
|
|
|
26
26
|
Order[Order["Shuffle"] = 23] = "Shuffle";
|
|
27
27
|
Order[Order["ControlFlowFlattening"] = 24] = "ControlFlowFlattening";
|
|
28
28
|
Order[Order["MovedDeclarations"] = 25] = "MovedDeclarations";
|
|
29
|
-
Order[Order["FunctionOutlining"] = 26] = "FunctionOutlining";
|
|
30
29
|
Order[Order["RenameLabels"] = 27] = "RenameLabels";
|
|
31
30
|
Order[Order["Minify"] = 28] = "Minify";
|
|
32
31
|
Order[Order["AstScrambler"] = 29] = "AstScrambler";
|
package/dist/probability.js
CHANGED
|
@@ -1,96 +1 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.computeProbabilityMap = computeProbabilityMap;
|
|
7
|
-
exports.isProbabilityMapProbable = isProbabilityMapProbable;
|
|
8
|
-
var _assert = require("assert");
|
|
9
|
-
var _objectUtils = require("./utils/object-utils");
|
|
10
|
-
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); }
|
|
11
|
-
/**
|
|
12
|
-
* Evaluates a ProbabilityMap.
|
|
13
|
-
* @param map The setting object.
|
|
14
|
-
* @param customFnArgs Args given to user-implemented function, such as a variable name.
|
|
15
|
-
*/
|
|
16
|
-
function computeProbabilityMap(map) {
|
|
17
|
-
if (!map) {
|
|
18
|
-
return false;
|
|
19
|
-
}
|
|
20
|
-
if (map === true || map === 1) {
|
|
21
|
-
return true;
|
|
22
|
-
}
|
|
23
|
-
if (typeof map === "number") {
|
|
24
|
-
return Math.random() < map;
|
|
25
|
-
}
|
|
26
|
-
if (typeof map === "function") {
|
|
27
|
-
for (var _len = arguments.length, customImplementationArgs = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
|
|
28
|
-
customImplementationArgs[_key - 1] = arguments[_key];
|
|
29
|
-
}
|
|
30
|
-
return map.apply(void 0, customImplementationArgs);
|
|
31
|
-
}
|
|
32
|
-
if (typeof map === "string") {
|
|
33
|
-
return map;
|
|
34
|
-
}
|
|
35
|
-
var asObject = {};
|
|
36
|
-
if (Array.isArray(map)) {
|
|
37
|
-
map.forEach(function (x) {
|
|
38
|
-
asObject[x.toString()] = 1;
|
|
39
|
-
});
|
|
40
|
-
} else {
|
|
41
|
-
asObject = map;
|
|
42
|
-
}
|
|
43
|
-
var total = Object.values(asObject).reduce(function (a, b) {
|
|
44
|
-
return a + b;
|
|
45
|
-
});
|
|
46
|
-
var percentages = (0, _objectUtils.createObject)(Object.keys(asObject), Object.values(asObject).map(function (x) {
|
|
47
|
-
return x / total;
|
|
48
|
-
}));
|
|
49
|
-
var ticket = Math.random();
|
|
50
|
-
var count = 0;
|
|
51
|
-
var winner = null;
|
|
52
|
-
Object.keys(percentages).forEach(function (key) {
|
|
53
|
-
var x = Number(percentages[key]);
|
|
54
|
-
if (ticket >= count && ticket < count + x) {
|
|
55
|
-
winner = key;
|
|
56
|
-
}
|
|
57
|
-
count += x;
|
|
58
|
-
});
|
|
59
|
-
return winner;
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
/**
|
|
63
|
-
* Determines if a probability map can return a positive result (true, or some string mode).
|
|
64
|
-
* - Negative probability maps are used to remove transformations from running entirely.
|
|
65
|
-
* @param map
|
|
66
|
-
*/
|
|
67
|
-
function isProbabilityMapProbable(map) {
|
|
68
|
-
(0, _assert.ok)(!Number.isNaN(map), "Numbers cannot be NaN");
|
|
69
|
-
if (!map || typeof map === "undefined") {
|
|
70
|
-
return false;
|
|
71
|
-
}
|
|
72
|
-
if (typeof map === "function") {
|
|
73
|
-
return true;
|
|
74
|
-
}
|
|
75
|
-
if (typeof map === "number") {
|
|
76
|
-
if (map > 1 || map < 0) {
|
|
77
|
-
throw new Error("Numbers must be between 0 and 1 for 0% - 100%");
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
if (Array.isArray(map)) {
|
|
81
|
-
(0, _assert.ok)(map.length != 0, "Empty arrays are not allowed for options. Use false instead.");
|
|
82
|
-
if (map.length == 1) {
|
|
83
|
-
return !!map[0];
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
|
-
if (_typeof(map) === "object") {
|
|
87
|
-
if (map instanceof Date) return true;
|
|
88
|
-
if (map instanceof RegExp) return true;
|
|
89
|
-
var keys = Object.keys(map);
|
|
90
|
-
(0, _assert.ok)(keys.length != 0, "Empty objects are not allowed for options. Use false instead.");
|
|
91
|
-
if (keys.length == 1) {
|
|
92
|
-
return !!keys[0];
|
|
93
|
-
}
|
|
94
|
-
}
|
|
95
|
-
return true;
|
|
96
|
-
}
|
|
1
|
+
"use strict";
|
|
@@ -6,10 +6,13 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.createGetGlobalTemplate = void 0;
|
|
7
7
|
var _template = _interopRequireDefault(require("./template"));
|
|
8
8
|
var _constants = require("../constants");
|
|
9
|
+
var _astUtils = require("../utils/ast-utils");
|
|
9
10
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; }
|
|
10
11
|
var createGetGlobalTemplate = exports.createGetGlobalTemplate = function createGetGlobalTemplate(pluginInstance, path) {
|
|
11
12
|
var _pluginInstance$optio;
|
|
12
|
-
if ((_pluginInstance$optio = pluginInstance.options.lock) !== null && _pluginInstance$optio !== void 0 && _pluginInstance$optio.tamperProtection) {
|
|
13
|
+
if ((_pluginInstance$optio = pluginInstance.options.lock) !== null && _pluginInstance$optio !== void 0 && _pluginInstance$optio.tamperProtection && !path.find(function (p) {
|
|
14
|
+
return (0, _astUtils.isStrictMode)(p);
|
|
15
|
+
})) {
|
|
13
16
|
return new _template["default"]("\n function {getGlobalFnName}(){\n var localVar = false;\n eval(__JS_CONFUSER_VAR__(localVar) + \" = true\")\n if (!localVar) {\n {countermeasures}\n\n return {};\n }\n\n const root = eval(\"this\");\n return root;\n }\n ").addSymbols(_constants.UNSAFE).setDefaultVariables({
|
|
14
17
|
countermeasures: pluginInstance.globalState.lock.createCountermeasuresCode()
|
|
15
18
|
});
|
|
@@ -3,8 +3,8 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.StringCompressionTemplate = exports.
|
|
6
|
+
exports.StringCompressionTemplate = exports.StringCompressionLibraryMinified = void 0;
|
|
7
7
|
var _template = _interopRequireDefault(require("./template"));
|
|
8
8
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; }
|
|
9
|
-
var StringCompressionTemplate = exports.StringCompressionTemplate = new _template["default"]("\nvar {stringFn};\n\n(function (){\n
|
|
10
|
-
var PakoInflateMin = exports.PakoInflateMin = " \nvar {pako} = {};\n\n/*! pako 2.1.0 https://github.com/nodeca/pako @license (MIT AND Zlib) */\n!function(e,t){ t({pako}) }(this,(function(e){\"use strict\";var t=function(e,t,i,n){for(var a=65535&e|0,r=e>>>16&65535|0,o=0;0!==i;){i-=o=i>2e3?2e3:i;do{r=r+(a=a+t[n++]|0)|0}while(--o);a%=65521,r%=65521}return a|r<<16|0},i=new Uint32Array(function(){for(var e,t=[],i=0;i<256;i++){e=i;for(var n=0;n<8;n++)e=1&e?3988292384^e>>>1:e>>>1;t[i]=e}return t}()),n=function(e,t,n,a){var r=i,o=a+n;e^=-1;for(var s=a;s<o;s++)e=e>>>8^r[255&(e^t[s])];return-1^e},a=16209,r=function(e,t){var i,n,r,o,s,l,f,d,h,c,u,w,b,m,k,_,v,g,p,y,x,E,R,A,Z=e.state;i=e.next_in,R=e.input,n=i+(e.avail_in-5),r=e.next_out,A=e.output,o=r-(t-e.avail_out),s=r+(e.avail_out-257),l=Z.dmax,f=Z.wsize,d=Z.whave,h=Z.wnext,c=Z.window,u=Z.hold,w=Z.bits,b=Z.lencode,m=Z.distcode,k=(1<<Z.lenbits)-1,_=(1<<Z.distbits)-1;e:do{w<15&&(u+=R[i++]<<w,w+=8,u+=R[i++]<<w,w+=8),v=b[u&k];t:for(;;){if(u>>>=g=v>>>24,w-=g,0===(g=v>>>16&255))A[r++]=65535&v;else{if(!(16&g)){if(0==(64&g)){v=b[(65535&v)+(u&(1<<g)-1)];continue t}if(32&g){Z.mode=16191;break e}e.msg=\"invalid literal/length code\",Z.mode=a;break e}p=65535&v,(g&=15)&&(w<g&&(u+=R[i++]<<w,w+=8),p+=u&(1<<g)-1,u>>>=g,w-=g),w<15&&(u+=R[i++]<<w,w+=8,u+=R[i++]<<w,w+=8),v=m[u&_];i:for(;;){if(u>>>=g=v>>>24,w-=g,!(16&(g=v>>>16&255))){if(0==(64&g)){v=m[(65535&v)+(u&(1<<g)-1)];continue i}e.msg=\"invalid distance code\",Z.mode=a;break e}if(y=65535&v,w<(g&=15)&&(u+=R[i++]<<w,(w+=8)<g&&(u+=R[i++]<<w,w+=8)),(y+=u&(1<<g)-1)>l){e.msg=\"invalid distance too far back\",Z.mode=a;break e}if(u>>>=g,w-=g,y>(g=r-o)){if((g=y-g)>d&&Z.sane){e.msg=\"invalid distance too far back\",Z.mode=a;break e}if(x=0,E=c,0===h){if(x+=f-g,g<p){p-=g;do{A[r++]=c[x++]}while(--g);x=r-y,E=A}}else if(h<g){if(x+=f+h-g,(g-=h)<p){p-=g;do{A[r++]=c[x++]}while(--g);if(x=0,h<p){p-=g=h;do{A[r++]=c[x++]}while(--g);x=r-y,E=A}}}else if(x+=h-g,g<p){p-=g;do{A[r++]=c[x++]}while(--g);x=r-y,E=A}for(;p>2;)A[r++]=E[x++],A[r++]=E[x++],A[r++]=E[x++],p-=3;p&&(A[r++]=E[x++],p>1&&(A[r++]=E[x++]))}else{x=r-y;do{A[r++]=A[x++],A[r++]=A[x++],A[r++]=A[x++],p-=3}while(p>2);p&&(A[r++]=A[x++],p>1&&(A[r++]=A[x++]))}break}}break}}while(i<n&&r<s);i-=p=w>>3,u&=(1<<(w-=p<<3))-1,e.next_in=i,e.next_out=r,e.avail_in=i<n?n-i+5:5-(i-n),e.avail_out=r<s?s-r+257:257-(r-s),Z.hold=u,Z.bits=w},o=15,s=new Uint16Array([3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,0,0]),l=new Uint8Array([16,16,16,16,16,16,16,16,17,17,17,17,18,18,18,18,19,19,19,19,20,20,20,20,21,21,21,21,16,72,78]),f=new Uint16Array([1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,0,0]),d=new Uint8Array([16,16,16,16,17,17,18,18,19,19,20,20,21,21,22,22,23,23,24,24,25,25,26,26,27,27,28,28,29,29,64,64]),h=function(e,t,i,n,a,r,h,c){var u,w,b,m,k,_,v,g,p,y=c.bits,x=0,E=0,R=0,A=0,Z=0,S=0,T=0,O=0,U=0,D=0,I=null,B=new Uint16Array(16),N=new Uint16Array(16),C=null;for(x=0;x<=o;x++)B[x]=0;for(E=0;E<n;E++)B[t[i+E]]++;for(Z=y,A=o;A>=1&&0===B[A];A--);if(Z>A&&(Z=A),0===A)return a[r++]=20971520,a[r++]=20971520,c.bits=1,0;for(R=1;R<A&&0===B[R];R++);for(Z<R&&(Z=R),O=1,x=1;x<=o;x++)if(O<<=1,(O-=B[x])<0)return-1;if(O>0&&(0===e||1!==A))return-1;for(N[1]=0,x=1;x<o;x++)N[x+1]=N[x]+B[x];for(E=0;E<n;E++)0!==t[i+E]&&(h[N[t[i+E]]++]=E);if(0===e?(I=C=h,_=20):1===e?(I=s,C=l,_=257):(I=f,C=d,_=0),D=0,E=0,x=R,k=r,S=Z,T=0,b=-1,m=(U=1<<Z)-1,1===e&&U>852||2===e&&U>592)return 1;for(;;){v=x-T,h[E]+1<_?(g=0,p=h[E]):h[E]>=_?(g=C[h[E]-_],p=I[h[E]-_]):(g=96,p=0),u=1<<x-T,R=w=1<<S;do{a[k+(D>>T)+(w-=u)]=v<<24|g<<16|p|0}while(0!==w);for(u=1<<x-1;D&u;)u>>=1;if(0!==u?(D&=u-1,D+=u):D=0,E++,0==--B[x]){if(x===A)break;x=t[i+h[E]]}if(x>Z&&(D&m)!==b){for(0===T&&(T=Z),k+=R,O=1<<(S=x-T);S+T<A&&!((O-=B[S+T])<=0);)S++,O<<=1;if(U+=1<<S,1===e&&U>852||2===e&&U>592)return 1;a[b=D&m]=Z<<24|S<<16|k-r|0}}return 0!==D&&(a[k+D]=x-T<<24|64<<16|0),c.bits=Z,0},c={Z_NO_FLUSH:0,Z_PARTIAL_FLUSH:1,Z_SYNC_FLUSH:2,Z_FULL_FLUSH:3,Z_FINISH:4,Z_BLOCK:5,Z_TREES:6,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_ERRNO:-1,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_MEM_ERROR:-4,Z_BUF_ERROR:-5,Z_NO_COMPRESSION:0,Z_BEST_SPEED:1,Z_BEST_COMPRESSION:9,Z_DEFAULT_COMPRESSION:-1,Z_FILTERED:1,Z_HUFFMAN_ONLY:2,Z_RLE:3,Z_FIXED:4,Z_DEFAULT_STRATEGY:0,Z_BINARY:0,Z_TEXT:1,Z_UNKNOWN:2,Z_DEFLATED:8},u=c.Z_FINISH,w=c.Z_BLOCK,b=c.Z_TREES,m=c.Z_OK,k=c.Z_STREAM_END,_=c.Z_NEED_DICT,v=c.Z_STREAM_ERROR,g=c.Z_DATA_ERROR,p=c.Z_MEM_ERROR,y=c.Z_BUF_ERROR,x=c.Z_DEFLATED,E=16180,R=16190,A=16191,Z=16192,S=16194,T=16199,O=16200,U=16206,D=16209,I=function(e){return(e>>>24&255)+(e>>>8&65280)+((65280&e)<<8)+((255&e)<<24)};function B(){this.strm=null,this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new Uint16Array(320),this.work=new Uint16Array(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}var N,C,z=function(e){if(!e)return 1;var t=e.state;return!t||t.strm!==e||t.mode<E||t.mode>16211?1:0},F=function(e){if(z(e))return v;var t=e.state;return e.total_in=e.total_out=t.total=0,e.msg=\"\",t.wrap&&(e.adler=1&t.wrap),t.mode=E,t.last=0,t.havedict=0,t.flags=-1,t.dmax=32768,t.head=null,t.hold=0,t.bits=0,t.lencode=t.lendyn=new Int32Array(852),t.distcode=t.distdyn=new Int32Array(592),t.sane=1,t.back=-1,m},L=function(e){if(z(e))return v;var t=e.state;return t.wsize=0,t.whave=0,t.wnext=0,F(e)},M=function(e,t){var i;if(z(e))return v;var n=e.state;return t<0?(i=0,t=-t):(i=5+(t>>4),t<48&&(t&=15)),t&&(t<8||t>15)?v:(null!==n.window&&n.wbits!==t&&(n.window=null),n.wrap=i,n.wbits=t,L(e))},H=function(e,t){if(!e)return v;var i=new B;e.state=i,i.strm=e,i.window=null,i.mode=E;var n=M(e,t);return n!==m&&(e.state=null),n},j=!0,K=function(e){if(j){N=new Int32Array(512),C=new Int32Array(32);for(var t=0;t<144;)e.lens[t++]=8;for(;t<256;)e.lens[t++]=9;for(;t<280;)e.lens[t++]=7;for(;t<288;)e.lens[t++]=8;for(h(1,e.lens,0,288,N,0,e.work,{bits:9}),t=0;t<32;)e.lens[t++]=5;h(2,e.lens,0,32,C,0,e.work,{bits:5}),j=!1}e.lencode=N,e.lenbits=9,e.distcode=C,e.distbits=5},P=function(e,t,i,n){var a,r=e.state;return null===r.window&&(r.wsize=1<<r.wbits,r.wnext=0,r.whave=0,r.window=new Uint8Array(r.wsize)),n>=r.wsize?(r.window.set(t.subarray(i-r.wsize,i),0),r.wnext=0,r.whave=r.wsize):((a=r.wsize-r.wnext)>n&&(a=n),r.window.set(t.subarray(i-n,i-n+a),r.wnext),(n-=a)?(r.window.set(t.subarray(i-n,i),0),r.wnext=n,r.whave=r.wsize):(r.wnext+=a,r.wnext===r.wsize&&(r.wnext=0),r.whave<r.wsize&&(r.whave+=a))),0},Y={inflateReset:L,inflateReset2:M,inflateResetKeep:F,inflateInit:function(e){return H(e,15)},inflateInit2:H,inflate:function(e,i){var a,o,s,l,f,d,c,B,N,C,F,L,M,H,j,Y,G,X,W,q,J,Q,V,$,ee=0,te=new Uint8Array(4),ie=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]);if(z(e)||!e.output||!e.input&&0!==e.avail_in)return v;(a=e.state).mode===A&&(a.mode=Z),f=e.next_out,s=e.output,c=e.avail_out,l=e.next_in,o=e.input,d=e.avail_in,B=a.hold,N=a.bits,C=d,F=c,Q=m;e:for(;;)switch(a.mode){case E:if(0===a.wrap){a.mode=Z;break}for(;N<16;){if(0===d)break e;d--,B+=o[l++]<<N,N+=8}if(2&a.wrap&&35615===B){0===a.wbits&&(a.wbits=15),a.check=0,te[0]=255&B,te[1]=B>>>8&255,a.check=n(a.check,te,2,0),B=0,N=0,a.mode=16181;break}if(a.head&&(a.head.done=!1),!(1&a.wrap)||(((255&B)<<8)+(B>>8))%31){e.msg=\"incorrect header check\",a.mode=D;break}if((15&B)!==x){e.msg=\"unknown compression method\",a.mode=D;break}if(N-=4,J=8+(15&(B>>>=4)),0===a.wbits&&(a.wbits=J),J>15||J>a.wbits){e.msg=\"invalid window size\",a.mode=D;break}a.dmax=1<<a.wbits,a.flags=0,e.adler=a.check=1,a.mode=512&B?16189:A,B=0,N=0;break;case 16181:for(;N<16;){if(0===d)break e;d--,B+=o[l++]<<N,N+=8}if(a.flags=B,(255&a.flags)!==x){e.msg=\"unknown compression method\",a.mode=D;break}if(57344&a.flags){e.msg=\"unknown header flags set\",a.mode=D;break}a.head&&(a.head.text=B>>8&1),512&a.flags&&4&a.wrap&&(te[0]=255&B,te[1]=B>>>8&255,a.check=n(a.check,te,2,0)),B=0,N=0,a.mode=16182;case 16182:for(;N<32;){if(0===d)break e;d--,B+=o[l++]<<N,N+=8}a.head&&(a.head.time=B),512&a.flags&&4&a.wrap&&(te[0]=255&B,te[1]=B>>>8&255,te[2]=B>>>16&255,te[3]=B>>>24&255,a.check=n(a.check,te,4,0)),B=0,N=0,a.mode=16183;case 16183:for(;N<16;){if(0===d)break e;d--,B+=o[l++]<<N,N+=8}a.head&&(a.head.xflags=255&B,a.head.os=B>>8),512&a.flags&&4&a.wrap&&(te[0]=255&B,te[1]=B>>>8&255,a.check=n(a.check,te,2,0)),B=0,N=0,a.mode=16184;case 16184:if(1024&a.flags){for(;N<16;){if(0===d)break e;d--,B+=o[l++]<<N,N+=8}a.length=B,a.head&&(a.head.extra_len=B),512&a.flags&&4&a.wrap&&(te[0]=255&B,te[1]=B>>>8&255,a.check=n(a.check,te,2,0)),B=0,N=0}else a.head&&(a.head.extra=null);a.mode=16185;case 16185:if(1024&a.flags&&((L=a.length)>d&&(L=d),L&&(a.head&&(J=a.head.extra_len-a.length,a.head.extra||(a.head.extra=new Uint8Array(a.head.extra_len)),a.head.extra.set(o.subarray(l,l+L),J)),512&a.flags&&4&a.wrap&&(a.check=n(a.check,o,L,l)),d-=L,l+=L,a.length-=L),a.length))break e;a.length=0,a.mode=16186;case 16186:if(2048&a.flags){if(0===d)break e;L=0;do{J=o[l+L++],a.head&&J&&a.length<65536&&(a.head.name+=String.fromCharCode(J))}while(J&&L<d);if(512&a.flags&&4&a.wrap&&(a.check=n(a.check,o,L,l)),d-=L,l+=L,J)break e}else a.head&&(a.head.name=null);a.length=0,a.mode=16187;case 16187:if(4096&a.flags){if(0===d)break e;L=0;do{J=o[l+L++],a.head&&J&&a.length<65536&&(a.head.comment+=String.fromCharCode(J))}while(J&&L<d);if(512&a.flags&&4&a.wrap&&(a.check=n(a.check,o,L,l)),d-=L,l+=L,J)break e}else a.head&&(a.head.comment=null);a.mode=16188;case 16188:if(512&a.flags){for(;N<16;){if(0===d)break e;d--,B+=o[l++]<<N,N+=8}if(4&a.wrap&&B!==(65535&a.check)){e.msg=\"header crc mismatch\",a.mode=D;break}B=0,N=0}a.head&&(a.head.hcrc=a.flags>>9&1,a.head.done=!0),e.adler=a.check=0,a.mode=A;break;case 16189:for(;N<32;){if(0===d)break e;d--,B+=o[l++]<<N,N+=8}e.adler=a.check=I(B),B=0,N=0,a.mode=R;case R:if(0===a.havedict)return e.next_out=f,e.avail_out=c,e.next_in=l,e.avail_in=d,a.hold=B,a.bits=N,_;e.adler=a.check=1,a.mode=A;case A:if(i===w||i===b)break e;case Z:if(a.last){B>>>=7&N,N-=7&N,a.mode=U;break}for(;N<3;){if(0===d)break e;d--,B+=o[l++]<<N,N+=8}switch(a.last=1&B,N-=1,3&(B>>>=1)){case 0:a.mode=16193;break;case 1:if(K(a),a.mode=T,i===b){B>>>=2,N-=2;break e}break;case 2:a.mode=16196;break;case 3:e.msg=\"invalid block type\",a.mode=D}B>>>=2,N-=2;break;case 16193:for(B>>>=7&N,N-=7&N;N<32;){if(0===d)break e;d--,B+=o[l++]<<N,N+=8}if((65535&B)!=(B>>>16^65535)){e.msg=\"invalid stored block lengths\",a.mode=D;break}if(a.length=65535&B,B=0,N=0,a.mode=S,i===b)break e;case S:a.mode=16195;case 16195:if(L=a.length){if(L>d&&(L=d),L>c&&(L=c),0===L)break e;s.set(o.subarray(l,l+L),f),d-=L,l+=L,c-=L,f+=L,a.length-=L;break}a.mode=A;break;case 16196:for(;N<14;){if(0===d)break e;d--,B+=o[l++]<<N,N+=8}if(a.nlen=257+(31&B),B>>>=5,N-=5,a.ndist=1+(31&B),B>>>=5,N-=5,a.ncode=4+(15&B),B>>>=4,N-=4,a.nlen>286||a.ndist>30){e.msg=\"too many length or distance symbols\",a.mode=D;break}a.have=0,a.mode=16197;case 16197:for(;a.have<a.ncode;){for(;N<3;){if(0===d)break e;d--,B+=o[l++]<<N,N+=8}a.lens[ie[a.have++]]=7&B,B>>>=3,N-=3}for(;a.have<19;)a.lens[ie[a.have++]]=0;if(a.lencode=a.lendyn,a.lenbits=7,V={bits:a.lenbits},Q=h(0,a.lens,0,19,a.lencode,0,a.work,V),a.lenbits=V.bits,Q){e.msg=\"invalid code lengths set\",a.mode=D;break}a.have=0,a.mode=16198;case 16198:for(;a.have<a.nlen+a.ndist;){for(;Y=(ee=a.lencode[B&(1<<a.lenbits)-1])>>>16&255,G=65535&ee,!((j=ee>>>24)<=N);){if(0===d)break e;d--,B+=o[l++]<<N,N+=8}if(G<16)B>>>=j,N-=j,a.lens[a.have++]=G;else{if(16===G){for($=j+2;N<$;){if(0===d)break e;d--,B+=o[l++]<<N,N+=8}if(B>>>=j,N-=j,0===a.have){e.msg=\"invalid bit length repeat\",a.mode=D;break}J=a.lens[a.have-1],L=3+(3&B),B>>>=2,N-=2}else if(17===G){for($=j+3;N<$;){if(0===d)break e;d--,B+=o[l++]<<N,N+=8}N-=j,J=0,L=3+(7&(B>>>=j)),B>>>=3,N-=3}else{for($=j+7;N<$;){if(0===d)break e;d--,B+=o[l++]<<N,N+=8}N-=j,J=0,L=11+(127&(B>>>=j)),B>>>=7,N-=7}if(a.have+L>a.nlen+a.ndist){e.msg=\"invalid bit length repeat\",a.mode=D;break}for(;L--;)a.lens[a.have++]=J}}if(a.mode===D)break;if(0===a.lens[256]){e.msg=\"invalid code -- missing end-of-block\",a.mode=D;break}if(a.lenbits=9,V={bits:a.lenbits},Q=h(1,a.lens,0,a.nlen,a.lencode,0,a.work,V),a.lenbits=V.bits,Q){e.msg=\"invalid literal/lengths set\",a.mode=D;break}if(a.distbits=6,a.distcode=a.distdyn,V={bits:a.distbits},Q=h(2,a.lens,a.nlen,a.ndist,a.distcode,0,a.work,V),a.distbits=V.bits,Q){e.msg=\"invalid distances set\",a.mode=D;break}if(a.mode=T,i===b)break e;case T:a.mode=O;case O:if(d>=6&&c>=258){e.next_out=f,e.avail_out=c,e.next_in=l,e.avail_in=d,a.hold=B,a.bits=N,r(e,F),f=e.next_out,s=e.output,c=e.avail_out,l=e.next_in,o=e.input,d=e.avail_in,B=a.hold,N=a.bits,a.mode===A&&(a.back=-1);break}for(a.back=0;Y=(ee=a.lencode[B&(1<<a.lenbits)-1])>>>16&255,G=65535&ee,!((j=ee>>>24)<=N);){if(0===d)break e;d--,B+=o[l++]<<N,N+=8}if(Y&&0==(240&Y)){for(X=j,W=Y,q=G;Y=(ee=a.lencode[q+((B&(1<<X+W)-1)>>X)])>>>16&255,G=65535&ee,!(X+(j=ee>>>24)<=N);){if(0===d)break e;d--,B+=o[l++]<<N,N+=8}B>>>=X,N-=X,a.back+=X}if(B>>>=j,N-=j,a.back+=j,a.length=G,0===Y){a.mode=16205;break}if(32&Y){a.back=-1,a.mode=A;break}if(64&Y){e.msg=\"invalid literal/length code\",a.mode=D;break}a.extra=15&Y,a.mode=16201;case 16201:if(a.extra){for($=a.extra;N<$;){if(0===d)break e;d--,B+=o[l++]<<N,N+=8}a.length+=B&(1<<a.extra)-1,B>>>=a.extra,N-=a.extra,a.back+=a.extra}a.was=a.length,a.mode=16202;case 16202:for(;Y=(ee=a.distcode[B&(1<<a.distbits)-1])>>>16&255,G=65535&ee,!((j=ee>>>24)<=N);){if(0===d)break e;d--,B+=o[l++]<<N,N+=8}if(0==(240&Y)){for(X=j,W=Y,q=G;Y=(ee=a.distcode[q+((B&(1<<X+W)-1)>>X)])>>>16&255,G=65535&ee,!(X+(j=ee>>>24)<=N);){if(0===d)break e;d--,B+=o[l++]<<N,N+=8}B>>>=X,N-=X,a.back+=X}if(B>>>=j,N-=j,a.back+=j,64&Y){e.msg=\"invalid distance code\",a.mode=D;break}a.offset=G,a.extra=15&Y,a.mode=16203;case 16203:if(a.extra){for($=a.extra;N<$;){if(0===d)break e;d--,B+=o[l++]<<N,N+=8}a.offset+=B&(1<<a.extra)-1,B>>>=a.extra,N-=a.extra,a.back+=a.extra}if(a.offset>a.dmax){e.msg=\"invalid distance too far back\",a.mode=D;break}a.mode=16204;case 16204:if(0===c)break e;if(L=F-c,a.offset>L){if((L=a.offset-L)>a.whave&&a.sane){e.msg=\"invalid distance too far back\",a.mode=D;break}L>a.wnext?(L-=a.wnext,M=a.wsize-L):M=a.wnext-L,L>a.length&&(L=a.length),H=a.window}else H=s,M=f-a.offset,L=a.length;L>c&&(L=c),c-=L,a.length-=L;do{s[f++]=H[M++]}while(--L);0===a.length&&(a.mode=O);break;case 16205:if(0===c)break e;s[f++]=a.length,c--,a.mode=O;break;case U:if(a.wrap){for(;N<32;){if(0===d)break e;d--,B|=o[l++]<<N,N+=8}if(F-=c,e.total_out+=F,a.total+=F,4&a.wrap&&F&&(e.adler=a.check=a.flags?n(a.check,s,F,f-F):t(a.check,s,F,f-F)),F=c,4&a.wrap&&(a.flags?B:I(B))!==a.check){e.msg=\"incorrect data check\",a.mode=D;break}B=0,N=0}a.mode=16207;case 16207:if(a.wrap&&a.flags){for(;N<32;){if(0===d)break e;d--,B+=o[l++]<<N,N+=8}if(4&a.wrap&&B!==(4294967295&a.total)){e.msg=\"incorrect length check\",a.mode=D;break}B=0,N=0}a.mode=16208;case 16208:Q=k;break e;case D:Q=g;break e;case 16210:return p;default:return v}return e.next_out=f,e.avail_out=c,e.next_in=l,e.avail_in=d,a.hold=B,a.bits=N,(a.wsize||F!==e.avail_out&&a.mode<D&&(a.mode<U||i!==u))&&P(e,e.output,e.next_out,F-e.avail_out),C-=e.avail_in,F-=e.avail_out,e.total_in+=C,e.total_out+=F,a.total+=F,4&a.wrap&&F&&(e.adler=a.check=a.flags?n(a.check,s,F,e.next_out-F):t(a.check,s,F,e.next_out-F)),e.data_type=a.bits+(a.last?64:0)+(a.mode===A?128:0)+(a.mode===T||a.mode===S?256:0),(0===C&&0===F||i===u)&&Q===m&&(Q=y),Q},inflateEnd:function(e){if(z(e))return v;var t=e.state;return t.window&&(t.window=null),e.state=null,m},inflateGetHeader:function(e,t){if(z(e))return v;var i=e.state;return 0==(2&i.wrap)?v:(i.head=t,t.done=!1,m)},inflateSetDictionary:function(e,i){var n,a=i.length;return z(e)||0!==(n=e.state).wrap&&n.mode!==R?v:n.mode===R&&t(1,i,a,0)!==n.check?g:P(e,i,a,a)?(n.mode=16210,p):(n.havedict=1,m)},inflateInfo:\"pako inflate (from Nodeca project)\"};function G(e){return G=\"function\"==typeof Symbol&&\"symbol\"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&\"function\"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?\"symbol\":typeof e},G(e)}var X=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},W=function(e){for(var t=Array.prototype.slice.call(arguments,1);t.length;){var i=t.shift();if(i){if(\"object\"!==G(i))throw new TypeError(i+\"must be non-object\");for(var n in i)X(i,n)&&(e[n]=i[n])}}return e},q=function(e){for(var t=0,i=0,n=e.length;i<n;i++)t+=e[i].length;for(var a=new Uint8Array(t),r=0,o=0,s=e.length;r<s;r++){var l=e[r];a.set(l,o),o+=l.length}return a},J=!0;try{String.fromCharCode.apply(null,new Uint8Array(1))}catch(e){J=!1}for(var Q=new Uint8Array(256),V=0;V<256;V++)Q[V]=V>=252?6:V>=248?5:V>=240?4:V>=224?3:V>=192?2:1;Q[254]=Q[254]=1;var $=function(e){if(\"function\"==typeof TextEncoder&&TextEncoder.prototype.encode)return(new TextEncoder).encode(e);var t,i,n,a,r,o=e.length,s=0;for(a=0;a<o;a++)55296==(64512&(i=e.charCodeAt(a)))&&a+1<o&&56320==(64512&(n=e.charCodeAt(a+1)))&&(i=65536+(i-55296<<10)+(n-56320),a++),s+=i<128?1:i<2048?2:i<65536?3:4;for(t=new Uint8Array(s),r=0,a=0;r<s;a++)55296==(64512&(i=e.charCodeAt(a)))&&a+1<o&&56320==(64512&(n=e.charCodeAt(a+1)))&&(i=65536+(i-55296<<10)+(n-56320),a++),i<128?t[r++]=i:i<2048?(t[r++]=192|i>>>6,t[r++]=128|63&i):i<65536?(t[r++]=224|i>>>12,t[r++]=128|i>>>6&63,t[r++]=128|63&i):(t[r++]=240|i>>>18,t[r++]=128|i>>>12&63,t[r++]=128|i>>>6&63,t[r++]=128|63&i);return t},ee=function(e,t){var i,n,a=t||e.length;if(\"function\"==typeof TextDecoder&&TextDecoder.prototype.decode)return(new TextDecoder).decode(e.subarray(0,t));var r=new Array(2*a);for(n=0,i=0;i<a;){var o=e[i++];if(o<128)r[n++]=o;else{var s=Q[o];if(s>4)r[n++]=65533,i+=s-1;else{for(o&=2===s?31:3===s?15:7;s>1&&i<a;)o=o<<6|63&e[i++],s--;s>1?r[n++]=65533:o<65536?r[n++]=o:(o-=65536,r[n++]=55296|o>>10&1023,r[n++]=56320|1023&o)}}}return function(e,t){if(t<65534&&e.subarray&&J)return String.fromCharCode.apply(null,e.length===t?e:e.subarray(0,t));for(var i=\"\",n=0;n<t;n++)i+=String.fromCharCode(e[n]);return i}(r,n)},te=function(e,t){(t=t||e.length)>e.length&&(t=e.length);for(var i=t-1;i>=0&&128==(192&e[i]);)i--;return i<0||0===i?t:i+Q[e[i]]>t?i:t},ie={2:\"need dictionary\",1:\"stream end\",0:\"\",\"-1\":\"file error\",\"-2\":\"stream error\",\"-3\":\"data error\",\"-4\":\"insufficient memory\",\"-5\":\"buffer error\",\"-6\":\"incompatible version\"};var ne=function(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg=\"\",this.state=null,this.data_type=2,this.adler=0};var ae=function(){this.text=0,this.time=0,this.xflags=0,this.os=0,this.extra=null,this.extra_len=0,this.name=\"\",this.comment=\"\",this.hcrc=0,this.done=!1},re=Object.prototype.toString,oe=c.Z_NO_FLUSH,se=c.Z_FINISH,le=c.Z_OK,fe=c.Z_STREAM_END,de=c.Z_NEED_DICT,he=c.Z_STREAM_ERROR,ce=c.Z_DATA_ERROR,ue=c.Z_MEM_ERROR;function we(e){this.options=W({chunkSize:65536,windowBits:15,to:\"\"},e||{});var t=this.options;t.raw&&t.windowBits>=0&&t.windowBits<16&&(t.windowBits=-t.windowBits,0===t.windowBits&&(t.windowBits=-15)),!(t.windowBits>=0&&t.windowBits<16)||e&&e.windowBits||(t.windowBits+=32),t.windowBits>15&&t.windowBits<48&&0==(15&t.windowBits)&&(t.windowBits|=15),this.err=0,this.msg=\"\",this.ended=!1,this.chunks=[],this.strm=new ne,this.strm.avail_out=0;var i=Y.inflateInit2(this.strm,t.windowBits);if(i!==le)throw new Error(ie[i]);if(this.header=new ae,Y.inflateGetHeader(this.strm,this.header),t.dictionary&&(\"string\"==typeof t.dictionary?t.dictionary=$(t.dictionary):\"[object ArrayBuffer]\"===re.call(t.dictionary)&&(t.dictionary=new Uint8Array(t.dictionary)),t.raw&&(i=Y.inflateSetDictionary(this.strm,t.dictionary))!==le))throw new Error(ie[i])}function be(e,t){var i=new we(t);if(i.push(e),i.err)throw i.msg||ie[i.err];return i.result}we.prototype.push=function(e,t){var i,n,a,r=this.strm,o=this.options.chunkSize,s=this.options.dictionary;if(this.ended)return!1;for(n=t===~~t?t:!0===t?se:oe,\"[object ArrayBuffer]\"===re.call(e)?r.input=new Uint8Array(e):r.input=e,r.next_in=0,r.avail_in=r.input.length;;){for(0===r.avail_out&&(r.output=new Uint8Array(o),r.next_out=0,r.avail_out=o),(i=Y.inflate(r,n))===de&&s&&((i=Y.inflateSetDictionary(r,s))===le?i=Y.inflate(r,n):i===ce&&(i=de));r.avail_in>0&&i===fe&&r.state.wrap>0&&0!==e[r.next_in];)Y.inflateReset(r),i=Y.inflate(r,n);switch(i){case he:case ce:case de:case ue:return this.onEnd(i),this.ended=!0,!1}if(a=r.avail_out,r.next_out&&(0===r.avail_out||i===fe))if(\"string\"===this.options.to){var l=te(r.output,r.next_out),f=r.next_out-l,d=ee(r.output,l);r.next_out=f,r.avail_out=o-f,f&&r.output.set(r.output.subarray(l,l+f),0),this.onData(d)}else this.onData(r.output.length===r.next_out?r.output:r.output.subarray(0,r.next_out));if(i!==le||0!==a){if(i===fe)return i=Y.inflateEnd(this.strm),this.onEnd(i),this.ended=!0,!0;if(0===r.avail_in)break}}return!0},we.prototype.onData=function(e){this.chunks.push(e)},we.prototype.onEnd=function(e){e===le&&(\"string\"===this.options.to?this.result=this.chunks.join(\"\"):this.result=q(this.chunks)),this.chunks=[],this.err=e,this.msg=this.strm.msg};var me=we,ke=be,_e=function(e,t){return(t=t||{}).raw=!0,be(e,t)},ve=be,ge=c,pe={Inflate:me,inflate:ke,inflateRaw:_e,ungzip:ve,constants:ge};e.Inflate=me,e.constants=ge,e.default=pe,e.inflate=ke,e.inflateRaw=_e,e.ungzip=ve,Object.defineProperty(e,\"__esModule\",{value:!0})}));\n ";
|
|
9
|
+
var StringCompressionTemplate = exports.StringCompressionTemplate = new _template["default"]("\nvar {stringFn};\n\n(function (){\n var compressedString = {stringValue};\n var utf8String = {StringCompressionLibrary}[\"decompressFromUTF16\"](compressedString);\n var stringArray = utf8String[\"split\"]({stringDelimiter});\n\n {stringFn} = function(index){\n return stringArray[index];\n }\n})();\n");
|
|
10
|
+
var StringCompressionLibraryMinified = exports.StringCompressionLibraryMinified = " \nvar {StringCompressionLibrary}=function(){var r=String.fromCharCode,o=\"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=\",n=\"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+-$\",e={};function t(r,o){if(!e[r]){e[r]={};for(var n=0;n<r.length;n++)e[r][r.charAt(n)]=n}return e[r][o]}var i={compressToBase64:function(r){if(null==r)return\"\";var n=i._compress(r,6,function(r){return o.charAt(r)});switch(n.length%4){default:case 0:return n;case 1:return n+\"===\";case 2:return n+\"==\";case 3:return n+\"=\"}},decompressFromBase64:function(r){return null==r?\"\":\"\"==r?null:i._decompress(r.length,32,function(n){return t(o,r.charAt(n))})},compressToUTF16:function(o){return null==o?\"\":i._compress(o,15,function(o){return r(o+32)})+\" \"},decompressFromUTF16:function(r){return null==r?\"\":\"\"==r?null:i._decompress(r.length,16384,function(o){return r.charCodeAt(o)-32})},compressToUint8Array:function(r){for(var o=i.compress(r),n=new Uint8Array(2*o.length),e=0,t=o.length;e<t;e++){var s=o.charCodeAt(e);n[2*e]=s>>>8,n[2*e+1]=s%256}return n},decompressFromUint8Array:function(o){if(null==o)return i.decompress(o);for(var n=new Array(o.length/2),e=0,t=n.length;e<t;e++)n[e]=256*o[2*e]+o[2*e+1];var s=[];return n.forEach(function(o){s.push(r(o))}),i.decompress(s.join(\"\"))},compressToEncodedURIComponent:function(r){return null==r?\"\":i._compress(r,6,function(r){return n.charAt(r)})},decompressFromEncodedURIComponent:function(r){return null==r?\"\":\"\"==r?null:(r=r.replace(/ /g,\"+\"),i._decompress(r.length,32,function(o){return t(n,r.charAt(o))}))},compress:function(o){return i._compress(o,16,function(o){return r(o)})},_compress:function(r,o,n){if(null==r)return\"\";var e,t,i,s={},u={},a=\"\",p=\"\",c=\"\",l=2,f=3,h=2,d=[],m=0,v=0;for(i=0;i<r.length;i+=1)if(a=r.charAt(i),Object.prototype.hasOwnProperty.call(s,a)||(s[a]=f++,u[a]=!0),p=c+a,Object.prototype.hasOwnProperty.call(s,p))c=p;else{if(Object.prototype.hasOwnProperty.call(u,c)){if(c.charCodeAt(0)<256){for(e=0;e<h;e++)m<<=1,v==o-1?(v=0,d.push(n(m)),m=0):v++;for(t=c.charCodeAt(0),e=0;e<8;e++)m=m<<1|1&t,v==o-1?(v=0,d.push(n(m)),m=0):v++,t>>=1}else{for(t=1,e=0;e<h;e++)m=m<<1|t,v==o-1?(v=0,d.push(n(m)),m=0):v++,t=0;for(t=c.charCodeAt(0),e=0;e<16;e++)m=m<<1|1&t,v==o-1?(v=0,d.push(n(m)),m=0):v++,t>>=1}0==--l&&(l=Math.pow(2,h),h++),delete u[c]}else for(t=s[c],e=0;e<h;e++)m=m<<1|1&t,v==o-1?(v=0,d.push(n(m)),m=0):v++,t>>=1;0==--l&&(l=Math.pow(2,h),h++),s[p]=f++,c=String(a)}if(\"\"!==c){if(Object.prototype.hasOwnProperty.call(u,c)){if(c.charCodeAt(0)<256){for(e=0;e<h;e++)m<<=1,v==o-1?(v=0,d.push(n(m)),m=0):v++;for(t=c.charCodeAt(0),e=0;e<8;e++)m=m<<1|1&t,v==o-1?(v=0,d.push(n(m)),m=0):v++,t>>=1}else{for(t=1,e=0;e<h;e++)m=m<<1|t,v==o-1?(v=0,d.push(n(m)),m=0):v++,t=0;for(t=c.charCodeAt(0),e=0;e<16;e++)m=m<<1|1&t,v==o-1?(v=0,d.push(n(m)),m=0):v++,t>>=1}0==--l&&(l=Math.pow(2,h),h++),delete u[c]}else for(t=s[c],e=0;e<h;e++)m=m<<1|1&t,v==o-1?(v=0,d.push(n(m)),m=0):v++,t>>=1;0==--l&&(l=Math.pow(2,h),h++)}for(t=2,e=0;e<h;e++)m=m<<1|1&t,v==o-1?(v=0,d.push(n(m)),m=0):v++,t>>=1;for(;;){if(m<<=1,v==o-1){d.push(n(m));break}v++}return d.join(\"\")},decompress:function(r){return null==r?\"\":\"\"==r?null:i._decompress(r.length,32768,function(o){return r.charCodeAt(o)})},_decompress:function(o,n,e){var t,i,s,u,a,p,c,l=[],f=4,h=4,d=3,m=\"\",v=[],g={val:e(0),position:n,index:1};for(t=0;t<3;t+=1)l[t]=t;for(s=0,a=Math.pow(2,2),p=1;p!=a;)u=g.val&g.position,g.position>>=1,0==g.position&&(g.position=n,g.val=e(g.index++)),s|=(u>0?1:0)*p,p<<=1;switch(s){case 0:for(s=0,a=Math.pow(2,8),p=1;p!=a;)u=g.val&g.position,g.position>>=1,0==g.position&&(g.position=n,g.val=e(g.index++)),s|=(u>0?1:0)*p,p<<=1;c=r(s);break;case 1:for(s=0,a=Math.pow(2,16),p=1;p!=a;)u=g.val&g.position,g.position>>=1,0==g.position&&(g.position=n,g.val=e(g.index++)),s|=(u>0?1:0)*p,p<<=1;c=r(s);break;case 2:return\"\"}for(l[3]=c,i=c,v.push(c);;){if(g.index>o)return\"\";for(s=0,a=Math.pow(2,d),p=1;p!=a;)u=g.val&g.position,g.position>>=1,0==g.position&&(g.position=n,g.val=e(g.index++)),s|=(u>0?1:0)*p,p<<=1;switch(c=s){case 0:for(s=0,a=Math.pow(2,8),p=1;p!=a;)u=g.val&g.position,g.position>>=1,0==g.position&&(g.position=n,g.val=e(g.index++)),s|=(u>0?1:0)*p,p<<=1;l[h++]=r(s),c=h-1,f--;break;case 1:for(s=0,a=Math.pow(2,16),p=1;p!=a;)u=g.val&g.position,g.position>>=1,0==g.position&&(g.position=n,g.val=e(g.index++)),s|=(u>0?1:0)*p,p<<=1;l[h++]=r(s),c=h-1,f--;break;case 2:return v.join(\"\")}if(0==f&&(f=Math.pow(2,d),d++),l[c])m=l[c];else{if(c!==h)return null;m=i+i.charAt(0)}v.push(m),l[h++]=i+m.charAt(0),i=m,0==--f&&(f=Math.pow(2,d),d++)}}};return i}();\"function\"==typeof define&&define.amd?define(function(){return {StringCompressionLibrary}}):\"undefined\"!=typeof module&&null!=module?module.exports={StringCompressionLibrary}:\"undefined\"!=typeof angular&&null!=angular&&angular.module(\"LZString\",[]).factory(\"LZString\",function(){return {StringCompressionLibrary}});";
|
|
@@ -17,5 +17,5 @@ var createEvalIntegrityTemplate = exports.createEvalIntegrityTemplate = function
|
|
|
17
17
|
countermeasures: pluginInstance.globalState.lock.createCountermeasuresCode()
|
|
18
18
|
});
|
|
19
19
|
}
|
|
20
|
-
return new _template["default"]("\n function {EvalIntegrityName}(
|
|
20
|
+
return new _template["default"]("\n function {EvalIntegrityName}(".concat(_constants.placeholderVariablePrefix, "_flag = true){\n return ").concat(_constants.placeholderVariablePrefix, "_flag;\n }\n "));
|
|
21
21
|
};
|
|
@@ -29,7 +29,7 @@ var Template = exports["default"] = /*#__PURE__*/function () {
|
|
|
29
29
|
function Template() {
|
|
30
30
|
_classCallCheck(this, Template);
|
|
31
31
|
_defineProperty(this, "astIdentifierPrefix", "__t_" + (0, _randomUtils.getRandomString)(6));
|
|
32
|
-
_defineProperty(this, "symbols",
|
|
32
|
+
_defineProperty(this, "symbols", new Set());
|
|
33
33
|
for (var _len = arguments.length, templates = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
34
34
|
templates[_key] = arguments[_key];
|
|
35
35
|
}
|
|
@@ -41,8 +41,13 @@ var Template = exports["default"] = /*#__PURE__*/function () {
|
|
|
41
41
|
return _createClass(Template, [{
|
|
42
42
|
key: "addSymbols",
|
|
43
43
|
value: function addSymbols() {
|
|
44
|
-
var _this
|
|
45
|
-
(
|
|
44
|
+
var _this = this;
|
|
45
|
+
for (var _len2 = arguments.length, symbols = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
|
|
46
|
+
symbols[_key2] = arguments[_key2];
|
|
47
|
+
}
|
|
48
|
+
symbols.forEach(function (symbol) {
|
|
49
|
+
_this.symbols.add(symbol);
|
|
50
|
+
});
|
|
46
51
|
return this;
|
|
47
52
|
}
|
|
48
53
|
}, {
|
|
@@ -54,19 +59,19 @@ var Template = exports["default"] = /*#__PURE__*/function () {
|
|
|
54
59
|
}, {
|
|
55
60
|
key: "findRequiredVariables",
|
|
56
61
|
value: function findRequiredVariables() {
|
|
57
|
-
var
|
|
62
|
+
var _this2 = this;
|
|
58
63
|
var matches = this.templates[0].match(/{[$A-Za-z0-9_]+}/g);
|
|
59
64
|
if (matches !== null) {
|
|
60
65
|
matches.forEach(function (variable) {
|
|
61
66
|
var name = variable.slice(1, -1);
|
|
62
|
-
|
|
67
|
+
_this2.requiredVariables.add(name);
|
|
63
68
|
});
|
|
64
69
|
}
|
|
65
70
|
}
|
|
66
71
|
}, {
|
|
67
72
|
key: "interpolateTemplate",
|
|
68
73
|
value: function interpolateTemplate(variables) {
|
|
69
|
-
var
|
|
74
|
+
var _this3 = this;
|
|
70
75
|
var allVariables = _objectSpread(_objectSpread({}, this.defaultVariables), variables);
|
|
71
76
|
var _iterator = _createForOfIteratorHelper(this.requiredVariables),
|
|
72
77
|
_step;
|
|
@@ -88,9 +93,9 @@ var Template = exports["default"] = /*#__PURE__*/function () {
|
|
|
88
93
|
Object.keys(allVariables).forEach(function (name) {
|
|
89
94
|
var bracketName = "{".concat(name.replace("$", "\\$"), "}");
|
|
90
95
|
var value = allVariables[name];
|
|
91
|
-
if (
|
|
92
|
-
var astIdentifierName =
|
|
93
|
-
|
|
96
|
+
if (_this3.isASTVariable(value)) {
|
|
97
|
+
var astIdentifierName = _this3.astIdentifierPrefix + name;
|
|
98
|
+
_this3.astVariableMappings.set(name, astIdentifierName);
|
|
94
99
|
value = astIdentifierName;
|
|
95
100
|
}
|
|
96
101
|
var reg = new RegExp(bracketName, "g");
|
|
@@ -159,7 +164,7 @@ var Template = exports["default"] = /*#__PURE__*/function () {
|
|
|
159
164
|
}, {
|
|
160
165
|
key: "file",
|
|
161
166
|
value: function file() {
|
|
162
|
-
var
|
|
167
|
+
var _this4 = this;
|
|
163
168
|
var variables = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
164
169
|
var _this$interpolateTemp = this.interpolateTemplate(variables),
|
|
165
170
|
output = _this$interpolateTemp.output;
|
|
@@ -173,9 +178,9 @@ var Template = exports["default"] = /*#__PURE__*/function () {
|
|
|
173
178
|
throw new Error(output + "\n" + "Template failed to parse: " + e.message);
|
|
174
179
|
}
|
|
175
180
|
this.interpolateAST(file, variables);
|
|
176
|
-
if (this.symbols.
|
|
181
|
+
if (this.symbols.size > 0) {
|
|
177
182
|
file.program.body.forEach(function (node) {
|
|
178
|
-
var _iterator2 = _createForOfIteratorHelper(
|
|
183
|
+
var _iterator2 = _createForOfIteratorHelper(_this4.symbols),
|
|
179
184
|
_step2;
|
|
180
185
|
try {
|
|
181
186
|
for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
|
|
@@ -6,7 +6,6 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports["default"] = void 0;
|
|
7
7
|
var _traverse = _interopRequireWildcard(require("@babel/traverse"));
|
|
8
8
|
var _order = require("../order");
|
|
9
|
-
var _probability = require("../probability");
|
|
10
9
|
var _astUtils = require("../utils/ast-utils");
|
|
11
10
|
var t = _interopRequireWildcard(require("@babel/types"));
|
|
12
11
|
var _node = require("../utils/node");
|
|
@@ -116,7 +115,7 @@ var _default = exports["default"] = function _default(_ref) {
|
|
|
116
115
|
if (blockPath.node.body.length < 3) return;
|
|
117
116
|
|
|
118
117
|
// Check user's threshold setting
|
|
119
|
-
if (!
|
|
118
|
+
if (!me.computeProbabilityMap(me.options.controlFlowFlattening)) {
|
|
120
119
|
return;
|
|
121
120
|
}
|
|
122
121
|
|
|
@@ -826,7 +825,7 @@ var _default = exports["default"] = function _default(_ref) {
|
|
|
826
825
|
if (path.node[_constants.NO_RENAME] === cffIndex) return;
|
|
827
826
|
var identifierName = path.node.name;
|
|
828
827
|
if (identifierName === gotoFunctionName) return;
|
|
829
|
-
var binding =
|
|
828
|
+
var binding = path.scope.getBinding(identifierName);
|
|
830
829
|
if (!binding) {
|
|
831
830
|
return;
|
|
832
831
|
}
|
|
@@ -1159,9 +1158,6 @@ var _default = exports["default"] = function _default(_ref) {
|
|
|
1159
1158
|
// Reset all bindings here
|
|
1160
1159
|
blockPath.scope.bindings = Object.create(null);
|
|
1161
1160
|
|
|
1162
|
-
// Bindings changed - breaking control objects
|
|
1163
|
-
delete blockPath.node[_constants.CONTROL_OBJECTS];
|
|
1164
|
-
|
|
1165
1161
|
// Register new declarations
|
|
1166
1162
|
var _iterator5 = _createForOfIteratorHelper(blockPath.get("body")),
|
|
1167
1163
|
_step5;
|