diff --git a/.github/workflows/JScrewIt.yml b/.github/workflows/JScrewIt.yml index 3c8979fe..1016a63a 100644 --- a/.github/workflows/JScrewIt.yml +++ b/.github/workflows/JScrewIt.yml @@ -4,7 +4,7 @@ on: [push, pull_request] jobs: - lint: + build: runs-on: ubuntu-latest @@ -15,11 +15,18 @@ jobs: node-version: 16.x - run: npm install - run: gulp lint + - run: gulp bundle:lib + - uses: actions/upload-artifact@v2 + with: + name: lib + path: lib test: name: test (Node.js ${{ matrix.node-version }}) + needs: build + runs-on: ubuntu-latest strategy: @@ -32,4 +39,8 @@ jobs: with: node-version: ${{ matrix.node-version }} - run: npm install ebdd expectations mocha@3 postrequire + - uses: actions/download-artifact@v2 + with: + name: lib + path: lib - run: npm test diff --git a/.gitignore b/.gitignore index 3bc05920..f4fbe0cf 100644 --- a/.gitignore +++ b/.gitignore @@ -3,8 +3,12 @@ !.npmrc *.cpuprofile /jsdoc +/lib/**/*.js +/lib/feature-all.d.ts /packages/**/lib /packages/**/test/node-legacy +/test/spec-runner.html +/ui/**/*.js coverage/ node_modules/ npm-debug.log diff --git a/lib/feature-all.d.ts b/lib/feature-all.d.ts deleted file mode 100644 index cc00fda5..00000000 --- a/lib/feature-all.d.ts +++ /dev/null @@ -1,755 +0,0 @@ -import { ElementaryFeature, PredefinedFeature } from './feature'; - -export interface FeatureAll -{ - /** Features available in Android Browser 4.0. */ - ANDRO_4_0: PredefinedFeature; - - /** Features available in Android Browser 4.1 to 4.3. */ - ANDRO_4_1: PredefinedFeature; - - /** Features available in Android Browser 4.4. */ - ANDRO_4_4: PredefinedFeature; - - /** - * Existence of the global object document whose string representation starts with "\[object " and ends with "Document\]". - * - * @remarks - * - * Available in Chrome, Edge, Firefox, Internet Explorer, Safari, Opera, and Android Browser. This feature is not available inside web workers. - */ - ANY_DOCUMENT: ElementaryFeature; - - /** - * Existence of the global object self whose string representation starts with "\[object " and ends with "Window\]". - * - * @remarks - * - * Available in Chrome, Edge, Firefox, Internet Explorer, Safari, Opera, and Android Browser. This feature is not available inside web workers. - */ - ANY_WINDOW: ElementaryFeature; - - /** - * The property that the string representation of Array.prototype.entries\(\) starts with "\[object Array" and ends with "\]" at index 21 or 22. - * - * @remarks - * - * Available in Chrome, Edge, Firefox, Safari 7.1+, Opera, and Node.js 0.12+. - */ - ARRAY_ITERATOR: ElementaryFeature; - - /** - * Support for arrow functions. - * - * @remarks - * - * Available in Chrome, Edge, Firefox, Safari 10+, Opera, and Node.js 4+. - */ - ARROW: ElementaryFeature; - - /** - * Existence of the native function Array.prototype.at. - * - * @remarks - * - * This feature is not available in any of the supported engines. - */ - AT: ElementaryFeature; - - /** - * Existence of the global functions atob and btoa. - * - * @remarks - * - * Available in Chrome, Edge, Firefox, Internet Explorer 10+, Safari, Opera, Android Browser, and Node.js 16+. This feature is not available inside web workers in Safari before 10. - */ - ATOB: ElementaryFeature; - - /** All features available in the current engine. */ - AUTO: PredefinedFeature; - - /** - * Existence of the global object statusbar having the string representation "\[object BarProp\]". - * - * @remarks - * - * Available in Chrome, Edge, Firefox, Safari, Opera, and Android Browser 4.4. This feature is not available inside web workers. - */ - BARPROP: ElementaryFeature; - - /** - * Features available in all browsers. - * - * No support for Node.js. - */ - BROWSER: PredefinedFeature; - - /** - * The property that the various string methods returning HTML code such as String.prototype.big or String.prototype.link have both the tag name and attributes written in capital letters. - * - * @remarks - * - * Available in Internet Explorer. - */ - CAPITAL_HTML: ElementaryFeature; - - /** - * Features available in the current stable versions of Chrome, Edge and Opera. - * - * An alias for `CHROME_86`. - */ - CHROME: PredefinedFeature; - - /** - * Features available in Chrome 86, Edge 86 and Opera 72 or later. - * - * @remarks - * - * This feature may be replaced or removed in the near future when current browser versions become obsolete. Use `CHROME` or `CHROME_PREV` instead of `CHROME_86` for long term support. - * - * @see - * - * [Engine Support Policy](https://github.com/fasttime/JScrewIt#engine-support-policy) - */ - CHROME_86: PredefinedFeature; - - /** - * Features available in the previous to current versions of Chrome and Edge. - * - * An alias for `CHROME_86`. - */ - CHROME_PREV: PredefinedFeature; - - /** - * All new browsers' features. - * - * No support for Node.js and older browsers like Internet Explorer, Safari 9 or Android Browser. - */ - COMPACT: PredefinedFeature; - - /** - * Existence of the global object console having the string representation "\[object Console\]". - * - * This feature may become unavailable when certain browser extensions are active. - * - * @remarks - * - * Available in Internet Explorer 10+, Safari before 14.1, and Android Browser. This feature is not available inside web workers in Safari before 7.1 and Android Browser 4.4. - */ - CONSOLE: ElementaryFeature; - - /** Minimum feature level, compatible with all supported engines in all environments. */ - DEFAULT: PredefinedFeature; - - /** - * Existence of the global object document having the string representation "\[object Document\]". - * - * @remarks - * - * Available in Internet Explorer before 11. This feature is not available inside web workers. - */ - DOCUMENT: ElementaryFeature; - - /** - * Existence of the global object self having the string representation "\[object DOMWindow\]". - * - * @remarks - * - * Available in Android Browser before 4.4. This feature is not available inside web workers. - */ - DOMWINDOW: ElementaryFeature; - - /** - * The property that double quotation mark, less than and greater than characters in the argument of String.prototype.fontcolor are escaped into their respective HTML entities. - * - * @remarks - * - * Available in Android Browser and Node.js before 0.12. - */ - ESC_HTML_ALL: ElementaryFeature; - - /** - * The property that double quotation marks in the argument of String.prototype.fontcolor are escaped as "\"". - * - * @remarks - * - * Available in Chrome, Edge, Firefox, Safari, Opera, Android Browser, and Node.js. - */ - ESC_HTML_QUOT: ElementaryFeature; - - /** - * The property that only double quotation marks and no other characters in the argument of String.prototype.fontcolor are escaped into HTML entities. - * - * @remarks - * - * Available in Chrome, Edge, Firefox, Safari, Opera, and Node.js 0.12+. - */ - ESC_HTML_QUOT_ONLY: ElementaryFeature; - - /** - * Having regular expressions created with the RegExp constructor use escape sequences starting with a backslash to format line feed characters \("\\n"\) in their string representation. - * - * @remarks - * - * Available in Chrome, Edge, Firefox, Internet Explorer, Safari, Opera, and Node.js 12+. - */ - ESC_REGEXP_LF: ElementaryFeature; - - /** - * Having regular expressions created with the RegExp constructor use escape sequences starting with a backslash to format slashes \("/"\) in their string representation. - * - * @remarks - * - * Available in Chrome, Edge, Firefox, Internet Explorer, Safari, Opera, and Node.js 4+. - */ - ESC_REGEXP_SLASH: ElementaryFeature; - - /** - * Existence of the global object sidebar having the string representation "\[object External\]". - * - * @remarks - * - * Available in Firefox. This feature is not available inside web workers. - */ - EXTERNAL: ElementaryFeature; - - /** - * Features available in the current stable version of Firefox. - * - * An alias for `FF_83`. - */ - FF: PredefinedFeature; - - /** - * Features available in Firefox 78 to 82. - * - * @remarks - * - * This feature may be replaced or removed in the near future when current browser versions become obsolete. Use `FF_ESR` or `FF_PREV` instead of `FF_78` for long term support. - * - * @see - * - * [Engine Support Policy](https://github.com/fasttime/JScrewIt#engine-support-policy) - */ - FF_78: PredefinedFeature; - - /** - * Features available in Firefox 83 or later. - * - * @remarks - * - * This feature may be replaced or removed in the near future when current browser versions become obsolete. Use `FF` instead of `FF_83` for long term support. - * - * @see - * - * [Engine Support Policy](https://github.com/fasttime/JScrewIt#engine-support-policy) - */ - FF_83: PredefinedFeature; - - /** - * Features available in the current version of Firefox ESR. - * - * An alias for `FF_78`. - */ - FF_ESR: PredefinedFeature; - - /** - * Features available in the previous to current version of Firefox. - * - * An alias for `FF_78`. - */ - FF_PREV: PredefinedFeature; - - /** - * A string representation of native functions typical for Firefox and Safari. - * - * Remarkable traits are the lack of line feed characters at the beginning and at the end of the string and the presence of a line feed followed by four whitespaces \("\\n "\) before the "\[native code\]" sequence. - * - * @remarks - * - * Available in Firefox and Safari. - */ - FF_SRC: ElementaryFeature; - - /** - * Existence of the native function Array.prototype.fill. - * - * @remarks - * - * Available in Chrome, Edge, Firefox, Safari 7.1+, Opera, and Node.js 4+. - */ - FILL: ElementaryFeature; - - /** - * Existence of the native function Array.prototype.flat. - * - * @remarks - * - * Available in Chrome, Edge, Firefox, Safari 12+, Opera, and Node.js 11+. - */ - FLAT: ElementaryFeature; - - /** - * Existence of the function String.fromCodePoint. - * - * @remarks - * - * Available in Chrome, Edge, Firefox, Safari 9+, Opera, and Node.js 4+. - */ - FROM_CODE_POINT: ElementaryFeature; - - /** - * A string representation of dynamically generated functions where the character at index 19 is a line feed \("\\n"\). - * - * @remarks - * - * Available in Chrome, Edge, Firefox, Opera, and Node.js 10+. - */ - FUNCTION_19_LF: ElementaryFeature; - - /** - * A string representation of dynamically generated functions where the character at index 22 is a line feed \("\\n"\). - * - * @remarks - * - * Available in Internet Explorer, Safari 9+, Android Browser, and Node.js before 10. - */ - FUNCTION_22_LF: ElementaryFeature; - - /** - * Ability to call Array.prototype.toString with a non-array binding. - * - * @remarks - * - * Available in Chrome, Edge, Firefox, Internet Explorer, Safari, Opera, Android Browser 4.1+, and Node.js. - */ - GENERIC_ARRAY_TO_STRING: ElementaryFeature; - - /** - * Having the global function toString return the string "\[object Undefined\]" when invoked without a binding. - * - * @remarks - * - * Available in Chrome, Edge, Firefox, Safari, Opera, and Node.js. - */ - GLOBAL_UNDEFINED: ElementaryFeature; - - /** - * Presence of the text "GMT" after the first 25 characters in the string returned by Date\(\). - * - * The string representation of dates is implementation dependent, but most engines use a similar format, making this feature available in all supported engines except Internet Explorer 9 and 10. - * - * @remarks - * - * Available in Chrome, Edge, Firefox, Internet Explorer 11, Safari, Opera, Android Browser, and Node.js. - */ - GMT: ElementaryFeature; - - /** - * Existence of the global object history having the string representation "\[object History\]". - * - * @remarks - * - * Available in Chrome, Edge, Firefox, Internet Explorer, Safari, Opera, and Android Browser. This feature is not available inside web workers. - */ - HISTORY: ElementaryFeature; - - /** - * Existence of the global object Audio whose string representation starts with "function HTMLAudioElement". - * - * @remarks - * - * Available in Android Browser 4.4. This feature is not available inside web workers. - */ - HTMLAUDIOELEMENT: ElementaryFeature; - - /** - * Existence of the global object document having the string representation "\[object HTMLDocument\]". - * - * @remarks - * - * Available in Chrome, Edge, Firefox, Internet Explorer 11, Safari, Opera, and Android Browser. This feature is not available inside web workers. - */ - HTMLDOCUMENT: ElementaryFeature; - - /** Features available in Internet Explorer 10. */ - IE_10: PredefinedFeature; - - /** Features available in Internet Explorer 11. */ - IE_11: PredefinedFeature; - - /** Features available in Internet Explorer 11 on Windows 10. */ - IE_11_WIN_10: PredefinedFeature; - - /** Features available in Internet Explorer 9. */ - IE_9: PredefinedFeature; - - /** - * A string representation of native functions typical for Internet Explorer. - * - * Remarkable traits are the presence of a line feed character \("\\n"\) at the beginning and at the end of the string and a line feed followed by four whitespaces \("\\n "\) before the "\[native code\]" sequence. - * - * @remarks - * - * Available in Internet Explorer. - */ - IE_SRC: ElementaryFeature; - - /** - * The ability to use unary increment operators with string characters, like in \( ++"some string"\[0\] \): this will result in a TypeError in strict mode in ECMAScript compliant engines. - * - * @remarks - * - * Available in Chrome, Edge, Firefox, Internet Explorer, Safari, Opera, Android Browser, and Node.js. This feature is not available when strict mode is enforced in Chrome, Edge, Firefox, Internet Explorer 10+, Safari, Opera, and Node.js 5+. - */ - INCR_CHAR: ElementaryFeature; - - /** - * Existence of the global object Intl. - * - * @remarks - * - * Available in Chrome, Edge, Firefox, Internet Explorer 11, Safari 10+, Opera, Android Browser 4.4, and Node.js 0.12+. - */ - INTL: ElementaryFeature; - - /** - * Language sensitive string representation of Infinity as "∞". - * - * @remarks - * - * Available in Chrome, Edge, Firefox, Internet Explorer 11 on Windows 10, Safari 10+, Opera, Android Browser 4.4, and Node.js 0.12+. - */ - LOCALE_INFINITY: ElementaryFeature; - - /** - * Features shared by all engines capable of localized number formatting, including output of Arabic digits, the Arabic decimal separator "٫", the letters in the first word of the Arabic string representation of NaN \("ليس"\), Persian digits and the Persian digit group separator "٬". - * - * @remarks - * - * Available in Chrome, Edge, Firefox, Internet Explorer 11, Safari 10+, Opera, Android Browser 4.4, and Node.js 13+. - */ - LOCALE_NUMERALS: ElementaryFeature; - - /** - * Extended localized number formatting. - * - * This includes all features of LOCALE_NUMERALS plus the output of the first three letters in the second word of the Arabic string representation of NaN \("رقم"\), Bengali digits, the letters in the Russian string representation of NaN \("не число"\) and the letters in the Persian string representation of NaN \("ناعدد"\). - * - * @remarks - * - * Available in Chrome, Edge, Firefox, Internet Explorer 11 on Windows 10, Safari 10+, Opera, Android Browser 4.4, and Node.js 13+. - */ - LOCALE_NUMERALS_EXT: ElementaryFeature; - - /** - * Existence of the global object location with the property that Object.prototype.toString.call\(location\) evaluates to a string that starts with "\[object " and ends with "Location\]". - * - * @remarks - * - * Available in Chrome, Edge, Firefox, Safari, Opera, and Android Browser. - */ - LOCATION: ElementaryFeature; - - /** - * Existence of the name property for functions. - * - * @remarks - * - * Available in Chrome, Edge, Firefox, Safari, Opera, Android Browser, and Node.js. - */ - NAME: ElementaryFeature; - - /** - * Existence of the global object Node having the string representation "\[object NodeConstructor\]". - * - * @remarks - * - * Available in Safari before 10. This feature is not available inside web workers. - */ - NODECONSTRUCTOR: ElementaryFeature; - - /** Features available in Node.js 0.10. */ - NODE_0_10: PredefinedFeature; - - /** Features available in Node.js 0.12. */ - NODE_0_12: PredefinedFeature; - - /** Features available in Node.js 10. */ - NODE_10: PredefinedFeature; - - /** Features available in Node.js 11. */ - NODE_11: PredefinedFeature; - - /** Features available in Node.js 12. */ - NODE_12: PredefinedFeature; - - /** Features available in Node.js 13 and Node.js 14. */ - NODE_13: PredefinedFeature; - - /** Features available in Node.js 15. */ - NODE_15: PredefinedFeature; - - /** Features available in Node.js 16 or later. */ - NODE_16: PredefinedFeature; - - /** Features available in Node.js 4. */ - NODE_4: PredefinedFeature; - - /** Features available in Node.js 5 to 9. */ - NODE_5: PredefinedFeature; - - /** - * A string representation of native functions typical for V8 or for Internet Explorer but not for Firefox and Safari. - * - * @remarks - * - * Available in Chrome, Edge, Internet Explorer, Opera, Android Browser, and Node.js. - */ - NO_FF_SRC: ElementaryFeature; - - /** - * A string representation of native functions typical for most engines with the notable exception of Internet Explorer. - * - * A remarkable trait of this feature is the lack of line feed characters at the beginning and at the end of the string. - * - * @remarks - * - * Available in Chrome, Edge, Firefox, Safari, Opera, Android Browser, and Node.js. - */ - NO_IE_SRC: ElementaryFeature; - - /** - * The property that the string representation of Array.prototype.entries\(\) evaluates to "\[object Array Iterator\]" and that Array.prototype.entries\(\).constructor is the global function Object. - * - * @remarks - * - * Available in Chrome, Edge, Firefox, Safari 9+, Opera, and Node.js 0.12+. - */ - NO_OLD_SAFARI_ARRAY_ITERATOR: ElementaryFeature; - - /** - * A string representation of native functions typical for Firefox, Internet Explorer and Safari. - * - * A most remarkable trait of this feature is the presence of a line feed followed by four whitespaces \("\\n "\) before the "\[native code\]" sequence. - * - * @remarks - * - * Available in Firefox, Internet Explorer, and Safari. - */ - NO_V8_SRC: ElementaryFeature; - - /** - * Having the function Object.prototype.toString return the string "\[object Undefined\]" when invoked without a binding. - * - * @remarks - * - * Available in Chrome, Edge, Firefox, Internet Explorer 10+, Safari, Opera, Android Browser 4.1+, and Node.js. - */ - OBJECT_UNDEFINED: ElementaryFeature; - - /** - * Existence of the global object Intl having the string representation "\[object Object\]" - * - * @remarks - * - * Available in Firefox before 83, Internet Explorer 11, Safari 10+ before 14.0.1, Android Browser 4.4, and Node.js 0.12+ before 15. - */ - PLAIN_INTL: ElementaryFeature; - - /** - * The property that the string representation of String.prototype.matchAll\(\) evaluates to "\[object RegExp String Iterator\]". - * - * @remarks - * - * Available in Chrome, Edge, Firefox, Safari 13+, Opera, and Node.js 12+. - */ - REGEXP_STRING_ITERATOR: ElementaryFeature; - - /** - * Features available in the current stable version of Safari. - * - * An alias for `SAFARI_14_1`. - */ - SAFARI: PredefinedFeature; - - /** Features available in Safari 10 and Safari 11. */ - SAFARI_10: PredefinedFeature; - - /** Features available in Safari 12. */ - SAFARI_12: PredefinedFeature; - - /** Features available in Safari 13 and Safari 14.0.0. */ - SAFARI_13: PredefinedFeature; - - /** Features available in Safari 14.0.1 to 14.0.3. */ - SAFARI_14_0_1: PredefinedFeature; - - /** Features available in Safari 14.1 or later. */ - SAFARI_14_1: PredefinedFeature; - - /** Features available in Safari 7.0. */ - SAFARI_7_0: PredefinedFeature; - - /** Features available in Safari 7.1 and Safari 8. */ - SAFARI_7_1: PredefinedFeature; - - /** An alias for `SAFARI_7_1`. */ - SAFARI_8: PredefinedFeature; - - /** Features available in Safari 9. */ - SAFARI_9: PredefinedFeature; - - /** An alias for `ANY_WINDOW`. */ - SELF: ElementaryFeature; - - /** - * Existence of the global object self whose string representation starts with "\[object ". - * - * @remarks - * - * Available in Chrome, Edge, Firefox, Internet Explorer, Safari, Opera, and Android Browser. This feature is not available inside web workers in Safari 7.1+ before 10. - */ - SELF_OBJ: ElementaryFeature; - - /** - * Support for the two-letter locale name "ar" to format decimal numbers as Arabic numerals. - * - * @remarks - * - * Available in Firefox, Internet Explorer 11, Safari 10+, Android Browser 4.4, and Node.js 13+. - */ - SHORT_LOCALES: ElementaryFeature; - - /** - * Existence of the global string status. - * - * @remarks - * - * Available in Chrome, Edge, Firefox, Internet Explorer, Safari, Opera, and Android Browser. This feature is not available inside web workers. - */ - STATUS: ElementaryFeature; - - /** - * The property that Object.prototype.toString.call\(\) evaluates to "\[object Undefined\]". - * - * This behavior is specified by ECMAScript, and is enforced by all engines except Android Browser versions prior to 4.1.2, where this feature is not available. - * - * @remarks - * - * Available in Chrome, Edge, Firefox, Internet Explorer, Safari, Opera, Android Browser 4.1+, and Node.js. - */ - UNDEFINED: ElementaryFeature; - - /** - * A string representation of native functions typical for the V8 engine. - * - * Remarkable traits are the lack of line feed characters at the beginning and at the end of the string and the presence of a single whitespace before the "\[native code\]" sequence. - * - * @remarks - * - * Available in Chrome, Edge, Opera, Android Browser, and Node.js. - */ - V8_SRC: ElementaryFeature; - - /** - * Existence of the global object self having the string representation "\[object Window\]". - * - * @remarks - * - * Available in Chrome, Edge, Firefox, Internet Explorer, Safari, Opera, and Android Browser 4.4. This feature is not available inside web workers. - */ - WINDOW: ElementaryFeature; -} - -/** Name of an elementary feature. */ -type ElementaryFeatureName = -| 'ANY_DOCUMENT' -| 'ANY_WINDOW' -| 'ARRAY_ITERATOR' -| 'ARROW' -| 'AT' -| 'ATOB' -| 'BARPROP' -| 'CAPITAL_HTML' -| 'CONSOLE' -| 'DOCUMENT' -| 'DOMWINDOW' -| 'ESC_HTML_ALL' -| 'ESC_HTML_QUOT' -| 'ESC_HTML_QUOT_ONLY' -| 'ESC_REGEXP_LF' -| 'ESC_REGEXP_SLASH' -| 'EXTERNAL' -| 'FF_SRC' -| 'FILL' -| 'FLAT' -| 'FROM_CODE_POINT' -| 'FUNCTION_19_LF' -| 'FUNCTION_22_LF' -| 'GENERIC_ARRAY_TO_STRING' -| 'GLOBAL_UNDEFINED' -| 'GMT' -| 'HISTORY' -| 'HTMLAUDIOELEMENT' -| 'HTMLDOCUMENT' -| 'IE_SRC' -| 'INCR_CHAR' -| 'INTL' -| 'LOCALE_INFINITY' -| 'LOCALE_NUMERALS' -| 'LOCALE_NUMERALS_EXT' -| 'LOCATION' -| 'NAME' -| 'NODECONSTRUCTOR' -| 'NO_FF_SRC' -| 'NO_IE_SRC' -| 'NO_OLD_SAFARI_ARRAY_ITERATOR' -| 'NO_V8_SRC' -| 'OBJECT_UNDEFINED' -| 'PLAIN_INTL' -| 'REGEXP_STRING_ITERATOR' -| 'SELF_OBJ' -| 'SHORT_LOCALES' -| 'STATUS' -| 'UNDEFINED' -| 'V8_SRC' -| 'WINDOW' -; - -/** Name of a predefined feature. */ -type PredefinedFeatureName = -ElementaryFeatureName -| 'ANDRO_4_0' -| 'ANDRO_4_1' -| 'ANDRO_4_4' -| 'AUTO' -| 'BROWSER' -| 'CHROME_86' -| 'COMPACT' -| 'DEFAULT' -| 'FF_78' -| 'FF_83' -| 'IE_10' -| 'IE_11' -| 'IE_11_WIN_10' -| 'IE_9' -| 'NODE_0_10' -| 'NODE_0_12' -| 'NODE_10' -| 'NODE_11' -| 'NODE_12' -| 'NODE_13' -| 'NODE_15' -| 'NODE_16' -| 'NODE_4' -| 'NODE_5' -| 'SAFARI_10' -| 'SAFARI_12' -| 'SAFARI_13' -| 'SAFARI_14_0_1' -| 'SAFARI_14_1' -| 'SAFARI_7_0' -| 'SAFARI_7_1' -| 'SAFARI_9' -; diff --git a/lib/jscrewit.js b/lib/jscrewit.js deleted file mode 100644 index 893c792e..00000000 --- a/lib/jscrewit.js +++ /dev/null @@ -1,9165 +0,0 @@ -// JScrewIt 2.28.0 – https://jscrew.it - -(function () { - 'use strict'; - - var _Array = Array; - var _Array_isArray = _Array.isArray; - var _Array_prototype_every_call; - var _Array_prototype_forEach_call; - var _Array_prototype_map_call; - var _Array_prototype_push_apply; - var _Array_prototype_slice_call; - - var _Date = Date; - - var _Error = Error; - - var _Function = Function; - - var _JSON_parse = JSON.parse; - var _JSON_stringify = JSON.stringify; - - var _Math_abs = Math.abs; - var _Math_max = Math.max; - var _Math_min = Math.min; - var _Math_pow = Math.pow; - - var _Object = Object; - var _Object_create = _Object.create; - var _Object_defineProperty = _Object.defineProperty; - var _Object_freeze = _Object.freeze; - var _Object_getOwnPropertyDescriptor = _Object.getOwnPropertyDescriptor; - var _Object_keys = _Object.keys; - - var _RegExp = RegExp; - - var _String = String; - - var _SyntaxError = SyntaxError; - - var _TypeError = TypeError; - - var _parseInt = parseInt; - - var _setTimeout = setTimeout; - - function assignNoEnum(target, source) - { - var names = _Object_keys(source); - names.forEach - ( - function (name) - { - var descriptor = _Object_getOwnPropertyDescriptor(source, name); - descriptor.enumerable = false; - _Object_defineProperty(target, name, descriptor); - } - ); - return target; - } - - var createEmpty = _Object_create.bind(null, null, undefined); - - function esToString(arg) - { - if (typeof arg === 'symbol') - throw new _TypeError('Cannot convert a symbol to a string'); - var str = _String(arg); - return str; - } - - function noProto(obj) - { - var result = createEmpty(); - _Object_keys(obj).forEach - ( - function (name) - { - result[name] = obj[name]; - } - ); - return result; - } - - function tryCreateRegExp(pattern, flags) - { - try - { - var regExp = _RegExp(pattern, flags); - // In Android Browser 4.0, the RegExp constructor ignores unrecognized flags instead of - // throwing a SyntaxError. - if (regExp.flags === flags) - return regExp; - } - catch (error) - { } - } - - var noop = _Function(); - - (function () - { - var _Array_prototype = _Array.prototype; - var _Function_prototype = _Function.prototype; - var _Function_prototype_apply = _Function_prototype.apply; - var _Function_prototype_call = _Function_prototype.call; - - _Array_prototype_every_call = _Function_prototype_call.bind(_Array_prototype.every); - _Array_prototype_forEach_call = _Function_prototype_call.bind(_Array_prototype.forEach); - _Array_prototype_map_call = _Function_prototype_call.bind(_Array_prototype.map); - _Array_prototype_slice_call = _Function_prototype_call.bind(_Array_prototype.slice); - _Array_prototype_push_apply = _Function_prototype_apply.bind(_Array_prototype.push); - } - )(); - - function addCluster(start, length, data, saving) - { - var startLink = getOrCreateStartLink(this.startLinks, start); - var cluster = startLink[length]; - if (cluster) - { - if (cluster.saving < saving) - { - cluster.data = data; - cluster.saving = saving; - } - } - else - { - cluster = startLink[length] = { start: start, length: length, data: data, saving: saving }; - this.clusters.push(cluster); - } - if (this.maxLength < length) - this.maxLength = length; - } - - function compareClustersByQuality(cluster1, cluster2) - { - var diff = - cluster1.saving - cluster2.saving || - cluster2.length - cluster1.length || - compareClustersByStart(cluster2, cluster1); - return diff; - } - - function compareClustersByStart(cluster1, cluster2) - { - var diff = cluster2.start - cluster1.start; - return diff; - } - - function conclude() - { - var bestClusters = []; - var clusters = this.clusters; - if (clusters.length) - { - clusters.sort(compareClustersByQuality); - var cluster; - while (cluster = pickBestCluster(this.startLinks, clusters, this.maxLength)) - bestClusters.push(cluster); - bestClusters.sort(compareClustersByStart); - } - return bestClusters; - } - - function getOrCreateStartLink(startLinks, start) - { - var startLink = startLinks[start] || (startLinks[start] = []); - return startLink; - } - - function pickBestCluster(startLinks, clusters, maxLength) - { - var cluster; - while (cluster = clusters.pop()) - { - if (cluster.saving != null) - { - unlinkClusters(startLinks, maxLength, cluster); - return cluster; - } - } - } - - function unlinkClusters(startLinks, maxLength, cluster) - { - var startLink; - var start = cluster.start; - var index = start; - var end = start + cluster.length; - do - { - startLink = startLinks[index]; - if (startLink) - { - unlinkClustersFromLength(startLink, 0); - delete startLinks[index]; - } - } - while (++index < end); - for (var length = 1; length < maxLength;) - { - startLink = startLinks[start - length++]; - if (startLink) - { - unlinkClustersFromLength(startLink, length); - startLink.length = length; - } - } - } - - function unlinkClustersFromLength(startLink, fromLength) - { - for (var length = startLink.length; length-- > fromLength;) - { - var cluster = startLink[length]; - if (cluster) - delete cluster.saving; - } - } - - function createClusteringPlan() - { - var plan = - { - addCluster: addCluster, - clusters: [], - conclude: conclude, - maxLength: 0, - startLinks: createEmpty(), - }; - return plan; - } - - var extendStatics = function(d, b) { - extendStatics = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; - return extendStatics(d, b); - }; - - function __extends(d, b) { - if (typeof b !== "function" && b !== null) - throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); - extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - } - - // quinquaginta-duo 3.1.1 – https://github.com/fasttime/JScrewIt/tree/master/packages/quinquaginta-duo - - var BIN_POW_31 = 2147483648; - var BIN_POW_32 = 4294967296; - var BIN_POW_51 = 2251799813685248; - var BIT_MASK_31 = 2147483647; - var EMPTY_MASK = 0; - /** Determines whether two specified masks are equal. */ - function maskAreEqual(mask1, mask2) { - return mask1 === mask2; - } - /** Determines whether a specified mask includes another one. */ - function maskIncludes(includingMask, includedMask) { - var includedLoValue; - var includedHiValue; - var returnValue = (includingMask & - (includedLoValue = includedMask | 0)) === - includedLoValue && - (includingMask / BIN_POW_32 & - (includedHiValue = includedMask / BIN_POW_32 | 0)) === - includedHiValue; - return returnValue; - } - /** Returns a new mask that is the intersection of two specified masks. */ - function maskIntersection(mask1, mask2) { - var intersectionMask = ((mask1 & mask2 & BIT_MASK_31) + - (mask1 / BIN_POW_31 & mask2 / BIN_POW_31) * BIN_POW_31); - return intersectionMask; - } - /** Returns a new empty mask. */ - function maskNew() { - return EMPTY_MASK; - } - /** - * Returns a new non-empty mask that does not intersect the specified mask. - * - * @throws If the specified mask is full, a `RangeError` is thrown. - */ - function maskNext(mask) { - var nextValue = 1; - for (var checkValue = mask; checkValue & 1; checkValue /= 2) - nextValue *= 2; - if (nextValue > BIN_POW_51) - throw RangeError('Mask full'); - return nextValue; - } - /** Returns a new mask that is the union of two specified masks. */ - function maskUnion(mask1, mask2) { - var unionMask = (((mask1 | mask2) & BIT_MASK_31) + - (mask1 / BIN_POW_31 | mask2 / BIN_POW_31) * BIN_POW_31); - return unionMask; - } - - var keyFor = function (mask) { return "_" + mask; }; - var MaskIndex = /** @class */ (function () { - function MaskIndex() { - this._index = Object.create(null); - this._size = 0; - } - /** Determines whether the current collection contains an entry for a specified mask. */ - MaskIndex.prototype.has = function (mask) { - var key = keyFor(mask); - var returnValue = key in this._index; - return returnValue; - }; - Object.defineProperty(MaskIndex.prototype, "size", { - /* The number of entries in the current collection. */ - get: function () { - return this._size; - }, - enumerable: false, - configurable: true - }); - MaskIndex.prototype._setEntry = function (mask, value) { - var key = keyFor(mask); - var _index = this._index; - if (!(key in _index)) - ++this._size; - _index[key] = value; - }; - return MaskIndex; - }()); - /** A data structure that maps masks to arbitrary values. */ - var MaskMap = /** @class */ (function (_super) { - __extends(MaskMap, _super); - function MaskMap() { - return _super !== null && _super.apply(this, arguments) || this; - } - /** - * Retrieves the value associated with a specified mask, or `undefined` if the mask has not been - * set. - */ - MaskMap.prototype.get = function (mask) { - var key = keyFor(mask); - var value = this._index[key]; - return value; - }; - /** - * Associates a specified value with a specified mask. - * If the mask has already been set, the previous value will be overwritten. - */ - MaskMap.prototype.set = function (mask, value) { - this._setEntry(mask, value); - }; - return MaskMap; - }(MaskIndex)); - /** A data structure that stores unique masks. */ - var MaskSet = /** @class */ (function (_super) { - __extends(MaskSet, _super); - function MaskSet() { - return _super !== null && _super.apply(this, arguments) || this; - } - /** - * Adds a specified mask to the current `MaskSet` object. - * If the mask has already been added, nothing is done. - */ - MaskSet.prototype.add = function (mask) { - this._setEntry(mask, undefined); - }; - return MaskSet; - }(MaskIndex)); - - var ALL = createEmpty(); - var DESCRIPTION_MAP = createEmpty(); - var ELEMENTARY = []; - var FEATURE_PROTOTYPE = Feature.prototype; - var INCLUDES_MAP = createEmpty(); - var INCOMPATIBLE_MASK_LIST = []; - - function Feature() - { - var mask = validMaskFromArguments(arguments); - var featureObj = this instanceof Feature ? this : _Object_create(FEATURE_PROTOTYPE); - initMask(featureObj, mask); - return featureObj; - } - - function areCompatible() - { - var arg0; - var features = - arguments.length === 1 && _Array_isArray(arg0 = arguments[0]) ? arg0 : arguments; - var compatible; - if (features.length > 1) - { - var mask = featureArrayLikeToMask(features); - compatible = isMaskCompatible(mask); - } - else - compatible = true; - return compatible; - } - - function areEqual() - { - var mask; - var equal = - _Array_prototype_every_call - ( - arguments, - function (arg, index) - { - var returnValue; - var otherMask = validMaskFromArrayOrStringOrFeature(arg); - if (index) - returnValue = maskAreEqual(otherMask, mask); - else - { - mask = otherMask; - returnValue = true; - } - return returnValue; - } - ); - return equal; - } - - function checkLocaleNumeral(locale, number, regExp) - { - var localizedNumeral = number.toLocaleString(locale); - var returnValue = regExp.test(localizedNumeral); - return returnValue; - } - - function checkSelfFeature() - { - // self + '' throws an error inside a web worker in Safari 8 and 9. - try - { - var str = self + ''; - } - catch (error) - { - return false; - } - var available = this(str); - return available; - } - - function commonOf() - { - var returnValue; - if (arguments.length) - { - var mask; - _Array_prototype_forEach_call - ( - arguments, - function (arg) - { - var otherMask = validMaskFromArrayOrStringOrFeature(arg); - if (mask != null) - mask = maskIntersection(mask, otherMask); - else - mask = otherMask; - } - ); - returnValue = featureFromMask(mask); - } - else - returnValue = null; - return returnValue; - } - - function descriptionFor(name) - { - name = esToString(name); - var description = DESCRIPTION_MAP[name]; - if (description == null) - throw new _Error('Unknown feature ' + _JSON_stringify(name)); - return description; - } - - function featureArrayLikeToMask(arrayLike) - { - var mask = maskNew(); - _Array_prototype_forEach_call - ( - arrayLike, - function (feature) - { - var otherMask = maskFromStringOrFeature(feature); - mask = maskUnion(mask, otherMask); - } - ); - return mask; - } - - function featureFromMask(mask) - { - var featureObj = _Object_create(FEATURE_PROTOTYPE); - initMask(featureObj, mask); - return featureObj; - } - - function featuresToMask(featureObjs) - { - var mask = maskNew(); - featureObjs.forEach - ( - function (featureObj) - { - mask = maskUnion(mask, featureObj.mask); - } - ); - return mask; - } - - function initMask(featureObj, mask) - { - _Object_defineProperty(featureObj, 'mask', { value: mask }); - } - - /** - * Node.js custom inspection function. - * Set on `Feature.prototype` with name `"inspect"` for Node.js ≤ 8.6.x and with symbol - * `Symbol.for("nodejs.util.inspect.custom")` for Node.js ≥ 6.6.x. - * - * @function inspect - * - * @see - * {@link https://tiny.cc/j4wz9y|Custom inspection functions on Objects} for further information. - */ - function inspect(depth, opts) - { - var returnValue; - var str = this.toString(); - if (opts !== undefined) // opts can be undefined in Node.js 0.10.0. - returnValue = opts.stylize(str, 'jscrewit-feature'); - else - returnValue = str; - return returnValue; - } - - function isExcludingAttribute(attributeCache, attributeName, featureObjs) - { - var returnValue = attributeCache[attributeName]; - if (returnValue === undefined) - { - attributeCache[attributeName] = - returnValue = - featureObjs.some - ( - function (featureObj) - { - return attributeName in featureObj.attributes; - } - ); - } - return returnValue; - } - - function isMaskCompatible(mask) - { - var compatible = - INCOMPATIBLE_MASK_LIST.every - ( - function (incompatibleMask) - { - var returnValue = !maskIncludes(mask, incompatibleMask); - return returnValue; - } - ); - return compatible; - } - - function maskFromStringOrFeature(arg) - { - var mask; - if (arg instanceof Feature) - mask = arg.mask; - else - { - var name = esToString(arg); - var featureObj = ALL[name]; - if (!featureObj) - throw new _Error('Unknown feature ' + _JSON_stringify(name)); - mask = featureObj.mask; - } - return mask; - } - - function validateMask(mask) - { - if (!isMaskCompatible(mask)) - throw new _Error('Incompatible features'); - } - - function validMaskFromArguments(args) - { - var mask = maskNew(); - var validationNeeded = 0; - _Array_prototype_forEach_call - ( - args, - function (arg) - { - var otherMask; - if (_Array_isArray(arg)) - { - otherMask = featureArrayLikeToMask(arg); - validationNeeded |= arg.length > 1; - } - else - otherMask = maskFromStringOrFeature(arg); - mask = maskUnion(mask, otherMask); - } - ); - validationNeeded |= args.length > 1; - if (validationNeeded) - validateMask(mask); - return mask; - } - - function validMaskFromArrayOrStringOrFeature(arg) - { - var mask; - if (_Array_isArray(arg)) - { - mask = featureArrayLikeToMask(arg); - if (arg.length > 1) - validateMask(mask); - } - else - mask = maskFromStringOrFeature(arg); - return mask; - } - - function wrapCheck(check) - { - var returnValue = - function () - { - var available = !!check(); - return available; - }; - return returnValue; - } - - assignNoEnum - ( - FEATURE_PROTOTYPE, - { - get canonicalNames() - { - var mask = this.mask; - var featureNameSet = createEmpty(); - var allIncludes = []; - ELEMENTARY.forEach - ( - function (featureObj) - { - var included = maskIncludes(mask, featureObj.mask); - if (included) - { - var name = featureObj.name; - featureNameSet[name] = null; - var includes = INCLUDES_MAP[name]; - _Array_prototype_push_apply(allIncludes, includes); - } - } - ); - allIncludes.forEach - ( - function (name) - { - delete featureNameSet[name]; - } - ); - var names = _Object_keys(featureNameSet).sort(); - return names; - }, - - elementary: false, - - get elementaryNames() - { - var names = []; - var mask = this.mask; - ELEMENTARY.forEach - ( - function (featureObj) - { - var included = maskIncludes(mask, featureObj.mask); - if (included) - names.push(featureObj.name); - } - ); - return names; - }, - - includes: - function () - { - var mask = this.mask; - var included = - _Array_prototype_every_call - ( - arguments, - function (arg) - { - var otherMask = validMaskFromArrayOrStringOrFeature(arg); - var returnValue = maskIncludes(mask, otherMask); - return returnValue; - } - ); - return included; - }, - - inspect: inspect, - - name: undefined, - - restrict: - function (environment, engineFeatureObjs) - { - var resultMask = maskNew(); - var thisMask = this.mask; - var attributeCache = createEmpty(); - ELEMENTARY.forEach - ( - function (featureObj) - { - var otherMask = featureObj.mask; - var included = maskIncludes(thisMask, otherMask); - if (included) - { - var attributeValue = featureObj.attributes[environment]; - if - ( - attributeValue === undefined || - engineFeatureObjs !== undefined && - !isExcludingAttribute(attributeCache, attributeValue, engineFeatureObjs) - ) - resultMask = maskUnion(resultMask, otherMask); - } - } - ); - var returnValue = featureFromMask(resultMask); - return returnValue; - }, - - toString: - function () - { - var name = this.name; - if (name === undefined) - name = '{' + this.canonicalNames.join(', ') + '}'; - var str = '[Feature ' + name + ']'; - return str; - }, - } - ); - - (function (featureInfos) - { - function completeExclusions() - { - var incompatibleMaskSet = new MaskSet(); - featureNames.forEach - ( - function (name) - { - var info = featureInfos[name]; - var excludes = info.excludes; - if (excludes) - { - var featureObj = ALL[name]; - var mask = featureObj.mask; - excludes.forEach - ( - function (exclude) - { - var excludeMask = completeFeature(exclude); - var incompatibleMask = maskUnion(mask, excludeMask); - if (!incompatibleMaskSet.has(incompatibleMask)) - { - INCOMPATIBLE_MASK_LIST.push(incompatibleMask); - incompatibleMaskSet.add(incompatibleMask); - } - } - ); - } - } - ); - } - - function completeFeature(name) - { - var mask; - var featureObj = ALL[name]; - if (featureObj) - mask = featureObj.mask; - else - { - var description; - var info = featureInfos[name]; - var engine = info.engine; - if (engine == null) - description = info.description; - else - description = createEngineFeatureDescription(engine); - var aliasFor = info.aliasFor; - if (aliasFor != null) - { - mask = completeFeature(aliasFor); - featureObj = ALL[aliasFor]; - if (description == null) - description = DESCRIPTION_MAP[aliasFor]; - } - else - { - var check = info.check; - if (check) - { - mask = maskNext(unionMask); - unionMask = maskUnion(unionMask, mask); - if (check()) - autoMask = maskUnion(autoMask, mask); - check = wrapCheck(check); - } - else - mask = maskNew(); - var includes = INCLUDES_MAP[name] = info.includes || []; - includes.forEach - ( - function (include) - { - var includeMask = completeFeature(include); - mask = maskUnion(mask, includeMask); - } - ); - var elementary = check || info.excludes; - featureObj = createFeature(name, mask, check, engine, info.attributes, elementary); - if (elementary) - ELEMENTARY.push(featureObj); - } - registerFeature(name, description, featureObj); - } - return mask; - } - - function createEngineFeatureDescription(engine) - { - var description = 'Features available in ' + engine + '.'; - return description; - } - - function createFeature(name, mask, check, engine, attributes, elementary) - { - attributes = _Object_freeze(attributes || { }); - var descriptors = - { - attributes: { value: attributes }, - check: { value: check }, - engine: { value: engine }, - name: { value: name }, - }; - if (elementary) - descriptors.elementary = { value: true }; - var featureObj = _Object_create(FEATURE_PROTOTYPE, descriptors); - initMask(featureObj, mask); - return featureObj; - } - - function registerFeature(name, description, featureObj) - { - var descriptor = { enumerable: true, value: featureObj }; - _Object_defineProperty(Feature, name, descriptor); - ALL[name] = featureObj; - DESCRIPTION_MAP[name] = description; - } - - var constructorSource = - { - ALL: ALL, - ELEMENTARY: ELEMENTARY, - areCompatible: areCompatible, - areEqual: areEqual, - commonOf: commonOf, - descriptionFor: descriptionFor, - }; - assignNoEnum(Feature, constructorSource); - - try - { - var inspectKey = require('util').inspect.custom; - } - catch (error) - { } - if (inspectKey) - { - _Object_defineProperty - (FEATURE_PROTOTYPE, inspectKey, { configurable: true, value: inspect, writable: true }); - } - - var autoMask = maskNew(); - var unionMask = maskNew(); - - var featureNames = _Object_keys(featureInfos); - featureNames.forEach(completeFeature); - completeExclusions(); - ELEMENTARY.sort - ( - function (feature1, feature2) - { - var returnValue = feature1.name < feature2.name ? -1 : 1; - return returnValue; - } - ); - _Object_freeze(ELEMENTARY); - var autoFeatureObj = createFeature('AUTO', autoMask); - registerFeature('AUTO', 'All features available in the current engine.', autoFeatureObj); - _Object_freeze(ALL); - }) - ( - { - ANY_DOCUMENT: - { - description: - 'Existence of the global object document whose string representation starts with ' + - '"[object " and ends with "Document]".', - check: - function () - { - var available = - typeof document === 'object' && /^\[object .*Document]$/.test(document + ''); - return available; - }, - attributes: { 'web-worker': 'web-worker-restriction' }, - }, - ANY_WINDOW: - { - description: - 'Existence of the global object self whose string representation starts with ' + - '"[object " and ends with "Window]".', - check: - checkSelfFeature.bind - ( - function (str) - { - var available = /^\[object .*Window]$/.test(str); - return available; - } - ), - includes: ['SELF_OBJ'], - attributes: { 'web-worker': 'web-worker-restriction' }, - }, - ARRAY_ITERATOR: - { - description: - 'The property that the string representation of Array.prototype.entries() starts ' + - 'with "[object Array" and ends with "]" at index 21 or 22.', - check: - function () - { - var available = - Array.prototype.entries && /^\[object Array.{8,9}]$/.test([].entries()); - return available; - }, - }, - ARROW: - { - description: 'Support for arrow functions.', - check: - function () - { - try - { - Function('()=>{}')(); - return true; - } - catch (error) - { } - }, - }, - AT: - { - description: 'Existence of the native function Array.prototype.at.', - check: - function () - { - var available = Array.prototype.at; - return available; - }, - }, - ATOB: - { - description: 'Existence of the global functions atob and btoa.', - check: - function () - { - var available = typeof atob === 'function' && typeof btoa === 'function'; - return available; - }, - attributes: { 'web-worker': 'no-atob-in-web-worker' }, - }, - BARPROP: - { - description: - 'Existence of the global object statusbar having the string representation "[object ' + - 'BarProp]".', - check: - function () - { - var available = - typeof statusbar === 'object' && statusbar + '' === '[object BarProp]'; - return available; - }, - attributes: { 'web-worker': 'web-worker-restriction' }, - }, - CAPITAL_HTML: - { - description: - 'The property that the various string methods returning HTML code such as ' + - 'String.prototype.big or String.prototype.link have both the tag name and attributes ' + - 'written in capital letters.', - check: - function () - { - var available = - ''.big() === '' && - ''.fontcolor('') === '' && - ''.fontsize('') === '' && - ''.link('') === '' && - ''.small() === '' && - ''.strike() === '' && - ''.sub() === '' && - ''.sup() === ''; - return available; - }, - }, - CONSOLE: - { - description: - 'Existence of the global object console having the string representation "[object ' + - 'Console]".\n' + - 'This feature may become unavailable when certain browser extensions are active.', - check: - function () - { - var available = typeof console === 'object' && console + '' === '[object Console]'; - return available; - }, - attributes: { 'web-worker': 'no-console-in-web-worker' }, - }, - DOCUMENT: - { - description: - 'Existence of the global object document having the string representation "[object ' + - 'Document]".', - check: - function () - { - var available = - typeof document === 'object' && document + '' === '[object Document]'; - return available; - }, - includes: ['ANY_DOCUMENT'], - excludes: ['HTMLDOCUMENT'], - attributes: { 'web-worker': 'web-worker-restriction' }, - }, - DOMWINDOW: - { - description: - 'Existence of the global object self having the string representation "[object ' + - 'DOMWindow]".', - check: - checkSelfFeature.bind - ( - function (str) - { - var available = str === '[object DOMWindow]'; - return available; - } - ), - includes: ['ANY_WINDOW'], - excludes: ['WINDOW'], - attributes: { 'web-worker': 'web-worker-restriction' }, - }, - ESC_HTML_ALL: - { - description: - 'The property that double quotation mark, less than and greater than characters in ' + - 'the argument of String.prototype.fontcolor are escaped into their respective HTML ' + - 'entities.', - check: - function () - { - var available = ~''.fontcolor('"<>').indexOf('"<>'); - return available; - }, - includes: ['ESC_HTML_QUOT'], - excludes: ['ESC_HTML_QUOT_ONLY'], - }, - ESC_HTML_QUOT: - { - description: - 'The property that double quotation marks in the argument of ' + - 'String.prototype.fontcolor are escaped as """.', - check: - function () - { - var available = ~''.fontcolor('"').indexOf('"'); - return available; - }, - }, - ESC_HTML_QUOT_ONLY: - { - description: - 'The property that only double quotation marks and no other characters in the ' + - 'argument of String.prototype.fontcolor are escaped into HTML entities.', - check: - function () - { - var available = ~''.fontcolor('"<>').indexOf('"<>'); - return available; - }, - includes: ['ESC_HTML_QUOT'], - excludes: ['ESC_HTML_ALL'], - }, - ESC_REGEXP_LF: - { - description: - 'Having regular expressions created with the RegExp constructor use escape sequences ' + - 'starting with a backslash to format line feed characters ("\\n") in their string ' + - 'representation.', - check: - function () - { - var available = (RegExp('\n') + '')[1] === '\\'; - return available; - }, - }, - ESC_REGEXP_SLASH: - { - description: - 'Having regular expressions created with the RegExp constructor use escape sequences ' + - 'starting with a backslash to format slashes ("/") in their string representation.', - check: - function () - { - var available = (RegExp('/') + '')[1] === '\\'; - return available; - }, - }, - EXTERNAL: - { - description: - 'Existence of the global object sidebar having the string representation "[object ' + - 'External]".', - check: - function () - { - var available = typeof sidebar === 'object' && sidebar + '' === '[object External]'; - return available; - }, - attributes: { 'web-worker': 'web-worker-restriction' }, - }, - FF_SRC: - { - description: - 'A string representation of native functions typical for Firefox and Safari.\n' + - 'Remarkable traits are the lack of line feed characters at the beginning and at the ' + - 'end of the string and the presence of a line feed followed by four whitespaces ' + - '("\\n ") before the "[native code]" sequence.', - includes: ['NO_IE_SRC', 'NO_V8_SRC'], - excludes: ['NO_FF_SRC'], - }, - FILL: - { - description: 'Existence of the native function Array.prototype.fill.', - check: - function () - { - var available = Array.prototype.fill; - return available; - }, - }, - FLAT: - { - description: 'Existence of the native function Array.prototype.flat.', - check: - function () - { - var available = Array.prototype.flat; - return available; - }, - }, - FROM_CODE_POINT: - { - description: 'Existence of the function String.fromCodePoint.', - check: - function () - { - var available = String.fromCodePoint; - return available; - }, - }, - FUNCTION_19_LF: - { - description: - 'A string representation of dynamically generated functions where the character at ' + - 'index 19 is a line feed ("\\n").', - check: - function () - { - var available = (Function() + '')[19] === '\n'; - return available; - }, - }, - FUNCTION_22_LF: - { - description: - 'A string representation of dynamically generated functions where the character at ' + - 'index 22 is a line feed ("\\n").', - check: - function () - { - var available = (Function() + '')[22] === '\n'; - return available; - }, - }, - GENERIC_ARRAY_TO_STRING: - { - description: 'Ability to call Array.prototype.toString with a non-array binding.', - check: - function () - { - try - { - Array.prototype.toString.call({ }); - return true; - } - catch (error) - { } - }, - }, - GLOBAL_UNDEFINED: - { - description: - 'Having the global function toString return the string "[object Undefined]" when ' + - 'invoked without a binding.', - check: - function () - { - var getToString = Function('return toString'); - var available = getToString()() === '[object Undefined]'; - return available; - }, - includes: ['OBJECT_UNDEFINED'], - }, - GMT: - { - description: - 'Presence of the text "GMT" after the first 25 characters in the string returned by ' + - 'Date().\n' + - 'The string representation of dates is implementation dependent, but most engines ' + - 'use a similar format, making this feature available in all supported engines except ' + - 'Internet Explorer 9 and 10.', - check: - function () - { - var available = /^.{25}GMT/.test(Date()); - return available; - }, - }, - HISTORY: - { - description: - 'Existence of the global object history having the string representation "[object ' + - 'History]".', - check: - function () - { - var available = typeof history === 'object' && history + '' === '[object History]'; - return available; - }, - attributes: { 'web-worker': 'web-worker-restriction' }, - }, - HTMLAUDIOELEMENT: - { - description: - 'Existence of the global object Audio whose string representation starts with ' + - '"function HTMLAudioElement".', - check: - function () - { - var available = - typeof Audio !== 'undefined' && /^function HTMLAudioElement/.test(Audio); - return available; - }, - includes: ['NO_IE_SRC'], - attributes: { 'web-worker': 'web-worker-restriction' }, - }, - HTMLDOCUMENT: - { - description: - 'Existence of the global object document having the string representation "[object ' + - 'HTMLDocument]".', - check: - function () - { - var available = - typeof document === 'object' && document + '' === '[object HTMLDocument]'; - return available; - }, - includes: ['ANY_DOCUMENT'], - excludes: ['DOCUMENT'], - attributes: { 'web-worker': 'web-worker-restriction' }, - }, - IE_SRC: - { - description: - 'A string representation of native functions typical for Internet Explorer.\n' + - 'Remarkable traits are the presence of a line feed character ("\\n") at the ' + - 'beginning and at the end of the string and a line feed followed by four whitespaces ' + - '("\\n ") before the "[native code]" sequence.', - includes: ['NO_FF_SRC', 'NO_V8_SRC'], - excludes: ['NO_IE_SRC'], - }, - INCR_CHAR: - { - description: - 'The ability to use unary increment operators with string characters, like in ( ' + - '++"some string"[0] ): this will result in a TypeError in strict mode in ECMAScript ' + - 'compliant engines.', - check: - function () - { - return true; - }, - attributes: { 'forced-strict-mode': 'char-increment-restriction' }, - }, - INTL: - { - description: 'Existence of the global object Intl.', - check: - function () - { - var available = typeof Intl === 'object'; - return available; - }, - }, - LOCALE_INFINITY: - { - description: 'Language sensitive string representation of Infinity as "∞".', - check: - function () - { - var available = Infinity.toLocaleString() === '∞'; - return available; - }, - }, - LOCALE_NUMERALS: - { - description: - 'Features shared by all engines capable of localized number formatting, including ' + - 'output of Arabic digits, the Arabic decimal separator "٫", the letters in the first ' + - 'word of the Arabic string representation of NaN ("ليس"), Persian digits and the ' + - 'Persian digit group separator "٬".', - check: - function () - { - var available = - Number.prototype.toLocaleString && - checkLocaleNumeral('ar', NaN, /^ليس/) && - checkLocaleNumeral('ar-td', 234567890.1, /^٢٣٤٬?٥٦٧٬?٨٩٠٫١/) && - checkLocaleNumeral('fa', 1234567890, /^۱٬۲۳۴٬۵۶۷٬۸۹۰/); - return available; - }, - }, - LOCALE_NUMERALS_EXT: - { - description: - 'Extended localized number formatting.\n' + - 'This includes all features of LOCALE_NUMERALS plus the output of the first three ' + - 'letters in the second word of the Arabic string representation of NaN ("رقم"), ' + - 'Bengali digits, the letters in the Russian string representation of NaN ("не\xa0' + - 'число") and the letters in the Persian string representation of NaN ("ناعدد").', - check: - function () - { - var available = - Number.prototype.toLocaleString && - checkLocaleNumeral('ar', NaN, /^ليس.رقم/) && - checkLocaleNumeral('ar-td', 234567890.1, /^٢٣٤٬?٥٦٧٬?٨٩٠٫١/) && - checkLocaleNumeral('bn', 1234567890, /^১,২৩,৪৫,৬৭,৮৯০/) && - checkLocaleNumeral('fa', 1234567890, /^۱٬۲۳۴٬۵۶۷٬۸۹۰/) && - checkLocaleNumeral('fa', NaN, /^ناعد/) && - checkLocaleNumeral('ru', NaN, /^не.число/); - return available; - }, - includes: ['LOCALE_NUMERALS'], - }, - LOCATION: - { - description: - 'Existence of the global object location with the property that ' + - 'Object.prototype.toString.call(location) evaluates to a string that starts with ' + - '"[object " and ends with "Location]".', - check: - function () - { - var available = - typeof location === 'object' && - /^\[object .*Location]$/.test(Object.prototype.toString.call(location)); - return available; - }, - }, - NAME: - { - description: 'Existence of the name property for functions.', - check: - function () - { - var available = 'name' in Function(); - return available; - }, - }, - NODECONSTRUCTOR: - { - description: - 'Existence of the global object Node having the string representation "[object ' + - 'NodeConstructor]".', - check: - function () - { - var available = - typeof Node !== 'undefined' && Node + '' === '[object NodeConstructor]'; - return available; - }, - attributes: { 'web-worker': 'web-worker-restriction' }, - }, - NO_FF_SRC: - { - description: - 'A string representation of native functions typical for V8 or for Internet Explorer ' + - 'but not for Firefox and Safari.', - check: - function () - { - var available = /^(\n?)function Object\(\) \{\1 +\[native code]\s\}/.test(Object); - return available; - }, - excludes: ['FF_SRC'], - }, - NO_IE_SRC: - { - description: - 'A string representation of native functions typical for most engines with the ' + - 'notable exception of Internet Explorer.\n' + - 'A remarkable trait of this feature is the lack of line feed characters at the ' + - 'beginning and at the end of the string.', - check: - function () - { - var available = /^function Object\(\) \{(\n )? \[native code]\s\}/.test(Object); - return available; - }, - excludes: ['IE_SRC'], - }, - NO_OLD_SAFARI_ARRAY_ITERATOR: - { - description: - 'The property that the string representation of Array.prototype.entries() evaluates ' + - 'to "[object Array Iterator]" and that Array.prototype.entries().constructor is the ' + - 'global function Object.', - check: - function () - { - if (Array.prototype.entries) - { - var arrayIterator = [].entries(); - var available = - arrayIterator + '' === '[object Array Iterator]' && - arrayIterator.constructor === Object; - return available; - } - }, - includes: ['ARRAY_ITERATOR'], - }, - NO_V8_SRC: - { - description: - 'A string representation of native functions typical for Firefox, Internet Explorer ' + - 'and Safari.\n' + - 'A most remarkable trait of this feature is the presence of a line feed followed by ' + - 'four whitespaces ("\\n ") before the "[native code]" sequence.', - check: - function () - { - var available = /^\n?function Object\(\) \{\n \[native code]\s\}/.test(Object); - return available; - }, - excludes: ['V8_SRC'], - }, - OBJECT_UNDEFINED: - { - description: - 'Having the function Object.prototype.toString return the string "[object ' + - 'Undefined]" when invoked without a binding.', - check: - function () - { - var toString = Object.prototype.toString; - var available = toString() === '[object Undefined]'; - return available; - }, - includes: ['UNDEFINED'], - }, - PLAIN_INTL: - { - description: - 'Existence of the global object Intl having the string representation "[object ' + - 'Object]"', - check: - function () - { - var available = typeof Intl === 'object' && Intl + '' === '[object Object]'; - return available; - }, - includes: ['INTL'], - }, - REGEXP_STRING_ITERATOR: - { - description: - 'The property that the string representation of String.prototype.matchAll() ' + - 'evaluates to "[object RegExp String Iterator]".', - check: - function () - { - var available = - String.prototype.matchAll && - ''.matchAll() + '' === '[object RegExp String Iterator]'; - return available; - }, - }, - SELF: { aliasFor: 'ANY_WINDOW' }, - SELF_OBJ: - { - description: - 'Existence of the global object self whose string representation starts with ' + - '"[object ".', - check: - checkSelfFeature.bind - ( - function (str) - { - var available = /^\[object /.test(str); - return available; - } - ), - attributes: { 'web-worker': 'safari-bug-21820506' }, - }, - SHORT_LOCALES: - { - description: - 'Support for the two-letter locale name "ar" to format decimal numbers as Arabic ' + - 'numerals.', - check: - function () - { - var NUMBER = 9876430.125; - - var localizedNumeral = NUMBER.toLocaleString('ar'); - var available = - localizedNumeral === NUMBER.toLocaleString('ar-td') && - localizedNumeral !== NUMBER.toLocaleString('en'); - return available; - }, - includes: ['LOCALE_NUMERALS'], - }, - STATUS: - { - description: 'Existence of the global string status.', - check: - function () - { - var available = typeof status === 'string'; - return available; - }, - attributes: { 'web-worker': 'web-worker-restriction' }, - }, - UNDEFINED: - { - description: - 'The property that Object.prototype.toString.call() evaluates to "[object ' + - 'Undefined]".\n' + - 'This behavior is specified by ECMAScript, and is enforced by all engines except ' + - 'Android Browser versions prior to 4.1.2, where this feature is not available.', - check: - function () - { - var available = Object.prototype.toString.call() === '[object Undefined]'; - return available; - }, - }, - V8_SRC: - { - description: - 'A string representation of native functions typical for the V8 engine.\n' + - 'Remarkable traits are the lack of line feed characters at the beginning and at the ' + - 'end of the string and the presence of a single whitespace before the "[native ' + - 'code]" sequence.', - includes: ['NO_FF_SRC', 'NO_IE_SRC'], - excludes: ['NO_V8_SRC'], - }, - WINDOW: - { - description: - 'Existence of the global object self having the string representation "[object ' + - 'Window]".', - check: - checkSelfFeature.bind - ( - function (str) - { - var available = str === '[object Window]'; - return available; - } - ), - includes: ['ANY_WINDOW'], - excludes: ['DOMWINDOW'], - attributes: { 'web-worker': 'web-worker-restriction' }, - }, - - DEFAULT: - { - description: - 'Minimum feature level, compatible with all supported engines in all environments.', - }, - BROWSER: - { - description: - 'Features available in all browsers.\n' + - 'No support for Node.js.', - includes: ['ANY_DOCUMENT', 'ANY_WINDOW', 'HISTORY', 'INCR_CHAR', 'STATUS'], - attributes: - { - 'char-increment-restriction': null, - 'safari-bug-21820506': null, - 'web-worker-restriction': null, - }, - }, - COMPACT: - { - description: - 'All new browsers\' features.\n' + - 'No support for Node.js and older browsers like Internet Explorer, Safari 9 or ' + - 'Android Browser.', - includes: - [ - 'ARROW', - 'ATOB', - 'BARPROP', - 'ESC_HTML_QUOT_ONLY', - 'ESC_REGEXP_LF', - 'ESC_REGEXP_SLASH', - 'FILL', - 'FLAT', - 'FROM_CODE_POINT', - 'GENERIC_ARRAY_TO_STRING', - 'GLOBAL_UNDEFINED', - 'GMT', - 'HISTORY', - 'HTMLDOCUMENT', - 'INCR_CHAR', - 'INTL', - 'LOCALE_INFINITY', - 'LOCALE_NUMERALS_EXT', - 'LOCATION', - 'NAME', - 'NO_IE_SRC', - 'NO_OLD_SAFARI_ARRAY_ITERATOR', - 'REGEXP_STRING_ITERATOR', - 'STATUS', - 'WINDOW', - ], - attributes: { 'char-increment-restriction': null, 'web-worker-restriction': null }, - }, - ANDRO_4_0: - { - engine: 'Android Browser 4.0', - includes: - [ - 'ATOB', - 'CONSOLE', - 'DOMWINDOW', - 'ESC_HTML_ALL', - 'FUNCTION_22_LF', - 'GMT', - 'HISTORY', - 'HTMLDOCUMENT', - 'INCR_CHAR', - 'LOCATION', - 'NAME', - 'STATUS', - 'V8_SRC', - ], - }, - ANDRO_4_1: - { - engine: 'Android Browser 4.1 to 4.3', - includes: - [ - 'ATOB', - 'CONSOLE', - 'DOMWINDOW', - 'ESC_HTML_ALL', - 'FUNCTION_22_LF', - 'GENERIC_ARRAY_TO_STRING', - 'GMT', - 'HISTORY', - 'HTMLDOCUMENT', - 'INCR_CHAR', - 'LOCATION', - 'NAME', - 'OBJECT_UNDEFINED', - 'STATUS', - 'V8_SRC', - ], - }, - ANDRO_4_4: - { - engine: 'Android Browser 4.4', - includes: - [ - 'ATOB', - 'BARPROP', - 'CONSOLE', - 'ESC_HTML_ALL', - 'FUNCTION_22_LF', - 'GENERIC_ARRAY_TO_STRING', - 'GMT', - 'HISTORY', - 'HTMLAUDIOELEMENT', - 'HTMLDOCUMENT', - 'INCR_CHAR', - 'LOCALE_INFINITY', - 'LOCALE_NUMERALS_EXT', - 'LOCATION', - 'NAME', - 'OBJECT_UNDEFINED', - 'PLAIN_INTL', - 'SHORT_LOCALES', - 'STATUS', - 'V8_SRC', - 'WINDOW', - ], - attributes: { 'no-console-in-web-worker': null, 'web-worker-restriction': null }, - }, - CHROME_PREV: - { - engine: 'the previous to current versions of Chrome and Edge', - aliasFor: 'CHROME_86', - }, - CHROME: - { - engine: 'the current stable versions of Chrome, Edge and Opera', - aliasFor: 'CHROME_86', - }, - CHROME_86: - { - engine: 'Chrome 86, Edge 86 and Opera 72 or later', - includes: - [ - 'ARROW', - 'ATOB', - 'BARPROP', - 'ESC_HTML_QUOT_ONLY', - 'ESC_REGEXP_LF', - 'ESC_REGEXP_SLASH', - 'FILL', - 'FLAT', - 'FROM_CODE_POINT', - 'FUNCTION_19_LF', - 'GENERIC_ARRAY_TO_STRING', - 'GLOBAL_UNDEFINED', - 'GMT', - 'HISTORY', - 'HTMLDOCUMENT', - 'INCR_CHAR', - 'INTL', - 'LOCALE_INFINITY', - 'LOCALE_NUMERALS_EXT', - 'LOCATION', - 'NAME', - 'NO_OLD_SAFARI_ARRAY_ITERATOR', - 'REGEXP_STRING_ITERATOR', - 'STATUS', - 'V8_SRC', - 'WINDOW', - ], - attributes: - { - 'char-increment-restriction': null, - 'unstable': null, - 'web-worker-restriction': null, - }, - }, - FF_ESR: - { - engine: 'the current version of Firefox ESR', - aliasFor: 'FF_78', - }, - FF_PREV: - { - engine: 'the previous to current version of Firefox', - aliasFor: 'FF_78', - }, - FF_78: - { - engine: 'Firefox 78 to 82', - includes: - [ - 'ARROW', - 'ATOB', - 'BARPROP', - 'ESC_HTML_QUOT_ONLY', - 'ESC_REGEXP_LF', - 'ESC_REGEXP_SLASH', - 'EXTERNAL', - 'FF_SRC', - 'FILL', - 'FLAT', - 'FROM_CODE_POINT', - 'FUNCTION_19_LF', - 'GENERIC_ARRAY_TO_STRING', - 'GLOBAL_UNDEFINED', - 'GMT', - 'HISTORY', - 'HTMLDOCUMENT', - 'INCR_CHAR', - 'LOCALE_INFINITY', - 'LOCALE_NUMERALS_EXT', - 'LOCATION', - 'NAME', - 'NO_OLD_SAFARI_ARRAY_ITERATOR', - 'PLAIN_INTL', - 'REGEXP_STRING_ITERATOR', - 'SHORT_LOCALES', - 'STATUS', - 'WINDOW', - ], - attributes: - { - 'char-increment-restriction': null, - 'unstable': null, - 'web-worker-restriction': null, - }, - }, - FF: - { - engine: 'the current stable version of Firefox', - aliasFor: 'FF_83', - }, - FF_83: - { - engine: 'Firefox 83 or later', - includes: - [ - 'ARROW', - 'ATOB', - 'BARPROP', - 'ESC_HTML_QUOT_ONLY', - 'ESC_REGEXP_LF', - 'ESC_REGEXP_SLASH', - 'EXTERNAL', - 'FF_SRC', - 'FILL', - 'FLAT', - 'FROM_CODE_POINT', - 'FUNCTION_19_LF', - 'GENERIC_ARRAY_TO_STRING', - 'GLOBAL_UNDEFINED', - 'GMT', - 'HISTORY', - 'HTMLDOCUMENT', - 'INCR_CHAR', - 'INTL', - 'LOCALE_INFINITY', - 'LOCALE_NUMERALS_EXT', - 'LOCATION', - 'NAME', - 'NO_OLD_SAFARI_ARRAY_ITERATOR', - 'REGEXP_STRING_ITERATOR', - 'SHORT_LOCALES', - 'STATUS', - 'WINDOW', - ], - attributes: - { - 'char-increment-restriction': null, - 'unstable': null, - 'web-worker-restriction': null, - }, - }, - IE_9: - { - engine: 'Internet Explorer 9', - includes: - [ - 'CAPITAL_HTML', - 'DOCUMENT', - 'ESC_REGEXP_LF', - 'ESC_REGEXP_SLASH', - 'FUNCTION_22_LF', - 'GENERIC_ARRAY_TO_STRING', - 'HISTORY', - 'IE_SRC', - 'INCR_CHAR', - 'STATUS', - 'UNDEFINED', - 'WINDOW', - ], - }, - IE_10: - { - engine: 'Internet Explorer 10', - includes: - [ - 'ATOB', - 'CAPITAL_HTML', - 'CONSOLE', - 'DOCUMENT', - 'ESC_REGEXP_LF', - 'ESC_REGEXP_SLASH', - 'FUNCTION_22_LF', - 'GENERIC_ARRAY_TO_STRING', - 'HISTORY', - 'IE_SRC', - 'INCR_CHAR', - 'OBJECT_UNDEFINED', - 'STATUS', - 'WINDOW', - ], - attributes: { 'char-increment-restriction': null, 'web-worker-restriction': null }, - }, - IE_11: - { - engine: 'Internet Explorer 11', - includes: - [ - 'ATOB', - 'CAPITAL_HTML', - 'CONSOLE', - 'ESC_REGEXP_LF', - 'ESC_REGEXP_SLASH', - 'FUNCTION_22_LF', - 'GENERIC_ARRAY_TO_STRING', - 'GMT', - 'HISTORY', - 'HTMLDOCUMENT', - 'IE_SRC', - 'INCR_CHAR', - 'LOCALE_NUMERALS', - 'OBJECT_UNDEFINED', - 'PLAIN_INTL', - 'SHORT_LOCALES', - 'STATUS', - 'WINDOW', - ], - attributes: { 'char-increment-restriction': null, 'web-worker-restriction': null }, - }, - IE_11_WIN_10: - { - engine: 'Internet Explorer 11 on Windows 10', - includes: - [ - 'ATOB', - 'CAPITAL_HTML', - 'CONSOLE', - 'ESC_REGEXP_LF', - 'ESC_REGEXP_SLASH', - 'FUNCTION_22_LF', - 'GENERIC_ARRAY_TO_STRING', - 'GMT', - 'HISTORY', - 'HTMLDOCUMENT', - 'IE_SRC', - 'INCR_CHAR', - 'LOCALE_INFINITY', - 'LOCALE_NUMERALS_EXT', - 'OBJECT_UNDEFINED', - 'PLAIN_INTL', - 'SHORT_LOCALES', - 'STATUS', - 'WINDOW', - ], - attributes: { 'char-increment-restriction': null, 'web-worker-restriction': null }, - }, - NODE_0_10: - { - engine: 'Node.js 0.10', - includes: - [ - 'ESC_HTML_ALL', - 'FUNCTION_22_LF', - 'GENERIC_ARRAY_TO_STRING', - 'GLOBAL_UNDEFINED', - 'GMT', - 'INCR_CHAR', - 'NAME', - 'V8_SRC', - ], - }, - NODE_0_12: - { - engine: 'Node.js 0.12', - includes: - [ - 'ESC_HTML_QUOT_ONLY', - 'FUNCTION_22_LF', - 'GENERIC_ARRAY_TO_STRING', - 'GLOBAL_UNDEFINED', - 'GMT', - 'INCR_CHAR', - 'LOCALE_INFINITY', - 'NAME', - 'NO_OLD_SAFARI_ARRAY_ITERATOR', - 'PLAIN_INTL', - 'V8_SRC', - ], - }, - NODE_4: - { - engine: 'Node.js 4', - includes: - [ - 'ARROW', - 'ESC_HTML_QUOT_ONLY', - 'ESC_REGEXP_SLASH', - 'FILL', - 'FROM_CODE_POINT', - 'FUNCTION_22_LF', - 'GENERIC_ARRAY_TO_STRING', - 'GLOBAL_UNDEFINED', - 'GMT', - 'INCR_CHAR', - 'LOCALE_INFINITY', - 'NAME', - 'NO_OLD_SAFARI_ARRAY_ITERATOR', - 'PLAIN_INTL', - 'V8_SRC', - ], - }, - NODE_5: - { - engine: 'Node.js 5 to 9', - includes: - [ - 'ARROW', - 'ESC_HTML_QUOT_ONLY', - 'ESC_REGEXP_SLASH', - 'FILL', - 'FROM_CODE_POINT', - 'FUNCTION_22_LF', - 'GENERIC_ARRAY_TO_STRING', - 'GLOBAL_UNDEFINED', - 'GMT', - 'INCR_CHAR', - 'LOCALE_INFINITY', - 'NAME', - 'NO_OLD_SAFARI_ARRAY_ITERATOR', - 'PLAIN_INTL', - 'V8_SRC', - ], - attributes: { 'char-increment-restriction': null }, - }, - NODE_10: - { - engine: 'Node.js 10', - includes: - [ - 'ARROW', - 'ESC_HTML_QUOT_ONLY', - 'ESC_REGEXP_SLASH', - 'FILL', - 'FROM_CODE_POINT', - 'FUNCTION_19_LF', - 'GENERIC_ARRAY_TO_STRING', - 'GLOBAL_UNDEFINED', - 'GMT', - 'INCR_CHAR', - 'LOCALE_INFINITY', - 'NAME', - 'NO_OLD_SAFARI_ARRAY_ITERATOR', - 'PLAIN_INTL', - 'V8_SRC', - ], - attributes: { 'char-increment-restriction': null }, - }, - NODE_11: - { - engine: 'Node.js 11', - includes: - [ - 'ARROW', - 'ESC_HTML_QUOT_ONLY', - 'ESC_REGEXP_SLASH', - 'FILL', - 'FLAT', - 'FROM_CODE_POINT', - 'FUNCTION_19_LF', - 'GENERIC_ARRAY_TO_STRING', - 'GLOBAL_UNDEFINED', - 'GMT', - 'INCR_CHAR', - 'LOCALE_INFINITY', - 'NAME', - 'NO_OLD_SAFARI_ARRAY_ITERATOR', - 'PLAIN_INTL', - 'V8_SRC', - ], - attributes: { 'char-increment-restriction': null }, - }, - NODE_12: - { - engine: 'Node.js 12', - includes: - [ - 'ARROW', - 'ESC_HTML_QUOT_ONLY', - 'ESC_REGEXP_LF', - 'ESC_REGEXP_SLASH', - 'FILL', - 'FLAT', - 'FROM_CODE_POINT', - 'FUNCTION_19_LF', - 'GENERIC_ARRAY_TO_STRING', - 'GLOBAL_UNDEFINED', - 'GMT', - 'INCR_CHAR', - 'LOCALE_INFINITY', - 'NAME', - 'NO_OLD_SAFARI_ARRAY_ITERATOR', - 'PLAIN_INTL', - 'REGEXP_STRING_ITERATOR', - 'V8_SRC', - ], - attributes: { 'char-increment-restriction': null }, - }, - NODE_13: - { - engine: 'Node.js 13 and Node.js 14', - includes: - [ - 'ARROW', - 'ESC_HTML_QUOT_ONLY', - 'ESC_REGEXP_LF', - 'ESC_REGEXP_SLASH', - 'FILL', - 'FLAT', - 'FROM_CODE_POINT', - 'FUNCTION_19_LF', - 'GENERIC_ARRAY_TO_STRING', - 'GLOBAL_UNDEFINED', - 'GMT', - 'INCR_CHAR', - 'LOCALE_INFINITY', - 'LOCALE_NUMERALS_EXT', - 'NAME', - 'NO_OLD_SAFARI_ARRAY_ITERATOR', - 'PLAIN_INTL', - 'REGEXP_STRING_ITERATOR', - 'SHORT_LOCALES', - 'V8_SRC', - ], - attributes: { 'char-increment-restriction': null }, - }, - NODE_15: - { - engine: 'Node.js 15', - includes: - [ - 'ARROW', - 'ESC_HTML_QUOT_ONLY', - 'ESC_REGEXP_LF', - 'ESC_REGEXP_SLASH', - 'FILL', - 'FLAT', - 'FROM_CODE_POINT', - 'FUNCTION_19_LF', - 'GENERIC_ARRAY_TO_STRING', - 'GLOBAL_UNDEFINED', - 'GMT', - 'INCR_CHAR', - 'INTL', - 'LOCALE_INFINITY', - 'LOCALE_NUMERALS_EXT', - 'NAME', - 'NO_OLD_SAFARI_ARRAY_ITERATOR', - 'REGEXP_STRING_ITERATOR', - 'SHORT_LOCALES', - 'V8_SRC', - ], - attributes: { 'char-increment-restriction': null }, - }, - NODE_16: - { - engine: 'Node.js 16 or later', - includes: - [ - 'ARROW', - 'ATOB', - 'ESC_HTML_QUOT_ONLY', - 'ESC_REGEXP_LF', - 'ESC_REGEXP_SLASH', - 'FILL', - 'FLAT', - 'FROM_CODE_POINT', - 'FUNCTION_19_LF', - 'GENERIC_ARRAY_TO_STRING', - 'GLOBAL_UNDEFINED', - 'GMT', - 'INCR_CHAR', - 'INTL', - 'LOCALE_INFINITY', - 'LOCALE_NUMERALS_EXT', - 'NAME', - 'NO_OLD_SAFARI_ARRAY_ITERATOR', - 'REGEXP_STRING_ITERATOR', - 'SHORT_LOCALES', - 'V8_SRC', - ], - attributes: { 'char-increment-restriction': null }, - }, - SAFARI_7_0: - { - engine: 'Safari 7.0', - includes: - [ - 'ATOB', - 'BARPROP', - 'CONSOLE', - 'ESC_HTML_QUOT_ONLY', - 'ESC_REGEXP_LF', - 'ESC_REGEXP_SLASH', - 'FF_SRC', - 'GENERIC_ARRAY_TO_STRING', - 'GLOBAL_UNDEFINED', - 'GMT', - 'HISTORY', - 'HTMLDOCUMENT', - 'INCR_CHAR', - 'LOCATION', - 'NAME', - 'NODECONSTRUCTOR', - 'STATUS', - 'WINDOW', - ], - attributes: - { - 'char-increment-restriction': null, - 'no-atob-in-web-worker': null, - 'no-console-in-web-worker': null, - 'web-worker-restriction': null, - }, - }, - SAFARI_7_1: - { - engine: 'Safari 7.1 and Safari 8', - includes: - [ - 'ARRAY_ITERATOR', - 'ATOB', - 'BARPROP', - 'CONSOLE', - 'ESC_HTML_QUOT_ONLY', - 'ESC_REGEXP_LF', - 'ESC_REGEXP_SLASH', - 'FF_SRC', - 'FILL', - 'GENERIC_ARRAY_TO_STRING', - 'GLOBAL_UNDEFINED', - 'GMT', - 'HISTORY', - 'HTMLDOCUMENT', - 'INCR_CHAR', - 'LOCATION', - 'NAME', - 'NODECONSTRUCTOR', - 'STATUS', - 'WINDOW', - ], - attributes: - { - 'char-increment-restriction': null, - 'no-atob-in-web-worker': null, - 'safari-bug-21820506': null, - 'web-worker-restriction': null, - }, - }, - SAFARI_8: { aliasFor: 'SAFARI_7_1' }, - SAFARI_9: - { - engine: 'Safari 9', - includes: - [ - 'ATOB', - 'BARPROP', - 'CONSOLE', - 'ESC_HTML_QUOT_ONLY', - 'ESC_REGEXP_LF', - 'ESC_REGEXP_SLASH', - 'FF_SRC', - 'FILL', - 'FROM_CODE_POINT', - 'FUNCTION_22_LF', - 'GENERIC_ARRAY_TO_STRING', - 'GLOBAL_UNDEFINED', - 'GMT', - 'HISTORY', - 'HTMLDOCUMENT', - 'INCR_CHAR', - 'LOCATION', - 'NAME', - 'NODECONSTRUCTOR', - 'NO_OLD_SAFARI_ARRAY_ITERATOR', - 'STATUS', - 'WINDOW', - ], - attributes: - { - 'char-increment-restriction': null, - 'no-atob-in-web-worker': null, - 'safari-bug-21820506': null, - 'web-worker-restriction': null, - }, - }, - SAFARI_10: - { - engine: 'Safari 10 and Safari 11', - includes: - [ - 'ARROW', - 'ATOB', - 'BARPROP', - 'CONSOLE', - 'ESC_HTML_QUOT_ONLY', - 'ESC_REGEXP_LF', - 'ESC_REGEXP_SLASH', - 'FF_SRC', - 'FILL', - 'FROM_CODE_POINT', - 'FUNCTION_22_LF', - 'GENERIC_ARRAY_TO_STRING', - 'GLOBAL_UNDEFINED', - 'GMT', - 'HISTORY', - 'HTMLDOCUMENT', - 'INCR_CHAR', - 'LOCALE_INFINITY', - 'LOCALE_NUMERALS_EXT', - 'LOCATION', - 'NAME', - 'NO_OLD_SAFARI_ARRAY_ITERATOR', - 'PLAIN_INTL', - 'SHORT_LOCALES', - 'STATUS', - 'WINDOW', - ], - attributes: { 'char-increment-restriction': null, 'web-worker-restriction': null }, - }, - SAFARI_12: - { - engine: 'Safari 12', - includes: - [ - 'ARROW', - 'ATOB', - 'BARPROP', - 'CONSOLE', - 'ESC_HTML_QUOT_ONLY', - 'ESC_REGEXP_LF', - 'ESC_REGEXP_SLASH', - 'FF_SRC', - 'FILL', - 'FLAT', - 'FROM_CODE_POINT', - 'FUNCTION_22_LF', - 'GENERIC_ARRAY_TO_STRING', - 'GLOBAL_UNDEFINED', - 'GMT', - 'HISTORY', - 'HTMLDOCUMENT', - 'INCR_CHAR', - 'LOCALE_INFINITY', - 'LOCALE_NUMERALS_EXT', - 'LOCATION', - 'NAME', - 'NO_OLD_SAFARI_ARRAY_ITERATOR', - 'PLAIN_INTL', - 'SHORT_LOCALES', - 'STATUS', - 'WINDOW', - ], - attributes: { 'char-increment-restriction': null, 'web-worker-restriction': null }, - }, - SAFARI_13: - { - engine: 'Safari 13 and Safari 14.0.0', - includes: - [ - 'ARROW', - 'ATOB', - 'BARPROP', - 'CONSOLE', - 'ESC_HTML_QUOT_ONLY', - 'ESC_REGEXP_LF', - 'ESC_REGEXP_SLASH', - 'FF_SRC', - 'FILL', - 'FLAT', - 'FROM_CODE_POINT', - 'FUNCTION_22_LF', - 'GENERIC_ARRAY_TO_STRING', - 'GLOBAL_UNDEFINED', - 'GMT', - 'HISTORY', - 'HTMLDOCUMENT', - 'INCR_CHAR', - 'LOCALE_INFINITY', - 'LOCALE_NUMERALS_EXT', - 'LOCATION', - 'NAME', - 'NO_OLD_SAFARI_ARRAY_ITERATOR', - 'PLAIN_INTL', - 'REGEXP_STRING_ITERATOR', - 'SHORT_LOCALES', - 'STATUS', - 'WINDOW', - ], - attributes: { 'char-increment-restriction': null, 'web-worker-restriction': null }, - }, - SAFARI_14_0_1: - { - engine: 'Safari 14.0.1 to 14.0.3', - includes: - [ - 'ARROW', - 'ATOB', - 'BARPROP', - 'CONSOLE', - 'ESC_HTML_QUOT_ONLY', - 'ESC_REGEXP_LF', - 'ESC_REGEXP_SLASH', - 'FF_SRC', - 'FILL', - 'FLAT', - 'FROM_CODE_POINT', - 'FUNCTION_22_LF', - 'GENERIC_ARRAY_TO_STRING', - 'GLOBAL_UNDEFINED', - 'GMT', - 'HISTORY', - 'HTMLDOCUMENT', - 'INCR_CHAR', - 'INTL', - 'LOCALE_INFINITY', - 'LOCALE_NUMERALS_EXT', - 'LOCATION', - 'NAME', - 'NO_OLD_SAFARI_ARRAY_ITERATOR', - 'REGEXP_STRING_ITERATOR', - 'SHORT_LOCALES', - 'STATUS', - 'WINDOW', - ], - attributes: { 'char-increment-restriction': null, 'web-worker-restriction': null }, - }, - SAFARI: - { - engine: 'the current stable version of Safari', - aliasFor: 'SAFARI_14_1', - }, - SAFARI_14_1: - { - engine: 'Safari 14.1 or later', - includes: - [ - 'ARROW', - 'ATOB', - 'BARPROP', - 'ESC_HTML_QUOT_ONLY', - 'ESC_REGEXP_LF', - 'ESC_REGEXP_SLASH', - 'FF_SRC', - 'FILL', - 'FLAT', - 'FROM_CODE_POINT', - 'FUNCTION_22_LF', - 'GENERIC_ARRAY_TO_STRING', - 'GLOBAL_UNDEFINED', - 'GMT', - 'HISTORY', - 'HTMLDOCUMENT', - 'INCR_CHAR', - 'INTL', - 'LOCALE_INFINITY', - 'LOCALE_NUMERALS_EXT', - 'LOCATION', - 'NAME', - 'NO_OLD_SAFARI_ARRAY_ITERATOR', - 'REGEXP_STRING_ITERATOR', - 'SHORT_LOCALES', - 'STATUS', - 'WINDOW', - ], - attributes: { 'char-increment-restriction': null, 'web-worker-restriction': null }, - }, - } - ); - - function callWithFeatures() - { - var args = arguments; - var featureArgsIndex = args.length - 2; - var featureArgs = args[featureArgsIndex]; - var featureStartIndex = args[featureArgsIndex + 1]; - var defineFnArgs = sliceArgs(args, 0, featureArgsIndex); - var features = sliceArgs(featureArgs, featureStartIndex); - _Array_prototype_push_apply(defineFnArgs, features); - var entry = this.apply(null, defineFnArgs); - return entry; - } - - function createDefinitionEntry(definition, mask) - { - var entry = { definition: definition, mask: mask }; - return entry; - } - - function define(definition) - { - var features = sliceArgs(arguments, 1); - var mask = featuresToMask(features); - var entry = createDefinitionEntry(definition, mask); - return entry; - } - - function defineList(availableEntries, indexEntries) - { - var effectiveEntries = - indexEntries.map - ( - function (indexEntry) - { - var availableEntry = availableEntries[indexEntry.definition]; - var definition = availableEntry.definition; - var mask = maskUnion(indexEntry.mask, availableEntry.mask); - var effectiveEntry = createDefinitionEntry(definition, mask); - return effectiveEntry; - } - ); - effectiveEntries.available = availableEntries; - return effectiveEntries; - } - - function makeCallableWithFeatures(fn) - { - fn._callWithFeatures = callWithFeatures; - } - - function sliceArgs(args, startIndex, endIndex) - { - var array = _Array_prototype_slice_call(args, startIndex, endIndex); - return array; - } - - makeCallableWithFeatures(define); - - function codePointFromSurrogatePair(highSurrogateCharCode, lowSurrogateCharCode) - { - // 0x2400 = 0x10000 - 0xdc00 - var codePoint = (highSurrogateCharCode - 0xd800 << 10) + lowSurrogateCharCode + 0x2400; - return codePoint; - } - - function extraZeros(count) - { - var extraZeros = _Array(count + 1).join('0'); - return extraZeros; - } - - function initStaticEncoder(encoder) - { - staticEncoder = encoder; - } - - function replaceStaticExpr(expr) - { - var solution = staticEncoder.replaceExpr(expr); - return solution; - } - - function replaceStaticString(str, options) - { - var replacement = staticEncoder.replaceString(str, options); - return replacement; - } - - function shortestOf() - { - var shortestObj; - var shortestLength = Infinity; - _Array_prototype_forEach_call - ( - arguments, - function (obj) - { - var length = obj.length; - if (length < shortestLength) - { - shortestObj = obj; - shortestLength = length; - } - } - ); - return shortestObj; - } - - var staticEncoder; - - // novem 2.0.1 – https://github.com/fasttime/JScrewIt/tree/master/packages/novem - - var INVALID_EXPR = {}; - function evalExpr$1(expr) { - var value = tryEvalExpr(expr); - if (value === INVALID_EXPR) - throw SyntaxError("Invalid expression " + expr); - return value; - } - function tryEvalExpr(expr) { - var fn; - try { - fn = Function("return(" + expr + ");"); - } - catch (_a) { - return INVALID_EXPR; - } - var value = fn(); - return value; - } - - var SolutionType; - (function (SolutionType) { - SolutionType[SolutionType["UNDEFINED"] = 1] = "UNDEFINED"; - SolutionType[SolutionType["ALGEBRAIC"] = 2] = "ALGEBRAIC"; - SolutionType[SolutionType["WEAK_ALGEBRAIC"] = 4] = "WEAK_ALGEBRAIC"; - SolutionType[SolutionType["OBJECT"] = 8] = "OBJECT"; - SolutionType[SolutionType["STRING"] = 16] = "STRING"; - SolutionType[SolutionType["PREFIXED_STRING"] = 32] = "PREFIXED_STRING"; - SolutionType[SolutionType["WEAK_PREFIXED_STRING"] = 64] = "WEAK_PREFIXED_STRING"; - SolutionType[SolutionType["COMBINED_STRING"] = 128] = "COMBINED_STRING"; - })(SolutionType || (SolutionType = {})); - Object.freeze(SolutionType); - var calculateSolutionType = function (replacement) { - var value = evalExpr$1(replacement); - if (value === undefined || value === null) - return SolutionType.UNDEFINED; - switch (typeof value) { - case 'boolean': - return SolutionType.ALGEBRAIC; - case 'number': - { - var type = isWeak$1(replacement, value) ? SolutionType.WEAK_ALGEBRAIC : SolutionType.ALGEBRAIC; - return type; - } - case 'object': - case 'function': - return SolutionType.OBJECT; - case 'string': - { - var type = isCombined(replacement, value) ? - isPrefixed(replacement, value) ? - isWeak$1(replacement, value) ? - SolutionType.WEAK_PREFIXED_STRING : - SolutionType.PREFIXED_STRING : - SolutionType.COMBINED_STRING : - SolutionType.STRING; - return type; - } - } - }; - var isCombined = function (replacement, value) { return !value !== tryEvalExpr("!" + replacement); }; - var isPrefixed = function (replacement, value) { return "0" + value !== tryEvalExpr("0+" + replacement); }; - var isWeak$1 = function (replacement, value) { return "" + value !== tryEvalExpr("\"\"+" + replacement); }; - - function createTypeSet() { - var types = []; - for (var _i = 0; _i < arguments.length; _i++) { - types[_i] = arguments[_i]; - } - var typeSet = 0; - for (var _a = 0, types_1 = types; _a < types_1.length; _a++) { - var type = types_1[_a]; - typeSet |= type; - } - return typeSet; - } - var includesType = function (typeSet, type) { return (typeSet & type) !== 0; }; - var isLoose = makeIsAttr(SolutionType.WEAK_ALGEBRAIC, SolutionType.PREFIXED_STRING, SolutionType.WEAK_PREFIXED_STRING, SolutionType.COMBINED_STRING); - var isString = makeIsAttr(SolutionType.STRING, SolutionType.PREFIXED_STRING, SolutionType.WEAK_PREFIXED_STRING, SolutionType.COMBINED_STRING); - var isWeak = makeIsAttr(SolutionType.WEAK_ALGEBRAIC, SolutionType.WEAK_PREFIXED_STRING); - function makeIsAttr() { - var types = []; - for (var _i = 0; _i < arguments.length; _i++) { - types[_i] = arguments[_i]; - } - var typeSet = createTypeSet.apply(void 0, types); - var is = function (type) { return includesType(typeSet, type); }; - return is; - } - - var RULES = [ - // UNDEFINED - { - typeSetList: [ - createTypeSet(SolutionType.UNDEFINED), - createTypeSet(SolutionType.UNDEFINED), - createTypeSet(SolutionType.WEAK_ALGEBRAIC), - ], - replace: function (r1, r2, r3) { return r1 + "+(" + r2 + "+[" + r3 + "])"; }, - solutionType: SolutionType.PREFIXED_STRING, - }, - { - typeSetList: [ - createTypeSet(SolutionType.UNDEFINED), - createTypeSet(SolutionType.UNDEFINED), - createTypeSet(SolutionType.WEAK_PREFIXED_STRING), - ], - replace: function (r1, r2, r3) { return r1 + "+(" + r2 + "+(" + r3 + "))"; }, - solutionType: SolutionType.PREFIXED_STRING, - }, - { - typeSetList: [ - createTypeSet(SolutionType.UNDEFINED), - createTypeSet(SolutionType.UNDEFINED), - createTypeSet(SolutionType.OBJECT, SolutionType.STRING, SolutionType.COMBINED_STRING), - ], - replace: function (r1, r2, r3) { return r1 + "+(" + r2 + "+" + r3 + ")"; }, - solutionType: SolutionType.PREFIXED_STRING, - }, - { - typeSetList: [ - createTypeSet(SolutionType.UNDEFINED), - createTypeSet(SolutionType.UNDEFINED), - ], - replace: function (r1, r2) { return "[]+" + r1 + "+" + r2; }, - solutionType: SolutionType.COMBINED_STRING, - }, - { - typeSetList: [ - createTypeSet(SolutionType.UNDEFINED), - createTypeSet(SolutionType.ALGEBRAIC, SolutionType.WEAK_ALGEBRAIC), - ], - replace: function (r1, r2) { return r1 + "+[" + r2 + "]"; }, - solutionType: SolutionType.PREFIXED_STRING, - }, - { - typeSetList: [ - createTypeSet(SolutionType.UNDEFINED), - createTypeSet(SolutionType.PREFIXED_STRING), - ], - replace: function (r1, r2) { return r1 + "+(" + r2 + ")"; }, - solutionType: SolutionType.PREFIXED_STRING, - }, - { - typeSetList: [createTypeSet(SolutionType.UNDEFINED)], - replace: function (r1) { return r1; }, - solutionType: SolutionType.PREFIXED_STRING, - }, - // ALGEBRAIC, PREFIXED_STRING - { - typeSetList: [ - createTypeSet(SolutionType.ALGEBRAIC), - createTypeSet(SolutionType.UNDEFINED, SolutionType.ALGEBRAIC, SolutionType.PREFIXED_STRING), - ], - replace: function (r1, r2) { return "[" + r1 + "]+" + r2; }, - solutionType: SolutionType.COMBINED_STRING, - }, - { - typeSetList: [ - createTypeSet(SolutionType.ALGEBRAIC), - createTypeSet(SolutionType.WEAK_ALGEBRAIC), - ], - replace: function (r1, r2) { return r1 + "+[" + r2 + "]"; }, - solutionType: SolutionType.PREFIXED_STRING, - }, - { - typeSetList: [createTypeSet(SolutionType.ALGEBRAIC, SolutionType.PREFIXED_STRING)], - replace: function (r1) { return r1; }, - solutionType: SolutionType.PREFIXED_STRING, - }, - // WEAK_ALGEBRAIC, WEAK_PREFIXED_STRING - { - typeSetList: [ - createTypeSet(SolutionType.WEAK_ALGEBRAIC), - createTypeSet(SolutionType.UNDEFINED, SolutionType.ALGEBRAIC, SolutionType.PREFIXED_STRING), - ], - replace: function (r1, r2) { return "[" + r1 + "]+" + r2; }, - solutionType: SolutionType.COMBINED_STRING, - }, - { - typeSetList: [ - createTypeSet(SolutionType.WEAK_ALGEBRAIC), - createTypeSet(SolutionType.WEAK_ALGEBRAIC), - ], - replace: function (r1, r2) { return r1 + "+[" + r2 + "]"; }, - solutionType: SolutionType.WEAK_PREFIXED_STRING, - }, - { - typeSetList: [createTypeSet(SolutionType.WEAK_ALGEBRAIC, SolutionType.WEAK_PREFIXED_STRING)], - replace: function (r1) { return r1; }, - solutionType: SolutionType.WEAK_PREFIXED_STRING, - }, - // OBJECT, STRING, COMBINED_STRING - { - typeSetList: [createTypeSet(SolutionType.OBJECT, SolutionType.STRING, SolutionType.COMBINED_STRING)], - replace: function (r1) { return r1; }, - solutionType: SolutionType.COMBINED_STRING, - }, - ]; - function findRule(solutions) { - for (var _i = 0, RULES_1 = RULES; _i < RULES_1.length; _i++) { - var rule = RULES_1[_i]; - if (matchSolutions(rule.typeSetList, solutions)) - return rule; - } - } - function matchSolutions(typeSets, solutions) { - if (typeSets.length > solutions.length) - return false; - var test = typeSets.every(function (typeSet, index) { - var type = solutions[index].type; - var test = includesType(typeSet, type); - return test; - }); - return test; - } - - var AbstractSolution = /** @class */ (function () { - function AbstractSolution() { - } - Object.defineProperty(AbstractSolution.prototype, "isLoose", { - get: function () { - return isLoose(this.type); - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(AbstractSolution.prototype, "isString", { - get: function () { - return isString(this.type); - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(AbstractSolution.prototype, "isWeak", { - get: function () { - return isWeak(this.type); - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(AbstractSolution.prototype, "length", { - get: function () { - return this.replacement.length; - }, - enumerable: false, - configurable: true - }); - return AbstractSolution; - }()); - var DynamicSolution = /** @class */ (function (_super) { - __extends(DynamicSolution, _super); - function DynamicSolution() { - var _this = _super !== null && _super.apply(this, arguments) || this; - _this._solutions = []; - return _this; - } - DynamicSolution.prototype.append = function (solution) { - this._replacement = undefined; - this._solutions.push(solution); - }; - DynamicSolution.prototype.prepend = function (solution) { - this._replacement = undefined; - this._solutions.unshift(solution); - }; - Object.defineProperty(DynamicSolution.prototype, "replacement", { - get: function () { - var _a; - var replacement = (_a = this._replacement) !== null && _a !== void 0 ? _a : (this._replacement = calculateReplacement(this._solutions)); - return replacement; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(DynamicSolution.prototype, "source", { - get: function () { - var sources = []; - for (var _i = 0, _a = this._solutions; _i < _a.length; _i++) { - var source_1 = _a[_i].source; - if (source_1 === undefined) - return undefined; - sources.push(source_1); - } - var source = sources.join(''); - return source; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(DynamicSolution.prototype, "type", { - get: function () { - var solutions = this._solutions; - switch (solutions.length) { - case 0: - return EMPTY_SOLUTION.type; - case 1: - return solutions[0].type; - default: - { - var solutionType = findRule(solutions).solutionType; - return solutionType; - } - } - }, - enumerable: false, - configurable: true - }); - return DynamicSolution; - }(AbstractSolution)); - var LazySolution = /** @class */ (function (_super) { - __extends(LazySolution, _super); - function LazySolution(source, createReplacement, type) { - var _this = _super.call(this) || this; - _this.source = source; - _this.type = type; - var get = function () { - var replacement = createReplacement(); - this.defineReplacement({ value: replacement, writable: true }); - return replacement; - }; - _this.defineReplacement({ get: get }); - return _this; - } - LazySolution.prototype.defineReplacement = function (attributes) { - attributes.configurable = true; - attributes.enumerable = true; - Object.defineProperty(this, 'replacement', attributes); - }; - return LazySolution; - }(AbstractSolution)); - var SimpleSolution = /** @class */ (function (_super) { - __extends(SimpleSolution, _super); - function SimpleSolution(source, replacement, type) { - var _this = _super.call(this) || this; - _this.source = source; - _this.replacement = replacement; - _this.type = type; - return _this; - } - return SimpleSolution; - }(AbstractSolution)); - var EMPTY_SOLUTION = new SimpleSolution('', '[]', SolutionType.OBJECT); - function calculateReplacement(solutions) { - switch (solutions.length) { - case 0: - return EMPTY_SOLUTION.replacement; - case 1: - return solutions[0].replacement; - default: - { - var _a = findRule(solutions), replace = _a.replace, typeSetList = _a.typeSetList; - var typeSetCount = typeSetList.length; - var replacements = solutions.slice(typeSetCount).map(getAppendableReplacement); - var ruleReplacements = solutions.slice(0, typeSetCount).map(getReplacement); - var firstReplacement = replace.apply(void 0, ruleReplacements); - replacements.unshift(firstReplacement); - var replacement = replacements.join(''); - return replacement; - } - } - } - var getAppendableReplacement = function (_a) { - var replacement = _a.replacement, type = _a.type; - return isWeak(type) ? "+(" + replacement + ")" : "+" + replacement; - }; - var getReplacement = function (_a) { - var replacement = _a.replacement; - return replacement; - }; - - assignNoEnum - ( - AbstractSolution.prototype, - { - get appendLength() - { - var extraLength = this.isWeak ? 3 : 1; - var appendLength = this.length + extraLength; - return appendLength; - }, - set appendLength(appendLength) - { - _Object_defineProperty(this, 'appendLength', { enumerable: true, value: appendLength }); - }, - } - ); - - // As of version 2.1.0, definitions are interpreted using JScrewIt's own express parser, which can - - var AMENDINGS = ['true', 'undefined', 'NaN']; - - var JSFUCK_INFINITY = '1e1000'; - - var R_PADDINGS = - [ - 'RP_0_S', - 'RP_1_WA', - , - 'RP_3_WA', - 'RP_4_A', - 'RP_5_A', - 'RP_6_S', - ]; - - var SIMPLE = createEmpty(); - - var FROM_CHAR_CODE; - var FROM_CHAR_CODE_CALLBACK_FORMATTER; - var MAPPER_FORMATTER; - var OPTIMAL_ARG_NAME; - var OPTIMAL_B; - var OPTIMAL_RETURN_STRING; - - var BASE64_ALPHABET_HI_2; - var BASE64_ALPHABET_HI_4; - var BASE64_ALPHABET_HI_6; - var BASE64_ALPHABET_LO_2; - var BASE64_ALPHABET_LO_4; - var BASE64_ALPHABET_LO_6; - - var CHARACTERS; - var COMPLEX; - var CONSTANTS; - var NATIVE_FUNCTION_INFOS; - - var FB_PADDING_ENTRIES_MAP = createEmpty(); - var FH_PADDING_ENTRIES_MAP = createEmpty(); - - var FB_R_PADDING_SHIFTS; - var FH_R_PADDING_SHIFTS; - - function backslashDefinition() - { - var replacement = this._replaceCharByUnescape(0x5C); - var solution = new SimpleSolution(undefined, replacement, SolutionType.STRING); - return solution; - } - - function chooseOtherArgName(argName) - { - var otherArgName = argName !== 'undefined' ? 'undefined' : 'falsefalse'; - return otherArgName; - } - - function createCharAtFnPosDefinition(expr, index, paddingEntries) - { - function definitionFX(char) - { - var solution = - this._resolveCharInExpr(char, expr, index, paddingEntries, FH_R_PADDING_SHIFTS); - return solution; - } - - return definitionFX; - } - - function createCharInFBDefinition(offset) - { - function definitionFB(char) - { - var solution = - this._resolveCharInNativeFunction(char, offset, getFBPaddingEntries, FB_R_PADDING_SHIFTS); - return solution; - } - - return definitionFB; - } - - function createCharInFHDefinition(offset) - { - function definitionFH(char) - { - var solution = - this._resolveCharInNativeFunction(char, offset, getFHPaddingEntries, FH_R_PADDING_SHIFTS); - return solution; - } - - return definitionFH; - } - - function createLazySolution(source, expr, type) - { - var solution = - new LazySolution - ( - source, - function () - { - var replacement = replaceStaticExpr(expr); - return replacement; - }, - type - ); - return solution; - } - - function definePadding(block, shiftedIndex) - { - var padding = { block: block, shiftedIndex: shiftedIndex }; - var paddingEntry = define._callWithFeatures(padding, arguments, 2); - return paddingEntry; - } - - function getFBPaddingEntries(index) - { - var paddingEntries = FB_PADDING_ENTRIES_MAP[index]; - if (!paddingEntries) - { - var AT = Feature.AT; - var FF_SRC = Feature.FF_SRC; - var IE_SRC = Feature.IE_SRC; - var NO_FF_SRC = Feature.NO_FF_SRC; - var NO_IE_SRC = Feature.NO_IE_SRC; - var NO_V8_SRC = Feature.NO_V8_SRC; - var V8_SRC = Feature.V8_SRC; - - switch (index) - { - case 16: - paddingEntries = - [ - definePadding('FBEP_4_S', '2 + FH_SHIFT_1'), - definePadding('FBP_5_S', 21, NO_FF_SRC), - definePadding('FBEP_4_S', 20, NO_IE_SRC), - definePadding('RP_0_S', '2 + FH_SHIFT_1', NO_V8_SRC), - define(0, FF_SRC), - define(0, IE_SRC), - define(4, V8_SRC), - ]; - break; - case 18: - case 28: - paddingEntries = - [ - definePadding('RP_5_A + [FBP_7_WA]', index + 12), - definePadding('RP_4_A + [FBP_8_WA]', index + 12, AT), - definePadding('[RP_3_WA] + FBP_9_U', index + 12, NO_FF_SRC), - definePadding('[RP_3_WA] + FBEP_9_U', index + 12, NO_IE_SRC), - definePadding('FBEP_4_S', index + 4, Feature.INCR_CHAR, NO_IE_SRC), - definePadding('RP_0_S', (index + 2) / 10 + ' + FH_SHIFT_3', NO_V8_SRC), - define(0, FF_SRC), - define(0, IE_SRC), - define(3, V8_SRC), - ]; - break; - case 20: - case 30: - paddingEntries = - [ - definePadding('RP_3_WA + [FBP_7_WA]', index + 10), - definePadding('FBEP_10_S', (index + 10) / 10 + ' + FH_SHIFT_1', AT), - definePadding('[RP_1_WA] + FBP_9_U', index + 10, NO_FF_SRC), - definePadding('FBEP_10_S', index + 10, NO_IE_SRC), - definePadding('RP_6_S', (index + 10) / 10 + ' + FH_SHIFT_1', NO_V8_SRC), - define(6, FF_SRC), - define(5, IE_SRC), - define(0, V8_SRC), - ]; - break; - case 21: - paddingEntries = - [ - definePadding('FBEP_9_U', '3 + FH_SHIFT_1'), - definePadding('FBP_9_U', 30, NO_FF_SRC), - definePadding('FBEP_9_U', 30, NO_IE_SRC), - definePadding('RP_5_A', '3 + FH_SHIFT_1', NO_V8_SRC), - define(5, FF_SRC), - define(4, IE_SRC), - define(0, V8_SRC), - ]; - break; - case 23: - paddingEntries = - [ - definePadding('FBP_7_WA', 30), - definePadding('FBP_9_U', 32, NO_FF_SRC), - definePadding('FBEP_9_U', 32, NO_IE_SRC), - definePadding('RP_3_WA', '3 + FH_SHIFT_1', NO_V8_SRC), - define(3, FF_SRC), - define(3, IE_SRC), - define(0, V8_SRC), - ]; - break; - case 25: - paddingEntries = - [ - definePadding('FBP_7_WA', 32), - definePadding('FBP_5_S', 30, NO_FF_SRC), - definePadding('RP_1_WA + FBEP_4_S', 30, NO_IE_SRC), - definePadding('RP_1_WA', '3 + FH_SHIFT_1', NO_V8_SRC), - define(1, FF_SRC), - define(0, IE_SRC), - define(5, V8_SRC), - ]; - break; - case 32: - paddingEntries = - [ - definePadding('FBP_8_WA', 40), - definePadding('FBP_9_U', 41, NO_FF_SRC), - definePadding('FBEP_9_U', 41, NO_IE_SRC), - definePadding('RP_4_A', '4 + FH_SHIFT_1', NO_V8_SRC), - define(4, FF_SRC), - define(3, IE_SRC), - define(0, V8_SRC), - ]; - break; - case 34: - paddingEntries = - [ - definePadding('FBP_7_WA', 41), - definePadding('RP_1_WA + FBP_5_S', 40, NO_FF_SRC), - definePadding('FBEP_9_U', 43, NO_IE_SRC), - definePadding('RP_2_WS', '4 + FH_SHIFT_1', NO_V8_SRC), - define(3, FF_SRC), - define(1, IE_SRC), - define(6, V8_SRC), - ]; - break; - } - paddingEntries.cacheKey = 'FBP:' + index; - FB_PADDING_ENTRIES_MAP[index] = paddingEntries; - } - return paddingEntries; - } - - function getFHPaddingEntries(index) - { - var paddingEntries = FH_PADDING_ENTRIES_MAP[index]; - if (!paddingEntries) - { - var IE_SRC = Feature.IE_SRC; - var INCR_CHAR = Feature.INCR_CHAR; - var NO_IE_SRC = Feature.NO_IE_SRC; - - switch (index) - { - case 3: - case 13: - paddingEntries = - [ - definePadding('RP_4_A + [FHP_3_WA]', index + 7), - definePadding('FHP_8_S', index + 8, INCR_CHAR), - define(6, IE_SRC), - define(0, NO_IE_SRC), - ]; - break; - case 6: - case 16: - paddingEntries = - [ - definePadding('FHP_5_A', index + 5), - define(3, IE_SRC), - define(4, NO_IE_SRC), - ]; - break; - case 8: - case 18: - paddingEntries = - [ - definePadding('FHP_3_WA', index + 3), - definePadding('RP_2_WS', (index + 2) / 10 + ' + FH_SHIFT_1', INCR_CHAR), - define(1, IE_SRC), - define(3, NO_IE_SRC), - ]; - break; - case 9: - case 19: - paddingEntries = - [ - definePadding('RP_1_WA', (index + 1) / 10 + ' + FH_SHIFT_1'), - define(0, IE_SRC), - define(1, NO_IE_SRC), - ]; - break; - case 11: - paddingEntries = - [ - definePadding('RP_0_S', '1 + FH_SHIFT_2'), - define(0, IE_SRC), - define(0, NO_IE_SRC), - ]; - break; - case 12: - paddingEntries = - [ - definePadding('FHP_8_S', 20), - define(0, IE_SRC), - define(0, NO_IE_SRC), - ]; - break; - case 14: - paddingEntries = - [ - definePadding('[RP_1_WA] + FHP_5_A', 20), - define(5, IE_SRC), - define(6, NO_IE_SRC), - ]; - break; - case 15: - paddingEntries = - [ - definePadding('FHP_5_A', 20), - define(4, IE_SRC), - define(5, NO_IE_SRC), - ]; - break; - case 17: - paddingEntries = - [ - definePadding('FHP_3_WA', 20), - definePadding('RP_3_WA', 2 + ' + FH_SHIFT_1', INCR_CHAR), - define(3, IE_SRC), - define(3, NO_IE_SRC), - ]; - break; - } - paddingEntries.cacheKey = 'FHP:' + index; - FH_PADDING_ENTRIES_MAP[index] = paddingEntries; - } - return paddingEntries; - } - - (function () - { - var ANY_DOCUMENT = Feature.ANY_DOCUMENT; - var ANY_WINDOW = Feature.ANY_WINDOW; - var ARRAY_ITERATOR = Feature.ARRAY_ITERATOR; - var ARROW = Feature.ARROW; - var AT = Feature.AT; - var ATOB = Feature.ATOB; - var BARPROP = Feature.BARPROP; - var CAPITAL_HTML = Feature.CAPITAL_HTML; - var CONSOLE = Feature.CONSOLE; - var DOCUMENT = Feature.DOCUMENT; - var DOMWINDOW = Feature.DOMWINDOW; - var ESC_HTML_ALL = Feature.ESC_HTML_ALL; - var ESC_HTML_QUOT = Feature.ESC_HTML_QUOT; - var ESC_HTML_QUOT_ONLY = Feature.ESC_HTML_QUOT_ONLY; - var ESC_REGEXP_LF = Feature.ESC_REGEXP_LF; - var ESC_REGEXP_SLASH = Feature.ESC_REGEXP_SLASH; - var EXTERNAL = Feature.EXTERNAL; - var FF_SRC = Feature.FF_SRC; - var FILL = Feature.FILL; - var FLAT = Feature.FLAT; - var FROM_CODE_POINT = Feature.FROM_CODE_POINT; - var FUNCTION_19_LF = Feature.FUNCTION_19_LF; - var FUNCTION_22_LF = Feature.FUNCTION_22_LF; - var GENERIC_ARRAY_TO_STRING = Feature.GENERIC_ARRAY_TO_STRING; - var GLOBAL_UNDEFINED = Feature.GLOBAL_UNDEFINED; - var GMT = Feature.GMT; - var HISTORY = Feature.HISTORY; - var HTMLAUDIOELEMENT = Feature.HTMLAUDIOELEMENT; - var HTMLDOCUMENT = Feature.HTMLDOCUMENT; - var IE_SRC = Feature.IE_SRC; - var INCR_CHAR = Feature.INCR_CHAR; - var INTL = Feature.INTL; - var LOCALE_INFINITY = Feature.LOCALE_INFINITY; - var LOCALE_NUMERALS = Feature.LOCALE_NUMERALS; - var LOCALE_NUMERALS_EXT = Feature.LOCALE_NUMERALS_EXT; - var LOCATION = Feature.LOCATION; - var NAME = Feature.NAME; - var NODECONSTRUCTOR = Feature.NODECONSTRUCTOR; - var NO_FF_SRC = Feature.NO_FF_SRC; - var NO_IE_SRC = Feature.NO_IE_SRC; - var NO_OLD_SAFARI_ARRAY_ITERATOR = Feature.NO_OLD_SAFARI_ARRAY_ITERATOR; - var NO_V8_SRC = Feature.NO_V8_SRC; - var OBJECT_UNDEFINED = Feature.OBJECT_UNDEFINED; - var PLAIN_INTL = Feature.PLAIN_INTL; - var REGEXP_STRING_ITERATOR = Feature.REGEXP_STRING_ITERATOR; - var SELF_OBJ = Feature.SELF_OBJ; - var SHORT_LOCALES = Feature.SHORT_LOCALES; - var STATUS = Feature.STATUS; - var UNDEFINED = Feature.UNDEFINED; - var V8_SRC = Feature.V8_SRC; - var WINDOW = Feature.WINDOW; - - function createCharDefaultDefinition - (atobOpt, charCodeOpt, escSeqOpt, unescapeOpt) - { - function charDefaultDefinition(char) - { - var charCode = char.charCodeAt(); - var solution = - this._createCharDefaultSolution - (char, charCode, atobOpt && charCode < 0x100, charCodeOpt, escSeqOpt, unescapeOpt); - return solution; - } - - return charDefaultDefinition; - } - - function defineCharAtFnPos(expr, index) - { - var paddingEntries = getFHPaddingEntries(index); - var definition = createCharAtFnPosDefinition(expr, index, paddingEntries); - var entry = define._callWithFeatures(definition, arguments, 2); - return entry; - } - - function defineCharDefault(opts) - { - function checkOpt(optName) - { - var opt = !(opts && optName in opts) || opts[optName]; - return opt; - } - - var atobOpt = checkOpt('atob'); - var charCodeOpt = checkOpt('charCode'); - var escSeqOpt = checkOpt('escSeq'); - var unescapeOpt = checkOpt('unescape'); - var definition = createCharDefaultDefinition(atobOpt, charCodeOpt, escSeqOpt, unescapeOpt); - var entry = define(definition); - return entry; - } - - function defineCharInFB(offset) - { - var definition = createCharInFBDefinition(offset); - var entry = define(definition); - return entry; - } - - function defineCharInFH(offset) - { - var definition = createCharInFHDefinition(offset); - var entry = define._callWithFeatures(definition, arguments, 1); - return entry; - } - - function defineLocalizedNumeral(locale, number, index) - { - var expr = '(' + number + ')[TO_LOCALE_STRING](' + locale + ')'; - if (index != null) - expr += '[' + index + ']'; - var entry = define._callWithFeatures(expr, LOCALE_NUMERALS, arguments, 3); - return entry; - } - - function defineSimple(simple, expr, type) - { - SIMPLE[simple] = createLazySolution(simple, expr, type); - } - - function replaceDigit(digit) - { - switch (digit) - { - case 0: - return '+[]'; - case 1: - return '+!![]'; - default: - var replacement = '!![]'; - do - replacement += '+!![]'; - while (--digit > 1); - return replacement; - } - } - - function useLocaleNumeralDefinition(char, locale, number, index) - { - CHARACTERS[char] = - [ - defineLocalizedNumeral._callWithFeatures(locale, number, index, arguments, 4), - defineCharDefault(), - ]; - } - - function useLocaleNumeralDigitDefinitions(locale, zeroCharCode) - { - var fromCharCode = _String.fromCharCode; - for (var digit = 0; digit <= 9; ++digit) - { - var char = fromCharCode(zeroCharCode + digit); - useLocaleNumeralDefinition - ._callWithFeatures(char, locale, digit, undefined, arguments, 2); - } - } - - BASE64_ALPHABET_HI_2 = ['NaN', 'false', 'undefined', '0']; - - BASE64_ALPHABET_HI_4 = - [ - [define('A'), define('C', CAPITAL_HTML), define('A', ARRAY_ITERATOR)], - 'F', - 'Infinity', - 'NaNfalse', - [define('S'), define('R', CAPITAL_HTML), define('S', ARRAY_ITERATOR)], - [define('W'), define('U', CAPITAL_HTML)], - 'a', - 'false', - 'i', - 'n', - 'r', - 'true', - 'y', - '0', - '4', - '8', - ]; - - BASE64_ALPHABET_HI_6 = - [ - 'A', - 'B', - 'C', - 'D', - 'E', - 'F', - 'G', - 'H', - 'Infinity', - 'J', - 'K', - 'L', - 'M', - 'NaN', - 'O', - 'P', - 'Q', - 'R', - 'S', - 'T', - 'U', - 'V', - 'W', - 'X', - 'Y', - 'Z', - 'a', - 'b', - 'c', - 'd', - 'e', - 'false', - 'g', - 'h', - 'i', - 'j', - 'k', - 'l', - 'm', - 'n', - 'o', - 'p', - 'q', - 'r', - 's', - 'true', - 'undefined', - 'v', - 'w', - 'x', - 'y', - 'z', - '0', - '1', - '2', - '3', - '4', - '5', - '6', - '7', - '8', - '9', - '+', - '/', - ]; - - BASE64_ALPHABET_LO_2 = ['000', 'NaN', 'falsefalsefalse', '00f']; - - BASE64_ALPHABET_LO_4 = - [ - '0A', - [define('0B'), define('0R', CAPITAL_HTML), define('0B', ARRAY_ITERATOR)], - '0i', - [define('0j'), define('0T', CAPITAL_HTML), define('0j', ARRAY_ITERATOR)], - '00', - '01', - '02', - '03', - '04', - '05', - '0a', - '0r', - '0s', - '0t', - 'undefinedfalse', - '0f', - ]; - - BASE64_ALPHABET_LO_6 = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'; - - CHARACTERS = - noProto - ({ - '\t': - [ - define('Function("return\\"" + ESCAPING_BACKSLASH + "true\\"")()[0]'), - defineCharDefault({ escSeq: false }), - ], - '\n': - [ - define('(RP_0_S + Function())[23]'), - define('(RP_1_WA + Function())[20]', FUNCTION_19_LF), - define('(RP_0_S + Function())[22]', FUNCTION_22_LF), - define('(RP_0_S + ANY_FUNCTION)[0]', IE_SRC), - defineCharInFH(13, NO_V8_SRC), - ], - - '\f': - [ - define('Function("return\\"" + ESCAPING_BACKSLASH + "false\\"")()[0]'), - defineCharDefault({ escSeq: false }), - ], - '\r': - [ - define('Function("return\\"" + ESCAPING_BACKSLASH + "r\\"")()'), - defineCharDefault({ escSeq: false }), - ], - - '\x1e': - [ - define('(RP_5_A + atob("NaNfalse"))[10]', ATOB), - ], - - ' ': - [ - defineCharAtFnPos('ANY_FUNCTION', 8), - define('(RP_3_WA + ARRAY_ITERATOR)[10]', ARRAY_ITERATOR), - define('(RP_0_S + FILTER)[20]', FF_SRC), - define('(+(RP_0_S + FILTER)[0] + FILTER)[22]', NO_FF_SRC), - define('(RP_0_S + FILTER)[21]', NO_V8_SRC), - define('(RP_1_WA + FILTER)[20]', V8_SRC), - define('(RP_1_WA + AT)[20]', AT, NO_V8_SRC), - define('(RP_5_A + AT)[20]', AT, V8_SRC), - define('(+(RP_0_S + FILL)[0] + FILL)[20]', FILL, NO_FF_SRC), - define('(RP_5_A + FILL)[20]', FILL, NO_IE_SRC), - define('(RP_0_S + FILL)[20]', FILL, NO_V8_SRC), - define('(+(RP_0_S + FLAT)[0] + FLAT)[20]', FLAT, NO_FF_SRC), - define('(RP_5_A + FLAT)[20]', FLAT, NO_IE_SRC), - define('(RP_0_S + FLAT)[20]', FLAT, NO_V8_SRC), - ], - // '!': , - '"': - [ - define('"".fontcolor()[12]'), - ], - '#': - [ - define('document.nodeName[0]', ANY_DOCUMENT), - defineCharDefault(), - ], - // '$': , - '%': - [ - define('escape(FILTER)[20]'), - define('escape(0 + AT)[20]', AT), - define('atob("000l")[2]', ATOB), - define('escape(FILL)[21]', FILL), - define('escape(FLAT)[21]', FLAT), - define('escape(ANY_FUNCTION)[0]', IE_SRC), - ], - '&': - [ - define('"".fontcolor("".italics())[22]', ESC_HTML_ALL), - define('"".fontcolor("".sub())[20]', ESC_HTML_ALL), - define('"".fontcolor("\\"")[13]', ESC_HTML_QUOT), - define('"".fontcolor("".fontcolor([]))[31]', ESC_HTML_QUOT_ONLY), - defineCharDefault(), - ], - // '\'': , - '(': - [ - defineCharInFH(9), - ], - ')': - [ - defineCharInFH(10), - ], - // '*': , - '+': '(1e100 + [])[2]', - ',': - [ - define('(RP_0_S + F_A_L_S_E)[1]'), - define({ expr: '[[]].concat([[]])', solutionType: SolutionType.OBJECT }), - ], - '-': '(.0000001 + [])[2]', - '.': '(11e20 + [])[1]', - '/': - [ - define('"0false".italics()[10]'), - define('"true".sub()[10]'), - ], - // '0'…'9': - ':': - [ - define('(RP_0_S + RegExp())[3]'), - defineCharDefault(), - ], - ';': - [ - define('"".fontcolor("".italics())[21]', ESC_HTML_ALL), - define('"".fontcolor(true + "".sub())[20]', ESC_HTML_ALL), - define('"".fontcolor("NaN\\"")[21]', ESC_HTML_QUOT), - define('"".fontcolor("".fontcolor())[30]', ESC_HTML_QUOT_ONLY), - defineCharDefault(), - ], - '<': - [ - define('"".italics()[0]'), - define('"".sub()[0]'), - ], - '=': - [ - define('"".fontcolor()[11]'), - ], - '>': - [ - define('"".italics()[2]'), - define('"".sub()[10]'), - ], - '?': - [ - define('(RP_0_S + RegExp())[2]'), - defineCharDefault(), - ], - // '@': , - 'A': - [ - defineCharAtFnPos('Array', 9), - define('(RP_3_WA + ARRAY_ITERATOR)[11]', ARRAY_ITERATOR), - ], - 'B': - [ - defineCharAtFnPos('Boolean', 9), - define('"0".sub()[10]', CAPITAL_HTML), - ], - 'C': - [ - define('escape("".italics())[2]'), - define('escape("".sub())[2]'), - define('escape(F_A_L_S_E)[11]'), - define('atob("00NaNfalse")[1]', ATOB), - define('(RP_4_A + "".fontcolor())[10]', CAPITAL_HTML), - define('(RP_3_WA + Function("return console")())[11]', CONSOLE), - define('(RP_0_S + Node)[12]', NODECONSTRUCTOR), - ], - 'D': - [ - // • The escaped character may be either "]" or "}". - define('escape((+("1000" + (RP_5_A + FILTER + 0)[40] + 0) + FILTER)[40])[2]'), // * - define('escape("]")[2]'), - define('escape("}")[2]'), - define('(document + RP_0_S)[SLICE_OR_SUBSTR]("-10")[1]', ANY_DOCUMENT), - define('escape((RP_4_A + [+("1000" + (AT + 0)[31] + 0)] + AT)[40])[2]', AT), // * - define('btoa("00")[1]', ATOB), - define('(RP_3_WA + document)[11]', DOCUMENT), - define // * - ('escape((NaN + [+("10" + [(RP_6_S + FILL)[40]] + "000")] + FILL)[40])[2]', FILL), - define // * - ('escape((NaN + [+("10" + [(RP_6_S + FLAT)[40]] + "000")] + FLAT)[40])[2]', FLAT), - define('(RP_0_S + document)[12]', HTMLDOCUMENT), - define('escape(ARRAY_ITERATOR)[30]', NO_OLD_SAFARI_ARRAY_ITERATOR), - define('escape(FILTER)[50]', V8_SRC), - define('(document + [RP_1_WA]).at("-10")', ANY_DOCUMENT, AT), - define('escape(AT)[61]', AT, IE_SRC), - define('escape([[]][+(RP_0_S + AT)[0]] + AT)[61]', AT, NO_FF_SRC), // * - define('escape([NaN][+(RP_1_WA + AT)[20]] + AT)[61]', AT, NO_IE_SRC), // * - define('escape(true + AT)[50]', AT, V8_SRC), - define('escape(FILL)[60]', FF_SRC, FILL), - define('escape(FLAT)[60]', FF_SRC, FLAT), - ], - 'E': - [ - defineCharAtFnPos('RegExp', 12), - define('btoa("0NaN")[1]', ATOB), - define('(RP_5_A + "".link())[10]', CAPITAL_HTML), - define('(RP_3_WA + sidebar)[11]', EXTERNAL), - define('(RP_3_WA + Audio)[21]', HTMLAUDIOELEMENT), - define('(RP_0_S + REGEXP_STRING_ITERATOR)[11]', REGEXP_STRING_ITERATOR), - ], - 'F': - [ - defineCharAtFnPos('Function', 9), - define('"".fontcolor()[1]', CAPITAL_HTML), - ], - 'G': - [ - define('btoa("0false")[1]', ATOB), - define('"0".big()[10]', CAPITAL_HTML), - define('(RP_5_A + Date())[30]', GMT), - ], - 'H': - [ - define('btoa(true)[1]', ATOB), - define('"".link()[3]', CAPITAL_HTML), - define - ({ expr: '(RP_3_WA + Function("return history")())[11]', optimize: true }, HISTORY), - define('(RP_1_WA + Audio)[10]', HTMLAUDIOELEMENT), - define('(RP_3_WA + document)[11]', HTMLDOCUMENT), - ], - 'I': '"Infinity"[0]', - 'J': - [ - define('"j"[TO_UPPER_CASE]()'), - define('btoa(true)[2]', ATOB), - defineCharDefault({ atob: false }), - ], - 'K': - [ - define('(RP_5_A + "".strike())[10]', CAPITAL_HTML), - defineCharDefault(), - ], - 'L': - [ - define('btoa(".")[0]', ATOB), - define('(RP_3_WA + "".fontcolor())[11]', CAPITAL_HTML), - define('(RP_0_S + Audio)[12]', HTMLAUDIOELEMENT), - define('(RP_0_S + document)[11]', HTMLDOCUMENT), - define - ( - { - expr: 'Function("return toString.call(location)")()[SLICE_OR_SUBSTR]("-10")[1]', - optimize: true, - }, - LOCATION - ), - define - ( - { - expr: '(Function("return toString.call(location)")() + RP_1_WA).at("-10")', - optimize: true, - }, - AT, - LOCATION - ), - define - ( - '[][TO_STRING].call(location)[SLICE_OR_SUBSTR]("-10")[1]', - GENERIC_ARRAY_TO_STRING, - LOCATION - ), - define - ( - '([][TO_STRING].call(location) + RP_1_WA).at("-10")', - AT, - GENERIC_ARRAY_TO_STRING, - LOCATION - ), - ], - 'M': - [ - define('btoa(0)[0]', ATOB), - define('"".small()[2]', CAPITAL_HTML), - define('(RP_4_A + Date())[30]', GMT), - define('(RP_0_S + Audio)[11]', HTMLAUDIOELEMENT), - define('(RP_0_S + document)[10]', HTMLDOCUMENT), - ], - 'N': '"NaN"[0]', - 'O': - [ - defineCharAtFnPos('Object', 9), - define('(RP_3_WA + PLAIN_OBJECT)[11]'), - define('btoa(NaN)[3]', ATOB), - define('"".fontcolor()[2]', CAPITAL_HTML), - define('(RP_3_WA + Intl)[11]', PLAIN_INTL), - ], - 'P': - [ - define('String.fromCharCode("80")'), - define('atob("01A")[1]', ATOB), - define('btoa("".italics())[0]', ATOB), - define('(RP_0_S + Function("return statusbar")())[11]', BARPROP), - define('"0".sup()[10]', CAPITAL_HTML), - defineCharDefault({ atob: false, charCode: false }), - ], - 'Q': - [ - define('"q"[TO_UPPER_CASE]()'), - define('btoa(1)[1]', ATOB), - defineCharDefault({ atob: false }), - ], - 'R': - [ - defineCharAtFnPos('RegExp', 9), - define('btoa("0true")[2]', ATOB), - define('"".fontcolor()[10]', CAPITAL_HTML), - define('(RP_3_WA + REGEXP_STRING_ITERATOR)[11]', REGEXP_STRING_ITERATOR), - ], - 'S': - [ - defineCharAtFnPos('String', 9), - define('"".sub()[1]', CAPITAL_HTML), - ], - 'T': - [ - define - ( - { - expr: - '(RP_0_S + ' + - 'Function("try{undefined.false}catch(undefined){return undefined}")())[0]', - optimize: true, - } - ), - define('btoa(NaN)[0]', ATOB), - define('"".fontcolor([])[20]', CAPITAL_HTML), - define('(RP_3_WA + Date())[30]', GMT), - define('(RP_0_S + Audio)[10]', HTMLAUDIOELEMENT), - define('(RP_1_WA + document)[10]', HTMLDOCUMENT), - defineCharDefault({ atob: false }), - ], - 'U': - [ - define('btoa("1NaN")[1]', ATOB), - define('"".sub()[2]', CAPITAL_HTML), - define('(RP_3_WA + Function("return toString")()())[11]', GLOBAL_UNDEFINED), - define('(RP_3_WA + Function("return{}.toString")()())[11]', OBJECT_UNDEFINED), - define('(RP_3_WA + PLAIN_OBJECT[TO_STRING].call())[11]', UNDEFINED), - define('(RP_3_WA + ARRAY_ITERATOR[TO_STRING].call())[11]', ARRAY_ITERATOR, UNDEFINED), - define('(RP_3_WA + Function("return Intl.toString")()())[11]', INTL, OBJECT_UNDEFINED), - define('(RP_3_WA + Intl[TO_STRING].call())[11]', INTL, UNDEFINED), - ], - 'V': - [ - define('"v"[TO_UPPER_CASE]()'), - define('(RP_0_S + document.createElement("video"))[12]', ANY_DOCUMENT), - define('btoa(undefined)[10]', ATOB), - defineCharDefault({ atob: false }), - ], - 'W': - [ - define('"w"[TO_UPPER_CASE]()'), - define('(self + RP_4_A)[SLICE_OR_SUBSTR]("-11")[0]', ANY_WINDOW), - define('btoa(undefined)[1]', ATOB), - define('(RP_0_S + self)[11]', DOMWINDOW), - define('(RP_3_WA + self)[11]', WINDOW), - define('(self + RP_4_A).at("-11")', ANY_WINDOW, AT), - defineCharDefault({ atob: false }), - ], - 'X': - [ - define('"x"[TO_UPPER_CASE]()'), - define('btoa("1true")[1]', ATOB), - defineCharDefault({ atob: false }), - ], - 'Y': - [ - define('"y"[TO_UPPER_CASE]()'), - define('btoa("a")[0]', ATOB), - defineCharDefault({ atob: false }), - ], - 'Z': - [ - define('btoa(false)[0]', ATOB), - define('(RP_3_WA + "".fontsize())[11]', CAPITAL_HTML), - ], - '[': - [ - defineCharInFB(14), - define('(RP_0_S + ARRAY_ITERATOR)[0]', ARRAY_ITERATOR), - ], - '\\': - [ - define('ESCAPING_BACKSLASH'), - defineCharDefault({ atob: false, escSeq: false, unescape: false }), - ], - ']': - [ - defineCharInFB(26), - define('(RP_0_S + ARRAY_ITERATOR)[22]', NO_OLD_SAFARI_ARRAY_ITERATOR), - ], - '^': - [ - define('atob("undefined0")[2]', ATOB), - ], - // '_': , - // '`': , - 'a': '"false"[1]', - 'b': - [ - defineCharAtFnPos('Number', 12), - define('(RP_0_S + ARRAY_ITERATOR)[2]', ARRAY_ITERATOR), - ], - 'c': - [ - defineCharAtFnPos('ANY_FUNCTION', 3), - define('(RP_5_A + ARRAY_ITERATOR)[10]', ARRAY_ITERATOR), - ], - 'd': '"undefined"[2]', - 'e': '"true"[3]', - 'f': '"false"[0]', - 'g': - [ - defineCharAtFnPos('String', 14), - ], - 'h': - [ - define('101[TO_STRING]("21")[1]'), - define('btoa("0false")[3]', ATOB), - ], - 'i': '([RP_5_A] + undefined)[10]', - 'j': - [ - define('(RP_0_S + PLAIN_OBJECT)[10]'), - define('(RP_0_S + ARRAY_ITERATOR)[3]', ARRAY_ITERATOR), - define('(RP_0_S + Intl)[3]', INTL), - define('(RP_0_S + Node)[3]', NODECONSTRUCTOR), - define('(RP_0_S + Intl)[10]', PLAIN_INTL), - define('(RP_0_S + self)[3]', SELF_OBJ), - ], - 'k': - [ - define('20[TO_STRING]("21")'), - defineCharDefault(), - ], - 'l': '"false"[2]', - 'm': - [ - defineCharAtFnPos('Number', 11), - define('(RP_6_S + Function())[20]'), - ], - 'n': '"undefined"[1]', - 'o': - [ - defineCharAtFnPos('ANY_FUNCTION', 6), - define('(RP_0_S + ARRAY_ITERATOR)[1]', ARRAY_ITERATOR), - ], - 'p': - [ - define('211[TO_STRING]("31")[1]'), - define('(RP_3_WA + btoa(undefined))[10]', ATOB), - ], - 'q': - [ - define('212[TO_STRING]("31")[1]'), - define('"".fontcolor(0 + "".fontcolor())[30]', ESC_HTML_ALL), - define('"".fontcolor("0false\\"")[20]', ESC_HTML_QUOT), - define('"".fontcolor(true + "".fontcolor())[30]', ESC_HTML_QUOT_ONLY), - defineCharDefault(), - ], - 'r': '"true"[1]', - 's': '"false"[3]', - 't': '"true"[0]', - 'u': '"undefined"[0]', - 'v': - [ - defineCharInFB(19), - ], - 'w': - [ - define('32[TO_STRING]("33")'), - define('(self + RP_0_S)[SLICE_OR_SUBSTR]("-2")[0]', ANY_WINDOW), - define('atob("undefined0")[1]', ATOB), - define('(RP_4_A + self)[20]', DOMWINDOW), - define('(RP_0_S + self)[13]', WINDOW), - define('(self + RP_0_S).at("-2")', ANY_WINDOW, AT), - ], - 'x': - [ - define('101[TO_STRING]("34")[1]'), - define('btoa("falsefalse")[10]', ATOB), - define('(RP_1_WA + sidebar)[10]', EXTERNAL), - ], - 'y': '(RP_3_WA + [Infinity])[10]', - 'z': - [ - define('35[TO_STRING]("36")'), - define('btoa("falsefalse")[11]', ATOB), - ], - '{': - [ - defineCharInFH(12), - ], - // '|': , - '}': - [ - defineCharInFB(28), - ], - // '~': , - - '\x8a': - [ - define('(RP_4_A + atob("NaNundefined"))[10]', ATOB), - ], - '\x8d': - [ - define('atob("0NaN")[2]', ATOB), - ], - '\x96': - [ - define('atob("00false")[3]', ATOB), - ], - '\x9e': - [ - define('atob(true)[2]', ATOB), - ], - '£': - [ - define('atob(NaN)[1]', ATOB), - ], - '¥': - [ - define('atob("0false")[2]', ATOB), - ], - '§': - [ - define('atob("00undefined")[2]', ATOB), - ], - '©': - [ - define('atob("false0")[1]', ATOB), - ], - '±': - [ - define('atob("0false")[3]', ATOB), - ], - '¶': - [ - define('atob(true)[0]', ATOB), - ], - 'º': - [ - define('atob("undefined0")[0]', ATOB), - ], - '»': - [ - define('atob(true)[1]', ATOB), - ], - 'Ç': - [ - define('atob("falsefalsefalse")[10]', ATOB), - ], - 'Ú': - [ - define('atob("0truefalse")[1]', ATOB), - ], - 'Ý': - [ - define('atob("0undefined")[2]', ATOB), - ], - 'â': - [ - define('atob("falsefalseundefined")[11]', ATOB), - ], - 'é': - [ - define('atob("0undefined")[1]', ATOB), - ], - 'î': - [ - define('atob("0truefalse")[2]', ATOB), - ], - 'ö': - [ - define('atob("0false")[1]', ATOB), - ], - 'ø': - [ - define('atob("undefinedundefined")[10]', ATOB), - ], - '∞': - [ - define('Infinity[TO_LOCALE_STRING]()', LOCALE_INFINITY), - defineCharDefault(), - ], - }); - - COMPLEX = - noProto - ({ - Number: define({ expr: 'Number.name', optimize: { complexOpt: false } }, NAME), - Object: define({ expr: 'Object.name', optimize: { complexOpt: false } }, NAME), - RegExp: define({ expr: 'RegExp.name', optimize: { complexOpt: false } }, NAME), - String: define('String.name', NAME), - fromCharCo: - define({ expr: '"from3har3o".split(3).join("C")', optimize: { complexOpt: false } }), - mCh: define('atob("bUNo")', Feature.ATOB), - }); - - CONSTANTS = - noProto - ({ - // JavaScript globals - - Array: - [ - define('[].constructor'), - ], - Audio: - [ - define('Function("return Audio")()', HTMLAUDIOELEMENT), - ], - Boolean: - [ - define('false.constructor'), - ], - Date: - [ - define('Function("return Date")()'), - ], - Function: - [ - define('ANY_FUNCTION.constructor'), - ], - Intl: - [ - define('Function("return Intl")()', INTL), - ], - Node: - [ - define('Function("return Node")()', NODECONSTRUCTOR), - ], - Number: - [ - define('0..constructor'), - ], - Object: - [ - define('PLAIN_OBJECT.constructor'), - define('Intl.constructor', INTL), - define('[].entries().constructor', NO_OLD_SAFARI_ARRAY_ITERATOR), - ], - RegExp: - [ - define('Function("return/false/")().constructor'), - ], - String: - [ - define('"".constructor'), - ], - atob: - [ - define('Function("return atob")()', ATOB), - ], - btoa: - [ - define('Function("return btoa")()', ATOB), - ], - document: - [ - define({ expr: 'Function("return document")()', optimize: true }, ANY_DOCUMENT), - ], - escape: - [ - define({ expr: 'Function("return escape")()', optimize: true }), - ], - location: - [ - define('Function("return location")()', LOCATION), - ], - self: - [ - define('Function("return self")()', SELF_OBJ), - ], - sidebar: - [ - define('Function("return sidebar")()', EXTERNAL), - ], - unescape: - [ - define({ expr: 'Function("return unescape")()', optimize: true }), - ], - - // Custom definitions - - ANY_FUNCTION: - [ - define('FILTER'), - define('AT', AT), - define('FILL', FILL), - define('FLAT', FLAT), - ], - ARRAY_ITERATOR: - [ - define('[].entries()', ARRAY_ITERATOR), - ], - AT: - [ - define('[].at', AT), - ], - ESCAPING_BACKSLASH: - [ - define(backslashDefinition), - define({ expr: 'atob("01y")[1]', solutionType: SolutionType.STRING }, ATOB), - define - ( - { expr: '(RP_0_S + RegExp("\\n"))[1]', solutionType: SolutionType.STRING }, - ESC_REGEXP_LF - ), - define - ( - { expr: '(RP_5_A + RegExp("".italics()))[10]', solutionType: SolutionType.STRING }, - ESC_REGEXP_SLASH - ), - define - ( - { expr: '(RP_3_WA + RegExp("".sub()))[10]', solutionType: SolutionType.STRING }, - ESC_REGEXP_SLASH - ), - define - ( - { expr: '(RP_0_S + RegExp(FILTER))[20]', solutionType: SolutionType.STRING }, - ESC_REGEXP_LF, - FF_SRC - ), - define - ( - { expr: '(RP_0_S + RegExp(Function()))[20]', solutionType: SolutionType.STRING }, - ESC_REGEXP_LF, - FUNCTION_19_LF - ), - define - ( - { expr: '(RP_5_A + RegExp(Function()))[30]', solutionType: SolutionType.STRING }, - ESC_REGEXP_LF, - FUNCTION_22_LF - ), - define - ( - { expr: '(RP_0_S + RegExp(ANY_FUNCTION))[1]', solutionType: SolutionType.STRING }, - ESC_REGEXP_LF, - IE_SRC - ), - define - ( - { - expr: '(+(RP_0_S + FILTER)[0] + RegExp(FILTER))[23]', - solutionType: SolutionType.STRING, - }, - ESC_REGEXP_LF, - NO_V8_SRC - ), - define - ( - { expr: '(RP_4_A + RegExp(AT))[20]', solutionType: SolutionType.STRING }, - AT, - ESC_REGEXP_LF, - FF_SRC - ), - define - ( - { - expr: '(RP_1_WA + [+(RP_0_S + AT)[0]] + RegExp(AT))[20]', - solutionType: SolutionType.STRING, - }, - AT, - ESC_REGEXP_LF, - NO_V8_SRC - ), - define - ( - { expr: '(RP_3_WA + RegExp(FILL))[21]', solutionType: SolutionType.STRING }, - ESC_REGEXP_LF, - FF_SRC, - FILL - ), - define - ( - { expr: '(RP_3_WA + RegExp(FLAT))[21]', solutionType: SolutionType.STRING }, - ESC_REGEXP_LF, - FF_SRC, - FLAT - ), - define - ( - { - expr: '(+(RP_0_S + FILL)[0] + RegExp(FILL))[21]', - solutionType: SolutionType.STRING, - }, - ESC_REGEXP_LF, - FILL, - NO_V8_SRC - ), - define - ( - { - expr: '(+(RP_0_S + FLAT)[0] + RegExp(FLAT))[21]', - solutionType: SolutionType.STRING, - }, - ESC_REGEXP_LF, - FLAT, - NO_V8_SRC - ), - ], - FILL: - [ - define('[].fill', FILL), - ], - FILTER: - [ - define('[].filter'), - ], - FLAT: - [ - define('[].flat', FLAT), - ], - F_A_L_S_E: - [ - define('[][SLICE_OR_FLAT].call("false")'), - ], - LOCALE_AR: - [ - define({ expr: '"ar-td"', solutionType: SolutionType.COMBINED_STRING }), - define({ expr: '"ar"', solutionType: SolutionType.COMBINED_STRING }, SHORT_LOCALES), - ], - PLAIN_OBJECT: - [ - define('Function("return{}")()'), - ], - REGEXP_STRING_ITERATOR: - [ - define({ expr: '"".matchAll()', optimize: true }, REGEXP_STRING_ITERATOR), - ], - SLICE_OR_FLAT: - [ - define({ expr: '"slice"', solutionType: SolutionType.COMBINED_STRING }), - define({ expr: '"flat"', solutionType: SolutionType.COMBINED_STRING }, FLAT), - ], - SLICE_OR_SUBSTR: - [ - define({ expr: '"slice"', solutionType: SolutionType.COMBINED_STRING }), - define({ expr: '"substr"', solutionType: SolutionType.COMBINED_STRING }), - ], - TO_LOCALE_STRING: - [ - define - ( - { - expr: '"toLocaleString"', - optimize: true, - solutionType: SolutionType.COMBINED_STRING, - } - ), - ], - TO_STRING: - [ - define - ( - { - expr: '"toString"', - optimize: { toStringOpt: false }, - solutionType: SolutionType.COMBINED_STRING, - } - ), - ], - TO_UPPER_CASE: - [ - define - ( - { - expr: '"toUpperCase"', - optimize: true, - solutionType: SolutionType.COMBINED_STRING, - } - ), - ], - - // Function body extra padding blocks: prepended to a function to align the function's body - // at the same position in different engines, assuming that the function header is aligned. - // The number after "FBEP_" is the maximum character overhead. - // The postfix that follows the maximum character overhead has the same meaning as in - // regular padding blocks. - - FBEP_4_S: - [ - define('[[true][+(RP_3_WA + FILTER)[30]]]'), - define('[[true][+(RP_1_WA + AT)[30]]]', AT), - define('[[true][+(RP_5_A + FILL)[30]]]', FILL), - define('[[true][+(RP_5_A + FLAT)[30]]]', FLAT), - define('[[true][+!!++(RP_0_S + FILTER)[20]]]', INCR_CHAR), - define('[[true][+!!++(RP_1_WA + AT)[20]]]', AT, INCR_CHAR), - define('[[true][+!!++(RP_0_S + FILL)[20]]]', FILL, INCR_CHAR), - define('[[true][+!!++(RP_0_S + FLAT)[20]]]', FLAT, INCR_CHAR), - ], - FBEP_9_U: - [ - define - ({ expr: '[false][+(RP_0_S + FILTER)[20]]', solutionType: SolutionType.UNDEFINED }), - define - ({ expr: '[false][+(RP_1_WA + AT)[20]]', solutionType: SolutionType.UNDEFINED }, AT), - define - ({ expr: '[false][+(RP_0_S + FILL)[20]]', solutionType: SolutionType.UNDEFINED }, FILL), - define - ({ expr: '[false][+(RP_0_S + FLAT)[20]]', solutionType: SolutionType.UNDEFINED }, FLAT), - ], - FBEP_10_S: - [ - define({ expr: '[RP_1_WA] + FBEP_9_U', solutionType: SolutionType.COMBINED_STRING }), - ], - - // Function body padding blocks: prepended to a function to align the function's body at the - // same position in different engines. - // The number after "FBP_" is the maximum character overhead. - // The postfix that follows the maximum character overhead has the same meaning as in - // regular padding blocks. - - FBP_5_S: - [ - define('[[false][+IS_IE_SRC_A]]', NO_FF_SRC), - ], - FBP_7_WA: - [ - define - ( - { - expr: '+("10" + [(RP_4_A + FILTER)[40]] + "00000")', - solutionType: SolutionType.WEAK_ALGEBRAIC, - } - ), - define - ( - { - expr: '+("10" + [(RP_0_S + AT)[32]] + "00000")', - solutionType: SolutionType.WEAK_ALGEBRAIC, - }, - AT - ), - define - ( - { - expr: '+("10" + [(RP_6_S + FILL)[40]] + "00000")', - solutionType: SolutionType.WEAK_ALGEBRAIC, - }, - FILL - ), - define - ( - { - expr: '+("10" + [(RP_6_S + FLAT)[40]] + "00000")', - solutionType: SolutionType.WEAK_ALGEBRAIC, - }, - FLAT - ), - ], - FBP_8_WA: - [ - define - ( - { - expr: '+("1000" + (RP_5_A + FILTER + 0)[40] + "000")', - solutionType: SolutionType.WEAK_ALGEBRAIC, - } - ), - define - ( - { - expr: '+("1000" + (AT + 0)[31] + "000")', - solutionType: SolutionType.WEAK_ALGEBRAIC, - }, - AT - ), - define - ( - { - expr: '+("1000" + (FILL + 0)[33] + "000")', - solutionType: SolutionType.WEAK_ALGEBRAIC, - }, - FILL - ), - define - ( - { - expr: '+("1000" + (FLAT + 0)[33] + "000")', - solutionType: SolutionType.WEAK_ALGEBRAIC, - }, - FLAT - ), - ], - FBP_9_U: - [ - define - ( - { - expr: '[true][+(RP_0_S + ANY_FUNCTION)[0]]', - solutionType: SolutionType.UNDEFINED, - }, - NO_FF_SRC - ), - ], - - // Function header shift: used to adjust an index to make it point to the same position in - // the string representation of a function's header in different engines. - // This evaluates to an array containing only the number 𝑛 - 1 or only the number 𝑛, where 𝑛 - // is the number after "FH_SHIFT_". - - FH_SHIFT_1: - [ - define('[+IS_IE_SRC_A]'), - ], - FH_SHIFT_2: - [ - define('[true + IS_IE_SRC_A]'), - ], - FH_SHIFT_3: - [ - define('[2 + IS_IE_SRC_A]'), - ], - - // Function header padding blocks: prepended to a function to align the function's header at - // the same position in different engines. - // The number after "FHP_" is the maximum character overhead. - // The postfix that follows the maximum character overhead has the same meaning as in - // regular padding blocks. - - FHP_3_WA: - [ - define - ( - { - expr: '+(1 + [+(RP_0_S + ANY_FUNCTION)[0]])', - solutionType: SolutionType.WEAK_ALGEBRAIC, - } - ), - define - ( - { - expr: '+(++(RP_0_S + ANY_FUNCTION)[0] + [0])', - solutionType: SolutionType.WEAK_ALGEBRAIC, - }, - INCR_CHAR - ), - ], - FHP_5_A: - [ - define({ expr: 'IS_IE_SRC_A', solutionType: SolutionType.ALGEBRAIC }), - ], - FHP_8_S: - [ - define({ expr: '[RP_3_WA] + FHP_5_A', solutionType: SolutionType.COMBINED_STRING }), - ], - - // Conditional padding blocks. - // - // true if feature IE_SRC is available; false otherwise. - IS_IE_SRC_A: - [ - define - ( - { - expr: '!![[]][+(RP_0_S + ANY_FUNCTION)[0]]', - solutionType: SolutionType.ALGEBRAIC, - } - ), - define - ( - { expr: '!!++(RP_0_S + ANY_FUNCTION)[0]', solutionType: SolutionType.ALGEBRAIC }, - INCR_CHAR - ), - ], - - // Regular padding blocks. - // - // The number after "RP_" is the character overhead. - // The postifx that follows it indicates the solution type. - // - // • "_U": environment hybrid undefined and algebraic - // • "_A": algebraic - // • "_WA": weak algebraic - // • "_S": object, prefixed string or combined string - // • "_WS": weak prefixed string - - RP_0_S: { expr: '[]', solutionType: SolutionType.OBJECT }, - RP_1_WA: { expr: '0', solutionType: SolutionType.WEAK_ALGEBRAIC }, - RP_2_WS: { expr: '"00"', solutionType: SolutionType.WEAK_PREFIXED_STRING }, - RP_3_WA: { expr: 'NaN', solutionType: SolutionType.WEAK_ALGEBRAIC }, - RP_4_A: { expr: 'true', solutionType: SolutionType.ALGEBRAIC }, - RP_5_A: { expr: 'false', solutionType: SolutionType.ALGEBRAIC }, - RP_6_S: { expr: '"0false"', solutionType: SolutionType.COMBINED_STRING }, - }); - - FB_R_PADDING_SHIFTS = [define(4, FF_SRC), define(5, IE_SRC), define(0, V8_SRC)]; - - FH_R_PADDING_SHIFTS = [define(1, IE_SRC), define(0, NO_IE_SRC)]; - - FROM_CHAR_CODE = - defineList - ( - [define('fromCharCode'), define('fromCodePoint', FROM_CODE_POINT)], - [ - define(0), - define(1, ATOB), - define(1, BARPROP), - define(1, CAPITAL_HTML), - define(0, ARRAY_ITERATOR, ATOB, CAPITAL_HTML, FROM_CODE_POINT), - ] - ); - - FROM_CHAR_CODE_CALLBACK_FORMATTER = - defineList - ( - [ - define - ( - function (fromCharCode, arg) - { - var expr = - 'function(undefined){return String.' + fromCharCode + '(' + arg + ')}'; - return expr; - } - ), - define - ( - function (fromCharCode, arg) - { - var expr = - 'function(undefined){return(isNaN+false).constructor.' + fromCharCode + '(' + - arg + ')}'; - return expr; - } - ), - define - ( - function (fromCharCode, arg) - { - var expr = 'undefined=>String.' + fromCharCode + '(' + arg + ')'; - return expr; - }, - ARROW - ), - define - ( - function (fromCharCode, arg) - { - var expr = - 'undefined=>(isNaN+false).constructor.' + fromCharCode + '(' + arg + ')'; - return expr; - }, - ARROW - ), - define - ( - function (fromCharCode, arg) - { - var expr = - 'function(undefined){return status.constructor.' + fromCharCode + '(' + arg + - ')}'; - return expr; - }, - STATUS - ), - define - ( - function (fromCharCode, arg) - { - var expr = 'undefined=>status.constructor.' + fromCharCode + '(' + arg + ')'; - return expr; - }, - ARROW, - STATUS - ), - ], - [ - define(1), - define(3), - define(0, ARRAY_ITERATOR, CAPITAL_HTML), - define(1, ARRAY_ITERATOR, CAPITAL_HTML, FLAT), - define(0, ARRAY_ITERATOR, CAPITAL_HTML, NO_V8_SRC), - define(1, ARRAY_ITERATOR, AT, CAPITAL_HTML), - define(1, ARRAY_ITERATOR, CAPITAL_HTML, FF_SRC, FLAT), - define(1, ARRAY_ITERATOR, CAPITAL_HTML, FILL, IE_SRC), - define(1, ARRAY_ITERATOR, CAPITAL_HTML, FILL, NO_IE_SRC), - define(1, ARRAY_ITERATOR, CAPITAL_HTML, FLAT, IE_SRC), - define(2, ARRAY_ITERATOR, CAPITAL_HTML), - define(3, ARRAY_ITERATOR, AT, CAPITAL_HTML, IE_SRC), - define(3, ARRAY_ITERATOR, AT, CAPITAL_HTML, NO_IE_SRC), - define(4), - define(5), - ] - ); - - MAPPER_FORMATTER = - defineList - ( - [ - define - ( - function (argName, accessor) - { - var otherArgName = chooseOtherArgName(argName); - var mapper = - 'Function("return function(' + otherArgName + '){return function(' + argName + - '){return ' + otherArgName + accessor + '}}")()'; - return mapper; - } - ), - define - ( - function (argName, accessor) - { - var mapper = - 'Function("return function(' + argName + '){return this' + accessor + - '}")().bind'; - return mapper; - } - ), - define - ( - function (argName, accessor) - { - var otherArgName = chooseOtherArgName(argName); - var mapper = - 'Function("return ' + otherArgName + '=>' + argName + '=>' + otherArgName + - accessor + '")()'; - return mapper; - }, - ARROW - ), - ], - [ - define(0), - define(1, ARRAY_ITERATOR, ATOB), - define(0, NO_FF_SRC), - define(0, NO_V8_SRC), - define(1, ARRAY_ITERATOR, CAPITAL_HTML), - define(0, ARRAY_ITERATOR, AT, ATOB), - define(0, ARRAY_ITERATOR, AT, CAPITAL_HTML), - define(0, ARRAY_ITERATOR, ATOB, FILL), - define(0, ARRAY_ITERATOR, ATOB, FLAT), - define(0, ARRAY_ITERATOR, ATOB, NO_IE_SRC), - define(0, ARRAY_ITERATOR, CAPITAL_HTML, FILL), - define(0, ARRAY_ITERATOR, CAPITAL_HTML, FLAT), - define(0, ARRAY_ITERATOR, CAPITAL_HTML, IE_SRC), - define(0, ARRAY_ITERATOR, CAPITAL_HTML, NO_IE_SRC), - define(2), - ] - ); - - NATIVE_FUNCTION_INFOS = - [ - define({ expr: 'FILTER', shift: 6 }), - define({ expr: 'FILL', shift: 4 }, FILL), - define({ expr: 'FLAT', shift: 4 }, FLAT), - define({ expr: 'AT', shift: 2 }, AT), - ]; - - OPTIMAL_ARG_NAME = - defineList - ( - [define('f'), define('undefined')], - [ - define(0), - define(1, AT), - define(1, FILL, IE_SRC), - define(1, FILL, NO_IE_SRC), - define(0, FLAT), - ] - ); - - OPTIMAL_B = defineList([define('B'), define('b')], [define(0), define(1, ARRAY_ITERATOR)]); - - OPTIMAL_RETURN_STRING = - defineList - ( - [ - define('return String'), - define('return(isNaN+false).constructor'), - define('return status.constructor', STATUS), - ], - [ - define(1), - define(0, ARRAY_ITERATOR, CAPITAL_HTML), - define(1, FLAT), - define(0, ARRAY_ITERATOR, CAPITAL_HTML, NO_V8_SRC), - define(1, ARRAY_ITERATOR, AT, CAPITAL_HTML), - define(1, ARRAY_ITERATOR, CAPITAL_HTML, FF_SRC, FLAT), - define(1, ARRAY_ITERATOR, CAPITAL_HTML, FILL, IE_SRC), - define(1, ARRAY_ITERATOR, CAPITAL_HTML, FILL, NO_IE_SRC), - define(1, ARRAY_ITERATOR, CAPITAL_HTML, FLAT, IE_SRC), - define(2), - ] - ); - - // Create simple constant solutions - defineSimple('false', '![]', SolutionType.ALGEBRAIC); - defineSimple('true', '!![]', SolutionType.ALGEBRAIC); - defineSimple('undefined', '[][[]]', SolutionType.UNDEFINED); - defineSimple('NaN', '+[false]', SolutionType.WEAK_ALGEBRAIC); - defineSimple('Infinity', JSFUCK_INFINITY, SolutionType.WEAK_ALGEBRAIC); - - // Create definitions for digits - for (var digit = 0; digit <= 9; ++digit) - { - var expr = replaceDigit(digit); - CHARACTERS[digit] = { expr: expr, solutionType: SolutionType.WEAK_ALGEBRAIC }; - } - - makeCallableWithFeatures(defineLocalizedNumeral); - makeCallableWithFeatures(useLocaleNumeralDefinition); - - // Localized numeral definitions - useLocaleNumeralDigitDefinitions('LOCALE_AR', 0x0660); - useLocaleNumeralDefinition('٫', 'LOCALE_AR', 0.1, 1); - useLocaleNumeralDefinition('ل', '"ar"', NaN, 0); - useLocaleNumeralDefinition('ي', '"ar"', NaN, 1); - useLocaleNumeralDefinition('س', '"ar"', NaN, 2); - useLocaleNumeralDefinition('ر', '"ar"', NaN, 4, LOCALE_NUMERALS_EXT); - useLocaleNumeralDefinition('ق', '"ar"', NaN, 5, LOCALE_NUMERALS_EXT); - useLocaleNumeralDefinition('م', '"ar"', NaN, 6, LOCALE_NUMERALS_EXT); - useLocaleNumeralDigitDefinitions('"bn"', 0x09e6, LOCALE_NUMERALS_EXT); - useLocaleNumeralDigitDefinitions('"fa"', 0x06f0); - useLocaleNumeralDefinition('٬', '"fa"', 1000, 1); - useLocaleNumeralDefinition('ن', '"fa"', NaN, 0, LOCALE_NUMERALS_EXT); - useLocaleNumeralDefinition('ا', '"fa"', NaN, 1, LOCALE_NUMERALS_EXT); - useLocaleNumeralDefinition('ع', '"fa"', NaN, 2, LOCALE_NUMERALS_EXT); - useLocaleNumeralDefinition('د', '"fa"', NaN, 3, LOCALE_NUMERALS_EXT); - useLocaleNumeralDefinition('н', '"ru"', NaN, 0, LOCALE_NUMERALS_EXT); - useLocaleNumeralDefinition('е', '"ru"', NaN, 1, LOCALE_NUMERALS_EXT); - useLocaleNumeralDefinition('ч', '"ru"', NaN, 3, LOCALE_NUMERALS_EXT); - useLocaleNumeralDefinition('и', '"ru"', NaN, 4, LOCALE_NUMERALS_EXT); - useLocaleNumeralDefinition('с', '"ru"', NaN, 5, LOCALE_NUMERALS_EXT); - useLocaleNumeralDefinition('л', '"ru"', NaN, 6, LOCALE_NUMERALS_EXT); - useLocaleNumeralDefinition('о', '"ru"', NaN, 7, LOCALE_NUMERALS_EXT); - } - )(); - - var APPEND_LENGTH_OF_DIGIT_0 = 6; - var APPEND_LENGTH_OF_DOT = 73; - var APPEND_LENGTH_OF_FALSE = 4; - var APPEND_LENGTH_OF_EMPTY = 3; // Append length of the empty array. - var APPEND_LENGTH_OF_MINUS = 136; - var APPEND_LENGTH_OF_PLUS_SIGN = 71; - var APPEND_LENGTH_OF_SMALL_E = 26; - - var APPEND_LENGTH_OF_DIGITS = [APPEND_LENGTH_OF_DIGIT_0, 8, 12, 17, 22, 27, 32, 37, 42, 47]; - - // Recognized syntax elements include: - // - // • The boolean literals "true" and "false" - // • The pseudoconstant literals "undefined", "NaN" and "Infinity" - // • ES5 strict mode numeric literals - // • ES5 strict mode string literals with the line continuation extension - // • Empty and singleton array literals - // • ASCII identifiers - // • ASCII property getters in dot notation - // • Property getters in bracket notation - // • Function calls without parameters and with one parameter - // • The unary operators "!", "+", and to a limited extent "-" and "++" (prefix and postfix - // increment) - // • The binary operators "+" and to a limited extent "-" - // • Grouping parentheses - // • White spaces and line terminators - // • Semicolons - // • Comments - - function appendGetOp(parseInfo, op) - { - var str = stringifyUnit(op); - if (str != null) - op.str = str; - op.type = 'get'; - appendOp(parseInfo, op); - } - - function appendOp(parseInfo, op) - { - var opsStack = parseInfo.opsStack; - var ops = opsStack[opsStack.length - 1]; - ops.push(op); - } - - function appendTerm(parseInfo, term) - { - var unit = popUnit(parseInfo); - var mod = popMod(parseInfo); - applyMod(term, mod); - if (unit) - { - if (!finalizeUnit(term)) - return; - var terms = unit.terms; - if (terms && isUndecoratedUnit(unit)) - { - terms.push(term); - if (!term.arithmetic) - unit.arithmetic = false; - } - else - { - if (!finalizeUnit(unit)) - return; - var arithmetic = unit.arithmetic && term.arithmetic; - unit = { arithmetic: arithmetic, ops: [], terms: [unit, term] }; - } - } - else - unit = term; - var binSign = read(parseInfo, /^(?:\+(?!\+)|-(?!-))/); - if (!binSign) - { - var finalizer = popFinalizer(parseInfo); - return finalizer(unit, parseInfo); - } - if (binSign === '-' && !unit.arithmetic) - applyMod(unit, '+'); - mod = readMod(parseInfo, binSign === '+' ? '' : binSign); - pushMod(parseInfo, mod); - pushUnit(parseInfo, unit); - return parsePrimaryExpr; - } - - function applyMod(unit, mod) - { - if (!unit.mod && 'value' in unit && unit.arithmetic && !unit.pmod) - { - var value = unit.value; - loop: - for (var index = mod.length; index--;) - { - var thisMod = mod[index]; - switch (thisMod) - { - case '!': - value = !value; - break; - case '+': - value = +value; - break; - case '-': - value = -value; - break; - case '#': - break loop; - } - } - unit.value = value; - mod = mod.slice(0, index + 1); - } - if (mod) - { - mod = joinMods(mod, unit.mod || '', unit.pmod); - unit.mod = mod; - unit.arithmetic = true; - } - } - - function defaultReadIdentifierData(parseInfo) - { - var rawIdentifier = read(parseInfo, rawIdentifierRegExp); - if (rawIdentifier) - { - var identifier = _JSON_parse('"' + rawIdentifier + '"'); - if (/^[$A-Z_a-z][$\w]*$/.test(identifier)) - { - var escaped = identifier.length < rawIdentifier.length; - return { escaped: escaped, identifier: identifier }; - } - } - } - - function escapeMod(mod) - { - var escapedMod = mod.replace(/\+\+/g, '#'); - return escapedMod; - } - - function evalExpr(expr) - { - var value = _Function('return ' + expr)(); - return value; - } - - function finalizeArrayElement(unit, parseInfo) - { - if (finalizeUnit(unit) && readSquareBracketRight(parseInfo)) - { - newOps(parseInfo, { value: [unit] }); - return parseNextOp; - } - } - - function finalizeGroup(unit, parseInfo) - { - if (readParenthesisRight(parseInfo)) - { - newOps(parseInfo, unit); - return parseNextOp; - } - } - - function finalizeIndexer(op, parseInfo) - { - if (finalizeUnit(op) && readSquareBracketRight(parseInfo)) - { - appendGetOp(parseInfo, op); - return parseNextOp; - } - } - - function finalizeParamCall(op, parseInfo) - { - if (finalizeUnit(op) && readParenthesisRight(parseInfo)) - { - op.type = 'param-call'; - appendOp(parseInfo, op); - return parseNextOp; - } - } - - function finalizeUnit(unit) - { - var mod = unit.mod || ''; - if (!/-/.test(mod) && (!/#$/.test(mod) || unit.ops.length)) - { - unit.mod = unescapeMod(mod); - return unit; - } - } - - function isReturnableIdentifier(identifier, escaped) - { - var returnable = - UNRETURNABLE_WORDS.indexOf(identifier) < 0 && - (!escaped || INESCAPABLE_WORDS.indexOf(identifier) < 0); - return returnable; - } - - function isUndecoratedUnit(unit) - { - var undecorated = !(unit.mod || unit.ops.length); - return undecorated; - } - - function joinMods(mod1, mod2, trimTrailingPlus) - { - var mod = - (mod1 + mod2) - .replace(/\+\+|--/, '+') - .replace(/\+-|-\+/, '-') - .replace(/!-/, '!+') - .replace(/\+#/, '#') - .replace(/!\+!/, '!!') - .replace('!!!', '!'); - if (trimTrailingPlus) - mod = mod.replace(/\+$/, ''); - return mod; - } - - function makeRegExp(richPattern) - { - var pattern = '^(?:' + replacePattern(richPattern) + ')'; - var regExp = _RegExp(pattern); - return regExp; - } - - function newOps(parseInfo, unit) - { - pushNewOps(parseInfo); - pushUnit(parseInfo, unit); - } - - function parse(parseInfo) - { - for (var next = parseUnit; typeof next === 'function'; next = next(parseInfo)); - return next; - } - - function parseNextOp(parseInfo) - { - if (readParenthesisLeft(parseInfo)) - { - if (readParenthesisRight(parseInfo)) - { - appendOp(parseInfo, { type: 'call' }); - return parseNextOp; - } - pushFinalizer(parseInfo, finalizeParamCall); - return parseUnit; - } - if (readSquareBracketLeft(parseInfo)) - { - pushFinalizer(parseInfo, finalizeIndexer); - return parseUnit; - } - if (read(parseInfo, /^\./)) - { - var identifierData = defaultReadIdentifierData(parseInfo); - if (!identifierData) - return; - appendGetOp(parseInfo, { ops: [], value: identifierData.identifier }); - return parseNextOp; - } - var unit = popUnit(parseInfo); - var ops = popOps(parseInfo); - if (ops.length) - { - unit.arithmetic = false; - if (unit.mod || unit.pmod) - { - if (!finalizeUnit(unit)) - return; - unit = { terms: [unit] }; - } - } - unit.ops = ops = (unit.ops || []).concat(ops); - if (ops.length && !unit.mod && !unit.pmod) - { - if (/^.*$/.test(parseInfo.separator)) - { - var pmod = read(parseInfo, /^\+\+/); - if (pmod) - { - unit.pmod = pmod; - unit.arithmetic = true; - } - } - } - var next = appendTerm(parseInfo, unit); - return next; - } - - function parsePrimaryExpr(parseInfo) - { - var strExpr = read(parseInfo, strRegExp); - if (strExpr) - { - var str = evalExpr(strExpr); - newOps(parseInfo, { value: str }); - return parseNextOp; - } - var constValueExpr = read(parseInfo, constValueRegExp); - if (constValueExpr) - { - var constValue = evalExpr(constValueExpr); - newOps(parseInfo, { arithmetic: true, value: constValue }); - return parseNextOp; - } - if (readSquareBracketLeft(parseInfo)) - { - if (readSquareBracketRight(parseInfo)) - { - newOps(parseInfo, { value: [] }); - return parseNextOp; - } - pushFinalizer(parseInfo, finalizeArrayElement); - return parseUnit; - } - if (readParenthesisLeft(parseInfo)) - { - pushFinalizer(parseInfo, finalizeGroup); - return parseUnit; - } - var identifierData = defaultReadIdentifierData(parseInfo); - if (identifierData) - { - var identifier = identifierData.identifier; - if (isReturnableIdentifier(identifier, identifierData.escaped)) - { - newOps(parseInfo, { identifier: identifier }); - return parseNextOp; - } - } - } - - function parseUnit(parseInfo) - { - var MAX_PARSABLE_NESTINGS = 1000; - - if (parseInfo.finalizerStack.length <= MAX_PARSABLE_NESTINGS) - { - var mod = readMod(parseInfo, ''); - pushMod(parseInfo, mod); - pushUnit(parseInfo); - return parsePrimaryExpr; - } - } - - function popFinalizer(parseInfo) - { - var ret = parseInfo.finalizerStack.pop(); - return ret; - } - - function popMod(parseInfo) - { - var mod = parseInfo.modStack.pop(); - return mod; - } - - function popOps(parseInfo) - { - var ops = parseInfo.opsStack.pop(); - return ops; - } - - function popUnit(parseInfo) - { - var unit = parseInfo.unitStack.pop(); - return unit; - } - - function pushFinalizer(parseInfo, finalizer) - { - parseInfo.finalizerStack.push(finalizer); - } - - function pushMod(parseInfo, mod) - { - parseInfo.modStack.push(mod); - } - - function pushNewOps(parseInfo) - { - parseInfo.opsStack.push([]); - } - - function pushUnit(parseInfo, unit) - { - parseInfo.unitStack.push(unit); - } - - function read(parseInfo, regExp) - { - var data = parseInfo.data; - var matches = regExp.exec(data); - if (matches) - { - var match = matches[0]; - data = data.slice(match.length); - var separator = separatorRegExp.exec(data)[0]; - if (separator) - data = data.slice(separator.length); - parseInfo.data = data; - parseInfo.separator = separator; - return match; - } - } - - function readMod(parseInfo, mod) - { - var newMod; - while (newMod = read(parseInfo, /^(?:!|\+\+?|-(?!-))/)) - mod = joinMods(mod, escapeMod(newMod)); - return mod; - } - - function readParenthesisLeft(parseInfo) - { - var match = read(parseInfo, /^\(/); - return match; - } - - function readParenthesisRight(parseInfo) - { - var match = read(parseInfo, /^\)/); - return match; - } - - function readSeparatorOrColon(parseInfo) - { - parseInfo.data = parseInfo.data.replace(separatorOrColonRegExp, ''); - } - - function readSquareBracketLeft(parseInfo) - { - var match = read(parseInfo, /^\[/); - return match; - } - - function readSquareBracketRight(parseInfo) - { - var match = read(parseInfo, /^]/); - return match; - } - - function replaceAndGroupToken(unused, tokenName) - { - var replacement = '(?:' + replaceToken(tokenName) + ')'; - return replacement; - } - - function replacePattern(richPattern) - { - var pattern = richPattern.replace(/#(\w+)/g, replaceAndGroupToken); - return pattern; - } - - function replaceToken(tokenName) - { - var replacement = tokenCache[tokenName]; - if (replacement == null) - { - var richPattern = tokens[tokenName]; - tokenCache[tokenName] = replacement = replacePattern(richPattern); - } - return replacement; - } - - function stringifyUnit(unit) - { - var inArray = false; - while ('value' in unit && isUndecoratedUnit(unit)) - { - var value = unit.value; - if (!_Array_isArray(value)) - return value == null && inArray ? '' : _String(value); - unit = value[0]; - if (!unit) - return ''; - inArray = true; - } - } - - function unescapeMod(mod) - { - var unescapedMod = mod.replace(/#/g, '++'); - return unescapedMod; - } - - var tokens = - { - ConstIdentifier: 'Infinity|NaN|false|true|undefined', - DecimalLiteral: '(?:(?:0|[1-9]\\d*)(?:\\.\\d*)?|\\.\\d+)(?:[Ee][+-]?\\d+)?', - DoubleQuotedString: '"(?:#EscapeSequence|(?!["\\\\]).)*"', - EscapeSequence: '\\\\(?:u#HexDigit{4}|x#HexDigit{2}|0(?![0-7])|\r\n|[^0-7ux])', - HexDigit: '[0-9A-Fa-f]', - HexIntegerLiteral: '0[Xx]#HexDigit+', - NumericLiteral: '#HexIntegerLiteral|#DecimalLiteral', - Separator: '#SeparatorChar|//.*(?!.)|/\\*[\\s\\S]*?\\*/', - // U+180E is recognized as a separator in older browsers. - // U+FEFF is missed by /\s/ in Android Browser < 4.1.x. - SeparatorChar: '(?!\u180E)[\\s\uFEFF]', - SingleQuotedString: '\'(?:#EscapeSequence|(?![\'\\\\]).)*\'', - UnicodeEscapeSequence: '\\\\u#HexDigit{4}', - }; - - var tokenCache = createEmpty(); - - // Reserved words and that cannot be written with escape sequences. - var INESCAPABLE_WORDS = ['false', 'null', 'true']; - - // This list includes reserved words and identifiers that would cause a change in a script's - // behavior when placed after a return statement inside a Function invocation. - // Unwanted changes include producing a syntax error where none is expected or a difference in - // evaluation. - var UNRETURNABLE_WORDS = - [ - 'arguments', // shadowed in function body - 'debugger', // : debugger; - 'delete', // : delete(x); - 'if', // : if(x); - 'import', // : import(x); - 'let', // may be an identifier in non-strict mode - 'new', // : new(x); - 'return', // : return; - 'this', // shadowed in function body - 'throw', // : throw(x); - 'typeof', // : typeof(x); - 'void', // : void(x); - 'while', // : while(x); - 'with', // : with(x); - 'yield', // may be an identifier in non-strict mode - ]; - - var constValueRegExp = makeRegExp('(?:#NumericLiteral|#ConstIdentifier)'); - var rawIdentifierRegExp = makeRegExp('(?:[$\\w]|#UnicodeEscapeSequence)+'); - var separatorOrColonRegExp = makeRegExp('(?:#Separator|;)*'); - var separatorRegExp = makeRegExp('#Separator*'); - var strRegExp = makeRegExp('#SingleQuotedString|#DoubleQuotedString'); - - function expressParse(input) - { - var parseInfo = - { data: input, modStack: [], opsStack: [], finalizerStack: [finalizeUnit], unitStack: [] }; - readSeparatorOrColon(parseInfo); - if (!parseInfo.data) - return true; - var unit = parse(parseInfo); - if (unit) - { - readSeparatorOrColon(parseInfo); - if (!parseInfo.data) - return unit; - } - } - - var expressParseCached; - - if (typeof WeakRef !== 'function') - expressParseCached = expressParse; - else - { - var cache = new Map(); - var cleanup = - new FinalizationRegistry - ( - function (input) - { - var ref = cache.get(input); - if (ref && !ref.deref()) - cache.delete(input); - } - ); - expressParseCached = - function (input) - { - var unit; - var ref = cache.get(input); - if (ref) - unit = ref.deref(); - if (!unit) - { - unit = expressParse(input); - if (unit && unit !== true) - { - ref = new WeakRef(unit); - cache.set(input, ref); - cleanup.register(unit, input); - } - } - return unit; - }; - } - - var expressParseCached$1 = expressParseCached; - - function findDefinition(entries) - { - var cacheKey = entries.cacheKey; - if (cacheKey === undefined) - entries.cacheKey = cacheKey = ++lastCacheKey; - var definitionCache = this._definitionCache; - if (cacheKey in definitionCache) - return definitionCache[cacheKey]; - var definition; - for (var entryIndex = entries.length; entryIndex--;) - { - var entry = entries[entryIndex]; - if (this.hasFeatures(entry.mask)) - { - definition = entry.definition; - break; - } - } - definitionCache[cacheKey] = definition; - return definition; - } - - var lastCacheKey = 0; - - var SCREW_NORMAL = 0; - var SCREW_AS_STRING = 1; - var SCREW_AS_BONDED_STRING = 2; - - function gather(buffer, offset, count, groupBond, groupForceString) - { - var end = offset + count; - var groupSolutions = buffer._solutions.slice(offset, end); - var optimizerList = buffer._optimizerList; - if (optimizerList.length) - optimizeSolutions(optimizerList, groupSolutions, groupBond, groupForceString); - var str = gatherGroup(groupSolutions, groupBond, groupForceString); - return str; - } - - function gatherGroup(solutions, bond, forceString) - { - var solution = new DynamicSolution(); - var count = solutions.length; - if (count) - { - var index = 0; - do - { - var subSolution = solutions[index]; - solution.append(subSolution); - } - while (++index < count); - } - else - solution.append(EMPTY_SOLUTION); - if (!solution.isString && forceString) - solution.append(EMPTY_SOLUTION); - var str = solution.replacement; - if (bond && solution.isLoose) - str = '(' + str + ')'; - return str; - } - - function ScrewBuffer(screwMode, groupThreshold, optimizerList) - { - this._groupThreshold = groupThreshold; - this._maxSolutionCount = _Math_pow(2, groupThreshold - 1); - this._optimizerList = optimizerList; - this._screwMode = screwMode; - this._solutions = []; - this._length = -APPEND_LENGTH_OF_EMPTY; - } - - assignNoEnum - ( - ScrewBuffer.prototype, - { - get length() - { - return this._length; - }, - append: - function (solution) - { - var solutions = this._solutions; - if (solutions.length >= this._maxSolutionCount) - return false; - solutions.push(solution); - var appendLength = solution.appendLength; - this._optimizerList.forEach - ( - function (optimizer) - { - var currentAppendLength = optimizer.appendLengthOf(solution); - if (currentAppendLength < appendLength) - appendLength = currentAppendLength; - } - ); - this._length += appendLength; - return true; - }, - toString: - function () - { - function collectOut(offset, count, maxGroupCount, groupBond) - { - var str; - if (count <= groupSize + 1) - str = gather(buffer, offset, count, groupBond); - else - { - maxGroupCount /= 2; - var halfCount = groupSize * maxGroupCount; - var capacity = 2 * halfCount - count; - var leftEndCount = - _Math_max - ( - halfCount - capacity + capacity % (groupSize - 1), - (maxGroupCount / 2 ^ 0) * (groupSize + 1) - ); - str = - collectOut(offset, leftEndCount, maxGroupCount) + - '+' + - collectOut(offset + leftEndCount, count - leftEndCount, maxGroupCount, true); - if (groupBond) - str = '(' + str + ')'; - } - return str; - } - - var str; - var solutionCount = this._solutions.length; - var groupThreshold = this._groupThreshold; - var screwMode = this._screwMode; - var bond = screwMode === SCREW_AS_BONDED_STRING; - if (solutionCount <= groupThreshold) - { - var forceString = screwMode !== SCREW_NORMAL; - str = gather(this, 0, solutionCount, bond, forceString); - } - else - { - var groupSize = groupThreshold; - var maxGroupCount = 2; - for (;;) - { - --groupSize; - var maxSolutionCountForDepth = groupSize * maxGroupCount; - if (solutionCount <= maxSolutionCountForDepth) - break; - maxGroupCount *= 2; - } - var buffer = this; - str = collectOut(0, solutionCount, maxGroupCount, bond); - } - return str; - }, - } - ); - - function optimizeSolutions(optimizerList, solutions, bond, forceString) - { - var plan = createClusteringPlan(); - optimizerList.forEach - ( - function (optimizer) - { - optimizer.optimizeSolutions(plan, solutions, bond, forceString); - } - ); - var clusters = plan.conclude(); - clusters.forEach - ( - function (cluster) - { - var clusterer = cluster.data; - var solution = clusterer(); - solutions.splice(cluster.start, cluster.length, solution); - } - ); - } - - function findBase64AlphabetDefinition(encoder, element) - { - var definition; - if (_Array_isArray(element)) - definition = encoder.findDefinition(element); - else - definition = element; - return definition; - } - - function replaceCharByAtob(charCode) - { - var param1 = BASE64_ALPHABET_LO_6[charCode >> 2] + BASE64_ALPHABET_HI_2[charCode & 0x03]; - var postfix1 = '(' + this.replaceString(param1) + ')'; - if (param1.length > 2) - postfix1 += replaceIndexer(0); - - var param2Left = findBase64AlphabetDefinition(this, BASE64_ALPHABET_LO_4[charCode >> 4]); - var param2Right = findBase64AlphabetDefinition(this, BASE64_ALPHABET_HI_4[charCode & 0x0f]); - var param2 = param2Left + param2Right; - var index2 = 1 + (param2Left.length - 2) / 4 * 3; - var indexer2 = replaceIndexer(index2); - var postfix2 = '(' + this.replaceString(param2) + ')' + indexer2; - - var param3Left = BASE64_ALPHABET_LO_2[charCode >> 6]; - var param3 = param3Left + BASE64_ALPHABET_HI_6[charCode & 0x3f]; - var index3 = 2 + (param3Left.length - 3) / 4 * 3; - var indexer3 = replaceIndexer(index3); - var postfix3 = '(' + this.replaceString(param3) + ')' + indexer3; - - var postfix = shortestOf(postfix1, postfix2, postfix3); - var replacement = this.resolveConstant('atob').replacement + postfix; - return replacement; - } - - function replaceIndexer(index) - { - var indexStr = _String(index); - var replacement = '[' + replaceStaticString(indexStr) + ']'; - return replacement; - } - - function replaceCharByCharCode(charCode) - { - var fromCharCode = charCode < 0x10000 ? this.findDefinition(FROM_CHAR_CODE) : 'fromCodePoint'; - var fromCharCodeReplacement = this.replaceString(fromCharCode, { optimize: true }); - var arg; - if (charCode === 0) - arg = '[]'; - else if (charCode === 1) - arg = 'true'; - else if (charCode < 10) - arg = '' + charCode; - else - arg = '"' + charCode + '"'; - var argReplacement = this.replaceExpr(arg); - var replacement = - this.replaceExpr('String') + '[' + fromCharCodeReplacement + '](' + argReplacement + ')'; - return replacement; - } - - var REPLACE_OPTIONS = { firstSolution: EMPTY_SOLUTION }; - - var REPLACE_SMALL_B_OPTIONS = - { firstSolution: EMPTY_SOLUTION, optimize: { default: false, toStringOpt: true } }; - - function hexCodeOf(encoder, charCode, hexDigitCount) - { - var optimalB = encoder.findDefinition(OPTIMAL_B); - var charCodeStr = charCode.toString(16); - var hexCodeSmallB; - if (hexDigitCount) - { - var extraZeroCount = hexDigitCount - charCodeStr.length; - hexCodeSmallB = extraZeros(extraZeroCount) + charCodeStr.replace(/fa?$/, 'false'); - } - else - hexCodeSmallB = charCodeStr; - var hexCode = hexCodeSmallB.replace(/b/g, optimalB); - if (optimalB !== 'b' && /(?=.*b.*b)(?=.*c)|(?=.*b.*b.*b)/.test(charCodeStr)) - { - // optimalB is not "b", but the character code is a candidate for toString clustering, which - // only works with "b". - var replacementSmallB = encoder.replaceString(hexCodeSmallB, REPLACE_SMALL_B_OPTIONS); - var replacement = encoder.replaceString(hexCode, REPLACE_OPTIONS); - if (replacementSmallB.length < replacement.length) - hexCode = hexCodeSmallB; - } - return hexCode; - } - - var LOW_UNICODE_ESC_SEQ_CODES; - - function replaceCharByEscSeq(charCode) - { - var escCode; - var appendIndexer; - var toStringOpt; - if (charCode >= 0x10000) - { - escCode = 'u{' + hexCodeOf(this, charCode) + '}'; - appendIndexer = false; - toStringOpt = true; - } - else if (charCode >= 0xfd || charCode in LOW_UNICODE_ESC_SEQ_CODES) - { - escCode = 'u' + hexCodeOf(this, charCode, 4); - appendIndexer = escCode.length > 5; - toStringOpt = true; - } - else - { - escCode = charCode.toString(8); - appendIndexer = false; - toStringOpt = false; - } - var expr = 'Function("return\\"" + ESCAPING_BACKSLASH + "' + escCode + '\\"")()'; - if (appendIndexer) - expr += '[0]'; - var replacement = this.replaceExpr(expr, { default: false, toStringOpt: toStringOpt }); - return replacement; - } - - LOW_UNICODE_ESC_SEQ_CODES = createEmpty(); - - [ - 0x0f, 0x1f, 0x2f, 0x3f, 0x6f, 0x7f, 0xaf, 0xdf, 0xef, - 0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7, 0xfa, - ] - .forEach - ( - function (charCode) - { - LOW_UNICODE_ESC_SEQ_CODES[charCode] = null; - } - ); - - function replaceCharByUnescape(charCode) - { - var hexCode; - var appendIndexer; - var toStringOpt; - if (charCode < 0x100) - { - hexCode = hexCodeOf(this, charCode, 2); - appendIndexer = hexCode.length > 2; - toStringOpt = false; - } - else - { - hexCode = 'u' + hexCodeOf(this, charCode, 4); - appendIndexer = hexCode.length > 5; - toStringOpt = true; - } - var expr = 'unescape("%' + hexCode + '")'; - if (appendIndexer) - expr += '[0]'; - var replacement = this.replaceExpr(expr, { default: false, toStringOpt: toStringOpt }); - return replacement; - } - - var ATOB_MASK = Feature.ATOB.mask; - - var STATIC_CHAR_CACHE = createEmpty(); - var STATIC_CONST_CACHE = createEmpty(); - var STATIC_ENCODER = new Encoder(maskNew()); - - var BOND_STRENGTH_NONE = 0; - var BOND_STRENGTH_WEAK = 1; - var BOND_STRENGTH_STRONG = 2; - - /** @class Encoder */ - - function Encoder(mask) - { - this.mask = mask; - this._charCache = _Object_create(STATIC_CHAR_CACHE); - this._constCache = _Object_create(STATIC_CONST_CACHE); - this._definitionCache = createEmpty(); - this._optimizers = createEmpty(); - this._stack = []; - } - - function callResolver(encoder, stackName, resolver) - { - var stack = encoder._stack; - var stackIndex = stack.indexOf(stackName); - stack.push(stackName); - try - { - if (~stackIndex) - { - var chain = stack.slice(stackIndex); - var feature = featureFromMask(encoder.mask); - var message = 'Circular reference detected: ' + chain.join(' < ') + ' – ' + feature; - var error = new _SyntaxError(message); - assignNoEnum(error, { chain: chain, feature: feature }); - throw error; - } - resolver.call(encoder); - } - finally - { - stack.pop(); - } - } - - function defaultResolveCharacter(encoder, char) - { - var charCode = char.charCodeAt(); - var atobOpt = charCode < 0x100; - var solution = encoder._createCharDefaultSolution(char, charCode, atobOpt, true, true, true); - return solution; - } - - function evalNumber(preMantissa, lastDigit, exp) - { - var value = +(preMantissa + lastDigit + 'e' + exp); - return value; - } - - function findOptimalSolution(encoder, source, entries, defaultSolutionType) - { - var optimalSolution; - entries.forEach - ( - function (entry, entryIndex) - { - if (encoder.hasFeatures(entry.mask)) - { - var solution = encoder.resolve(entry.definition, source, defaultSolutionType); - if (!optimalSolution || optimalSolution.length > solution.length) - { - optimalSolution = solution; - if (optimalSolution.entryCode == null) - optimalSolution.entryCode = entryIndex; - } - } - }, - encoder - ); - return optimalSolution; - } - - function formatPositiveNumber(number) - { - function getMantissa() - { - var lastDigitIndex = usefulDigits - 1; - var preMantissa = digits.slice(0, lastDigitIndex); - var lastDigit = +digits[lastDigitIndex]; - var value = evalNumber(preMantissa, lastDigit, exp); - for (;;) - { - var decreasedLastDigit = lastDigit - 1; - var newValue = evalNumber(preMantissa, decreasedLastDigit, exp); - if (newValue !== value) - break; - lastDigit = decreasedLastDigit; - } - var mantissa = preMantissa + lastDigit; - return mantissa; - } - - var str; - var match = /^(\d+)(?:\.(\d+))?(?:e(.+))?$/.exec(number); - var digitsAfterDot = match[2] || ''; - var digits = (match[1] + digitsAfterDot).replace(/^0+/, ''); - var usefulDigits = digits.search(/0*$/); - var exp = (match[3] | 0) - digitsAfterDot.length + digits.length - usefulDigits; - var mantissa = getMantissa(); - if (exp >= 0) - { - if (exp < 10) - str = mantissa + extraZeros(exp); - else if (exp % 100 === 99 && (exp > 99 || mantissa[1])) - str = mantissa.replace(/.$/, '.$&e') + (exp + 1); - else - str = mantissa + 'e' + exp; - } - else - { - if (exp >= -mantissa.length) - str = mantissa.slice(0, exp) + '.' + mantissa.slice(exp); - else - { - var extraZeroCount = -mantissa.length - exp; - var extraLength = APPEND_LENGTH_OF_DOT + APPEND_LENGTH_OF_DIGIT_0 * extraZeroCount; - str = - replaceNegativeExponential(mantissa, exp, extraLength) || - '.' + extraZeros(extraZeroCount) + mantissa; - } - } - return str; - } - - function getMultiDigitLength(str) - { - var appendLength = 0; - _Array_prototype_forEach_call - ( - str, - function (digit) - { - var digitAppendLength = APPEND_LENGTH_OF_DIGITS[digit]; - appendLength += digitAppendLength; - } - ); - return appendLength; - } - - function getReplacers(optimize) - { - var replaceString = - function (encoder, str, options) - { - options.optimize = optimize; - var replacement = encoder.replaceString(str, options); - if (!replacement) - throwSyntaxError(encoder, 'String too complex'); - return replacement; - }; - var strReplacer = - function (encoder, str, screwMode) - { - var options = { screwMode: screwMode }; - var replacement = replaceString(encoder, str, options); - return replacement; - }; - var strAppender = - function (encoder, str, firstSolution) - { - var options = { firstSolution: firstSolution, screwMode: SCREW_AS_STRING }; - var replacement = replaceString(encoder, str, options); - return replacement; - }; - var replacers = - { appendString: strAppender, identifier: replaceIdentifier, string: strReplacer }; - return replacers; - } - - function isStringUnit(unit) - { - var strUnit = typeof unit.value === 'string' && !unit.mod && !unit.pmod && !unit.ops.length; - return strUnit; - } - - function replaceIdentifier(encoder, identifier, bondStrength) - { - var solution; - if (identifier in encoder.constantDefinitions) - solution = encoder.resolveConstant(identifier); - else - solution = SIMPLE[identifier]; - if (!solution) - throwSyntaxError(encoder, 'Undefined identifier ' + identifier); - var groupingRequired = - bondStrength && solution.isLoose || - bondStrength > BOND_STRENGTH_WEAK && solution.replacement[0] === '!'; - var replacement = solution.replacement; - if (groupingRequired) - replacement = '(' + replacement + ')'; - return replacement; - } - - function replaceMultiDigitNumber(number) - { - var str = formatPositiveNumber(number); - var replacement = replaceStaticString(str); - return replacement; - } - - function replaceNegativeExponential(mantissa, exp, rivalExtraLength) - { - var extraZeroCount; - if (exp % 100 > 7 - 100) - { - if (exp % 10 > -7) - extraZeroCount = 0; - else - extraZeroCount = 10 + exp % 10; - } - else - extraZeroCount = 100 + exp % 100; - mantissa += extraZeros(extraZeroCount); - exp -= extraZeroCount; - var extraLength = - APPEND_LENGTH_OF_DIGIT_0 * extraZeroCount + - APPEND_LENGTH_OF_SMALL_E + - APPEND_LENGTH_OF_MINUS + - getMultiDigitLength(_String(-exp)); - if (extraLength < rivalExtraLength) - { - var str = mantissa + 'e' + exp; - return str; - } - } - - function replacePrimaryExpr(encoder, unit, bondStrength, unitIndices, maxLength, replacers) - { - var MIN_APPEND_LENGTH = 3; - - var output; - var terms; - var identifier; - var strAppender = replacers.appendString; - if (terms = unit.terms) - { - var count = terms.length; - var maxCoreLength = maxLength - (bondStrength ? 2 : 0); - var canAppendString = false; - for (var index = 0; index < count; ++index) - { - var term = terms[index]; - var termUnitIndices = count > 1 ? unitIndices.concat(index) : unitIndices; - if (strAppender && isStringUnit(term)) - { - var firstSolution; - if (output) - { - if (!canAppendString) - { - throwSyntaxError - ( - encoder, - 'Unsupported concatenation of a string to a potentially non-string ' + - 'expression' - ); - } - firstSolution = - new SimpleSolution(undefined, output, SolutionType.WEAK_PREFIXED_STRING); - } - else - { - firstSolution = undefined; - canAppendString = true; - } - output = strAppender(encoder, term.value, firstSolution); - } - else - { - var maxTermLength = - maxCoreLength - (output ? output.length + 1 : 0) - - MIN_APPEND_LENGTH * (count - index - 1); - var termOutput = - encoder._replaceExpressUnit(term, index, termUnitIndices, maxTermLength, replacers); - if (!termOutput) - return; - if (output) - output += '+' + termOutput; - else - output = termOutput; - } - } - if (bondStrength) - output = '(' + output + ')'; - } - else if (identifier = unit.identifier) - { - var identifierReplacer = replacers.identifier; - output = identifierReplacer(encoder, identifier, bondStrength, unitIndices, maxLength); - } - else - { - var value = unit.value; - if (typeof value === 'string') - { - var strReplacer = replacers.string; - var screwMode = bondStrength ? SCREW_AS_BONDED_STRING : SCREW_AS_STRING; - output = strReplacer(encoder, value, screwMode, unitIndices, maxLength); - } - else if (_Array_isArray(value)) - { - if (value.length) - { - var replacement = - encoder._replaceExpressUnit - (value[0], false, unitIndices, maxLength - 2, replacers); - if (replacement) - output = '[' + replacement + ']'; - } - else if (!(maxLength < 2)) - output = '[]'; - } - else - { - if (typeof value === 'number' && value === value) - { - var abs = _Math_abs(value); - var negative = value < 0 || 1 / value < 0; - var str; - if (abs === 0) - str = '0'; - else if (abs === Infinity) - str = JSFUCK_INFINITY; - else - str = formatPositiveNumber(abs); - if (negative) - str = '-' + str; - output = replaceStaticString(str); - if (str.length > 1) - output = '+(' + output + ')'; - if (bondStrength) - output = '(' + output + ')'; - } - else - output = replaceIdentifier(STATIC_ENCODER, _String(value), bondStrength); - if (output.length > maxLength) - return; - } - } - return output; - } - - function resolveCharByDefaultMethod(encoder, char, charCode, replaceChar, entryCode) - { - var replacement = replaceChar.call(encoder, charCode); - var solution = new SimpleSolution(char, replacement, SolutionType.STRING); - solution.entryCode = entryCode; - return solution; - } - - function throwSyntaxError(encoder, message) - { - var stack = encoder._stack; - var stackLength = stack.length; - if (stackLength) - message += ' in the definition of ' + stack[stackLength - 1]; - throw new _SyntaxError(message); - } - - var matchSimpleAt = - (function () - { - var matchSimpleAt; - var pattern = _Object_keys(SIMPLE).join('|'); - var regExp = tryCreateRegExp(pattern, 'y'); - if (regExp) - { - matchSimpleAt = - function (str, index) - { - regExp.lastIndex = index; - var match = str.match(regExp); - if (match) - return match[0]; - }; - } - else - { - matchSimpleAt = - function (str, index) - { - for (var simple in SIMPLE) - { - var substr = str.substr(index, simple.length); - if (substr === simple) - return simple; - } - }; - } - return matchSimpleAt; - } - )(); - - assignNoEnum - ( - Encoder.prototype, - { - _createCharDefaultSolution: - function (char, charCode, atobOpt, charCodeOpt, escSeqOpt, unescapeOpt) - { - var solution; - if (atobOpt && this.hasFeatures(ATOB_MASK)) - { - solution = - resolveCharByDefaultMethod(this, char, charCode, replaceCharByAtob, 'atob'); - } - else - { - var solutions = []; - if (charCodeOpt) - { - solution = - resolveCharByDefaultMethod - (this, char, charCode, replaceCharByCharCode, 'char-code'); - solutions.push(solution); - } - if (escSeqOpt) - { - solution = - resolveCharByDefaultMethod - (this, char, charCode, replaceCharByEscSeq, 'esc-seq'); - solutions.push(solution); - } - if (unescapeOpt) - { - solution = - resolveCharByDefaultMethod - (this, char, charCode, replaceCharByUnescape, 'unescape'); - solutions.push(solution); - } - solution = shortestOf.apply(null, solutions); - } - return solution; - }, - - _getPaddingBlock: - function (length) - { - var paddingBlock = R_PADDINGS[length]; - if (paddingBlock !== undefined) - return paddingBlock; - throwSyntaxError(this, 'Undefined regular padding block with length ' + length); - }, - - _replaceCharByAtob: replaceCharByAtob, - - _replaceCharByCharCode: replaceCharByCharCode, - - _replaceCharByEscSeq: replaceCharByEscSeq, - - _replaceCharByUnescape: replaceCharByUnescape, - - _replaceExpressUnit: - function (unit, bond, unitIndices, maxLength, replacers) - { - var mod = unit.mod || ''; - var pmod = unit.pmod || ''; - var groupingRequired = bond && mod[0] === '+'; - var maxCoreLength = - maxLength - (mod ? (groupingRequired ? 2 : 0) + mod.length : 0) - pmod.length; - var ops = unit.ops; - var opCount = ops.length; - var primaryExprBondStrength = - opCount || pmod ? - BOND_STRENGTH_STRONG : bond || mod ? BOND_STRENGTH_WEAK : BOND_STRENGTH_NONE; - var output = - replacePrimaryExpr - (this, unit, primaryExprBondStrength, unitIndices, maxCoreLength, replacers); - if (output) - { - for (var index = 0; index < opCount; ++index) - { - var op = ops[index]; - var type = op.type; - if (type === 'call') - { - output += '()'; - if (output.length > maxCoreLength) - return; - } - else - { - var opOutput; - var opUnitIndices = unitIndices.concat(index + 1); - var maxOpLength = maxCoreLength - output.length - 2; - var str = op.str; - if (str != null) - { - var strReplacer = replacers.string; - opOutput = - strReplacer(this, str, SCREW_NORMAL, opUnitIndices, maxOpLength); - } - else - { - opOutput = - this._replaceExpressUnit - (op, false, opUnitIndices, maxOpLength, replacers); - } - if (!opOutput) - return; - if (type === 'get') - output += '[' + opOutput + ']'; - else - output += '(' + opOutput + ')'; - } - } - output += pmod; - if (mod) - { - output = mod + output; - if (groupingRequired) - output = '(' + output + ')'; - } - } - return output; - }, - - _resolveCharInExpr: - function (char, expr, index, paddingEntries, paddingShifts) - { - if (!paddingEntries) - throwSyntaxError(this, 'Missing padding entries for index ' + index); - var padding = this.findDefinition(paddingEntries); - var paddingBlock; - var shiftedIndex; - if (typeof padding === 'number') - { - var paddingShift = this.findDefinition(paddingShifts); - paddingBlock = this._getPaddingBlock(padding); - shiftedIndex = index + padding + paddingShift; - } - else - { - paddingBlock = padding.block; - shiftedIndex = padding.shiftedIndex; - } - var fullExpr = '(' + paddingBlock + '+' + expr + ')[' + shiftedIndex + ']'; - var replacement = this.replaceExpr(fullExpr); - var solution = new SimpleSolution(char, replacement, SolutionType.STRING); - return solution; - }, - - _resolveCharInNativeFunction: - function (char, offset, getPaddingEntries, paddingShifts) - { - var nativeFunctionInfo = this.findDefinition(NATIVE_FUNCTION_INFOS); - var expr = nativeFunctionInfo.expr; - var index = offset + nativeFunctionInfo.shift; - var paddingEntries = getPaddingEntries(index); - var solution = - this._resolveCharInExpr(char, expr, index, paddingEntries, paddingShifts); - return solution; - }, - - constantDefinitions: CONSTANTS, - - findDefinition: findDefinition, - - hasFeatures: - function (mask) - { - var included = maskIncludes(this.mask, mask); - return included; - }, - - // The maximum value that can be safely used as the first group threshold of a ScrewBuffer. - // "Safely" means such that the extreme decoding test is passed in all engines. - // This value is typically limited by the free memory available on the stack, and since the - // memory layout of the stack changes at runtime in an unstable way, the maximum safe value - // cannot be determined exactly. - // The lowest recorded value so far is 1844, measured in an Android Browser 4.2.2 running on - // an Intel Atom emulator. - // Internet Explorer on Windows Phone occasionally failed the extreme decoding test in a - // non-reproducible manner, although the issue seems to be related to the output size rather - // than the grouping threshold setting. - maxGroupThreshold: 1800, - - replaceExpr: - function (expr, optimize) - { - var unit = expressParseCached$1(expr); - if (!unit || unit === true) - throwSyntaxError(this, 'Syntax error'); - var replacers = getReplacers(optimize); - var replacement = this._replaceExpressUnit(unit, false, [], NaN, replacers); - return replacement; - }, - - /** - * Replaces a given string with equivalent JSFuck code. - * - * @function Encoder#replaceString - * - * @param {string} str - * The string to replace. - * - * @param {object} [options={ }] - * An optional object specifying replacement options. - * - * @param {SimpleSolution} [options.firstSolution] - * An optional solution to be prepended to the replacement string. - * - * @param {number} [options.maxLength=(NaN)] - * The maximum length of the replacement expression. - * - * If the replacement expression exceeds the specified length, the return value is - * `undefined`. - * - * If this parameter is `NaN`, then no length limit is imposed. - * - * @param {boolean|object} [options.optimize=false] - * Specifies which optimizations should be attempted. - * - * Optimizations may reduce the length of the replacement string, but they also reduce the - * performance and may lead to unwanted circular dependencies when resolving definitions. - * - * This parameter can be set to a boolean value in order to turn all optimizations on - * (`true`) or off (`false`). - * In order to turn specific optimizations on or off, specify an object that maps - * optimization names with the suffix "Opt" to a boolean setting. - * Currently supported settings are `commaOpt`, `complexOpt` `surrogatePairOpt`, - * `toStringOpt` and `default`. - * When an object is specified, undefined optimization settings have the value specified by - * `default`, or `true` if `default` is not specified. - * - * @param {number} [options.screwMode=SCREW_NORMAL] - * Specifies how the replacement will be used. - * - *
- * - *
SCREW_NORMAL
- *
- * Generates code suitable for being used as a function argument or indexer. - * The generated replacement is not guaranteed to evaluate to a string but will have the - * string representation specified by the input string. - *
- * - *
SCREW_AS_STRING
- *
- * Generates code suitable for being used as a standalone string or as the start of a - * concatenated string or as an argument to a function that expects a string. - *
- * - *
SCREW_AS_BONDED_STRING
- *
- * Generates code suitable for being used with any unary operators, as a property access - * target, or in concatenation with any expression. - *
- * - *
- * - * @returns {string|undefined} - * The replacement string or `undefined`. - */ - - replaceString: - function (str, options) - { - options = options || { }; - var optimizerList = this._getOptimizerList(str, options.optimize); - var screwMode = options.screwMode || SCREW_NORMAL; - var buffer = new ScrewBuffer(screwMode, this.maxGroupThreshold, optimizerList); - var firstSolution = options.firstSolution; - var maxLength = options.maxLength; - if (firstSolution) - { - buffer.append(firstSolution); - if (buffer.length > maxLength) - return; - } - var length = str.length; - for (var index = 0; index < length;) - { - var solution; - var simple = matchSimpleAt(str, index); - if (simple) - { - index += simple.length; - solution = SIMPLE[simple]; - } - else - { - var char = str[index++]; - solution = this.resolveCharacter(char); - } - if (!buffer.append(solution) || buffer.length > maxLength) - return; - } - var replacement = _String(buffer); - if (!(replacement.length > maxLength)) - return replacement; - }, - - resolve: - function (definition, source, defaultSolutionType) - { - var solution; - var type = typeof definition; - if (type === 'function') - solution = definition.call(this, source); - else - { - var expr; - var solutionType; - var optimize; - if (type === 'object') - { - expr = definition.expr; - solutionType = definition.solutionType; - optimize = definition.optimize; - } - else - expr = definition; - var replacement = this.replaceExpr(expr, optimize); - if (solutionType == null) - { - solutionType = - defaultSolutionType != null ? defaultSolutionType : SolutionType.STRING; - } - solution = new SimpleSolution(source, replacement, solutionType); - } - return solution; - }, - - resolveCharacter: - function (char) - { - var charCache = this._charCache; - var solution = charCache[char]; - if (solution === undefined) - { - callResolver - ( - this, - _JSON_stringify(char), - function () - { - var entries = CHARACTERS[char]; - if (!entries || _Array_isArray(entries)) - { - if (entries) - solution = findOptimalSolution(this, char, entries); - if (!solution) - solution = defaultResolveCharacter(this, char); - } - else - { - solution = STATIC_ENCODER.resolve(entries, char); - solution.entryCode = 'static'; - charCache = STATIC_CHAR_CACHE; - } - charCache[char] = solution; - } - ); - } - return solution; - }, - - resolveConstant: - function (constant) - { - var constCache = this._constCache; - var solution = constCache[constant]; - if (solution === undefined) - { - callResolver - ( - this, - constant, - function () - { - var entries = this.constantDefinitions[constant]; - if (_Array_isArray(entries)) - { - solution = - findOptimalSolution(this, constant, entries, SolutionType.OBJECT); - } - else - { - solution = - STATIC_ENCODER.resolve(entries, undefined, SolutionType.OBJECT); - constCache = STATIC_CONST_CACHE; - } - constCache[constant] = solution; - } - ); - } - return solution; - }, - } - ); - - initStaticEncoder(STATIC_ENCODER); - - function createFigurator(startValues, joiner) - { - function createFigure(value, sortLength) - { - var figure = _Object(value); - figure.sortLength = sortLength; - return figure; - } - - function createPart(value, sortLength, isJoiner) - { - var part = createFigure(value, sortLength); - part.isJoiner = isJoiner; - return part; - } - - function figurator(index) - { - while (figures.length <= index) - { - appendableParts.forEach(growFigures); - var newFigures = figureList[currentSortLength++]; - if (newFigures) - _Array_prototype_push_apply(figures, newFigures); - } - var figure = figures[index]; - return figure; - } - - function growFigures(part) - { - var oldFigureSortLength = currentSortLength - part.sortLength; - var oldFigures = figureList[oldFigureSortLength]; - if (oldFigures) - { - oldFigures.forEach - ( - function (oldFigure) - { - var newValue = oldFigure + part; - pushFigure(newValue, currentSortLength, part); - } - ); - } - } - - function pushFigure(value, sortLength, part) - { - if (!(value in usedValueSet)) - { - usedValueSet[value] = null; - var figures = figureList[sortLength] || (figureList[sortLength] = []); - var figure = createFigure(value, sortLength); - figures.push(figure); - part.isJoiner = false; - for (;; ++joinerIndex) - { - var joinerPart = PARTS[joinerIndex]; - if (!joinerPart) - break; - if (joinerPart.isJoiner) - { - figure.joiner = joinerPart.valueOf(); - break; - } - } - } - } - - var PARTS = - [ - createPart('', 0, false), - createPart('false', 4, true), - createPart('true', 5, true), - createPart('0', APPEND_LENGTH_OF_DIGIT_0, true), - createPart('undefined', 7, true), - createPart('1', 8, true), - createPart('NaN', 9, true), - createPart('2', 12, true), - createPart('f', 14, false), - createPart('t', 15, false), - createPart('a', 16, false), - createPart('3', 17, true), - createPart('N', 17, false), - createPart('r', 17, false), - createPart('u', 17, false), - createPart('n', 19, false), - createPart('l', 20, false), - createPart('4', 22, true), - createPart('d', 23, false), - createPart('s', 25, false), - createPart('e', APPEND_LENGTH_OF_SMALL_E, false), - createPart('5', 27, true), - createPart('i', 28, false), - createPart('6', 32, true), - createPart('7', 37, true), - createPart('8', 42, true), - createPart('9', 47, true), - ]; - - var currentSortLength = 0; - var figureList = []; - var figures = []; - var joinerIndex = 0; - var usedValueSet = createEmpty(); - var appendableParts = - PARTS.filter - ( - function (part) - { - var value = part.valueOf(); - if (startValues.indexOf(value) >= 0) - pushFigure(value, part.sortLength, part); - else if (value !== joiner) - return true; - } - ); - - return figurator; - } - - var FALSE_FREE_DELIMITER = { joiner: 'false', separator: 'false' }; - var FALSE_TRUE_DELIMITER = { joiner: '', separator: 'Function("return/(?=false|true)/")()' }; - - var REPLACERS = - { - identifier: - function (encoder, identifier, bondStrength, unitIndices, maxLength) - { - var unitPath = getUnitPath(unitIndices); - var replacement = - encodeAndWrapText(encoder, 'return ' + identifier, wrapWithCall, unitPath, maxLength); - return replacement; - }, - string: - function (encoder, str, screwMode, unitIndices, maxLength) - { - var unitPath = getUnitPath(unitIndices); - var replacement = encodeText(encoder, str, screwMode, unitPath, maxLength); - return replacement; - }, - }; - - var STRATEGIES; - - function callStrategies(encoder, input, options, strategyNames, unitPath) - { - var output; - var inputLength = input.length; - var perfLog = encoder.perfLog; - var perfInfoList = []; - perfInfoList.name = unitPath; - perfInfoList.inputLength = inputLength; - perfLog.push(perfInfoList); - var inputData = _Object(input); - _Object_keys(options).forEach - ( - function (optName) - { - inputData[optName] = options[optName]; - } - ); - var usedPerfInfo; - strategyNames.forEach - ( - function (strategyName) - { - var strategy = STRATEGIES[strategyName]; - var perfInfo = { strategyName: strategyName }; - var perfStatus; - if (inputLength < strategy.minInputLength) - perfStatus = 'skipped'; - else if (!encoder.hasFeatures(strategy.mask)) - perfStatus = 'unsuited'; - else - { - encoder.perfLog = perfInfo.perfLog = []; - var before = new _Date(); - var maxLength = output != null ? output.length : NaN; - var newOutput = strategy.call(encoder, inputData, maxLength); - var time = new _Date() - before; - encoder.perfLog = perfLog; - perfInfo.time = time; - if (newOutput != null) - { - output = newOutput; - if (usedPerfInfo) - usedPerfInfo.status = 'superseded'; - usedPerfInfo = perfInfo; - perfInfo.outputLength = newOutput.length; - perfStatus = 'used'; - } - else - perfStatus = 'incomplete'; - } - perfInfo.status = perfStatus; - perfInfoList.push(perfInfo); - } - ); - return output; - } - - function createCharKeyArrayString - (encoder, input, charMap, insertions, substitutions, forceString, maxLength) - { - var charKeyArray = - _Array_prototype_map_call - ( - input, - function (char) - { - var charKey = charMap[char]; - return charKey; - } - ); - var charKeyArrayStr = - encoder.replaceStringArray(charKeyArray, insertions, substitutions, forceString, maxLength); - return charKeyArrayStr; - } - - function createJSFuckArrayMapping(encoder, arrayStr, mapper, legend) - { - var result = - arrayStr + '[' + encoder.replaceString('map', { optimize: true }) + '](' + - encoder.replaceExpr(mapper, true) + '(' + legend + '))'; - return result; - } - - function createLongStrCodesOutput(encoder, strCodeArrayStr, fromCharCode, arg) - { - var formatter = encoder.findDefinition(FROM_CHAR_CODE_CALLBACK_FORMATTER); - var formatterExpr = formatter(fromCharCode, arg); - var output = - strCodeArrayStr + '[' + encoder.replaceString('map', { optimize: true }) + '](' + - encoder.replaceExpr('Function("return ' + formatterExpr + '")()', true) + ')[' + - encoder.replaceString('join') + ']([])'; - return output; - } - - function createReindexMap(count, radix, amendingCount, coerceToInt) - { - function getSortLength() - { - var length = 0; - _Array_prototype_forEach_call - ( - str, - function (digit) - { - length += digitAppendLengths[digit]; - } - ); - return length; - } - - var index; - var digitAppendLengths = APPEND_LENGTH_OF_DIGITS.slice(0, radix); - var regExp; - var replacer; - if (amendingCount) - { - var firstDigit = radix - amendingCount; - var pattern = '['; - for (index = 0; index < amendingCount; ++index) - { - var digit = firstDigit + index; - digitAppendLengths[digit] = SIMPLE[AMENDINGS[index]].appendLength; - pattern += digit; - } - pattern += ']'; - regExp = _RegExp(pattern, 'g'); - replacer = - function (match) - { - return AMENDINGS[match - firstDigit]; - }; - } - var range = []; - for (index = 0; index < count; ++index) - { - var str = coerceToInt && !index ? '' : index.toString(radix); - var reindexStr = amendingCount ? str.replace(regExp, replacer) : str; - var reindex = range[index] = _Object(reindexStr); - reindex.sortLength = getSortLength(); - reindex.index = index; - } - range.sort - ( - function (reindex1, reindex2) - { - var result = - reindex1.sortLength - reindex2.sortLength || reindex1.index - reindex2.index; - return result; - } - ); - return range; - } - - function createStrCodesEncoding(encoder, inputData, fromCharCode, splitter, radix, maxLength) - { - var input = inputData.valueOf(); - var strCodeCacheKey = 'strCodeCache' + (radix ? 'Radix' + radix : ''); - var cache = inputData[strCodeCacheKey] || (inputData[strCodeCacheKey] = createEmpty()); - var strCodeArray = splitter(input, radix, cache); - var strCodeArrayStr = encoder.replaceFalseFreeArray(strCodeArray, maxLength); - if (strCodeArrayStr) - { - var output; - if (radix) - { - output = - createLongStrCodesOutput - (encoder, strCodeArrayStr, fromCharCode, 'parseInt(undefined,' + radix + ')'); - } - else - { - var long = strCodeArray.length > encoder._maxDecodableArgs; - if (long) - { - output = - createLongStrCodesOutput(encoder, strCodeArrayStr, fromCharCode, 'undefined'); - } - else - { - var returnString = encoder.findDefinition(OPTIMAL_RETURN_STRING); - var str = returnString + '.' + fromCharCode + '('; - output = - encoder.resolveConstant('Function').replacement + - '(' + - encoder.replaceString(str, { optimize: true }) + - '+' + - strCodeArrayStr + - '+' + - encoder.resolveCharacter(')').replacement + - ')()'; - } - } - if (!(output.length > maxLength)) - return output; - } - } - - function encodeAndWrapText(encoder, input, wrapper, unitPath, maxLength) - { - var output; - if (!wrapper || input) - { - var screwMode = !wrapper || wrapper.forceString ? SCREW_AS_STRING : SCREW_NORMAL; - output = encodeText(encoder, input, screwMode, unitPath, maxLength); - if (output == null) - return; - } - else - output = ''; - if (wrapper) - output = wrapper.call(encoder, output); - if (!(output.length > maxLength)) - return output; - } - - function encodeByDblDict - ( - encoder, - initMinCharIndexArrayStrLength, - figurator, - getFigureLegendInsertions, - keyFigureArrayInsertions, - inputData, - maxLength - ) - { - var input = inputData.valueOf(); - var freqList = getFrequencyList(inputData); - var charMap = createEmpty(); - var minCharIndexArrayStrLength = initMinCharIndexArrayStrLength(input); - var figures = - freqList.map - ( - function (freq, index) - { - var figure = figurator(index); - charMap[freq.char] = figure; - minCharIndexArrayStrLength += freq.count * figure.sortLength; - return figure; - } - ); - var dictChars = - freqList.map - ( - function (freq) - { - return freq.char; - } - ); - var legend = encodeDictLegend(encoder, dictChars, maxLength - minCharIndexArrayStrLength); - if (!legend) - return; - var figureLegendInsertions = - encoder._callGetFigureLegendInsertions(getFigureLegendInsertions, figurator, figures); - var figureMaxLength = maxLength - legend.length; - var figureLegend = - encoder.replaceStringArray - (figures, figureLegendInsertions, null, true, figureMaxLength - minCharIndexArrayStrLength); - if (!figureLegend) - return; - var keyFigureArrayStr = - createCharKeyArrayString - ( - encoder, - input, - charMap, - keyFigureArrayInsertions, - null, - true, - figureMaxLength - figureLegend.length - ); - if (!keyFigureArrayStr) - return; - var formatter = encoder.findDefinition(MAPPER_FORMATTER); - var argName = 'undefined'; - var accessor = '.indexOf(' + argName + ')'; - var mapper = formatter(argName, accessor); - var charIndexArrayStr = - createJSFuckArrayMapping(encoder, keyFigureArrayStr, mapper, figureLegend); - var output = encoder.createDictEncoding(legend, charIndexArrayStr, maxLength); - return output; - } - - function encodeDictLegend(encoder, dictChars, maxLength) - { - if (!(maxLength < 0)) - { - var input = dictChars.join(''); - var output = - callStrategies - ( - encoder, - input, - { screwMode: SCREW_AS_STRING }, - ['byCodePointsRadix4', 'byCharCodesRadix4', 'byCodePoints', 'byCharCodes', 'plain'], - 'legend' - ); - if (output && !(output.length > maxLength)) - return output; - } - } - - function encodeText(encoder, input, screwMode, unitPath, maxLength) - { - var output = - callStrategies - ( - encoder, - input, - { screwMode: screwMode }, - [ - 'byDenseFigures', - 'bySparseFigures', - 'byDictRadix5AmendedBy3', - 'byDictRadix4AmendedBy2', - 'byDictRadix4AmendedBy1', - 'byDictRadix5', - 'byDictRadix3AmendedBy1', - 'byDictRadix4', - 'byDict', - 'byCodePointsRadix4', - 'byCharCodesRadix4', - 'byCodePoints', - 'byCharCodes', - 'plain', - ], - unitPath - ); - if (output != null && !(output.length > maxLength)) - return output; - } - - function getDenseFigureLegendInsertions(figurator, figures) - { - var insertions = [FALSE_TRUE_DELIMITER]; - var lastFigure = figurator(figures.length - 1); - var joiner = lastFigure.joiner; - if (joiner != null) - insertions.push({ joiner: joiner, separator: joiner }); - return insertions; - } - - function getFrequencyList(inputData) - { - var freqList = inputData.freqList; - if (!freqList) - { - var charMap = createEmpty(); - _Array_prototype_forEach_call - ( - inputData, - function (char) - { - ( - charMap[char] || - (charMap[char] = { char: char, charCode: char.charCodeAt(), count: 0 }) - ) - .count++; - } - ); - var charList = _Object_keys(charMap); - inputData.freqList = - freqList = - charList.map - ( - function (char) - { - var freq = charMap[char]; - return freq; - } - ) - .sort - ( - function (freq1, freq2) - { - var diff = freq2.count - freq1.count || freq1.charCode - freq2.charCode; - return diff; - } - ); - } - return freqList; - } - - function getSparseFigureLegendInsertions() - { - var insertions = [FALSE_FREE_DELIMITER]; - return insertions; - } - - // The unit path consists of the string of colon-separated unit indices. - function getUnitPath(unitIndices) - { - var unitPath = unitIndices.length ? unitIndices.join(':') : '0'; - return unitPath; - } - - function initMinFalseFreeCharIndexArrayStrLength(input) - { - var minCharIndexArrayStrLength = _Math_max((input.length - 1) * APPEND_LENGTH_OF_FALSE - 3, 0); - return minCharIndexArrayStrLength; - } - - function initMinFalseTrueCharIndexArrayStrLength() - { - return -1; - } - - function splitIntoCharCodes(str, radix, cache) - { - var strCodes = []; - var regExp = /[^]/g; - for (var match; match = regExp.exec(str);) - { - var char = match[0]; - var strCode = cache[char]; - if (strCode == null) - strCode = cache[char] = char.charCodeAt().toString(radix); - strCodes.push(strCode); - } - return strCodes; - } - - function splitIntoCodePoints(str, radix, cache) - { - var strCodes = []; - var regExp = tryCreateRegExp('.', 'gsu') || /[\ud800-\udbff][\udc00-\udfff]|[^]/g; - for (var match; match = regExp.exec(str);) - { - var char = match[0]; - var strCode = cache[char]; - if (strCode == null) - strCode = cache[char] = codePointOf(char).toString(radix); - strCodes.push(strCode); - } - return strCodes; - } - - function undefinedAsString(replacement) - { - if (replacement === '[][[]]') - replacement += '+[]'; - return replacement; - } - - function wrapWithCall(str) - { - var output = this.resolveConstant('Function').replacement + '(' + str + ')()'; - return output; - } - - wrapWithCall.forceString = false; - - function wrapWithEval(str) - { - var output = this.replaceExpr('Function("return eval")()') + '(' + str + ')'; - return output; - } - - wrapWithEval.forceString = true; - - var falseFreeFigurator = createFigurator([''], 'false'); - var falseTrueFigurator = createFigurator(['false', 'true'], ''); - - (function () - { - function defineStrategy(strategy, minInputLength, expressionMode, featureObj) - { - strategy.minInputLength = minInputLength; - if (expressionMode === undefined) - expressionMode = false; - strategy.expressionMode = expressionMode; - if (featureObj === undefined) - featureObj = Feature.DEFAULT; - strategy.mask = featureObj.mask; - return strategy; - } - - STRATEGIES = - { - /* -------------------------------------------------------------------------------------- *\ - - Encodes "NINE" as: - - Function("return String.fromCharCode(" + [78, 73, 78, 69] + ")")() - - (short version) - - Or: - - [78, 73, 78, 69].map(Function( - "return function(undefined){return String.fromCharCode(undefined)}")()).join([]) - - (long version) - - \* -------------------------------------------------------------------------------------- */ - - byCharCodes: - defineStrategy - ( - function (inputData, maxLength) - { - var output = this._encodeByCharCodes(inputData, undefined, maxLength); - return output; - }, - 2 - ), - - /* -------------------------------------------------------------------------------------- *\ - - Encodes "NINE" as: - - [1032, 1021, 1032, 1011].map(Function( - "return function(undefined){return String.fromCharCode(parseInt(undefined,4))}")()).join([]) - - \* -------------------------------------------------------------------------------------- */ - - byCharCodesRadix4: - defineStrategy - ( - function (inputData, maxLength) - { - var output = this._encodeByCharCodes(inputData, 4, maxLength); - return output; - }, - 25 - ), - - /* -------------------------------------------------------------------------------------- *\ - - Like byCharCodes, but uses String.fromCodePoint instead of String.fromCharCode and treats - surrogate pairs as one character. - Requires feature FROM_CODE_POINT. - - \* -------------------------------------------------------------------------------------- */ - - byCodePoints: - defineStrategy - ( - function (inputData, maxLength) - { - var output = this._encodeByCodePoints(inputData, undefined, maxLength); - return output; - }, - 3, - undefined, - Feature.FROM_CODE_POINT - ), - - /* -------------------------------------------------------------------------------------- *\ - - Like byCharCodesRadix4, but uses String.fromCodePoint instead of String.fromCharCode and - treats surrogate pairs as one character. - Requires feature FROM_CODE_POINT. - - \* -------------------------------------------------------------------------------------- */ - - byCodePointsRadix4: - defineStrategy - ( - function (inputData, maxLength) - { - var output = this._encodeByCodePoints(inputData, 4, maxLength); - return output; - }, - 38, - undefined, - Feature.FROM_CODE_POINT - ), - - /* -------------------------------------------------------------------------------------- *\ - - Encodes "NINE" as: - - ["false", "false0", "false", "true"].map(Function( - "return function(undefined){return this.indexOf(undefined)}")().bind(["false", "true", - "false0"])).map("".charAt.bind("NEI")).join([]) - - \* -------------------------------------------------------------------------------------- */ - - byDenseFigures: - defineStrategy - ( - function (inputData, maxLength) - { - var output = this._encodeByDenseFigures(inputData, maxLength); - return output; - }, - 1888 - ), - - /* -------------------------------------------------------------------------------------- *\ - - Encodes "NINE" as: - - "false2falsefalse1".split(false).map("".charAt.bind("NEI")).join([]) - - (split strategy) - - Or: - - [0].concat(2).concat(0).concat(1).map("".charAt.bind("NEI")).join([]) - - (concat strategy) - - \* -------------------------------------------------------------------------------------- */ - - byDict: - defineStrategy - ( - function (inputData, maxLength) - { - var output = this._encodeByDict(inputData, undefined, undefined, maxLength); - return output; - }, - 2 - ), - - /* -------------------------------------------------------------------------------------- *\ - - Encodes "THREE" as: - - "10false0false1falsetruefalsetrue".split(true).join(2).split(false).map(Function( - "return function(undefined){return this[parseInt(undefined,3)]}")().bind("HRET")).join([]) - - (simple) - - Or: - - "10falsetruefalse1falsefalse".split(true).join(2).split(false).map(Function( - "return function(undefined){return this[parseInt(+undefined,3)]}")().bind("ERHT")).join([]) - - (with coercion) - - \* -------------------------------------------------------------------------------------- */ - - byDictRadix3AmendedBy1: - defineStrategy - ( - function (inputData, maxLength) - { - var output = this._encodeByDict(inputData, 3, 1, maxLength); - return output; - }, - 153 - ), - - /* -------------------------------------------------------------------------------------- *\ - - Encodes "TWELVE" as: - - "2false3false0false1false10false0".split(false).map(Function( - "return function(undefined){return this[parseInt(undefined,4)]}")().bind("ELTWV")).join([]) - - (split strategy) - - Or: - - "2false3falsefalse1false10falsefalse".split(false).map(Function( - "return function(undefined){return this[parseInt(+undefined,4)]}")().bind("ELTWV")).join([]) - - (split strategy, with coercion) - - Or: - - [2].concat(3).concat(0).concat(1).concat("10").concat(0).map(Function( - "return function(undefined){return this[parseInt(undefined,4)]}")().bind("ELTWV")).join([]) - - (concat strategy) - - \* -------------------------------------------------------------------------------------- */ - - byDictRadix4: - defineStrategy - ( - function (inputData, maxLength) - { - var output = this._encodeByDict(inputData, 4, 0, maxLength); - return output; - }, - 160 - ), - - /* -------------------------------------------------------------------------------------- *\ - - Encodes "TWELVE" as: - - "1false10falsetruefalse0false2falsetrue".split(true).join(3).split(false).map(Function( - "return function(undefined){return this[parseInt(undefined,4)]}")().bind("LTVEW")).join([]) - - (simple) - - Or: - - "1false10falsefalsetruefalse2false".split(true).join(3).split(false).map(Function( - "return function(undefined){return this[parseInt(+undefined,4)]}")().bind("ETVLW")).join([]) - - (with coercion) - - \* -------------------------------------------------------------------------------------- */ - - byDictRadix4AmendedBy1: - defineStrategy - ( - function (inputData, maxLength) - { - var output = this._encodeByDict(inputData, 4, 1, maxLength); - return output; - }, - 218 - ), - - /* -------------------------------------------------------------------------------------- *\ - - Encodes "TWELVE" as: - - "undefinedfalse10falsetruefalse0false1falsetrue".split(true).join(2).split("undefined").join - (3).split(false).map(Function( - "return function(undefined){return this[parseInt(undefined,4)]}")().bind("LVETW")).join([]) - - (simple) - - Or: - - "undefinedfalse10falsefalsetruefalse1false".split(true).join(2).split("undefined").join(3). - split(false).map(Function("return function(undefined){return this[parseInt(+undefined,4)]}") - ().bind("EVLTW")).join([]) - - (with coercion) - - \* -------------------------------------------------------------------------------------- */ - - byDictRadix4AmendedBy2: - defineStrategy - ( - function (inputData, maxLength) - { - var output = this._encodeByDict(inputData, 4, 2, maxLength); - return output; - }, - 279 - ), - - /* -------------------------------------------------------------------------------------- *\ - - Encodes "SIXTEEN" as: - - "10false1false4false3false0false0false2".split(false).map(Function( - "return function(undefined){return this[parseInt(undefined,5)]}")().bind("EINTXS")).join([]) - - (split strategy) - - Or: - - "10false1false4false3falsefalsefalse2".split(false).map(Function( - "return function(undefined){return this[parseInt(+undefined,5)]}")().bind("EINTXS")).join([] - ) - - (split strategy, with coercion) - - Or: - - ["10"].concat(1).concat(4).concat(3).concat(0).concat(0).concat(2).map(Function( - "return function(undefined){return this[parseInt(undefined,5)]}")().bind("EINTXS")).join([]) - - (concat strategy) - - \* -------------------------------------------------------------------------------------- */ - - byDictRadix5: - defineStrategy - ( - function (inputData, maxLength) - { - var output = this._encodeByDict(inputData, 5, 0, maxLength); - return output; - }, - 223 - ), - - /* -------------------------------------------------------------------------------------- *\ - - Encodes "SIXTEEN" as: - - "1false0false10falseNaNfalsetruefalsetruefalseundefined".split(true).join(2).split( - "undefined").join(3).split(NaN).join(4).split(false).map(Function( - "return function(undefined){return this[parseInt(undefined,5)]}")().bind("ISENTX")).join([]) - - (simple) - - Or: - - "1falsetruefalse10falseNaNfalsefalsefalseundefined".split(true).join(2).split("undefined"). - join(3).split(NaN).join(4).split(false).map(Function( - "return function(undefined){return this[parseInt(+undefined,5)]}")().bind("ESINTX")).join([] - ) - - (with coercion) - - \* -------------------------------------------------------------------------------------- */ - - byDictRadix5AmendedBy3: - defineStrategy - ( - function (inputData, maxLength) - { - var output = this._encodeByDict(inputData, 5, 3, maxLength); - return output; - }, - 602 - ), - - /* -------------------------------------------------------------------------------------- *\ - - Encodes "NINE" as: - - ["", "0", "", "true"].map(Function( - "return function(undefined){return this.indexOf(undefined)}")().bind(["", "true", "0"])).map - ("".charAt.bind("NEI")).join([]) - - \* -------------------------------------------------------------------------------------- */ - - bySparseFigures: - defineStrategy - ( - function (inputData, maxLength) - { - var output = this._encodeBySparseFigures(inputData, maxLength); - return output; - }, - 347 - ), - - /* -------------------------------------------------------------------------------------- *\ - - Encodes any JavaScript expression recognized by the express parser. - - \* -------------------------------------------------------------------------------------- */ - - express: - defineStrategy - ( - function (inputData, maxLength) - { - var input = inputData.valueOf(); - var output = this._encodeExpress(input, maxLength); - return output; - }, - undefined, - true - ), - - /* -------------------------------------------------------------------------------------- *\ - - Encodes any text as a string using only the mininal set of optimizations. - - \* -------------------------------------------------------------------------------------- */ - - plain: - defineStrategy - ( - function (inputData, maxLength) - { - var input = inputData.valueOf(); - var options = - { maxLength: maxLength, optimize: true, screwMode: inputData.screwMode }; - var output = this.replaceString(input, options); - return output; - } - ), - - /* -------------------------------------------------------------------------------------- *\ - - Encodes any text by trying out all plausible strategies. - - \* -------------------------------------------------------------------------------------- */ - - text: - defineStrategy - ( - function (inputData, maxLength) - { - var input = inputData.valueOf(); - var wrapper = inputData.wrapper; - var output = encodeAndWrapText(this, input, wrapper, undefined, maxLength); - return output; - } - ), - }; - } - )(); - - assignNoEnum - ( - Encoder.prototype, - { - _callGetFigureLegendInsertions: - function (getFigureLegendInsertions, figurator, figures) - { - var figureLegendInsertions = getFigureLegendInsertions(figurator, figures); - return figureLegendInsertions; - }, - - _encodeByCharCodes: - function (inputData, radix, maxLength) - { - var fromCharCode = this.findDefinition(FROM_CHAR_CODE); - var output = - createStrCodesEncoding - (this, inputData, fromCharCode, splitIntoCharCodes, radix, maxLength); - return output; - }, - - _encodeByCodePoints: - function (inputData, radix, maxLength) - { - var output = - createStrCodesEncoding - (this, inputData, 'fromCodePoint', splitIntoCodePoints, radix, maxLength); - return output; - }, - - _encodeByDenseFigures: - function (inputData, maxLength) - { - var output = - encodeByDblDict - ( - this, - initMinFalseTrueCharIndexArrayStrLength, - falseTrueFigurator, - getDenseFigureLegendInsertions, - [FALSE_TRUE_DELIMITER], - inputData, - maxLength - ); - return output; - }, - - _encodeByDict: - function (inputData, radix, amendingCount, maxLength) - { - var input = inputData.valueOf(); - var freqList = getFrequencyList(inputData); - var freqListLength = freqList.length; - // Integer coercion is for free without a radix, otherwise it costs a replaced plus - // sign. - var coerceToInt = - !radix || - freqListLength && - freqList[0].count * APPEND_LENGTH_OF_DIGIT_0 > APPEND_LENGTH_OF_PLUS_SIGN; - var radixNum = radix || 10; - var reindexMap = createReindexMap(freqListLength, radixNum, amendingCount, coerceToInt); - var charMap = createEmpty(); - var minCharIndexArrayStrLength = initMinFalseFreeCharIndexArrayStrLength(input); - var dictChars = []; - freqList.forEach - ( - function (freq, index) - { - var reindex = reindexMap[index]; - var char = freq.char; - charMap[char] = reindex; - minCharIndexArrayStrLength += freq.count * reindex.sortLength; - dictChars[reindex.index] = char; - } - ); - var legend = encodeDictLegend(this, dictChars, maxLength - minCharIndexArrayStrLength); - if (!legend) - return; - if (amendingCount) - { - var substitutions = []; - var firstDigit = radixNum - amendingCount; - for (var index = 0; index < amendingCount; ++index) - { - var separator = AMENDINGS[index]; - var digit = firstDigit + index; - var joiner = _String(digit); - var substitution = { separator: separator, joiner: joiner }; - substitutions.push(substitution); - } - } - var charIndexArrayStr = - createCharKeyArrayString - ( - this, - input, - charMap, - [FALSE_FREE_DELIMITER], - substitutions, - false, - maxLength - legend.length - ); - if (!charIndexArrayStr) - return; - var output = - this.createDictEncoding(legend, charIndexArrayStr, maxLength, radix, coerceToInt); - return output; - }, - - _encodeBySparseFigures: - function (inputData, maxLength) - { - var output = - encodeByDblDict - ( - this, - initMinFalseFreeCharIndexArrayStrLength, - falseFreeFigurator, - getSparseFigureLegendInsertions, - [FALSE_FREE_DELIMITER], - inputData, - maxLength - ); - return output; - }, - - _encodeExpress: - function (input, maxLength) - { - var unit = expressParse(input); - if (unit) - { - var output; - if (unit === true) - { - if (!(maxLength < 0)) - output = ''; - } - else - output = this._replaceExpressUnit(unit, false, [], maxLength, REPLACERS); - return output; - } - }, - - _exec: - function (input, wrapper, strategyNames, perfInfo) - { - var perfLog = this.perfLog = []; - var output = callStrategies(this, input, { wrapper: wrapper }, strategyNames); - if (perfInfo) - perfInfo.perfLog = perfLog; - delete this.perfLog; - if (output == null) - throw new _Error('Encoding failed'); - return output; - }, - - _maxDecodableArgs: 65533, // Limit imposed by Internet Explorer. - - createDictEncoding: - function (legend, charIndexArrayStr, maxLength, radix, coerceToInt) - { - var mapper; - if (radix) - { - var formatter = this.findDefinition(MAPPER_FORMATTER); - var argName = this.findDefinition(OPTIMAL_ARG_NAME); - var parseIntArg = (coerceToInt ? '+' : '') + argName; - var accessor = '[parseInt(' + parseIntArg + ',' + radix + ')]'; - mapper = formatter(argName, accessor); - } - else - mapper = '"".charAt.bind'; - var output = - createJSFuckArrayMapping(this, charIndexArrayStr, mapper, legend) + '[' + - this.replaceString('join') + ']([])'; - if (!(output.length > maxLength)) - return output; - }, - - // Array elements may not contain the substring "false", because the value false could be - // used as a separator in the encoding. - replaceFalseFreeArray: - function (array, maxLength) - { - var result = - this.replaceStringArray(array, [FALSE_FREE_DELIMITER], null, false, maxLength); - return result; - }, - - replaceJoinedArrayString: - function (str, maxLength) - { - var options = { maxLength: maxLength, screwMode: SCREW_AS_BONDED_STRING }; - var replacement = replaceStaticString(str, options); - return replacement; - }, - - /** - * An object that exposes properties used to split a string into an array of strings or to - * join array elements into a string. - * - * @typedef Delimiter - * - * @property {string} separator - * An express-parsable expression used as an argument for `String.prototype.split` to split - * a string into an array of strings. - * - * @property {number} joiner - * The joiner can be any string. A joiner is inserted between adjacent strings in an array - * in order to join them into a single string. - */ - - /** - * Replaces a given array of strings with equivalent JSFuck code. - * - * Array elements may only contain characters with static definitions in their string - * representations. - * - * @function Encoder#replaceStringArray - * - * @param {string[]} array - * The string array to replace. Empty arrays are not supported. - * - * @param {Delimiter[]} insertions - * An array of delimiters of which at most one will be used to compose a joined string and - * split it into an array of strings. - * - * The encoder can pick an insertion and insert a joiner between any two adjacent elements - * to mark the boundary between them. The separator is then used to split the concatenated - * string back into its elements. - * - * @param {Delimiter[]|null} [substitutions] - * An array of delimiters, specifying substitutions to be applied to the input elements. - * - * All substitutions are applied on each element of the input array, in the order they are - * specified. - * - * Substitutions are expensive in two ways: they create additional overhead and prevent - * certain optimizations for short arrays to be made. To allow all optimizations to be - * performed, omit this argument or set it to null instead of specifying an empty array. - * - * @param {boolean} [forceString=false] - * Indicates whether the elements in the replacement expression should evaluate to strings. - * - * If this argument is falsy, the elements in the replacement expression may not be equal to - * those in the input array, but will have the same string representation. - * - * Regardless of this argument, the string representation of the value of the whole - * replacement expression will be always the same as the string representation of the input - * array. - * - * @param {number} [maxLength=(NaN)] - * The maximum length of the replacement expression. - * - * If the replacement expression exceeds the specified length, the return value is - * `undefined`. - * - * If this parameter is `NaN`, then no length limit is imposed. - * - * @returns {string|undefined} - * The replacement string or `undefined`. - */ - - replaceStringArray: - function (array, insertions, substitutions, forceString, maxLength) - { - var replacement; - var count = array.length; - // Don't even try the split approach for 3 or less elements if the concat approach can - // be applied. - if (substitutions || count > 3) - { - var preReplacement = - function () - { - // Length of the shortest string replacement "([]+[])". - var STRING_REPLACEMENT_MIN_LENGTH = 7; - - // This is for the overhead of "[" + "](" + ")" plus the length of the shortest - // separator replacement "[]". - var SEPARATOR_MIN_OVERHEAD = 6; - - // This is for the overhead of "[" + "](" + ")" plus the length of the shortest - // joiner replacement "[]". - var JOINER_MIN_OVERHEAD = 6; - - var joinCount = substitutions ? substitutions.length : 0; - var splitCount = joinCount + 1; - var maxSplitReplacementLength = - (maxLength - STRING_REPLACEMENT_MIN_LENGTH) / splitCount - - SEPARATOR_MIN_OVERHEAD; - var splitReplacement = - this.replaceString - ('split', { maxLength: maxSplitReplacementLength, optimize: true }); - if (!splitReplacement) - return; - var preReplacement = ''; - if (joinCount) - { - var maxJoinReplacementLength = - ( - maxLength - STRING_REPLACEMENT_MIN_LENGTH - - splitCount * (splitReplacement.length + SEPARATOR_MIN_OVERHEAD) - ) / - joinCount - - JOINER_MIN_OVERHEAD; - var joinReplacement = - this.replaceString('join', { maxLength: maxJoinReplacementLength }); - if (!joinReplacement) - return; - substitutions.forEach - ( - function (substitution) - { - var separatorReplacement = - undefinedAsString(this.replaceExpr(substitution.separator)); - var joinerReplacement = - undefinedAsString(this.replaceString(substitution.joiner)); - preReplacement += - '[' + splitReplacement + '](' + separatorReplacement + ')[' + - joinReplacement + '](' + joinerReplacement + ')'; - }, - this - ); - } - preReplacement += '[' + splitReplacement + ']'; - return preReplacement; - } - .call(this); - } - if (!substitutions && count > 1) - { - var concatReplacement = - this.replaceString('concat', { maxLength: maxLength, optimize: true }); - } - if (preReplacement) - // Approach 1: (array[0] + joiner + array[1] + joiner + array[2]...).split(separator) - { - // 2 is for the additional overhead of "(" + ")". - var maxBulkLength = maxLength - (preReplacement.length + 2); - var optimalStrReplacement; - var optimalSeparatorReplacement; - insertions.forEach - ( - function (insertion) - { - var str = array.join(insertion.joiner); - var strReplacement = this.replaceJoinedArrayString(str, maxBulkLength); - if (!strReplacement) - return; - var separatorReplacement = - undefinedAsString(this.replaceExpr(insertion.separator)); - var bulkLength = strReplacement.length + separatorReplacement.length; - if (!(bulkLength > maxBulkLength)) - { - maxBulkLength = bulkLength; - optimalStrReplacement = strReplacement; - optimalSeparatorReplacement = separatorReplacement; - } - }, - this - ); - if (optimalStrReplacement) - { - replacement = - optimalStrReplacement + preReplacement + '(' + optimalSeparatorReplacement + - ')'; - maxLength = replacement.length - 1; - } - } - if - ( - !substitutions && - ( - count <= 1 || - concatReplacement && - // 4 is the length of the shortest possible replacement "[[]]". - // 7 is the length of the shortest possible additional overhead for each - // following array element, as in "[" + "](+[])" or "[" + "](![])". - !(4 + (concatReplacement.length + 7) * (count - 1) > maxLength) - ) - ) - // Approach 2: [array[0]].concat(array[1]).concat(array[2])... - { - var arrayReplacement; - var options = { screwMode: forceString ? SCREW_AS_STRING : SCREW_NORMAL }; - if - ( - !array.some - ( - function (element) - { - var elementReplacement = - undefinedAsString(replaceStaticString(element, options)); - if (arrayReplacement) - { - if (elementReplacement === '[]') - elementReplacement = '[[]]'; - arrayReplacement += - '[' + concatReplacement + '](' + elementReplacement + ')'; - } - else - arrayReplacement = '[' + elementReplacement + ']'; - var result = arrayReplacement.length > maxLength; - return result; - } - ) - ) - replacement = arrayReplacement; - } - return replacement; - }, - } - ); - - var codePointOf = - _String.prototype.codePointAt ? - function (char) - { - var codePoint = char.codePointAt(); - return codePoint; - } : - function (char) - { - var codePoint; - if (char.length < 2) - codePoint = char.charCodeAt(); - else - { - var highSurrogateCharCode = char.charCodeAt(0); - var lowSurrogateCharCode = char.charCodeAt(1); - codePoint = codePointFromSurrogatePair(highSurrogateCharCode, lowSurrogateCharCode); - } - return codePoint; - }; - - function appendLengthOf(solution) - { - if (solution.source === ',') - return 0; - } - - function countClusterableCommas(solutions, index) - { - var commaCount = 0; - if (isSingleCharacterSolution(solutions[index])) - { - for - ( - var end = solutions.length - 2; - index < end && - solutions[++index].source === ',' && - isSingleCharacterSolution(solutions[++index]); - ) - ++commaCount; - } - return commaCount; - } - - function getCommaAppendLength(solutions, start, clusterLength) - { - var commaAppendLength = 0; - for (var index = start + clusterLength; (index -= 2) > start;) - commaAppendLength += solutions[index].appendLength; - return commaAppendLength; - } - - function isSingleCharacterSolution(solution) - { - var source = solution.source; - var returnValue = source && source.length === 1; - return returnValue; - } - - function createCommaOptimizer (encoder) - { - function createClusterer(solutions, index, commaCount) - { - var bridgeSolutions = []; - for (var limit = index + 2 * commaCount; index <= limit; index += 2) - { - var solution = solutions[index]; - bridgeSolutions.push(solution); - } - var clusterer = - function () - { - var bridgeChars = - bridgeSolutions.map - ( - function (solution) - { - return solution.source; - } - ); - var source = bridgeChars.join(); - var bridge = bridgeChars.join(''); - var bridgeReplacement = - encoder.replaceString(bridge, { optimize: true, screwMode: SCREW_AS_STRING }); - var replacement = rampReplacement + '(' + bridgeReplacement + ')'; - var solution = new SimpleSolution(source, replacement, SolutionType.OBJECT); - return solution; - }; - return clusterer; - } - - function optimizeSolutions(plan, solutions, bond, forceString) - { - function passFrom(index) - { - while (index < end) - { - var commaCount = countClusterableCommas(solutions, index); - if (commaCount) - { - var clusterLength = 2 * commaCount + 1; - var saving = - getCommaAppendLength(solutions, index, clusterLength) - extraLength; - var singlePart = !index && clusterLength === solutionCount; - if (singlePart) - { - if (forceString) - saving -= 3; // "+[]" - else if (bond) - saving += 2; // "(" + ")" - } - if (index && solutions[index].isWeak) - saving += 2; // Save a pair of parentheses. - if (saving > 0) - { - var clusterer = createClusterer(solutions, index, commaCount); - plan.addCluster(index, clusterLength, clusterer, saving); - } - index += clusterLength + 1; - } - else - index += 2; - } - } - - var solutionCount = solutions.length; - var end = solutionCount - 2; - passFrom(0); - passFrom(1); - } - - var rampReplacement = encoder.replaceExpr('[][SLICE_OR_FLAT].call'); - // Adding 2 for "(" and ")" around the bridge. - var extraLength = rampReplacement.length + 2; - var optimizer = { appendLengthOf: appendLengthOf, optimizeSolutions: optimizeSolutions }; - return optimizer; - } - - var BOND_EXTRA_LENGTH$1 = 2; // Extra length of bonding parentheses "(" and ")". - var NOOP_OPTIMIZER = { appendLengthOf: noop, optimizeSolutions: noop }; - - function createOptimizer$2 - (complex, complexSolution, charSet, optimizedCharAppendLength, appendLengthDiff) - { - function appendLengthOf(solution) - { - var source = solution.source; - if (source != null && source in charSet) - return optimizedCharAppendLength; - } - - function clusterer() - { - return complexSolution; - } - - function matchComplex(solutions, start) - { - for (var index = 0; index < complexLength; ++index) - { - var solutionIndex = start + index; - var solution = solutions[solutionIndex]; - var complexChar = complex[index]; - if (solution.source !== complexChar) - return false; - } - return true; - } - - function optimizeSolutions(plan, solutions, bond, forceString) - { - for (var index = 0, limit = solutions.length - complexLength; index <= limit; ++index) - { - if (matchComplex(solutions, index)) - { - var saving = appendLengthDiff; - if (!limit) - { - if (forceString && !complexSolution.isString) - saving -= APPEND_LENGTH_OF_EMPTY; - else if (bond) - saving += BOND_EXTRA_LENGTH$1; - } - if (saving > 0) - plan.addCluster(index, complexLength, clusterer, saving); - } - } - } - - var complexLength = complex.length; - var optimizer = { appendLengthOf: appendLengthOf, optimizeSolutions: optimizeSolutions }; - return optimizer; - } - - function createCharSet(charInfos, index) - { - var charSet = createEmpty(); - var charInfo; - while (charInfo = charInfos[index++]) - charSet[charInfo.char] = null; - return charSet; - } - - function createComplexOptimizer (encoder, complex, definition) - { - var optimizer; - var discreteAppendLength = 0; - var charMap = createEmpty(); - var charInfos = []; - _Array_prototype_forEach_call - ( - complex, - function (char) - { - var charSolution = encoder.resolveCharacter(char); - var charAppendLength = charSolution.appendLength; - discreteAppendLength += charAppendLength; - var charInfo = charMap[char]; - if (charInfo) - ++charInfo.count; - else - { - charInfo = charMap[char] = - { appendLength: charAppendLength, char: char, count: 1 }; - charInfos.push(charInfo); - } - } - ); - var complexSolution = encoder.resolve(definition, complex); - var solutionAppendLength = complexSolution.appendLength; - var appendLengthDiff = discreteAppendLength - solutionAppendLength; - if (appendLengthDiff + BOND_EXTRA_LENGTH$1 > 0) - { - charInfos.sort - ( - function (charInfo1, charInfo2) - { - var result = charInfo1.appendLength - charInfo2.appendLength; - return result; - } - ); - var restLength = solutionAppendLength; - var restCount = complex.length; - for (var index = 0; restCount; ++index) - { - var charInfo = charInfos[index]; - var charAppendLength = charInfo.appendLength; - if (charAppendLength * restCount > restLength) - break; - var count = charInfo.count; - restLength -= charAppendLength * count; - restCount -= count; - } - var optimizedCharAppendLength = restLength / restCount | 0; - var charSet = createCharSet(charInfos, index); - optimizer = - createOptimizer$2 - (complex, complexSolution, charSet, optimizedCharAppendLength, appendLengthDiff); - } - else - optimizer = NOOP_OPTIMIZER; - return optimizer; - } - - function calculateMinSurrogateAppendLength(encoder) - { - var minLengthByCharCode = encoder._replaceCharByCharCode(100000).length; - var minLengthByEscSeq = encoder._replaceCharByEscSeq(0x10000).length; - var minSurrogateAppendLength = _Math_min(minLengthByCharCode, minLengthByEscSeq) + 1 >> 1; - return minSurrogateAppendLength; - } - - function createClusterer(source, replacement) - { - function clusterer() - { - var solution = new SimpleSolution(source, replacement, SolutionType.STRING); - return solution; - } - - return clusterer; - } - - function getCharCodeInRange(source, from, to) - { - if (source && source.length === 1) - { - var charCode = source.charCodeAt(); - if (charCode >= from && charCode <= to) - return charCode; - } - } - - function createSurrogatePairOptimizer (encoder) - { - var minSurrogateAppendLength = calculateMinSurrogateAppendLength(encoder); - var appendLengthOf = - function (solution) - { - var source = solution.source; - if (source && source.length === 1) - { - var charCode = source.charCodeAt(); - if (charCode >= 0xd800 && charCode <= 0xdfff) - return minSurrogateAppendLength; - } - }; - var optimizeSolutions = - function (plan, solutions, bond) - { - for (var index = solutions.length - 1; index--;) - { - var solution1 = solutions[index]; - var source1 = solution1.source; - var charCode1 = getCharCodeInRange(source1, 0xd800, 0xdbff); - if (!charCode1) - continue; - var solution2 = solutions[index + 1]; - var source2 = solution2.source; - var charCode2 = getCharCodeInRange(source2, 0xdc00, 0xdfff); - if (!charCode2) - continue; - var codePoint = codePointFromSurrogatePair(charCode1, charCode2); - var replacementByCharCode = encoder._replaceCharByCharCode(codePoint); - var replacementByEscSeq = encoder._replaceCharByEscSeq(codePoint); - var replacement = shortestOf(replacementByCharCode, replacementByEscSeq); - var saving = solution1.appendLength + solution2.appendLength - replacement.length - 1; - if (solutions.length === 2 && bond) - saving += 2; // "(" + ")" - if (saving > 0) - { - var source = source1 + source2; - var clusterer = createClusterer(source, replacement); - plan.addCluster(index, 2, clusterer, saving); - } - } - }; - var optimizer = { appendLengthOf: appendLengthOf, optimizeSolutions: optimizeSolutions }; - return optimizer; - } - - // Optimized clusters take the form: - - var BOND_EXTRA_LENGTH = 2; // Extra length of bonding parentheses "(" and ")". - var CLUSTER_EXTRA_LENGTHS = []; - var DECIMAL_DIGIT_MAX_COUNTS = []; - var MAX_RADIX = 36; - var MAX_SAFE_INTEGER = 0x1fffffffffffff; - var MIN_SOLUTION_SPAN = 2; - var RADIX_REPLACEMENTS = []; - - function createOptimizer$1(toStringReplacement) - { - function appendLengthOf(solution) - { - var source = solution.source; - if (source != null && /[bcghjkmopqvwxz]/.test(source)) - { - var appendLength = appendLengthCache[source]; - if (appendLength == null) - { - var minRadix = getMinRadix(source); - var clusterExtraLength = CLUSTER_EXTRA_LENGTHS[minRadix]; - var decimalDigitMaxCount = DECIMAL_DIGIT_MAX_COUNTS[minRadix]; - appendLength = - appendLengthCache[source] = - (clusterBaseLength + clusterExtraLength) / decimalDigitMaxCount | 0; - } - return appendLength; - } - } - - function createClusterer(decimalReplacement, radixReplacement) - { - var clusterer = - function () - { - var replacement = - '(+(' + decimalReplacement + '))[' + toStringReplacement + '](' + radixReplacement + - ')'; - var solution = new SimpleSolution(undefined, replacement, SolutionType.STRING); - return solution; - }; - return clusterer; - } - - function isExpensive(solution) - { - var char = solution.source; - var expensive = appendLengthCache[char] <= solution.appendLength; - return expensive; - } - - function optimizeCluster(plan, start, radix, discreteAppendLength, chars) - { - do - { - var decimal = _parseInt(chars, radix); - if (decimal > MAX_SAFE_INTEGER) - return clusterAppendLength == null; - var decimalReplacement = replaceMultiDigitNumber(decimal); - // Adding 3 for leading "+(" and trailing ")". - var decimalLength = decimalReplacement.length + 3; - var radixReplacement = RADIX_REPLACEMENTS[radix]; - var radixLength = radixReplacement.length; - var clusterAppendLength = clusterBaseLength + decimalLength + radixLength; - var saving = discreteAppendLength - clusterAppendLength; - if (saving > 0) - { - var clusterer = createClusterer(decimalReplacement, radixReplacement); - plan.addCluster(start, chars.length, clusterer, saving); - } - } - while (++radix <= MAX_RADIX); - } - - function optimizeClusters(plan, solutions, start, maxSolutionSpan, bond) - { - var maxDigitChar = ''; - var discreteAppendLength = 0; - var chars = ''; - var solutionSpan = 0; - do - { - var solution = solutions[start + solutionSpan]; - discreteAppendLength += solution.appendLength; - var char = solution.source; - if (maxDigitChar < char) - maxDigitChar = char; - chars += char; - if (++solutionSpan >= MIN_SOLUTION_SPAN && discreteAppendLength > clusterBaseLength) - { - var minRadix = getMinRadix(maxDigitChar); - // If a bonding is required, an integral cluster can save two additional characters - // by omitting a pair of parentheses. - if (bond && !start && solutionSpan === maxSolutionSpan) - discreteAppendLength += BOND_EXTRA_LENGTH; - var clusterTooLong = - optimizeCluster(plan, start, minRadix, discreteAppendLength, chars); - if (clusterTooLong) - break; - } - } - while (solutionSpan < maxSolutionSpan); - } - - function optimizeSequence(plan, solutions, start, end, bond) - { - for (;; ++start) - { - var maxSolutionSpan = end - start; - if (solutions[start].source !== '0') - optimizeClusters(plan, solutions, start, maxSolutionSpan, bond); - if (maxSolutionSpan <= MIN_SOLUTION_SPAN) - break; - } - } - - function optimizeSolutions(plan, solutions, bond) - { - var end; - var expensive; - for (var start = solutions.length; start > 0;) - { - var solution = solutions[--start]; - if (isClusterable(solution)) - { - if (!end) - { - end = start + 1; - expensive = false; - } - if (!expensive) - expensive = isExpensive(solution); - if (expensive && end - start >= MIN_SOLUTION_SPAN) - optimizeSequence(plan, solutions, start, end, bond); - } - else - end = undefined; - } - } - - // Adding 7 for "+(", ")[", "](" and ")". - var clusterBaseLength = toStringReplacement.length + 7; - var appendLengthCache = createEmpty(); - var optimizer = { appendLengthOf: appendLengthOf, optimizeSolutions: optimizeSolutions }; - return optimizer; - } - - function getMinRadix(char) - { - var minRadix = _parseInt(char, MAX_RADIX) + 1; - return minRadix; - } - - function isClusterable(solution) - { - var char = solution.source; - var clusterable = char != null && /[\da-z]/.test(char); - return clusterable; - } - - function createToStringOptimizer (encoder) - { - if (initialize) - { - initialize(); - initialize = null; - } - var toStringReplacement = encoder.resolveConstant('TO_STRING').replacement; - var optimizer = createOptimizer$1(toStringReplacement); - return optimizer; - } - - var initialize = - function () - { - // DECIMAL_MIN_LENGTHS is indexed by decimalDigitMaxCount (the number of digits used to write - // MAX_SAFE_INTEGER in base radix). - // decimalDigitMaxCount may only range from 11 (for radix 36) to 15 (for radix 12). - var DECIMAL_MIN_LENGTHS = - [ - , - , - , - , - , - , - , - , - , - , - , - 48, // 1e10 - 50, // 1e11 - 54, // 1e12 - , - 64, // 1e14 - ]; - - var minLength = Infinity; - for (var radix = MAX_RADIX; radix >= 12; --radix) - { - var replacement = replaceMultiDigitNumber(radix); - var length = replacement.length; - if (length < minLength) - minLength = length; - RADIX_REPLACEMENTS[radix] = replacement; - var decimalDigitMaxCount = DECIMAL_DIGIT_MAX_COUNTS[radix] = - MAX_SAFE_INTEGER.toString(radix).length; - CLUSTER_EXTRA_LENGTHS[radix] = DECIMAL_MIN_LENGTHS[decimalDigitMaxCount] + minLength; - } - }; - - var FROM_CODE_POINT_MASK = Feature.FROM_CODE_POINT.mask; - - function addOptimizer(optimizerList, optName, keyData, extraData) - { - var optimizers = this._optimizers; - var optKey = optName; - if (keyData != null) - optKey += ':' + keyData; - var optimizer = optimizers[optKey]; - if (!optimizer) - { - optimizer = this._createOptimizer(optName, keyData, extraData); - optimizers[optKey] = optimizer; - } - optimizerList.push(optimizer); - } - - function createOptimizer(optName, keyData, extraData) - { - var optimizer; - switch (optName) - { - case 'comma': - optimizer = createCommaOptimizer(this); - break; - case 'complex': - optimizer = createComplexOptimizer(this, keyData, extraData); - break; - case 'surrogatePair': - optimizer = createSurrogatePairOptimizer(this); - break; - case 'toString': - optimizer = createToStringOptimizer(this); - break; - } - return optimizer; - } - - function getOptimizerList(str, optimize) - { - var optimizerList = []; - if (optimize) - { - var optimizeComma; - var optimizeComplex; - var optimizeSurrogatePair; - var optimizeToString; - if (typeof optimize === 'object') - { - var defaultOptValue = 'default' in optimize ? !!optimize.default : true; - var normalizeOption = - function (optName) - { - var optKey = optName + 'Opt'; - var optValue = optKey in optimize ? !!optimize[optKey] : defaultOptValue; - return optValue; - }; - optimizeComma = normalizeOption('comma'); - optimizeComplex = normalizeOption('complex'); - optimizeSurrogatePair = normalizeOption('surrogatePair'); - optimizeToString = normalizeOption('toString'); - } - else - optimizeComma = optimizeComplex = optimizeSurrogatePair = optimizeToString = true; - if (optimizeComma) - { - if (str.indexOf(',') >= 0) - this._addOptimizer(optimizerList, 'comma'); - } - if (optimizeComplex) - { - for (var complex in COMPLEX) - { - var entry = COMPLEX[complex]; - if (this.hasFeatures(entry.mask) && str.indexOf(complex) >= 0) - this._addOptimizer(optimizerList, 'complex', complex, entry.definition); - } - } - if (optimizeSurrogatePair) - { - if - (this.hasFeatures(FROM_CODE_POINT_MASK) && /[\ud800-\udbff][\udc00-\udfff]/.test(str)) - this._addOptimizer(optimizerList, 'surrogatePair'); - } - if (optimizeToString) - this._addOptimizer(optimizerList, 'toString'); - } - return optimizerList; - } - - assignNoEnum - ( - Encoder.prototype, - { - _addOptimizer: addOptimizer, - _createOptimizer: createOptimizer, - _getOptimizerList: getOptimizerList, - } - ); - - var trimJS; - - (function () - { - var regExp = - _RegExp - ('(?:(?!.)\\s)+(?:\\s|\uFEFF|//(?:(?!\\*/|`).)*(?!.)|/\\*(?:(?!`)(?:[^*]|\\*[^/]))*?\\*/)*$'); - - trimJS = - function (str) - { - str = str.replace(/^(?:\s|\uFEFF|\/\/.*(?!.)|\/\*[\s\S]*?\*\/)*(?!.)\s/, ''); - var match = regExp.exec(str); - if (match) - { - var index = match.index; - if (str[index - 1] !== '\\') - str = str.slice(0, index); - } - return str; - }; - } - )(); - - var trimJS$1 = trimJS; - - function cacheEncoder(encoder) - { - encoderCache.set(encoder.mask, encoder); - } - - function encode(input, options) - { - input = esToString(input); - options = options || { }; - var features = options.features; - var runAsData; - var runAs = options.runAs; - if (runAs !== undefined) - runAsData = filterRunAs(runAs, 'runAs'); - else - runAsData = filterRunAs(options.wrapWith, 'wrapWith'); - var wrapper = runAsData[0]; - var strategyNames = runAsData[1]; - if (options.trimCode) - input = trimJS$1(input); - var perfInfo = options.perfInfo; - var encoder = getEncoder(features); - var output = encoder._exec(input, wrapper, strategyNames, perfInfo); - return output; - } - - function filterRunAs(input, name) - { - var STRATEGY_NAMES_BOTH = ['text', 'express']; - var STRATEGY_NAMES_EXPRESS = ['express']; - var STRATEGY_NAMES_TEXT = ['text']; - - if (input === undefined) - return [wrapWithEval, STRATEGY_NAMES_BOTH]; - switch (_String(input)) - { - case 'call': - return [wrapWithCall, STRATEGY_NAMES_TEXT]; - case 'eval': - return [wrapWithEval, STRATEGY_NAMES_TEXT]; - case 'express': - return [, STRATEGY_NAMES_EXPRESS]; - case 'express-call': - return [wrapWithCall, STRATEGY_NAMES_BOTH]; - case 'express-eval': - return [wrapWithEval, STRATEGY_NAMES_BOTH]; - case 'none': - return [, STRATEGY_NAMES_TEXT]; - } - throw new _Error('Invalid value for option ' + name); - } - - function flushEncoderCache() - { - timeout = undefined; - if (!_permanentCaching) - { - resetEncoderCache(); - cacheEncoder(lastEncoder); - } - } - - function getEncoder(features) - { - var mask = getValidFeatureMask(features); - var encoder = encoderCache.get(mask); - if (!encoder) - { - encoder = new Encoder(mask); - cacheEncoder(encoder); - scheduleFlush(); - } - lastEncoder = encoder; - return encoder; - } - - function getValidFeatureMask(features) - { - var mask = features !== undefined ? validMaskFromArrayOrStringOrFeature(features) : maskNew(); - return mask; - } - - function isEncoderInCache(features) - { - var mask = getValidFeatureMask(features); - var returnValue = encoderCache.has(mask); - return returnValue; - } - - function resetEncoderCache() - { - encoderCache = new MaskMap(); - } - - function scheduleFlush() - { - if (!_permanentCaching && !timeout && encoderCache.size > 1) - timeout = _setTimeout(flushEncoderCache); - } - - var JScrewIt = assignNoEnum({ }, { Feature: Feature, encode: encode }); - - var _permanentCaching = false; - var encoderCache; - var lastEncoder; - var timeout; - - resetEncoderCache(); - - assignNoEnum - ( - encode, - { - get permanentCaching() - { - return _permanentCaching; - }, - set permanentCaching(value) - { - _permanentCaching = !!value; - scheduleFlush(); - }, - } - ); - - if (typeof self !== 'undefined') - self.JScrewIt = JScrewIt; - - if (typeof module !== 'undefined') - { - module.exports = JScrewIt; - - // Dummy statements to allow named exports when JScrewIt is imported by ES modules. - exports.Feature = null; - exports.encode = null; - } - - if (typeof NO_DEBUG === 'undefined') - { - (function () - { - function clone(obj) - { - if (typeof obj === 'object') - { - var target = { }; - var names = _Object_keys(obj); - names.forEach - ( - function (name) - { - var value = clone(obj[name]); - target[name] = value; - } - ); - return target; - } - return obj; - } - - function cloneEntries(inputEntries) - { - var outputEntries; - if (inputEntries) - { - if (_Array_isArray(inputEntries)) - outputEntries = inputEntries.map(clone); - else - outputEntries = [createEntryClone(inputEntries, EMPTY_MASK)]; - } - return outputEntries; - } - - function createEncoder(features) - { - var mask = getValidFeatureMask(features); - var encoder = new Encoder(mask); - encoder.perfLog = []; - return encoder; - } - - function createEntryClone(definition, mask) - { - definition = clone(definition); - var entry = { definition: definition, mask: mask }; - return entry; - } - - function createFeatureFromMask(mask) - { - var featureObj = isMaskCompatible(mask) ? featureFromMask(mask) : null; - return featureObj; - } - - function createScrewBuffer(screwMode, groupThreshold, optimizerList) - { - var buffer = new ScrewBuffer(screwMode, groupThreshold, optimizerList); - return buffer; - } - - function defineConstant(encoder, constant, definition) - { - constant = _String(constant); - if (!/^[$A-Z_a-z][$\w]*$/.test(constant)) - throw new _SyntaxError('Invalid identifier ' + _JSON_stringify(constant)); - if (!encoder.hasOwnProperty('constantDefinitions')) - encoder.constantDefinitions = _Object_create(CONSTANTS); - var entries = [define(esToString(definition))]; - encoder.constantDefinitions[constant] = entries; - } - - function getCharacterEntries(char) - { - var entries = cloneEntries(CHARACTERS[char]); - return entries; - } - - function getCharacters() - { - var chars = _Object_keys(CHARACTERS).sort(); - return chars; - } - - function getComplexEntry(complex) - { - var entry = clone(COMPLEX[complex]); - return entry; - } - - function getComplexNames() - { - var names = _Object_keys(COMPLEX).sort(); - return names; - } - - function getConstantEntries(constant) - { - var entries = cloneEntries(CONSTANTS[constant]); - return entries; - } - - function getConstantNames() - { - var names = _Object_keys(CONSTANTS).sort(); - return names; - } - - function getEntries(name) - { - var entries = cloneEntries(ENTRIES[name]); - entries.cacheKey = name; - return entries; - } - - function getStrategies() - { - return STRATEGIES; - } - - var EMPTY_MASK = maskNew(); - - // Miscellaneous entries - var ENTRIES = createEmpty(); - ENTRIES['BASE64_ALPHABET_HI_4:0'] = BASE64_ALPHABET_HI_4[0]; - ENTRIES['BASE64_ALPHABET_HI_4:4'] = BASE64_ALPHABET_HI_4[4]; - ENTRIES['BASE64_ALPHABET_HI_4:5'] = BASE64_ALPHABET_HI_4[5]; - ENTRIES['BASE64_ALPHABET_LO_4:1'] = BASE64_ALPHABET_LO_4[1]; - ENTRIES['BASE64_ALPHABET_LO_4:3'] = BASE64_ALPHABET_LO_4[3]; - - (function () - { - function exposeEntries(name, entries) - { - ENTRIES[name] = entries; - ENTRIES[name + ':available'] = entries.available; - } - - exposeEntries('FROM_CHAR_CODE', FROM_CHAR_CODE); - exposeEntries('FROM_CHAR_CODE_CALLBACK_FORMATTER', FROM_CHAR_CODE_CALLBACK_FORMATTER); - exposeEntries('MAPPER_FORMATTER', MAPPER_FORMATTER); - exposeEntries('OPTIMAL_ARG_NAME', OPTIMAL_ARG_NAME); - exposeEntries('OPTIMAL_B', OPTIMAL_B); - exposeEntries('OPTIMAL_RETURN_STRING', OPTIMAL_RETURN_STRING); - } - )(); - - var debug = - assignNoEnum - ( - { }, - { - DynamicSolution: DynamicSolution, - MaskMap: MaskMap, - MaskSet: MaskSet, - Solution: SimpleSolution, - SolutionType: SolutionType, - calculateSolutionType: calculateSolutionType, - createClusteringPlan: createClusteringPlan, - createEncoder: createEncoder, - createFeatureFromMask: createFeatureFromMask, - createFigurator: createFigurator, - createReindexMap: createReindexMap, - createScrewBuffer: createScrewBuffer, - defineConstant: defineConstant, - getCharacterEntries: getCharacterEntries, - getCharacters: getCharacters, - getComplexEntry: getComplexEntry, - getComplexNames: getComplexNames, - getConstantEntries: getConstantEntries, - getConstantNames: getConstantNames, - getEntries: getEntries, - getStrategies: getStrategies, - isEncoderInCache: isEncoderInCache, - maskAreEqual: maskAreEqual, - maskIncludes: maskIncludes, - maskNew: maskNew, - maskNext: maskNext, - maskUnion: maskUnion, - optimizeSolutions: optimizeSolutions, - trimJS: trimJS$1, - } - ); - - assignNoEnum(JScrewIt, { debug: debug }); - } - )(); - } - -}()); diff --git a/lib/jscrewit.min.js b/lib/jscrewit.min.js deleted file mode 100644 index 0d3c7ee4..00000000 --- a/lib/jscrewit.min.js +++ /dev/null @@ -1,2 +0,0 @@ -// JScrewIt 2.28.0 – https://jscrew.it -!function(){"use strict";function T(n,r){return Yt(r).forEach(function(e){var t=Bt(r,e);t.enumerable=!1,kt(n,e,t)}),n}function u(e){if("symbol"==typeof e)throw new Qt("Cannot convert a symbol to a string");return Xt(e)}function ae(t){var n=Jt();return Yt(t).forEach(function(e){n[e]=t[e]}),n}function a(e,t){try{var n=jt(e,t);if(n.flags===t)return n}catch(e){}}function _(e,t,n,r){var i=(i=this.startLinks)[o=e]||(i[o]=[]),o=i[t];o?o.savingt;){var r=e[n];r&&delete r.saving}}function e(e,t){function n(){this.constructor=e}if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");_n(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}function f(e,t){var n;return(e&(n=0|t))==n&&(e/fn&(t=t/fn|0))==t}function E(e,t){return((e|t)&ln)+(e/sn|t/sn)*sn}function ce(){var n,r,e=(n=An,r=0,on(t=arguments,function(e){var t;Pt(e)?(t=l(e),r|=1n.length)&&e.every(function(e,t){return Ft(e,t=n[t].type)})}(r.typeSetList,e))return r}}function Re(){var e=this.$(92);return new wn(void 0,e,tn.STRING)}function le(e){return"undefined"!==e?"undefined":"falsefalse"}function x(e,t){return _e._({block:e,shiftedIndex:t},arguments,2)}function Ae(e){var t=rr[e];if(!t){var n=ce.AT,r=ce.FF_SRC,i=ce.IE_SRC,o=ce.NO_FF_SRC,u=ce.NO_IE_SRC,a=ce.NO_V8_SRC,c=ce.V8_SRC;switch(e){case 16:t=[x("FBEP_4_S","2 + FH_SHIFT_1"),x("FBP_5_S",21,o),x("FBEP_4_S",20,u),x("RP_0_S","2 + FH_SHIFT_1",a),_e(0,r),_e(0,i),_e(4,c)];break;case 18:case 28:t=[x("RP_5_A + [FBP_7_WA]",e+12),x("RP_4_A + [FBP_8_WA]",e+12,n),x("[RP_3_WA] + FBP_9_U",e+12,o),x("[RP_3_WA] + FBEP_9_U",e+12,u),x("FBEP_4_S",e+4,ce.INCR_CHAR,u),x("RP_0_S",(e+2)/10+" + FH_SHIFT_3",a),_e(0,r),_e(0,i),_e(3,c)];break;case 20:case 30:t=[x("RP_3_WA + [FBP_7_WA]",e+10),x("FBEP_10_S",(e+10)/10+" + FH_SHIFT_1",n),x("[RP_1_WA] + FBP_9_U",e+10,o),x("FBEP_10_S",e+10,u),x("RP_6_S",(e+10)/10+" + FH_SHIFT_1",a),_e(6,r),_e(5,i),_e(0,c)];break;case 21:t=[x("FBEP_9_U","3 + FH_SHIFT_1"),x("FBP_9_U",30,o),x("FBEP_9_U",30,u),x("RP_5_A","3 + FH_SHIFT_1",a),_e(5,r),_e(4,i),_e(0,c)];break;case 23:t=[x("FBP_7_WA",30),x("FBP_9_U",32,o),x("FBEP_9_U",32,u),x("RP_3_WA","3 + FH_SHIFT_1",a),_e(3,r),_e(3,i),_e(0,c)];break;case 25:t=[x("FBP_7_WA",32),x("FBP_5_S",30,o),x("RP_1_WA + FBEP_4_S",30,u),x("RP_1_WA","3 + FH_SHIFT_1",a),_e(1,r),_e(0,i),_e(5,c)];break;case 32:t=[x("FBP_8_WA",40),x("FBP_9_U",41,o),x("FBEP_9_U",41,u),x("RP_4_A","4 + FH_SHIFT_1",a),_e(4,r),_e(3,i),_e(0,c)];break;case 34:t=[x("FBP_7_WA",41),x("RP_1_WA + FBP_5_S",40,o),x("FBEP_9_U",43,u),x("RP_2_WS","4 + FH_SHIFT_1",a),_e(3,r),_e(1,i),_e(6,c)]}t.cacheKey="FBP:"+e,rr[e]=t}return t}function Te(e){var t=ir[e];if(!t){var n=ce.IE_SRC,r=ce.INCR_CHAR,i=ce.NO_IE_SRC;switch(e){case 3:case 13:t=[x("RP_4_A + [FHP_3_WA]",e+7),x("FHP_8_S",e+8,r),_e(6,n),_e(0,i)];break;case 6:case 16:t=[x("FHP_5_A",e+5),_e(3,n),_e(4,i)];break;case 8:case 18:t=[x("FHP_3_WA",e+3),x("RP_2_WS",(e+2)/10+" + FH_SHIFT_1",r),_e(1,n),_e(3,i)];break;case 9:case 19:t=[x("RP_1_WA",(e+1)/10+" + FH_SHIFT_1"),_e(0,n),_e(1,i)];break;case 11:t=[x("RP_0_S","1 + FH_SHIFT_2"),_e(0,n),_e(0,i)];break;case 12:t=[x("FHP_8_S",20),_e(0,n),_e(0,i)];break;case 14:t=[x("[RP_1_WA] + FHP_5_A",20),_e(5,n),_e(6,i)];break;case 15:t=[x("FHP_5_A",20),_e(4,n),_e(5,i)];break;case 17:t=[x("FHP_3_WA",20),x("RP_3_WA","2 + FH_SHIFT_1",r),_e(3,n),_e(3,i)]}t.cacheKey="FHP:"+e,ir[e]=t}return t}function H(e,t){var n=function(e){for(var t=!1;"value"in e&&z(e);){var n=e.value;if(!Pt(n))return null==n&&t?"":Xt(n);if(!(e=n[0]))return"";t=!0}}(t);null!=n&&(t.str=n),t.type="get",U(e,t)}function U(e,t){(e=e.opsStack)[e.length-1].push(t)}function M(e,t){if(!e.mod&&"value"in e&&e.arithmetic&&!e.pmod){var n=e.value;e:for(var r=t.length;r--;)switch(t[r]){case"!":n=!n;break;case"+":n=+n;break;case"-":n=-n;break;case"#":break e}e.value=n,t=t.slice(0,r+1)}t&&(t=Q(t,e.mod||"",e.pmod),e.mod=t,e.arithmetic=!0)}function G(e){var t=re(e,Nr);if(t&&(e=mt('"'+t+'"'),/^[$A-Z_a-z][$\w]*$/.test(e)))return{escaped:e.length>2]+Yn[3&e])+")";2>4]))+he(this,jn[15&e]),r=Fe(1+(r.length-2)/4*3),n="("+this.replaceString(n)+")"+r,e=(r=zn[e>>6])+Xn[63&e],r=Fe(2+(r.length-3)/4*3),r=y(t,n,"("+this.replaceString(e)+")"+r);return this.resolveConstant("atob").replacement+r}function Fe(e){return"["+g(Xt(e))+"]"}function be(e){var t=e<65536?this.findDefinition(Un):"fromCodePoint",t=this.replaceString(t,{optimize:!0}),e=0===e?"[]":1===e?"true":e<10?""+e:'"'+e+'"',e=this.replaceExpr(e);return this.replaceExpr("String")+"["+t+"]("+e+")"}function Pe(e,t,n){var r=e.findDefinition(Wn),i=t.toString(16),n=(t=n?v(n-i.length)+i.replace(/fa?$/,"false"):i).replace(/b/g,r);return"b"!==r&&/(?=.*b.*b)(?=.*c)|(?=.*b.*b.*b)/.test(i)&&(i=e.replaceString(t,Cr),e=e.replaceString(n,hr),i.lengthe.length)&&null==(o=e).entryCode&&(o.entryCode=t))},n),o}function xe(e){var e=(t=/^(\d+)(?:\.(\d+))?(?:e(.+))?$/.exec(e))[2]||"",o=(t[1]+e).replace(/^0+/,""),u=o.search(/0*$/),a=(0|t[3])-e.length+o.length-u,t=function(){for(var e=u-1,t=o.slice(0,e),n=+o[e],r=we(t,n,a);;){var i=n-1;if(we(t,i,a)!==r)break;n=i}return t+n}();return 0<=a?a<10?t+v(a):a%100==99&&(99=-t.length?t.slice(0,a)+"."+t.slice(a):(e=-t.length-a,function(e,t,n){var r,i=-93e.fe?je(e,u,n,"undefined"):(n=e.findDefinition(Bn)+"."+n+"(",e.resolveConstant("Function").replacement+"("+e.replaceString(n,{optimize:!0})+"+"+u+"+"+e.resolveCharacter(")").replacement+")()")).length>o))return e}function ze(e,t,n,r,i){var o;if(!n||t){if(null==(o=Ve(e,t,!n||n.forceString?pr:0,r,i)))return}else o="";if(!((o=n?n.call(e,o):o).length>i))return o}function Qe(e,t,n,r,i,o,u){var a=o.valueOf(),c=$e(o),_=Jt(),s=t(a),o=c.map(function(e,t){return t=n(t),_[e.char]=t,s+=e.count*t.sortLength,t});if((t=qe(e,c.map(function(e){return e.char}),u-s))&&(c=e.Re(r,n,o),r=u-t.length,(c=e.replaceStringArray(o,c,null,!0,r-s))&&(a=Be(e,a,_,i,null,!0,r-c.length))))return i=e.findDefinition(Gn),c=Ye(e,a,i(r="undefined",".indexOf(undefined)"),c),e.createDictEncoding(t,c,u)}function qe(e,t,n){if(!(n<0)&&(t=We(e,t.join(""),{screwMode:pr},["byCodePointsRadix4","byCharCodesRadix4","byCodePoints","byCharCodes","plain"],"legend"))&&!(t.length>n))return t}function Ve(e,t,n,r,i){if(null!=(r=We(e,t,{screwMode:n},["byDenseFigures","bySparseFigures","byDictRadix5AmendedBy3","byDictRadix4AmendedBy2","byDictRadix4AmendedBy1","byDictRadix5","byDictRadix3AmendedBy1","byDictRadix4","byDict","byCodePointsRadix4","byCharCodesRadix4","byCodePoints","byCharCodes","plain"],r))&&!(r.length>i))return r}function Je(e,t){var n=[xr];return null!=(t=e(t.length-1).joiner)&&n.push({joiner:t,separator:t}),n}function $e(e){var t,n,r=e.freqList;return r||(t=Jt(),on(e,function(e){(t[e]||(t[e]={char:e,charCode:e.charCodeAt(),count:0})).count++}),n=Yt(t),e.freqList=r=n.map(function(e){return t[e]}).sort(function(e,t){return t.count-e.count||e.charCode-t.charCode})),r}function Ke(){return[Dr]}function Ze(e){return e.length?e.join(":"):"0"}function et(e){return xt(4*(e.length-1)-3,0)}function tt(){return-1}function nt(e,t,n){for(var r=[],i=/[^]/g;u=i.exec(e);){var o=u[0],u=n[o];null==u&&(u=n[o]=o.charCodeAt().toString(t)),r.push(u)}return r}function rt(e,t,n){for(var r=[],i=a(".","gsu")||/[\ud800-\udbff][\udc00-\udfff]|[^]/g;u=i.exec(e);){var o=u[0],u=n[o];null==u&&(u=n[o]=kr(o).toString(t)),r.push(u)}return r}function it(e){return"[][[]]"===e&&(e+="+[]"),e}function ot(e){return this.resolveConstant("Function").replacement+"("+e+")()"}function ut(e){return this.replaceExpr('Function("return eval")()')+"("+e+")"}function at(e){if(","===e.source)return 0}function ct(e){return(e=e.source)&&1===e.length}function _t(e,t,n){if(e&&1===e.length&&t<=(e=e.charCodeAt())&&e<=n)return e}function st(s){function c(e,t,n,r,i){for(;;++n){var o=r-n;if("0"!==t[n].source&&function(e,t,n,r,i){var o="",u=0,a="",c=0;do{var _=t[n+c];if(u+=_.appendLength,o<(_=_.source)&&(o=_),a+=_,2<=++c&&f{}")(),!0}catch(e){}}},AT:{description:"Existence of the native function Array.prototype.at.",check:function(){return Array.prototype.at}},ATOB:{description:"Existence of the global functions atob and btoa.",check:function(){return"function"==typeof atob&&"function"==typeof btoa},attributes:{"web-worker":"no-atob-in-web-worker"}},BARPROP:{description:'Existence of the global object statusbar having the string representation "[object BarProp]".',check:function(){return"object"==typeof statusbar&&statusbar+""=="[object BarProp]"},attributes:{"web-worker":"web-worker-restriction"}},CAPITAL_HTML:{description:"The property that the various string methods returning HTML code such as String.prototype.big or String.prototype.link have both the tag name and attributes written in capital letters.",check:function(){return""==="".big()&&''==="".fontcolor("")&&''==="".fontsize("")&&''==="".link("")&&""==="".small()&&""==="".strike()&&""==="".sub()&&""==="".sup()}},CONSOLE:{description:'Existence of the global object console having the string representation "[object Console]".\nThis feature may become unavailable when certain browser extensions are active.',check:function(){return"object"==typeof console&&console+""=="[object Console]"},attributes:{"web-worker":"no-console-in-web-worker"}},DOCUMENT:{description:'Existence of the global object document having the string representation "[object Document]".',check:function(){return"object"==typeof document&&document+""=="[object Document]"},includes:["ANY_DOCUMENT"],excludes:["HTMLDOCUMENT"],attributes:{"web-worker":"web-worker-restriction"}},DOMWINDOW:{description:'Existence of the global object self having the string representation "[object DOMWindow]".',check:R.bind(function(e){return"[object DOMWindow]"===e}),includes:["ANY_WINDOW"],excludes:["WINDOW"],attributes:{"web-worker":"web-worker-restriction"}},ESC_HTML_ALL:{description:"The property that double quotation mark, less than and greater than characters in the argument of String.prototype.fontcolor are escaped into their respective HTML entities.",check:function(){return~"".fontcolor('"<>').indexOf(""<>")},includes:["ESC_HTML_QUOT"],excludes:["ESC_HTML_QUOT_ONLY"]},ESC_HTML_QUOT:{description:'The property that double quotation marks in the argument of String.prototype.fontcolor are escaped as """.',check:function(){return~"".fontcolor('"').indexOf(""")}},ESC_HTML_QUOT_ONLY:{description:"The property that only double quotation marks and no other characters in the argument of String.prototype.fontcolor are escaped into HTML entities.",check:function(){return~"".fontcolor('"<>').indexOf(""<>")},includes:["ESC_HTML_QUOT"],excludes:["ESC_HTML_ALL"]},ESC_REGEXP_LF:{description:'Having regular expressions created with the RegExp constructor use escape sequences starting with a backslash to format line feed characters ("\\n") in their string representation.',check:function(){return"\\"===(RegExp("\n")+"")[1]}},ESC_REGEXP_SLASH:{description:'Having regular expressions created with the RegExp constructor use escape sequences starting with a backslash to format slashes ("/") in their string representation.',check:function(){return"\\"===(RegExp("/")+"")[1]}},EXTERNAL:{description:'Existence of the global object sidebar having the string representation "[object External]".',check:function(){return"object"==typeof sidebar&&sidebar+""=="[object External]"},attributes:{"web-worker":"web-worker-restriction"}},FF_SRC:{description:'A string representation of native functions typical for Firefox and Safari.\nRemarkable traits are the lack of line feed characters at the beginning and at the end of the string and the presence of a line feed followed by four whitespaces ("\\n ") before the "[native code]" sequence.',includes:["NO_IE_SRC","NO_V8_SRC"],excludes:["NO_FF_SRC"]},FILL:{description:"Existence of the native function Array.prototype.fill.",check:function(){return Array.prototype.fill}},FLAT:{description:"Existence of the native function Array.prototype.flat.",check:function(){return Array.prototype.flat}},FROM_CODE_POINT:{description:"Existence of the function String.fromCodePoint.",check:function(){return String.fromCodePoint}},FUNCTION_19_LF:{description:'A string representation of dynamically generated functions where the character at index 19 is a line feed ("\\n").',check:function(){return"\n"===(Function()+"")[19]}},FUNCTION_22_LF:{description:'A string representation of dynamically generated functions where the character at index 22 is a line feed ("\\n").',check:function(){return"\n"===(Function()+"")[22]}},GENERIC_ARRAY_TO_STRING:{description:"Ability to call Array.prototype.toString with a non-array binding.",check:function(){try{return Array.prototype.toString.call({}),!0}catch(e){}}},GLOBAL_UNDEFINED:{description:'Having the global function toString return the string "[object Undefined]" when invoked without a binding.',check:function(){return"[object Undefined]"===Function("return toString")()()},includes:["OBJECT_UNDEFINED"]},GMT:{description:'Presence of the text "GMT" after the first 25 characters in the string returned by Date().\nThe string representation of dates is implementation dependent, but most engines use a similar format, making this feature available in all supported engines except Internet Explorer 9 and 10.',check:function(){return/^.{25}GMT/.test(Date())}},HISTORY:{description:'Existence of the global object history having the string representation "[object History]".',check:function(){return"object"==typeof history&&history+""=="[object History]"},attributes:{"web-worker":"web-worker-restriction"}},HTMLAUDIOELEMENT:{description:'Existence of the global object Audio whose string representation starts with "function HTMLAudioElement".',check:function(){return"undefined"!=typeof Audio&&/^function HTMLAudioElement/.test(Audio)},includes:["NO_IE_SRC"],attributes:{"web-worker":"web-worker-restriction"}},HTMLDOCUMENT:{description:'Existence of the global object document having the string representation "[object HTMLDocument]".',check:function(){return"object"==typeof document&&document+""=="[object HTMLDocument]"},includes:["ANY_DOCUMENT"],excludes:["DOCUMENT"],attributes:{"web-worker":"web-worker-restriction"}},IE_SRC:{description:'A string representation of native functions typical for Internet Explorer.\nRemarkable traits are the presence of a line feed character ("\\n") at the beginning and at the end of the string and a line feed followed by four whitespaces ("\\n ") before the "[native code]" sequence.',includes:["NO_FF_SRC","NO_V8_SRC"],excludes:["NO_IE_SRC"]},INCR_CHAR:{description:'The ability to use unary increment operators with string characters, like in ( ++"some string"[0] ): this will result in a TypeError in strict mode in ECMAScript compliant engines.',check:function(){return!0},attributes:{"forced-strict-mode":"char-increment-restriction"}},INTL:{description:"Existence of the global object Intl.",check:function(){return"object"==typeof Intl}},LOCALE_INFINITY:{description:'Language sensitive string representation of Infinity as "∞".',check:function(){return"∞"===(1/0).toLocaleString()}},LOCALE_NUMERALS:{description:'Features shared by all engines capable of localized number formatting, including output of Arabic digits, the Arabic decimal separator "٫", the letters in the first word of the Arabic string representation of NaN ("ليس"), Persian digits and the Persian digit group separator "٬".',check:function(){return Number.prototype.toLocaleString&&o("ar",NaN,/^ليس/)&&o("ar-td",234567890.1,/^٢٣٤٬?٥٦٧٬?٨٩٠٫١/)&&o("fa",1234567890,/^۱٬۲۳۴٬۵۶۷٬۸۹۰/)}},LOCALE_NUMERALS_EXT:{description:'Extended localized number formatting.\nThis includes all features of LOCALE_NUMERALS plus the output of the first three letters in the second word of the Arabic string representation of NaN ("رقم"), Bengali digits, the letters in the Russian string representation of NaN ("не число") and the letters in the Persian string representation of NaN ("ناعدد").',check:function(){return Number.prototype.toLocaleString&&o("ar",NaN,/^ليس.رقم/)&&o("ar-td",234567890.1,/^٢٣٤٬?٥٦٧٬?٨٩٠٫١/)&&o("bn",1234567890,/^১,২৩,৪৫,৬৭,৮৯০/)&&o("fa",1234567890,/^۱٬۲۳۴٬۵۶۷٬۸۹۰/)&&o("fa",NaN,/^ناعد/)&&o("ru",NaN,/^не.число/)},includes:["LOCALE_NUMERALS"]},LOCATION:{description:'Existence of the global object location with the property that Object.prototype.toString.call(location) evaluates to a string that starts with "[object " and ends with "Location]".',check:function(){return"object"==typeof location&&/^\[object .*Location]$/.test(Object.prototype.toString.call(location))}},NAME:{description:"Existence of the name property for functions.",check:function(){return"name"in Function()}},NODECONSTRUCTOR:{description:'Existence of the global object Node having the string representation "[object NodeConstructor]".',check:function(){return"undefined"!=typeof Node&&Node+""=="[object NodeConstructor]"},attributes:{"web-worker":"web-worker-restriction"}},NO_FF_SRC:{description:"A string representation of native functions typical for V8 or for Internet Explorer but not for Firefox and Safari.",check:function(){return/^(\n?)function Object\(\) \{\1 +\[native code]\s\}/.test(Object)},excludes:["FF_SRC"]},NO_IE_SRC:{description:"A string representation of native functions typical for most engines with the notable exception of Internet Explorer.\nA remarkable trait of this feature is the lack of line feed characters at the beginning and at the end of the string.",check:function(){return/^function Object\(\) \{(\n )? \[native code]\s\}/.test(Object)},excludes:["IE_SRC"]},NO_OLD_SAFARI_ARRAY_ITERATOR:{description:'The property that the string representation of Array.prototype.entries() evaluates to "[object Array Iterator]" and that Array.prototype.entries().constructor is the global function Object.',check:function(){if(Array.prototype.entries){var e=[].entries();return e+""=="[object Array Iterator]"&&e.constructor===Object}},includes:["ARRAY_ITERATOR"]},NO_V8_SRC:{description:'A string representation of native functions typical for Firefox, Internet Explorer and Safari.\nA most remarkable trait of this feature is the presence of a line feed followed by four whitespaces ("\\n ") before the "[native code]" sequence.',check:function(){return/^\n?function Object\(\) \{\n \[native code]\s\}/.test(Object)},excludes:["V8_SRC"]},OBJECT_UNDEFINED:{description:'Having the function Object.prototype.toString return the string "[object Undefined]" when invoked without a binding.',check:function(){return"[object Undefined]"===(0,Object.prototype.toString)()},includes:["UNDEFINED"]},PLAIN_INTL:{description:'Existence of the global object Intl having the string representation "[object Object]"',check:function(){return"object"==typeof Intl&&Intl+""=="[object Object]"},includes:["INTL"]},REGEXP_STRING_ITERATOR:{description:'The property that the string representation of String.prototype.matchAll() evaluates to "[object RegExp String Iterator]".',check:function(){return String.prototype.matchAll&&"".matchAll()+""=="[object RegExp String Iterator]"}},SELF:{aliasFor:"ANY_WINDOW"},SELF_OBJ:{description:'Existence of the global object self whose string representation starts with "[object ".',check:R.bind(function(e){return/^\[object /.test(e)}),attributes:{"web-worker":"safari-bug-21820506"}},SHORT_LOCALES:{description:'Support for the two-letter locale name "ar" to format decimal numbers as Arabic numerals.',check:function(){var e=9876430.125,t=e.toLocaleString("ar");return t===e.toLocaleString("ar-td")&&t!==e.toLocaleString("en")},includes:["LOCALE_NUMERALS"]},STATUS:{description:"Existence of the global string status.",check:function(){return"string"==typeof status},attributes:{"web-worker":"web-worker-restriction"}},UNDEFINED:{description:'The property that Object.prototype.toString.call() evaluates to "[object Undefined]".\nThis behavior is specified by ECMAScript, and is enforced by all engines except Android Browser versions prior to 4.1.2, where this feature is not available.',check:function(){return"[object Undefined]"===Object.prototype.toString.call()}},V8_SRC:{description:'A string representation of native functions typical for the V8 engine.\nRemarkable traits are the lack of line feed characters at the beginning and at the end of the string and the presence of a single whitespace before the "[native code]" sequence.',includes:["NO_FF_SRC","NO_IE_SRC"],excludes:["NO_V8_SRC"]},WINDOW:{description:'Existence of the global object self having the string representation "[object Window]".',check:R.bind(function(e){return"[object Window]"===e}),includes:["ANY_WINDOW"],excludes:["DOMWINDOW"],attributes:{"web-worker":"web-worker-restriction"}},DEFAULT:{description:"Minimum feature level, compatible with all supported engines in all environments."},BROWSER:{description:"Features available in all browsers.\nNo support for Node.js.",includes:["ANY_DOCUMENT","ANY_WINDOW","HISTORY","INCR_CHAR","STATUS"],attributes:{"char-increment-restriction":null,"safari-bug-21820506":null,"web-worker-restriction":null}},COMPACT:{description:"All new browsers' features.\nNo support for Node.js and older browsers like Internet Explorer, Safari 9 or Android Browser.",includes:["ARROW","ATOB","BARPROP","ESC_HTML_QUOT_ONLY","ESC_REGEXP_LF","ESC_REGEXP_SLASH","FILL","FLAT","FROM_CODE_POINT","GENERIC_ARRAY_TO_STRING","GLOBAL_UNDEFINED","GMT","HISTORY","HTMLDOCUMENT","INCR_CHAR","INTL","LOCALE_INFINITY","LOCALE_NUMERALS_EXT","LOCATION","NAME","NO_IE_SRC","NO_OLD_SAFARI_ARRAY_ITERATOR","REGEXP_STRING_ITERATOR","STATUS","WINDOW"],attributes:{"char-increment-restriction":null,"web-worker-restriction":null}},ANDRO_4_0:{engine:"Android Browser 4.0",includes:["ATOB","CONSOLE","DOMWINDOW","ESC_HTML_ALL","FUNCTION_22_LF","GMT","HISTORY","HTMLDOCUMENT","INCR_CHAR","LOCATION","NAME","STATUS","V8_SRC"]},ANDRO_4_1:{engine:"Android Browser 4.1 to 4.3",includes:["ATOB","CONSOLE","DOMWINDOW","ESC_HTML_ALL","FUNCTION_22_LF","GENERIC_ARRAY_TO_STRING","GMT","HISTORY","HTMLDOCUMENT","INCR_CHAR","LOCATION","NAME","OBJECT_UNDEFINED","STATUS","V8_SRC"]},ANDRO_4_4:{engine:"Android Browser 4.4",includes:["ATOB","BARPROP","CONSOLE","ESC_HTML_ALL","FUNCTION_22_LF","GENERIC_ARRAY_TO_STRING","GMT","HISTORY","HTMLAUDIOELEMENT","HTMLDOCUMENT","INCR_CHAR","LOCALE_INFINITY","LOCALE_NUMERALS_EXT","LOCATION","NAME","OBJECT_UNDEFINED","PLAIN_INTL","SHORT_LOCALES","STATUS","V8_SRC","WINDOW"],attributes:{"no-console-in-web-worker":null,"web-worker-restriction":null}},CHROME_PREV:{engine:"the previous to current versions of Chrome and Edge",aliasFor:"CHROME_86"},CHROME:{engine:"the current stable versions of Chrome, Edge and Opera",aliasFor:"CHROME_86"},CHROME_86:{engine:"Chrome 86, Edge 86 and Opera 72 or later",includes:["ARROW","ATOB","BARPROP","ESC_HTML_QUOT_ONLY","ESC_REGEXP_LF","ESC_REGEXP_SLASH","FILL","FLAT","FROM_CODE_POINT","FUNCTION_19_LF","GENERIC_ARRAY_TO_STRING","GLOBAL_UNDEFINED","GMT","HISTORY","HTMLDOCUMENT","INCR_CHAR","INTL","LOCALE_INFINITY","LOCALE_NUMERALS_EXT","LOCATION","NAME","NO_OLD_SAFARI_ARRAY_ITERATOR","REGEXP_STRING_ITERATOR","STATUS","V8_SRC","WINDOW"],attributes:{"char-increment-restriction":null,unstable:null,"web-worker-restriction":null}},FF_ESR:{engine:"the current version of Firefox ESR",aliasFor:"FF_78"},FF_PREV:{engine:"the previous to current version of Firefox",aliasFor:"FF_78"},FF_78:{engine:"Firefox 78 to 82",includes:["ARROW","ATOB","BARPROP","ESC_HTML_QUOT_ONLY","ESC_REGEXP_LF","ESC_REGEXP_SLASH","EXTERNAL","FF_SRC","FILL","FLAT","FROM_CODE_POINT","FUNCTION_19_LF","GENERIC_ARRAY_TO_STRING","GLOBAL_UNDEFINED","GMT","HISTORY","HTMLDOCUMENT","INCR_CHAR","LOCALE_INFINITY","LOCALE_NUMERALS_EXT","LOCATION","NAME","NO_OLD_SAFARI_ARRAY_ITERATOR","PLAIN_INTL","REGEXP_STRING_ITERATOR","SHORT_LOCALES","STATUS","WINDOW"],attributes:{"char-increment-restriction":null,unstable:null,"web-worker-restriction":null}},FF:{engine:"the current stable version of Firefox",aliasFor:"FF_83"},FF_83:{engine:"Firefox 83 or later",includes:["ARROW","ATOB","BARPROP","ESC_HTML_QUOT_ONLY","ESC_REGEXP_LF","ESC_REGEXP_SLASH","EXTERNAL","FF_SRC","FILL","FLAT","FROM_CODE_POINT","FUNCTION_19_LF","GENERIC_ARRAY_TO_STRING","GLOBAL_UNDEFINED","GMT","HISTORY","HTMLDOCUMENT","INCR_CHAR","INTL","LOCALE_INFINITY","LOCALE_NUMERALS_EXT","LOCATION","NAME","NO_OLD_SAFARI_ARRAY_ITERATOR","REGEXP_STRING_ITERATOR","SHORT_LOCALES","STATUS","WINDOW"],attributes:{"char-increment-restriction":null,unstable:null,"web-worker-restriction":null}},IE_9:{engine:"Internet Explorer 9",includes:["CAPITAL_HTML","DOCUMENT","ESC_REGEXP_LF","ESC_REGEXP_SLASH","FUNCTION_22_LF","GENERIC_ARRAY_TO_STRING","HISTORY","IE_SRC","INCR_CHAR","STATUS","UNDEFINED","WINDOW"]},IE_10:{engine:"Internet Explorer 10",includes:["ATOB","CAPITAL_HTML","CONSOLE","DOCUMENT","ESC_REGEXP_LF","ESC_REGEXP_SLASH","FUNCTION_22_LF","GENERIC_ARRAY_TO_STRING","HISTORY","IE_SRC","INCR_CHAR","OBJECT_UNDEFINED","STATUS","WINDOW"],attributes:{"char-increment-restriction":null,"web-worker-restriction":null}},IE_11:{engine:"Internet Explorer 11",includes:["ATOB","CAPITAL_HTML","CONSOLE","ESC_REGEXP_LF","ESC_REGEXP_SLASH","FUNCTION_22_LF","GENERIC_ARRAY_TO_STRING","GMT","HISTORY","HTMLDOCUMENT","IE_SRC","INCR_CHAR","LOCALE_NUMERALS","OBJECT_UNDEFINED","PLAIN_INTL","SHORT_LOCALES","STATUS","WINDOW"],attributes:{"char-increment-restriction":null,"web-worker-restriction":null}},IE_11_WIN_10:{engine:"Internet Explorer 11 on Windows 10",includes:["ATOB","CAPITAL_HTML","CONSOLE","ESC_REGEXP_LF","ESC_REGEXP_SLASH","FUNCTION_22_LF","GENERIC_ARRAY_TO_STRING","GMT","HISTORY","HTMLDOCUMENT","IE_SRC","INCR_CHAR","LOCALE_INFINITY","LOCALE_NUMERALS_EXT","OBJECT_UNDEFINED","PLAIN_INTL","SHORT_LOCALES","STATUS","WINDOW"],attributes:{"char-increment-restriction":null,"web-worker-restriction":null}},NODE_0_10:{engine:"Node.js 0.10",includes:["ESC_HTML_ALL","FUNCTION_22_LF","GENERIC_ARRAY_TO_STRING","GLOBAL_UNDEFINED","GMT","INCR_CHAR","NAME","V8_SRC"]},NODE_0_12:{engine:"Node.js 0.12",includes:["ESC_HTML_QUOT_ONLY","FUNCTION_22_LF","GENERIC_ARRAY_TO_STRING","GLOBAL_UNDEFINED","GMT","INCR_CHAR","LOCALE_INFINITY","NAME","NO_OLD_SAFARI_ARRAY_ITERATOR","PLAIN_INTL","V8_SRC"]},NODE_4:{engine:"Node.js 4",includes:["ARROW","ESC_HTML_QUOT_ONLY","ESC_REGEXP_SLASH","FILL","FROM_CODE_POINT","FUNCTION_22_LF","GENERIC_ARRAY_TO_STRING","GLOBAL_UNDEFINED","GMT","INCR_CHAR","LOCALE_INFINITY","NAME","NO_OLD_SAFARI_ARRAY_ITERATOR","PLAIN_INTL","V8_SRC"]},NODE_5:{engine:"Node.js 5 to 9",includes:["ARROW","ESC_HTML_QUOT_ONLY","ESC_REGEXP_SLASH","FILL","FROM_CODE_POINT","FUNCTION_22_LF","GENERIC_ARRAY_TO_STRING","GLOBAL_UNDEFINED","GMT","INCR_CHAR","LOCALE_INFINITY","NAME","NO_OLD_SAFARI_ARRAY_ITERATOR","PLAIN_INTL","V8_SRC"],attributes:{"char-increment-restriction":null}},NODE_10:{engine:"Node.js 10",includes:["ARROW","ESC_HTML_QUOT_ONLY","ESC_REGEXP_SLASH","FILL","FROM_CODE_POINT","FUNCTION_19_LF","GENERIC_ARRAY_TO_STRING","GLOBAL_UNDEFINED","GMT","INCR_CHAR","LOCALE_INFINITY","NAME","NO_OLD_SAFARI_ARRAY_ITERATOR","PLAIN_INTL","V8_SRC"],attributes:{"char-increment-restriction":null}},NODE_11:{engine:"Node.js 11",includes:["ARROW","ESC_HTML_QUOT_ONLY","ESC_REGEXP_SLASH","FILL","FLAT","FROM_CODE_POINT","FUNCTION_19_LF","GENERIC_ARRAY_TO_STRING","GLOBAL_UNDEFINED","GMT","INCR_CHAR","LOCALE_INFINITY","NAME","NO_OLD_SAFARI_ARRAY_ITERATOR","PLAIN_INTL","V8_SRC"],attributes:{"char-increment-restriction":null}},NODE_12:{engine:"Node.js 12",includes:["ARROW","ESC_HTML_QUOT_ONLY","ESC_REGEXP_LF","ESC_REGEXP_SLASH","FILL","FLAT","FROM_CODE_POINT","FUNCTION_19_LF","GENERIC_ARRAY_TO_STRING","GLOBAL_UNDEFINED","GMT","INCR_CHAR","LOCALE_INFINITY","NAME","NO_OLD_SAFARI_ARRAY_ITERATOR","PLAIN_INTL","REGEXP_STRING_ITERATOR","V8_SRC"],attributes:{"char-increment-restriction":null}},NODE_13:{engine:"Node.js 13 and Node.js 14",includes:["ARROW","ESC_HTML_QUOT_ONLY","ESC_REGEXP_LF","ESC_REGEXP_SLASH","FILL","FLAT","FROM_CODE_POINT","FUNCTION_19_LF","GENERIC_ARRAY_TO_STRING","GLOBAL_UNDEFINED","GMT","INCR_CHAR","LOCALE_INFINITY","LOCALE_NUMERALS_EXT","NAME","NO_OLD_SAFARI_ARRAY_ITERATOR","PLAIN_INTL","REGEXP_STRING_ITERATOR","SHORT_LOCALES","V8_SRC"],attributes:{"char-increment-restriction":null}},NODE_15:{engine:"Node.js 15",includes:["ARROW","ESC_HTML_QUOT_ONLY","ESC_REGEXP_LF","ESC_REGEXP_SLASH","FILL","FLAT","FROM_CODE_POINT","FUNCTION_19_LF","GENERIC_ARRAY_TO_STRING","GLOBAL_UNDEFINED","GMT","INCR_CHAR","INTL","LOCALE_INFINITY","LOCALE_NUMERALS_EXT","NAME","NO_OLD_SAFARI_ARRAY_ITERATOR","REGEXP_STRING_ITERATOR","SHORT_LOCALES","V8_SRC"],attributes:{"char-increment-restriction":null}},NODE_16:{engine:"Node.js 16 or later",includes:["ARROW","ATOB","ESC_HTML_QUOT_ONLY","ESC_REGEXP_LF","ESC_REGEXP_SLASH","FILL","FLAT","FROM_CODE_POINT","FUNCTION_19_LF","GENERIC_ARRAY_TO_STRING","GLOBAL_UNDEFINED","GMT","INCR_CHAR","INTL","LOCALE_INFINITY","LOCALE_NUMERALS_EXT","NAME","NO_OLD_SAFARI_ARRAY_ITERATOR","REGEXP_STRING_ITERATOR","SHORT_LOCALES","V8_SRC"],attributes:{"char-increment-restriction":null}},SAFARI_7_0:{engine:"Safari 7.0",includes:["ATOB","BARPROP","CONSOLE","ESC_HTML_QUOT_ONLY","ESC_REGEXP_LF","ESC_REGEXP_SLASH","FF_SRC","GENERIC_ARRAY_TO_STRING","GLOBAL_UNDEFINED","GMT","HISTORY","HTMLDOCUMENT","INCR_CHAR","LOCATION","NAME","NODECONSTRUCTOR","STATUS","WINDOW"],attributes:{"char-increment-restriction":null,"no-atob-in-web-worker":null,"no-console-in-web-worker":null,"web-worker-restriction":null}},SAFARI_7_1:{engine:"Safari 7.1 and Safari 8",includes:["ARRAY_ITERATOR","ATOB","BARPROP","CONSOLE","ESC_HTML_QUOT_ONLY","ESC_REGEXP_LF","ESC_REGEXP_SLASH","FF_SRC","FILL","GENERIC_ARRAY_TO_STRING","GLOBAL_UNDEFINED","GMT","HISTORY","HTMLDOCUMENT","INCR_CHAR","LOCATION","NAME","NODECONSTRUCTOR","STATUS","WINDOW"],attributes:{"char-increment-restriction":null,"no-atob-in-web-worker":null,"safari-bug-21820506":null,"web-worker-restriction":null}},SAFARI_8:{aliasFor:"SAFARI_7_1"},SAFARI_9:{engine:"Safari 9",includes:["ATOB","BARPROP","CONSOLE","ESC_HTML_QUOT_ONLY","ESC_REGEXP_LF","ESC_REGEXP_SLASH","FF_SRC","FILL","FROM_CODE_POINT","FUNCTION_22_LF","GENERIC_ARRAY_TO_STRING","GLOBAL_UNDEFINED","GMT","HISTORY","HTMLDOCUMENT","INCR_CHAR","LOCATION","NAME","NODECONSTRUCTOR","NO_OLD_SAFARI_ARRAY_ITERATOR","STATUS","WINDOW"],attributes:{"char-increment-restriction":null,"no-atob-in-web-worker":null,"safari-bug-21820506":null,"web-worker-restriction":null}},SAFARI_10:{engine:"Safari 10 and Safari 11",includes:["ARROW","ATOB","BARPROP","CONSOLE","ESC_HTML_QUOT_ONLY","ESC_REGEXP_LF","ESC_REGEXP_SLASH","FF_SRC","FILL","FROM_CODE_POINT","FUNCTION_22_LF","GENERIC_ARRAY_TO_STRING","GLOBAL_UNDEFINED","GMT","HISTORY","HTMLDOCUMENT","INCR_CHAR","LOCALE_INFINITY","LOCALE_NUMERALS_EXT","LOCATION","NAME","NO_OLD_SAFARI_ARRAY_ITERATOR","PLAIN_INTL","SHORT_LOCALES","STATUS","WINDOW"],attributes:{"char-increment-restriction":null,"web-worker-restriction":null}},SAFARI_12:{engine:"Safari 12",includes:["ARROW","ATOB","BARPROP","CONSOLE","ESC_HTML_QUOT_ONLY","ESC_REGEXP_LF","ESC_REGEXP_SLASH","FF_SRC","FILL","FLAT","FROM_CODE_POINT","FUNCTION_22_LF","GENERIC_ARRAY_TO_STRING","GLOBAL_UNDEFINED","GMT","HISTORY","HTMLDOCUMENT","INCR_CHAR","LOCALE_INFINITY","LOCALE_NUMERALS_EXT","LOCATION","NAME","NO_OLD_SAFARI_ARRAY_ITERATOR","PLAIN_INTL","SHORT_LOCALES","STATUS","WINDOW"],attributes:{"char-increment-restriction":null,"web-worker-restriction":null}},SAFARI_13:{engine:"Safari 13 and Safari 14.0.0",includes:["ARROW","ATOB","BARPROP","CONSOLE","ESC_HTML_QUOT_ONLY","ESC_REGEXP_LF","ESC_REGEXP_SLASH","FF_SRC","FILL","FLAT","FROM_CODE_POINT","FUNCTION_22_LF","GENERIC_ARRAY_TO_STRING","GLOBAL_UNDEFINED","GMT","HISTORY","HTMLDOCUMENT","INCR_CHAR","LOCALE_INFINITY","LOCALE_NUMERALS_EXT","LOCATION","NAME","NO_OLD_SAFARI_ARRAY_ITERATOR","PLAIN_INTL","REGEXP_STRING_ITERATOR","SHORT_LOCALES","STATUS","WINDOW"],attributes:{"char-increment-restriction":null,"web-worker-restriction":null}},SAFARI_14_0_1:{engine:"Safari 14.0.1 to 14.0.3",includes:["ARROW","ATOB","BARPROP","CONSOLE","ESC_HTML_QUOT_ONLY","ESC_REGEXP_LF","ESC_REGEXP_SLASH","FF_SRC","FILL","FLAT","FROM_CODE_POINT","FUNCTION_22_LF","GENERIC_ARRAY_TO_STRING","GLOBAL_UNDEFINED","GMT","HISTORY","HTMLDOCUMENT","INCR_CHAR","INTL","LOCALE_INFINITY","LOCALE_NUMERALS_EXT","LOCATION","NAME","NO_OLD_SAFARI_ARRAY_ITERATOR","REGEXP_STRING_ITERATOR","SHORT_LOCALES","STATUS","WINDOW"],attributes:{"char-increment-restriction":null,"web-worker-restriction":null}},SAFARI:{engine:"the current stable version of Safari",aliasFor:"SAFARI_14_1"},SAFARI_14_1:{engine:"Safari 14.1 or later",includes:["ARROW","ATOB","BARPROP","ESC_HTML_QUOT_ONLY","ESC_REGEXP_LF","ESC_REGEXP_SLASH","FF_SRC","FILL","FLAT","FROM_CODE_POINT","FUNCTION_22_LF","GENERIC_ARRAY_TO_STRING","GLOBAL_UNDEFINED","GMT","HISTORY","HTMLDOCUMENT","INCR_CHAR","INTL","LOCALE_INFINITY","LOCALE_NUMERALS_EXT","LOCATION","NAME","NO_OLD_SAFARI_ARRAY_ITERATOR","REGEXP_STRING_ITERATOR","SHORT_LOCALES","STATUS","WINDOW"],attributes:{"char-increment-restriction":null,"web-worker-restriction":null}}}),fe(_e),(Tn=tn={})[Tn.UNDEFINED=1]="UNDEFINED",Tn[Tn.ALGEBRAIC=2]="ALGEBRAIC",Tn[Tn.WEAK_ALGEBRAIC=4]="WEAK_ALGEBRAIC",Tn[Tn.OBJECT=8]="OBJECT",Tn[Tn.STRING=16]="STRING",Tn[Tn.PREFIXED_STRING=32]="PREFIXED_STRING",Tn[Tn.WEAK_PREFIXED_STRING=64]="WEAK_PREFIXED_STRING",Tn[Tn.COMBINED_STRING=128]="COMBINED_STRING",Object.freeze(tn);var hn,Cn,Fn,bn=w(tn.WEAK_ALGEBRAIC,tn.PREFIXED_STRING,tn.WEAK_PREFIXED_STRING,tn.COMBINED_STRING),Pn=w(tn.STRING,tn.PREFIXED_STRING,tn.WEAK_PREFIXED_STRING,tn.COMBINED_STRING),vn=w(tn.WEAK_ALGEBRAIC,tn.WEAK_PREFIXED_STRING),gn=[{typeSetList:[m(tn.UNDEFINED),m(tn.UNDEFINED),m(tn.WEAK_ALGEBRAIC)],replace:function(e,t,n){return e+"+("+t+"+["+n+"])"},solutionType:tn.PREFIXED_STRING},{typeSetList:[m(tn.UNDEFINED),m(tn.UNDEFINED),m(tn.WEAK_PREFIXED_STRING)],replace:function(e,t,n){return e+"+("+t+"+("+n+"))"},solutionType:tn.PREFIXED_STRING},{typeSetList:[m(tn.UNDEFINED),m(tn.UNDEFINED),m(tn.OBJECT,tn.STRING,tn.COMBINED_STRING)],replace:function(e,t,n){return e+"+("+t+"+"+n+")"},solutionType:tn.PREFIXED_STRING},{typeSetList:[m(tn.UNDEFINED),m(tn.UNDEFINED)],replace:function(e,t){return"[]+"+e+"+"+t},solutionType:tn.COMBINED_STRING},{typeSetList:[m(tn.UNDEFINED),m(tn.ALGEBRAIC,tn.WEAK_ALGEBRAIC)],replace:function(e,t){return e+"+["+t+"]"},solutionType:tn.PREFIXED_STRING},{typeSetList:[m(tn.UNDEFINED),m(tn.PREFIXED_STRING)],replace:function(e,t){return e+"+("+t+")"},solutionType:tn.PREFIXED_STRING},{typeSetList:[m(tn.UNDEFINED)],replace:function(e){return e},solutionType:tn.PREFIXED_STRING},{typeSetList:[m(tn.ALGEBRAIC),m(tn.UNDEFINED,tn.ALGEBRAIC,tn.PREFIXED_STRING)],replace:function(e,t){return"["+e+"]+"+t},solutionType:tn.COMBINED_STRING},{typeSetList:[m(tn.ALGEBRAIC),m(tn.WEAK_ALGEBRAIC)],replace:function(e,t){return e+"+["+t+"]"},solutionType:tn.PREFIXED_STRING},{typeSetList:[m(tn.ALGEBRAIC,tn.PREFIXED_STRING)],replace:function(e){return e},solutionType:tn.PREFIXED_STRING},{typeSetList:[m(tn.WEAK_ALGEBRAIC),m(tn.UNDEFINED,tn.ALGEBRAIC,tn.PREFIXED_STRING)],replace:function(e,t){return"["+e+"]+"+t},solutionType:tn.COMBINED_STRING},{typeSetList:[m(tn.WEAK_ALGEBRAIC),m(tn.WEAK_ALGEBRAIC)],replace:function(e,t){return e+"+["+t+"]"},solutionType:tn.WEAK_PREFIXED_STRING},{typeSetList:[m(tn.WEAK_ALGEBRAIC,tn.WEAK_PREFIXED_STRING)],replace:function(e){return e},solutionType:tn.WEAK_PREFIXED_STRING},{typeSetList:[m(tn.OBJECT,tn.STRING,tn.COMBINED_STRING)],replace:function(e){return e},solutionType:tn.COMBINED_STRING}],Tn=(Object.defineProperty(It.prototype,"isLoose",{get:function(){return bn(this.type)},enumerable:!1,configurable:!0}),Object.defineProperty(It.prototype,"isString",{get:function(){return Pn(this.type)},enumerable:!1,configurable:!0}),Object.defineProperty(It.prototype,"isWeak",{get:function(){return vn(this.type)},enumerable:!1,configurable:!0}),Object.defineProperty(It.prototype,"length",{get:function(){return this.replacement.length},enumerable:!1,configurable:!0}),It),yn=(e(dt,hn=Tn),dt.prototype.append=function(e){this.Ne=void 0,this.ee.push(e)},dt.prototype.prepend=function(e){this.Ne=void 0,this.ee.unshift(e)},Object.defineProperty(dt.prototype,"replacement",{get:function(){var e;return null!==(e=this.Ne)&&void 0!==e?e:this.Ne=function(e){switch(e.length){case 0:return Dn.replacement;case 1:return e[0].replacement;default:var t=(r=D(e)).replace,n=r.typeSetList.length,r=e.slice(n).map(xn),n=e.slice(0,n).map(Hn),n=t.apply(void 0,n);return r.unshift(n),r.join("")}}(this.ee)},enumerable:!1,configurable:!0}),Object.defineProperty(dt.prototype,"source",{get:function(){for(var e=[],t=0,n=this.ee;t":[_e('"".italics()[2]'),_e('"".sub()[10]')],"?":[_e("(RP_0_S + RegExp())[2]"),i()],A:[e("Array",9),_e("(RP_3_WA + ARRAY_ITERATOR)[11]",s)],B:[e("Boolean",9),_e('"0".sub()[10]',T)],C:[_e('escape("".italics())[2]'),_e('escape("".sub())[2]'),_e("escape(F_A_L_S_E)[11]"),_e('atob("00NaNfalse")[1]',l),_e('(RP_4_A + "".fontcolor())[10]',T),_e('(RP_3_WA + Function("return console")())[11]',E),_e("(RP_0_S + Node)[12]",X)],D:[_e('escape((+("1000" + (RP_5_A + FILTER + 0)[40] + 0) + FILTER)[40])[2]'),_e('escape("]")[2]'),_e('escape("}")[2]'),_e('(document + RP_0_S)[SLICE_OR_SUBSTR]("-10")[1]',c),_e('escape((RP_4_A + [+("1000" + (AT + 0)[31] + 0)] + AT)[40])[2]',R),_e('btoa("00")[1]',l),_e("(RP_3_WA + document)[11]",N),_e('escape((NaN + [+("10" + [(RP_6_S + FILL)[40]] + "000")] + FILL)[40])[2]',F),_e('escape((NaN + [+("10" + [(RP_6_S + FLAT)[40]] + "000")] + FLAT)[40])[2]',b),_e("(RP_0_S + document)[12]",H),_e("escape(ARRAY_ITERATOR)[30]",q),_e("escape(FILTER)[50]",re),_e('(document + [RP_1_WA]).at("-10")',c,R),_e("escape(AT)[61]",R,U),_e("escape([[]][+(RP_0_S + AT)[0]] + AT)[61]",R,z),_e("escape([NaN][+(RP_1_WA + AT)[20]] + AT)[61]",R,Q),_e("escape(true + AT)[50]",R,re),_e("escape(FILL)[60]",C,F),_e("escape(FLAT)[60]",C,b)],E:[e("RegExp",12),_e('btoa("0NaN")[1]',l),_e('(RP_5_A + "".link())[10]',T),_e("(RP_3_WA + sidebar)[11]",h),_e("(RP_3_WA + Audio)[21]",x),_e("(RP_0_S + REGEXP_STRING_ITERATOR)[11]",K)],F:[e("Function",9),_e('"".fontcolor()[1]',T)],G:[_e('btoa("0false")[1]',l),_e('"0".big()[10]',T),_e("(RP_5_A + Date())[30]",w)],H:[_e("btoa(true)[1]",l),_e('"".link()[3]',T),_e({expr:'(RP_3_WA + Function("return history")())[11]',optimize:!0},D),_e("(RP_1_WA + Audio)[10]",x),_e("(RP_3_WA + document)[11]",H)],I:'"Infinity"[0]',J:[_e('"j"[TO_UPPER_CASE]()'),_e("btoa(true)[2]",l),i({atob:!1})],K:[_e('(RP_5_A + "".strike())[10]',T),i()],L:[_e('btoa(".")[0]',l),_e('(RP_3_WA + "".fontcolor())[11]',T),_e("(RP_0_S + Audio)[12]",x),_e("(RP_0_S + document)[11]",H),_e({expr:'Function("return toString.call(location)")()[SLICE_OR_SUBSTR]("-10")[1]',optimize:!0},Y),_e({expr:'(Function("return toString.call(location)")() + RP_1_WA).at("-10")',optimize:!0},R,Y),_e('[][TO_STRING].call(location)[SLICE_OR_SUBSTR]("-10")[1]',y,Y),_e('([][TO_STRING].call(location) + RP_1_WA).at("-10")',R,y,Y)],M:[_e("btoa(0)[0]",l),_e('"".small()[2]',T),_e("(RP_4_A + Date())[30]",w),_e("(RP_0_S + Audio)[11]",x),_e("(RP_0_S + document)[10]",H)],N:'"NaN"[0]',O:[e("Object",9),_e("(RP_3_WA + PLAIN_OBJECT)[11]"),_e("btoa(NaN)[3]",l),_e('"".fontcolor()[2]',T),_e("(RP_3_WA + Intl)[11]",$)],P:[_e('String.fromCharCode("80")'),_e('atob("01A")[1]',l),_e('btoa("".italics())[0]',l),_e('(RP_0_S + Function("return statusbar")())[11]',A),_e('"0".sup()[10]',T),i({atob:!1,charCode:!1})],Q:[_e('"q"[TO_UPPER_CASE]()'),_e("btoa(1)[1]",l),i({atob:!1})],R:[e("RegExp",9),_e('btoa("0true")[2]',l),_e('"".fontcolor()[10]',T),_e("(RP_3_WA + REGEXP_STRING_ITERATOR)[11]",K)],S:[e("String",9),_e('"".sub()[1]',T)],T:[_e({expr:'(RP_0_S + Function("try{undefined.false}catch(undefined){return undefined}")())[0]',optimize:!0}),_e("btoa(NaN)[0]",l),_e('"".fontcolor([])[20]',T),_e("(RP_3_WA + Date())[30]",w),_e("(RP_0_S + Audio)[10]",x),_e("(RP_1_WA + document)[10]",H),i({atob:!1})],U:[_e('btoa("1NaN")[1]',l),_e('"".sub()[2]',T),_e('(RP_3_WA + Function("return toString")()())[11]',m),_e('(RP_3_WA + Function("return{}.toString")()())[11]',J),_e("(RP_3_WA + PLAIN_OBJECT[TO_STRING].call())[11]",ne),_e("(RP_3_WA + ARRAY_ITERATOR[TO_STRING].call())[11]",s,ne),_e('(RP_3_WA + Function("return Intl.toString")()())[11]',G,J),_e("(RP_3_WA + Intl[TO_STRING].call())[11]",G,ne)],V:[_e('"v"[TO_UPPER_CASE]()'),_e('(RP_0_S + document.createElement("video"))[12]',c),_e("btoa(undefined)[10]",l),i({atob:!1})],W:[_e('"w"[TO_UPPER_CASE]()'),_e('(self + RP_4_A)[SLICE_OR_SUBSTR]("-11")[0]',_),_e("btoa(undefined)[1]",l),_e("(RP_0_S + self)[11]",O),_e("(RP_3_WA + self)[11]",ie),_e('(self + RP_4_A).at("-11")',_,R),i({atob:!1})],X:[_e('"x"[TO_UPPER_CASE]()'),_e('btoa("1true")[1]',l),i({atob:!1})],Y:[_e('"y"[TO_UPPER_CASE]()'),_e('btoa("a")[0]',l),i({atob:!1})],Z:[_e("btoa(false)[0]",l),_e('(RP_3_WA + "".fontsize())[11]',T)],"[":[t(14),_e("(RP_0_S + ARRAY_ITERATOR)[0]",s)],"\\":[_e("ESCAPING_BACKSLASH"),i({atob:!1,escSeq:!1,unescape:!1})],"]":[t(26),_e("(RP_0_S + ARRAY_ITERATOR)[22]",q)],"^":[_e('atob("undefined0")[2]',l)],a:'"false"[1]',b:[e("Number",12),_e("(RP_0_S + ARRAY_ITERATOR)[2]",s)],c:[e("ANY_FUNCTION",3),_e("(RP_5_A + ARRAY_ITERATOR)[10]",s)],d:'"undefined"[2]',e:'"true"[3]',f:'"false"[0]',g:[e("String",14)],h:[_e('101[TO_STRING]("21")[1]'),_e('btoa("0false")[3]',l)],i:"([RP_5_A] + undefined)[10]",j:[_e("(RP_0_S + PLAIN_OBJECT)[10]"),_e("(RP_0_S + ARRAY_ITERATOR)[3]",s),_e("(RP_0_S + Intl)[3]",G),_e("(RP_0_S + Node)[3]",X),_e("(RP_0_S + Intl)[10]",$),_e("(RP_0_S + self)[3]",Z)],k:[_e('20[TO_STRING]("21")'),i()],l:'"false"[2]',m:[e("Number",11),_e("(RP_6_S + Function())[20]")],n:'"undefined"[1]',o:[e("ANY_FUNCTION",6),_e("(RP_0_S + ARRAY_ITERATOR)[1]",s)],p:[_e('211[TO_STRING]("31")[1]'),_e("(RP_3_WA + btoa(undefined))[10]",l)],q:[_e('212[TO_STRING]("31")[1]'),_e('"".fontcolor(0 + "".fontcolor())[30]',S),_e('"".fontcolor("0false\\"")[20]',L),_e('"".fontcolor(true + "".fontcolor())[30]',I),i()],r:'"true"[1]',s:'"false"[3]',t:'"true"[0]',u:'"undefined"[0]',v:[t(19)],w:[_e('32[TO_STRING]("33")'),_e('(self + RP_0_S)[SLICE_OR_SUBSTR]("-2")[0]',_),_e('atob("undefined0")[1]',l),_e("(RP_4_A + self)[20]",O),_e("(RP_0_S + self)[13]",ie),_e('(self + RP_0_S).at("-2")',_,R)],x:[_e('101[TO_STRING]("34")[1]'),_e('btoa("falsefalse")[10]',l),_e("(RP_1_WA + sidebar)[10]",h)],y:"(RP_3_WA + [Infinity])[10]",z:[_e('35[TO_STRING]("36")'),_e('btoa("falsefalse")[11]',l)],"{":[n(12)],"}":[t(28)],"Š":[_e('(RP_4_A + atob("NaNundefined"))[10]',l)],"":[_e('atob("0NaN")[2]',l)],"–":[_e('atob("00false")[3]',l)],"ž":[_e("atob(true)[2]",l)],"£":[_e("atob(NaN)[1]",l)],"¥":[_e('atob("0false")[2]',l)],"§":[_e('atob("00undefined")[2]',l)],"©":[_e('atob("false0")[1]',l)],"±":[_e('atob("0false")[3]',l)],"¶":[_e("atob(true)[0]",l)],"º":[_e('atob("undefined0")[0]',l)],"»":[_e("atob(true)[1]",l)],"Ç":[_e('atob("falsefalsefalse")[10]',l)],"Ú":[_e('atob("0truefalse")[1]',l)],"Ý":[_e('atob("0undefined")[2]',l)],"â":[_e('atob("falsefalseundefined")[11]',l)],"é":[_e('atob("0undefined")[1]',l)],"î":[_e('atob("0truefalse")[2]',l)],"ö":[_e('atob("0false")[1]',l)],"ø":[_e('atob("undefinedundefined")[10]',l)],"∞":[_e("Infinity[TO_LOCALE_STRING]()",k),i()]}),Vn=ae({Number:_e({expr:"Number.name",optimize:{complexOpt:!1}},j),Object:_e({expr:"Object.name",optimize:{complexOpt:!1}},j),RegExp:_e({expr:"RegExp.name",optimize:{complexOpt:!1}},j),String:_e("String.name",j),fromCharCo:_e({expr:'"from3har3o".split(3).join("C")',optimize:{complexOpt:!1}}),mCh:_e('atob("bUNo")',ce.ATOB)}),Jn=ae({Array:[_e("[].constructor")],Audio:[_e('Function("return Audio")()',x)],Boolean:[_e("false.constructor")],Date:[_e('Function("return Date")()')],Function:[_e("ANY_FUNCTION.constructor")],Intl:[_e('Function("return Intl")()',G)],Node:[_e('Function("return Node")()',X)],Number:[_e("0..constructor")],Object:[_e("PLAIN_OBJECT.constructor"),_e("Intl.constructor",G),_e("[].entries().constructor",q)],RegExp:[_e('Function("return/false/")().constructor')],String:[_e('"".constructor')],atob:[_e('Function("return atob")()',l)],btoa:[_e('Function("return btoa")()',l)],document:[_e({expr:'Function("return document")()',optimize:!0},c)],escape:[_e({expr:'Function("return escape")()',optimize:!0})],location:[_e('Function("return location")()',Y)],self:[_e('Function("return self")()',Z)],sidebar:[_e('Function("return sidebar")()',h)],unescape:[_e({expr:'Function("return unescape")()',optimize:!0})],ANY_FUNCTION:[_e("FILTER"),_e("AT",R),_e("FILL",F),_e("FLAT",b)],ARRAY_ITERATOR:[_e("[].entries()",s)],AT:[_e("[].at",R)],ESCAPING_BACKSLASH:[_e(Re),_e({expr:'atob("01y")[1]',solutionType:tn.STRING},l),_e({expr:'(RP_0_S + RegExp("\\n"))[1]',solutionType:tn.STRING},d),_e({expr:'(RP_5_A + RegExp("".italics()))[10]',solutionType:tn.STRING},p),_e({expr:'(RP_3_WA + RegExp("".sub()))[10]',solutionType:tn.STRING},p),_e({expr:"(RP_0_S + RegExp(FILTER))[20]",solutionType:tn.STRING},d,C),_e({expr:"(RP_0_S + RegExp(Function()))[20]",solutionType:tn.STRING},d,v),_e({expr:"(RP_5_A + RegExp(Function()))[30]",solutionType:tn.STRING},d,g),_e({expr:"(RP_0_S + RegExp(ANY_FUNCTION))[1]",solutionType:tn.STRING},d,U),_e({expr:"(+(RP_0_S + FILTER)[0] + RegExp(FILTER))[23]",solutionType:tn.STRING},d,V),_e({expr:"(RP_4_A + RegExp(AT))[20]",solutionType:tn.STRING},R,d,C),_e({expr:"(RP_1_WA + [+(RP_0_S + AT)[0]] + RegExp(AT))[20]",solutionType:tn.STRING},R,d,V),_e({expr:"(RP_3_WA + RegExp(FILL))[21]",solutionType:tn.STRING},d,C,F),_e({expr:"(RP_3_WA + RegExp(FLAT))[21]",solutionType:tn.STRING},d,C,b),_e({expr:"(+(RP_0_S + FILL)[0] + RegExp(FILL))[21]",solutionType:tn.STRING},d,F,V),_e({expr:"(+(RP_0_S + FLAT)[0] + RegExp(FLAT))[21]",solutionType:tn.STRING},d,b,V)],FILL:[_e("[].fill",F)],FILTER:[_e("[].filter")],FLAT:[_e("[].flat",b)],F_A_L_S_E:[_e('[][SLICE_OR_FLAT].call("false")')],LOCALE_AR:[_e({expr:'"ar-td"',solutionType:tn.COMBINED_STRING}),_e({expr:'"ar"',solutionType:tn.COMBINED_STRING},ee)],PLAIN_OBJECT:[_e('Function("return{}")()')],REGEXP_STRING_ITERATOR:[_e({expr:'"".matchAll()',optimize:!0},K)],SLICE_OR_FLAT:[_e({expr:'"slice"',solutionType:tn.COMBINED_STRING}),_e({expr:'"flat"',solutionType:tn.COMBINED_STRING},b)],SLICE_OR_SUBSTR:[_e({expr:'"slice"',solutionType:tn.COMBINED_STRING}),_e({expr:'"substr"',solutionType:tn.COMBINED_STRING})],TO_LOCALE_STRING:[_e({expr:'"toLocaleString"',optimize:!0,solutionType:tn.COMBINED_STRING})],TO_STRING:[_e({expr:'"toString"',optimize:{toStringOpt:!1},solutionType:tn.COMBINED_STRING})],TO_UPPER_CASE:[_e({expr:'"toUpperCase"',optimize:!0,solutionType:tn.COMBINED_STRING})],FBEP_4_S:[_e("[[true][+(RP_3_WA + FILTER)[30]]]"),_e("[[true][+(RP_1_WA + AT)[30]]]",R),_e("[[true][+(RP_5_A + FILL)[30]]]",F),_e("[[true][+(RP_5_A + FLAT)[30]]]",b),_e("[[true][+!!++(RP_0_S + FILTER)[20]]]",M),_e("[[true][+!!++(RP_1_WA + AT)[20]]]",R,M),_e("[[true][+!!++(RP_0_S + FILL)[20]]]",F,M),_e("[[true][+!!++(RP_0_S + FLAT)[20]]]",b,M)],FBEP_9_U:[_e({expr:"[false][+(RP_0_S + FILTER)[20]]",solutionType:tn.UNDEFINED}),_e({expr:"[false][+(RP_1_WA + AT)[20]]",solutionType:tn.UNDEFINED},R),_e({expr:"[false][+(RP_0_S + FILL)[20]]",solutionType:tn.UNDEFINED},F),_e({expr:"[false][+(RP_0_S + FLAT)[20]]",solutionType:tn.UNDEFINED},b)],FBEP_10_S:[_e({expr:"[RP_1_WA] + FBEP_9_U",solutionType:tn.COMBINED_STRING})],FBP_5_S:[_e("[[false][+IS_IE_SRC_A]]",z)],FBP_7_WA:[_e({expr:'+("10" + [(RP_4_A + FILTER)[40]] + "00000")',solutionType:tn.WEAK_ALGEBRAIC}),_e({expr:'+("10" + [(RP_0_S + AT)[32]] + "00000")',solutionType:tn.WEAK_ALGEBRAIC},R),_e({expr:'+("10" + [(RP_6_S + FILL)[40]] + "00000")',solutionType:tn.WEAK_ALGEBRAIC},F),_e({expr:'+("10" + [(RP_6_S + FLAT)[40]] + "00000")',solutionType:tn.WEAK_ALGEBRAIC},b)],FBP_8_WA:[_e({expr:'+("1000" + (RP_5_A + FILTER + 0)[40] + "000")',solutionType:tn.WEAK_ALGEBRAIC}),_e({expr:'+("1000" + (AT + 0)[31] + "000")',solutionType:tn.WEAK_ALGEBRAIC},R),_e({expr:'+("1000" + (FILL + 0)[33] + "000")',solutionType:tn.WEAK_ALGEBRAIC},F),_e({expr:'+("1000" + (FLAT + 0)[33] + "000")',solutionType:tn.WEAK_ALGEBRAIC},b)],FBP_9_U:[_e({expr:"[true][+(RP_0_S + ANY_FUNCTION)[0]]",solutionType:tn.UNDEFINED},z)],FH_SHIFT_1:[_e("[+IS_IE_SRC_A]")],FH_SHIFT_2:[_e("[true + IS_IE_SRC_A]")],FH_SHIFT_3:[_e("[2 + IS_IE_SRC_A]")],FHP_3_WA:[_e({expr:"+(1 + [+(RP_0_S + ANY_FUNCTION)[0]])",solutionType:tn.WEAK_ALGEBRAIC}),_e({expr:"+(++(RP_0_S + ANY_FUNCTION)[0] + [0])",solutionType:tn.WEAK_ALGEBRAIC},M)],FHP_5_A:[_e({expr:"IS_IE_SRC_A",solutionType:tn.ALGEBRAIC})],FHP_8_S:[_e({expr:"[RP_3_WA] + FHP_5_A",solutionType:tn.COMBINED_STRING})],IS_IE_SRC_A:[_e({expr:"!![[]][+(RP_0_S + ANY_FUNCTION)[0]]",solutionType:tn.ALGEBRAIC}),_e({expr:"!!++(RP_0_S + ANY_FUNCTION)[0]",solutionType:tn.ALGEBRAIC},M)],RP_0_S:{expr:"[]",solutionType:tn.OBJECT},RP_1_WA:{expr:"0",solutionType:tn.WEAK_ALGEBRAIC},RP_2_WS:{expr:'"00"',solutionType:tn.WEAK_PREFIXED_STRING},RP_3_WA:{expr:"NaN",solutionType:tn.WEAK_ALGEBRAIC},RP_4_A:{expr:"true",solutionType:tn.ALGEBRAIC},RP_5_A:{expr:"false",solutionType:tn.ALGEBRAIC},RP_6_S:{expr:'"0false"',solutionType:tn.COMBINED_STRING}}),Kn=[_e(4,C),_e(5,U),_e(0,re)],Zn=[_e(1,U),_e(0,Q)],Un=se([_e("fromCharCode"),_e("fromCodePoint",P)],[_e(0),_e(1,l),_e(1,A),_e(1,T),_e(0,s,l,T,P)]),Mn=se([_e(function(e,t){return"function(undefined){return String."+e+"("+t+")}"}),_e(function(e,t){return"function(undefined){return(isNaN+false).constructor."+e+"("+t+")}"}),_e(function(e,t){return"undefined=>String."+e+"("+t+")"},f),_e(function(e,t){return"undefined=>(isNaN+false).constructor."+e+"("+t+")"},f),_e(function(e,t){return"function(undefined){return status.constructor."+e+"("+t+")}"},te),_e(function(e,t){return"undefined=>status.constructor."+e+"("+t+")"},f,te)],[_e(1),_e(3),_e(0,s,T),_e(1,s,T,b),_e(0,s,T,V),_e(1,s,R,T),_e(1,s,T,C,b),_e(1,s,T,F,U),_e(1,s,T,F,Q),_e(1,s,T,b,U),_e(2,s,T),_e(3,s,R,T,U),_e(3,s,R,T,Q),_e(4),_e(5)]),Gn=se([_e(function(e,t){var n=le(e);return'Function("return function('+n+"){return function("+e+"){return "+n+t+'}}")()'}),_e(function(e,t){return'Function("return function('+e+"){return this"+t+'}")().bind'}),_e(function(e,t){var n=le(e);return'Function("return '+n+"=>"+e+"=>"+n+t+'")()'},f)],[_e(0),_e(1,s,l),_e(0,z),_e(0,V),_e(1,s,T),_e(0,s,R,l),_e(0,s,R,T),_e(0,s,l,F),_e(0,s,l,b),_e(0,s,l,Q),_e(0,s,T,F),_e(0,s,T,b),_e(0,s,T,U),_e(0,s,T,Q),_e(2)]),$n=[_e({expr:"FILTER",shift:6}),_e({expr:"FILL",shift:4},F),_e({expr:"FLAT",shift:4},b),_e({expr:"AT",shift:2},R)],kn=se([_e("f"),_e("undefined")],[_e(0),_e(1,R),_e(1,F,U),_e(1,F,Q),_e(0,b)]),Wn=se([_e("B"),_e("b")],[_e(0),_e(1,s)]),Bn=se([_e("return String"),_e("return(isNaN+false).constructor"),_e("return status.constructor",te)],[_e(1),_e(0,s,T),_e(1,b),_e(0,s,T,V),_e(1,s,R,T),_e(1,s,T,C,b),_e(1,s,T,F,U),_e(1,s,T,F,Q),_e(1,s,T,b,U),_e(2)]),r("false","![]",tn.ALGEBRAIC),r("true","!![]",tn.ALGEBRAIC),r("undefined","[][[]]",tn.UNDEFINED),r("NaN","+[false]",tn.WEAK_ALGEBRAIC),r("Infinity","1e1000",tn.WEAK_ALGEBRAIC);for(var oe=0;oe<=9;++oe){var ue=function(e){switch(e){case 0:return"+[]";case 1:return"+!![]";default:for(var t="!![]";t+="+!![]",1<--e;);return t}}(oe);qn[oe]={expr:ue,solutionType:tn.WEAK_ALGEBRAIC}}fe(o),fe(u),a("LOCALE_AR",1632),u("٫","LOCALE_AR",.1,1),u("ل",'"ar"',NaN,0),u("ي",'"ar"',NaN,1),u("س",'"ar"',NaN,2),u("ر",'"ar"',NaN,4,B),u("ق",'"ar"',NaN,5,B),u("م",'"ar"',NaN,6,B),a('"bn"',2534,B),a('"fa"',1776),u("٬",'"fa"',1e3,1),u("ن",'"fa"',NaN,0,B),u("ا",'"fa"',NaN,1,B),u("ع",'"fa"',NaN,2,B),u("د",'"fa"',NaN,3,B),u("н",'"ru"',NaN,0,B),u("е",'"ru"',NaN,1,B),u("ч",'"ru"',NaN,3,B),u("и",'"ru"',NaN,4,B),u("с",'"ru"',NaN,5,B),u("л",'"ru"',NaN,6,B),u("о",'"ru"',NaN,7,B)}();var or,ur,ar=6,cr=73,_r=136,sr=26,fr=[ar,8,12,17,22,27,32,37,42,47],Rr={ConstIdentifier:"Infinity|NaN|false|true|undefined",DecimalLiteral:"(?:(?:0|[1-9]\\d*)(?:\\.\\d*)?|\\.\\d+)(?:[Ee][+-]?\\d+)?",DoubleQuotedString:'"(?:#EscapeSequence|(?!["\\\\]).)*"',EscapeSequence:"\\\\(?:u#HexDigit{4}|x#HexDigit{2}|0(?![0-7])|\r\n|[^0-7ux])",HexDigit:"[0-9A-Fa-f]",HexIntegerLiteral:"0[Xx]#HexDigit+",NumericLiteral:"#HexIntegerLiteral|#DecimalLiteral",Separator:"#SeparatorChar|//.*(?!.)|/\\*[\\s\\S]*?\\*/",SeparatorChar:"(?!᠎)[\\s\ufeff]",SingleQuotedString:"'(?:#EscapeSequence|(?!['\\\\]).)*'",UnicodeEscapeSequence:"\\\\u#HexDigit{4}"},lr=Jt(),Ar=["false","null","true"],Tr=["arguments","debugger","delete","if","import","let","new","return","this","throw","typeof","void","while","with","yield"],Er=q("(?:#NumericLiteral|#ConstIdentifier)"),Nr=q("(?:[$\\w]|#UnicodeEscapeSequence)+"),Or=q("(?:#Separator|;)*"),Sr=q("#Separator*"),Lr=q("#SingleQuotedString|#DoubleQuotedString"),Ir="function"!=typeof WeakRef?Ie:(or=new Map,ur=new FinalizationRegistry(function(e){var t=or.get(e);t&&!t.deref()&&or.delete(e)}),function(e){var t,n=or.get(e);return(t=n?n.deref():t)||(t=Ie(e))&&!0!==t&&(n=new WeakRef(t),or.set(e,n),ur.register(t,e)),t}),dr=0,pr=1;T(pe.prototype,{get length(){return this.oe},append:function(t){var e=this.ee;if(e.length>=this.re)return!1;e.push(t);var n=t.appendLength;return this.te.forEach(function(e){(e=e.appendLengthOf(t))i)return}return E}(this,e,s||u?2:t||o?1:0,n,c,i);if(f){for(var R=0;Rc)return}else{var T=n.concat(R+1),E=c-f.length-2,N=l.str;if(!(E=null!=N?(0,i.string)(this,N,0,T,E):this.Ce(l,!1,T,E,i)))return;f+="get"===A?"["+E+"]":"("+E+")"}}f+=u,o&&(f=o+f,a&&(f="("+f+")"))}return f},Oe:function(e,t,n,r,i){var o;return r||Ge(this,"Missing padding entries for index "+n),r="number"==typeof(r=this.findDefinition(r))?(i=this.findDefinition(i),o=this.Ie(r),n+r+i):(o=r.block,r.shiftedIndex),r=this.replaceExpr("("+o+"+"+t+")["+r+"]"),new wn(e,r,tn.STRING)},Le:function(e,t,n,r){var i=this.findDefinition($n),o=i.expr,n=n(i=t+i.shift);return this.Oe(e,o,i,n,r)},constantDefinitions:Jn,findDefinition:function(e){var t=e.cacheKey;void 0===t&&(e.cacheKey=t=++dr);var n,r=this.ce;if(t in r)return r[t];for(var i=e.length;i--;){var o=e[i];if(this.hasFeatures(o.mask)){n=o.definition;break}}return r[t]=n},hasFeatures:function(e){return f(this.mask,e)},maxGroupThreshold:1800,replaceExpr:function(e,t){function r(e,t,n){return n.optimize=i,(n=e.replaceString(t,n))||Ge(e,"String too complex"),n}var i;return(e=Ir(e))&&!0!==e||Ge(this,"Syntax error"),i=t,this.Ce(e,!(t={appendString:function(e,t,n){return r(e,t,{firstSolution:n,screwMode:pr})},identifier:He,string:function(e,t,n){return r(e,t,{screwMode:n})}}),[],NaN,t)},replaceString:function(e,t){var n=this.Fe(e,(t=t||{}).optimize),r=new pe(t.screwMode||0,this.maxGroupThreshold,n),n=t.firstSolution,i=t.maxLength;if(!(n&&(r.append(n),r.length>i))){for(var o=e.length,u=0;ui)return}return(n=Xt(r)).length>i?void 0:n}},resolve:function(e,t,n){var r,i,o=typeof e,u="function"==o?e.call(this,t):("object"==o?(r=e.expr,u=e.solutionType,i=e.optimize):r=e,i=this.replaceExpr(r,i),new wn(t,i,u=null==u?null!=n?n:tn.STRING:u));return u},resolveCharacter:function(r){var i=this.ue,o=i[r];return void 0===o&&me(this,wt(r),function(){var e,t,n=qn[r];!n||Pt(n)?(o=n?De(this,r,n):o)||(t=(e=r).charCodeAt(),o=this.Se(e,t,t<256,!0,!0,!0)):((o=yr.resolve(n,r)).entryCode="static",i=vr),i[r]=o}),o},resolveConstant:function(t){var n=this.ae,r=n[t];return void 0===r&&me(this,t,function(){var e=this.constantDefinitions[t];Pt(e)?r=De(this,t,e,tn.OBJECT):(r=yr.resolve(e,void 0,tn.OBJECT),n=gr),n[t]=r}),r}});var wr=yr,Dr={joiner:"false",separator:"false"},xr={joiner:"",separator:'Function("return/(?=false|true)/")()'},Hr={identifier:function(e,t,n,r,i){return ze(e,"return "+t,ot,Ze(r),i)},string:function(e,t,n,r,i){return Ve(e,t,n,Ze(r),i)}};ut.forceString=!(ot.forceString=!1);var Ur=ke([""],"false"),Mr=ke(["false","true"],""),Gr={byCharCodes:Ct(function(e,t){return this.be(e,void 0,t)},2),byCharCodesRadix4:Ct(function(e,t){return this.be(e,4,t)},25),byCodePoints:Ct(function(e,t){return this.Pe(e,void 0,t)},3,void 0,ce.FROM_CODE_POINT),byCodePointsRadix4:Ct(function(e,t){return this.Pe(e,4,t)},38,void 0,ce.FROM_CODE_POINT),byDenseFigures:Ct(function(e,t){return this.ve(e,t)},1888),byDict:Ct(function(e,t){return this.ge(e,void 0,void 0,t)},2),byDictRadix3AmendedBy1:Ct(function(e,t){return this.ge(e,3,1,t)},153),byDictRadix4:Ct(function(e,t){return this.ge(e,4,0,t)},160),byDictRadix4AmendedBy1:Ct(function(e,t){return this.ge(e,4,1,t)},218),byDictRadix4AmendedBy2:Ct(function(e,t){return this.ge(e,4,2,t)},279),byDictRadix5:Ct(function(e,t){return this.ge(e,5,0,t)},223),byDictRadix5AmendedBy3:Ct(function(e,t){return this.ge(e,5,3,t)},602),bySparseFigures:Ct(function(e,t){return this.ye(e,t)},347),express:Ct(function(e,t){return e=e.valueOf(),this.me(e,t)},void 0,!0),plain:Ct(function(e,t){var n=e.valueOf(),e={maxLength:t,optimize:!0,screwMode:e.screwMode};return this.replaceString(n,e)}),text:Ct(function(e,t){return ze(this,e.valueOf(),e.wrapper,void 0,t)})};T(ye.prototype,{Re:function(e,t,n){return e(t,n)},be:function(e,t,n){var r=this.findDefinition(Un);return Xe(this,e,r,nt,t,n)},Pe:function(e,t,n){return Xe(this,e,"fromCodePoint",rt,t,n)},ve:function(e,t){return Qe(this,tt,Mr,Je,[xr],e,t)},ge:function(e,t,n,r){var i=e.valueOf(),o=$e(e),u=o.length,a=!t||u&&71a))&&(R={screwMode:t?pr:0},r.some(function(e){return e=it(g(e,R)),f?f+="["+o+"]("+(e="[]"===e?"[[]]":e)+")":f="["+e+"]",f.length>a})||(n=f)),n}});var kr=Xt.prototype.codePointAt?function(e){return e.codePointAt()}:function(e){return e.length<2?e.charCodeAt():P(e.charCodeAt(0),e.charCodeAt(1))},Wr={appendLengthOf:$t,optimizeSolutions:$t},Br=[],Yr=[],jr=36,Xr=9007199254740991,zr=[],Qr=function(){for(var e=[,,,,,,,,,,,48,50,54,,64],t=1/0,n=jr;12<=n;--n){var r=Ue(n),i=r.length;it;)n+=e[r].appendLength;return n}(r,e,i=2*o+1)-l,e||i!==c||(a?t-=3:u&&(t+=2)),e&&r[e].isWeak&&(t+=2),0>1,r={appendLengthOf:function(e){if((e=e.source)&&1===e.length&&55296<=(e=e.charCodeAt())&&e<=57343)return u},optimizeSolutions:function(e,t,n){for(var r=t.length-1;r--;){var i,o,u,a=t[r],c=a.source,_=_t(c,55296,56319);_&&(u=_t(i=(o=t[r+1]).source,56320,57343))&&(u=P(_,u),u=y(s.pe(u),s.he(u)),o=a.appendLength+o.appendLength-u.length-1,2===t.length&&n&&(o+=2),0 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -JScrewIt Test Suite - -

JScrewIt Test Suite

-
-
-
-
-
diff --git a/ui/ui.js b/ui/ui.js deleted file mode 100644 index 710e4b9f..00000000 --- a/ui/ui.js +++ /dev/null @@ -1 +0,0 @@ -!function(){"use strict";function i(e){var t=typeof e;return"object"==t&&null!==e||"undefined"==t&&void 0!==e}function o(n,o,r,a){return function(t){function e(e){t[a](e,o,r)}Array.isArray(n)?n.forEach(e):e(n)}}function c(e){e.removeAttribute("tabindex")}function x(e){e.setAttribute("tabindex",0)}function D(e){function t(){u.className="button focusable",i("off")}function n(e){e.target!==u&&r()&&t()}function o(e){!e.relatedTarget&&r()&&t()}function r(){return/\bactive\b/.test(u.className)}function a(){return!u.hasAttribute("tabindex")}function i(e){e=F[e],F(document,e("mousemove",n),e("mouseout",o))}var u=F("SPAN",{className:"button focusable",get disabled(){return a()},set disabled(e){(e=!!e)!==a()&&(e?(F(u,c),r()&&(document.releaseCapture(),i("off")),u.blur()):F(u,x),u.className="",u.className="button focusable")}},x,F.on("click",function(e){a()&&e.stopImmediatePropagation(),e.preventDefault()}),F.on("keydown",function(e){13===e.keyCode&&(u.click(),e.preventDefault())}),F.on("keyup",function(e){32===e.keyCode&&(u.click(),e.preventDefault())}),F.on("mouseup",function(e){0===e.button&&r()&&(document.releaseCapture(),t())}),F("SPAN",e),F("SPAN"));return u.setCapture&&(u.firstChild.setAttribute("unselectable","on"),F(u,F.on("mousedown",function(e){0!==e.button||a()||r()||(u.setCapture(),u.className="active button focusable",i("on"))}))),u}function _(e,t){function n(){var e=document.body;e.removeChild(u),F(e,F.off("keydown",a),F.off("focus",r,!0)),void 0!==t&&t()}function o(){i.focus()}function r(e){i.contains(e.target)||o()}function a(e){var t=e.keyCode;13!==t&&27!==t||!(t=document.activeElement).contains(i)&&t.contains(e.target)||(n(),e.preventDefault())}var i=F("DIV",{style:{borderRadius:"25px",display:"inline-block",maxWidth:"500px",width:"100%"}},x,F("DIV",{className:"focusable",id:"modalBox",style:{background:"whitesmoke",border:"10px solid blue",borderRadius:"23px",margin:"2px"}},F("DIV",{style:{margin:"1.5em 1.5em .25em",overflow:"hidden"}},e,F("DIV",{style:{margin:"1.25em 0"}},F(D("OK"),{style:{maxWidth:"5em",width:"100%"}},F.on("click",n)))))),u=F("DIV",{style:{background:"rgba(0, 0, 0, .25)",overflow:"auto",position:"fixed",textAlign:"center",left:"0",top:"0",bottom:"0",width:"100%"}},F("DIV",{style:{display:"table",tableLayout:"fixed",width:"100%",height:"100%"}},F("DIV",{style:{display:"table-cell",verticalAlign:"middle"}},i)));F(document.body,u,F.on("focus",r,!0),F.on("keydown",a)),setTimeout(o)}function n(){(J=new Worker(N)).onmessage=e}function r(){URL.revokeObjectURL(N),N=void 0}function T(){var e,t=a();try{e=JScrewIt.encode(inputArea.value,t)}catch(e){return f(),void p(String(e))}b(e)}function R(){var e=a(),e={input:inputArea.value,options:e};t&&(J.terminate(),n(),e.url=g),J.postMessage(e),f(),m(!0),inputArea.onkeyup=null}function a(){return{features:j.canonicalNames}}function u(e){9!==e.keyCode&&R()}function M(e){var t;L(e)&&(e=outputArea.value.length,0===outputArea.selectionStart&&outputArea.selectionEnd===e||(outputArea.selectionStart=0,outputArea.selectionEnd=e,"scrollTopMax"in outputArea&&(t=outputArea.scrollTop,F(outputArea,F.on("scroll",function(){outputArea.scrollTop=t},{once:!0})))))}function s(){H.disabled=!1;var e=this.result;null!=e&&(inputArea.value=e),inputArea.oninput(),inputArea.disabled=!1}function O(){var e,t,n,o;try{t=(0,eval)(outputArea.value)}catch(e){n=F("P",String(e))}void 0!==t&&(e=formatValue(t),t=formatValueType(t),n=e?F("DIV",F("P",t?"Evaluation result is "+t+":":"Evaluation result is"),F("P",{style:{overflowX:"auto"}},F("DIV",{style:{display:"inline-block",textAlign:"left",whiteSpace:"pre"}},e))):F("DIV",F("P","Evaluation result is "+t+"."))),null!=n&&(o=this,_(n,function(){o.focus()}))}function e(e){var t=e.data;(e=t.error)?p(e):b(t.output),m(!1)}function L(e){var t,n,o=e.target;return(n="runtimeStyle"in o?(n=o.lastMainMouseButtonEventTimeStamp,t=0===e.button?e.timeStamp:void 0,(o.lastMainMouseButtonEventTimeStamp=t)-n<=500):2<=e.detail&&0===e.button)&&e.preventDefault(),n}function l(){function n(){var e=+new Date;0<=((d=c+(e-s)*l/250)-i)*l&&(d=i,o()),r.height=1===d?"":t.scrollHeight*d+"px",a.display=0===d?"none":""}function o(){clearInterval(u),u=null,l=0}document.querySelector("main>div").style.display="block",inputArea.value=inputArea.defaultValue,F(outputArea,F.on("mousedown",M),F.on("mouseup",L),F.on("input",V)),F(stats.parentNode,F(D("Run this"),{style:{bottom:"0",fontSize:"10pt",position:"absolute",right:"0"}},F.on("click",O))),g=W.COMPACT,j=W.AUTO.includes(g)?g:W.BROWSER,compMenu.value=j.name,compMenu.previousIndex=compMenu.selectedIndex,J?(A=R)():(g=F(D("Encode"),F.on("click",T)),F(controls,g),A=P,outputArea.value=""),"undefined"!=typeof File&&(e=F("INPUT",{accept:".js",style:{display:"none"},type:"file"},F.on("change",C)),k=HTMLInputElement.prototype.click.bind(e),H=F(D("Load file…"),F.on("click",k)),F(controls,H,e)),inputArea.oninput=A;var t,r,a,i,u,c,s,l,d,e,f,m,p,b,v,y,h,g,A,N,k=function(){var e=compMenu.selectedIndex,t=compMenu.options[e].value,n=t?W[t]:U.feature;!B&&W.areEqual(n,j)||(j=n,this()),e!==compMenu.previousIndex&&(compMenu.previousIndex=e,q.rollTo(+!t))}.bind(A);function S(e,t){return F("LABEL",{style:{display:"inline-table"}},F("SPAN",{style:{display:"table-cell",verticalAlign:"middle"}},F("INPUT",{style:{margin:"0 .25em 0 0"},type:"checkbox"},t)),F("SPAN",{style:{display:"table-cell"}},e))}function w(e){var t=F("DIV",{className:"help-text"});return t.innerHTML=e,F("SPAN",{className:"focusable",style:{background:"black",borderRadius:"1em",color:"white",cursor:"pointer",display:"inline-table",fontSize:"8pt",fontWeight:"bold",lineHeight:"10.5pt",position:"relative",textAlign:"center",top:"-1.5pt",width:"10.5pt"},title:"Learn more…"},"?",x,F.on("click",function(){_(t)}))}function E(){var t=f.checked;Array.prototype.forEach.call(p,function(e){e.checked=t})}function I(){var t=JScrewIt.Feature,e=Array.prototype.filter.call(p,function(e){return e.checked}).map(function(e){return++n,t[e.featureName]}),n=e.length;f.checked=n,f.indeterminate=n&&nWeb workers are part of a standard HTML technology used to perform background tasks in JavaScript.

Check the option Support web workers only if your code needs to run inside a web worker. To create or use a web worker in your code, this option is not required.")),F("DIV",g," ",w('

The option Generate strict mode code instructs JScrewIt to avoid optimizations that don\'t work in strict mode JavaScript code. Check this option only if your environment disallows non-strict code. You may want to do this for example in one of the following circumstances.

  • To encode a string or a number and embed it in a JavaScript file in a place where strict mode code is expected, like in a scope containing a "use strict" statement or in a class body.
  • To encode a script and run it in Node.js with the option --use_strict.
  • To encode an ECMAScript module. Note that module support in JSFuck is very limited, as import and export statements don\'t work at all. If your module doesn\'t contain these statements, you can encode it using this option.

In most other cases, this option is not required, not even to encode a script that contains a top level "use strict" statement.')),F.on("change",function(){var e;I(),(e=document.createEvent("Event")).initEvent("input",!0,!1),N.dispatchEvent(e)}))),[{name:"Chrome",versions:[{featureName:"CHROME_86",number:"86+"}]},{name:"Edge",versions:[{featureName:"CHROME_86",number:"86+"}]},{name:"Firefox",versions:[{featureName:"FF_78",number:"78–82"},{featureName:"FF_83",number:"83+"}]},{name:"Internet Explorer",versions:[{featureName:"IE_9",number:"9"},{featureName:"IE_10",number:"10"},{featureName:"IE_11",number:"11"},{featureName:"IE_11_WIN_10",number:"11 (W10)"}]},{name:"Safari",versions:[{featureName:"SAFARI_7_0",number:"7.0"},{featureName:"SAFARI_7_1",number:"7.1–8"},{featureName:"SAFARI_9",number:"9"},{featureName:"SAFARI_10",number:"10–11"},{featureName:"SAFARI_12",number:"12"},{featureName:"SAFARI_13",number:"13–14.0.0"},{featureName:"SAFARI_14_0_1",number:"14.0.1–14.0.3"},{featureName:"SAFARI_14_1",number:"14.1+"}]},{name:"Opera",versions:[{featureName:"CHROME_86",number:"72+"}]},{name:"Android Browser",versions:[{featureName:"ANDRO_4_0",number:"4.0"},{featureName:"ANDRO_4_1",number:"4.1–4.3"},{featureName:"ANDRO_4_4",number:"4.4"}]},{name:"Node.js",versions:[{featureName:"NODE_0_10",number:"0.10"},{featureName:"NODE_0_12",number:"0.12"},{featureName:"NODE_4",number:"4"},{featureName:"NODE_5",number:"5–9"},{featureName:"NODE_10",number:"10"},{featureName:"NODE_11",number:"11"},{featureName:"NODE_12",number:"12"},{featureName:"NODE_13",number:"13–14"},{featureName:"NODE_15",number:"15"},{featureName:"NODE_16",number:"16+"}]}].forEach(function(e,t){for(var n,o=e.versions,r=1&t?{className:"even-field"}:null,a=(o.length+2)/3^0,i=3*a,u=0;u:first-child",{"margin-bottom":"initial"})):e=F("DIV",F("SPAN",k)),F(q.container,F(e,{className:"frame"},U)),F(controls.parentNode,q),inputArea.selectionStart=2147483647,inputArea.focus()}function d(){document.addEventListener("DOMContentLoaded",l)}function C(){var e,t=this.files[0];t&&(inputArea.disabled=!0,inputArea.value="",H.disabled=!0,(e=new FileReader).addEventListener("loadend",s),e.readAsText(t))}function P(){A&&V(!0)}function f(){A=!1,outputArea.value="",stats.textContent="…"}function m(e){t=e,outputArea.disabled=e}function p(e){_(F("P",e))}function b(e){outputArea.value=e,V()}function V(e){var t=1===(t=outputArea.value.length)?"1 char":t+" chars";B=!!e,e&&(J&&(inputArea.onkeyup=u),t+=" – out of sync"),A=!0,stats.innerHTML=t}function v(e){var t,n=typeof e;try{t="string"==n?'"'+e+'"':0===e&&1/e<0?"-0":Array.isArray(e)?e.length?"[…]":"[]":"bigint"==n?e+"n":"symbol"!=n?String(e):e.toString()}catch(e){}return t}self.formatValue=function(e){var t;if(Array.isArray(e))try{t="["+e.map(v).join(", ")+"]"}catch(e){}else t=v(e);return t},self.formatValueType=function(e){var t;if(null!==e){var n=typeof e;if("function"==n||"object"==n||"undefined"==n){var o=Object.getPrototypeOf(e);if(o===Array.prototype)switch(e.length){case 0:t="an empty array";break;case 1:t="a one element array";break;default:t="an array"}else t=o===Date.prototype?"a date":o===RegExp.prototype?"a regular expression":"function"==n?"a function":"an object"}}return t};var y,h=Object,F=function(e){for(var t=e instanceof Node?e:"function"==typeof e?e.call(F):document.createElement(e),n=arguments.length,o=0;++o:last-child",{"border-radius":".1em"}),F.css(".button.active, .button[tabindex]:active",{background:"#29b3e5"}),F.css(".button.active>:first-child, .button[tabindex]:active>:first-child",{left:".1em",top:".1em"}),F.css(".button.active>:last-child, .button[tabindex]:active>:last-child",{"border-color":"#0088b6"}),F.css(".button:not([tabindex])",{background:"#e9e9e9",color:"#707070"}),F.css(".button:not([tabindex])>:last-child",{"border-color":"#bababa"}),F.css(".button>:first-child",{display:"inline-block",margin:".15em .5em",position:"relative","user-select":"none","-moz-user-select":"none","-ms-user-select":"none","-webkit-user-select":"none"}),F.css(".button>:last-child",{"border-color":"#707070","border-style":"solid","border-width":"1px",display:"inline-block",position:"absolute",left:"0",right:"0",top:"0",bottom:"0"}),F.css(".button[tabindex]:hover:not(.active):not(:active)",{background:"#a3f4ff"}),F.css(".button[tabindex]:hover:not(.active):not(:active)>:last-child",{"border-color":"#189fdd"}),F.css("#modalBox p:first-child",{"margin-top":"0"}),F.css("#modalBox p:last-child",{"margin-bottom":"0"}),F.css(".engine-selection-box",{background:"#f0f0f0"}),F.css(".engine-selection-box .even-field",{background:"#fff"}),F.css(".help-text",{"font-size":"11pt","text-align":"justify"}),F.css(".help-text code",{"white-space":"pre"}),F.css(".help-text dfn",{"font-style":"normal","font-weight":"bold"}),F.css(".help-text li",{margin:".5em 0"});var j,U,g,H,B,A,q,t,J,N,k="application/javascript",W=JScrewIt.Feature;!function(){var t;try{(t=new XMLHttpRequest).open("GET","lib/jscrewit.min.js",!0)}catch(e){t=void 0}if(t&&"undefined"!=typeof Worker){N=URL.createObjectURL(new Blob(['"use strict";self.onmessage=function(t){var r=t.data,t=r.url;null!=t&&importScripts(t);t=r.input;if(null!=t){try{e={output:JScrewIt.encode(t,r.options)}}catch(t){var e={error:String(t)}}postMessage(e)}};'],{type:k}));try{n()}catch(e){r()}}J?(t.onerror=function(){J.terminate(),J=void 0,r()},t.onload=function(){t.status<400?(g=URL.createObjectURL(t.response),J.postMessage({url:g})):this.onerror()},t.onloadend=function(){("loading"===document.readyState?d:l)()},t.overrideMimeType(k),t.responseType="blob",t.send()):d()}()}(); \ No newline at end of file