diff --git a/package-lock.json b/package-lock.json index b3da61e..7564586 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,2116 +1,3107 @@ { - "requires": true, - "lockfileVersion": 1, - "dependencies": { - "JSONStream": { - "version": "1.3.5", - "resolved": "https://registry.npmjs.org/JSONStream/-/JSONStream-1.3.5.tgz", - "integrity": "sha512-E+iruNOY8VV9s4JEbe1aNEm6MiszPRr/UfcHMz0TQh1BXSxHK+ASV1R6W4HpjBhSeS+54PIsAMCBmwD06LLsqQ==", - "dev": true, - "requires": { - "jsonparse": "^1.2.0", - "through": ">=2.2.7 <3" - } - }, - "accepts": { - "version": "1.3.7", - "resolved": "https://registry.npmjs.org/accepts/-/accepts-1.3.7.tgz", - "integrity": "sha512-Il80Qs2WjYlJIBNzNkK6KYqlVMTbZLXgHx2oT0pU/fjRHyEp+PEfEPY0R3WCwAGVOtauxh1hOxNgIf5bv7dQpA==", - "requires": { - "mime-types": "~2.1.24", - "negotiator": "0.6.2" - } - }, - "acorn": { - "version": "6.4.1", - "resolved": "https://registry.npmjs.org/acorn/-/acorn-6.4.1.tgz", - "integrity": "sha512-ZVA9k326Nwrj3Cj9jlh3wGFutC2ZornPNARZwsNYqQYgN0EsV2d53w5RN/co65Ohn4sUAUtb1rSUAOD6XN9idA==", - "dev": true - }, - "acorn-dynamic-import": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/acorn-dynamic-import/-/acorn-dynamic-import-4.0.0.tgz", - "integrity": "sha512-d3OEjQV4ROpoflsnUA8HozoIR504TFxNivYEUi6uwz0IYhBkTDXGuWlNdMtybRt3nqVx/L6XqMt0FxkXuWKZhw==", - "dev": true - }, - "acorn-node": { - "version": "1.7.0", - "resolved": "https://registry.npmjs.org/acorn-node/-/acorn-node-1.7.0.tgz", - "integrity": "sha512-XhahLSsCB6X6CJbe+uNu3Mn9sJBNFxtBN9NLgAOQovfS6Kh0lDUtmlclhjn9CvEK7A7YyRU13PXlNcpSiLI9Yw==", - "dev": true, - "requires": { - "acorn": "^6.1.1", - "acorn-dynamic-import": "^4.0.0", - "acorn-walk": "^6.1.1", - "xtend": "^4.0.1" - } - }, - "acorn-walk": { - "version": "6.1.1", - "resolved": "https://registry.npmjs.org/acorn-walk/-/acorn-walk-6.1.1.tgz", - "integrity": "sha512-OtUw6JUTgxA2QoqqmrmQ7F2NYqiBPi/L2jqHyFtllhOUvXYQXf0Z1CYUinIfyT4bTCGmrA7gX9FvHA81uzCoVw==", - "dev": true - }, - "agent-base": { - "version": "4.3.0", - "resolved": "https://registry.npmjs.org/agent-base/-/agent-base-4.3.0.tgz", - "integrity": "sha512-salcGninV0nPrwpGNn4VTXBb1SOuXQBiqbrNXoeizJsHrsL6ERFM2Ne3JUSBWRE6aeNJI2ROP/WEEIDUiDe3cg==", - "requires": { - "es6-promisify": "^5.0.0" - } - }, - "array-filter": { - "version": "0.0.1", - "resolved": "https://registry.npmjs.org/array-filter/-/array-filter-0.0.1.tgz", - "integrity": "sha1-fajPLiZijtcygDWB/SH2fKzS7uw=", - "dev": true - }, - "array-flatten": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/array-flatten/-/array-flatten-1.1.1.tgz", - "integrity": "sha1-ml9pkFGx5wczKPKgCJaLZOopVdI=" - }, - "array-map": { - "version": "0.0.0", - "resolved": "https://registry.npmjs.org/array-map/-/array-map-0.0.0.tgz", - "integrity": "sha1-iKK6tz0c97zVwbEYoAP2b2ZfpmI=", - "dev": true - }, - "array-reduce": { - "version": "0.0.0", - "resolved": "https://registry.npmjs.org/array-reduce/-/array-reduce-0.0.0.tgz", - "integrity": "sha1-FziZ0//Rx9k4PkR5Ul2+J4yrXys=", - "dev": true - }, - "asn1.js": { - "version": "4.10.1", - "resolved": "https://registry.npmjs.org/asn1.js/-/asn1.js-4.10.1.tgz", - "integrity": "sha512-p32cOF5q0Zqs9uBiONKYLm6BClCoBCM5O9JfeUSlnQLBTxYdTK+pW+nXflm8UkKd2UYlEbYz5qEi0JuZR9ckSw==", - "dev": true, - "requires": { - "bn.js": "^4.0.0", - "inherits": "^2.0.1", - "minimalistic-assert": "^1.0.0" - } - }, - "assert": { - "version": "1.5.0", - "resolved": "https://registry.npmjs.org/assert/-/assert-1.5.0.tgz", - "integrity": "sha512-EDsgawzwoun2CZkCgtxJbv392v4nbk9XDD06zI+kQYoBM/3RBWLlEyJARDOmhAAosBjWACEkKL6S+lIZtcAubA==", - "dev": true, - "requires": { - "object-assign": "^4.1.1", - "util": "0.10.3" - }, - "dependencies": { - "inherits": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.1.tgz", - "integrity": "sha1-sX0I0ya0Qj5Wjv9xn5GwscvfafE=", - "dev": true - }, - "util": { - "version": "0.10.3", - "resolved": "https://registry.npmjs.org/util/-/util-0.10.3.tgz", - "integrity": "sha1-evsa/lCAUkZInj23/g7TeTNqwPk=", - "dev": true, - "requires": { - "inherits": "2.0.1" - } - } - } - }, - "axios": { - "version": "0.21.4", - "resolved": "https://registry.npmjs.org/axios/-/axios-0.21.4.tgz", - "integrity": "sha512-ut5vewkiu8jjGBdqpM44XxjuCjq9LAKeHVmoVfHVzy8eHgxxq8SbAVQNovDA8mVi05kP0Ea/n/UzcSHcTJQfNg==", - "requires": { - "follow-redirects": "^1.14.0" - } - }, - "balanced-match": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.0.tgz", - "integrity": "sha1-ibTRmasr7kneFk6gK4nORi1xt2c=", - "dev": true - }, - "base64-js": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/base64-js/-/base64-js-1.3.0.tgz", - "integrity": "sha512-ccav/yGvoa80BQDljCxsmmQ3Xvx60/UpBIij5QN21W3wBi/hhIC9OoO+KLpu9IJTS9j4DRVJ3aDDF9cMSoa2lw==", - "dev": true - }, - "bignumber.js": { - "version": "9.1.0", - "resolved": "https://registry.npmjs.org/bignumber.js/-/bignumber.js-9.1.0.tgz", - "integrity": "sha512-4LwHK4nfDOraBCtst+wOWIHbu1vhvAPJK8g8nROd4iuc3PSEjWif/qwbkh8jwCJz6yDBvtU4KPynETgrfh7y3A==" - }, - "bn.js": { - "version": "4.11.8", - "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-4.11.8.tgz", - "integrity": "sha512-ItfYfPLkWHUjckQCk8xC+LwxgK8NYcXywGigJgSwOP8Y2iyWT4f2vsZnoOXTTbo+o5yXmIUJ4gn5538SO5S3gA==", - "dev": true - }, - "body-parser": { - "version": "1.19.0", - "resolved": "https://registry.npmjs.org/body-parser/-/body-parser-1.19.0.tgz", - "integrity": "sha512-dhEPs72UPbDnAQJ9ZKMNTP6ptJaionhP5cBb541nXPlW60Jepo9RV/a4fX4XWW9CuFNK22krhrj1+rgzifNCsw==", - "requires": { - "bytes": "3.1.0", - "content-type": "~1.0.4", - "debug": "2.6.9", - "depd": "~1.1.2", - "http-errors": "1.7.2", - "iconv-lite": "0.4.24", - "on-finished": "~2.3.0", - "qs": "6.7.0", - "raw-body": "2.4.0", - "type-is": "~1.6.17" - } - }, - "brace-expansion": { - "version": "1.1.11", - "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", - "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", - "dev": true, - "requires": { - "balanced-match": "^1.0.0", - "concat-map": "0.0.1" - } - }, - "brorand": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/brorand/-/brorand-1.1.0.tgz", - "integrity": "sha1-EsJe/kCkXjwyPrhnWgoM5XsiNx8=", - "dev": true - }, - "browser-pack": { - "version": "6.1.0", - "resolved": "https://registry.npmjs.org/browser-pack/-/browser-pack-6.1.0.tgz", - "integrity": "sha512-erYug8XoqzU3IfcU8fUgyHqyOXqIE4tUTTQ+7mqUjQlvnXkOO6OlT9c/ZoJVHYoAaqGxr09CN53G7XIsO4KtWA==", - "dev": true, - "requires": { - "JSONStream": "^1.0.3", - "combine-source-map": "~0.8.0", - "defined": "^1.0.0", - "safe-buffer": "^5.1.1", - "through2": "^2.0.0", - "umd": "^3.0.0" - } - }, - "browser-resolve": { - "version": "1.11.3", - "resolved": "https://registry.npmjs.org/browser-resolve/-/browser-resolve-1.11.3.tgz", - "integrity": "sha512-exDi1BYWB/6raKHmDTCicQfTkqwN5fioMFV4j8BsfMU4R2DK/QfZfK7kOVkmWCNANf0snkBzqGqAJBao9gZMdQ==", - "dev": true, - "requires": { - "resolve": "1.1.7" - }, - "dependencies": { - "resolve": { - "version": "1.1.7", - "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.1.7.tgz", - "integrity": "sha1-IDEU2CrSxe2ejgQRs5ModeiJ6Xs=", - "dev": true - } - } - }, - "browserify": { - "version": "16.2.3", - "resolved": "https://registry.npmjs.org/browserify/-/browserify-16.2.3.tgz", - "integrity": "sha512-zQt/Gd1+W+IY+h/xX2NYMW4orQWhqSwyV+xsblycTtpOuB27h1fZhhNQuipJ4t79ohw4P4mMem0jp/ZkISQtjQ==", - "dev": true, - "requires": { - "JSONStream": "^1.0.3", - "assert": "^1.4.0", - "browser-pack": "^6.0.1", - "browser-resolve": "^1.11.0", - "browserify-zlib": "~0.2.0", - "buffer": "^5.0.2", - "cached-path-relative": "^1.0.0", - "concat-stream": "^1.6.0", - "console-browserify": "^1.1.0", - "constants-browserify": "~1.0.0", - "crypto-browserify": "^3.0.0", - "defined": "^1.0.0", - "deps-sort": "^2.0.0", - "domain-browser": "^1.2.0", - "duplexer2": "~0.1.2", - "events": "^2.0.0", - "glob": "^7.1.0", - "has": "^1.0.0", - "htmlescape": "^1.1.0", - "https-browserify": "^1.0.0", - "inherits": "~2.0.1", - "insert-module-globals": "^7.0.0", - "labeled-stream-splicer": "^2.0.0", - "mkdirp": "^0.5.0", - "module-deps": "^6.0.0", - "os-browserify": "~0.3.0", - "parents": "^1.0.1", - "path-browserify": "~0.0.0", - "process": "~0.11.0", - "punycode": "^1.3.2", - "querystring-es3": "~0.2.0", - "read-only-stream": "^2.0.0", - "readable-stream": "^2.0.2", - "resolve": "^1.1.4", - "shasum": "^1.0.0", - "shell-quote": "^1.6.1", - "stream-browserify": "^2.0.0", - "stream-http": "^2.0.0", - "string_decoder": "^1.1.1", - "subarg": "^1.0.0", - "syntax-error": "^1.1.1", - "through2": "^2.0.0", - "timers-browserify": "^1.0.1", - "tty-browserify": "0.0.1", - "url": "~0.11.0", - "util": "~0.10.1", - "vm-browserify": "^1.0.0", - "xtend": "^4.0.0" - }, - "dependencies": { - "isarray": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz", - "integrity": "sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE=", - "dev": true - }, - "readable-stream": { - "version": "2.3.6", - "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.6.tgz", - "integrity": "sha512-tQtKA9WIAhBF3+VLAseyMqZeBjW0AHJoxOtYqSUZNJxauErmLbVm2FW1y+J/YA9dUrAC39ITejlZWhVIwawkKw==", - "dev": true, - "requires": { - "core-util-is": "~1.0.0", - "inherits": "~2.0.3", - "isarray": "~1.0.0", - "process-nextick-args": "~2.0.0", - "safe-buffer": "~5.1.1", - "string_decoder": "~1.1.1", - "util-deprecate": "~1.0.1" - }, - "dependencies": { - "string_decoder": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", - "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==", - "dev": true, - "requires": { - "safe-buffer": "~5.1.0" - } - } - } - }, - "string_decoder": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.2.0.tgz", - "integrity": "sha512-6YqyX6ZWEYguAxgZzHGL7SsCeGx3V2TtOTqZz1xSTSWnqsbWwbptafNyvf/ACquZUXV3DANr5BDIwNYe1mN42w==", - "dev": true, - "requires": { - "safe-buffer": "~5.1.0" - } - } - } - }, - "browserify-aes": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/browserify-aes/-/browserify-aes-1.2.0.tgz", - "integrity": "sha512-+7CHXqGuspUn/Sl5aO7Ea0xWGAtETPXNSAjHo48JfLdPWcMng33Xe4znFvQweqc/uzk5zSOI3H52CYnjCfb5hA==", - "dev": true, - "requires": { - "buffer-xor": "^1.0.3", - "cipher-base": "^1.0.0", - "create-hash": "^1.1.0", - "evp_bytestokey": "^1.0.3", - "inherits": "^2.0.1", - "safe-buffer": "^5.0.1" - } - }, - "browserify-cipher": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/browserify-cipher/-/browserify-cipher-1.0.1.tgz", - "integrity": "sha512-sPhkz0ARKbf4rRQt2hTpAHqn47X3llLkUGn+xEJzLjwY8LRs2p0v7ljvI5EyoRO/mexrNunNECisZs+gw2zz1w==", - "dev": true, - "requires": { - "browserify-aes": "^1.0.4", - "browserify-des": "^1.0.0", - "evp_bytestokey": "^1.0.0" - } - }, - "browserify-des": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/browserify-des/-/browserify-des-1.0.2.tgz", - "integrity": "sha512-BioO1xf3hFwz4kc6iBhI3ieDFompMhrMlnDFC4/0/vd5MokpuAc3R+LYbwTA9A5Yc9pq9UYPqffKpW2ObuwX5A==", - "dev": true, - "requires": { - "cipher-base": "^1.0.1", - "des.js": "^1.0.0", - "inherits": "^2.0.1", - "safe-buffer": "^5.1.2" - } - }, - "browserify-rsa": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/browserify-rsa/-/browserify-rsa-4.0.1.tgz", - "integrity": "sha1-IeCr+vbyApzy+vsTNWenAdQTVSQ=", - "dev": true, - "requires": { - "bn.js": "^4.1.0", - "randombytes": "^2.0.1" - } - }, - "browserify-sign": { - "version": "4.0.4", - "resolved": "https://registry.npmjs.org/browserify-sign/-/browserify-sign-4.0.4.tgz", - "integrity": "sha1-qk62jl17ZYuqa/alfmMMvXqT0pg=", - "dev": true, - "requires": { - "bn.js": "^4.1.1", - "browserify-rsa": "^4.0.0", - "create-hash": "^1.1.0", - "create-hmac": "^1.1.2", - "elliptic": "^6.0.0", - "inherits": "^2.0.1", - "parse-asn1": "^5.0.0" - } - }, - "browserify-zlib": { - "version": "0.2.0", - "resolved": "https://registry.npmjs.org/browserify-zlib/-/browserify-zlib-0.2.0.tgz", - "integrity": "sha512-Z942RysHXmJrhqk88FmKBVq/v5tqmSkDz7p54G/MGyjMnCFFnC79XWNbg+Vta8W6Wb2qtSZTSxIGkJrRpCFEiA==", - "dev": true, - "requires": { - "pako": "~1.0.5" - } - }, - "buffer": { - "version": "5.2.1", - "resolved": "https://registry.npmjs.org/buffer/-/buffer-5.2.1.tgz", - "integrity": "sha512-c+Ko0loDaFfuPWiL02ls9Xd3GO3cPVmUobQ6t3rXNUk304u6hGq+8N/kFi+QEIKhzK3uwolVhLzszmfLmMLnqg==", - "dev": true, - "requires": { - "base64-js": "^1.0.2", - "ieee754": "^1.1.4" - } - }, - "buffer-alloc": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/buffer-alloc/-/buffer-alloc-1.2.0.tgz", - "integrity": "sha512-CFsHQgjtW1UChdXgbyJGtnm+O/uLQeZdtbDo8mfUgYXCHSM1wgrVxXm6bSyrUuErEb+4sYVGCzASBRot7zyrow==", - "requires": { - "buffer-alloc-unsafe": "^1.1.0", - "buffer-fill": "^1.0.0" - } - }, - "buffer-alloc-unsafe": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/buffer-alloc-unsafe/-/buffer-alloc-unsafe-1.1.0.tgz", - "integrity": "sha512-TEM2iMIEQdJ2yjPJoSIsldnleVaAk1oW3DBVUykyOLsEsFmEc9kn+SFFPz+gl54KQNxlDnAwCXosOS9Okx2xAg==" - }, - "buffer-fill": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/buffer-fill/-/buffer-fill-1.0.0.tgz", - "integrity": "sha1-+PeLdniYiO858gXNY39o5wISKyw=" - }, - "buffer-from": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/buffer-from/-/buffer-from-1.1.1.tgz", - "integrity": "sha512-MQcXEUbCKtEo7bhqEs6560Hyd4XaovZlO/k9V3hjVUF/zwW7KBVdSK4gIt/bzwS9MbR5qob+F5jusZsb0YQK2A==" - }, - "buffer-xor": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/buffer-xor/-/buffer-xor-1.0.3.tgz", - "integrity": "sha1-JuYe0UIvtw3ULm42cp7VHYVf6Nk=", - "dev": true - }, + "name": "hound-sdk-web-example", + "lockfileVersion": 3, + "requires": true, + "packages": { + "": { + "license": "MIT", + "dependencies": { + "body-parser": "^1.18.3", + "bufferutil": "^4.0.1", + "express": "^4.16.3", + "houndify": "4.0.0-beta.3", + "minimist": "^1.2.5", + "utf-8-validate": "^5.0.2", + "wav": "^1.0.0" + }, + "devDependencies": { + "browserify": "^16.2.3" + } + }, + "node_modules/accepts": { + "version": "1.3.8", + "resolved": "https://registry.npmjs.org/accepts/-/accepts-1.3.8.tgz", + "integrity": "sha512-PYAthTa2m2VKxuvSD3DPC/Gy+U+sOA1LAuT8mkmRuvw+NACSaeXEQ+NHcVF7rONl6qcaxV3Uuemwawk+7+SJLw==", + "license": "MIT", + "dependencies": { + "mime-types": "~2.1.34", + "negotiator": "0.6.3" + }, + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/acorn": { + "version": "7.4.1", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-7.4.1.tgz", + "integrity": "sha512-nQyp0o1/mNdbTO1PO6kHkwSrmgZ0MT/jCCpNiwbUjGoRN4dlBhqJtoQuCnEOKzgTVwg0ZWiCoQy6SxMebQVh8A==", + "dev": true, + "license": "MIT", + "bin": { + "acorn": "bin/acorn" + }, + "engines": { + "node": ">=0.4.0" + } + }, + "node_modules/acorn-node": { + "version": "1.8.2", + "resolved": "https://registry.npmjs.org/acorn-node/-/acorn-node-1.8.2.tgz", + "integrity": "sha512-8mt+fslDufLYntIoPAaIMUe/lrbrehIiwmR3t2k9LljIzoigEPF27eLk2hy8zSGzmR/ogr7zbRKINMo1u0yh5A==", + "dev": true, + "license": "Apache-2.0", + "dependencies": { + "acorn": "^7.0.0", + "acorn-walk": "^7.0.0", + "xtend": "^4.0.2" + } + }, + "node_modules/acorn-walk": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/acorn-walk/-/acorn-walk-7.2.0.tgz", + "integrity": "sha512-OPdCF6GsMIP+Az+aWfAAOEt2/+iVDKE7oy6lJ098aoe59oAmK76qV6Gw60SbZ8jHuG2wH058GF4pLFbYamYrVA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.4.0" + } + }, + "node_modules/agent-base": { + "version": "6.0.2", + "resolved": "https://registry.npmjs.org/agent-base/-/agent-base-6.0.2.tgz", + "integrity": "sha512-RZNwNclF7+MS/8bDg70amg32dyeZGZxiDuQmZxKLAlQjr3jGyLx+4Kkk58UO7D2QdgFIQCovuSuZESne6RG6XQ==", + "license": "MIT", + "dependencies": { + "debug": "4" + }, + "engines": { + "node": ">= 6.0.0" + } + }, + "node_modules/agent-base/node_modules/debug": { + "version": "4.4.3", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.4.3.tgz", + "integrity": "sha512-RGwwWnwQvkVfavKVt22FGLw+xYSdzARwm0ru6DhTVA3umU5hZc28V3kO4stgYryrTlLpuvgI9GiijltAjNbcqA==", + "license": "MIT", + "dependencies": { + "ms": "^2.1.3" + }, + "engines": { + "node": ">=6.0" + }, + "peerDependenciesMeta": { + "supports-color": { + "optional": true + } + } + }, + "node_modules/agent-base/node_modules/ms": { + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", + "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==", + "license": "MIT" + }, + "node_modules/array-flatten": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/array-flatten/-/array-flatten-1.1.1.tgz", + "integrity": "sha512-PCVAQswWemu6UdxsDFFX/+gVeYqKAod3D3UVm91jHwynguOwAvYPhx8nNlM++NqRcK6CxxpUafjmhIdKiHibqg==", + "license": "MIT" + }, + "node_modules/asn1.js": { + "version": "4.10.1", + "resolved": "https://registry.npmjs.org/asn1.js/-/asn1.js-4.10.1.tgz", + "integrity": "sha512-p32cOF5q0Zqs9uBiONKYLm6BClCoBCM5O9JfeUSlnQLBTxYdTK+pW+nXflm8UkKd2UYlEbYz5qEi0JuZR9ckSw==", + "dev": true, + "license": "MIT", + "dependencies": { + "bn.js": "^4.0.0", + "inherits": "^2.0.1", + "minimalistic-assert": "^1.0.0" + } + }, + "node_modules/asn1.js/node_modules/bn.js": { + "version": "4.12.2", + "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-4.12.2.tgz", + "integrity": "sha512-n4DSx829VRTRByMRGdjQ9iqsN0Bh4OolPsFnaZBLcbi8iXcB+kJ9s7EnRt4wILZNV3kPLHkRVfOc/HvhC3ovDw==", + "dev": true, + "license": "MIT" + }, + "node_modules/assert": { + "version": "1.5.1", + "resolved": "https://registry.npmjs.org/assert/-/assert-1.5.1.tgz", + "integrity": "sha512-zzw1uCAgLbsKwBfFc8CX78DDg+xZeBksSO3vwVIDDN5i94eOrPsSSyiVhmsSABFDM/OcpE2aagCat9dnWQLG1A==", + "dev": true, + "license": "MIT", + "dependencies": { + "object.assign": "^4.1.4", + "util": "^0.10.4" + } + }, + "node_modules/asynckit": { + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz", + "integrity": "sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q==", + "license": "MIT" + }, + "node_modules/available-typed-arrays": { + "version": "1.0.7", + "resolved": "https://registry.npmjs.org/available-typed-arrays/-/available-typed-arrays-1.0.7.tgz", + "integrity": "sha512-wvUjBtSGN7+7SjNpq/9M2Tg350UZD3q62IFZLbRAR1bSMlCo1ZaeW+BJ+D090e4hIIZLBcTDWe4Mh4jvUDajzQ==", + "license": "MIT", + "dependencies": { + "possible-typed-array-names": "^1.0.0" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/axios": { + "version": "1.12.2", + "resolved": "https://registry.npmjs.org/axios/-/axios-1.12.2.tgz", + "integrity": "sha512-vMJzPewAlRyOgxV2dU0Cuz2O8zzzx9VYtbJOaBgXFeLc4IV/Eg50n4LowmehOOR61S8ZMpc2K5Sa7g6A4jfkUw==", + "license": "MIT", + "dependencies": { + "follow-redirects": "^1.15.6", + "form-data": "^4.0.4", + "proxy-from-env": "^1.1.0" + } + }, + "node_modules/balanced-match": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz", + "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==", + "dev": true, + "license": "MIT" + }, + "node_modules/base64-js": { + "version": "1.5.1", + "resolved": "https://registry.npmjs.org/base64-js/-/base64-js-1.5.1.tgz", + "integrity": "sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ], + "license": "MIT" + }, + "node_modules/bignumber.js": { + "version": "9.3.1", + "resolved": "https://registry.npmjs.org/bignumber.js/-/bignumber.js-9.3.1.tgz", + "integrity": "sha512-Ko0uX15oIUS7wJ3Rb30Fs6SkVbLmPBAKdlm7q9+ak9bbIeFf0MwuBsQV6z7+X768/cHsfg+WlysDWJcmthjsjQ==", + "license": "MIT", + "engines": { + "node": "*" + } + }, + "node_modules/bn.js": { + "version": "5.2.2", + "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-5.2.2.tgz", + "integrity": "sha512-v2YAxEmKaBLahNwE1mjp4WON6huMNeuDvagFZW+ASCuA/ku0bXR9hSMw0XpiqMoA3+rmnyck/tPRSFQkoC9Cuw==", + "dev": true, + "license": "MIT" + }, + "node_modules/body-parser": { + "version": "1.20.3", + "resolved": "https://registry.npmjs.org/body-parser/-/body-parser-1.20.3.tgz", + "integrity": "sha512-7rAxByjUMqQ3/bHJy7D6OGXvx/MMc4IqBn/X0fcM1QUcAItpZrBEYhWGem+tzXH90c+G01ypMcYJBO9Y30203g==", + "license": "MIT", + "dependencies": { + "bytes": "3.1.2", + "content-type": "~1.0.5", + "debug": "2.6.9", + "depd": "2.0.0", + "destroy": "1.2.0", + "http-errors": "2.0.0", + "iconv-lite": "0.4.24", + "on-finished": "2.4.1", + "qs": "6.13.0", + "raw-body": "2.5.2", + "type-is": "~1.6.18", + "unpipe": "1.0.0" + }, + "engines": { + "node": ">= 0.8", + "npm": "1.2.8000 || >= 1.4.16" + } + }, + "node_modules/brace-expansion": { + "version": "1.1.12", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.12.tgz", + "integrity": "sha512-9T9UjW3r0UW5c1Q7GTwllptXwhvYmEzFhzMfZ9H7FQWt+uZePjZPjBP/W1ZEyZ1twGWom5/56TF4lPcqjnDHcg==", + "dev": true, + "license": "MIT", + "dependencies": { + "balanced-match": "^1.0.0", + "concat-map": "0.0.1" + } + }, + "node_modules/brorand": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/brorand/-/brorand-1.1.0.tgz", + "integrity": "sha512-cKV8tMCEpQs4hK/ik71d6LrPOnpkpGBR0wzxqr68g2m/LB2GxVYQroAjMJZRVM1Y4BCjCKc3vAamxSzOY2RP+w==", + "dev": true, + "license": "MIT" + }, + "node_modules/browser-pack": { + "version": "6.1.0", + "resolved": "https://registry.npmjs.org/browser-pack/-/browser-pack-6.1.0.tgz", + "integrity": "sha512-erYug8XoqzU3IfcU8fUgyHqyOXqIE4tUTTQ+7mqUjQlvnXkOO6OlT9c/ZoJVHYoAaqGxr09CN53G7XIsO4KtWA==", + "dev": true, + "license": "MIT", + "dependencies": { + "combine-source-map": "~0.8.0", + "defined": "^1.0.0", + "JSONStream": "^1.0.3", + "safe-buffer": "^5.1.1", + "through2": "^2.0.0", + "umd": "^3.0.0" + }, + "bin": { + "browser-pack": "bin/cmd.js" + } + }, + "node_modules/browser-resolve": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/browser-resolve/-/browser-resolve-2.0.0.tgz", + "integrity": "sha512-7sWsQlYL2rGLy2IWm8WL8DCTJvYLc/qlOnsakDac87SOoCd16WLsaAMdCiAqsTNHIe+SXfaqyxyo6THoWqs8WQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "resolve": "^1.17.0" + } + }, + "node_modules/browserify": { + "version": "16.5.2", + "resolved": "https://registry.npmjs.org/browserify/-/browserify-16.5.2.tgz", + "integrity": "sha512-TkOR1cQGdmXU9zW4YukWzWVSJwrxmNdADFbqbE3HFgQWe5wqZmOawqZ7J/8MPCwk/W8yY7Y0h+7mOtcZxLP23g==", + "dev": true, + "license": "MIT", + "dependencies": { + "assert": "^1.4.0", + "browser-pack": "^6.0.1", + "browser-resolve": "^2.0.0", + "browserify-zlib": "~0.2.0", + "buffer": "~5.2.1", + "cached-path-relative": "^1.0.0", + "concat-stream": "^1.6.0", + "console-browserify": "^1.1.0", + "constants-browserify": "~1.0.0", + "crypto-browserify": "^3.0.0", + "defined": "^1.0.0", + "deps-sort": "^2.0.0", + "domain-browser": "^1.2.0", + "duplexer2": "~0.1.2", + "events": "^2.0.0", + "glob": "^7.1.0", + "has": "^1.0.0", + "htmlescape": "^1.1.0", + "https-browserify": "^1.0.0", + "inherits": "~2.0.1", + "insert-module-globals": "^7.0.0", + "JSONStream": "^1.0.3", + "labeled-stream-splicer": "^2.0.0", + "mkdirp-classic": "^0.5.2", + "module-deps": "^6.2.3", + "os-browserify": "~0.3.0", + "parents": "^1.0.1", + "path-browserify": "~0.0.0", + "process": "~0.11.0", + "punycode": "^1.3.2", + "querystring-es3": "~0.2.0", + "read-only-stream": "^2.0.0", + "readable-stream": "^2.0.2", + "resolve": "^1.1.4", + "shasum": "^1.0.0", + "shell-quote": "^1.6.1", + "stream-browserify": "^2.0.0", + "stream-http": "^3.0.0", + "string_decoder": "^1.1.1", + "subarg": "^1.0.0", + "syntax-error": "^1.1.1", + "through2": "^2.0.0", + "timers-browserify": "^1.0.1", + "tty-browserify": "0.0.1", + "url": "~0.11.0", + "util": "~0.10.1", + "vm-browserify": "^1.0.0", + "xtend": "^4.0.0" + }, + "bin": { + "browserify": "bin/cmd.js" + }, + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/browserify-aes": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/browserify-aes/-/browserify-aes-1.2.0.tgz", + "integrity": "sha512-+7CHXqGuspUn/Sl5aO7Ea0xWGAtETPXNSAjHo48JfLdPWcMng33Xe4znFvQweqc/uzk5zSOI3H52CYnjCfb5hA==", + "dev": true, + "license": "MIT", + "dependencies": { + "buffer-xor": "^1.0.3", + "cipher-base": "^1.0.0", + "create-hash": "^1.1.0", + "evp_bytestokey": "^1.0.3", + "inherits": "^2.0.1", + "safe-buffer": "^5.0.1" + } + }, + "node_modules/browserify-cipher": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/browserify-cipher/-/browserify-cipher-1.0.1.tgz", + "integrity": "sha512-sPhkz0ARKbf4rRQt2hTpAHqn47X3llLkUGn+xEJzLjwY8LRs2p0v7ljvI5EyoRO/mexrNunNECisZs+gw2zz1w==", + "dev": true, + "license": "MIT", + "dependencies": { + "browserify-aes": "^1.0.4", + "browserify-des": "^1.0.0", + "evp_bytestokey": "^1.0.0" + } + }, + "node_modules/browserify-des": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/browserify-des/-/browserify-des-1.0.2.tgz", + "integrity": "sha512-BioO1xf3hFwz4kc6iBhI3ieDFompMhrMlnDFC4/0/vd5MokpuAc3R+LYbwTA9A5Yc9pq9UYPqffKpW2ObuwX5A==", + "dev": true, + "license": "MIT", + "dependencies": { + "cipher-base": "^1.0.1", + "des.js": "^1.0.0", + "inherits": "^2.0.1", + "safe-buffer": "^5.1.2" + } + }, + "node_modules/browserify-rsa": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/browserify-rsa/-/browserify-rsa-4.1.1.tgz", + "integrity": "sha512-YBjSAiTqM04ZVei6sXighu679a3SqWORA3qZTEqZImnlkDIFtKc6pNutpjyZ8RJTjQtuYfeetkxM11GwoYXMIQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "bn.js": "^5.2.1", + "randombytes": "^2.1.0", + "safe-buffer": "^5.2.1" + }, + "engines": { + "node": ">= 0.10" + } + }, + "node_modules/browserify-sign": { + "version": "4.2.5", + "resolved": "https://registry.npmjs.org/browserify-sign/-/browserify-sign-4.2.5.tgz", + "integrity": "sha512-C2AUdAJg6rlM2W5QMp2Q4KGQMVBwR1lIimTsUnutJ8bMpW5B52pGpR2gEnNBNwijumDo5FojQ0L9JrXA8m4YEw==", + "dev": true, + "license": "ISC", + "dependencies": { + "bn.js": "^5.2.2", + "browserify-rsa": "^4.1.1", + "create-hash": "^1.2.0", + "create-hmac": "^1.1.7", + "elliptic": "^6.6.1", + "inherits": "^2.0.4", + "parse-asn1": "^5.1.9", + "readable-stream": "^2.3.8", + "safe-buffer": "^5.2.1" + }, + "engines": { + "node": ">= 0.10" + } + }, + "node_modules/browserify-zlib": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/browserify-zlib/-/browserify-zlib-0.2.0.tgz", + "integrity": "sha512-Z942RysHXmJrhqk88FmKBVq/v5tqmSkDz7p54G/MGyjMnCFFnC79XWNbg+Vta8W6Wb2qtSZTSxIGkJrRpCFEiA==", + "dev": true, + "license": "MIT", + "dependencies": { + "pako": "~1.0.5" + } + }, + "node_modules/buffer": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/buffer/-/buffer-5.2.1.tgz", + "integrity": "sha512-c+Ko0loDaFfuPWiL02ls9Xd3GO3cPVmUobQ6t3rXNUk304u6hGq+8N/kFi+QEIKhzK3uwolVhLzszmfLmMLnqg==", + "dev": true, + "license": "MIT", + "dependencies": { + "base64-js": "^1.0.2", + "ieee754": "^1.1.4" + } + }, + "node_modules/buffer-alloc": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/buffer-alloc/-/buffer-alloc-1.2.0.tgz", + "integrity": "sha512-CFsHQgjtW1UChdXgbyJGtnm+O/uLQeZdtbDo8mfUgYXCHSM1wgrVxXm6bSyrUuErEb+4sYVGCzASBRot7zyrow==", + "license": "MIT", + "dependencies": { + "buffer-alloc-unsafe": "^1.1.0", + "buffer-fill": "^1.0.0" + } + }, + "node_modules/buffer-alloc-unsafe": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/buffer-alloc-unsafe/-/buffer-alloc-unsafe-1.1.0.tgz", + "integrity": "sha512-TEM2iMIEQdJ2yjPJoSIsldnleVaAk1oW3DBVUykyOLsEsFmEc9kn+SFFPz+gl54KQNxlDnAwCXosOS9Okx2xAg==", + "license": "MIT" + }, + "node_modules/buffer-fill": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/buffer-fill/-/buffer-fill-1.0.0.tgz", + "integrity": "sha512-T7zexNBwiiaCOGDg9xNX9PBmjrubblRkENuptryuI64URkXDFum9il/JGL8Lm8wYfAXpredVXXZz7eMHilimiQ==", + "license": "MIT" + }, + "node_modules/buffer-from": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/buffer-from/-/buffer-from-1.1.2.tgz", + "integrity": "sha512-E+XQCRwSbaaiChtv6k6Dwgc+bx+Bs6vuKJHHl5kox/BaKbhiXzqQOwK4cO22yElGp2OCmjwVhT3HmxgyPGnJfQ==", + "license": "MIT" + }, + "node_modules/buffer-xor": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/buffer-xor/-/buffer-xor-1.0.3.tgz", + "integrity": "sha512-571s0T7nZWK6vB67HI5dyUF7wXiNcfaPPPTl6zYCNApANjIvYJTg7hlud/+cJpdAhS7dVzqMLmfhfHR3rAcOjQ==", + "dev": true, + "license": "MIT" + }, + "node_modules/bufferutil": { + "version": "4.0.9", + "resolved": "https://registry.npmjs.org/bufferutil/-/bufferutil-4.0.9.tgz", + "integrity": "sha512-WDtdLmJvAuNNPzByAYpRo2rF1Mmradw6gvWsQKf63476DDXmomT9zUiGypLcG4ibIM67vhAj8jJRdbmEws2Aqw==", + "hasInstallScript": true, + "license": "MIT", + "dependencies": { + "node-gyp-build": "^4.3.0" + }, + "engines": { + "node": ">=6.14.2" + } + }, + "node_modules/builtin-status-codes": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/builtin-status-codes/-/builtin-status-codes-3.0.0.tgz", + "integrity": "sha512-HpGFw18DgFWlncDfjTa2rcQ4W88O1mC8e8yZ2AvQY5KDaktSTwo+KRf6nHK6FRI5FyRyb/5T6+TSxfP7QyGsmQ==", + "dev": true, + "license": "MIT" + }, + "node_modules/bytes": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/bytes/-/bytes-3.1.2.tgz", + "integrity": "sha512-/Nf7TyzTx6S3yRJObOAV7956r8cr2+Oj8AC5dt8wSP3BQAoeX58NoHyCU8P8zGkNXStjTSi6fzO6F0pBdcYbEg==", + "license": "MIT", + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/cached-path-relative": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/cached-path-relative/-/cached-path-relative-1.1.0.tgz", + "integrity": "sha512-WF0LihfemtesFcJgO7xfOoOcnWzY/QHR4qeDqV44jPU3HTI54+LnfXK3SA27AVVGCdZFgjjFFaqUA9Jx7dMJZA==", + "dev": true, + "license": "MIT" + }, + "node_modules/call-bind": { + "version": "1.0.8", + "resolved": "https://registry.npmjs.org/call-bind/-/call-bind-1.0.8.tgz", + "integrity": "sha512-oKlSFMcMwpUg2ednkhQ454wfWiU/ul3CkJe/PEHcTKuiX6RpbehUiFMXu13HalGZxfUwCQzZG747YXBn1im9ww==", + "license": "MIT", + "dependencies": { + "call-bind-apply-helpers": "^1.0.0", + "es-define-property": "^1.0.0", + "get-intrinsic": "^1.2.4", + "set-function-length": "^1.2.2" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/call-bind-apply-helpers": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/call-bind-apply-helpers/-/call-bind-apply-helpers-1.0.2.tgz", + "integrity": "sha512-Sp1ablJ0ivDkSzjcaJdxEunN5/XvksFJ2sMBFfq6x0ryhQV/2b/KwFe21cMpmHtPOSij8K99/wSfoEuTObmuMQ==", + "license": "MIT", + "dependencies": { + "es-errors": "^1.3.0", + "function-bind": "^1.1.2" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/call-bound": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/call-bound/-/call-bound-1.0.4.tgz", + "integrity": "sha512-+ys997U96po4Kx/ABpBCqhA9EuxJaQWDQg7295H4hBphv3IZg0boBKuwYpt4YXp6MZ5AmZQnU/tyMTlRpaSejg==", + "license": "MIT", + "dependencies": { + "call-bind-apply-helpers": "^1.0.2", + "get-intrinsic": "^1.3.0" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/cipher-base": { + "version": "1.0.7", + "resolved": "https://registry.npmjs.org/cipher-base/-/cipher-base-1.0.7.tgz", + "integrity": "sha512-Mz9QMT5fJe7bKI7MH31UilT5cEK5EHHRCccw/YRFsRY47AuNgaV6HY3rscp0/I4Q+tTW/5zoqpSeRRI54TkDWA==", + "license": "MIT", + "dependencies": { + "inherits": "^2.0.4", + "safe-buffer": "^5.2.1", + "to-buffer": "^1.2.2" + }, + "engines": { + "node": ">= 0.10" + } + }, + "node_modules/combine-source-map": { + "version": "0.8.0", + "resolved": "https://registry.npmjs.org/combine-source-map/-/combine-source-map-0.8.0.tgz", + "integrity": "sha512-UlxQ9Vw0b/Bt/KYwCFqdEwsQ1eL8d1gibiFb7lxQJFdvTgc2hIZi6ugsg+kyhzhPV+QEpUiEIwInIAIrgoEkrg==", + "dev": true, + "license": "MIT", + "dependencies": { + "convert-source-map": "~1.1.0", + "inline-source-map": "~0.6.0", + "lodash.memoize": "~3.0.3", + "source-map": "~0.5.3" + } + }, + "node_modules/combined-stream": { + "version": "1.0.8", + "resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.8.tgz", + "integrity": "sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg==", + "license": "MIT", + "dependencies": { + "delayed-stream": "~1.0.0" + }, + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/concat-map": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", + "integrity": "sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg==", + "dev": true, + "license": "MIT" + }, + "node_modules/concat-stream": { + "version": "1.6.2", + "resolved": "https://registry.npmjs.org/concat-stream/-/concat-stream-1.6.2.tgz", + "integrity": "sha512-27HBghJxjiZtIk3Ycvn/4kbJk/1uZuJFfuPEns6LaEvpvG1f0hTea8lilrouyo9mVc2GWdcEZ8OLoGmSADlrCw==", + "dev": true, + "engines": [ + "node >= 0.8" + ], + "license": "MIT", + "dependencies": { + "buffer-from": "^1.0.0", + "inherits": "^2.0.3", + "readable-stream": "^2.2.2", + "typedarray": "^0.0.6" + } + }, + "node_modules/console-browserify": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/console-browserify/-/console-browserify-1.2.0.tgz", + "integrity": "sha512-ZMkYO/LkF17QvCPqM0gxw8yUzigAOZOSWSHg91FH6orS7vcEj5dVZTidN2fQ14yBSdg97RqhSNwLUXInd52OTA==", + "dev": true + }, + "node_modules/constants-browserify": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/constants-browserify/-/constants-browserify-1.0.0.tgz", + "integrity": "sha512-xFxOwqIzR/e1k1gLiWEophSCMqXcwVHIH7akf7b/vxcUeGunlj3hvZaaqxwHsTgn+IndtkQJgSztIDWeumWJDQ==", + "dev": true, + "license": "MIT" + }, + "node_modules/content-disposition": { + "version": "0.5.4", + "resolved": "https://registry.npmjs.org/content-disposition/-/content-disposition-0.5.4.tgz", + "integrity": "sha512-FveZTNuGw04cxlAiWbzi6zTAL/lhehaWbTtgluJh4/E95DqMwTmha3KZN1aAWA8cFIhHzMZUvLevkw5Rqk+tSQ==", + "license": "MIT", + "dependencies": { + "safe-buffer": "5.2.1" + }, + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/content-type": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/content-type/-/content-type-1.0.5.tgz", + "integrity": "sha512-nTjqfcBFEipKdXCv4YDQWCfmcLZKm81ldF0pAopTvyrFGVbcR6P/VAAd5G7N+0tTr8QqiU0tFadD6FK4NtJwOA==", + "license": "MIT", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/convert-source-map": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/convert-source-map/-/convert-source-map-1.1.3.tgz", + "integrity": "sha512-Y8L5rp6jo+g9VEPgvqNfEopjTR4OTYct8lXlS8iVQdmnjDvbdbzYe9rjtFCB9egC86JoNCU61WRY+ScjkZpnIg==", + "dev": true, + "license": "MIT" + }, + "node_modules/cookie": { + "version": "0.7.1", + "resolved": "https://registry.npmjs.org/cookie/-/cookie-0.7.1.tgz", + "integrity": "sha512-6DnInpx7SJ2AK3+CTUE/ZM0vWTUboZCegxhC2xiIydHR9jNuTAASBrfEpHhiGOZw/nX51bHt6YQl8jsGo4y/0w==", + "license": "MIT", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/cookie-signature": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/cookie-signature/-/cookie-signature-1.0.6.tgz", + "integrity": "sha512-QADzlaHc8icV8I7vbaJXJwod9HWYp8uCqf1xa4OfNu1T7JVxQIrUgOWtHdNDtPiywmFbiS12VjotIXLrKM3orQ==", + "license": "MIT" + }, + "node_modules/core-util-is": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.3.tgz", + "integrity": "sha512-ZQBvi1DcpJ4GDqanjucZ2Hj3wEO5pZDS89BWbkcrvdxksJorwUDDZamX9ldFkp9aw2lmBDLgkObEA4DWNJ9FYQ==", + "license": "MIT" + }, + "node_modules/create-ecdh": { + "version": "4.0.4", + "resolved": "https://registry.npmjs.org/create-ecdh/-/create-ecdh-4.0.4.tgz", + "integrity": "sha512-mf+TCx8wWc9VpuxfP2ht0iSISLZnt0JgWlrOKZiNqyUZWnjIaCIVNQArMHnCZKfEYRg6IM7A+NeJoN8gf/Ws0A==", + "dev": true, + "license": "MIT", + "dependencies": { + "bn.js": "^4.1.0", + "elliptic": "^6.5.3" + } + }, + "node_modules/create-ecdh/node_modules/bn.js": { + "version": "4.12.2", + "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-4.12.2.tgz", + "integrity": "sha512-n4DSx829VRTRByMRGdjQ9iqsN0Bh4OolPsFnaZBLcbi8iXcB+kJ9s7EnRt4wILZNV3kPLHkRVfOc/HvhC3ovDw==", + "dev": true, + "license": "MIT" + }, + "node_modules/create-hash": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/create-hash/-/create-hash-1.2.0.tgz", + "integrity": "sha512-z00bCGNHDG8mHAkP7CtT1qVu+bFQUPjYq/4Iv3C3kWjTFV10zIjfSoeqXo9Asws8gwSHDGj/hl2u4OGIjapeCg==", + "license": "MIT", + "dependencies": { + "cipher-base": "^1.0.1", + "inherits": "^2.0.1", + "md5.js": "^1.3.4", + "ripemd160": "^2.0.1", + "sha.js": "^2.4.0" + } + }, + "node_modules/create-hmac": { + "version": "1.1.7", + "resolved": "https://registry.npmjs.org/create-hmac/-/create-hmac-1.1.7.tgz", + "integrity": "sha512-MJG9liiZ+ogc4TzUwuvbER1JRdgvUFSB5+VR/g5h82fGaIRWMWddtKBHi7/sVhfjQZ6SehlyhvQYrcYkaUIpLg==", + "license": "MIT", + "dependencies": { + "cipher-base": "^1.0.3", + "create-hash": "^1.1.0", + "inherits": "^2.0.1", + "ripemd160": "^2.0.0", + "safe-buffer": "^5.0.1", + "sha.js": "^2.4.8" + } + }, + "node_modules/cross-fetch": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/cross-fetch/-/cross-fetch-3.2.0.tgz", + "integrity": "sha512-Q+xVJLoGOeIMXZmbUK4HYk+69cQH6LudR0Vu/pRm2YlU/hDV9CiS0gKUMaWY5f2NeUH9C1nV3bsTlCo0FsTV1Q==", + "license": "MIT", + "dependencies": { + "node-fetch": "^2.7.0" + } + }, + "node_modules/crypto-browserify": { + "version": "3.12.1", + "resolved": "https://registry.npmjs.org/crypto-browserify/-/crypto-browserify-3.12.1.tgz", + "integrity": "sha512-r4ESw/IlusD17lgQi1O20Fa3qNnsckR126TdUuBgAu7GBYSIPvdNyONd3Zrxh0xCwA4+6w/TDArBPsMvhur+KQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "browserify-cipher": "^1.0.1", + "browserify-sign": "^4.2.3", + "create-ecdh": "^4.0.4", + "create-hash": "^1.2.0", + "create-hmac": "^1.1.7", + "diffie-hellman": "^5.0.3", + "hash-base": "~3.0.4", + "inherits": "^2.0.4", + "pbkdf2": "^3.1.2", + "public-encrypt": "^4.0.3", + "randombytes": "^2.1.0", + "randomfill": "^1.0.4" + }, + "engines": { + "node": ">= 0.10" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/dash-ast": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/dash-ast/-/dash-ast-1.0.0.tgz", + "integrity": "sha512-Vy4dx7gquTeMcQR/hDkYLGUnwVil6vk4FOOct+djUnHOUWt+zJPJAaRIXaAFkPXtJjvlY7o3rfRu0/3hpnwoUA==", + "dev": true, + "license": "Apache-2.0" + }, + "node_modules/debug": { + "version": "2.6.9", + "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", + "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", + "license": "MIT", + "dependencies": { + "ms": "2.0.0" + } + }, + "node_modules/define-data-property": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/define-data-property/-/define-data-property-1.1.4.tgz", + "integrity": "sha512-rBMvIzlpA8v6E+SJZoo++HAYqsLrkg7MSfIinMPFhmkorw7X+dOXVJQs+QT69zGkzMyfDnIMN2Wid1+NbL3T+A==", + "license": "MIT", + "dependencies": { + "es-define-property": "^1.0.0", + "es-errors": "^1.3.0", + "gopd": "^1.0.1" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/define-properties": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/define-properties/-/define-properties-1.2.1.tgz", + "integrity": "sha512-8QmQKqEASLd5nx0U1B1okLElbUuuttJ/AnYmRXbbbGDWh6uS208EjD4Xqq/I9wK7u0v6O08XhTWnt5XtEbR6Dg==", + "dev": true, + "license": "MIT", + "dependencies": { + "define-data-property": "^1.0.1", + "has-property-descriptors": "^1.0.0", + "object-keys": "^1.1.1" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/defined": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/defined/-/defined-1.0.1.tgz", + "integrity": "sha512-hsBd2qSVCRE+5PmNdHt1uzyrFu5d3RwmFDKzyNZMFq/EwDNJF7Ee5+D5oEKF0hU6LhtoUF1macFvOe4AskQC1Q==", + "dev": true, + "license": "MIT", + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/delayed-stream": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz", + "integrity": "sha512-ZySD7Nf91aLB0RxL4KGrKHBXl7Eds1DAmEdcoVawXnLD7SDhpNgtuII2aAkg7a7QS41jxPSZ17p4VdGnMHk3MQ==", + "license": "MIT", + "engines": { + "node": ">=0.4.0" + } + }, + "node_modules/depd": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/depd/-/depd-2.0.0.tgz", + "integrity": "sha512-g7nH6P6dyDioJogAAGprGpCtVImJhpPk/roCzdb3fIh61/s/nPsfR6onyMwkCAR/OlC3yBC0lESvUoQEAssIrw==", + "license": "MIT", + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/deps-sort": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/deps-sort/-/deps-sort-2.0.1.tgz", + "integrity": "sha512-1orqXQr5po+3KI6kQb9A4jnXT1PBwggGl2d7Sq2xsnOeI9GPcE/tGcF9UiSZtZBM7MukY4cAh7MemS6tZYipfw==", + "dev": true, + "license": "MIT", + "dependencies": { + "JSONStream": "^1.0.3", + "shasum-object": "^1.0.0", + "subarg": "^1.0.0", + "through2": "^2.0.0" + }, + "bin": { + "deps-sort": "bin/cmd.js" + } + }, + "node_modules/des.js": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/des.js/-/des.js-1.1.0.tgz", + "integrity": "sha512-r17GxjhUCjSRy8aiJpr8/UadFIzMzJGexI3Nmz4ADi9LYSFx4gTBp80+NaX/YsXWWLhpZ7v/v/ubEc/bCNfKwg==", + "dev": true, + "license": "MIT", + "dependencies": { + "inherits": "^2.0.1", + "minimalistic-assert": "^1.0.0" + } + }, + "node_modules/destroy": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/destroy/-/destroy-1.2.0.tgz", + "integrity": "sha512-2sJGJTaXIIaR1w4iJSNoN0hnMY7Gpc/n8D4qSCJw8QqFWXf7cuAgnEHxBpweaVcPevC2l3KpjYCx3NypQQgaJg==", + "license": "MIT", + "engines": { + "node": ">= 0.8", + "npm": "1.2.8000 || >= 1.4.16" + } + }, + "node_modules/detective": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/detective/-/detective-5.2.1.tgz", + "integrity": "sha512-v9XE1zRnz1wRtgurGu0Bs8uHKFSTdteYZNbIPFVhUZ39L/S79ppMpdmVOZAnoz1jfEFodc48n6MX483Xo3t1yw==", + "dev": true, + "license": "MIT", + "dependencies": { + "acorn-node": "^1.8.2", + "defined": "^1.0.0", + "minimist": "^1.2.6" + }, + "bin": { + "detective": "bin/detective.js" + }, + "engines": { + "node": ">=0.8.0" + } + }, + "node_modules/diffie-hellman": { + "version": "5.0.3", + "resolved": "https://registry.npmjs.org/diffie-hellman/-/diffie-hellman-5.0.3.tgz", + "integrity": "sha512-kqag/Nl+f3GwyK25fhUMYj81BUOrZ9IuJsjIcDE5icNM9FJHAVm3VcUDxdLPoQtTuUylWm6ZIknYJwwaPxsUzg==", + "dev": true, + "license": "MIT", + "dependencies": { + "bn.js": "^4.1.0", + "miller-rabin": "^4.0.0", + "randombytes": "^2.0.0" + } + }, + "node_modules/diffie-hellman/node_modules/bn.js": { + "version": "4.12.2", + "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-4.12.2.tgz", + "integrity": "sha512-n4DSx829VRTRByMRGdjQ9iqsN0Bh4OolPsFnaZBLcbi8iXcB+kJ9s7EnRt4wILZNV3kPLHkRVfOc/HvhC3ovDw==", + "dev": true, + "license": "MIT" + }, + "node_modules/domain-browser": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/domain-browser/-/domain-browser-1.2.0.tgz", + "integrity": "sha512-jnjyiM6eRyZl2H+W8Q/zLMA481hzi0eszAaBUzIVnmYVDBbnLxVNnfu1HgEBvCbL+71FrxMl3E6lpKH7Ge3OXA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.4", + "npm": ">=1.2" + } + }, + "node_modules/dunder-proto": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/dunder-proto/-/dunder-proto-1.0.1.tgz", + "integrity": "sha512-KIN/nDJBQRcXw0MLVhZE9iQHmG68qAVIBg9CqmUYjmQIhgij9U5MFvrqkUL5FbtyyzZuOeOt0zdeRe4UY7ct+A==", + "license": "MIT", + "dependencies": { + "call-bind-apply-helpers": "^1.0.1", + "es-errors": "^1.3.0", + "gopd": "^1.2.0" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/duplexer2": { + "version": "0.1.4", + "resolved": "https://registry.npmjs.org/duplexer2/-/duplexer2-0.1.4.tgz", + "integrity": "sha512-asLFVfWWtJ90ZyOUHMqk7/S2w2guQKxUI2itj3d92ADHhxUSbCMGi1f1cBcJ7xM1To+pE/Khbwo1yuNbMEPKeA==", + "dev": true, + "license": "BSD-3-Clause", + "dependencies": { + "readable-stream": "^2.0.2" + } + }, + "node_modules/ee-first": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/ee-first/-/ee-first-1.1.1.tgz", + "integrity": "sha512-WMwm9LhRUo+WUaRN+vRuETqG89IgZphVSNkdFgeb6sS/E4OrDIN7t48CAewSHXc6C8lefD8KKfr5vY61brQlow==", + "license": "MIT" + }, + "node_modules/elliptic": { + "version": "6.6.1", + "resolved": "https://registry.npmjs.org/elliptic/-/elliptic-6.6.1.tgz", + "integrity": "sha512-RaddvvMatK2LJHqFJ+YA4WysVN5Ita9E35botqIYspQ4TkRAlCicdzKOjlyv/1Za5RyTNn7di//eEV0uTAfe3g==", + "dev": true, + "license": "MIT", + "dependencies": { + "bn.js": "^4.11.9", + "brorand": "^1.1.0", + "hash.js": "^1.0.0", + "hmac-drbg": "^1.0.1", + "inherits": "^2.0.4", + "minimalistic-assert": "^1.0.1", + "minimalistic-crypto-utils": "^1.0.1" + } + }, + "node_modules/elliptic/node_modules/bn.js": { + "version": "4.12.2", + "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-4.12.2.tgz", + "integrity": "sha512-n4DSx829VRTRByMRGdjQ9iqsN0Bh4OolPsFnaZBLcbi8iXcB+kJ9s7EnRt4wILZNV3kPLHkRVfOc/HvhC3ovDw==", + "dev": true, + "license": "MIT" + }, + "node_modules/encodeurl": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/encodeurl/-/encodeurl-2.0.0.tgz", + "integrity": "sha512-Q0n9HRi4m6JuGIV1eFlmvJB7ZEVxu93IrMyiMsGC0lrMJMWzRgx6WGquyfQgZVb31vhGgXnfmPNNXmxnOkRBrg==", + "license": "MIT", + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/es-define-property": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/es-define-property/-/es-define-property-1.0.1.tgz", + "integrity": "sha512-e3nRfgfUZ4rNGL232gUgX06QNyyez04KdjFrF+LTRoOXmrOgFKDg4BCdsjW8EnT69eqdYGmRpJwiPVYNrCaW3g==", + "license": "MIT", + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/es-errors": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/es-errors/-/es-errors-1.3.0.tgz", + "integrity": "sha512-Zf5H2Kxt2xjTvbJvP2ZWLEICxA6j+hAmMzIlypy4xcBg1vKVnx89Wy0GbS+kf5cwCVFFzdCFh2XSCFNULS6csw==", + "license": "MIT", + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/es-object-atoms": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/es-object-atoms/-/es-object-atoms-1.1.1.tgz", + "integrity": "sha512-FGgH2h8zKNim9ljj7dankFPcICIK9Cp5bm+c2gQSYePhpaG5+esrLODihIorn+Pe6FGJzWhXQotPv73jTaldXA==", + "license": "MIT", + "dependencies": { + "es-errors": "^1.3.0" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/es-set-tostringtag": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/es-set-tostringtag/-/es-set-tostringtag-2.1.0.tgz", + "integrity": "sha512-j6vWzfrGVfyXxge+O0x5sh6cvxAog0a/4Rdd2K36zCMV5eJ+/+tOAngRO8cODMNWbVRdVlmGZQL2YS3yR8bIUA==", + "license": "MIT", + "dependencies": { + "es-errors": "^1.3.0", + "get-intrinsic": "^1.2.6", + "has-tostringtag": "^1.0.2", + "hasown": "^2.0.2" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/escape-html": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/escape-html/-/escape-html-1.0.3.tgz", + "integrity": "sha512-NiSupZ4OeuGwr68lGIeym/ksIZMJodUGOSCZ/FSnTxcrekbvqrgdUxlJOMpijaKZVjAJrWrGs/6Jy8OMuyj9ow==", + "license": "MIT" + }, + "node_modules/etag": { + "version": "1.8.1", + "resolved": "https://registry.npmjs.org/etag/-/etag-1.8.1.tgz", + "integrity": "sha512-aIL5Fx7mawVa300al2BnEE4iNvo1qETxLrPI/o05L7z6go7fCw1J6EQmbK4FmJ2AS7kgVF/KEZWufBfdClMcPg==", + "license": "MIT", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/events": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/events/-/events-2.1.0.tgz", + "integrity": "sha512-3Zmiobend8P9DjmKAty0Era4jV8oJ0yGYe2nJJAxgymF9+N8F2m0hhZiMoWtcfepExzNKZumFU3ksdQbInGWCg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.4.x" + } + }, + "node_modules/evp_bytestokey": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/evp_bytestokey/-/evp_bytestokey-1.0.3.tgz", + "integrity": "sha512-/f2Go4TognH/KvCISP7OUsHn85hT9nUkxxA9BEWxFn+Oj9o8ZNLm/40hdlgSLyuOimsrTKLUMEorQexp/aPQeA==", + "dev": true, + "license": "MIT", + "dependencies": { + "md5.js": "^1.3.4", + "safe-buffer": "^5.1.1" + } + }, + "node_modules/express": { + "version": "4.21.2", + "resolved": "https://registry.npmjs.org/express/-/express-4.21.2.tgz", + "integrity": "sha512-28HqgMZAmih1Czt9ny7qr6ek2qddF4FclbMzwhCREB6OFfH+rXAnuNCwo1/wFvrtbgsQDb4kSbX9de9lFbrXnA==", + "license": "MIT", + "dependencies": { + "accepts": "~1.3.8", + "array-flatten": "1.1.1", + "body-parser": "1.20.3", + "content-disposition": "0.5.4", + "content-type": "~1.0.4", + "cookie": "0.7.1", + "cookie-signature": "1.0.6", + "debug": "2.6.9", + "depd": "2.0.0", + "encodeurl": "~2.0.0", + "escape-html": "~1.0.3", + "etag": "~1.8.1", + "finalhandler": "1.3.1", + "fresh": "0.5.2", + "http-errors": "2.0.0", + "merge-descriptors": "1.0.3", + "methods": "~1.1.2", + "on-finished": "2.4.1", + "parseurl": "~1.3.3", + "path-to-regexp": "0.1.12", + "proxy-addr": "~2.0.7", + "qs": "6.13.0", + "range-parser": "~1.2.1", + "safe-buffer": "5.2.1", + "send": "0.19.0", + "serve-static": "1.16.2", + "setprototypeof": "1.2.0", + "statuses": "2.0.1", + "type-is": "~1.6.18", + "utils-merge": "1.0.1", + "vary": "~1.1.2" + }, + "engines": { + "node": ">= 0.10.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/express" + } + }, + "node_modules/express-ws": { + "version": "5.0.2", + "resolved": "https://registry.npmjs.org/express-ws/-/express-ws-5.0.2.tgz", + "integrity": "sha512-0uvmuk61O9HXgLhGl3QhNSEtRsQevtmbL94/eILaliEADZBHZOQUAiHFrGPrgsjikohyrmSG5g+sCfASTt0lkQ==", + "license": "BSD-2-Clause", + "dependencies": { + "ws": "^7.4.6" + }, + "engines": { + "node": ">=4.5.0" + }, + "peerDependencies": { + "express": "^4.0.0 || ^5.0.0-alpha.1" + } + }, + "node_modules/express-ws/node_modules/ws": { + "version": "7.5.10", + "resolved": "https://registry.npmjs.org/ws/-/ws-7.5.10.tgz", + "integrity": "sha512-+dbF1tHwZpXcbOJdVOkzLDxZP1ailvSxM6ZweXTegylPny803bFhA+vqBYw4s31NSAk4S2Qz+AKXK9a4wkdjcQ==", + "license": "MIT", + "engines": { + "node": ">=8.3.0" + }, + "peerDependencies": { + "bufferutil": "^4.0.1", + "utf-8-validate": "^5.0.2" + }, + "peerDependenciesMeta": { "bufferutil": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/bufferutil/-/bufferutil-4.0.1.tgz", - "integrity": "sha512-xowrxvpxojqkagPcWRQVXZl0YXhRhAtBEIq3VoER1NH5Mw1n1o0ojdspp+GS2J//2gCVyrzQDApQ4unGF+QOoA==", - "requires": { - "node-gyp-build": "~3.7.0" - } - }, - "builtin-status-codes": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/builtin-status-codes/-/builtin-status-codes-3.0.0.tgz", - "integrity": "sha1-hZgoeOIbmOHGZCXgPQF0eI9Wnug=", - "dev": true - }, - "bytes": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/bytes/-/bytes-3.1.0.tgz", - "integrity": "sha512-zauLjrfCG+xvoyaqLoV8bLVXXNGC4JqlxFCutSDWA6fJrTo2ZuvLYTqZ7aHBLZSMOopbzwv8f+wZcVzfVTI2Dg==" - }, - "cached-path-relative": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/cached-path-relative/-/cached-path-relative-1.0.2.tgz", - "integrity": "sha512-5r2GqsoEb4qMTTN9J+WzXfjov+hjxT+j3u5K+kIVNIwAd99DLCJE9pBIMP1qVeybV6JiijL385Oz0DcYxfbOIg==", - "dev": true - }, - "cipher-base": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/cipher-base/-/cipher-base-1.0.4.tgz", - "integrity": "sha512-Kkht5ye6ZGmwv40uUDZztayT2ThLQGfnj/T71N/XzeZeo3nf8foyW7zGTsPYkEya3m5f3cAypH+qe7YOrM1U2Q==", - "requires": { - "inherits": "^2.0.1", - "safe-buffer": "^5.0.1" - } - }, - "combine-source-map": { - "version": "0.8.0", - "resolved": "https://registry.npmjs.org/combine-source-map/-/combine-source-map-0.8.0.tgz", - "integrity": "sha1-pY0N8ELBhvz4IqjoAV9UUNLXmos=", - "dev": true, - "requires": { - "convert-source-map": "~1.1.0", - "inline-source-map": "~0.6.0", - "lodash.memoize": "~3.0.3", - "source-map": "~0.5.3" - } - }, - "concat-map": { - "version": "0.0.1", - "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", - "integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=", - "dev": true - }, - "concat-stream": { - "version": "1.6.2", - "resolved": "https://registry.npmjs.org/concat-stream/-/concat-stream-1.6.2.tgz", - "integrity": "sha512-27HBghJxjiZtIk3Ycvn/4kbJk/1uZuJFfuPEns6LaEvpvG1f0hTea8lilrouyo9mVc2GWdcEZ8OLoGmSADlrCw==", - "dev": true, - "requires": { - "buffer-from": "^1.0.0", - "inherits": "^2.0.3", - "readable-stream": "^2.2.2", - "typedarray": "^0.0.6" - }, - "dependencies": { - "isarray": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz", - "integrity": "sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE=", - "dev": true - }, - "readable-stream": { - "version": "2.3.6", - "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.6.tgz", - "integrity": "sha512-tQtKA9WIAhBF3+VLAseyMqZeBjW0AHJoxOtYqSUZNJxauErmLbVm2FW1y+J/YA9dUrAC39ITejlZWhVIwawkKw==", - "dev": true, - "requires": { - "core-util-is": "~1.0.0", - "inherits": "~2.0.3", - "isarray": "~1.0.0", - "process-nextick-args": "~2.0.0", - "safe-buffer": "~5.1.1", - "string_decoder": "~1.1.1", - "util-deprecate": "~1.0.1" - } - }, - "string_decoder": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", - "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==", - "dev": true, - "requires": { - "safe-buffer": "~5.1.0" - } - } - } - }, - "console-browserify": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/console-browserify/-/console-browserify-1.1.0.tgz", - "integrity": "sha1-8CQcRXMKn8YyOyBtvzjtx0HQuxA=", - "dev": true, - "requires": { - "date-now": "^0.1.4" - } - }, - "constants-browserify": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/constants-browserify/-/constants-browserify-1.0.0.tgz", - "integrity": "sha1-wguW2MYXdIqvHBYCF2DNJ/y4y3U=", - "dev": true - }, - "content-disposition": { - "version": "0.5.3", - "resolved": "https://registry.npmjs.org/content-disposition/-/content-disposition-0.5.3.tgz", - "integrity": "sha512-ExO0774ikEObIAEV9kDo50o+79VCUdEB6n6lzKgGwupcVeRlhrj3qGAfwq8G6uBJjkqLrhT0qEYFcWng8z1z0g==", - "requires": { - "safe-buffer": "5.1.2" - } - }, - "content-type": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/content-type/-/content-type-1.0.4.tgz", - "integrity": "sha512-hIP3EEPs8tB9AT1L+NUqtwOAps4mk2Zob89MWXMHjHWg9milF/j4osnnQLXBCBFBk/tvIG/tUc9mOUJiPBhPXA==" - }, - "convert-source-map": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/convert-source-map/-/convert-source-map-1.1.3.tgz", - "integrity": "sha1-SCnId+n+SbMWHzvzZziI4gRpmGA=", - "dev": true - }, - "cookie": { - "version": "0.4.0", - "resolved": "https://registry.npmjs.org/cookie/-/cookie-0.4.0.tgz", - "integrity": "sha512-+Hp8fLp57wnUSt0tY0tHEXh4voZRDnoIrZPqlo3DPiI4y9lwg/jqx+1Om94/W6ZaPDOUbnjOt/99w66zk+l1Xg==" - }, - "cookie-signature": { - "version": "1.0.6", - "resolved": "https://registry.npmjs.org/cookie-signature/-/cookie-signature-1.0.6.tgz", - "integrity": "sha1-4wOogrNCzD7oylE6eZmXNNqzriw=" - }, - "core-util-is": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.2.tgz", - "integrity": "sha1-tf1UIgqivFq1eqtxQMlAdUUDwac=" - }, - "create-ecdh": { - "version": "4.0.3", - "resolved": "https://registry.npmjs.org/create-ecdh/-/create-ecdh-4.0.3.tgz", - "integrity": "sha512-GbEHQPMOswGpKXM9kCWVrremUcBmjteUaQ01T9rkKCPDXfUHX0IoP9LpHYo2NPFampa4e+/pFDc3jQdxrxQLaw==", - "dev": true, - "requires": { - "bn.js": "^4.1.0", - "elliptic": "^6.0.0" - } - }, - "create-hash": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/create-hash/-/create-hash-1.2.0.tgz", - "integrity": "sha512-z00bCGNHDG8mHAkP7CtT1qVu+bFQUPjYq/4Iv3C3kWjTFV10zIjfSoeqXo9Asws8gwSHDGj/hl2u4OGIjapeCg==", - "requires": { - "cipher-base": "^1.0.1", - "inherits": "^2.0.1", - "md5.js": "^1.3.4", - "ripemd160": "^2.0.1", - "sha.js": "^2.4.0" - } - }, - "create-hmac": { - "version": "1.1.7", - "resolved": "https://registry.npmjs.org/create-hmac/-/create-hmac-1.1.7.tgz", - "integrity": "sha512-MJG9liiZ+ogc4TzUwuvbER1JRdgvUFSB5+VR/g5h82fGaIRWMWddtKBHi7/sVhfjQZ6SehlyhvQYrcYkaUIpLg==", - "requires": { - "cipher-base": "^1.0.3", - "create-hash": "^1.1.0", - "inherits": "^2.0.1", - "ripemd160": "^2.0.0", - "safe-buffer": "^5.0.1", - "sha.js": "^2.4.8" - } - }, - "cross-fetch": { - "version": "3.1.5", - "resolved": "https://registry.npmjs.org/cross-fetch/-/cross-fetch-3.1.5.tgz", - "integrity": "sha512-lvb1SBsI0Z7GDwmuid+mU3kWVBwTVUbe7S0H52yaaAdQOXq2YktTCZdlAcNKFzE6QtRz0snpw9bNiPeOIkkQvw==", - "requires": { - "node-fetch": "2.6.7" - } - }, - "crypto-browserify": { - "version": "3.12.0", - "resolved": "https://registry.npmjs.org/crypto-browserify/-/crypto-browserify-3.12.0.tgz", - "integrity": "sha512-fz4spIh+znjO2VjL+IdhEpRJ3YN6sMzITSBijk6FK2UvTqruSQW+/cCZTSNsMiZNvUeq0CqurF+dAbyiGOY6Wg==", - "dev": true, - "requires": { - "browserify-cipher": "^1.0.0", - "browserify-sign": "^4.0.0", - "create-ecdh": "^4.0.0", - "create-hash": "^1.1.0", - "create-hmac": "^1.1.0", - "diffie-hellman": "^5.0.0", - "inherits": "^2.0.1", - "pbkdf2": "^3.0.3", - "public-encrypt": "^4.0.0", - "randombytes": "^2.0.0", - "randomfill": "^1.0.3" - } - }, - "dash-ast": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/dash-ast/-/dash-ast-1.0.0.tgz", - "integrity": "sha512-Vy4dx7gquTeMcQR/hDkYLGUnwVil6vk4FOOct+djUnHOUWt+zJPJAaRIXaAFkPXtJjvlY7o3rfRu0/3hpnwoUA==", - "dev": true - }, - "date-now": { - "version": "0.1.4", - "resolved": "https://registry.npmjs.org/date-now/-/date-now-0.1.4.tgz", - "integrity": "sha1-6vQ5/U1ISK105cx9vvIAZyueNFs=", - "dev": true + "optional": true }, + "utf-8-validate": { + "optional": true + } + } + }, + "node_modules/fast-safe-stringify": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/fast-safe-stringify/-/fast-safe-stringify-2.1.1.tgz", + "integrity": "sha512-W+KJc2dmILlPplD/H4K9l9LcAHAfPtP6BY84uVLXQ6Evcz9Lcg33Y2z1IVblT6xdY54PXYVHEv+0Wpq8Io6zkA==", + "dev": true, + "license": "MIT" + }, + "node_modules/finalhandler": { + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/finalhandler/-/finalhandler-1.3.1.tgz", + "integrity": "sha512-6BN9trH7bp3qvnrRyzsBz+g3lZxTNZTbVO2EV1CS0WIcDbawYVdYvGflME/9QP0h0pYlCDBCTjYa9nZzMDpyxQ==", + "license": "MIT", + "dependencies": { + "debug": "2.6.9", + "encodeurl": "~2.0.0", + "escape-html": "~1.0.3", + "on-finished": "2.4.1", + "parseurl": "~1.3.3", + "statuses": "2.0.1", + "unpipe": "~1.0.0" + }, + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/follow-redirects": { + "version": "1.15.11", + "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.15.11.tgz", + "integrity": "sha512-deG2P0JfjrTxl50XGCDyfI97ZGVCxIpfKYmfyrQ54n5FO/0gfIES8C/Psl6kWVDolizcaaxZJnTS0QSMxvnsBQ==", + "funding": [ + { + "type": "individual", + "url": "https://github.com/sponsors/RubenVerborgh" + } + ], + "license": "MIT", + "engines": { + "node": ">=4.0" + }, + "peerDependenciesMeta": { "debug": { - "version": "2.6.9", - "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", - "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", - "requires": { - "ms": "2.0.0" - } - }, - "defined": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/defined/-/defined-1.0.0.tgz", - "integrity": "sha1-yY2bzvdWdBiOEQlpFRGZ45sfppM=", - "dev": true - }, - "depd": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/depd/-/depd-1.1.2.tgz", - "integrity": "sha1-m81S4UwJd2PnSbJ0xDRu0uVgtak=" - }, - "deps-sort": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/deps-sort/-/deps-sort-2.0.0.tgz", - "integrity": "sha1-CRckkC6EZYJg65EHSMzNGvbiH7U=", - "dev": true, - "requires": { - "JSONStream": "^1.0.3", - "shasum": "^1.0.0", - "subarg": "^1.0.0", - "through2": "^2.0.0" - } - }, - "des.js": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/des.js/-/des.js-1.0.0.tgz", - "integrity": "sha1-wHTS4qpqipoH29YfmhXCzYPsjsw=", - "dev": true, - "requires": { - "inherits": "^2.0.1", - "minimalistic-assert": "^1.0.0" - } - }, - "destroy": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/destroy/-/destroy-1.0.4.tgz", - "integrity": "sha1-l4hXRCxEdJ5CBmE+N5RiBYJqvYA=" - }, - "detective": { - "version": "5.2.0", - "resolved": "https://registry.npmjs.org/detective/-/detective-5.2.0.tgz", - "integrity": "sha512-6SsIx+nUUbuK0EthKjv0zrdnajCCXVYGmbYYiYjFVpzcjwEs/JMDZ8tPRG29J/HhN56t3GJp2cGSWDRjjot8Pg==", - "dev": true, - "requires": { - "acorn-node": "^1.6.1", - "defined": "^1.0.0", - "minimist": "^1.1.1" - } - }, - "diffie-hellman": { - "version": "5.0.3", - "resolved": "https://registry.npmjs.org/diffie-hellman/-/diffie-hellman-5.0.3.tgz", - "integrity": "sha512-kqag/Nl+f3GwyK25fhUMYj81BUOrZ9IuJsjIcDE5icNM9FJHAVm3VcUDxdLPoQtTuUylWm6ZIknYJwwaPxsUzg==", - "dev": true, - "requires": { - "bn.js": "^4.1.0", - "miller-rabin": "^4.0.0", - "randombytes": "^2.0.0" - } - }, - "domain-browser": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/domain-browser/-/domain-browser-1.2.0.tgz", - "integrity": "sha512-jnjyiM6eRyZl2H+W8Q/zLMA481hzi0eszAaBUzIVnmYVDBbnLxVNnfu1HgEBvCbL+71FrxMl3E6lpKH7Ge3OXA==", - "dev": true - }, - "duplexer2": { - "version": "0.1.4", - "resolved": "https://registry.npmjs.org/duplexer2/-/duplexer2-0.1.4.tgz", - "integrity": "sha1-ixLauHjA1p4+eJEFFmKjL8a93ME=", - "dev": true, - "requires": { - "readable-stream": "^2.0.2" - }, - "dependencies": { - "isarray": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz", - "integrity": "sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE=", - "dev": true - }, - "readable-stream": { - "version": "2.3.6", - "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.6.tgz", - "integrity": "sha512-tQtKA9WIAhBF3+VLAseyMqZeBjW0AHJoxOtYqSUZNJxauErmLbVm2FW1y+J/YA9dUrAC39ITejlZWhVIwawkKw==", - "dev": true, - "requires": { - "core-util-is": "~1.0.0", - "inherits": "~2.0.3", - "isarray": "~1.0.0", - "process-nextick-args": "~2.0.0", - "safe-buffer": "~5.1.1", - "string_decoder": "~1.1.1", - "util-deprecate": "~1.0.1" - } - }, - "string_decoder": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", - "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==", - "dev": true, - "requires": { - "safe-buffer": "~5.1.0" - } - } - } - }, - "ee-first": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/ee-first/-/ee-first-1.1.1.tgz", - "integrity": "sha1-WQxhFWsK4vTwJVcyoViyZrxWsh0=" - }, - "elliptic": { - "version": "6.5.3", - "resolved": "https://registry.npmjs.org/elliptic/-/elliptic-6.5.3.tgz", - "integrity": "sha512-IMqzv5wNQf+E6aHeIqATs0tOLeOTwj1QKbRcS3jBbYkl5oLAserA8yJTT7/VyHUYG91PRmPyeQDObKLPpeS4dw==", - "dev": true, - "requires": { - "bn.js": "^4.4.0", - "brorand": "^1.0.1", - "hash.js": "^1.0.0", - "hmac-drbg": "^1.0.0", - "inherits": "^2.0.1", - "minimalistic-assert": "^1.0.0", - "minimalistic-crypto-utils": "^1.0.0" - } - }, - "encodeurl": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/encodeurl/-/encodeurl-1.0.2.tgz", - "integrity": "sha1-rT/0yG7C0CkyL1oCw6mmBslbP1k=" - }, - "es6-promise": { - "version": "4.2.8", - "resolved": "https://registry.npmjs.org/es6-promise/-/es6-promise-4.2.8.tgz", - "integrity": "sha512-HJDGx5daxeIvxdBxvG2cb9g4tEvwIk3i8+nhX0yGrYmZUzbkdg8QbDevheDB8gd0//uPj4c1EQua8Q+MViT0/w==" - }, - "es6-promisify": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/es6-promisify/-/es6-promisify-5.0.0.tgz", - "integrity": "sha512-C+d6UdsYDk0lMebHNR4S2NybQMMngAOnOwYBQjTOiv0MkoJMP0Myw2mgpDLBcpfCmRLxyFqYhS/CfOENq4SJhQ==", - "requires": { - "es6-promise": "^4.0.3" - } - }, - "escape-html": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/escape-html/-/escape-html-1.0.3.tgz", - "integrity": "sha1-Aljq5NPQwJdN4cFpGI7wBR0dGYg=" - }, - "etag": { - "version": "1.8.1", - "resolved": "https://registry.npmjs.org/etag/-/etag-1.8.1.tgz", - "integrity": "sha1-Qa4u62XvpiJorr/qg6x9eSmbCIc=" - }, - "events": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/events/-/events-2.1.0.tgz", - "integrity": "sha512-3Zmiobend8P9DjmKAty0Era4jV8oJ0yGYe2nJJAxgymF9+N8F2m0hhZiMoWtcfepExzNKZumFU3ksdQbInGWCg==", - "dev": true - }, - "evp_bytestokey": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/evp_bytestokey/-/evp_bytestokey-1.0.3.tgz", - "integrity": "sha512-/f2Go4TognH/KvCISP7OUsHn85hT9nUkxxA9BEWxFn+Oj9o8ZNLm/40hdlgSLyuOimsrTKLUMEorQexp/aPQeA==", - "dev": true, - "requires": { - "md5.js": "^1.3.4", - "safe-buffer": "^5.1.1" - } - }, - "express": { - "version": "4.17.1", - "resolved": "https://registry.npmjs.org/express/-/express-4.17.1.tgz", - "integrity": "sha512-mHJ9O79RqluphRrcw2X/GTh3k9tVv8YcoyY4Kkh4WDMUYKRZUq0h1o0w2rrrxBqM7VoeUVqgb27xlEMXTnYt4g==", - "requires": { - "accepts": "~1.3.7", - "array-flatten": "1.1.1", - "body-parser": "1.19.0", - "content-disposition": "0.5.3", - "content-type": "~1.0.4", - "cookie": "0.4.0", - "cookie-signature": "1.0.6", - "debug": "2.6.9", - "depd": "~1.1.2", - "encodeurl": "~1.0.2", - "escape-html": "~1.0.3", - "etag": "~1.8.1", - "finalhandler": "~1.1.2", - "fresh": "0.5.2", - "merge-descriptors": "1.0.1", - "methods": "~1.1.2", - "on-finished": "~2.3.0", - "parseurl": "~1.3.3", - "path-to-regexp": "0.1.7", - "proxy-addr": "~2.0.5", - "qs": "6.7.0", - "range-parser": "~1.2.1", - "safe-buffer": "5.1.2", - "send": "0.17.1", - "serve-static": "1.14.1", - "setprototypeof": "1.1.1", - "statuses": "~1.5.0", - "type-is": "~1.6.18", - "utils-merge": "1.0.1", - "vary": "~1.1.2" - } - }, - "express-ws": { - "version": "5.0.2", - "resolved": "https://registry.npmjs.org/express-ws/-/express-ws-5.0.2.tgz", - "integrity": "sha512-0uvmuk61O9HXgLhGl3QhNSEtRsQevtmbL94/eILaliEADZBHZOQUAiHFrGPrgsjikohyrmSG5g+sCfASTt0lkQ==", - "requires": { - "ws": "^7.4.6" - } - }, - "finalhandler": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/finalhandler/-/finalhandler-1.1.2.tgz", - "integrity": "sha512-aAWcW57uxVNrQZqFXjITpW3sIUQmHGG3qSb9mUah9MgMC4NeWhNOlNjXEYq3HjRAvL6arUviZGGJsBg6z0zsWA==", - "requires": { - "debug": "2.6.9", - "encodeurl": "~1.0.2", - "escape-html": "~1.0.3", - "on-finished": "~2.3.0", - "parseurl": "~1.3.3", - "statuses": "~1.5.0", - "unpipe": "~1.0.0" - } - }, - "follow-redirects": { - "version": "1.15.1", - "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.15.1.tgz", - "integrity": "sha512-yLAMQs+k0b2m7cVxpS1VKJVvoz7SS9Td1zss3XRwXj+ZDH00RJgnuLx7E44wx02kQLrdM3aOOy+FpzS7+8OizA==" - }, - "forwarded": { - "version": "0.1.2", - "resolved": "https://registry.npmjs.org/forwarded/-/forwarded-0.1.2.tgz", - "integrity": "sha1-mMI9qxF1ZXuMBXPozszZGw/xjIQ=" - }, - "fresh": { - "version": "0.5.2", - "resolved": "https://registry.npmjs.org/fresh/-/fresh-0.5.2.tgz", - "integrity": "sha1-PYyt2Q2XZWn6g1qx+OSyOhBWBac=" - }, - "fs.realpath": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", - "integrity": "sha1-FQStJSMVjKpA20onh8sBQRmU6k8=", - "dev": true - }, - "function-bind": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.1.tgz", - "integrity": "sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A==", - "dev": true - }, - "get-assigned-identifiers": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/get-assigned-identifiers/-/get-assigned-identifiers-1.2.0.tgz", - "integrity": "sha512-mBBwmeGTrxEMO4pMaaf/uUEFHnYtwr8FTe8Y/mer4rcV/bye0qGm6pw1bGZFGStxC5O76c5ZAVBGnqHmOaJpdQ==", - "dev": true - }, - "glob": { - "version": "7.1.4", - "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.4.tgz", - "integrity": "sha512-hkLPepehmnKk41pUGm3sYxoFs/umurYfYJCerbXEyFIWcAzvpipAgVkBqqT9RBKMGjnq6kMuyYwha6csxbiM1A==", - "dev": true, - "requires": { - "fs.realpath": "^1.0.0", - "inflight": "^1.0.4", - "inherits": "2", - "minimatch": "^3.0.4", - "once": "^1.3.0", - "path-is-absolute": "^1.0.0" - } - }, - "has": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/has/-/has-1.0.3.tgz", - "integrity": "sha512-f2dvO0VU6Oej7RkWJGrehjbzMAjFp5/VKPp5tTpWIV4JHHZK1/BxbFRtf/siA2SWTe09caDmVtYYzWEIbBS4zw==", - "dev": true, - "requires": { - "function-bind": "^1.1.1" - } - }, - "hash-base": { - "version": "3.0.4", - "resolved": "https://registry.npmjs.org/hash-base/-/hash-base-3.0.4.tgz", - "integrity": "sha1-X8hoaEfs1zSZQDMZprCj8/auSRg=", - "requires": { - "inherits": "^2.0.1", - "safe-buffer": "^5.0.1" - } - }, - "hash.js": { - "version": "1.1.7", - "resolved": "https://registry.npmjs.org/hash.js/-/hash.js-1.1.7.tgz", - "integrity": "sha512-taOaskGt4z4SOANNseOviYDvjEJinIkRgmp7LbKP2YTTmVxWBl87s/uzK9r+44BclBSp2X7K1hqeNfz9JbBeXA==", - "dev": true, - "requires": { - "inherits": "^2.0.3", - "minimalistic-assert": "^1.0.1" - } - }, - "hmac-drbg": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/hmac-drbg/-/hmac-drbg-1.0.1.tgz", - "integrity": "sha1-0nRXAQJabHdabFRXk+1QL8DGSaE=", - "dev": true, - "requires": { - "hash.js": "^1.0.3", - "minimalistic-assert": "^1.0.0", - "minimalistic-crypto-utils": "^1.0.1" - } - }, - "houndify": { - "version": "3.1.13", - "resolved": "https://registry.npmjs.org/houndify/-/houndify-3.1.13.tgz", - "integrity": "sha512-zZ35IUwwcfa5GgBQRw3ZqJnDQiXPWeSvPEkc2Ce6WK42UWtX0VYue02VdnAkG3pyKpTQ28nyXxZVyg/G+Mj4pg==", - "requires": { - "axios": "^0.21.4", - "create-hmac": "^1.1.6", - "cross-fetch": "^3.1.5", - "express": "^4.17.0", - "express-ws": "^5.0.2", - "https-proxy-agent": "^2.2.4", - "json-bigint": "^1.0.0", - "pako": "^1.0.5", - "uuid": "^3.1.0", - "wav": "^1.0.2", - "ws": "^7.5.7" - } - }, - "htmlescape": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/htmlescape/-/htmlescape-1.1.1.tgz", - "integrity": "sha1-OgPtwiFLyjtmQko+eVk0lQnLA1E=", - "dev": true - }, - "http-errors": { - "version": "1.7.2", - "resolved": "https://registry.npmjs.org/http-errors/-/http-errors-1.7.2.tgz", - "integrity": "sha512-uUQBt3H/cSIVfch6i1EuPNy/YsRSOUBXTVfZ+yR7Zjez3qjBz6i9+i4zjNaoqcoFVI4lQJ5plg63TvGfRSDCRg==", - "requires": { - "depd": "~1.1.2", - "inherits": "2.0.3", - "setprototypeof": "1.1.1", - "statuses": ">= 1.5.0 < 2", - "toidentifier": "1.0.0" - } - }, - "https-browserify": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/https-browserify/-/https-browserify-1.0.0.tgz", - "integrity": "sha1-7AbBDgo0wPL68Zn3/X/Hj//QPHM=", - "dev": true - }, - "https-proxy-agent": { - "version": "2.2.4", - "resolved": "https://registry.npmjs.org/https-proxy-agent/-/https-proxy-agent-2.2.4.tgz", - "integrity": "sha512-OmvfoQ53WLjtA9HeYP9RNrWMJzzAz1JGaSFr1nijg0PVR1JaD/xbJq1mdEIIlxGpXp9eSe/O2LgU9DJmTPd0Eg==", - "requires": { - "agent-base": "^4.3.0", - "debug": "^3.1.0" - }, - "dependencies": { - "debug": { - "version": "3.2.7", - "resolved": "https://registry.npmjs.org/debug/-/debug-3.2.7.tgz", - "integrity": "sha512-CFjzYYAi4ThfiQvizrFQevTTXHtnCqWfe7x1AhgEscTz6ZbLbfoLRLPugTQyBth6f8ZERVUSyWHFD/7Wu4t1XQ==", - "requires": { - "ms": "^2.1.1" - } - }, - "ms": { - "version": "2.1.3", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", - "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==" - } - } - }, - "iconv-lite": { - "version": "0.4.24", - "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.24.tgz", - "integrity": "sha512-v3MXnZAcvnywkTUEZomIActle7RXXeedOR31wwl7VlyoXO4Qi9arvSenNQWne1TcRwhCL1HwLI21bEqdpj8/rA==", - "requires": { - "safer-buffer": ">= 2.1.2 < 3" - } - }, - "ieee754": { - "version": "1.1.13", - "resolved": "https://registry.npmjs.org/ieee754/-/ieee754-1.1.13.tgz", - "integrity": "sha512-4vf7I2LYV/HaWerSo3XmlMkp5eZ83i+/CDluXi/IGTs/O1sejBNhTtnxzmRZfvOUqj7lZjqHkeTvpgSFDlWZTg==", - "dev": true - }, - "inflight": { - "version": "1.0.6", - "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", - "integrity": "sha1-Sb1jMdfQLQwJvJEKEHW6gWW1bfk=", - "dev": true, - "requires": { - "once": "^1.3.0", - "wrappy": "1" - } - }, - "inherits": { - "version": "2.0.3", - "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz", - "integrity": "sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4=" - }, - "inline-source-map": { - "version": "0.6.2", - "resolved": "https://registry.npmjs.org/inline-source-map/-/inline-source-map-0.6.2.tgz", - "integrity": "sha1-+Tk0ccGKedFyT4Y/o4tYY3Ct4qU=", - "dev": true, - "requires": { - "source-map": "~0.5.3" - } - }, - "insert-module-globals": { - "version": "7.2.0", - "resolved": "https://registry.npmjs.org/insert-module-globals/-/insert-module-globals-7.2.0.tgz", - "integrity": "sha512-VE6NlW+WGn2/AeOMd496AHFYmE7eLKkUY6Ty31k4og5vmA3Fjuwe9v6ifH6Xx/Hz27QvdoMoviw1/pqWRB09Sw==", - "dev": true, - "requires": { - "JSONStream": "^1.0.3", - "acorn-node": "^1.5.2", - "combine-source-map": "^0.8.0", - "concat-stream": "^1.6.1", - "is-buffer": "^1.1.0", - "path-is-absolute": "^1.0.1", - "process": "~0.11.0", - "through2": "^2.0.0", - "undeclared-identifiers": "^1.1.2", - "xtend": "^4.0.0" - }, - "dependencies": { - "is-buffer": { - "version": "1.1.6", - "resolved": "https://registry.npmjs.org/is-buffer/-/is-buffer-1.1.6.tgz", - "integrity": "sha512-NcdALwpXkTm5Zvvbk7owOUSvVvBKDgKP5/ewfXEznmQFfs4ZRmanOeKBTjRVjka3QFoN6XJ+9F3USqfHqTaU5w==", - "dev": true - } - } - }, - "ipaddr.js": { - "version": "1.9.0", - "resolved": "https://registry.npmjs.org/ipaddr.js/-/ipaddr.js-1.9.0.tgz", - "integrity": "sha512-M4Sjn6N/+O6/IXSJseKqHoFc+5FdGJ22sXqnjTpdZweHK64MzEPAyQZyEU3R/KRv2GLoa7nNtg/C2Ev6m7z+eA==" - }, - "isarray": { - "version": "0.0.1", - "resolved": "https://registry.npmjs.org/isarray/-/isarray-0.0.1.tgz", - "integrity": "sha1-ihis/Kmo9Bd+Cav8YDiTmwXR7t8=" - }, - "json-bigint": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/json-bigint/-/json-bigint-1.0.0.tgz", - "integrity": "sha512-SiPv/8VpZuWbvLSMtTDU8hEfrZWg/mH/nV/b4o0CYbSxu1UIQPLdwKOCIyLQX+VIPO5vrLX3i8qtqFyhdPSUSQ==", - "requires": { - "bignumber.js": "^9.0.0" - } - }, - "json-stable-stringify": { - "version": "0.0.1", - "resolved": "https://registry.npmjs.org/json-stable-stringify/-/json-stable-stringify-0.0.1.tgz", - "integrity": "sha1-YRwj6BTbN1Un34URk9tZ3Sryf0U=", - "dev": true, - "requires": { - "jsonify": "~0.0.0" - } - }, - "jsonify": { - "version": "0.0.0", - "resolved": "https://registry.npmjs.org/jsonify/-/jsonify-0.0.0.tgz", - "integrity": "sha1-LHS27kHZPKUbe1qu6PUDYx0lKnM=", - "dev": true - }, - "jsonparse": { - "version": "1.3.1", - "resolved": "https://registry.npmjs.org/jsonparse/-/jsonparse-1.3.1.tgz", - "integrity": "sha1-P02uSpH6wxX3EGL4UhzCOfE2YoA=", - "dev": true - }, - "labeled-stream-splicer": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/labeled-stream-splicer/-/labeled-stream-splicer-2.0.2.tgz", - "integrity": "sha512-Ca4LSXFFZUjPScRaqOcFxneA0VpKZr4MMYCljyQr4LIewTLb3Y0IUTIsnBBsVubIeEfxeSZpSjSsRM8APEQaAw==", - "dev": true, - "requires": { - "inherits": "^2.0.1", - "stream-splicer": "^2.0.0" - } - }, - "lodash.memoize": { - "version": "3.0.4", - "resolved": "https://registry.npmjs.org/lodash.memoize/-/lodash.memoize-3.0.4.tgz", - "integrity": "sha1-LcvSwofLwKVcxCMovQxzYVDVPj8=", - "dev": true - }, - "md5.js": { - "version": "1.3.5", - "resolved": "https://registry.npmjs.org/md5.js/-/md5.js-1.3.5.tgz", - "integrity": "sha512-xitP+WxNPcTTOgnTJcrhM0xvdPepipPSf3I8EIpGKeFLjt3PlJLIDG3u8EX53ZIubkb+5U2+3rELYpEhHhzdkg==", - "requires": { - "hash-base": "^3.0.0", - "inherits": "^2.0.1", - "safe-buffer": "^5.1.2" - } - }, - "media-typer": { - "version": "0.3.0", - "resolved": "https://registry.npmjs.org/media-typer/-/media-typer-0.3.0.tgz", - "integrity": "sha1-hxDXrwqmJvj/+hzgAWhUUmMlV0g=" - }, - "merge-descriptors": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/merge-descriptors/-/merge-descriptors-1.0.1.tgz", - "integrity": "sha1-sAqqVW3YtEVoFQ7J0blT8/kMu2E=" - }, - "methods": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/methods/-/methods-1.1.2.tgz", - "integrity": "sha1-VSmk1nZUE07cxSZmVoNbD4Ua/O4=" - }, - "miller-rabin": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/miller-rabin/-/miller-rabin-4.0.1.tgz", - "integrity": "sha512-115fLhvZVqWwHPbClyntxEVfVDfl9DLLTuJvq3g2O/Oxi8AiNouAHvDSzHS0viUJc+V5vm3eq91Xwqn9dp4jRA==", - "dev": true, - "requires": { - "bn.js": "^4.0.0", - "brorand": "^1.0.1" - } - }, - "mime": { - "version": "1.6.0", - "resolved": "https://registry.npmjs.org/mime/-/mime-1.6.0.tgz", - "integrity": "sha512-x0Vn8spI+wuJ1O6S7gnbaQg8Pxh4NNHb7KSINmEWKiPE4RKOplvijn+NkmYmmRgP68mc70j2EbeTFRsrswaQeg==" - }, - "mime-db": { - "version": "1.40.0", - "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.40.0.tgz", - "integrity": "sha512-jYdeOMPy9vnxEqFRRo6ZvTZ8d9oPb+k18PKoYNYUe2stVEBPPwsln/qWzdbmaIvnhZ9v2P+CuecK+fpUfsV2mA==" - }, - "mime-types": { - "version": "2.1.24", - "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.24.tgz", - "integrity": "sha512-WaFHS3MCl5fapm3oLxU4eYDw77IQM2ACcxQ9RIxfaC3ooc6PFuBMGZZsYpvoXS5D5QTWPieo1jjLdAm3TBP3cQ==", - "requires": { - "mime-db": "1.40.0" - } - }, - "minimalistic-assert": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/minimalistic-assert/-/minimalistic-assert-1.0.1.tgz", - "integrity": "sha512-UtJcAD4yEaGtjPezWuO9wC4nwUnVH/8/Im3yEHQP4b67cXlD/Qr9hdITCU1xDbSEXg2XKNaP8jsReV7vQd00/A==", - "dev": true - }, - "minimalistic-crypto-utils": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/minimalistic-crypto-utils/-/minimalistic-crypto-utils-1.0.1.tgz", - "integrity": "sha1-9sAMHAsIIkblxNmd+4x8CDsrWCo=", - "dev": true - }, - "minimatch": { - "version": "3.0.4", - "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz", - "integrity": "sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA==", - "dev": true, - "requires": { - "brace-expansion": "^1.1.7" - } - }, - "minimist": { - "version": "1.2.5", - "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.5.tgz", - "integrity": "sha512-FM9nNUYrRBAELZQT3xeZQ7fmMOBg6nWNmJKTcgsJeaLstP/UODVpGsr5OhXhhXg6f+qtJ8uiZ+PUxkDWcgIXLw==" - }, - "mkdirp": { - "version": "0.5.5", - "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.5.tgz", - "integrity": "sha512-NKmAlESf6jMGym1++R0Ra7wvhV+wFW63FaSOFPwRahvea0gMUcGUhVeAg/0BC0wiv9ih5NYPB1Wn1UEI1/L+xQ==", - "dev": true, - "requires": { - "minimist": "^1.2.5" - } - }, - "module-deps": { - "version": "6.2.1", - "resolved": "https://registry.npmjs.org/module-deps/-/module-deps-6.2.1.tgz", - "integrity": "sha512-UnEn6Ah36Tu4jFiBbJVUtt0h+iXqxpLqDvPS8nllbw5RZFmNJ1+Mz5BjYnM9ieH80zyxHkARGLnMIHlPK5bu6A==", - "dev": true, - "requires": { - "JSONStream": "^1.0.3", - "browser-resolve": "^1.7.0", - "cached-path-relative": "^1.0.2", - "concat-stream": "~1.6.0", - "defined": "^1.0.0", - "detective": "^5.0.2", - "duplexer2": "^0.1.2", - "inherits": "^2.0.1", - "parents": "^1.0.0", - "readable-stream": "^2.0.2", - "resolve": "^1.4.0", - "stream-combiner2": "^1.1.1", - "subarg": "^1.0.0", - "through2": "^2.0.0", - "xtend": "^4.0.0" - }, - "dependencies": { - "isarray": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz", - "integrity": "sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE=", - "dev": true - }, - "readable-stream": { - "version": "2.3.6", - "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.6.tgz", - "integrity": "sha512-tQtKA9WIAhBF3+VLAseyMqZeBjW0AHJoxOtYqSUZNJxauErmLbVm2FW1y+J/YA9dUrAC39ITejlZWhVIwawkKw==", - "dev": true, - "requires": { - "core-util-is": "~1.0.0", - "inherits": "~2.0.3", - "isarray": "~1.0.0", - "process-nextick-args": "~2.0.0", - "safe-buffer": "~5.1.1", - "string_decoder": "~1.1.1", - "util-deprecate": "~1.0.1" - } - }, - "string_decoder": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", - "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==", - "dev": true, - "requires": { - "safe-buffer": "~5.1.0" - } - } - } - }, - "ms": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", - "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=" - }, - "negotiator": { - "version": "0.6.2", - "resolved": "https://registry.npmjs.org/negotiator/-/negotiator-0.6.2.tgz", - "integrity": "sha512-hZXc7K2e+PgeI1eDBe/10Ard4ekbfrrqG8Ep+8Jmf4JID2bNg7NvCPOZN+kfF574pFQI7mum2AUqDidoKqcTOw==" - }, - "node-fetch": { - "version": "2.6.7", - "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.7.tgz", - "integrity": "sha512-ZjMPFEfVx5j+y2yF35Kzx5sF7kDzxuDj6ziH4FFbOp87zKDZNx8yExJIb05OGF4Nlt9IHFIMBkRl41VdvcNdbQ==", - "requires": { - "whatwg-url": "^5.0.0" - } - }, - "node-gyp-build": { - "version": "3.7.0", - "resolved": "https://registry.npmjs.org/node-gyp-build/-/node-gyp-build-3.7.0.tgz", - "integrity": "sha512-L/Eg02Epx6Si2NXmedx+Okg+4UHqmaf3TNcxd50SF9NQGcJaON3AtU++kax69XV7YWz4tUspqZSAsVofhFKG2w==" - }, - "object-assign": { - "version": "4.1.1", - "resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz", - "integrity": "sha1-IQmtx5ZYh8/AXLvUQsrIv7s2CGM=", - "dev": true - }, - "on-finished": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/on-finished/-/on-finished-2.3.0.tgz", - "integrity": "sha1-IPEzZIGwg811M3mSoWlxqi2QaUc=", - "requires": { - "ee-first": "1.1.1" - } - }, - "once": { - "version": "1.4.0", - "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", - "integrity": "sha1-WDsap3WWHUsROsF9nFC6753Xa9E=", - "dev": true, - "requires": { - "wrappy": "1" - } - }, - "os-browserify": { - "version": "0.3.0", - "resolved": "https://registry.npmjs.org/os-browserify/-/os-browserify-0.3.0.tgz", - "integrity": "sha1-hUNzx/XCMVkU/Jv8a9gjj92h7Cc=", - "dev": true - }, - "pako": { - "version": "1.0.10", - "resolved": "https://registry.npmjs.org/pako/-/pako-1.0.10.tgz", - "integrity": "sha512-0DTvPVU3ed8+HNXOu5Bs+o//Mbdj9VNQMUOe9oKCwh8l0GNwpTDMKCWbRjgtD291AWnkAgkqA/LOnQS8AmS1tw==" - }, - "parents": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/parents/-/parents-1.0.1.tgz", - "integrity": "sha1-/t1NK/GTp3dF/nHjcdc8MwfZx1E=", - "dev": true, - "requires": { - "path-platform": "~0.11.15" - } - }, - "parse-asn1": { - "version": "5.1.4", - "resolved": "https://registry.npmjs.org/parse-asn1/-/parse-asn1-5.1.4.tgz", - "integrity": "sha512-Qs5duJcuvNExRfFZ99HDD3z4mAi3r9Wl/FOjEOijlxwCZs7E7mW2vjTpgQ4J8LpTF8x5v+1Vn5UQFejmWT11aw==", - "dev": true, - "requires": { - "asn1.js": "^4.0.0", - "browserify-aes": "^1.0.0", - "create-hash": "^1.1.0", - "evp_bytestokey": "^1.0.0", - "pbkdf2": "^3.0.3", - "safe-buffer": "^5.1.1" - } - }, - "parseurl": { - "version": "1.3.3", - "resolved": "https://registry.npmjs.org/parseurl/-/parseurl-1.3.3.tgz", - "integrity": "sha512-CiyeOxFT/JZyN5m0z9PfXw4SCBJ6Sygz1Dpl0wqjlhDEGGBP1GnsUVEL0p63hoG1fcj3fHynXi9NYO4nWOL+qQ==" - }, - "path-browserify": { - "version": "0.0.1", - "resolved": "https://registry.npmjs.org/path-browserify/-/path-browserify-0.0.1.tgz", - "integrity": "sha512-BapA40NHICOS+USX9SN4tyhq+A2RrN/Ws5F0Z5aMHDp98Fl86lX8Oti8B7uN93L4Ifv4fHOEA+pQw87gmMO/lQ==", - "dev": true - }, - "path-is-absolute": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", - "integrity": "sha1-F0uSaHNVNP+8es5r9TpanhtcX18=", - "dev": true - }, - "path-parse": { - "version": "1.0.6", - "resolved": "https://registry.npmjs.org/path-parse/-/path-parse-1.0.6.tgz", - "integrity": "sha512-GSmOT2EbHrINBf9SR7CDELwlJ8AENk3Qn7OikK4nFYAu3Ote2+JYNVvkpAEQm3/TLNEJFD/xZJjzyxg3KBWOzw==", - "dev": true - }, - "path-platform": { - "version": "0.11.15", - "resolved": "https://registry.npmjs.org/path-platform/-/path-platform-0.11.15.tgz", - "integrity": "sha1-6GQhf3TDaFDwhSt43Hv31KVyG/I=", - "dev": true - }, - "path-to-regexp": { - "version": "0.1.7", - "resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-0.1.7.tgz", - "integrity": "sha1-32BBeABfUi8V60SQ5yR6G/qmf4w=" - }, - "pbkdf2": { - "version": "3.0.17", - "resolved": "https://registry.npmjs.org/pbkdf2/-/pbkdf2-3.0.17.tgz", - "integrity": "sha512-U/il5MsrZp7mGg3mSQfn742na2T+1/vHDCG5/iTI3X9MKUuYUZVLQhyRsg06mCgDBTd57TxzgZt7P+fYfjRLtA==", - "dev": true, - "requires": { - "create-hash": "^1.1.2", - "create-hmac": "^1.1.4", - "ripemd160": "^2.0.1", - "safe-buffer": "^5.0.1", - "sha.js": "^2.4.8" - } - }, - "process": { - "version": "0.11.10", - "resolved": "https://registry.npmjs.org/process/-/process-0.11.10.tgz", - "integrity": "sha1-czIwDoQBYb2j5podHZGn1LwW8YI=", - "dev": true - }, - "process-nextick-args": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-2.0.0.tgz", - "integrity": "sha512-MtEC1TqN0EU5nephaJ4rAtThHtC86dNN9qCuEhtshvpVBkAW5ZO7BASN9REnF9eoXGcRub+pFuKEpOHE+HbEMw==", - "dev": true - }, - "proxy-addr": { - "version": "2.0.5", - "resolved": "https://registry.npmjs.org/proxy-addr/-/proxy-addr-2.0.5.tgz", - "integrity": "sha512-t/7RxHXPH6cJtP0pRG6smSr9QJidhB+3kXu0KgXnbGYMgzEnUxRQ4/LDdfOwZEMyIh3/xHb8PX3t+lfL9z+YVQ==", - "requires": { - "forwarded": "~0.1.2", - "ipaddr.js": "1.9.0" - } - }, - "public-encrypt": { - "version": "4.0.3", - "resolved": "https://registry.npmjs.org/public-encrypt/-/public-encrypt-4.0.3.tgz", - "integrity": "sha512-zVpa8oKZSz5bTMTFClc1fQOnyyEzpl5ozpi1B5YcvBrdohMjH2rfsBtyXcuNuwjsDIXmBYlF2N5FlJYhR29t8Q==", - "dev": true, - "requires": { - "bn.js": "^4.1.0", - "browserify-rsa": "^4.0.0", - "create-hash": "^1.1.0", - "parse-asn1": "^5.0.0", - "randombytes": "^2.0.1", - "safe-buffer": "^5.1.2" - } - }, - "punycode": { - "version": "1.4.1", - "resolved": "https://registry.npmjs.org/punycode/-/punycode-1.4.1.tgz", - "integrity": "sha1-wNWmOycYgArY4esPpSachN1BhF4=", - "dev": true - }, - "qs": { - "version": "6.7.0", - "resolved": "https://registry.npmjs.org/qs/-/qs-6.7.0.tgz", - "integrity": "sha512-VCdBRNFTX1fyE7Nb6FYoURo/SPe62QCaAyzJvUjwRaIsc+NePBEniHlvxFmmX56+HZphIGtV0XeCirBtpDrTyQ==" - }, - "querystring": { - "version": "0.2.0", - "resolved": "https://registry.npmjs.org/querystring/-/querystring-0.2.0.tgz", - "integrity": "sha1-sgmEkgO7Jd+CDadW50cAWHhSFiA=", - "dev": true - }, - "querystring-es3": { - "version": "0.2.1", - "resolved": "https://registry.npmjs.org/querystring-es3/-/querystring-es3-0.2.1.tgz", - "integrity": "sha1-nsYfeQSYdXB9aUFFlv2Qek1xHnM=", - "dev": true - }, - "randombytes": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/randombytes/-/randombytes-2.1.0.tgz", - "integrity": "sha512-vYl3iOX+4CKUWuxGi9Ukhie6fsqXqS9FE2Zaic4tNFD2N2QQaXOMFbuKK4QmDHC0JO6B1Zp41J0LpT0oR68amQ==", - "dev": true, - "requires": { - "safe-buffer": "^5.1.0" - } - }, - "randomfill": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/randomfill/-/randomfill-1.0.4.tgz", - "integrity": "sha512-87lcbR8+MhcWcUiQ+9e+Rwx8MyR2P7qnt15ynUlbm3TU/fjbgz4GsvfSUDTemtCCtVCqb4ZcEFlyPNTh9bBTLw==", - "dev": true, - "requires": { - "randombytes": "^2.0.5", - "safe-buffer": "^5.1.0" - } - }, - "range-parser": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/range-parser/-/range-parser-1.2.1.tgz", - "integrity": "sha512-Hrgsx+orqoygnmhFbKaHE6c296J+HTAQXoxEF6gNupROmmGJRoyzfG3ccAveqCBrwr/2yxQ5BVd/GTl5agOwSg==" - }, - "raw-body": { - "version": "2.4.0", - "resolved": "https://registry.npmjs.org/raw-body/-/raw-body-2.4.0.tgz", - "integrity": "sha512-4Oz8DUIwdvoa5qMJelxipzi/iJIi40O5cGV1wNYp5hvZP8ZN0T+jiNkL0QepXs+EsQ9XJ8ipEDoiH70ySUJP3Q==", - "requires": { - "bytes": "3.1.0", - "http-errors": "1.7.2", - "iconv-lite": "0.4.24", - "unpipe": "1.0.0" - } - }, - "read-only-stream": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/read-only-stream/-/read-only-stream-2.0.0.tgz", - "integrity": "sha1-JyT9aoET1zdkrCiNQ4YnDB2/F/A=", - "dev": true, - "requires": { - "readable-stream": "^2.0.2" - }, - "dependencies": { - "isarray": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz", - "integrity": "sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE=", - "dev": true - }, - "readable-stream": { - "version": "2.3.6", - "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.6.tgz", - "integrity": "sha512-tQtKA9WIAhBF3+VLAseyMqZeBjW0AHJoxOtYqSUZNJxauErmLbVm2FW1y+J/YA9dUrAC39ITejlZWhVIwawkKw==", - "dev": true, - "requires": { - "core-util-is": "~1.0.0", - "inherits": "~2.0.3", - "isarray": "~1.0.0", - "process-nextick-args": "~2.0.0", - "safe-buffer": "~5.1.1", - "string_decoder": "~1.1.1", - "util-deprecate": "~1.0.1" - } - }, - "string_decoder": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", - "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==", - "dev": true, - "requires": { - "safe-buffer": "~5.1.0" - } - } - } - }, - "readable-stream": { - "version": "1.1.14", - "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-1.1.14.tgz", - "integrity": "sha1-fPTFTvZI44EwhMY23SB54WbAgdk=", - "requires": { - "core-util-is": "~1.0.0", - "inherits": "~2.0.1", - "isarray": "0.0.1", - "string_decoder": "~0.10.x" - } - }, - "resolve": { - "version": "1.11.1", - "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.11.1.tgz", - "integrity": "sha512-vIpgF6wfuJOZI7KKKSP+HmiKggadPQAdsp5HiC1mvqnfp0gF1vdwgBWZIdrVft9pgqoMFQN+R7BSWZiBxx+BBw==", - "dev": true, - "requires": { - "path-parse": "^1.0.6" - } - }, - "ripemd160": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/ripemd160/-/ripemd160-2.0.2.tgz", - "integrity": "sha512-ii4iagi25WusVoiC4B4lq7pbXfAp3D9v5CwfkY33vffw2+pkDjY1D8GaN7spsxvCSx8dkPqOZCEZyfxcmJG2IA==", - "requires": { - "hash-base": "^3.0.0", - "inherits": "^2.0.1" - } - }, - "safe-buffer": { - "version": "5.1.2", - "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", - "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==" - }, - "safer-buffer": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz", - "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==" - }, - "send": { - "version": "0.17.1", - "resolved": "https://registry.npmjs.org/send/-/send-0.17.1.tgz", - "integrity": "sha512-BsVKsiGcQMFwT8UxypobUKyv7irCNRHk1T0G680vk88yf6LBByGcZJOTJCrTP2xVN6yI+XjPJcNuE3V4fT9sAg==", - "requires": { - "debug": "2.6.9", - "depd": "~1.1.2", - "destroy": "~1.0.4", - "encodeurl": "~1.0.2", - "escape-html": "~1.0.3", - "etag": "~1.8.1", - "fresh": "0.5.2", - "http-errors": "~1.7.2", - "mime": "1.6.0", - "ms": "2.1.1", - "on-finished": "~2.3.0", - "range-parser": "~1.2.1", - "statuses": "~1.5.0" - }, - "dependencies": { - "ms": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.1.tgz", - "integrity": "sha512-tgp+dl5cGk28utYktBsrFqA7HKgrhgPsg6Z/EfhWI4gl1Hwq8B/GmY/0oXZ6nF8hDVesS/FpnYaD/kOWhYQvyg==" - } - } - }, - "serve-static": { - "version": "1.14.1", - "resolved": "https://registry.npmjs.org/serve-static/-/serve-static-1.14.1.tgz", - "integrity": "sha512-JMrvUwE54emCYWlTI+hGrGv5I8dEwmco/00EvkzIIsR7MqrHonbD9pO2MOfFnpFntl7ecpZs+3mW+XbQZu9QCg==", - "requires": { - "encodeurl": "~1.0.2", - "escape-html": "~1.0.3", - "parseurl": "~1.3.3", - "send": "0.17.1" - } - }, - "setprototypeof": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/setprototypeof/-/setprototypeof-1.1.1.tgz", - "integrity": "sha512-JvdAWfbXeIGaZ9cILp38HntZSFSo3mWg6xGcJJsd+d4aRMOqauag1C63dJfDw7OaMYwEbHMOxEZ1lqVRYP2OAw==" - }, - "sha.js": { - "version": "2.4.11", - "resolved": "https://registry.npmjs.org/sha.js/-/sha.js-2.4.11.tgz", - "integrity": "sha512-QMEp5B7cftE7APOjk5Y6xgrbWu+WkLVQwk8JNjZ8nKRciZaByEW6MubieAiToS7+dwvrjGhH8jRXz3MVd0AYqQ==", - "requires": { - "inherits": "^2.0.1", - "safe-buffer": "^5.0.1" - } - }, - "shasum": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/shasum/-/shasum-1.0.2.tgz", - "integrity": "sha1-5wEjENj0F/TetXEhUOVni4euVl8=", - "dev": true, - "requires": { - "json-stable-stringify": "~0.0.0", - "sha.js": "~2.4.4" - } - }, - "shell-quote": { - "version": "1.6.1", - "resolved": "https://registry.npmjs.org/shell-quote/-/shell-quote-1.6.1.tgz", - "integrity": "sha1-9HgZSczkAmlxJ0MOo7PFR29IF2c=", - "dev": true, - "requires": { - "array-filter": "~0.0.0", - "array-map": "~0.0.0", - "array-reduce": "~0.0.0", - "jsonify": "~0.0.0" - } - }, - "simple-concat": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/simple-concat/-/simple-concat-1.0.0.tgz", - "integrity": "sha1-c0TLuLbib7J9ZrL8hvn21Zl1IcY=", - "dev": true - }, - "source-map": { - "version": "0.5.7", - "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.5.7.tgz", - "integrity": "sha1-igOdLRAh0i0eoUyA2OpGi6LvP8w=", - "dev": true - }, - "statuses": { - "version": "1.5.0", - "resolved": "https://registry.npmjs.org/statuses/-/statuses-1.5.0.tgz", - "integrity": "sha1-Fhx9rBd2Wf2YEfQ3cfqZOBR4Yow=" - }, - "stream-browserify": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/stream-browserify/-/stream-browserify-2.0.2.tgz", - "integrity": "sha512-nX6hmklHs/gr2FuxYDltq8fJA1GDlxKQCz8O/IM4atRqBH8OORmBNgfvW5gG10GT/qQ9u0CzIvr2X5Pkt6ntqg==", - "dev": true, - "requires": { - "inherits": "~2.0.1", - "readable-stream": "^2.0.2" - }, - "dependencies": { - "isarray": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz", - "integrity": "sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE=", - "dev": true - }, - "readable-stream": { - "version": "2.3.6", - "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.6.tgz", - "integrity": "sha512-tQtKA9WIAhBF3+VLAseyMqZeBjW0AHJoxOtYqSUZNJxauErmLbVm2FW1y+J/YA9dUrAC39ITejlZWhVIwawkKw==", - "dev": true, - "requires": { - "core-util-is": "~1.0.0", - "inherits": "~2.0.3", - "isarray": "~1.0.0", - "process-nextick-args": "~2.0.0", - "safe-buffer": "~5.1.1", - "string_decoder": "~1.1.1", - "util-deprecate": "~1.0.1" - } - }, - "string_decoder": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", - "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==", - "dev": true, - "requires": { - "safe-buffer": "~5.1.0" - } - } - } - }, - "stream-combiner2": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/stream-combiner2/-/stream-combiner2-1.1.1.tgz", - "integrity": "sha1-+02KFCDqNidk4hrUeAOXvry0HL4=", - "dev": true, - "requires": { - "duplexer2": "~0.1.0", - "readable-stream": "^2.0.2" - }, - "dependencies": { - "isarray": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz", - "integrity": "sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE=", - "dev": true - }, - "readable-stream": { - "version": "2.3.6", - "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.6.tgz", - "integrity": "sha512-tQtKA9WIAhBF3+VLAseyMqZeBjW0AHJoxOtYqSUZNJxauErmLbVm2FW1y+J/YA9dUrAC39ITejlZWhVIwawkKw==", - "dev": true, - "requires": { - "core-util-is": "~1.0.0", - "inherits": "~2.0.3", - "isarray": "~1.0.0", - "process-nextick-args": "~2.0.0", - "safe-buffer": "~5.1.1", - "string_decoder": "~1.1.1", - "util-deprecate": "~1.0.1" - } - }, - "string_decoder": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", - "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==", - "dev": true, - "requires": { - "safe-buffer": "~5.1.0" - } - } - } - }, - "stream-http": { - "version": "2.8.3", - "resolved": "https://registry.npmjs.org/stream-http/-/stream-http-2.8.3.tgz", - "integrity": "sha512-+TSkfINHDo4J+ZobQLWiMouQYB+UVYFttRA94FpEzzJ7ZdqcL4uUUQ7WkdkI4DSozGmgBUE/a47L+38PenXhUw==", - "dev": true, - "requires": { - "builtin-status-codes": "^3.0.0", - "inherits": "^2.0.1", - "readable-stream": "^2.3.6", - "to-arraybuffer": "^1.0.0", - "xtend": "^4.0.0" - }, - "dependencies": { - "isarray": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz", - "integrity": "sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE=", - "dev": true - }, - "readable-stream": { - "version": "2.3.6", - "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.6.tgz", - "integrity": "sha512-tQtKA9WIAhBF3+VLAseyMqZeBjW0AHJoxOtYqSUZNJxauErmLbVm2FW1y+J/YA9dUrAC39ITejlZWhVIwawkKw==", - "dev": true, - "requires": { - "core-util-is": "~1.0.0", - "inherits": "~2.0.3", - "isarray": "~1.0.0", - "process-nextick-args": "~2.0.0", - "safe-buffer": "~5.1.1", - "string_decoder": "~1.1.1", - "util-deprecate": "~1.0.1" - } - }, - "string_decoder": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", - "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==", - "dev": true, - "requires": { - "safe-buffer": "~5.1.0" - } - } - } - }, - "stream-parser": { - "version": "0.3.1", - "resolved": "https://registry.npmjs.org/stream-parser/-/stream-parser-0.3.1.tgz", - "integrity": "sha1-FhhUhpRCACGhGC/wrxkRwSl2F3M=", - "requires": { - "debug": "2" - } - }, - "stream-splicer": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/stream-splicer/-/stream-splicer-2.0.1.tgz", - "integrity": "sha512-Xizh4/NPuYSyAXyT7g8IvdJ9HJpxIGL9PjyhtywCZvvP0OPIdqyrr4dMikeuvY8xahpdKEBlBTySe583totajg==", - "dev": true, - "requires": { - "inherits": "^2.0.1", - "readable-stream": "^2.0.2" - }, - "dependencies": { - "isarray": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz", - "integrity": "sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE=", - "dev": true - }, - "readable-stream": { - "version": "2.3.6", - "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.6.tgz", - "integrity": "sha512-tQtKA9WIAhBF3+VLAseyMqZeBjW0AHJoxOtYqSUZNJxauErmLbVm2FW1y+J/YA9dUrAC39ITejlZWhVIwawkKw==", - "dev": true, - "requires": { - "core-util-is": "~1.0.0", - "inherits": "~2.0.3", - "isarray": "~1.0.0", - "process-nextick-args": "~2.0.0", - "safe-buffer": "~5.1.1", - "string_decoder": "~1.1.1", - "util-deprecate": "~1.0.1" - } - }, - "string_decoder": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", - "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==", - "dev": true, - "requires": { - "safe-buffer": "~5.1.0" - } - } - } - }, - "string_decoder": { - "version": "0.10.31", - "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-0.10.31.tgz", - "integrity": "sha1-YuIDvEF2bGwoyfyEMB2rHFMQ+pQ=" - }, - "subarg": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/subarg/-/subarg-1.0.0.tgz", - "integrity": "sha1-9izxdYHplrSPyWVpn1TAauJouNI=", - "dev": true, - "requires": { - "minimist": "^1.1.0" - } - }, - "syntax-error": { - "version": "1.4.0", - "resolved": "https://registry.npmjs.org/syntax-error/-/syntax-error-1.4.0.tgz", - "integrity": "sha512-YPPlu67mdnHGTup2A8ff7BC2Pjq0e0Yp/IyTFN03zWO0RcK07uLcbi7C2KpGR2FvWbaB0+bfE27a+sBKebSo7w==", - "dev": true, - "requires": { - "acorn-node": "^1.2.0" - } - }, - "through": { - "version": "2.3.8", - "resolved": "https://registry.npmjs.org/through/-/through-2.3.8.tgz", - "integrity": "sha1-DdTJ/6q8NXlgsbckEV1+Doai4fU=", - "dev": true - }, - "through2": { - "version": "2.0.5", - "resolved": "https://registry.npmjs.org/through2/-/through2-2.0.5.tgz", - "integrity": "sha512-/mrRod8xqpA+IHSLyGCQ2s8SPHiCDEeQJSep1jqLYeEUClOFG2Qsh+4FU6G9VeqpZnGW/Su8LQGc4YKni5rYSQ==", - "dev": true, - "requires": { - "readable-stream": "~2.3.6", - "xtend": "~4.0.1" - }, - "dependencies": { - "isarray": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz", - "integrity": "sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE=", - "dev": true - }, - "readable-stream": { - "version": "2.3.6", - "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.6.tgz", - "integrity": "sha512-tQtKA9WIAhBF3+VLAseyMqZeBjW0AHJoxOtYqSUZNJxauErmLbVm2FW1y+J/YA9dUrAC39ITejlZWhVIwawkKw==", - "dev": true, - "requires": { - "core-util-is": "~1.0.0", - "inherits": "~2.0.3", - "isarray": "~1.0.0", - "process-nextick-args": "~2.0.0", - "safe-buffer": "~5.1.1", - "string_decoder": "~1.1.1", - "util-deprecate": "~1.0.1" - } - }, - "string_decoder": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", - "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==", - "dev": true, - "requires": { - "safe-buffer": "~5.1.0" - } - } - } - }, - "timers-browserify": { - "version": "1.4.2", - "resolved": "https://registry.npmjs.org/timers-browserify/-/timers-browserify-1.4.2.tgz", - "integrity": "sha1-ycWLV1voQHN1y14kYtrO50NZ9B0=", - "dev": true, - "requires": { - "process": "~0.11.0" - } - }, - "to-arraybuffer": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/to-arraybuffer/-/to-arraybuffer-1.0.1.tgz", - "integrity": "sha1-fSKbH8xjfkZsoIEYCDanqr/4P0M=", - "dev": true - }, - "toidentifier": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/toidentifier/-/toidentifier-1.0.0.tgz", - "integrity": "sha512-yaOH/Pk/VEhBWWTlhI+qXxDFXlejDGcQipMlyxda9nthulaxLZUNcUqFxokp0vcYnvteJln5FNQDRrxj3YcbVw==" - }, - "tr46": { - "version": "0.0.3", - "resolved": "https://registry.npmjs.org/tr46/-/tr46-0.0.3.tgz", - "integrity": "sha512-N3WMsuqV66lT30CrXNbEjx4GEwlow3v6rr4mCcv6prnfwhS01rkgyFdjPNBYd9br7LpXV1+Emh01fHnq2Gdgrw==" - }, - "tty-browserify": { - "version": "0.0.1", - "resolved": "https://registry.npmjs.org/tty-browserify/-/tty-browserify-0.0.1.tgz", - "integrity": "sha512-C3TaO7K81YvjCgQH9Q1S3R3P3BtN3RIM8n+OvX4il1K1zgE8ZhI0op7kClgkxtutIE8hQrcrHBXvIheqKUUCxw==", - "dev": true - }, - "type-is": { - "version": "1.6.18", - "resolved": "https://registry.npmjs.org/type-is/-/type-is-1.6.18.tgz", - "integrity": "sha512-TkRKr9sUTxEH8MdfuCSP7VizJyzRNMjj2J2do2Jr3Kym598JVdEksuzPQCnlFPW4ky9Q+iA+ma9BGm06XQBy8g==", - "requires": { - "media-typer": "0.3.0", - "mime-types": "~2.1.24" - } - }, - "typedarray": { - "version": "0.0.6", - "resolved": "https://registry.npmjs.org/typedarray/-/typedarray-0.0.6.tgz", - "integrity": "sha1-hnrHTjhkGHsdPUfZlqeOxciDB3c=", - "dev": true - }, - "umd": { - "version": "3.0.3", - "resolved": "https://registry.npmjs.org/umd/-/umd-3.0.3.tgz", - "integrity": "sha512-4IcGSufhFshvLNcMCV80UnQVlZ5pMOC8mvNPForqwA4+lzYQuetTESLDQkeLmihq8bRcnpbQa48Wb8Lh16/xow==", - "dev": true - }, - "undeclared-identifiers": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/undeclared-identifiers/-/undeclared-identifiers-1.1.3.tgz", - "integrity": "sha512-pJOW4nxjlmfwKApE4zvxLScM/njmwj/DiUBv7EabwE4O8kRUy+HIwxQtZLBPll/jx1LJyBcqNfB3/cpv9EZwOw==", - "dev": true, - "requires": { - "acorn-node": "^1.3.0", - "dash-ast": "^1.0.0", - "get-assigned-identifiers": "^1.2.0", - "simple-concat": "^1.0.0", - "xtend": "^4.0.1" - } - }, - "unpipe": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/unpipe/-/unpipe-1.0.0.tgz", - "integrity": "sha1-sr9O6FFKrmFltIF4KdIbLvSZBOw=" - }, - "url": { - "version": "0.11.0", - "resolved": "https://registry.npmjs.org/url/-/url-0.11.0.tgz", - "integrity": "sha1-ODjpfPxgUh63PFJajlW/3Z4uKPE=", - "dev": true, - "requires": { - "punycode": "1.3.2", - "querystring": "0.2.0" - }, - "dependencies": { - "punycode": { - "version": "1.3.2", - "resolved": "https://registry.npmjs.org/punycode/-/punycode-1.3.2.tgz", - "integrity": "sha1-llOgNvt8HuQjQvIyXM7v6jkmxI0=", - "dev": true - } - } + "optional": true + } + } + }, + "node_modules/for-each": { + "version": "0.3.5", + "resolved": "https://registry.npmjs.org/for-each/-/for-each-0.3.5.tgz", + "integrity": "sha512-dKx12eRCVIzqCxFGplyFKJMPvLEWgmNtUrpTiJIR5u97zEhRG8ySrtboPHZXx7daLxQVrl643cTzbab2tkQjxg==", + "license": "MIT", + "dependencies": { + "is-callable": "^1.2.7" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/form-data": { + "version": "4.0.4", + "resolved": "https://registry.npmjs.org/form-data/-/form-data-4.0.4.tgz", + "integrity": "sha512-KrGhL9Q4zjj0kiUt5OO4Mr/A/jlI2jDYs5eHBpYHPcBEVSiipAvn2Ko2HnPe20rmcuuvMHNdZFp+4IlGTMF0Ow==", + "license": "MIT", + "dependencies": { + "asynckit": "^0.4.0", + "combined-stream": "^1.0.8", + "es-set-tostringtag": "^2.1.0", + "hasown": "^2.0.2", + "mime-types": "^2.1.12" + }, + "engines": { + "node": ">= 6" + } + }, + "node_modules/forwarded": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/forwarded/-/forwarded-0.2.0.tgz", + "integrity": "sha512-buRG0fpBtRHSTCOASe6hD258tEubFoRLb4ZNA6NxMVHNw2gOcwHo9wyablzMzOA5z9xA9L1KNjk/Nt6MT9aYow==", + "license": "MIT", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/fresh": { + "version": "0.5.2", + "resolved": "https://registry.npmjs.org/fresh/-/fresh-0.5.2.tgz", + "integrity": "sha512-zJ2mQYM18rEFOudeV4GShTGIQ7RbzA7ozbU9I/XBpm7kqgMywgmylMwXHxZJmkVoYkna9d2pVXVXPdYTP9ej8Q==", + "license": "MIT", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/fs.realpath": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", + "integrity": "sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw==", + "dev": true, + "license": "ISC" + }, + "node_modules/function-bind": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.2.tgz", + "integrity": "sha512-7XHNxH7qX9xG5mIwxkhumTox/MIRNcOgDrxWsMt2pAr23WHp6MrRlN7FBSFpCpr+oVO0F744iUgR82nJMfG2SA==", + "license": "MIT", + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/get-assigned-identifiers": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/get-assigned-identifiers/-/get-assigned-identifiers-1.2.0.tgz", + "integrity": "sha512-mBBwmeGTrxEMO4pMaaf/uUEFHnYtwr8FTe8Y/mer4rcV/bye0qGm6pw1bGZFGStxC5O76c5ZAVBGnqHmOaJpdQ==", + "dev": true, + "license": "Apache-2.0" + }, + "node_modules/get-intrinsic": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.3.0.tgz", + "integrity": "sha512-9fSjSaos/fRIVIp+xSJlE6lfwhES7LNtKaCBIamHsjr2na1BiABJPo0mOjjz8GJDURarmCPGqaiVg5mfjb98CQ==", + "license": "MIT", + "dependencies": { + "call-bind-apply-helpers": "^1.0.2", + "es-define-property": "^1.0.1", + "es-errors": "^1.3.0", + "es-object-atoms": "^1.1.1", + "function-bind": "^1.1.2", + "get-proto": "^1.0.1", + "gopd": "^1.2.0", + "has-symbols": "^1.1.0", + "hasown": "^2.0.2", + "math-intrinsics": "^1.1.0" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/get-proto": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/get-proto/-/get-proto-1.0.1.tgz", + "integrity": "sha512-sTSfBjoXBp89JvIKIefqw7U2CCebsc74kiY6awiGogKtoSGbgjYE/G/+l9sF3MWFPNc9IcoOC4ODfKHfxFmp0g==", + "license": "MIT", + "dependencies": { + "dunder-proto": "^1.0.1", + "es-object-atoms": "^1.0.0" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/glob": { + "version": "7.2.3", + "resolved": "https://registry.npmjs.org/glob/-/glob-7.2.3.tgz", + "integrity": "sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q==", + "deprecated": "Glob versions prior to v9 are no longer supported", + "dev": true, + "license": "ISC", + "dependencies": { + "fs.realpath": "^1.0.0", + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "^3.1.1", + "once": "^1.3.0", + "path-is-absolute": "^1.0.0" + }, + "engines": { + "node": "*" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/gopd": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/gopd/-/gopd-1.2.0.tgz", + "integrity": "sha512-ZUKRh6/kUFoAiTAtTYPZJ3hw9wNxx+BIBOijnlG9PnrJsCcSjs1wyyD6vJpaYtgnzDrKYRSqf3OO6Rfa93xsRg==", + "license": "MIT", + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/has": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/has/-/has-1.0.4.tgz", + "integrity": "sha512-qdSAmqLF6209RFj4VVItywPMbm3vWylknmB3nvNiUIs72xAimcM8nVYxYr7ncvZq5qzk9MKIZR8ijqD/1QuYjQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 0.4.0" + } + }, + "node_modules/has-property-descriptors": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/has-property-descriptors/-/has-property-descriptors-1.0.2.tgz", + "integrity": "sha512-55JNKuIW+vq4Ke1BjOTjM2YctQIvCT7GFzHwmfZPGo5wnrgkid0YQtnAleFSqumZm4az3n2BS+erby5ipJdgrg==", + "license": "MIT", + "dependencies": { + "es-define-property": "^1.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/has-symbols": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.1.0.tgz", + "integrity": "sha512-1cDNdwJ2Jaohmb3sg4OmKaMBwuC48sYni5HUw2DvsC8LjGTLK9h+eb1X6RyuOHe4hT0ULCW68iomhjUoKUqlPQ==", + "license": "MIT", + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/has-tostringtag": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/has-tostringtag/-/has-tostringtag-1.0.2.tgz", + "integrity": "sha512-NqADB8VjPFLM2V0VvHUewwwsw0ZWBaIdgo+ieHtK3hasLz4qeCRjYcqfB6AQrBggRKppKF8L52/VqdVsO47Dlw==", + "license": "MIT", + "dependencies": { + "has-symbols": "^1.0.3" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/hash-base": { + "version": "3.0.5", + "resolved": "https://registry.npmjs.org/hash-base/-/hash-base-3.0.5.tgz", + "integrity": "sha512-vXm0l45VbcHEVlTCzs8M+s0VeYsB2lnlAaThoLKGXr3bE/VWDOelNUnycUPEhKEaXARL2TEFjBOyUiM6+55KBg==", + "license": "MIT", + "dependencies": { + "inherits": "^2.0.4", + "safe-buffer": "^5.2.1" + }, + "engines": { + "node": ">= 0.10" + } + }, + "node_modules/hash.js": { + "version": "1.1.7", + "resolved": "https://registry.npmjs.org/hash.js/-/hash.js-1.1.7.tgz", + "integrity": "sha512-taOaskGt4z4SOANNseOviYDvjEJinIkRgmp7LbKP2YTTmVxWBl87s/uzK9r+44BclBSp2X7K1hqeNfz9JbBeXA==", + "dev": true, + "license": "MIT", + "dependencies": { + "inherits": "^2.0.3", + "minimalistic-assert": "^1.0.1" + } + }, + "node_modules/hasown": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/hasown/-/hasown-2.0.2.tgz", + "integrity": "sha512-0hJU9SCPvmMzIBdZFqNPXWa6dqh7WdH0cII9y+CyS8rG3nL48Bclra9HmKhVVUHyPWNH5Y7xDwAB7bfgSjkUMQ==", + "license": "MIT", + "dependencies": { + "function-bind": "^1.1.2" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/hmac-drbg": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/hmac-drbg/-/hmac-drbg-1.0.1.tgz", + "integrity": "sha512-Tti3gMqLdZfhOQY1Mzf/AanLiqh1WTiJgEj26ZuYQ9fbkLomzGchCws4FyrSd4VkpBfiNhaE1On+lOz894jvXg==", + "dev": true, + "license": "MIT", + "dependencies": { + "hash.js": "^1.0.3", + "minimalistic-assert": "^1.0.0", + "minimalistic-crypto-utils": "^1.0.1" + } + }, + "node_modules/houndify": { + "version": "4.0.0-beta.3", + "resolved": "file:../houndify-web-sdk/houndify-4.0.0-beta.3.tgz", + "integrity": "sha512-KKJhDTMt3/4MRg6xbepWZQ/GfOgFZcrGzN24hPSHMfnoD8hlPuLWfJhgrxidTHkbUx+/vDtsT+Yw2IFqiut23A==", + "license": "MIT", + "dependencies": { + "axios": "^1.11.0", + "create-hmac": "^1.1.6", + "cross-fetch": "^3.1.5", + "express": "^4.21.2", + "express-ws": "^5.0.2", + "https-proxy-agent": "^5.0.1", + "json-bigint": "^1.0.0", + "pako": "^1.0.5", + "uuid": "^9.0.1", + "wav": "^1.0.2", + "ws": "^8.18.0" + }, + "engines": { + "node": ">=18.0.0" + } + }, + "node_modules/htmlescape": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/htmlescape/-/htmlescape-1.1.1.tgz", + "integrity": "sha512-eVcrzgbR4tim7c7soKQKtxa/kQM4TzjnlU83rcZ9bHU6t31ehfV7SktN6McWgwPWg+JYMA/O3qpGxBvFq1z2Jg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.10" + } + }, + "node_modules/http-errors": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/http-errors/-/http-errors-2.0.0.tgz", + "integrity": "sha512-FtwrG/euBzaEjYeRqOgly7G0qviiXoJWnvEH2Z1plBdXgbyjv34pHTSb9zoeHMyDy33+DWy5Wt9Wo+TURtOYSQ==", + "license": "MIT", + "dependencies": { + "depd": "2.0.0", + "inherits": "2.0.4", + "setprototypeof": "1.2.0", + "statuses": "2.0.1", + "toidentifier": "1.0.1" + }, + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/https-browserify": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/https-browserify/-/https-browserify-1.0.0.tgz", + "integrity": "sha512-J+FkSdyD+0mA0N+81tMotaRMfSL9SGi+xpD3T6YApKsc3bGSXJlfXri3VyFOeYkfLRQisDk1W+jIFFKBeUBbBg==", + "dev": true, + "license": "MIT" + }, + "node_modules/https-proxy-agent": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/https-proxy-agent/-/https-proxy-agent-5.0.1.tgz", + "integrity": "sha512-dFcAjpTQFgoLMzC2VwU+C/CbS7uRL0lWmxDITmqm7C+7F0Odmj6s9l6alZc6AELXhrnggM2CeWSXHGOdX2YtwA==", + "license": "MIT", + "dependencies": { + "agent-base": "6", + "debug": "4" + }, + "engines": { + "node": ">= 6" + } + }, + "node_modules/https-proxy-agent/node_modules/debug": { + "version": "4.4.3", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.4.3.tgz", + "integrity": "sha512-RGwwWnwQvkVfavKVt22FGLw+xYSdzARwm0ru6DhTVA3umU5hZc28V3kO4stgYryrTlLpuvgI9GiijltAjNbcqA==", + "license": "MIT", + "dependencies": { + "ms": "^2.1.3" + }, + "engines": { + "node": ">=6.0" + }, + "peerDependenciesMeta": { + "supports-color": { + "optional": true + } + } + }, + "node_modules/https-proxy-agent/node_modules/ms": { + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", + "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==", + "license": "MIT" + }, + "node_modules/iconv-lite": { + "version": "0.4.24", + "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.24.tgz", + "integrity": "sha512-v3MXnZAcvnywkTUEZomIActle7RXXeedOR31wwl7VlyoXO4Qi9arvSenNQWne1TcRwhCL1HwLI21bEqdpj8/rA==", + "license": "MIT", + "dependencies": { + "safer-buffer": ">= 2.1.2 < 3" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/ieee754": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/ieee754/-/ieee754-1.2.1.tgz", + "integrity": "sha512-dcyqhDvX1C46lXZcVqCpK+FtMRQVdIMN6/Df5js2zouUsqG7I6sFxitIC+7KYK29KdXOLHdu9zL4sFnoVQnqaA==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ], + "license": "BSD-3-Clause" + }, + "node_modules/inflight": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", + "integrity": "sha512-k92I/b08q4wvFscXCLvqfsHCrjrF7yiXsQuIVvVE7N82W3+aqpzuUdBbfhWcy/FZR3/4IgflMgKLOsvPDrGCJA==", + "deprecated": "This module is not supported, and leaks memory. Do not use it. Check out lru-cache if you want a good and tested way to coalesce async requests by a key value, which is much more comprehensive and powerful.", + "dev": true, + "license": "ISC", + "dependencies": { + "once": "^1.3.0", + "wrappy": "1" + } + }, + "node_modules/inherits": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", + "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==", + "license": "ISC" + }, + "node_modules/inline-source-map": { + "version": "0.6.3", + "resolved": "https://registry.npmjs.org/inline-source-map/-/inline-source-map-0.6.3.tgz", + "integrity": "sha512-1aVsPEsJWMJq/pdMU61CDlm1URcW702MTB4w9/zUjMus6H/Py8o7g68Pr9D4I6QluWGt/KdmswuRhaA05xVR1w==", + "dev": true, + "license": "MIT", + "dependencies": { + "source-map": "~0.5.3" + } + }, + "node_modules/insert-module-globals": { + "version": "7.2.1", + "resolved": "https://registry.npmjs.org/insert-module-globals/-/insert-module-globals-7.2.1.tgz", + "integrity": "sha512-ufS5Qq9RZN+Bu899eA9QCAYThY+gGW7oRkmb0vC93Vlyu/CFGcH0OYPEjVkDXA5FEbTt1+VWzdoOD3Ny9N+8tg==", + "dev": true, + "license": "MIT", + "dependencies": { + "acorn-node": "^1.5.2", + "combine-source-map": "^0.8.0", + "concat-stream": "^1.6.1", + "is-buffer": "^1.1.0", + "JSONStream": "^1.0.3", + "path-is-absolute": "^1.0.1", + "process": "~0.11.0", + "through2": "^2.0.0", + "undeclared-identifiers": "^1.1.2", + "xtend": "^4.0.0" + }, + "bin": { + "insert-module-globals": "bin/cmd.js" + } + }, + "node_modules/ipaddr.js": { + "version": "1.9.1", + "resolved": "https://registry.npmjs.org/ipaddr.js/-/ipaddr.js-1.9.1.tgz", + "integrity": "sha512-0KI/607xoxSToH7GjN1FfSbLoU0+btTicjsQSWQlh/hZykN8KpmMf7uYwPW3R+akZ6R/w18ZlXSHBYXiYUPO3g==", + "license": "MIT", + "engines": { + "node": ">= 0.10" + } + }, + "node_modules/is-buffer": { + "version": "1.1.6", + "resolved": "https://registry.npmjs.org/is-buffer/-/is-buffer-1.1.6.tgz", + "integrity": "sha512-NcdALwpXkTm5Zvvbk7owOUSvVvBKDgKP5/ewfXEznmQFfs4ZRmanOeKBTjRVjka3QFoN6XJ+9F3USqfHqTaU5w==", + "dev": true, + "license": "MIT" + }, + "node_modules/is-callable": { + "version": "1.2.7", + "resolved": "https://registry.npmjs.org/is-callable/-/is-callable-1.2.7.tgz", + "integrity": "sha512-1BC0BVFhS/p0qtw6enp8e+8OD0UrK0oFLztSjNzhcKA3WDuJxxAPXzPuPtKkjEY9UUoEWlX/8fgKeu2S8i9JTA==", + "license": "MIT", + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-core-module": { + "version": "2.16.1", + "resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.16.1.tgz", + "integrity": "sha512-UfoeMA6fIJ8wTYFEUjelnaGI67v6+N7qXJEvQuIGa99l4xsCruSYOVSQ0uPANn4dAzm8lkYPaKLrrijLq7x23w==", + "dev": true, + "license": "MIT", + "dependencies": { + "hasown": "^2.0.2" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-typed-array": { + "version": "1.1.15", + "resolved": "https://registry.npmjs.org/is-typed-array/-/is-typed-array-1.1.15.tgz", + "integrity": "sha512-p3EcsicXjit7SaskXHs1hA91QxgTw46Fv6EFKKGS5DRFLD8yKnohjF3hxoju94b/OcMZoQukzpPpBE9uLVKzgQ==", + "license": "MIT", + "dependencies": { + "which-typed-array": "^1.1.16" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/isarray": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz", + "integrity": "sha512-VLghIWNM6ELQzo7zwmcg0NmTVyWKYjvIeM83yjp0wRDTmUnrM678fQbcKBo6n2CJEF0szoG//ytg+TKla89ALQ==", + "license": "MIT" + }, + "node_modules/json-bigint": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/json-bigint/-/json-bigint-1.0.0.tgz", + "integrity": "sha512-SiPv/8VpZuWbvLSMtTDU8hEfrZWg/mH/nV/b4o0CYbSxu1UIQPLdwKOCIyLQX+VIPO5vrLX3i8qtqFyhdPSUSQ==", + "license": "MIT", + "dependencies": { + "bignumber.js": "^9.0.0" + } + }, + "node_modules/json-stable-stringify": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/json-stable-stringify/-/json-stable-stringify-0.0.1.tgz", + "integrity": "sha512-nKtD/Qxm7tWdZqJoldEC7fF0S41v0mWbeaXG3637stOWfyGxTgWTYE2wtfKmjzpvxv2MA2xzxsXOIiwUpkX6Qw==", + "dev": true, + "license": "MIT", + "dependencies": { + "jsonify": "~0.0.0" + } + }, + "node_modules/jsonify": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/jsonify/-/jsonify-0.0.1.tgz", + "integrity": "sha512-2/Ki0GcmuqSrgFyelQq9M05y7PS0mEwuIzrf3f1fPqkVDVRvZrPZtVSMHxdgo8Aq0sxAOb/cr2aqqA3LeWHVPg==", + "dev": true, + "license": "Public Domain", + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/jsonparse": { + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/jsonparse/-/jsonparse-1.3.1.tgz", + "integrity": "sha512-POQXvpdL69+CluYsillJ7SUhKvytYjW9vG/GKpnf+xP8UWgYEM/RaMzHHofbALDiKbbP1W8UEYmgGl39WkPZsg==", + "dev": true, + "engines": [ + "node >= 0.2.0" + ], + "license": "MIT" + }, + "node_modules/JSONStream": { + "version": "1.3.5", + "resolved": "https://registry.npmjs.org/JSONStream/-/JSONStream-1.3.5.tgz", + "integrity": "sha512-E+iruNOY8VV9s4JEbe1aNEm6MiszPRr/UfcHMz0TQh1BXSxHK+ASV1R6W4HpjBhSeS+54PIsAMCBmwD06LLsqQ==", + "dev": true, + "license": "(MIT OR Apache-2.0)", + "dependencies": { + "jsonparse": "^1.2.0", + "through": ">=2.2.7 <3" + }, + "bin": { + "JSONStream": "bin.js" + }, + "engines": { + "node": "*" + } + }, + "node_modules/labeled-stream-splicer": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/labeled-stream-splicer/-/labeled-stream-splicer-2.0.2.tgz", + "integrity": "sha512-Ca4LSXFFZUjPScRaqOcFxneA0VpKZr4MMYCljyQr4LIewTLb3Y0IUTIsnBBsVubIeEfxeSZpSjSsRM8APEQaAw==", + "dev": true, + "license": "MIT", + "dependencies": { + "inherits": "^2.0.1", + "stream-splicer": "^2.0.0" + } + }, + "node_modules/lodash.memoize": { + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/lodash.memoize/-/lodash.memoize-3.0.4.tgz", + "integrity": "sha512-eDn9kqrAmVUC1wmZvlQ6Uhde44n+tXpqPrN8olQJbttgh0oKclk+SF54P47VEGE9CEiMeRwAP8BaM7UHvBkz2A==", + "dev": true, + "license": "MIT" + }, + "node_modules/math-intrinsics": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/math-intrinsics/-/math-intrinsics-1.1.0.tgz", + "integrity": "sha512-/IXtbwEk5HTPyEwyKX6hGkYXxM9nbj64B+ilVJnC/R6B0pH5G4V3b0pVbL7DBj4tkhBAppbQUlf6F6Xl9LHu1g==", + "license": "MIT", + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/md5.js": { + "version": "1.3.5", + "resolved": "https://registry.npmjs.org/md5.js/-/md5.js-1.3.5.tgz", + "integrity": "sha512-xitP+WxNPcTTOgnTJcrhM0xvdPepipPSf3I8EIpGKeFLjt3PlJLIDG3u8EX53ZIubkb+5U2+3rELYpEhHhzdkg==", + "license": "MIT", + "dependencies": { + "hash-base": "^3.0.0", + "inherits": "^2.0.1", + "safe-buffer": "^5.1.2" + } + }, + "node_modules/media-typer": { + "version": "0.3.0", + "resolved": "https://registry.npmjs.org/media-typer/-/media-typer-0.3.0.tgz", + "integrity": "sha512-dq+qelQ9akHpcOl/gUVRTxVIOkAJ1wR3QAvb4RsVjS8oVoFjDGTc679wJYmUmknUF5HwMLOgb5O+a3KxfWapPQ==", + "license": "MIT", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/merge-descriptors": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/merge-descriptors/-/merge-descriptors-1.0.3.tgz", + "integrity": "sha512-gaNvAS7TZ897/rVaZ0nMtAyxNyi/pdbjbAwUpFQpN70GqnVfOiXpeUUMKRBmzXaSQ8DdTX4/0ms62r2K+hE6mQ==", + "license": "MIT", + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/methods": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/methods/-/methods-1.1.2.tgz", + "integrity": "sha512-iclAHeNqNm68zFtnZ0e+1L2yUIdvzNoauKU4WBA3VvH/vPFieF7qfRlwUZU+DA9P9bPXIS90ulxoUoCH23sV2w==", + "license": "MIT", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/miller-rabin": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/miller-rabin/-/miller-rabin-4.0.1.tgz", + "integrity": "sha512-115fLhvZVqWwHPbClyntxEVfVDfl9DLLTuJvq3g2O/Oxi8AiNouAHvDSzHS0viUJc+V5vm3eq91Xwqn9dp4jRA==", + "dev": true, + "license": "MIT", + "dependencies": { + "bn.js": "^4.0.0", + "brorand": "^1.0.1" + }, + "bin": { + "miller-rabin": "bin/miller-rabin" + } + }, + "node_modules/miller-rabin/node_modules/bn.js": { + "version": "4.12.2", + "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-4.12.2.tgz", + "integrity": "sha512-n4DSx829VRTRByMRGdjQ9iqsN0Bh4OolPsFnaZBLcbi8iXcB+kJ9s7EnRt4wILZNV3kPLHkRVfOc/HvhC3ovDw==", + "dev": true, + "license": "MIT" + }, + "node_modules/mime": { + "version": "1.6.0", + "resolved": "https://registry.npmjs.org/mime/-/mime-1.6.0.tgz", + "integrity": "sha512-x0Vn8spI+wuJ1O6S7gnbaQg8Pxh4NNHb7KSINmEWKiPE4RKOplvijn+NkmYmmRgP68mc70j2EbeTFRsrswaQeg==", + "license": "MIT", + "bin": { + "mime": "cli.js" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/mime-db": { + "version": "1.52.0", + "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.52.0.tgz", + "integrity": "sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg==", + "license": "MIT", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/mime-types": { + "version": "2.1.35", + "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.35.tgz", + "integrity": "sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw==", + "license": "MIT", + "dependencies": { + "mime-db": "1.52.0" + }, + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/minimalistic-assert": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/minimalistic-assert/-/minimalistic-assert-1.0.1.tgz", + "integrity": "sha512-UtJcAD4yEaGtjPezWuO9wC4nwUnVH/8/Im3yEHQP4b67cXlD/Qr9hdITCU1xDbSEXg2XKNaP8jsReV7vQd00/A==", + "dev": true, + "license": "ISC" + }, + "node_modules/minimalistic-crypto-utils": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/minimalistic-crypto-utils/-/minimalistic-crypto-utils-1.0.1.tgz", + "integrity": "sha512-JIYlbt6g8i5jKfJ3xz7rF0LXmv2TkDxBLUkiBeZ7bAx4GnnNMr8xFpGnOxn6GhTEHx3SjRrZEoU+j04prX1ktg==", + "dev": true, + "license": "MIT" + }, + "node_modules/minimatch": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", + "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", + "dev": true, + "license": "ISC", + "dependencies": { + "brace-expansion": "^1.1.7" + }, + "engines": { + "node": "*" + } + }, + "node_modules/minimist": { + "version": "1.2.8", + "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.8.tgz", + "integrity": "sha512-2yyAR8qBkN3YuheJanUpWC5U3bb5osDywNB8RzDVlDwDHbocAJveqqj1u8+SVD7jkWT4yvsHCpWqqWqAxb0zCA==", + "license": "MIT", + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/mkdirp-classic": { + "version": "0.5.3", + "resolved": "https://registry.npmjs.org/mkdirp-classic/-/mkdirp-classic-0.5.3.tgz", + "integrity": "sha512-gKLcREMhtuZRwRAfqP3RFW+TK4JqApVBtOIftVgjuABpAtpxhPGaDcfvbhNvD0B8iD1oUr/txX35NjcaY6Ns/A==", + "dev": true, + "license": "MIT" + }, + "node_modules/module-deps": { + "version": "6.2.3", + "resolved": "https://registry.npmjs.org/module-deps/-/module-deps-6.2.3.tgz", + "integrity": "sha512-fg7OZaQBcL4/L+AK5f4iVqf9OMbCclXfy/znXRxTVhJSeW5AIlS9AwheYwDaXM3lVW7OBeaeUEY3gbaC6cLlSA==", + "dev": true, + "license": "MIT", + "dependencies": { + "browser-resolve": "^2.0.0", + "cached-path-relative": "^1.0.2", + "concat-stream": "~1.6.0", + "defined": "^1.0.0", + "detective": "^5.2.0", + "duplexer2": "^0.1.2", + "inherits": "^2.0.1", + "JSONStream": "^1.0.3", + "parents": "^1.0.0", + "readable-stream": "^2.0.2", + "resolve": "^1.4.0", + "stream-combiner2": "^1.1.1", + "subarg": "^1.0.0", + "through2": "^2.0.0", + "xtend": "^4.0.0" + }, + "bin": { + "module-deps": "bin/cmd.js" + }, + "engines": { + "node": ">= 0.8.0" + } + }, + "node_modules/ms": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", + "integrity": "sha512-Tpp60P6IUJDTuOq/5Z8cdskzJujfwqfOTkrwIwj7IRISpnkJnT6SyJ4PCPnGMoFjC9ddhal5KVIYtAt97ix05A==", + "license": "MIT" + }, + "node_modules/negotiator": { + "version": "0.6.3", + "resolved": "https://registry.npmjs.org/negotiator/-/negotiator-0.6.3.tgz", + "integrity": "sha512-+EUsqGPLsM+j/zdChZjsnX51g4XrHFOIXwfnCVPGlQk/k5giakcKsuxCObBRu6DSm9opw/O6slWbJdghQM4bBg==", + "license": "MIT", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/node-fetch": { + "version": "2.7.0", + "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.7.0.tgz", + "integrity": "sha512-c4FRfUm/dbcWZ7U+1Wq0AwCyFL+3nt2bEw05wfxSz+DWpWsitgmSgYmy2dQdWyKC1694ELPqMs/YzUSNozLt8A==", + "license": "MIT", + "dependencies": { + "whatwg-url": "^5.0.0" + }, + "engines": { + "node": "4.x || >=6.0.0" + }, + "peerDependencies": { + "encoding": "^0.1.0" + }, + "peerDependenciesMeta": { + "encoding": { + "optional": true + } + } + }, + "node_modules/node-gyp-build": { + "version": "4.8.4", + "resolved": "https://registry.npmjs.org/node-gyp-build/-/node-gyp-build-4.8.4.tgz", + "integrity": "sha512-LA4ZjwlnUblHVgq0oBF3Jl/6h/Nvs5fzBLwdEF4nuxnFdsfajde4WfxtJr3CaiH+F6ewcIB/q4jQ4UzPyid+CQ==", + "license": "MIT", + "bin": { + "node-gyp-build": "bin.js", + "node-gyp-build-optional": "optional.js", + "node-gyp-build-test": "build-test.js" + } + }, + "node_modules/object-inspect": { + "version": "1.13.4", + "resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.13.4.tgz", + "integrity": "sha512-W67iLl4J2EXEGTbfeHCffrjDfitvLANg0UlX3wFUUSTx92KXRFegMHUVgSqE+wvhAbi4WqjGg9czysTV2Epbew==", + "license": "MIT", + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/object-keys": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/object-keys/-/object-keys-1.1.1.tgz", + "integrity": "sha512-NuAESUOUMrlIXOfHKzD6bpPu3tYt3xvjNdRIQ+FeT0lNb4K8WR70CaDxhuNguS2XG+GjkyMwOzsN5ZktImfhLA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/object.assign": { + "version": "4.1.7", + "resolved": "https://registry.npmjs.org/object.assign/-/object.assign-4.1.7.tgz", + "integrity": "sha512-nK28WOo+QIjBkDduTINE4JkF/UJJKyf2EJxvJKfblDpyg0Q+pkOHNTL0Qwy6NP6FhE/EnzV73BxxqcJaXY9anw==", + "dev": true, + "license": "MIT", + "dependencies": { + "call-bind": "^1.0.8", + "call-bound": "^1.0.3", + "define-properties": "^1.2.1", + "es-object-atoms": "^1.0.0", + "has-symbols": "^1.1.0", + "object-keys": "^1.1.1" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/on-finished": { + "version": "2.4.1", + "resolved": "https://registry.npmjs.org/on-finished/-/on-finished-2.4.1.tgz", + "integrity": "sha512-oVlzkg3ENAhCk2zdv7IJwd/QUD4z2RxRwpkcGY8psCVcCYZNq4wYnVWALHM+brtuJjePWiYF/ClmuDr8Ch5+kg==", + "license": "MIT", + "dependencies": { + "ee-first": "1.1.1" + }, + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/once": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", + "integrity": "sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w==", + "dev": true, + "license": "ISC", + "dependencies": { + "wrappy": "1" + } + }, + "node_modules/os-browserify": { + "version": "0.3.0", + "resolved": "https://registry.npmjs.org/os-browserify/-/os-browserify-0.3.0.tgz", + "integrity": "sha512-gjcpUc3clBf9+210TRaDWbf+rZZZEshZ+DlXMRCeAjp0xhTrnQsKHypIy1J3d5hKdUzj69t708EHtU8P6bUn0A==", + "dev": true, + "license": "MIT" + }, + "node_modules/pako": { + "version": "1.0.11", + "resolved": "https://registry.npmjs.org/pako/-/pako-1.0.11.tgz", + "integrity": "sha512-4hLB8Py4zZce5s4yd9XzopqwVv/yGNhV1Bl8NTmCq1763HeK2+EwVTv+leGeL13Dnh2wfbqowVPXCIO0z4taYw==", + "license": "(MIT AND Zlib)" + }, + "node_modules/parents": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/parents/-/parents-1.0.1.tgz", + "integrity": "sha512-mXKF3xkoUt5td2DoxpLmtOmZvko9VfFpwRwkKDHSNvgmpLAeBo18YDhcPbBzJq+QLCHMbGOfzia2cX4U+0v9Mg==", + "dev": true, + "license": "MIT", + "dependencies": { + "path-platform": "~0.11.15" + } + }, + "node_modules/parse-asn1": { + "version": "5.1.9", + "resolved": "https://registry.npmjs.org/parse-asn1/-/parse-asn1-5.1.9.tgz", + "integrity": "sha512-fIYNuZ/HastSb80baGOuPRo1O9cf4baWw5WsAp7dBuUzeTD/BoaG8sVTdlPFksBE2lF21dN+A1AnrpIjSWqHHg==", + "dev": true, + "license": "ISC", + "dependencies": { + "asn1.js": "^4.10.1", + "browserify-aes": "^1.2.0", + "evp_bytestokey": "^1.0.3", + "pbkdf2": "^3.1.5", + "safe-buffer": "^5.2.1" + }, + "engines": { + "node": ">= 0.10" + } + }, + "node_modules/parseurl": { + "version": "1.3.3", + "resolved": "https://registry.npmjs.org/parseurl/-/parseurl-1.3.3.tgz", + "integrity": "sha512-CiyeOxFT/JZyN5m0z9PfXw4SCBJ6Sygz1Dpl0wqjlhDEGGBP1GnsUVEL0p63hoG1fcj3fHynXi9NYO4nWOL+qQ==", + "license": "MIT", + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/path-browserify": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/path-browserify/-/path-browserify-0.0.1.tgz", + "integrity": "sha512-BapA40NHICOS+USX9SN4tyhq+A2RrN/Ws5F0Z5aMHDp98Fl86lX8Oti8B7uN93L4Ifv4fHOEA+pQw87gmMO/lQ==", + "dev": true, + "license": "MIT" + }, + "node_modules/path-is-absolute": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", + "integrity": "sha512-AVbw3UJ2e9bq64vSaS9Am0fje1Pa8pbGqTTsmXfaIiMpnr5DlDhfJOuLj9Sf95ZPVDAUerDfEk88MPmPe7UCQg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/path-parse": { + "version": "1.0.7", + "resolved": "https://registry.npmjs.org/path-parse/-/path-parse-1.0.7.tgz", + "integrity": "sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw==", + "dev": true, + "license": "MIT" + }, + "node_modules/path-platform": { + "version": "0.11.15", + "resolved": "https://registry.npmjs.org/path-platform/-/path-platform-0.11.15.tgz", + "integrity": "sha512-Y30dB6rab1A/nfEKsZxmr01nUotHX0c/ZiIAsCTatEe1CmS5Pm5He7fZ195bPT7RdquoaL8lLxFCMQi/bS7IJg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 0.8.0" + } + }, + "node_modules/path-to-regexp": { + "version": "0.1.12", + "resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-0.1.12.tgz", + "integrity": "sha512-RA1GjUVMnvYFxuqovrEqZoxxW5NUZqbwKtYz/Tt7nXerk0LbLblQmrsgdeOxV5SFHf0UDggjS/bSeOZwt1pmEQ==", + "license": "MIT" + }, + "node_modules/pbkdf2": { + "version": "3.1.5", + "resolved": "https://registry.npmjs.org/pbkdf2/-/pbkdf2-3.1.5.tgz", + "integrity": "sha512-Q3CG/cYvCO1ye4QKkuH7EXxs3VC/rI1/trd+qX2+PolbaKG0H+bgcZzrTt96mMyRtejk+JMCiLUn3y29W8qmFQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "create-hash": "^1.2.0", + "create-hmac": "^1.1.7", + "ripemd160": "^2.0.3", + "safe-buffer": "^5.2.1", + "sha.js": "^2.4.12", + "to-buffer": "^1.2.1" + }, + "engines": { + "node": ">= 0.10" + } + }, + "node_modules/possible-typed-array-names": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/possible-typed-array-names/-/possible-typed-array-names-1.1.0.tgz", + "integrity": "sha512-/+5VFTchJDoVj3bhoqi6UeymcD00DAwb1nJwamzPvHEszJ4FpF6SNNbUbOS8yI56qHzdV8eK0qEfOSiodkTdxg==", + "license": "MIT", + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/process": { + "version": "0.11.10", + "resolved": "https://registry.npmjs.org/process/-/process-0.11.10.tgz", + "integrity": "sha512-cdGef/drWFoydD1JsMzuFf8100nZl+GT+yacc2bEced5f9Rjk4z+WtFUTBu9PhOi9j/jfmBPu0mMEY4wIdAF8A==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 0.6.0" + } + }, + "node_modules/process-nextick-args": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-2.0.1.tgz", + "integrity": "sha512-3ouUOpQhtgrbOa17J7+uxOTpITYWaGP7/AhoR3+A+/1e9skrzelGi/dXzEYyvbxubEF6Wn2ypscTKiKJFFn1ag==", + "license": "MIT" + }, + "node_modules/proxy-addr": { + "version": "2.0.7", + "resolved": "https://registry.npmjs.org/proxy-addr/-/proxy-addr-2.0.7.tgz", + "integrity": "sha512-llQsMLSUDUPT44jdrU/O37qlnifitDP+ZwrmmZcoSKyLKvtZxpyV0n2/bD/N4tBAAZ/gJEdZU7KMraoK1+XYAg==", + "license": "MIT", + "dependencies": { + "forwarded": "0.2.0", + "ipaddr.js": "1.9.1" + }, + "engines": { + "node": ">= 0.10" + } + }, + "node_modules/proxy-from-env": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/proxy-from-env/-/proxy-from-env-1.1.0.tgz", + "integrity": "sha512-D+zkORCbA9f1tdWRK0RaCR3GPv50cMxcrz4X8k5LTSUD1Dkw47mKJEZQNunItRTkWwgtaUSo1RVFRIG9ZXiFYg==", + "license": "MIT" + }, + "node_modules/public-encrypt": { + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/public-encrypt/-/public-encrypt-4.0.3.tgz", + "integrity": "sha512-zVpa8oKZSz5bTMTFClc1fQOnyyEzpl5ozpi1B5YcvBrdohMjH2rfsBtyXcuNuwjsDIXmBYlF2N5FlJYhR29t8Q==", + "dev": true, + "license": "MIT", + "dependencies": { + "bn.js": "^4.1.0", + "browserify-rsa": "^4.0.0", + "create-hash": "^1.1.0", + "parse-asn1": "^5.0.0", + "randombytes": "^2.0.1", + "safe-buffer": "^5.1.2" + } + }, + "node_modules/public-encrypt/node_modules/bn.js": { + "version": "4.12.2", + "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-4.12.2.tgz", + "integrity": "sha512-n4DSx829VRTRByMRGdjQ9iqsN0Bh4OolPsFnaZBLcbi8iXcB+kJ9s7EnRt4wILZNV3kPLHkRVfOc/HvhC3ovDw==", + "dev": true, + "license": "MIT" + }, + "node_modules/punycode": { + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/punycode/-/punycode-1.4.1.tgz", + "integrity": "sha512-jmYNElW7yvO7TV33CjSmvSiE2yco3bV2czu/OzDKdMNVZQWfxCblURLhf+47syQRBntjfLdd/H0egrzIG+oaFQ==", + "dev": true, + "license": "MIT" + }, + "node_modules/qs": { + "version": "6.13.0", + "resolved": "https://registry.npmjs.org/qs/-/qs-6.13.0.tgz", + "integrity": "sha512-+38qI9SOr8tfZ4QmJNplMUxqjbe7LKvvZgWdExBOmd+egZTtjLB67Gu0HRX3u/XOq7UU2Nx6nsjvS16Z9uwfpg==", + "license": "BSD-3-Clause", + "dependencies": { + "side-channel": "^1.0.6" + }, + "engines": { + "node": ">=0.6" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/querystring-es3": { + "version": "0.2.1", + "resolved": "https://registry.npmjs.org/querystring-es3/-/querystring-es3-0.2.1.tgz", + "integrity": "sha512-773xhDQnZBMFobEiztv8LIl70ch5MSF/jUQVlhwFyBILqq96anmoctVIYz+ZRp0qbCKATTn6ev02M3r7Ga5vqA==", + "dev": true, + "engines": { + "node": ">=0.4.x" + } + }, + "node_modules/randombytes": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/randombytes/-/randombytes-2.1.0.tgz", + "integrity": "sha512-vYl3iOX+4CKUWuxGi9Ukhie6fsqXqS9FE2Zaic4tNFD2N2QQaXOMFbuKK4QmDHC0JO6B1Zp41J0LpT0oR68amQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "safe-buffer": "^5.1.0" + } + }, + "node_modules/randomfill": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/randomfill/-/randomfill-1.0.4.tgz", + "integrity": "sha512-87lcbR8+MhcWcUiQ+9e+Rwx8MyR2P7qnt15ynUlbm3TU/fjbgz4GsvfSUDTemtCCtVCqb4ZcEFlyPNTh9bBTLw==", + "dev": true, + "license": "MIT", + "dependencies": { + "randombytes": "^2.0.5", + "safe-buffer": "^5.1.0" + } + }, + "node_modules/range-parser": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/range-parser/-/range-parser-1.2.1.tgz", + "integrity": "sha512-Hrgsx+orqoygnmhFbKaHE6c296J+HTAQXoxEF6gNupROmmGJRoyzfG3ccAveqCBrwr/2yxQ5BVd/GTl5agOwSg==", + "license": "MIT", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/raw-body": { + "version": "2.5.2", + "resolved": "https://registry.npmjs.org/raw-body/-/raw-body-2.5.2.tgz", + "integrity": "sha512-8zGqypfENjCIqGhgXToC8aB2r7YrBX+AQAfIPs/Mlk+BtPTztOvTS01NRW/3Eh60J+a48lt8qsCzirQ6loCVfA==", + "license": "MIT", + "dependencies": { + "bytes": "3.1.2", + "http-errors": "2.0.0", + "iconv-lite": "0.4.24", + "unpipe": "1.0.0" + }, + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/read-only-stream": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/read-only-stream/-/read-only-stream-2.0.0.tgz", + "integrity": "sha512-3ALe0bjBVZtkdWKIcThYpQCLbBMd/+Tbh2CDSrAIDO3UsZ4Xs+tnyjv2MjCOMMgBG+AsUOeuP1cgtY1INISc8w==", + "dev": true, + "license": "MIT", + "dependencies": { + "readable-stream": "^2.0.2" + } + }, + "node_modules/readable-stream": { + "version": "2.3.8", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.8.tgz", + "integrity": "sha512-8p0AUk4XODgIewSi0l8Epjs+EVnWiK7NoDIEGU0HhE7+ZyY8D1IMY7odu5lRrFXGg71L15KG8QrPmum45RTtdA==", + "license": "MIT", + "dependencies": { + "core-util-is": "~1.0.0", + "inherits": "~2.0.3", + "isarray": "~1.0.0", + "process-nextick-args": "~2.0.0", + "safe-buffer": "~5.1.1", + "string_decoder": "~1.1.1", + "util-deprecate": "~1.0.1" + } + }, + "node_modules/readable-stream/node_modules/safe-buffer": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", + "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==", + "license": "MIT" + }, + "node_modules/readable-stream/node_modules/string_decoder": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", + "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==", + "license": "MIT", + "dependencies": { + "safe-buffer": "~5.1.0" + } + }, + "node_modules/resolve": { + "version": "1.22.11", + "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.22.11.tgz", + "integrity": "sha512-RfqAvLnMl313r7c9oclB1HhUEAezcpLjz95wFH4LVuhk9JF/r22qmVP9AMmOU4vMX7Q8pN8jwNg/CSpdFnMjTQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "is-core-module": "^2.16.1", + "path-parse": "^1.0.7", + "supports-preserve-symlinks-flag": "^1.0.0" + }, + "bin": { + "resolve": "bin/resolve" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/ripemd160": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/ripemd160/-/ripemd160-2.0.3.tgz", + "integrity": "sha512-5Di9UC0+8h1L6ZD2d7awM7E/T4uA1fJRlx6zk/NvdCCVEoAnFqvHmCuNeIKoCeIixBX/q8uM+6ycDvF8woqosA==", + "license": "MIT", + "dependencies": { + "hash-base": "^3.1.2", + "inherits": "^2.0.4" + }, + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/ripemd160/node_modules/hash-base": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/hash-base/-/hash-base-3.1.2.tgz", + "integrity": "sha512-Bb33KbowVTIj5s7Ked1OsqHUeCpz//tPwR+E2zJgJKo9Z5XolZ9b6bdUgjmYlwnWhoOQKoTd1TYToZGn5mAYOg==", + "license": "MIT", + "dependencies": { + "inherits": "^2.0.4", + "readable-stream": "^2.3.8", + "safe-buffer": "^5.2.1", + "to-buffer": "^1.2.1" + }, + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/safe-buffer": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz", + "integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ], + "license": "MIT" + }, + "node_modules/safer-buffer": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz", + "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==", + "license": "MIT" + }, + "node_modules/send": { + "version": "0.19.0", + "resolved": "https://registry.npmjs.org/send/-/send-0.19.0.tgz", + "integrity": "sha512-dW41u5VfLXu8SJh5bwRmyYUbAoSB3c9uQh6L8h/KtsFREPWpbX1lrljJo186Jc4nmci/sGUZ9a0a0J2zgfq2hw==", + "license": "MIT", + "dependencies": { + "debug": "2.6.9", + "depd": "2.0.0", + "destroy": "1.2.0", + "encodeurl": "~1.0.2", + "escape-html": "~1.0.3", + "etag": "~1.8.1", + "fresh": "0.5.2", + "http-errors": "2.0.0", + "mime": "1.6.0", + "ms": "2.1.3", + "on-finished": "2.4.1", + "range-parser": "~1.2.1", + "statuses": "2.0.1" + }, + "engines": { + "node": ">= 0.8.0" + } + }, + "node_modules/send/node_modules/encodeurl": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/encodeurl/-/encodeurl-1.0.2.tgz", + "integrity": "sha512-TPJXq8JqFaVYm2CWmPvnP2Iyo4ZSM7/QKcSmuMLDObfpH5fi7RUGmd/rTDf+rut/saiDiQEeVTNgAmJEdAOx0w==", + "license": "MIT", + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/send/node_modules/ms": { + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", + "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==", + "license": "MIT" + }, + "node_modules/serve-static": { + "version": "1.16.2", + "resolved": "https://registry.npmjs.org/serve-static/-/serve-static-1.16.2.tgz", + "integrity": "sha512-VqpjJZKadQB/PEbEwvFdO43Ax5dFBZ2UECszz8bQ7pi7wt//PWe1P6MN7eCnjsatYtBT6EuiClbjSWP2WrIoTw==", + "license": "MIT", + "dependencies": { + "encodeurl": "~2.0.0", + "escape-html": "~1.0.3", + "parseurl": "~1.3.3", + "send": "0.19.0" + }, + "engines": { + "node": ">= 0.8.0" + } + }, + "node_modules/set-function-length": { + "version": "1.2.2", + "resolved": "https://registry.npmjs.org/set-function-length/-/set-function-length-1.2.2.tgz", + "integrity": "sha512-pgRc4hJ4/sNjWCSS9AmnS40x3bNMDTknHgL5UaMBTMyJnU90EgWh1Rz+MC9eFu4BuN/UwZjKQuY/1v3rM7HMfg==", + "license": "MIT", + "dependencies": { + "define-data-property": "^1.1.4", + "es-errors": "^1.3.0", + "function-bind": "^1.1.2", + "get-intrinsic": "^1.2.4", + "gopd": "^1.0.1", + "has-property-descriptors": "^1.0.2" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/setprototypeof": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/setprototypeof/-/setprototypeof-1.2.0.tgz", + "integrity": "sha512-E5LDX7Wrp85Kil5bhZv46j8jOeboKq5JMmYM3gVGdGH8xFpPWXUMsNrlODCrkoxMEeNi/XZIwuRvY4XNwYMJpw==", + "license": "ISC" + }, + "node_modules/sha.js": { + "version": "2.4.12", + "resolved": "https://registry.npmjs.org/sha.js/-/sha.js-2.4.12.tgz", + "integrity": "sha512-8LzC5+bvI45BjpfXU8V5fdU2mfeKiQe1D1gIMn7XUlF3OTUrpdJpPPH4EMAnF0DsHHdSZqCdSss5qCmJKuiO3w==", + "license": "(MIT AND BSD-3-Clause)", + "dependencies": { + "inherits": "^2.0.4", + "safe-buffer": "^5.2.1", + "to-buffer": "^1.2.0" + }, + "bin": { + "sha.js": "bin.js" + }, + "engines": { + "node": ">= 0.10" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/shasum": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/shasum/-/shasum-1.0.2.tgz", + "integrity": "sha512-UTzHm/+AzKfO9RgPgRpDIuMSNie1ubXRaljjlhFMNGYoG7z+rm9AHLPMf70R7887xboDH9Q+5YQbWKObFHEAtw==", + "dev": true, + "license": "MIT", + "dependencies": { + "json-stable-stringify": "~0.0.0", + "sha.js": "~2.4.4" + } + }, + "node_modules/shasum-object": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/shasum-object/-/shasum-object-1.0.1.tgz", + "integrity": "sha512-SsC+1tW7XKQ/94D4k1JhLmjDFpVGET/Nf54jVDtbavbALf8Zhp0Td9zTlxScjMW6nbEIrpADtPWfLk9iCXzHDQ==", + "dev": true, + "license": "Apache-2.0", + "dependencies": { + "fast-safe-stringify": "^2.0.7" + }, + "bin": { + "shasum-object": "bin.js" + } + }, + "node_modules/shell-quote": { + "version": "1.8.3", + "resolved": "https://registry.npmjs.org/shell-quote/-/shell-quote-1.8.3.tgz", + "integrity": "sha512-ObmnIF4hXNg1BqhnHmgbDETF8dLPCggZWBjkQfhZpbszZnYur5DUljTcCHii5LC3J5E0yeO/1LIMyH+UvHQgyw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/side-channel": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/side-channel/-/side-channel-1.1.0.tgz", + "integrity": "sha512-ZX99e6tRweoUXqR+VBrslhda51Nh5MTQwou5tnUDgbtyM0dBgmhEDtWGP/xbKn6hqfPRHujUNwz5fy/wbbhnpw==", + "license": "MIT", + "dependencies": { + "es-errors": "^1.3.0", + "object-inspect": "^1.13.3", + "side-channel-list": "^1.0.0", + "side-channel-map": "^1.0.1", + "side-channel-weakmap": "^1.0.2" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/side-channel-list": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/side-channel-list/-/side-channel-list-1.0.0.tgz", + "integrity": "sha512-FCLHtRD/gnpCiCHEiJLOwdmFP+wzCmDEkc9y7NsYxeF4u7Btsn1ZuwgwJGxImImHicJArLP4R0yX4c2KCrMrTA==", + "license": "MIT", + "dependencies": { + "es-errors": "^1.3.0", + "object-inspect": "^1.13.3" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/side-channel-map": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/side-channel-map/-/side-channel-map-1.0.1.tgz", + "integrity": "sha512-VCjCNfgMsby3tTdo02nbjtM/ewra6jPHmpThenkTYh8pG9ucZ/1P8So4u4FGBek/BjpOVsDCMoLA/iuBKIFXRA==", + "license": "MIT", + "dependencies": { + "call-bound": "^1.0.2", + "es-errors": "^1.3.0", + "get-intrinsic": "^1.2.5", + "object-inspect": "^1.13.3" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/side-channel-weakmap": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/side-channel-weakmap/-/side-channel-weakmap-1.0.2.tgz", + "integrity": "sha512-WPS/HvHQTYnHisLo9McqBHOJk2FkHO/tlpvldyrnem4aeQp4hai3gythswg6p01oSoTl58rcpiFAjF2br2Ak2A==", + "license": "MIT", + "dependencies": { + "call-bound": "^1.0.2", + "es-errors": "^1.3.0", + "get-intrinsic": "^1.2.5", + "object-inspect": "^1.13.3", + "side-channel-map": "^1.0.1" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/simple-concat": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/simple-concat/-/simple-concat-1.0.1.tgz", + "integrity": "sha512-cSFtAPtRhljv69IK0hTVZQ+OfE9nePi/rtJmw5UjHeVyVroEqJXP1sFztKUy1qU+xvz3u/sfYJLa947b7nAN2Q==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ], + "license": "MIT" + }, + "node_modules/source-map": { + "version": "0.5.7", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.5.7.tgz", + "integrity": "sha512-LbrmJOMUSdEVxIKvdcJzQC+nQhe8FUZQTXQy6+I75skNgn3OoQ0DZA8YnFa7gp8tqtL3KPf1kmo0R5DoApeSGQ==", + "dev": true, + "license": "BSD-3-Clause", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/statuses": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/statuses/-/statuses-2.0.1.tgz", + "integrity": "sha512-RwNA9Z/7PrK06rYLIzFMlaF+l73iwpzsqRIFgbMLbTcLD6cOao82TaWefPXQvB2fOC4AjuYSEndS7N/mTCbkdQ==", + "license": "MIT", + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/stream-browserify": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/stream-browserify/-/stream-browserify-2.0.2.tgz", + "integrity": "sha512-nX6hmklHs/gr2FuxYDltq8fJA1GDlxKQCz8O/IM4atRqBH8OORmBNgfvW5gG10GT/qQ9u0CzIvr2X5Pkt6ntqg==", + "dev": true, + "license": "MIT", + "dependencies": { + "inherits": "~2.0.1", + "readable-stream": "^2.0.2" + } + }, + "node_modules/stream-combiner2": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/stream-combiner2/-/stream-combiner2-1.1.1.tgz", + "integrity": "sha512-3PnJbYgS56AeWgtKF5jtJRT6uFJe56Z0Hc5Ngg/6sI6rIt8iiMBTa9cvdyFfpMQjaVHr8dusbNeFGIIonxOvKw==", + "dev": true, + "license": "MIT", + "dependencies": { + "duplexer2": "~0.1.0", + "readable-stream": "^2.0.2" + } + }, + "node_modules/stream-http": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/stream-http/-/stream-http-3.2.0.tgz", + "integrity": "sha512-Oq1bLqisTyK3TSCXpPbT4sdeYNdmyZJv1LxpEm2vu1ZhK89kSE5YXwZc3cWk0MagGaKriBh9mCFbVGtO+vY29A==", + "dev": true, + "license": "MIT", + "dependencies": { + "builtin-status-codes": "^3.0.0", + "inherits": "^2.0.4", + "readable-stream": "^3.6.0", + "xtend": "^4.0.2" + } + }, + "node_modules/stream-http/node_modules/readable-stream": { + "version": "3.6.2", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.2.tgz", + "integrity": "sha512-9u/sniCrY3D5WdsERHzHE4G2YCXqoG5FTHUiCC4SIbr6XcLZBY05ya9EKjYek9O5xOAwjGq+1JdGBAS7Q9ScoA==", + "dev": true, + "license": "MIT", + "dependencies": { + "inherits": "^2.0.3", + "string_decoder": "^1.1.1", + "util-deprecate": "^1.0.1" + }, + "engines": { + "node": ">= 6" + } + }, + "node_modules/stream-parser": { + "version": "0.3.1", + "resolved": "https://registry.npmjs.org/stream-parser/-/stream-parser-0.3.1.tgz", + "integrity": "sha512-bJ/HgKq41nlKvlhccD5kaCr/P+Hu0wPNKPJOH7en+YrJu/9EgqUF+88w5Jb6KNcjOFMhfX4B2asfeAtIGuHObQ==", + "license": "MIT", + "dependencies": { + "debug": "2" + } + }, + "node_modules/stream-splicer": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/stream-splicer/-/stream-splicer-2.0.1.tgz", + "integrity": "sha512-Xizh4/NPuYSyAXyT7g8IvdJ9HJpxIGL9PjyhtywCZvvP0OPIdqyrr4dMikeuvY8xahpdKEBlBTySe583totajg==", + "dev": true, + "license": "MIT", + "dependencies": { + "inherits": "^2.0.1", + "readable-stream": "^2.0.2" + } + }, + "node_modules/string_decoder": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.3.0.tgz", + "integrity": "sha512-hkRX8U1WjJFd8LsDJ2yQ/wWWxaopEsABU1XfkM8A+j0+85JAGppt16cr1Whg6KIbb4okU6Mql6BOj+uup/wKeA==", + "dev": true, + "license": "MIT", + "dependencies": { + "safe-buffer": "~5.2.0" + } + }, + "node_modules/subarg": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/subarg/-/subarg-1.0.0.tgz", + "integrity": "sha512-RIrIdRY0X1xojthNcVtgT9sjpOGagEUKpZdgBUi054OEPFo282yg+zE+t1Rj3+RqKq2xStL7uUHhY+AjbC4BXg==", + "dev": true, + "license": "MIT", + "dependencies": { + "minimist": "^1.1.0" + } + }, + "node_modules/supports-preserve-symlinks-flag": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/supports-preserve-symlinks-flag/-/supports-preserve-symlinks-flag-1.0.0.tgz", + "integrity": "sha512-ot0WnXS9fgdkgIcePe6RHNk1WA8+muPa6cSjeR3V8K27q9BB1rTE3R1p7Hv0z1ZyAc8s6Vvv8DIyWf681MAt0w==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/syntax-error": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/syntax-error/-/syntax-error-1.4.0.tgz", + "integrity": "sha512-YPPlu67mdnHGTup2A8ff7BC2Pjq0e0Yp/IyTFN03zWO0RcK07uLcbi7C2KpGR2FvWbaB0+bfE27a+sBKebSo7w==", + "dev": true, + "license": "MIT", + "dependencies": { + "acorn-node": "^1.2.0" + } + }, + "node_modules/through": { + "version": "2.3.8", + "resolved": "https://registry.npmjs.org/through/-/through-2.3.8.tgz", + "integrity": "sha512-w89qg7PI8wAdvX60bMDP+bFoD5Dvhm9oLheFp5O4a2QF0cSBGsBX4qZmadPMvVqlLJBBci+WqGGOAPvcDeNSVg==", + "dev": true, + "license": "MIT" + }, + "node_modules/through2": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/through2/-/through2-2.0.5.tgz", + "integrity": "sha512-/mrRod8xqpA+IHSLyGCQ2s8SPHiCDEeQJSep1jqLYeEUClOFG2Qsh+4FU6G9VeqpZnGW/Su8LQGc4YKni5rYSQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "readable-stream": "~2.3.6", + "xtend": "~4.0.1" + } + }, + "node_modules/timers-browserify": { + "version": "1.4.2", + "resolved": "https://registry.npmjs.org/timers-browserify/-/timers-browserify-1.4.2.tgz", + "integrity": "sha512-PIxwAupJZiYU4JmVZYwXp9FKsHMXb5h0ZEFyuXTAn8WLHOlcij+FEcbrvDsom1o5dr1YggEtFbECvGCW2sT53Q==", + "dev": true, + "dependencies": { + "process": "~0.11.0" + }, + "engines": { + "node": ">=0.6.0" + } + }, + "node_modules/to-buffer": { + "version": "1.2.2", + "resolved": "https://registry.npmjs.org/to-buffer/-/to-buffer-1.2.2.tgz", + "integrity": "sha512-db0E3UJjcFhpDhAF4tLo03oli3pwl3dbnzXOUIlRKrp+ldk/VUxzpWYZENsw2SZiuBjHAk7DfB0VU7NKdpb6sw==", + "license": "MIT", + "dependencies": { + "isarray": "^2.0.5", + "safe-buffer": "^5.2.1", + "typed-array-buffer": "^1.0.3" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/to-buffer/node_modules/isarray": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/isarray/-/isarray-2.0.5.tgz", + "integrity": "sha512-xHjhDr3cNBK0BzdUJSPXZntQUx/mwMS5Rw4A7lPJ90XGAO6ISP/ePDNuo0vhqOZU+UD5JoodwCAAoZQd3FeAKw==", + "license": "MIT" + }, + "node_modules/toidentifier": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/toidentifier/-/toidentifier-1.0.1.tgz", + "integrity": "sha512-o5sSPKEkg/DIQNmH43V0/uerLrpzVedkUh8tGNvaeXpfpuwjKenlSox/2O/BTlZUtEe+JG7s5YhEz608PlAHRA==", + "license": "MIT", + "engines": { + "node": ">=0.6" + } + }, + "node_modules/tr46": { + "version": "0.0.3", + "resolved": "https://registry.npmjs.org/tr46/-/tr46-0.0.3.tgz", + "integrity": "sha512-N3WMsuqV66lT30CrXNbEjx4GEwlow3v6rr4mCcv6prnfwhS01rkgyFdjPNBYd9br7LpXV1+Emh01fHnq2Gdgrw==", + "license": "MIT" + }, + "node_modules/tty-browserify": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/tty-browserify/-/tty-browserify-0.0.1.tgz", + "integrity": "sha512-C3TaO7K81YvjCgQH9Q1S3R3P3BtN3RIM8n+OvX4il1K1zgE8ZhI0op7kClgkxtutIE8hQrcrHBXvIheqKUUCxw==", + "dev": true, + "license": "MIT" + }, + "node_modules/type-is": { + "version": "1.6.18", + "resolved": "https://registry.npmjs.org/type-is/-/type-is-1.6.18.tgz", + "integrity": "sha512-TkRKr9sUTxEH8MdfuCSP7VizJyzRNMjj2J2do2Jr3Kym598JVdEksuzPQCnlFPW4ky9Q+iA+ma9BGm06XQBy8g==", + "license": "MIT", + "dependencies": { + "media-typer": "0.3.0", + "mime-types": "~2.1.24" + }, + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/typed-array-buffer": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/typed-array-buffer/-/typed-array-buffer-1.0.3.tgz", + "integrity": "sha512-nAYYwfY3qnzX30IkA6AQZjVbtK6duGontcQm1WSG1MD94YLqK0515GNApXkoxKOWMusVssAHWLh9SeaoefYFGw==", + "license": "MIT", + "dependencies": { + "call-bound": "^1.0.3", + "es-errors": "^1.3.0", + "is-typed-array": "^1.1.14" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/typedarray": { + "version": "0.0.6", + "resolved": "https://registry.npmjs.org/typedarray/-/typedarray-0.0.6.tgz", + "integrity": "sha512-/aCDEGatGvZ2BIk+HmLf4ifCJFwvKFNb9/JeZPMulfgFracn9QFcAf5GO8B/mweUjSoblS5In0cWhqpfs/5PQA==", + "dev": true, + "license": "MIT" + }, + "node_modules/umd": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/umd/-/umd-3.0.3.tgz", + "integrity": "sha512-4IcGSufhFshvLNcMCV80UnQVlZ5pMOC8mvNPForqwA4+lzYQuetTESLDQkeLmihq8bRcnpbQa48Wb8Lh16/xow==", + "dev": true, + "license": "MIT", + "bin": { + "umd": "bin/cli.js" + } + }, + "node_modules/undeclared-identifiers": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/undeclared-identifiers/-/undeclared-identifiers-1.1.3.tgz", + "integrity": "sha512-pJOW4nxjlmfwKApE4zvxLScM/njmwj/DiUBv7EabwE4O8kRUy+HIwxQtZLBPll/jx1LJyBcqNfB3/cpv9EZwOw==", + "dev": true, + "license": "Apache-2.0", + "dependencies": { + "acorn-node": "^1.3.0", + "dash-ast": "^1.0.0", + "get-assigned-identifiers": "^1.2.0", + "simple-concat": "^1.0.0", + "xtend": "^4.0.1" + }, + "bin": { + "undeclared-identifiers": "bin.js" + } + }, + "node_modules/unpipe": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/unpipe/-/unpipe-1.0.0.tgz", + "integrity": "sha512-pjy2bYhSsufwWlKwPc+l3cN7+wuJlK6uz0YdJEOlQDbl6jo/YlPi4mb8agUkVC8BF7V8NuzeyPNqRksA3hztKQ==", + "license": "MIT", + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/url": { + "version": "0.11.4", + "resolved": "https://registry.npmjs.org/url/-/url-0.11.4.tgz", + "integrity": "sha512-oCwdVC7mTuWiPyjLUz/COz5TLk6wgp0RCsN+wHZ2Ekneac9w8uuV0njcbbie2ME+Vs+d6duwmYuR3HgQXs1fOg==", + "dev": true, + "license": "MIT", + "dependencies": { + "punycode": "^1.4.1", + "qs": "^6.12.3" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/utf-8-validate": { + "version": "5.0.10", + "resolved": "https://registry.npmjs.org/utf-8-validate/-/utf-8-validate-5.0.10.tgz", + "integrity": "sha512-Z6czzLq4u8fPOyx7TU6X3dvUZVvoJmxSQ+IcrlmagKhilxlhZgxPK6C5Jqbkw1IDUmFTM+cz9QDnnLTwDz/2gQ==", + "hasInstallScript": true, + "license": "MIT", + "dependencies": { + "node-gyp-build": "^4.3.0" + }, + "engines": { + "node": ">=6.14.2" + } + }, + "node_modules/util": { + "version": "0.10.4", + "resolved": "https://registry.npmjs.org/util/-/util-0.10.4.tgz", + "integrity": "sha512-0Pm9hTQ3se5ll1XihRic3FDIku70C+iHUdT/W926rSgHV5QgXsYbKZN8MSC3tJtSkhuROzvsQjAaFENRXr+19A==", + "dev": true, + "license": "MIT", + "dependencies": { + "inherits": "2.0.3" + } + }, + "node_modules/util-deprecate": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", + "integrity": "sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw==", + "license": "MIT" + }, + "node_modules/util/node_modules/inherits": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz", + "integrity": "sha512-x00IRNXNy63jwGkJmzPigoySHbaqpNuzKbBOmzK+g2OdZpQ9w+sxCN+VSB3ja7IAge2OP2qpfxTjeNcyjmW1uw==", + "dev": true, + "license": "ISC" + }, + "node_modules/utils-merge": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/utils-merge/-/utils-merge-1.0.1.tgz", + "integrity": "sha512-pMZTvIkT1d+TFGvDOqodOclx0QWkkgi6Tdoa8gC8ffGAAqz9pzPTZWAybbsHHoED/ztMtkv/VoYTYyShUn81hA==", + "license": "MIT", + "engines": { + "node": ">= 0.4.0" + } + }, + "node_modules/uuid": { + "version": "9.0.1", + "resolved": "https://registry.npmjs.org/uuid/-/uuid-9.0.1.tgz", + "integrity": "sha512-b+1eJOlsR9K8HJpow9Ok3fiWOWSIcIzXodvv0rQjVoOVNpWMpxf1wZNpt4y9h10odCNrqnYp1OBzRktckBe3sA==", + "funding": [ + "https://github.com/sponsors/broofa", + "https://github.com/sponsors/ctavan" + ], + "license": "MIT", + "bin": { + "uuid": "dist/bin/uuid" + } + }, + "node_modules/vary": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/vary/-/vary-1.1.2.tgz", + "integrity": "sha512-BNGbWLfd0eUPabhkXUVm0j8uuvREyTh5ovRa/dyow/BqAbZJyC+5fU+IzQOzmAKzYqYRAISoRhdQr3eIZ/PXqg==", + "license": "MIT", + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/vm-browserify": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/vm-browserify/-/vm-browserify-1.1.2.tgz", + "integrity": "sha512-2ham8XPWTONajOR0ohOKOHXkm3+gaBmGut3SRuu75xLd/RRaY6vqgh8NBYYk7+RW3u5AtzPQZG8F10LHkl0lAQ==", + "dev": true, + "license": "MIT" + }, + "node_modules/wav": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/wav/-/wav-1.0.2.tgz", + "integrity": "sha512-viHtz3cDd/Tcr/HbNqzQCofKdF6kWUymH9LGDdskfWFoIy/HJ+RTihgjEcHfnsy1PO4e9B+y4HwgTwMrByquhg==", + "license": "MIT", + "dependencies": { + "buffer-alloc": "^1.1.0", + "buffer-from": "^1.0.0", + "debug": "^2.2.0", + "readable-stream": "^1.1.14", + "stream-parser": "^0.3.1" + } + }, + "node_modules/wav/node_modules/isarray": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/isarray/-/isarray-0.0.1.tgz", + "integrity": "sha512-D2S+3GLxWH+uhrNEcoh/fnmYeP8E8/zHl644d/jdA0g2uyXvy3sb0qxotE+ne0LtccHknQzWwZEzhak7oJ0COQ==", + "license": "MIT" + }, + "node_modules/wav/node_modules/readable-stream": { + "version": "1.1.14", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-1.1.14.tgz", + "integrity": "sha512-+MeVjFf4L44XUkhM1eYbD8fyEsxcV81pqMSR5gblfcLCHfZvbrqy4/qYHE+/R5HoBUT11WV5O08Cr1n3YXkWVQ==", + "license": "MIT", + "dependencies": { + "core-util-is": "~1.0.0", + "inherits": "~2.0.1", + "isarray": "0.0.1", + "string_decoder": "~0.10.x" + } + }, + "node_modules/wav/node_modules/string_decoder": { + "version": "0.10.31", + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-0.10.31.tgz", + "integrity": "sha512-ev2QzSzWPYmy9GuqfIVildA4OdcGLeFZQrq5ys6RtiuF+RQQiZWr8TZNyAcuVXyQRYfEO+MsoB/1BuQVhOJuoQ==", + "license": "MIT" + }, + "node_modules/webidl-conversions": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-3.0.1.tgz", + "integrity": "sha512-2JAn3z8AR6rjK8Sm8orRC0h/bcl/DqL7tRPdGZ4I1CjdF+EaMLmYxBHyXuKL849eucPFhvBoxMsflfOb8kxaeQ==", + "license": "BSD-2-Clause" + }, + "node_modules/whatwg-url": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-5.0.0.tgz", + "integrity": "sha512-saE57nupxk6v3HY35+jzBwYa0rKSy0XR8JSxZPwgLr7ys0IBzhGviA1/TUGJLmSVqs8pb9AnvICXEuOHLprYTw==", + "license": "MIT", + "dependencies": { + "tr46": "~0.0.3", + "webidl-conversions": "^3.0.0" + } + }, + "node_modules/which-typed-array": { + "version": "1.1.19", + "resolved": "https://registry.npmjs.org/which-typed-array/-/which-typed-array-1.1.19.tgz", + "integrity": "sha512-rEvr90Bck4WZt9HHFC4DJMsjvu7x+r6bImz0/BrbWb7A2djJ8hnZMrWnHo9F8ssv0OMErasDhftrfROTyqSDrw==", + "license": "MIT", + "dependencies": { + "available-typed-arrays": "^1.0.7", + "call-bind": "^1.0.8", + "call-bound": "^1.0.4", + "for-each": "^0.3.5", + "get-proto": "^1.0.1", + "gopd": "^1.2.0", + "has-tostringtag": "^1.0.2" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/wrappy": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", + "integrity": "sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==", + "dev": true, + "license": "ISC" + }, + "node_modules/ws": { + "version": "8.18.3", + "resolved": "https://registry.npmjs.org/ws/-/ws-8.18.3.tgz", + "integrity": "sha512-PEIGCY5tSlUt50cqyMXfCzX+oOPqN0vuGqWzbcJ2xvnkzkq46oOpz7dQaTDBdfICb4N14+GARUDw2XV2N4tvzg==", + "license": "MIT", + "engines": { + "node": ">=10.0.0" + }, + "peerDependencies": { + "bufferutil": "^4.0.1", + "utf-8-validate": ">=5.0.2" + }, + "peerDependenciesMeta": { + "bufferutil": { + "optional": true }, "utf-8-validate": { - "version": "5.0.2", - "resolved": "https://registry.npmjs.org/utf-8-validate/-/utf-8-validate-5.0.2.tgz", - "integrity": "sha512-SwV++i2gTD5qh2XqaPzBnNX88N6HdyhQrNNRykvcS0QKvItV9u3vPEJr+X5Hhfb1JC0r0e1alL0iB09rY8+nmw==", - "requires": { - "node-gyp-build": "~3.7.0" - } - }, - "util": { - "version": "0.10.4", - "resolved": "https://registry.npmjs.org/util/-/util-0.10.4.tgz", - "integrity": "sha512-0Pm9hTQ3se5ll1XihRic3FDIku70C+iHUdT/W926rSgHV5QgXsYbKZN8MSC3tJtSkhuROzvsQjAaFENRXr+19A==", - "dev": true, - "requires": { - "inherits": "2.0.3" - } - }, - "util-deprecate": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", - "integrity": "sha1-RQ1Nyfpw3nMnYvvS1KKJgUGaDM8=", - "dev": true - }, - "utils-merge": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/utils-merge/-/utils-merge-1.0.1.tgz", - "integrity": "sha1-n5VxD1CiZ5R7LMwSR0HBAoQn5xM=" - }, - "uuid": { - "version": "3.4.0", - "resolved": "https://registry.npmjs.org/uuid/-/uuid-3.4.0.tgz", - "integrity": "sha512-HjSDRw6gZE5JMggctHBcjVak08+KEVhSIiDzFnT9S9aegmp85S/bReBVTb4QTFaRNptJ9kuYaNhnbNEOkbKb/A==" - }, - "vary": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/vary/-/vary-1.1.2.tgz", - "integrity": "sha1-IpnwLG3tMNSllhsLn3RSShj2NPw=" - }, - "vm-browserify": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/vm-browserify/-/vm-browserify-1.1.0.tgz", - "integrity": "sha512-iq+S7vZJE60yejDYM0ek6zg308+UZsdtPExWP9VZoCFCz1zkJoXFnAX7aZfd/ZwrkidzdUZL0C/ryW+JwAiIGw==", - "dev": true - }, - "wav": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/wav/-/wav-1.0.2.tgz", - "integrity": "sha512-viHtz3cDd/Tcr/HbNqzQCofKdF6kWUymH9LGDdskfWFoIy/HJ+RTihgjEcHfnsy1PO4e9B+y4HwgTwMrByquhg==", - "requires": { - "buffer-alloc": "^1.1.0", - "buffer-from": "^1.0.0", - "debug": "^2.2.0", - "readable-stream": "^1.1.14", - "stream-parser": "^0.3.1" - } - }, - "webidl-conversions": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-3.0.1.tgz", - "integrity": "sha512-2JAn3z8AR6rjK8Sm8orRC0h/bcl/DqL7tRPdGZ4I1CjdF+EaMLmYxBHyXuKL849eucPFhvBoxMsflfOb8kxaeQ==" - }, - "whatwg-url": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-5.0.0.tgz", - "integrity": "sha512-saE57nupxk6v3HY35+jzBwYa0rKSy0XR8JSxZPwgLr7ys0IBzhGviA1/TUGJLmSVqs8pb9AnvICXEuOHLprYTw==", - "requires": { - "tr46": "~0.0.3", - "webidl-conversions": "^3.0.0" - } - }, - "wrappy": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", - "integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=", - "dev": true - }, - "ws": { - "version": "7.5.9", - "resolved": "https://registry.npmjs.org/ws/-/ws-7.5.9.tgz", - "integrity": "sha512-F+P9Jil7UiSKSkppIiD94dN07AwvFixvLIj1Og1Rl9GGMuNipJnV9JzjD6XuqmAeiswGvUmNLjr5cFuXwNS77Q==" - }, - "xtend": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/xtend/-/xtend-4.0.1.tgz", - "integrity": "sha1-pcbVMr5lbiPbgg77lDofBJmNY68=", - "dev": true + "optional": true } + } + }, + "node_modules/xtend": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/xtend/-/xtend-4.0.2.tgz", + "integrity": "sha512-LKYU1iAXJXUgAXn9URjiu+MWhyUXHsvfp7mcuYm9dSUKK0/CjtrUwFAxD82/mCWbtLsGjFIad0wIsod4zrTAEQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.4" + } } + } } diff --git a/package.json b/package.json index 517bcc4..7c605b3 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,5 @@ { "scripts": { - "prestart": "browserify ./node_modules/houndify/index.js --standalone Houndify > public/js/houndify.js", "start": "node server.js" }, "license": "MIT", @@ -8,7 +7,7 @@ "body-parser": "^1.18.3", "bufferutil": "^4.0.1", "express": "^4.16.3", - "houndify": "^3.1.13", + "houndify": "4.0.0-beta.3", "minimist": "^1.2.5", "utf-8-validate": "^5.0.2", "wav": "^1.0.0" diff --git a/public/js/houndify.js b/public/js/houndify.js deleted file mode 100644 index f85658b..0000000 --- a/public/js/houndify.js +++ /dev/null @@ -1,60246 +0,0 @@ -(function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.Houndify = f()}})(function(){var define,module,exports;return (function(){function r(e,n,t){function o(i,f){if(!n[i]){if(!e[i]){var c="function"==typeof require&&require;if(!f&&c)return c(i,!0);if(u)return u(i,!0);var a=new Error("Cannot find module '"+i+"'");throw a.code="MODULE_NOT_FOUND",a}var p=n[i]={exports:{}};e[i][0].call(p.exports,function(r){var n=e[i][1][r];return o(n||r)},p,p.exports,r,e,n,t)}return n[i].exports}for(var u="function"==typeof require&&require,i=0;i= 3) { - // Legacy callback function - convert to a Promise - this.callback = promisify(this.callback, this); - this._promisifiedCallback = true; - } - - if (timeoutMs > 0) { - timeout = setTimeout(ontimeout, timeoutMs); - } - - try { - Promise.resolve(this.callback(req, opts)).then(onsocket, callbackError); - } catch (err) { - Promise.reject(err).catch(callbackError); - } -}; - -Agent.prototype.freeSocket = function freeSocket(socket, opts) { - // TODO reuse sockets - socket.destroy(); -}; - -},{"./patch-core":2,"es6-promisify":129,"events":130,"util":264}],2:[function(require,module,exports){ -'use strict'; -const url = require('url'); -const https = require('https'); - -/** - * This currently needs to be applied to all Node.js versions - * in order to determine if the `req` is an HTTP or HTTPS request. - * - * There is currently no PR attempting to move this property upstream. - */ -const patchMarker = "__agent_base_https_request_patched__"; -if (!https.request[patchMarker]) { - https.request = (function(request) { - return function(_options, cb) { - let options; - if (typeof _options === 'string') { - options = url.parse(_options); - } else { - options = Object.assign({}, _options); - } - if (null == options.port) { - options.port = 443; - } - options.secureEndpoint = true; - return request.call(https, options, cb); - }; - })(https.request); - https.request[patchMarker] = true; -} - -/** - * This is needed for Node.js >= 9.0.0 to make sure `https.get()` uses the - * patched `https.request()`. - * - * Ref: https://github.com/nodejs/node/commit/5118f31 - */ -https.get = function (_url, _options, cb) { - let options; - if (typeof _url === 'string' && _options && typeof _options !== 'function') { - options = Object.assign({}, url.parse(_url), _options); - } else if (!_options && !cb) { - options = _url; - } else if (!cb) { - options = _url; - cb = _options; - } - - const req = https.request(options, cb); - req.end(); - return req; -}; - -},{"https":150,"url":260}],3:[function(require,module,exports){ -var asn1 = exports; - -asn1.bignum = require('bn.js'); - -asn1.define = require('./asn1/api').define; -asn1.base = require('./asn1/base'); -asn1.constants = require('./asn1/constants'); -asn1.decoders = require('./asn1/decoders'); -asn1.encoders = require('./asn1/encoders'); - -},{"./asn1/api":4,"./asn1/base":6,"./asn1/constants":10,"./asn1/decoders":12,"./asn1/encoders":15,"bn.js":52}],4:[function(require,module,exports){ -var asn1 = require('../asn1'); -var inherits = require('inherits'); - -var api = exports; - -api.define = function define(name, body) { - return new Entity(name, body); -}; - -function Entity(name, body) { - this.name = name; - this.body = body; - - this.decoders = {}; - this.encoders = {}; -}; - -Entity.prototype._createNamed = function createNamed(base) { - var named; - try { - named = require('vm').runInThisContext( - '(function ' + this.name + '(entity) {\n' + - ' this._initNamed(entity);\n' + - '})' - ); - } catch (e) { - named = function (entity) { - this._initNamed(entity); - }; - } - inherits(named, base); - named.prototype._initNamed = function initnamed(entity) { - base.call(this, entity); - }; - - return new named(this); -}; - -Entity.prototype._getDecoder = function _getDecoder(enc) { - enc = enc || 'der'; - // Lazily create decoder - if (!this.decoders.hasOwnProperty(enc)) - this.decoders[enc] = this._createNamed(asn1.decoders[enc]); - return this.decoders[enc]; -}; - -Entity.prototype.decode = function decode(data, enc, options) { - return this._getDecoder(enc).decode(data, options); -}; - -Entity.prototype._getEncoder = function _getEncoder(enc) { - enc = enc || 'der'; - // Lazily create encoder - if (!this.encoders.hasOwnProperty(enc)) - this.encoders[enc] = this._createNamed(asn1.encoders[enc]); - return this.encoders[enc]; -}; - -Entity.prototype.encode = function encode(data, enc, /* internal */ reporter) { - return this._getEncoder(enc).encode(data, reporter); -}; - -},{"../asn1":3,"inherits":156,"vm":270}],5:[function(require,module,exports){ -var inherits = require('inherits'); -var Reporter = require('../base').Reporter; -var Buffer = require('buffer').Buffer; - -function DecoderBuffer(base, options) { - Reporter.call(this, options); - if (!Buffer.isBuffer(base)) { - this.error('Input not Buffer'); - return; - } - - this.base = base; - this.offset = 0; - this.length = base.length; -} -inherits(DecoderBuffer, Reporter); -exports.DecoderBuffer = DecoderBuffer; - -DecoderBuffer.prototype.save = function save() { - return { offset: this.offset, reporter: Reporter.prototype.save.call(this) }; -}; - -DecoderBuffer.prototype.restore = function restore(save) { - // Return skipped data - var res = new DecoderBuffer(this.base); - res.offset = save.offset; - res.length = this.offset; - - this.offset = save.offset; - Reporter.prototype.restore.call(this, save.reporter); - - return res; -}; - -DecoderBuffer.prototype.isEmpty = function isEmpty() { - return this.offset === this.length; -}; - -DecoderBuffer.prototype.readUInt8 = function readUInt8(fail) { - if (this.offset + 1 <= this.length) - return this.base.readUInt8(this.offset++, true); - else - return this.error(fail || 'DecoderBuffer overrun'); -} - -DecoderBuffer.prototype.skip = function skip(bytes, fail) { - if (!(this.offset + bytes <= this.length)) - return this.error(fail || 'DecoderBuffer overrun'); - - var res = new DecoderBuffer(this.base); - - // Share reporter state - res._reporterState = this._reporterState; - - res.offset = this.offset; - res.length = this.offset + bytes; - this.offset += bytes; - return res; -} - -DecoderBuffer.prototype.raw = function raw(save) { - return this.base.slice(save ? save.offset : this.offset, this.length); -} - -function EncoderBuffer(value, reporter) { - if (Array.isArray(value)) { - this.length = 0; - this.value = value.map(function(item) { - if (!(item instanceof EncoderBuffer)) - item = new EncoderBuffer(item, reporter); - this.length += item.length; - return item; - }, this); - } else if (typeof value === 'number') { - if (!(0 <= value && value <= 0xff)) - return reporter.error('non-byte EncoderBuffer value'); - this.value = value; - this.length = 1; - } else if (typeof value === 'string') { - this.value = value; - this.length = Buffer.byteLength(value); - } else if (Buffer.isBuffer(value)) { - this.value = value; - this.length = value.length; - } else { - return reporter.error('Unsupported type: ' + typeof value); - } -} -exports.EncoderBuffer = EncoderBuffer; - -EncoderBuffer.prototype.join = function join(out, offset) { - if (!out) - out = new Buffer(this.length); - if (!offset) - offset = 0; - - if (this.length === 0) - return out; - - if (Array.isArray(this.value)) { - this.value.forEach(function(item) { - item.join(out, offset); - offset += item.length; - }); - } else { - if (typeof this.value === 'number') - out[offset] = this.value; - else if (typeof this.value === 'string') - out.write(this.value, offset); - else if (Buffer.isBuffer(this.value)) - this.value.copy(out, offset); - offset += this.length; - } - - return out; -}; - -},{"../base":6,"buffer":89,"inherits":156}],6:[function(require,module,exports){ -var base = exports; - -base.Reporter = require('./reporter').Reporter; -base.DecoderBuffer = require('./buffer').DecoderBuffer; -base.EncoderBuffer = require('./buffer').EncoderBuffer; -base.Node = require('./node'); - -},{"./buffer":5,"./node":7,"./reporter":8}],7:[function(require,module,exports){ -var Reporter = require('../base').Reporter; -var EncoderBuffer = require('../base').EncoderBuffer; -var DecoderBuffer = require('../base').DecoderBuffer; -var assert = require('minimalistic-assert'); - -// Supported tags -var tags = [ - 'seq', 'seqof', 'set', 'setof', 'objid', 'bool', - 'gentime', 'utctime', 'null_', 'enum', 'int', 'objDesc', - 'bitstr', 'bmpstr', 'charstr', 'genstr', 'graphstr', 'ia5str', 'iso646str', - 'numstr', 'octstr', 'printstr', 't61str', 'unistr', 'utf8str', 'videostr' -]; - -// Public methods list -var methods = [ - 'key', 'obj', 'use', 'optional', 'explicit', 'implicit', 'def', 'choice', - 'any', 'contains' -].concat(tags); - -// Overrided methods list -var overrided = [ - '_peekTag', '_decodeTag', '_use', - '_decodeStr', '_decodeObjid', '_decodeTime', - '_decodeNull', '_decodeInt', '_decodeBool', '_decodeList', - - '_encodeComposite', '_encodeStr', '_encodeObjid', '_encodeTime', - '_encodeNull', '_encodeInt', '_encodeBool' -]; - -function Node(enc, parent) { - var state = {}; - this._baseState = state; - - state.enc = enc; - - state.parent = parent || null; - state.children = null; - - // State - state.tag = null; - state.args = null; - state.reverseArgs = null; - state.choice = null; - state.optional = false; - state.any = false; - state.obj = false; - state.use = null; - state.useDecoder = null; - state.key = null; - state['default'] = null; - state.explicit = null; - state.implicit = null; - state.contains = null; - - // Should create new instance on each method - if (!state.parent) { - state.children = []; - this._wrap(); - } -} -module.exports = Node; - -var stateProps = [ - 'enc', 'parent', 'children', 'tag', 'args', 'reverseArgs', 'choice', - 'optional', 'any', 'obj', 'use', 'alteredUse', 'key', 'default', 'explicit', - 'implicit', 'contains' -]; - -Node.prototype.clone = function clone() { - var state = this._baseState; - var cstate = {}; - stateProps.forEach(function(prop) { - cstate[prop] = state[prop]; - }); - var res = new this.constructor(cstate.parent); - res._baseState = cstate; - return res; -}; - -Node.prototype._wrap = function wrap() { - var state = this._baseState; - methods.forEach(function(method) { - this[method] = function _wrappedMethod() { - var clone = new this.constructor(this); - state.children.push(clone); - return clone[method].apply(clone, arguments); - }; - }, this); -}; - -Node.prototype._init = function init(body) { - var state = this._baseState; - - assert(state.parent === null); - body.call(this); - - // Filter children - state.children = state.children.filter(function(child) { - return child._baseState.parent === this; - }, this); - assert.equal(state.children.length, 1, 'Root node can have only one child'); -}; - -Node.prototype._useArgs = function useArgs(args) { - var state = this._baseState; - - // Filter children and args - var children = args.filter(function(arg) { - return arg instanceof this.constructor; - }, this); - args = args.filter(function(arg) { - return !(arg instanceof this.constructor); - }, this); - - if (children.length !== 0) { - assert(state.children === null); - state.children = children; - - // Replace parent to maintain backward link - children.forEach(function(child) { - child._baseState.parent = this; - }, this); - } - if (args.length !== 0) { - assert(state.args === null); - state.args = args; - state.reverseArgs = args.map(function(arg) { - if (typeof arg !== 'object' || arg.constructor !== Object) - return arg; - - var res = {}; - Object.keys(arg).forEach(function(key) { - if (key == (key | 0)) - key |= 0; - var value = arg[key]; - res[value] = key; - }); - return res; - }); - } -}; - -// -// Overrided methods -// - -overrided.forEach(function(method) { - Node.prototype[method] = function _overrided() { - var state = this._baseState; - throw new Error(method + ' not implemented for encoding: ' + state.enc); - }; -}); - -// -// Public methods -// - -tags.forEach(function(tag) { - Node.prototype[tag] = function _tagMethod() { - var state = this._baseState; - var args = Array.prototype.slice.call(arguments); - - assert(state.tag === null); - state.tag = tag; - - this._useArgs(args); - - return this; - }; -}); - -Node.prototype.use = function use(item) { - assert(item); - var state = this._baseState; - - assert(state.use === null); - state.use = item; - - return this; -}; - -Node.prototype.optional = function optional() { - var state = this._baseState; - - state.optional = true; - - return this; -}; - -Node.prototype.def = function def(val) { - var state = this._baseState; - - assert(state['default'] === null); - state['default'] = val; - state.optional = true; - - return this; -}; - -Node.prototype.explicit = function explicit(num) { - var state = this._baseState; - - assert(state.explicit === null && state.implicit === null); - state.explicit = num; - - return this; -}; - -Node.prototype.implicit = function implicit(num) { - var state = this._baseState; - - assert(state.explicit === null && state.implicit === null); - state.implicit = num; - - return this; -}; - -Node.prototype.obj = function obj() { - var state = this._baseState; - var args = Array.prototype.slice.call(arguments); - - state.obj = true; - - if (args.length !== 0) - this._useArgs(args); - - return this; -}; - -Node.prototype.key = function key(newKey) { - var state = this._baseState; - - assert(state.key === null); - state.key = newKey; - - return this; -}; - -Node.prototype.any = function any() { - var state = this._baseState; - - state.any = true; - - return this; -}; - -Node.prototype.choice = function choice(obj) { - var state = this._baseState; - - assert(state.choice === null); - state.choice = obj; - this._useArgs(Object.keys(obj).map(function(key) { - return obj[key]; - })); - - return this; -}; - -Node.prototype.contains = function contains(item) { - var state = this._baseState; - - assert(state.use === null); - state.contains = item; - - return this; -}; - -// -// Decoding -// - -Node.prototype._decode = function decode(input, options) { - var state = this._baseState; - - // Decode root node - if (state.parent === null) - return input.wrapResult(state.children[0]._decode(input, options)); - - var result = state['default']; - var present = true; - - var prevKey = null; - if (state.key !== null) - prevKey = input.enterKey(state.key); - - // Check if tag is there - if (state.optional) { - var tag = null; - if (state.explicit !== null) - tag = state.explicit; - else if (state.implicit !== null) - tag = state.implicit; - else if (state.tag !== null) - tag = state.tag; - - if (tag === null && !state.any) { - // Trial and Error - var save = input.save(); - try { - if (state.choice === null) - this._decodeGeneric(state.tag, input, options); - else - this._decodeChoice(input, options); - present = true; - } catch (e) { - present = false; - } - input.restore(save); - } else { - present = this._peekTag(input, tag, state.any); - - if (input.isError(present)) - return present; - } - } - - // Push object on stack - var prevObj; - if (state.obj && present) - prevObj = input.enterObject(); - - if (present) { - // Unwrap explicit values - if (state.explicit !== null) { - var explicit = this._decodeTag(input, state.explicit); - if (input.isError(explicit)) - return explicit; - input = explicit; - } - - var start = input.offset; - - // Unwrap implicit and normal values - if (state.use === null && state.choice === null) { - if (state.any) - var save = input.save(); - var body = this._decodeTag( - input, - state.implicit !== null ? state.implicit : state.tag, - state.any - ); - if (input.isError(body)) - return body; - - if (state.any) - result = input.raw(save); - else - input = body; - } - - if (options && options.track && state.tag !== null) - options.track(input.path(), start, input.length, 'tagged'); - - if (options && options.track && state.tag !== null) - options.track(input.path(), input.offset, input.length, 'content'); - - // Select proper method for tag - if (state.any) - result = result; - else if (state.choice === null) - result = this._decodeGeneric(state.tag, input, options); - else - result = this._decodeChoice(input, options); - - if (input.isError(result)) - return result; - - // Decode children - if (!state.any && state.choice === null && state.children !== null) { - state.children.forEach(function decodeChildren(child) { - // NOTE: We are ignoring errors here, to let parser continue with other - // parts of encoded data - child._decode(input, options); - }); - } - - // Decode contained/encoded by schema, only in bit or octet strings - if (state.contains && (state.tag === 'octstr' || state.tag === 'bitstr')) { - var data = new DecoderBuffer(result); - result = this._getUse(state.contains, input._reporterState.obj) - ._decode(data, options); - } - } - - // Pop object - if (state.obj && present) - result = input.leaveObject(prevObj); - - // Set key - if (state.key !== null && (result !== null || present === true)) - input.leaveKey(prevKey, state.key, result); - else if (prevKey !== null) - input.exitKey(prevKey); - - return result; -}; - -Node.prototype._decodeGeneric = function decodeGeneric(tag, input, options) { - var state = this._baseState; - - if (tag === 'seq' || tag === 'set') - return null; - if (tag === 'seqof' || tag === 'setof') - return this._decodeList(input, tag, state.args[0], options); - else if (/str$/.test(tag)) - return this._decodeStr(input, tag, options); - else if (tag === 'objid' && state.args) - return this._decodeObjid(input, state.args[0], state.args[1], options); - else if (tag === 'objid') - return this._decodeObjid(input, null, null, options); - else if (tag === 'gentime' || tag === 'utctime') - return this._decodeTime(input, tag, options); - else if (tag === 'null_') - return this._decodeNull(input, options); - else if (tag === 'bool') - return this._decodeBool(input, options); - else if (tag === 'objDesc') - return this._decodeStr(input, tag, options); - else if (tag === 'int' || tag === 'enum') - return this._decodeInt(input, state.args && state.args[0], options); - - if (state.use !== null) { - return this._getUse(state.use, input._reporterState.obj) - ._decode(input, options); - } else { - return input.error('unknown tag: ' + tag); - } -}; - -Node.prototype._getUse = function _getUse(entity, obj) { - - var state = this._baseState; - // Create altered use decoder if implicit is set - state.useDecoder = this._use(entity, obj); - assert(state.useDecoder._baseState.parent === null); - state.useDecoder = state.useDecoder._baseState.children[0]; - if (state.implicit !== state.useDecoder._baseState.implicit) { - state.useDecoder = state.useDecoder.clone(); - state.useDecoder._baseState.implicit = state.implicit; - } - return state.useDecoder; -}; - -Node.prototype._decodeChoice = function decodeChoice(input, options) { - var state = this._baseState; - var result = null; - var match = false; - - Object.keys(state.choice).some(function(key) { - var save = input.save(); - var node = state.choice[key]; - try { - var value = node._decode(input, options); - if (input.isError(value)) - return false; - - result = { type: key, value: value }; - match = true; - } catch (e) { - input.restore(save); - return false; - } - return true; - }, this); - - if (!match) - return input.error('Choice not matched'); - - return result; -}; - -// -// Encoding -// - -Node.prototype._createEncoderBuffer = function createEncoderBuffer(data) { - return new EncoderBuffer(data, this.reporter); -}; - -Node.prototype._encode = function encode(data, reporter, parent) { - var state = this._baseState; - if (state['default'] !== null && state['default'] === data) - return; - - var result = this._encodeValue(data, reporter, parent); - if (result === undefined) - return; - - if (this._skipDefault(result, reporter, parent)) - return; - - return result; -}; - -Node.prototype._encodeValue = function encode(data, reporter, parent) { - var state = this._baseState; - - // Decode root node - if (state.parent === null) - return state.children[0]._encode(data, reporter || new Reporter()); - - var result = null; - - // Set reporter to share it with a child class - this.reporter = reporter; - - // Check if data is there - if (state.optional && data === undefined) { - if (state['default'] !== null) - data = state['default'] - else - return; - } - - // Encode children first - var content = null; - var primitive = false; - if (state.any) { - // Anything that was given is translated to buffer - result = this._createEncoderBuffer(data); - } else if (state.choice) { - result = this._encodeChoice(data, reporter); - } else if (state.contains) { - content = this._getUse(state.contains, parent)._encode(data, reporter); - primitive = true; - } else if (state.children) { - content = state.children.map(function(child) { - if (child._baseState.tag === 'null_') - return child._encode(null, reporter, data); - - if (child._baseState.key === null) - return reporter.error('Child should have a key'); - var prevKey = reporter.enterKey(child._baseState.key); - - if (typeof data !== 'object') - return reporter.error('Child expected, but input is not object'); - - var res = child._encode(data[child._baseState.key], reporter, data); - reporter.leaveKey(prevKey); - - return res; - }, this).filter(function(child) { - return child; - }); - content = this._createEncoderBuffer(content); - } else { - if (state.tag === 'seqof' || state.tag === 'setof') { - // TODO(indutny): this should be thrown on DSL level - if (!(state.args && state.args.length === 1)) - return reporter.error('Too many args for : ' + state.tag); - - if (!Array.isArray(data)) - return reporter.error('seqof/setof, but data is not Array'); - - var child = this.clone(); - child._baseState.implicit = null; - content = this._createEncoderBuffer(data.map(function(item) { - var state = this._baseState; - - return this._getUse(state.args[0], data)._encode(item, reporter); - }, child)); - } else if (state.use !== null) { - result = this._getUse(state.use, parent)._encode(data, reporter); - } else { - content = this._encodePrimitive(state.tag, data); - primitive = true; - } - } - - // Encode data itself - var result; - if (!state.any && state.choice === null) { - var tag = state.implicit !== null ? state.implicit : state.tag; - var cls = state.implicit === null ? 'universal' : 'context'; - - if (tag === null) { - if (state.use === null) - reporter.error('Tag could be omitted only for .use()'); - } else { - if (state.use === null) - result = this._encodeComposite(tag, primitive, cls, content); - } - } - - // Wrap in explicit - if (state.explicit !== null) - result = this._encodeComposite(state.explicit, false, 'context', result); - - return result; -}; - -Node.prototype._encodeChoice = function encodeChoice(data, reporter) { - var state = this._baseState; - - var node = state.choice[data.type]; - if (!node) { - assert( - false, - data.type + ' not found in ' + - JSON.stringify(Object.keys(state.choice))); - } - return node._encode(data.value, reporter); -}; - -Node.prototype._encodePrimitive = function encodePrimitive(tag, data) { - var state = this._baseState; - - if (/str$/.test(tag)) - return this._encodeStr(data, tag); - else if (tag === 'objid' && state.args) - return this._encodeObjid(data, state.reverseArgs[0], state.args[1]); - else if (tag === 'objid') - return this._encodeObjid(data, null, null); - else if (tag === 'gentime' || tag === 'utctime') - return this._encodeTime(data, tag); - else if (tag === 'null_') - return this._encodeNull(); - else if (tag === 'int' || tag === 'enum') - return this._encodeInt(data, state.args && state.reverseArgs[0]); - else if (tag === 'bool') - return this._encodeBool(data); - else if (tag === 'objDesc') - return this._encodeStr(data, tag); - else - throw new Error('Unsupported tag: ' + tag); -}; - -Node.prototype._isNumstr = function isNumstr(str) { - return /^[0-9 ]*$/.test(str); -}; - -Node.prototype._isPrintstr = function isPrintstr(str) { - return /^[A-Za-z0-9 '\(\)\+,\-\.\/:=\?]*$/.test(str); -}; - -},{"../base":6,"minimalistic-assert":164}],8:[function(require,module,exports){ -var inherits = require('inherits'); - -function Reporter(options) { - this._reporterState = { - obj: null, - path: [], - options: options || {}, - errors: [] - }; -} -exports.Reporter = Reporter; - -Reporter.prototype.isError = function isError(obj) { - return obj instanceof ReporterError; -}; - -Reporter.prototype.save = function save() { - var state = this._reporterState; - - return { obj: state.obj, pathLen: state.path.length }; -}; - -Reporter.prototype.restore = function restore(data) { - var state = this._reporterState; - - state.obj = data.obj; - state.path = state.path.slice(0, data.pathLen); -}; - -Reporter.prototype.enterKey = function enterKey(key) { - return this._reporterState.path.push(key); -}; - -Reporter.prototype.exitKey = function exitKey(index) { - var state = this._reporterState; - - state.path = state.path.slice(0, index - 1); -}; - -Reporter.prototype.leaveKey = function leaveKey(index, key, value) { - var state = this._reporterState; - - this.exitKey(index); - if (state.obj !== null) - state.obj[key] = value; -}; - -Reporter.prototype.path = function path() { - return this._reporterState.path.join('/'); -}; - -Reporter.prototype.enterObject = function enterObject() { - var state = this._reporterState; - - var prev = state.obj; - state.obj = {}; - return prev; -}; - -Reporter.prototype.leaveObject = function leaveObject(prev) { - var state = this._reporterState; - - var now = state.obj; - state.obj = prev; - return now; -}; - -Reporter.prototype.error = function error(msg) { - var err; - var state = this._reporterState; - - var inherited = msg instanceof ReporterError; - if (inherited) { - err = msg; - } else { - err = new ReporterError(state.path.map(function(elem) { - return '[' + JSON.stringify(elem) + ']'; - }).join(''), msg.message || msg, msg.stack); - } - - if (!state.options.partial) - throw err; - - if (!inherited) - state.errors.push(err); - - return err; -}; - -Reporter.prototype.wrapResult = function wrapResult(result) { - var state = this._reporterState; - if (!state.options.partial) - return result; - - return { - result: this.isError(result) ? null : result, - errors: state.errors - }; -}; - -function ReporterError(path, msg) { - this.path = path; - this.rethrow(msg); -}; -inherits(ReporterError, Error); - -ReporterError.prototype.rethrow = function rethrow(msg) { - this.message = msg + ' at: ' + (this.path || '(shallow)'); - if (Error.captureStackTrace) - Error.captureStackTrace(this, ReporterError); - - if (!this.stack) { - try { - // IE only adds stack when thrown - throw new Error(this.message); - } catch (e) { - this.stack = e.stack; - } - } - return this; -}; - -},{"inherits":156}],9:[function(require,module,exports){ -var constants = require('../constants'); - -exports.tagClass = { - 0: 'universal', - 1: 'application', - 2: 'context', - 3: 'private' -}; -exports.tagClassByName = constants._reverse(exports.tagClass); - -exports.tag = { - 0x00: 'end', - 0x01: 'bool', - 0x02: 'int', - 0x03: 'bitstr', - 0x04: 'octstr', - 0x05: 'null_', - 0x06: 'objid', - 0x07: 'objDesc', - 0x08: 'external', - 0x09: 'real', - 0x0a: 'enum', - 0x0b: 'embed', - 0x0c: 'utf8str', - 0x0d: 'relativeOid', - 0x10: 'seq', - 0x11: 'set', - 0x12: 'numstr', - 0x13: 'printstr', - 0x14: 't61str', - 0x15: 'videostr', - 0x16: 'ia5str', - 0x17: 'utctime', - 0x18: 'gentime', - 0x19: 'graphstr', - 0x1a: 'iso646str', - 0x1b: 'genstr', - 0x1c: 'unistr', - 0x1d: 'charstr', - 0x1e: 'bmpstr' -}; -exports.tagByName = constants._reverse(exports.tag); - -},{"../constants":10}],10:[function(require,module,exports){ -var constants = exports; - -// Helper -constants._reverse = function reverse(map) { - var res = {}; - - Object.keys(map).forEach(function(key) { - // Convert key to integer if it is stringified - if ((key | 0) == key) - key = key | 0; - - var value = map[key]; - res[value] = key; - }); - - return res; -}; - -constants.der = require('./der'); - -},{"./der":9}],11:[function(require,module,exports){ -var inherits = require('inherits'); - -var asn1 = require('../../asn1'); -var base = asn1.base; -var bignum = asn1.bignum; - -// Import DER constants -var der = asn1.constants.der; - -function DERDecoder(entity) { - this.enc = 'der'; - this.name = entity.name; - this.entity = entity; - - // Construct base tree - this.tree = new DERNode(); - this.tree._init(entity.body); -}; -module.exports = DERDecoder; - -DERDecoder.prototype.decode = function decode(data, options) { - if (!(data instanceof base.DecoderBuffer)) - data = new base.DecoderBuffer(data, options); - - return this.tree._decode(data, options); -}; - -// Tree methods - -function DERNode(parent) { - base.Node.call(this, 'der', parent); -} -inherits(DERNode, base.Node); - -DERNode.prototype._peekTag = function peekTag(buffer, tag, any) { - if (buffer.isEmpty()) - return false; - - var state = buffer.save(); - var decodedTag = derDecodeTag(buffer, 'Failed to peek tag: "' + tag + '"'); - if (buffer.isError(decodedTag)) - return decodedTag; - - buffer.restore(state); - - return decodedTag.tag === tag || decodedTag.tagStr === tag || - (decodedTag.tagStr + 'of') === tag || any; -}; - -DERNode.prototype._decodeTag = function decodeTag(buffer, tag, any) { - var decodedTag = derDecodeTag(buffer, - 'Failed to decode tag of "' + tag + '"'); - if (buffer.isError(decodedTag)) - return decodedTag; - - var len = derDecodeLen(buffer, - decodedTag.primitive, - 'Failed to get length of "' + tag + '"'); - - // Failure - if (buffer.isError(len)) - return len; - - if (!any && - decodedTag.tag !== tag && - decodedTag.tagStr !== tag && - decodedTag.tagStr + 'of' !== tag) { - return buffer.error('Failed to match tag: "' + tag + '"'); - } - - if (decodedTag.primitive || len !== null) - return buffer.skip(len, 'Failed to match body of: "' + tag + '"'); - - // Indefinite length... find END tag - var state = buffer.save(); - var res = this._skipUntilEnd( - buffer, - 'Failed to skip indefinite length body: "' + this.tag + '"'); - if (buffer.isError(res)) - return res; - - len = buffer.offset - state.offset; - buffer.restore(state); - return buffer.skip(len, 'Failed to match body of: "' + tag + '"'); -}; - -DERNode.prototype._skipUntilEnd = function skipUntilEnd(buffer, fail) { - while (true) { - var tag = derDecodeTag(buffer, fail); - if (buffer.isError(tag)) - return tag; - var len = derDecodeLen(buffer, tag.primitive, fail); - if (buffer.isError(len)) - return len; - - var res; - if (tag.primitive || len !== null) - res = buffer.skip(len) - else - res = this._skipUntilEnd(buffer, fail); - - // Failure - if (buffer.isError(res)) - return res; - - if (tag.tagStr === 'end') - break; - } -}; - -DERNode.prototype._decodeList = function decodeList(buffer, tag, decoder, - options) { - var result = []; - while (!buffer.isEmpty()) { - var possibleEnd = this._peekTag(buffer, 'end'); - if (buffer.isError(possibleEnd)) - return possibleEnd; - - var res = decoder.decode(buffer, 'der', options); - if (buffer.isError(res) && possibleEnd) - break; - result.push(res); - } - return result; -}; - -DERNode.prototype._decodeStr = function decodeStr(buffer, tag) { - if (tag === 'bitstr') { - var unused = buffer.readUInt8(); - if (buffer.isError(unused)) - return unused; - return { unused: unused, data: buffer.raw() }; - } else if (tag === 'bmpstr') { - var raw = buffer.raw(); - if (raw.length % 2 === 1) - return buffer.error('Decoding of string type: bmpstr length mismatch'); - - var str = ''; - for (var i = 0; i < raw.length / 2; i++) { - str += String.fromCharCode(raw.readUInt16BE(i * 2)); - } - return str; - } else if (tag === 'numstr') { - var numstr = buffer.raw().toString('ascii'); - if (!this._isNumstr(numstr)) { - return buffer.error('Decoding of string type: ' + - 'numstr unsupported characters'); - } - return numstr; - } else if (tag === 'octstr') { - return buffer.raw(); - } else if (tag === 'objDesc') { - return buffer.raw(); - } else if (tag === 'printstr') { - var printstr = buffer.raw().toString('ascii'); - if (!this._isPrintstr(printstr)) { - return buffer.error('Decoding of string type: ' + - 'printstr unsupported characters'); - } - return printstr; - } else if (/str$/.test(tag)) { - return buffer.raw().toString(); - } else { - return buffer.error('Decoding of string type: ' + tag + ' unsupported'); - } -}; - -DERNode.prototype._decodeObjid = function decodeObjid(buffer, values, relative) { - var result; - var identifiers = []; - var ident = 0; - while (!buffer.isEmpty()) { - var subident = buffer.readUInt8(); - ident <<= 7; - ident |= subident & 0x7f; - if ((subident & 0x80) === 0) { - identifiers.push(ident); - ident = 0; - } - } - if (subident & 0x80) - identifiers.push(ident); - - var first = (identifiers[0] / 40) | 0; - var second = identifiers[0] % 40; - - if (relative) - result = identifiers; - else - result = [first, second].concat(identifiers.slice(1)); - - if (values) { - var tmp = values[result.join(' ')]; - if (tmp === undefined) - tmp = values[result.join('.')]; - if (tmp !== undefined) - result = tmp; - } - - return result; -}; - -DERNode.prototype._decodeTime = function decodeTime(buffer, tag) { - var str = buffer.raw().toString(); - if (tag === 'gentime') { - var year = str.slice(0, 4) | 0; - var mon = str.slice(4, 6) | 0; - var day = str.slice(6, 8) | 0; - var hour = str.slice(8, 10) | 0; - var min = str.slice(10, 12) | 0; - var sec = str.slice(12, 14) | 0; - } else if (tag === 'utctime') { - var year = str.slice(0, 2) | 0; - var mon = str.slice(2, 4) | 0; - var day = str.slice(4, 6) | 0; - var hour = str.slice(6, 8) | 0; - var min = str.slice(8, 10) | 0; - var sec = str.slice(10, 12) | 0; - if (year < 70) - year = 2000 + year; - else - year = 1900 + year; - } else { - return buffer.error('Decoding ' + tag + ' time is not supported yet'); - } - - return Date.UTC(year, mon - 1, day, hour, min, sec, 0); -}; - -DERNode.prototype._decodeNull = function decodeNull(buffer) { - return null; -}; - -DERNode.prototype._decodeBool = function decodeBool(buffer) { - var res = buffer.readUInt8(); - if (buffer.isError(res)) - return res; - else - return res !== 0; -}; - -DERNode.prototype._decodeInt = function decodeInt(buffer, values) { - // Bigint, return as it is (assume big endian) - var raw = buffer.raw(); - var res = new bignum(raw); - - if (values) - res = values[res.toString(10)] || res; - - return res; -}; - -DERNode.prototype._use = function use(entity, obj) { - if (typeof entity === 'function') - entity = entity(obj); - return entity._getDecoder('der').tree; -}; - -// Utility methods - -function derDecodeTag(buf, fail) { - var tag = buf.readUInt8(fail); - if (buf.isError(tag)) - return tag; - - var cls = der.tagClass[tag >> 6]; - var primitive = (tag & 0x20) === 0; - - // Multi-octet tag - load - if ((tag & 0x1f) === 0x1f) { - var oct = tag; - tag = 0; - while ((oct & 0x80) === 0x80) { - oct = buf.readUInt8(fail); - if (buf.isError(oct)) - return oct; - - tag <<= 7; - tag |= oct & 0x7f; - } - } else { - tag &= 0x1f; - } - var tagStr = der.tag[tag]; - - return { - cls: cls, - primitive: primitive, - tag: tag, - tagStr: tagStr - }; -} - -function derDecodeLen(buf, primitive, fail) { - var len = buf.readUInt8(fail); - if (buf.isError(len)) - return len; - - // Indefinite form - if (!primitive && len === 0x80) - return null; - - // Definite form - if ((len & 0x80) === 0) { - // Short form - return len; - } - - // Long form - var num = len & 0x7f; - if (num > 4) - return buf.error('length octect is too long'); - - len = 0; - for (var i = 0; i < num; i++) { - len <<= 8; - var j = buf.readUInt8(fail); - if (buf.isError(j)) - return j; - len |= j; - } - - return len; -} - -},{"../../asn1":3,"inherits":156}],12:[function(require,module,exports){ -var decoders = exports; - -decoders.der = require('./der'); -decoders.pem = require('./pem'); - -},{"./der":11,"./pem":13}],13:[function(require,module,exports){ -var inherits = require('inherits'); -var Buffer = require('buffer').Buffer; - -var DERDecoder = require('./der'); - -function PEMDecoder(entity) { - DERDecoder.call(this, entity); - this.enc = 'pem'; -}; -inherits(PEMDecoder, DERDecoder); -module.exports = PEMDecoder; - -PEMDecoder.prototype.decode = function decode(data, options) { - var lines = data.toString().split(/[\r\n]+/g); - - var label = options.label.toUpperCase(); - - var re = /^-----(BEGIN|END) ([^-]+)-----$/; - var start = -1; - var end = -1; - for (var i = 0; i < lines.length; i++) { - var match = lines[i].match(re); - if (match === null) - continue; - - if (match[2] !== label) - continue; - - if (start === -1) { - if (match[1] !== 'BEGIN') - break; - start = i; - } else { - if (match[1] !== 'END') - break; - end = i; - break; - } - } - if (start === -1 || end === -1) - throw new Error('PEM section not found for: ' + label); - - var base64 = lines.slice(start + 1, end).join(''); - // Remove excessive symbols - base64.replace(/[^a-z0-9\+\/=]+/gi, ''); - - var input = new Buffer(base64, 'base64'); - return DERDecoder.prototype.decode.call(this, input, options); -}; - -},{"./der":11,"buffer":89,"inherits":156}],14:[function(require,module,exports){ -var inherits = require('inherits'); -var Buffer = require('buffer').Buffer; - -var asn1 = require('../../asn1'); -var base = asn1.base; - -// Import DER constants -var der = asn1.constants.der; - -function DEREncoder(entity) { - this.enc = 'der'; - this.name = entity.name; - this.entity = entity; - - // Construct base tree - this.tree = new DERNode(); - this.tree._init(entity.body); -}; -module.exports = DEREncoder; - -DEREncoder.prototype.encode = function encode(data, reporter) { - return this.tree._encode(data, reporter).join(); -}; - -// Tree methods - -function DERNode(parent) { - base.Node.call(this, 'der', parent); -} -inherits(DERNode, base.Node); - -DERNode.prototype._encodeComposite = function encodeComposite(tag, - primitive, - cls, - content) { - var encodedTag = encodeTag(tag, primitive, cls, this.reporter); - - // Short form - if (content.length < 0x80) { - var header = new Buffer(2); - header[0] = encodedTag; - header[1] = content.length; - return this._createEncoderBuffer([ header, content ]); - } - - // Long form - // Count octets required to store length - var lenOctets = 1; - for (var i = content.length; i >= 0x100; i >>= 8) - lenOctets++; - - var header = new Buffer(1 + 1 + lenOctets); - header[0] = encodedTag; - header[1] = 0x80 | lenOctets; - - for (var i = 1 + lenOctets, j = content.length; j > 0; i--, j >>= 8) - header[i] = j & 0xff; - - return this._createEncoderBuffer([ header, content ]); -}; - -DERNode.prototype._encodeStr = function encodeStr(str, tag) { - if (tag === 'bitstr') { - return this._createEncoderBuffer([ str.unused | 0, str.data ]); - } else if (tag === 'bmpstr') { - var buf = new Buffer(str.length * 2); - for (var i = 0; i < str.length; i++) { - buf.writeUInt16BE(str.charCodeAt(i), i * 2); - } - return this._createEncoderBuffer(buf); - } else if (tag === 'numstr') { - if (!this._isNumstr(str)) { - return this.reporter.error('Encoding of string type: numstr supports ' + - 'only digits and space'); - } - return this._createEncoderBuffer(str); - } else if (tag === 'printstr') { - if (!this._isPrintstr(str)) { - return this.reporter.error('Encoding of string type: printstr supports ' + - 'only latin upper and lower case letters, ' + - 'digits, space, apostrophe, left and rigth ' + - 'parenthesis, plus sign, comma, hyphen, ' + - 'dot, slash, colon, equal sign, ' + - 'question mark'); - } - return this._createEncoderBuffer(str); - } else if (/str$/.test(tag)) { - return this._createEncoderBuffer(str); - } else if (tag === 'objDesc') { - return this._createEncoderBuffer(str); - } else { - return this.reporter.error('Encoding of string type: ' + tag + - ' unsupported'); - } -}; - -DERNode.prototype._encodeObjid = function encodeObjid(id, values, relative) { - if (typeof id === 'string') { - if (!values) - return this.reporter.error('string objid given, but no values map found'); - if (!values.hasOwnProperty(id)) - return this.reporter.error('objid not found in values map'); - id = values[id].split(/[\s\.]+/g); - for (var i = 0; i < id.length; i++) - id[i] |= 0; - } else if (Array.isArray(id)) { - id = id.slice(); - for (var i = 0; i < id.length; i++) - id[i] |= 0; - } - - if (!Array.isArray(id)) { - return this.reporter.error('objid() should be either array or string, ' + - 'got: ' + JSON.stringify(id)); - } - - if (!relative) { - if (id[1] >= 40) - return this.reporter.error('Second objid identifier OOB'); - id.splice(0, 2, id[0] * 40 + id[1]); - } - - // Count number of octets - var size = 0; - for (var i = 0; i < id.length; i++) { - var ident = id[i]; - for (size++; ident >= 0x80; ident >>= 7) - size++; - } - - var objid = new Buffer(size); - var offset = objid.length - 1; - for (var i = id.length - 1; i >= 0; i--) { - var ident = id[i]; - objid[offset--] = ident & 0x7f; - while ((ident >>= 7) > 0) - objid[offset--] = 0x80 | (ident & 0x7f); - } - - return this._createEncoderBuffer(objid); -}; - -function two(num) { - if (num < 10) - return '0' + num; - else - return num; -} - -DERNode.prototype._encodeTime = function encodeTime(time, tag) { - var str; - var date = new Date(time); - - if (tag === 'gentime') { - str = [ - two(date.getFullYear()), - two(date.getUTCMonth() + 1), - two(date.getUTCDate()), - two(date.getUTCHours()), - two(date.getUTCMinutes()), - two(date.getUTCSeconds()), - 'Z' - ].join(''); - } else if (tag === 'utctime') { - str = [ - two(date.getFullYear() % 100), - two(date.getUTCMonth() + 1), - two(date.getUTCDate()), - two(date.getUTCHours()), - two(date.getUTCMinutes()), - two(date.getUTCSeconds()), - 'Z' - ].join(''); - } else { - this.reporter.error('Encoding ' + tag + ' time is not supported yet'); - } - - return this._encodeStr(str, 'octstr'); -}; - -DERNode.prototype._encodeNull = function encodeNull() { - return this._createEncoderBuffer(''); -}; - -DERNode.prototype._encodeInt = function encodeInt(num, values) { - if (typeof num === 'string') { - if (!values) - return this.reporter.error('String int or enum given, but no values map'); - if (!values.hasOwnProperty(num)) { - return this.reporter.error('Values map doesn\'t contain: ' + - JSON.stringify(num)); - } - num = values[num]; - } - - // Bignum, assume big endian - if (typeof num !== 'number' && !Buffer.isBuffer(num)) { - var numArray = num.toArray(); - if (!num.sign && numArray[0] & 0x80) { - numArray.unshift(0); - } - num = new Buffer(numArray); - } - - if (Buffer.isBuffer(num)) { - var size = num.length; - if (num.length === 0) - size++; - - var out = new Buffer(size); - num.copy(out); - if (num.length === 0) - out[0] = 0 - return this._createEncoderBuffer(out); - } - - if (num < 0x80) - return this._createEncoderBuffer(num); - - if (num < 0x100) - return this._createEncoderBuffer([0, num]); - - var size = 1; - for (var i = num; i >= 0x100; i >>= 8) - size++; - - var out = new Array(size); - for (var i = out.length - 1; i >= 0; i--) { - out[i] = num & 0xff; - num >>= 8; - } - if(out[0] & 0x80) { - out.unshift(0); - } - - return this._createEncoderBuffer(new Buffer(out)); -}; - -DERNode.prototype._encodeBool = function encodeBool(value) { - return this._createEncoderBuffer(value ? 0xff : 0); -}; - -DERNode.prototype._use = function use(entity, obj) { - if (typeof entity === 'function') - entity = entity(obj); - return entity._getEncoder('der').tree; -}; - -DERNode.prototype._skipDefault = function skipDefault(dataBuffer, reporter, parent) { - var state = this._baseState; - var i; - if (state['default'] === null) - return false; - - var data = dataBuffer.join(); - if (state.defaultBuffer === undefined) - state.defaultBuffer = this._encodeValue(state['default'], reporter, parent).join(); - - if (data.length !== state.defaultBuffer.length) - return false; - - for (i=0; i < data.length; i++) - if (data[i] !== state.defaultBuffer[i]) - return false; - - return true; -}; - -// Utility methods - -function encodeTag(tag, primitive, cls, reporter) { - var res; - - if (tag === 'seqof') - tag = 'seq'; - else if (tag === 'setof') - tag = 'set'; - - if (der.tagByName.hasOwnProperty(tag)) - res = der.tagByName[tag]; - else if (typeof tag === 'number' && (tag | 0) === tag) - res = tag; - else - return reporter.error('Unknown tag: ' + tag); - - if (res >= 0x1f) - return reporter.error('Multi-octet tag encoding unsupported'); - - if (!primitive) - res |= 0x20; - - res |= (der.tagClassByName[cls || 'universal'] << 6); - - return res; -} - -},{"../../asn1":3,"buffer":89,"inherits":156}],15:[function(require,module,exports){ -var encoders = exports; - -encoders.der = require('./der'); -encoders.pem = require('./pem'); - -},{"./der":14,"./pem":16}],16:[function(require,module,exports){ -var inherits = require('inherits'); - -var DEREncoder = require('./der'); - -function PEMEncoder(entity) { - DEREncoder.call(this, entity); - this.enc = 'pem'; -}; -inherits(PEMEncoder, DEREncoder); -module.exports = PEMEncoder; - -PEMEncoder.prototype.encode = function encode(data, options) { - var buf = DEREncoder.prototype.encode.call(this, data); - - var p = buf.toString('base64'); - var out = [ '-----BEGIN ' + options.label + '-----' ]; - for (var i = 0; i < p.length; i += 64) - out.push(p.slice(i, i + 64)); - out.push('-----END ' + options.label + '-----'); - return out.join('\n'); -}; - -},{"./der":14,"inherits":156}],17:[function(require,module,exports){ -(function (global){ -'use strict'; - -var objectAssign = require('object-assign'); - -// compare and isBuffer taken from https://github.com/feross/buffer/blob/680e9e5e488f22aac27599a57dc844a6315928dd/index.js -// original notice: - -/*! - * The buffer module from node.js, for the browser. - * - * @author Feross Aboukhadijeh - * @license MIT - */ -function compare(a, b) { - if (a === b) { - return 0; - } - - var x = a.length; - var y = b.length; - - for (var i = 0, len = Math.min(x, y); i < len; ++i) { - if (a[i] !== b[i]) { - x = a[i]; - y = b[i]; - break; - } - } - - if (x < y) { - return -1; - } - if (y < x) { - return 1; - } - return 0; -} -function isBuffer(b) { - if (global.Buffer && typeof global.Buffer.isBuffer === 'function') { - return global.Buffer.isBuffer(b); - } - return !!(b != null && b._isBuffer); -} - -// based on node assert, original notice: -// NB: The URL to the CommonJS spec is kept just for tradition. -// node-assert has evolved a lot since then, both in API and behavior. - -// http://wiki.commonjs.org/wiki/Unit_Testing/1.0 -// -// THIS IS NOT TESTED NOR LIKELY TO WORK OUTSIDE V8! -// -// Originally from narwhal.js (http://narwhaljs.org) -// Copyright (c) 2009 Thomas Robinson <280north.com> -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the 'Software'), to -// deal in the Software without restriction, including without limitation the -// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or -// sell copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN -// ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -var util = require('util/'); -var hasOwn = Object.prototype.hasOwnProperty; -var pSlice = Array.prototype.slice; -var functionsHaveNames = (function () { - return function foo() {}.name === 'foo'; -}()); -function pToString (obj) { - return Object.prototype.toString.call(obj); -} -function isView(arrbuf) { - if (isBuffer(arrbuf)) { - return false; - } - if (typeof global.ArrayBuffer !== 'function') { - return false; - } - if (typeof ArrayBuffer.isView === 'function') { - return ArrayBuffer.isView(arrbuf); - } - if (!arrbuf) { - return false; - } - if (arrbuf instanceof DataView) { - return true; - } - if (arrbuf.buffer && arrbuf.buffer instanceof ArrayBuffer) { - return true; - } - return false; -} -// 1. The assert module provides functions that throw -// AssertionError's when particular conditions are not met. The -// assert module must conform to the following interface. - -var assert = module.exports = ok; - -// 2. The AssertionError is defined in assert. -// new assert.AssertionError({ message: message, -// actual: actual, -// expected: expected }) - -var regex = /\s*function\s+([^\(\s]*)\s*/; -// based on https://github.com/ljharb/function.prototype.name/blob/adeeeec8bfcc6068b187d7d9fb3d5bb1d3a30899/implementation.js -function getName(func) { - if (!util.isFunction(func)) { - return; - } - if (functionsHaveNames) { - return func.name; - } - var str = func.toString(); - var match = str.match(regex); - return match && match[1]; -} -assert.AssertionError = function AssertionError(options) { - this.name = 'AssertionError'; - this.actual = options.actual; - this.expected = options.expected; - this.operator = options.operator; - if (options.message) { - this.message = options.message; - this.generatedMessage = false; - } else { - this.message = getMessage(this); - this.generatedMessage = true; - } - var stackStartFunction = options.stackStartFunction || fail; - if (Error.captureStackTrace) { - Error.captureStackTrace(this, stackStartFunction); - } else { - // non v8 browsers so we can have a stacktrace - var err = new Error(); - if (err.stack) { - var out = err.stack; - - // try to strip useless frames - var fn_name = getName(stackStartFunction); - var idx = out.indexOf('\n' + fn_name); - if (idx >= 0) { - // once we have located the function frame - // we need to strip out everything before it (and its line) - var next_line = out.indexOf('\n', idx + 1); - out = out.substring(next_line + 1); - } - - this.stack = out; - } - } -}; - -// assert.AssertionError instanceof Error -util.inherits(assert.AssertionError, Error); - -function truncate(s, n) { - if (typeof s === 'string') { - return s.length < n ? s : s.slice(0, n); - } else { - return s; - } -} -function inspect(something) { - if (functionsHaveNames || !util.isFunction(something)) { - return util.inspect(something); - } - var rawname = getName(something); - var name = rawname ? ': ' + rawname : ''; - return '[Function' + name + ']'; -} -function getMessage(self) { - return truncate(inspect(self.actual), 128) + ' ' + - self.operator + ' ' + - truncate(inspect(self.expected), 128); -} - -// At present only the three keys mentioned above are used and -// understood by the spec. Implementations or sub modules can pass -// other keys to the AssertionError's constructor - they will be -// ignored. - -// 3. All of the following functions must throw an AssertionError -// when a corresponding condition is not met, with a message that -// may be undefined if not provided. All assertion methods provide -// both the actual and expected values to the assertion error for -// display purposes. - -function fail(actual, expected, message, operator, stackStartFunction) { - throw new assert.AssertionError({ - message: message, - actual: actual, - expected: expected, - operator: operator, - stackStartFunction: stackStartFunction - }); -} - -// EXTENSION! allows for well behaved errors defined elsewhere. -assert.fail = fail; - -// 4. Pure assertion tests whether a value is truthy, as determined -// by !!guard. -// assert.ok(guard, message_opt); -// This statement is equivalent to assert.equal(true, !!guard, -// message_opt);. To test strictly for the value true, use -// assert.strictEqual(true, guard, message_opt);. - -function ok(value, message) { - if (!value) fail(value, true, message, '==', assert.ok); -} -assert.ok = ok; - -// 5. The equality assertion tests shallow, coercive equality with -// ==. -// assert.equal(actual, expected, message_opt); - -assert.equal = function equal(actual, expected, message) { - if (actual != expected) fail(actual, expected, message, '==', assert.equal); -}; - -// 6. The non-equality assertion tests for whether two objects are not equal -// with != assert.notEqual(actual, expected, message_opt); - -assert.notEqual = function notEqual(actual, expected, message) { - if (actual == expected) { - fail(actual, expected, message, '!=', assert.notEqual); - } -}; - -// 7. The equivalence assertion tests a deep equality relation. -// assert.deepEqual(actual, expected, message_opt); - -assert.deepEqual = function deepEqual(actual, expected, message) { - if (!_deepEqual(actual, expected, false)) { - fail(actual, expected, message, 'deepEqual', assert.deepEqual); - } -}; - -assert.deepStrictEqual = function deepStrictEqual(actual, expected, message) { - if (!_deepEqual(actual, expected, true)) { - fail(actual, expected, message, 'deepStrictEqual', assert.deepStrictEqual); - } -}; - -function _deepEqual(actual, expected, strict, memos) { - // 7.1. All identical values are equivalent, as determined by ===. - if (actual === expected) { - return true; - } else if (isBuffer(actual) && isBuffer(expected)) { - return compare(actual, expected) === 0; - - // 7.2. If the expected value is a Date object, the actual value is - // equivalent if it is also a Date object that refers to the same time. - } else if (util.isDate(actual) && util.isDate(expected)) { - return actual.getTime() === expected.getTime(); - - // 7.3 If the expected value is a RegExp object, the actual value is - // equivalent if it is also a RegExp object with the same source and - // properties (`global`, `multiline`, `lastIndex`, `ignoreCase`). - } else if (util.isRegExp(actual) && util.isRegExp(expected)) { - return actual.source === expected.source && - actual.global === expected.global && - actual.multiline === expected.multiline && - actual.lastIndex === expected.lastIndex && - actual.ignoreCase === expected.ignoreCase; - - // 7.4. Other pairs that do not both pass typeof value == 'object', - // equivalence is determined by ==. - } else if ((actual === null || typeof actual !== 'object') && - (expected === null || typeof expected !== 'object')) { - return strict ? actual === expected : actual == expected; - - // If both values are instances of typed arrays, wrap their underlying - // ArrayBuffers in a Buffer each to increase performance - // This optimization requires the arrays to have the same type as checked by - // Object.prototype.toString (aka pToString). Never perform binary - // comparisons for Float*Arrays, though, since e.g. +0 === -0 but their - // bit patterns are not identical. - } else if (isView(actual) && isView(expected) && - pToString(actual) === pToString(expected) && - !(actual instanceof Float32Array || - actual instanceof Float64Array)) { - return compare(new Uint8Array(actual.buffer), - new Uint8Array(expected.buffer)) === 0; - - // 7.5 For all other Object pairs, including Array objects, equivalence is - // determined by having the same number of owned properties (as verified - // with Object.prototype.hasOwnProperty.call), the same set of keys - // (although not necessarily the same order), equivalent values for every - // corresponding key, and an identical 'prototype' property. Note: this - // accounts for both named and indexed properties on Arrays. - } else if (isBuffer(actual) !== isBuffer(expected)) { - return false; - } else { - memos = memos || {actual: [], expected: []}; - - var actualIndex = memos.actual.indexOf(actual); - if (actualIndex !== -1) { - if (actualIndex === memos.expected.indexOf(expected)) { - return true; - } - } - - memos.actual.push(actual); - memos.expected.push(expected); - - return objEquiv(actual, expected, strict, memos); - } -} - -function isArguments(object) { - return Object.prototype.toString.call(object) == '[object Arguments]'; -} - -function objEquiv(a, b, strict, actualVisitedObjects) { - if (a === null || a === undefined || b === null || b === undefined) - return false; - // if one is a primitive, the other must be same - if (util.isPrimitive(a) || util.isPrimitive(b)) - return a === b; - if (strict && Object.getPrototypeOf(a) !== Object.getPrototypeOf(b)) - return false; - var aIsArgs = isArguments(a); - var bIsArgs = isArguments(b); - if ((aIsArgs && !bIsArgs) || (!aIsArgs && bIsArgs)) - return false; - if (aIsArgs) { - a = pSlice.call(a); - b = pSlice.call(b); - return _deepEqual(a, b, strict); - } - var ka = objectKeys(a); - var kb = objectKeys(b); - var key, i; - // having the same number of owned properties (keys incorporates - // hasOwnProperty) - if (ka.length !== kb.length) - return false; - //the same set of keys (although not necessarily the same order), - ka.sort(); - kb.sort(); - //~~~cheap key test - for (i = ka.length - 1; i >= 0; i--) { - if (ka[i] !== kb[i]) - return false; - } - //equivalent values for every corresponding key, and - //~~~possibly expensive deep test - for (i = ka.length - 1; i >= 0; i--) { - key = ka[i]; - if (!_deepEqual(a[key], b[key], strict, actualVisitedObjects)) - return false; - } - return true; -} - -// 8. The non-equivalence assertion tests for any deep inequality. -// assert.notDeepEqual(actual, expected, message_opt); - -assert.notDeepEqual = function notDeepEqual(actual, expected, message) { - if (_deepEqual(actual, expected, false)) { - fail(actual, expected, message, 'notDeepEqual', assert.notDeepEqual); - } -}; - -assert.notDeepStrictEqual = notDeepStrictEqual; -function notDeepStrictEqual(actual, expected, message) { - if (_deepEqual(actual, expected, true)) { - fail(actual, expected, message, 'notDeepStrictEqual', notDeepStrictEqual); - } -} - - -// 9. The strict equality assertion tests strict equality, as determined by ===. -// assert.strictEqual(actual, expected, message_opt); - -assert.strictEqual = function strictEqual(actual, expected, message) { - if (actual !== expected) { - fail(actual, expected, message, '===', assert.strictEqual); - } -}; - -// 10. The strict non-equality assertion tests for strict inequality, as -// determined by !==. assert.notStrictEqual(actual, expected, message_opt); - -assert.notStrictEqual = function notStrictEqual(actual, expected, message) { - if (actual === expected) { - fail(actual, expected, message, '!==', assert.notStrictEqual); - } -}; - -function expectedException(actual, expected) { - if (!actual || !expected) { - return false; - } - - if (Object.prototype.toString.call(expected) == '[object RegExp]') { - return expected.test(actual); - } - - try { - if (actual instanceof expected) { - return true; - } - } catch (e) { - // Ignore. The instanceof check doesn't work for arrow functions. - } - - if (Error.isPrototypeOf(expected)) { - return false; - } - - return expected.call({}, actual) === true; -} - -function _tryBlock(block) { - var error; - try { - block(); - } catch (e) { - error = e; - } - return error; -} - -function _throws(shouldThrow, block, expected, message) { - var actual; - - if (typeof block !== 'function') { - throw new TypeError('"block" argument must be a function'); - } - - if (typeof expected === 'string') { - message = expected; - expected = null; - } - - actual = _tryBlock(block); - - message = (expected && expected.name ? ' (' + expected.name + ').' : '.') + - (message ? ' ' + message : '.'); - - if (shouldThrow && !actual) { - fail(actual, expected, 'Missing expected exception' + message); - } - - var userProvidedMessage = typeof message === 'string'; - var isUnwantedException = !shouldThrow && util.isError(actual); - var isUnexpectedException = !shouldThrow && actual && !expected; - - if ((isUnwantedException && - userProvidedMessage && - expectedException(actual, expected)) || - isUnexpectedException) { - fail(actual, expected, 'Got unwanted exception' + message); - } - - if ((shouldThrow && actual && expected && - !expectedException(actual, expected)) || (!shouldThrow && actual)) { - throw actual; - } -} - -// 11. Expected to throw an error: -// assert.throws(block, Error_opt, message_opt); - -assert.throws = function(block, /*optional*/error, /*optional*/message) { - _throws(true, block, error, message); -}; - -// EXTENSION! This is annoying to write outside this module. -assert.doesNotThrow = function(block, /*optional*/error, /*optional*/message) { - _throws(false, block, error, message); -}; - -assert.ifError = function(err) { if (err) throw err; }; - -// Expose a strict only variant of assert -function strict(value, message) { - if (!value) fail(value, true, message, '==', strict); -} -assert.strict = objectAssign(strict, assert, { - equal: assert.strictEqual, - deepEqual: assert.deepStrictEqual, - notEqual: assert.notStrictEqual, - notDeepEqual: assert.notDeepStrictEqual -}); -assert.strict.strict = assert.strict; - -var objectKeys = Object.keys || function (obj) { - var keys = []; - for (var key in obj) { - if (hasOwn.call(obj, key)) keys.push(key); - } - return keys; -}; - -}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) -},{"object-assign":168,"util/":20}],18:[function(require,module,exports){ -if (typeof Object.create === 'function') { - // implementation from standard node.js 'util' module - module.exports = function inherits(ctor, superCtor) { - ctor.super_ = superCtor - ctor.prototype = Object.create(superCtor.prototype, { - constructor: { - value: ctor, - enumerable: false, - writable: true, - configurable: true - } - }); - }; -} else { - // old school shim for old browsers - module.exports = function inherits(ctor, superCtor) { - ctor.super_ = superCtor - var TempCtor = function () {} - TempCtor.prototype = superCtor.prototype - ctor.prototype = new TempCtor() - ctor.prototype.constructor = ctor - } -} - -},{}],19:[function(require,module,exports){ -module.exports = function isBuffer(arg) { - return arg && typeof arg === 'object' - && typeof arg.copy === 'function' - && typeof arg.fill === 'function' - && typeof arg.readUInt8 === 'function'; -} -},{}],20:[function(require,module,exports){ -(function (process,global){ -// Copyright Joyent, Inc. and other Node contributors. -// -// Permission is hereby granted, free of charge, to any person obtaining a -// copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to permit -// persons to whom the Software is furnished to do so, subject to the -// following conditions: -// -// The above copyright notice and this permission notice shall be included -// in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN -// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR -// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE -// USE OR OTHER DEALINGS IN THE SOFTWARE. - -var formatRegExp = /%[sdj%]/g; -exports.format = function(f) { - if (!isString(f)) { - var objects = []; - for (var i = 0; i < arguments.length; i++) { - objects.push(inspect(arguments[i])); - } - return objects.join(' '); - } - - var i = 1; - var args = arguments; - var len = args.length; - var str = String(f).replace(formatRegExp, function(x) { - if (x === '%%') return '%'; - if (i >= len) return x; - switch (x) { - case '%s': return String(args[i++]); - case '%d': return Number(args[i++]); - case '%j': - try { - return JSON.stringify(args[i++]); - } catch (_) { - return '[Circular]'; - } - default: - return x; - } - }); - for (var x = args[i]; i < len; x = args[++i]) { - if (isNull(x) || !isObject(x)) { - str += ' ' + x; - } else { - str += ' ' + inspect(x); - } - } - return str; -}; - - -// Mark that a method should not be used. -// Returns a modified function which warns once by default. -// If --no-deprecation is set, then it is a no-op. -exports.deprecate = function(fn, msg) { - // Allow for deprecating things in the process of starting up. - if (isUndefined(global.process)) { - return function() { - return exports.deprecate(fn, msg).apply(this, arguments); - }; - } - - if (process.noDeprecation === true) { - return fn; - } - - var warned = false; - function deprecated() { - if (!warned) { - if (process.throwDeprecation) { - throw new Error(msg); - } else if (process.traceDeprecation) { - console.trace(msg); - } else { - console.error(msg); - } - warned = true; - } - return fn.apply(this, arguments); - } - - return deprecated; -}; - - -var debugs = {}; -var debugEnviron; -exports.debuglog = function(set) { - if (isUndefined(debugEnviron)) - debugEnviron = process.env.NODE_DEBUG || ''; - set = set.toUpperCase(); - if (!debugs[set]) { - if (new RegExp('\\b' + set + '\\b', 'i').test(debugEnviron)) { - var pid = process.pid; - debugs[set] = function() { - var msg = exports.format.apply(exports, arguments); - console.error('%s %d: %s', set, pid, msg); - }; - } else { - debugs[set] = function() {}; - } - } - return debugs[set]; -}; - - -/** - * Echos the value of a value. Trys to print the value out - * in the best way possible given the different types. - * - * @param {Object} obj The object to print out. - * @param {Object} opts Optional options object that alters the output. - */ -/* legacy: obj, showHidden, depth, colors*/ -function inspect(obj, opts) { - // default options - var ctx = { - seen: [], - stylize: stylizeNoColor - }; - // legacy... - if (arguments.length >= 3) ctx.depth = arguments[2]; - if (arguments.length >= 4) ctx.colors = arguments[3]; - if (isBoolean(opts)) { - // legacy... - ctx.showHidden = opts; - } else if (opts) { - // got an "options" object - exports._extend(ctx, opts); - } - // set default options - if (isUndefined(ctx.showHidden)) ctx.showHidden = false; - if (isUndefined(ctx.depth)) ctx.depth = 2; - if (isUndefined(ctx.colors)) ctx.colors = false; - if (isUndefined(ctx.customInspect)) ctx.customInspect = true; - if (ctx.colors) ctx.stylize = stylizeWithColor; - return formatValue(ctx, obj, ctx.depth); -} -exports.inspect = inspect; - - -// http://en.wikipedia.org/wiki/ANSI_escape_code#graphics -inspect.colors = { - 'bold' : [1, 22], - 'italic' : [3, 23], - 'underline' : [4, 24], - 'inverse' : [7, 27], - 'white' : [37, 39], - 'grey' : [90, 39], - 'black' : [30, 39], - 'blue' : [34, 39], - 'cyan' : [36, 39], - 'green' : [32, 39], - 'magenta' : [35, 39], - 'red' : [31, 39], - 'yellow' : [33, 39] -}; - -// Don't use 'blue' not visible on cmd.exe -inspect.styles = { - 'special': 'cyan', - 'number': 'yellow', - 'boolean': 'yellow', - 'undefined': 'grey', - 'null': 'bold', - 'string': 'green', - 'date': 'magenta', - // "name": intentionally not styling - 'regexp': 'red' -}; - - -function stylizeWithColor(str, styleType) { - var style = inspect.styles[styleType]; - - if (style) { - return '\u001b[' + inspect.colors[style][0] + 'm' + str + - '\u001b[' + inspect.colors[style][1] + 'm'; - } else { - return str; - } -} - - -function stylizeNoColor(str, styleType) { - return str; -} - - -function arrayToHash(array) { - var hash = {}; - - array.forEach(function(val, idx) { - hash[val] = true; - }); - - return hash; -} - - -function formatValue(ctx, value, recurseTimes) { - // Provide a hook for user-specified inspect functions. - // Check that value is an object with an inspect function on it - if (ctx.customInspect && - value && - isFunction(value.inspect) && - // Filter out the util module, it's inspect function is special - value.inspect !== exports.inspect && - // Also filter out any prototype objects using the circular check. - !(value.constructor && value.constructor.prototype === value)) { - var ret = value.inspect(recurseTimes, ctx); - if (!isString(ret)) { - ret = formatValue(ctx, ret, recurseTimes); - } - return ret; - } - - // Primitive types cannot have properties - var primitive = formatPrimitive(ctx, value); - if (primitive) { - return primitive; - } - - // Look up the keys of the object. - var keys = Object.keys(value); - var visibleKeys = arrayToHash(keys); - - if (ctx.showHidden) { - keys = Object.getOwnPropertyNames(value); - } - - // IE doesn't make error fields non-enumerable - // http://msdn.microsoft.com/en-us/library/ie/dww52sbt(v=vs.94).aspx - if (isError(value) - && (keys.indexOf('message') >= 0 || keys.indexOf('description') >= 0)) { - return formatError(value); - } - - // Some type of object without properties can be shortcutted. - if (keys.length === 0) { - if (isFunction(value)) { - var name = value.name ? ': ' + value.name : ''; - return ctx.stylize('[Function' + name + ']', 'special'); - } - if (isRegExp(value)) { - return ctx.stylize(RegExp.prototype.toString.call(value), 'regexp'); - } - if (isDate(value)) { - return ctx.stylize(Date.prototype.toString.call(value), 'date'); - } - if (isError(value)) { - return formatError(value); - } - } - - var base = '', array = false, braces = ['{', '}']; - - // Make Array say that they are Array - if (isArray(value)) { - array = true; - braces = ['[', ']']; - } - - // Make functions say that they are functions - if (isFunction(value)) { - var n = value.name ? ': ' + value.name : ''; - base = ' [Function' + n + ']'; - } - - // Make RegExps say that they are RegExps - if (isRegExp(value)) { - base = ' ' + RegExp.prototype.toString.call(value); - } - - // Make dates with properties first say the date - if (isDate(value)) { - base = ' ' + Date.prototype.toUTCString.call(value); - } - - // Make error with message first say the error - if (isError(value)) { - base = ' ' + formatError(value); - } - - if (keys.length === 0 && (!array || value.length == 0)) { - return braces[0] + base + braces[1]; - } - - if (recurseTimes < 0) { - if (isRegExp(value)) { - return ctx.stylize(RegExp.prototype.toString.call(value), 'regexp'); - } else { - return ctx.stylize('[Object]', 'special'); - } - } - - ctx.seen.push(value); - - var output; - if (array) { - output = formatArray(ctx, value, recurseTimes, visibleKeys, keys); - } else { - output = keys.map(function(key) { - return formatProperty(ctx, value, recurseTimes, visibleKeys, key, array); - }); - } - - ctx.seen.pop(); - - return reduceToSingleString(output, base, braces); -} - - -function formatPrimitive(ctx, value) { - if (isUndefined(value)) - return ctx.stylize('undefined', 'undefined'); - if (isString(value)) { - var simple = '\'' + JSON.stringify(value).replace(/^"|"$/g, '') - .replace(/'/g, "\\'") - .replace(/\\"/g, '"') + '\''; - return ctx.stylize(simple, 'string'); - } - if (isNumber(value)) - return ctx.stylize('' + value, 'number'); - if (isBoolean(value)) - return ctx.stylize('' + value, 'boolean'); - // For some reason typeof null is "object", so special case here. - if (isNull(value)) - return ctx.stylize('null', 'null'); -} - - -function formatError(value) { - return '[' + Error.prototype.toString.call(value) + ']'; -} - - -function formatArray(ctx, value, recurseTimes, visibleKeys, keys) { - var output = []; - for (var i = 0, l = value.length; i < l; ++i) { - if (hasOwnProperty(value, String(i))) { - output.push(formatProperty(ctx, value, recurseTimes, visibleKeys, - String(i), true)); - } else { - output.push(''); - } - } - keys.forEach(function(key) { - if (!key.match(/^\d+$/)) { - output.push(formatProperty(ctx, value, recurseTimes, visibleKeys, - key, true)); - } - }); - return output; -} - - -function formatProperty(ctx, value, recurseTimes, visibleKeys, key, array) { - var name, str, desc; - desc = Object.getOwnPropertyDescriptor(value, key) || { value: value[key] }; - if (desc.get) { - if (desc.set) { - str = ctx.stylize('[Getter/Setter]', 'special'); - } else { - str = ctx.stylize('[Getter]', 'special'); - } - } else { - if (desc.set) { - str = ctx.stylize('[Setter]', 'special'); - } - } - if (!hasOwnProperty(visibleKeys, key)) { - name = '[' + key + ']'; - } - if (!str) { - if (ctx.seen.indexOf(desc.value) < 0) { - if (isNull(recurseTimes)) { - str = formatValue(ctx, desc.value, null); - } else { - str = formatValue(ctx, desc.value, recurseTimes - 1); - } - if (str.indexOf('\n') > -1) { - if (array) { - str = str.split('\n').map(function(line) { - return ' ' + line; - }).join('\n').substr(2); - } else { - str = '\n' + str.split('\n').map(function(line) { - return ' ' + line; - }).join('\n'); - } - } - } else { - str = ctx.stylize('[Circular]', 'special'); - } - } - if (isUndefined(name)) { - if (array && key.match(/^\d+$/)) { - return str; - } - name = JSON.stringify('' + key); - if (name.match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)) { - name = name.substr(1, name.length - 2); - name = ctx.stylize(name, 'name'); - } else { - name = name.replace(/'/g, "\\'") - .replace(/\\"/g, '"') - .replace(/(^"|"$)/g, "'"); - name = ctx.stylize(name, 'string'); - } - } - - return name + ': ' + str; -} - - -function reduceToSingleString(output, base, braces) { - var numLinesEst = 0; - var length = output.reduce(function(prev, cur) { - numLinesEst++; - if (cur.indexOf('\n') >= 0) numLinesEst++; - return prev + cur.replace(/\u001b\[\d\d?m/g, '').length + 1; - }, 0); - - if (length > 60) { - return braces[0] + - (base === '' ? '' : base + '\n ') + - ' ' + - output.join(',\n ') + - ' ' + - braces[1]; - } - - return braces[0] + base + ' ' + output.join(', ') + ' ' + braces[1]; -} - - -// NOTE: These type checking functions intentionally don't use `instanceof` -// because it is fragile and can be easily faked with `Object.create()`. -function isArray(ar) { - return Array.isArray(ar); -} -exports.isArray = isArray; - -function isBoolean(arg) { - return typeof arg === 'boolean'; -} -exports.isBoolean = isBoolean; - -function isNull(arg) { - return arg === null; -} -exports.isNull = isNull; - -function isNullOrUndefined(arg) { - return arg == null; -} -exports.isNullOrUndefined = isNullOrUndefined; - -function isNumber(arg) { - return typeof arg === 'number'; -} -exports.isNumber = isNumber; - -function isString(arg) { - return typeof arg === 'string'; -} -exports.isString = isString; - -function isSymbol(arg) { - return typeof arg === 'symbol'; -} -exports.isSymbol = isSymbol; - -function isUndefined(arg) { - return arg === void 0; -} -exports.isUndefined = isUndefined; - -function isRegExp(re) { - return isObject(re) && objectToString(re) === '[object RegExp]'; -} -exports.isRegExp = isRegExp; - -function isObject(arg) { - return typeof arg === 'object' && arg !== null; -} -exports.isObject = isObject; - -function isDate(d) { - return isObject(d) && objectToString(d) === '[object Date]'; -} -exports.isDate = isDate; - -function isError(e) { - return isObject(e) && - (objectToString(e) === '[object Error]' || e instanceof Error); -} -exports.isError = isError; - -function isFunction(arg) { - return typeof arg === 'function'; -} -exports.isFunction = isFunction; - -function isPrimitive(arg) { - return arg === null || - typeof arg === 'boolean' || - typeof arg === 'number' || - typeof arg === 'string' || - typeof arg === 'symbol' || // ES6 symbol - typeof arg === 'undefined'; -} -exports.isPrimitive = isPrimitive; - -exports.isBuffer = require('./support/isBuffer'); - -function objectToString(o) { - return Object.prototype.toString.call(o); -} - - -function pad(n) { - return n < 10 ? '0' + n.toString(10) : n.toString(10); -} - - -var months = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', - 'Oct', 'Nov', 'Dec']; - -// 26 Feb 16:19:34 -function timestamp() { - var d = new Date(); - var time = [pad(d.getHours()), - pad(d.getMinutes()), - pad(d.getSeconds())].join(':'); - return [d.getDate(), months[d.getMonth()], time].join(' '); -} - - -// log is just a thin wrapper to console.log that prepends a timestamp -exports.log = function() { - console.log('%s - %s', timestamp(), exports.format.apply(exports, arguments)); -}; - - -/** - * Inherit the prototype methods from one constructor into another. - * - * The Function.prototype.inherits from lang.js rewritten as a standalone - * function (not on Function.prototype). NOTE: If this file is to be loaded - * during bootstrapping this function needs to be rewritten using some native - * functions as prototype setup using normal JavaScript does not work as - * expected during bootstrapping (see mirror.js in r114903). - * - * @param {function} ctor Constructor function which needs to inherit the - * prototype. - * @param {function} superCtor Constructor function to inherit prototype from. - */ -exports.inherits = require('inherits'); - -exports._extend = function(origin, add) { - // Don't do anything if add isn't an object - if (!add || !isObject(add)) return origin; - - var keys = Object.keys(add); - var i = keys.length; - while (i--) { - origin[keys[i]] = add[keys[i]]; - } - return origin; -}; - -function hasOwnProperty(obj, prop) { - return Object.prototype.hasOwnProperty.call(obj, prop); -} - -}).call(this,require('_process'),typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) -},{"./support/isBuffer":19,"_process":197,"inherits":18}],21:[function(require,module,exports){ -module.exports = require('./lib/axios'); -},{"./lib/axios":23}],22:[function(require,module,exports){ -'use strict'; - -var utils = require('./../utils'); -var settle = require('./../core/settle'); -var cookies = require('./../helpers/cookies'); -var buildURL = require('./../helpers/buildURL'); -var buildFullPath = require('../core/buildFullPath'); -var parseHeaders = require('./../helpers/parseHeaders'); -var isURLSameOrigin = require('./../helpers/isURLSameOrigin'); -var createError = require('../core/createError'); - -module.exports = function xhrAdapter(config) { - return new Promise(function dispatchXhrRequest(resolve, reject) { - var requestData = config.data; - var requestHeaders = config.headers; - var responseType = config.responseType; - - if (utils.isFormData(requestData)) { - delete requestHeaders['Content-Type']; // Let the browser set it - } - - var request = new XMLHttpRequest(); - - // HTTP basic authentication - if (config.auth) { - var username = config.auth.username || ''; - var password = config.auth.password ? unescape(encodeURIComponent(config.auth.password)) : ''; - requestHeaders.Authorization = 'Basic ' + btoa(username + ':' + password); - } - - var fullPath = buildFullPath(config.baseURL, config.url); - request.open(config.method.toUpperCase(), buildURL(fullPath, config.params, config.paramsSerializer), true); - - // Set the request timeout in MS - request.timeout = config.timeout; - - function onloadend() { - if (!request) { - return; - } - // Prepare the response - var responseHeaders = 'getAllResponseHeaders' in request ? parseHeaders(request.getAllResponseHeaders()) : null; - var responseData = !responseType || responseType === 'text' || responseType === 'json' ? - request.responseText : request.response; - var response = { - data: responseData, - status: request.status, - statusText: request.statusText, - headers: responseHeaders, - config: config, - request: request - }; - - settle(resolve, reject, response); - - // Clean up request - request = null; - } - - if ('onloadend' in request) { - // Use onloadend if available - request.onloadend = onloadend; - } else { - // Listen for ready state to emulate onloadend - request.onreadystatechange = function handleLoad() { - if (!request || request.readyState !== 4) { - return; - } - - // The request errored out and we didn't get a response, this will be - // handled by onerror instead - // With one exception: request that using file: protocol, most browsers - // will return status as 0 even though it's a successful request - if (request.status === 0 && !(request.responseURL && request.responseURL.indexOf('file:') === 0)) { - return; - } - // readystate handler is calling before onerror or ontimeout handlers, - // so we should call onloadend on the next 'tick' - setTimeout(onloadend); - }; - } - - // Handle browser request cancellation (as opposed to a manual cancellation) - request.onabort = function handleAbort() { - if (!request) { - return; - } - - reject(createError('Request aborted', config, 'ECONNABORTED', request)); - - // Clean up request - request = null; - }; - - // Handle low level network errors - request.onerror = function handleError() { - // Real errors are hidden from us by the browser - // onerror should only fire if it's a network error - reject(createError('Network Error', config, null, request)); - - // Clean up request - request = null; - }; - - // Handle timeout - request.ontimeout = function handleTimeout() { - var timeoutErrorMessage = 'timeout of ' + config.timeout + 'ms exceeded'; - if (config.timeoutErrorMessage) { - timeoutErrorMessage = config.timeoutErrorMessage; - } - reject(createError( - timeoutErrorMessage, - config, - config.transitional && config.transitional.clarifyTimeoutError ? 'ETIMEDOUT' : 'ECONNABORTED', - request)); - - // Clean up request - request = null; - }; - - // Add xsrf header - // This is only done if running in a standard browser environment. - // Specifically not if we're in a web worker, or react-native. - if (utils.isStandardBrowserEnv()) { - // Add xsrf header - var xsrfValue = (config.withCredentials || isURLSameOrigin(fullPath)) && config.xsrfCookieName ? - cookies.read(config.xsrfCookieName) : - undefined; - - if (xsrfValue) { - requestHeaders[config.xsrfHeaderName] = xsrfValue; - } - } - - // Add headers to the request - if ('setRequestHeader' in request) { - utils.forEach(requestHeaders, function setRequestHeader(val, key) { - if (typeof requestData === 'undefined' && key.toLowerCase() === 'content-type') { - // Remove Content-Type if data is undefined - delete requestHeaders[key]; - } else { - // Otherwise add header to the request - request.setRequestHeader(key, val); - } - }); - } - - // Add withCredentials to request if needed - if (!utils.isUndefined(config.withCredentials)) { - request.withCredentials = !!config.withCredentials; - } - - // Add responseType to request if needed - if (responseType && responseType !== 'json') { - request.responseType = config.responseType; - } - - // Handle progress if needed - if (typeof config.onDownloadProgress === 'function') { - request.addEventListener('progress', config.onDownloadProgress); - } - - // Not all browsers support upload events - if (typeof config.onUploadProgress === 'function' && request.upload) { - request.upload.addEventListener('progress', config.onUploadProgress); - } - - if (config.cancelToken) { - // Handle cancellation - config.cancelToken.promise.then(function onCanceled(cancel) { - if (!request) { - return; - } - - request.abort(); - reject(cancel); - // Clean up request - request = null; - }); - } - - if (!requestData) { - requestData = null; - } - - // Send the request - request.send(requestData); - }); -}; - -},{"../core/buildFullPath":29,"../core/createError":30,"./../core/settle":34,"./../helpers/buildURL":38,"./../helpers/cookies":40,"./../helpers/isURLSameOrigin":43,"./../helpers/parseHeaders":45,"./../utils":48}],23:[function(require,module,exports){ -'use strict'; - -var utils = require('./utils'); -var bind = require('./helpers/bind'); -var Axios = require('./core/Axios'); -var mergeConfig = require('./core/mergeConfig'); -var defaults = require('./defaults'); - -/** - * Create an instance of Axios - * - * @param {Object} defaultConfig The default config for the instance - * @return {Axios} A new instance of Axios - */ -function createInstance(defaultConfig) { - var context = new Axios(defaultConfig); - var instance = bind(Axios.prototype.request, context); - - // Copy axios.prototype to instance - utils.extend(instance, Axios.prototype, context); - - // Copy context to instance - utils.extend(instance, context); - - return instance; -} - -// Create the default instance to be exported -var axios = createInstance(defaults); - -// Expose Axios class to allow class inheritance -axios.Axios = Axios; - -// Factory for creating new instances -axios.create = function create(instanceConfig) { - return createInstance(mergeConfig(axios.defaults, instanceConfig)); -}; - -// Expose Cancel & CancelToken -axios.Cancel = require('./cancel/Cancel'); -axios.CancelToken = require('./cancel/CancelToken'); -axios.isCancel = require('./cancel/isCancel'); - -// Expose all/spread -axios.all = function all(promises) { - return Promise.all(promises); -}; -axios.spread = require('./helpers/spread'); - -// Expose isAxiosError -axios.isAxiosError = require('./helpers/isAxiosError'); - -module.exports = axios; - -// Allow use of default import syntax in TypeScript -module.exports.default = axios; - -},{"./cancel/Cancel":24,"./cancel/CancelToken":25,"./cancel/isCancel":26,"./core/Axios":27,"./core/mergeConfig":33,"./defaults":36,"./helpers/bind":37,"./helpers/isAxiosError":42,"./helpers/spread":46,"./utils":48}],24:[function(require,module,exports){ -'use strict'; - -/** - * A `Cancel` is an object that is thrown when an operation is canceled. - * - * @class - * @param {string=} message The message. - */ -function Cancel(message) { - this.message = message; -} - -Cancel.prototype.toString = function toString() { - return 'Cancel' + (this.message ? ': ' + this.message : ''); -}; - -Cancel.prototype.__CANCEL__ = true; - -module.exports = Cancel; - -},{}],25:[function(require,module,exports){ -'use strict'; - -var Cancel = require('./Cancel'); - -/** - * A `CancelToken` is an object that can be used to request cancellation of an operation. - * - * @class - * @param {Function} executor The executor function. - */ -function CancelToken(executor) { - if (typeof executor !== 'function') { - throw new TypeError('executor must be a function.'); - } - - var resolvePromise; - this.promise = new Promise(function promiseExecutor(resolve) { - resolvePromise = resolve; - }); - - var token = this; - executor(function cancel(message) { - if (token.reason) { - // Cancellation has already been requested - return; - } - - token.reason = new Cancel(message); - resolvePromise(token.reason); - }); -} - -/** - * Throws a `Cancel` if cancellation has been requested. - */ -CancelToken.prototype.throwIfRequested = function throwIfRequested() { - if (this.reason) { - throw this.reason; - } -}; - -/** - * Returns an object that contains a new `CancelToken` and a function that, when called, - * cancels the `CancelToken`. - */ -CancelToken.source = function source() { - var cancel; - var token = new CancelToken(function executor(c) { - cancel = c; - }); - return { - token: token, - cancel: cancel - }; -}; - -module.exports = CancelToken; - -},{"./Cancel":24}],26:[function(require,module,exports){ -'use strict'; - -module.exports = function isCancel(value) { - return !!(value && value.__CANCEL__); -}; - -},{}],27:[function(require,module,exports){ -'use strict'; - -var utils = require('./../utils'); -var buildURL = require('../helpers/buildURL'); -var InterceptorManager = require('./InterceptorManager'); -var dispatchRequest = require('./dispatchRequest'); -var mergeConfig = require('./mergeConfig'); -var validator = require('../helpers/validator'); - -var validators = validator.validators; -/** - * Create a new instance of Axios - * - * @param {Object} instanceConfig The default config for the instance - */ -function Axios(instanceConfig) { - this.defaults = instanceConfig; - this.interceptors = { - request: new InterceptorManager(), - response: new InterceptorManager() - }; -} - -/** - * Dispatch a request - * - * @param {Object} config The config specific for this request (merged with this.defaults) - */ -Axios.prototype.request = function request(config) { - /*eslint no-param-reassign:0*/ - // Allow for axios('example/url'[, config]) a la fetch API - if (typeof config === 'string') { - config = arguments[1] || {}; - config.url = arguments[0]; - } else { - config = config || {}; - } - - config = mergeConfig(this.defaults, config); - - // Set config.method - if (config.method) { - config.method = config.method.toLowerCase(); - } else if (this.defaults.method) { - config.method = this.defaults.method.toLowerCase(); - } else { - config.method = 'get'; - } - - var transitional = config.transitional; - - if (transitional !== undefined) { - validator.assertOptions(transitional, { - silentJSONParsing: validators.transitional(validators.boolean, '1.0.0'), - forcedJSONParsing: validators.transitional(validators.boolean, '1.0.0'), - clarifyTimeoutError: validators.transitional(validators.boolean, '1.0.0') - }, false); - } - - // filter out skipped interceptors - var requestInterceptorChain = []; - var synchronousRequestInterceptors = true; - this.interceptors.request.forEach(function unshiftRequestInterceptors(interceptor) { - if (typeof interceptor.runWhen === 'function' && interceptor.runWhen(config) === false) { - return; - } - - synchronousRequestInterceptors = synchronousRequestInterceptors && interceptor.synchronous; - - requestInterceptorChain.unshift(interceptor.fulfilled, interceptor.rejected); - }); - - var responseInterceptorChain = []; - this.interceptors.response.forEach(function pushResponseInterceptors(interceptor) { - responseInterceptorChain.push(interceptor.fulfilled, interceptor.rejected); - }); - - var promise; - - if (!synchronousRequestInterceptors) { - var chain = [dispatchRequest, undefined]; - - Array.prototype.unshift.apply(chain, requestInterceptorChain); - chain = chain.concat(responseInterceptorChain); - - promise = Promise.resolve(config); - while (chain.length) { - promise = promise.then(chain.shift(), chain.shift()); - } - - return promise; - } - - - var newConfig = config; - while (requestInterceptorChain.length) { - var onFulfilled = requestInterceptorChain.shift(); - var onRejected = requestInterceptorChain.shift(); - try { - newConfig = onFulfilled(newConfig); - } catch (error) { - onRejected(error); - break; - } - } - - try { - promise = dispatchRequest(newConfig); - } catch (error) { - return Promise.reject(error); - } - - while (responseInterceptorChain.length) { - promise = promise.then(responseInterceptorChain.shift(), responseInterceptorChain.shift()); - } - - return promise; -}; - -Axios.prototype.getUri = function getUri(config) { - config = mergeConfig(this.defaults, config); - return buildURL(config.url, config.params, config.paramsSerializer).replace(/^\?/, ''); -}; - -// Provide aliases for supported request methods -utils.forEach(['delete', 'get', 'head', 'options'], function forEachMethodNoData(method) { - /*eslint func-names:0*/ - Axios.prototype[method] = function(url, config) { - return this.request(mergeConfig(config || {}, { - method: method, - url: url, - data: (config || {}).data - })); - }; -}); - -utils.forEach(['post', 'put', 'patch'], function forEachMethodWithData(method) { - /*eslint func-names:0*/ - Axios.prototype[method] = function(url, data, config) { - return this.request(mergeConfig(config || {}, { - method: method, - url: url, - data: data - })); - }; -}); - -module.exports = Axios; - -},{"../helpers/buildURL":38,"../helpers/validator":47,"./../utils":48,"./InterceptorManager":28,"./dispatchRequest":31,"./mergeConfig":33}],28:[function(require,module,exports){ -'use strict'; - -var utils = require('./../utils'); - -function InterceptorManager() { - this.handlers = []; -} - -/** - * Add a new interceptor to the stack - * - * @param {Function} fulfilled The function to handle `then` for a `Promise` - * @param {Function} rejected The function to handle `reject` for a `Promise` - * - * @return {Number} An ID used to remove interceptor later - */ -InterceptorManager.prototype.use = function use(fulfilled, rejected, options) { - this.handlers.push({ - fulfilled: fulfilled, - rejected: rejected, - synchronous: options ? options.synchronous : false, - runWhen: options ? options.runWhen : null - }); - return this.handlers.length - 1; -}; - -/** - * Remove an interceptor from the stack - * - * @param {Number} id The ID that was returned by `use` - */ -InterceptorManager.prototype.eject = function eject(id) { - if (this.handlers[id]) { - this.handlers[id] = null; - } -}; - -/** - * Iterate over all the registered interceptors - * - * This method is particularly useful for skipping over any - * interceptors that may have become `null` calling `eject`. - * - * @param {Function} fn The function to call for each interceptor - */ -InterceptorManager.prototype.forEach = function forEach(fn) { - utils.forEach(this.handlers, function forEachHandler(h) { - if (h !== null) { - fn(h); - } - }); -}; - -module.exports = InterceptorManager; - -},{"./../utils":48}],29:[function(require,module,exports){ -'use strict'; - -var isAbsoluteURL = require('../helpers/isAbsoluteURL'); -var combineURLs = require('../helpers/combineURLs'); - -/** - * Creates a new URL by combining the baseURL with the requestedURL, - * only when the requestedURL is not already an absolute URL. - * If the requestURL is absolute, this function returns the requestedURL untouched. - * - * @param {string} baseURL The base URL - * @param {string} requestedURL Absolute or relative URL to combine - * @returns {string} The combined full path - */ -module.exports = function buildFullPath(baseURL, requestedURL) { - if (baseURL && !isAbsoluteURL(requestedURL)) { - return combineURLs(baseURL, requestedURL); - } - return requestedURL; -}; - -},{"../helpers/combineURLs":39,"../helpers/isAbsoluteURL":41}],30:[function(require,module,exports){ -'use strict'; - -var enhanceError = require('./enhanceError'); - -/** - * Create an Error with the specified message, config, error code, request and response. - * - * @param {string} message The error message. - * @param {Object} config The config. - * @param {string} [code] The error code (for example, 'ECONNABORTED'). - * @param {Object} [request] The request. - * @param {Object} [response] The response. - * @returns {Error} The created error. - */ -module.exports = function createError(message, config, code, request, response) { - var error = new Error(message); - return enhanceError(error, config, code, request, response); -}; - -},{"./enhanceError":32}],31:[function(require,module,exports){ -'use strict'; - -var utils = require('./../utils'); -var transformData = require('./transformData'); -var isCancel = require('../cancel/isCancel'); -var defaults = require('../defaults'); - -/** - * Throws a `Cancel` if cancellation has been requested. - */ -function throwIfCancellationRequested(config) { - if (config.cancelToken) { - config.cancelToken.throwIfRequested(); - } -} - -/** - * Dispatch a request to the server using the configured adapter. - * - * @param {object} config The config that is to be used for the request - * @returns {Promise} The Promise to be fulfilled - */ -module.exports = function dispatchRequest(config) { - throwIfCancellationRequested(config); - - // Ensure headers exist - config.headers = config.headers || {}; - - // Transform request data - config.data = transformData.call( - config, - config.data, - config.headers, - config.transformRequest - ); - - // Flatten headers - config.headers = utils.merge( - config.headers.common || {}, - config.headers[config.method] || {}, - config.headers - ); - - utils.forEach( - ['delete', 'get', 'head', 'post', 'put', 'patch', 'common'], - function cleanHeaderConfig(method) { - delete config.headers[method]; - } - ); - - var adapter = config.adapter || defaults.adapter; - - return adapter(config).then(function onAdapterResolution(response) { - throwIfCancellationRequested(config); - - // Transform response data - response.data = transformData.call( - config, - response.data, - response.headers, - config.transformResponse - ); - - return response; - }, function onAdapterRejection(reason) { - if (!isCancel(reason)) { - throwIfCancellationRequested(config); - - // Transform response data - if (reason && reason.response) { - reason.response.data = transformData.call( - config, - reason.response.data, - reason.response.headers, - config.transformResponse - ); - } - } - - return Promise.reject(reason); - }); -}; - -},{"../cancel/isCancel":26,"../defaults":36,"./../utils":48,"./transformData":35}],32:[function(require,module,exports){ -'use strict'; - -/** - * Update an Error with the specified config, error code, and response. - * - * @param {Error} error The error to update. - * @param {Object} config The config. - * @param {string} [code] The error code (for example, 'ECONNABORTED'). - * @param {Object} [request] The request. - * @param {Object} [response] The response. - * @returns {Error} The error. - */ -module.exports = function enhanceError(error, config, code, request, response) { - error.config = config; - if (code) { - error.code = code; - } - - error.request = request; - error.response = response; - error.isAxiosError = true; - - error.toJSON = function toJSON() { - return { - // Standard - message: this.message, - name: this.name, - // Microsoft - description: this.description, - number: this.number, - // Mozilla - fileName: this.fileName, - lineNumber: this.lineNumber, - columnNumber: this.columnNumber, - stack: this.stack, - // Axios - config: this.config, - code: this.code - }; - }; - return error; -}; - -},{}],33:[function(require,module,exports){ -'use strict'; - -var utils = require('../utils'); - -/** - * Config-specific merge-function which creates a new config-object - * by merging two configuration objects together. - * - * @param {Object} config1 - * @param {Object} config2 - * @returns {Object} New object resulting from merging config2 to config1 - */ -module.exports = function mergeConfig(config1, config2) { - // eslint-disable-next-line no-param-reassign - config2 = config2 || {}; - var config = {}; - - var valueFromConfig2Keys = ['url', 'method', 'data']; - var mergeDeepPropertiesKeys = ['headers', 'auth', 'proxy', 'params']; - var defaultToConfig2Keys = [ - 'baseURL', 'transformRequest', 'transformResponse', 'paramsSerializer', - 'timeout', 'timeoutMessage', 'withCredentials', 'adapter', 'responseType', 'xsrfCookieName', - 'xsrfHeaderName', 'onUploadProgress', 'onDownloadProgress', 'decompress', - 'maxContentLength', 'maxBodyLength', 'maxRedirects', 'transport', 'httpAgent', - 'httpsAgent', 'cancelToken', 'socketPath', 'responseEncoding' - ]; - var directMergeKeys = ['validateStatus']; - - function getMergedValue(target, source) { - if (utils.isPlainObject(target) && utils.isPlainObject(source)) { - return utils.merge(target, source); - } else if (utils.isPlainObject(source)) { - return utils.merge({}, source); - } else if (utils.isArray(source)) { - return source.slice(); - } - return source; - } - - function mergeDeepProperties(prop) { - if (!utils.isUndefined(config2[prop])) { - config[prop] = getMergedValue(config1[prop], config2[prop]); - } else if (!utils.isUndefined(config1[prop])) { - config[prop] = getMergedValue(undefined, config1[prop]); - } - } - - utils.forEach(valueFromConfig2Keys, function valueFromConfig2(prop) { - if (!utils.isUndefined(config2[prop])) { - config[prop] = getMergedValue(undefined, config2[prop]); - } - }); - - utils.forEach(mergeDeepPropertiesKeys, mergeDeepProperties); - - utils.forEach(defaultToConfig2Keys, function defaultToConfig2(prop) { - if (!utils.isUndefined(config2[prop])) { - config[prop] = getMergedValue(undefined, config2[prop]); - } else if (!utils.isUndefined(config1[prop])) { - config[prop] = getMergedValue(undefined, config1[prop]); - } - }); - - utils.forEach(directMergeKeys, function merge(prop) { - if (prop in config2) { - config[prop] = getMergedValue(config1[prop], config2[prop]); - } else if (prop in config1) { - config[prop] = getMergedValue(undefined, config1[prop]); - } - }); - - var axiosKeys = valueFromConfig2Keys - .concat(mergeDeepPropertiesKeys) - .concat(defaultToConfig2Keys) - .concat(directMergeKeys); - - var otherKeys = Object - .keys(config1) - .concat(Object.keys(config2)) - .filter(function filterAxiosKeys(key) { - return axiosKeys.indexOf(key) === -1; - }); - - utils.forEach(otherKeys, mergeDeepProperties); - - return config; -}; - -},{"../utils":48}],34:[function(require,module,exports){ -'use strict'; - -var createError = require('./createError'); - -/** - * Resolve or reject a Promise based on response status. - * - * @param {Function} resolve A function that resolves the promise. - * @param {Function} reject A function that rejects the promise. - * @param {object} response The response. - */ -module.exports = function settle(resolve, reject, response) { - var validateStatus = response.config.validateStatus; - if (!response.status || !validateStatus || validateStatus(response.status)) { - resolve(response); - } else { - reject(createError( - 'Request failed with status code ' + response.status, - response.config, - null, - response.request, - response - )); - } -}; - -},{"./createError":30}],35:[function(require,module,exports){ -'use strict'; - -var utils = require('./../utils'); -var defaults = require('./../defaults'); - -/** - * Transform the data for a request or a response - * - * @param {Object|String} data The data to be transformed - * @param {Array} headers The headers for the request or response - * @param {Array|Function} fns A single function or Array of functions - * @returns {*} The resulting transformed data - */ -module.exports = function transformData(data, headers, fns) { - var context = this || defaults; - /*eslint no-param-reassign:0*/ - utils.forEach(fns, function transform(fn) { - data = fn.call(context, data, headers); - }); - - return data; -}; - -},{"./../defaults":36,"./../utils":48}],36:[function(require,module,exports){ -(function (process){ -'use strict'; - -var utils = require('./utils'); -var normalizeHeaderName = require('./helpers/normalizeHeaderName'); -var enhanceError = require('./core/enhanceError'); - -var DEFAULT_CONTENT_TYPE = { - 'Content-Type': 'application/x-www-form-urlencoded' -}; - -function setContentTypeIfUnset(headers, value) { - if (!utils.isUndefined(headers) && utils.isUndefined(headers['Content-Type'])) { - headers['Content-Type'] = value; - } -} - -function getDefaultAdapter() { - var adapter; - if (typeof XMLHttpRequest !== 'undefined') { - // For browsers use XHR adapter - adapter = require('./adapters/xhr'); - } else if (typeof process !== 'undefined' && Object.prototype.toString.call(process) === '[object process]') { - // For node use HTTP adapter - adapter = require('./adapters/http'); - } - return adapter; -} - -function stringifySafely(rawValue, parser, encoder) { - if (utils.isString(rawValue)) { - try { - (parser || JSON.parse)(rawValue); - return utils.trim(rawValue); - } catch (e) { - if (e.name !== 'SyntaxError') { - throw e; - } - } - } - - return (encoder || JSON.stringify)(rawValue); -} - -var defaults = { - - transitional: { - silentJSONParsing: true, - forcedJSONParsing: true, - clarifyTimeoutError: false - }, - - adapter: getDefaultAdapter(), - - transformRequest: [function transformRequest(data, headers) { - normalizeHeaderName(headers, 'Accept'); - normalizeHeaderName(headers, 'Content-Type'); - - if (utils.isFormData(data) || - utils.isArrayBuffer(data) || - utils.isBuffer(data) || - utils.isStream(data) || - utils.isFile(data) || - utils.isBlob(data) - ) { - return data; - } - if (utils.isArrayBufferView(data)) { - return data.buffer; - } - if (utils.isURLSearchParams(data)) { - setContentTypeIfUnset(headers, 'application/x-www-form-urlencoded;charset=utf-8'); - return data.toString(); - } - if (utils.isObject(data) || (headers && headers['Content-Type'] === 'application/json')) { - setContentTypeIfUnset(headers, 'application/json'); - return stringifySafely(data); - } - return data; - }], - - transformResponse: [function transformResponse(data) { - var transitional = this.transitional; - var silentJSONParsing = transitional && transitional.silentJSONParsing; - var forcedJSONParsing = transitional && transitional.forcedJSONParsing; - var strictJSONParsing = !silentJSONParsing && this.responseType === 'json'; - - if (strictJSONParsing || (forcedJSONParsing && utils.isString(data) && data.length)) { - try { - return JSON.parse(data); - } catch (e) { - if (strictJSONParsing) { - if (e.name === 'SyntaxError') { - throw enhanceError(e, this, 'E_JSON_PARSE'); - } - throw e; - } - } - } - - return data; - }], - - /** - * A timeout in milliseconds to abort a request. If set to 0 (default) a - * timeout is not created. - */ - timeout: 0, - - xsrfCookieName: 'XSRF-TOKEN', - xsrfHeaderName: 'X-XSRF-TOKEN', - - maxContentLength: -1, - maxBodyLength: -1, - - validateStatus: function validateStatus(status) { - return status >= 200 && status < 300; - } -}; - -defaults.headers = { - common: { - 'Accept': 'application/json, text/plain, */*' - } -}; - -utils.forEach(['delete', 'get', 'head'], function forEachMethodNoData(method) { - defaults.headers[method] = {}; -}); - -utils.forEach(['post', 'put', 'patch'], function forEachMethodWithData(method) { - defaults.headers[method] = utils.merge(DEFAULT_CONTENT_TYPE); -}); - -module.exports = defaults; - -}).call(this,require('_process')) -},{"./adapters/http":22,"./adapters/xhr":22,"./core/enhanceError":32,"./helpers/normalizeHeaderName":44,"./utils":48,"_process":197}],37:[function(require,module,exports){ -'use strict'; - -module.exports = function bind(fn, thisArg) { - return function wrap() { - var args = new Array(arguments.length); - for (var i = 0; i < args.length; i++) { - args[i] = arguments[i]; - } - return fn.apply(thisArg, args); - }; -}; - -},{}],38:[function(require,module,exports){ -'use strict'; - -var utils = require('./../utils'); - -function encode(val) { - return encodeURIComponent(val). - replace(/%3A/gi, ':'). - replace(/%24/g, '$'). - replace(/%2C/gi, ','). - replace(/%20/g, '+'). - replace(/%5B/gi, '['). - replace(/%5D/gi, ']'); -} - -/** - * Build a URL by appending params to the end - * - * @param {string} url The base of the url (e.g., http://www.google.com) - * @param {object} [params] The params to be appended - * @returns {string} The formatted url - */ -module.exports = function buildURL(url, params, paramsSerializer) { - /*eslint no-param-reassign:0*/ - if (!params) { - return url; - } - - var serializedParams; - if (paramsSerializer) { - serializedParams = paramsSerializer(params); - } else if (utils.isURLSearchParams(params)) { - serializedParams = params.toString(); - } else { - var parts = []; - - utils.forEach(params, function serialize(val, key) { - if (val === null || typeof val === 'undefined') { - return; - } - - if (utils.isArray(val)) { - key = key + '[]'; - } else { - val = [val]; - } - - utils.forEach(val, function parseValue(v) { - if (utils.isDate(v)) { - v = v.toISOString(); - } else if (utils.isObject(v)) { - v = JSON.stringify(v); - } - parts.push(encode(key) + '=' + encode(v)); - }); - }); - - serializedParams = parts.join('&'); - } - - if (serializedParams) { - var hashmarkIndex = url.indexOf('#'); - if (hashmarkIndex !== -1) { - url = url.slice(0, hashmarkIndex); - } - - url += (url.indexOf('?') === -1 ? '?' : '&') + serializedParams; - } - - return url; -}; - -},{"./../utils":48}],39:[function(require,module,exports){ -'use strict'; - -/** - * Creates a new URL by combining the specified URLs - * - * @param {string} baseURL The base URL - * @param {string} relativeURL The relative URL - * @returns {string} The combined URL - */ -module.exports = function combineURLs(baseURL, relativeURL) { - return relativeURL - ? baseURL.replace(/\/+$/, '') + '/' + relativeURL.replace(/^\/+/, '') - : baseURL; -}; - -},{}],40:[function(require,module,exports){ -'use strict'; - -var utils = require('./../utils'); - -module.exports = ( - utils.isStandardBrowserEnv() ? - - // Standard browser envs support document.cookie - (function standardBrowserEnv() { - return { - write: function write(name, value, expires, path, domain, secure) { - var cookie = []; - cookie.push(name + '=' + encodeURIComponent(value)); - - if (utils.isNumber(expires)) { - cookie.push('expires=' + new Date(expires).toGMTString()); - } - - if (utils.isString(path)) { - cookie.push('path=' + path); - } - - if (utils.isString(domain)) { - cookie.push('domain=' + domain); - } - - if (secure === true) { - cookie.push('secure'); - } - - document.cookie = cookie.join('; '); - }, - - read: function read(name) { - var match = document.cookie.match(new RegExp('(^|;\\s*)(' + name + ')=([^;]*)')); - return (match ? decodeURIComponent(match[3]) : null); - }, - - remove: function remove(name) { - this.write(name, '', Date.now() - 86400000); - } - }; - })() : - - // Non standard browser env (web workers, react-native) lack needed support. - (function nonStandardBrowserEnv() { - return { - write: function write() {}, - read: function read() { return null; }, - remove: function remove() {} - }; - })() -); - -},{"./../utils":48}],41:[function(require,module,exports){ -'use strict'; - -/** - * Determines whether the specified URL is absolute - * - * @param {string} url The URL to test - * @returns {boolean} True if the specified URL is absolute, otherwise false - */ -module.exports = function isAbsoluteURL(url) { - // A URL is considered absolute if it begins with "://" or "//" (protocol-relative URL). - // RFC 3986 defines scheme name as a sequence of characters beginning with a letter and followed - // by any combination of letters, digits, plus, period, or hyphen. - return /^([a-z][a-z\d\+\-\.]*:)?\/\//i.test(url); -}; - -},{}],42:[function(require,module,exports){ -'use strict'; - -/** - * Determines whether the payload is an error thrown by Axios - * - * @param {*} payload The value to test - * @returns {boolean} True if the payload is an error thrown by Axios, otherwise false - */ -module.exports = function isAxiosError(payload) { - return (typeof payload === 'object') && (payload.isAxiosError === true); -}; - -},{}],43:[function(require,module,exports){ -'use strict'; - -var utils = require('./../utils'); - -module.exports = ( - utils.isStandardBrowserEnv() ? - - // Standard browser envs have full support of the APIs needed to test - // whether the request URL is of the same origin as current location. - (function standardBrowserEnv() { - var msie = /(msie|trident)/i.test(navigator.userAgent); - var urlParsingNode = document.createElement('a'); - var originURL; - - /** - * Parse a URL to discover it's components - * - * @param {String} url The URL to be parsed - * @returns {Object} - */ - function resolveURL(url) { - var href = url; - - if (msie) { - // IE needs attribute set twice to normalize properties - urlParsingNode.setAttribute('href', href); - href = urlParsingNode.href; - } - - urlParsingNode.setAttribute('href', href); - - // urlParsingNode provides the UrlUtils interface - http://url.spec.whatwg.org/#urlutils - return { - href: urlParsingNode.href, - protocol: urlParsingNode.protocol ? urlParsingNode.protocol.replace(/:$/, '') : '', - host: urlParsingNode.host, - search: urlParsingNode.search ? urlParsingNode.search.replace(/^\?/, '') : '', - hash: urlParsingNode.hash ? urlParsingNode.hash.replace(/^#/, '') : '', - hostname: urlParsingNode.hostname, - port: urlParsingNode.port, - pathname: (urlParsingNode.pathname.charAt(0) === '/') ? - urlParsingNode.pathname : - '/' + urlParsingNode.pathname - }; - } - - originURL = resolveURL(window.location.href); - - /** - * Determine if a URL shares the same origin as the current location - * - * @param {String} requestURL The URL to test - * @returns {boolean} True if URL shares the same origin, otherwise false - */ - return function isURLSameOrigin(requestURL) { - var parsed = (utils.isString(requestURL)) ? resolveURL(requestURL) : requestURL; - return (parsed.protocol === originURL.protocol && - parsed.host === originURL.host); - }; - })() : - - // Non standard browser envs (web workers, react-native) lack needed support. - (function nonStandardBrowserEnv() { - return function isURLSameOrigin() { - return true; - }; - })() -); - -},{"./../utils":48}],44:[function(require,module,exports){ -'use strict'; - -var utils = require('../utils'); - -module.exports = function normalizeHeaderName(headers, normalizedName) { - utils.forEach(headers, function processHeader(value, name) { - if (name !== normalizedName && name.toUpperCase() === normalizedName.toUpperCase()) { - headers[normalizedName] = value; - delete headers[name]; - } - }); -}; - -},{"../utils":48}],45:[function(require,module,exports){ -'use strict'; - -var utils = require('./../utils'); - -// Headers whose duplicates are ignored by node -// c.f. https://nodejs.org/api/http.html#http_message_headers -var ignoreDuplicateOf = [ - 'age', 'authorization', 'content-length', 'content-type', 'etag', - 'expires', 'from', 'host', 'if-modified-since', 'if-unmodified-since', - 'last-modified', 'location', 'max-forwards', 'proxy-authorization', - 'referer', 'retry-after', 'user-agent' -]; - -/** - * Parse headers into an object - * - * ``` - * Date: Wed, 27 Aug 2014 08:58:49 GMT - * Content-Type: application/json - * Connection: keep-alive - * Transfer-Encoding: chunked - * ``` - * - * @param {String} headers Headers needing to be parsed - * @returns {Object} Headers parsed into an object - */ -module.exports = function parseHeaders(headers) { - var parsed = {}; - var key; - var val; - var i; - - if (!headers) { return parsed; } - - utils.forEach(headers.split('\n'), function parser(line) { - i = line.indexOf(':'); - key = utils.trim(line.substr(0, i)).toLowerCase(); - val = utils.trim(line.substr(i + 1)); - - if (key) { - if (parsed[key] && ignoreDuplicateOf.indexOf(key) >= 0) { - return; - } - if (key === 'set-cookie') { - parsed[key] = (parsed[key] ? parsed[key] : []).concat([val]); - } else { - parsed[key] = parsed[key] ? parsed[key] + ', ' + val : val; - } - } - }); - - return parsed; -}; - -},{"./../utils":48}],46:[function(require,module,exports){ -'use strict'; - -/** - * Syntactic sugar for invoking a function and expanding an array for arguments. - * - * Common use case would be to use `Function.prototype.apply`. - * - * ```js - * function f(x, y, z) {} - * var args = [1, 2, 3]; - * f.apply(null, args); - * ``` - * - * With `spread` this example can be re-written. - * - * ```js - * spread(function(x, y, z) {})([1, 2, 3]); - * ``` - * - * @param {Function} callback - * @returns {Function} - */ -module.exports = function spread(callback) { - return function wrap(arr) { - return callback.apply(null, arr); - }; -}; - -},{}],47:[function(require,module,exports){ -'use strict'; - -var pkg = require('./../../package.json'); - -var validators = {}; - -// eslint-disable-next-line func-names -['object', 'boolean', 'number', 'function', 'string', 'symbol'].forEach(function(type, i) { - validators[type] = function validator(thing) { - return typeof thing === type || 'a' + (i < 1 ? 'n ' : ' ') + type; - }; -}); - -var deprecatedWarnings = {}; -var currentVerArr = pkg.version.split('.'); - -/** - * Compare package versions - * @param {string} version - * @param {string?} thanVersion - * @returns {boolean} - */ -function isOlderVersion(version, thanVersion) { - var pkgVersionArr = thanVersion ? thanVersion.split('.') : currentVerArr; - var destVer = version.split('.'); - for (var i = 0; i < 3; i++) { - if (pkgVersionArr[i] > destVer[i]) { - return true; - } else if (pkgVersionArr[i] < destVer[i]) { - return false; - } - } - return false; -} - -/** - * Transitional option validator - * @param {function|boolean?} validator - * @param {string?} version - * @param {string} message - * @returns {function} - */ -validators.transitional = function transitional(validator, version, message) { - var isDeprecated = version && isOlderVersion(version); - - function formatMessage(opt, desc) { - return '[Axios v' + pkg.version + '] Transitional option \'' + opt + '\'' + desc + (message ? '. ' + message : ''); - } - - // eslint-disable-next-line func-names - return function(value, opt, opts) { - if (validator === false) { - throw new Error(formatMessage(opt, ' has been removed in ' + version)); - } - - if (isDeprecated && !deprecatedWarnings[opt]) { - deprecatedWarnings[opt] = true; - // eslint-disable-next-line no-console - console.warn( - formatMessage( - opt, - ' has been deprecated since v' + version + ' and will be removed in the near future' - ) - ); - } - - return validator ? validator(value, opt, opts) : true; - }; -}; - -/** - * Assert object's properties type - * @param {object} options - * @param {object} schema - * @param {boolean?} allowUnknown - */ - -function assertOptions(options, schema, allowUnknown) { - if (typeof options !== 'object') { - throw new TypeError('options must be an object'); - } - var keys = Object.keys(options); - var i = keys.length; - while (i-- > 0) { - var opt = keys[i]; - var validator = schema[opt]; - if (validator) { - var value = options[opt]; - var result = value === undefined || validator(value, opt, options); - if (result !== true) { - throw new TypeError('option ' + opt + ' must be ' + result); - } - continue; - } - if (allowUnknown !== true) { - throw Error('Unknown option ' + opt); - } - } -} - -module.exports = { - isOlderVersion: isOlderVersion, - assertOptions: assertOptions, - validators: validators -}; - -},{"./../../package.json":49}],48:[function(require,module,exports){ -'use strict'; - -var bind = require('./helpers/bind'); - -// utils is a library of generic helper functions non-specific to axios - -var toString = Object.prototype.toString; - -/** - * Determine if a value is an Array - * - * @param {Object} val The value to test - * @returns {boolean} True if value is an Array, otherwise false - */ -function isArray(val) { - return toString.call(val) === '[object Array]'; -} - -/** - * Determine if a value is undefined - * - * @param {Object} val The value to test - * @returns {boolean} True if the value is undefined, otherwise false - */ -function isUndefined(val) { - return typeof val === 'undefined'; -} - -/** - * Determine if a value is a Buffer - * - * @param {Object} val The value to test - * @returns {boolean} True if value is a Buffer, otherwise false - */ -function isBuffer(val) { - return val !== null && !isUndefined(val) && val.constructor !== null && !isUndefined(val.constructor) - && typeof val.constructor.isBuffer === 'function' && val.constructor.isBuffer(val); -} - -/** - * Determine if a value is an ArrayBuffer - * - * @param {Object} val The value to test - * @returns {boolean} True if value is an ArrayBuffer, otherwise false - */ -function isArrayBuffer(val) { - return toString.call(val) === '[object ArrayBuffer]'; -} - -/** - * Determine if a value is a FormData - * - * @param {Object} val The value to test - * @returns {boolean} True if value is an FormData, otherwise false - */ -function isFormData(val) { - return (typeof FormData !== 'undefined') && (val instanceof FormData); -} - -/** - * Determine if a value is a view on an ArrayBuffer - * - * @param {Object} val The value to test - * @returns {boolean} True if value is a view on an ArrayBuffer, otherwise false - */ -function isArrayBufferView(val) { - var result; - if ((typeof ArrayBuffer !== 'undefined') && (ArrayBuffer.isView)) { - result = ArrayBuffer.isView(val); - } else { - result = (val) && (val.buffer) && (val.buffer instanceof ArrayBuffer); - } - return result; -} - -/** - * Determine if a value is a String - * - * @param {Object} val The value to test - * @returns {boolean} True if value is a String, otherwise false - */ -function isString(val) { - return typeof val === 'string'; -} - -/** - * Determine if a value is a Number - * - * @param {Object} val The value to test - * @returns {boolean} True if value is a Number, otherwise false - */ -function isNumber(val) { - return typeof val === 'number'; -} - -/** - * Determine if a value is an Object - * - * @param {Object} val The value to test - * @returns {boolean} True if value is an Object, otherwise false - */ -function isObject(val) { - return val !== null && typeof val === 'object'; -} - -/** - * Determine if a value is a plain Object - * - * @param {Object} val The value to test - * @return {boolean} True if value is a plain Object, otherwise false - */ -function isPlainObject(val) { - if (toString.call(val) !== '[object Object]') { - return false; - } - - var prototype = Object.getPrototypeOf(val); - return prototype === null || prototype === Object.prototype; -} - -/** - * Determine if a value is a Date - * - * @param {Object} val The value to test - * @returns {boolean} True if value is a Date, otherwise false - */ -function isDate(val) { - return toString.call(val) === '[object Date]'; -} - -/** - * Determine if a value is a File - * - * @param {Object} val The value to test - * @returns {boolean} True if value is a File, otherwise false - */ -function isFile(val) { - return toString.call(val) === '[object File]'; -} - -/** - * Determine if a value is a Blob - * - * @param {Object} val The value to test - * @returns {boolean} True if value is a Blob, otherwise false - */ -function isBlob(val) { - return toString.call(val) === '[object Blob]'; -} - -/** - * Determine if a value is a Function - * - * @param {Object} val The value to test - * @returns {boolean} True if value is a Function, otherwise false - */ -function isFunction(val) { - return toString.call(val) === '[object Function]'; -} - -/** - * Determine if a value is a Stream - * - * @param {Object} val The value to test - * @returns {boolean} True if value is a Stream, otherwise false - */ -function isStream(val) { - return isObject(val) && isFunction(val.pipe); -} - -/** - * Determine if a value is a URLSearchParams object - * - * @param {Object} val The value to test - * @returns {boolean} True if value is a URLSearchParams object, otherwise false - */ -function isURLSearchParams(val) { - return typeof URLSearchParams !== 'undefined' && val instanceof URLSearchParams; -} - -/** - * Trim excess whitespace off the beginning and end of a string - * - * @param {String} str The String to trim - * @returns {String} The String freed of excess whitespace - */ -function trim(str) { - return str.trim ? str.trim() : str.replace(/^\s+|\s+$/g, ''); -} - -/** - * Determine if we're running in a standard browser environment - * - * This allows axios to run in a web worker, and react-native. - * Both environments support XMLHttpRequest, but not fully standard globals. - * - * web workers: - * typeof window -> undefined - * typeof document -> undefined - * - * react-native: - * navigator.product -> 'ReactNative' - * nativescript - * navigator.product -> 'NativeScript' or 'NS' - */ -function isStandardBrowserEnv() { - if (typeof navigator !== 'undefined' && (navigator.product === 'ReactNative' || - navigator.product === 'NativeScript' || - navigator.product === 'NS')) { - return false; - } - return ( - typeof window !== 'undefined' && - typeof document !== 'undefined' - ); -} - -/** - * Iterate over an Array or an Object invoking a function for each item. - * - * If `obj` is an Array callback will be called passing - * the value, index, and complete array for each item. - * - * If 'obj' is an Object callback will be called passing - * the value, key, and complete object for each property. - * - * @param {Object|Array} obj The object to iterate - * @param {Function} fn The callback to invoke for each item - */ -function forEach(obj, fn) { - // Don't bother if no value provided - if (obj === null || typeof obj === 'undefined') { - return; - } - - // Force an array if not already something iterable - if (typeof obj !== 'object') { - /*eslint no-param-reassign:0*/ - obj = [obj]; - } - - if (isArray(obj)) { - // Iterate over array values - for (var i = 0, l = obj.length; i < l; i++) { - fn.call(null, obj[i], i, obj); - } - } else { - // Iterate over object keys - for (var key in obj) { - if (Object.prototype.hasOwnProperty.call(obj, key)) { - fn.call(null, obj[key], key, obj); - } - } - } -} - -/** - * Accepts varargs expecting each argument to be an object, then - * immutably merges the properties of each object and returns result. - * - * When multiple objects contain the same key the later object in - * the arguments list will take precedence. - * - * Example: - * - * ```js - * var result = merge({foo: 123}, {foo: 456}); - * console.log(result.foo); // outputs 456 - * ``` - * - * @param {Object} obj1 Object to merge - * @returns {Object} Result of all merge properties - */ -function merge(/* obj1, obj2, obj3, ... */) { - var result = {}; - function assignValue(val, key) { - if (isPlainObject(result[key]) && isPlainObject(val)) { - result[key] = merge(result[key], val); - } else if (isPlainObject(val)) { - result[key] = merge({}, val); - } else if (isArray(val)) { - result[key] = val.slice(); - } else { - result[key] = val; - } - } - - for (var i = 0, l = arguments.length; i < l; i++) { - forEach(arguments[i], assignValue); - } - return result; -} - -/** - * Extends object a by mutably adding to it the properties of object b. - * - * @param {Object} a The object to be extended - * @param {Object} b The object to copy properties from - * @param {Object} thisArg The object to bind function to - * @return {Object} The resulting value of object a - */ -function extend(a, b, thisArg) { - forEach(b, function assignValue(val, key) { - if (thisArg && typeof val === 'function') { - a[key] = bind(val, thisArg); - } else { - a[key] = val; - } - }); - return a; -} - -/** - * Remove byte order marker. This catches EF BB BF (the UTF-8 BOM) - * - * @param {string} content with BOM - * @return {string} content value without BOM - */ -function stripBOM(content) { - if (content.charCodeAt(0) === 0xFEFF) { - content = content.slice(1); - } - return content; -} - -module.exports = { - isArray: isArray, - isArrayBuffer: isArrayBuffer, - isBuffer: isBuffer, - isFormData: isFormData, - isArrayBufferView: isArrayBufferView, - isString: isString, - isNumber: isNumber, - isObject: isObject, - isPlainObject: isPlainObject, - isUndefined: isUndefined, - isDate: isDate, - isFile: isFile, - isBlob: isBlob, - isFunction: isFunction, - isStream: isStream, - isURLSearchParams: isURLSearchParams, - isStandardBrowserEnv: isStandardBrowserEnv, - forEach: forEach, - merge: merge, - extend: extend, - trim: trim, - stripBOM: stripBOM -}; - -},{"./helpers/bind":37}],49:[function(require,module,exports){ -module.exports={ - "_args": [ - [ - "axios@0.21.4", - "/Users/nikkisharifli/src/external/hound-sdk-web-example" - ] - ], - "_from": "axios@0.21.4", - "_id": "axios@0.21.4", - "_inBundle": false, - "_integrity": "sha512-ut5vewkiu8jjGBdqpM44XxjuCjq9LAKeHVmoVfHVzy8eHgxxq8SbAVQNovDA8mVi05kP0Ea/n/UzcSHcTJQfNg==", - "_location": "/axios", - "_phantomChildren": {}, - "_requested": { - "type": "version", - "registry": true, - "raw": "axios@0.21.4", - "name": "axios", - "escapedName": "axios", - "rawSpec": "0.21.4", - "saveSpec": null, - "fetchSpec": "0.21.4" - }, - "_requiredBy": [ - "/houndify" - ], - "_resolved": "https://registry.npmjs.org/axios/-/axios-0.21.4.tgz", - "_spec": "0.21.4", - "_where": "/Users/nikkisharifli/src/external/hound-sdk-web-example", - "author": { - "name": "Matt Zabriskie" - }, - "browser": { - "./lib/adapters/http.js": "./lib/adapters/xhr.js" - }, - "bugs": { - "url": "https://github.com/axios/axios/issues" - }, - "bundlesize": [ - { - "path": "./dist/axios.min.js", - "threshold": "5kB" - } - ], - "dependencies": { - "follow-redirects": "^1.14.0" - }, - "description": "Promise based HTTP client for the browser and node.js", - "devDependencies": { - "coveralls": "^3.0.0", - "es6-promise": "^4.2.4", - "grunt": "^1.3.0", - "grunt-banner": "^0.6.0", - "grunt-cli": "^1.2.0", - "grunt-contrib-clean": "^1.1.0", - "grunt-contrib-watch": "^1.0.0", - "grunt-eslint": "^23.0.0", - "grunt-karma": "^4.0.0", - "grunt-mocha-test": "^0.13.3", - "grunt-ts": "^6.0.0-beta.19", - "grunt-webpack": "^4.0.2", - "istanbul-instrumenter-loader": "^1.0.0", - "jasmine-core": "^2.4.1", - "karma": "^6.3.2", - "karma-chrome-launcher": "^3.1.0", - "karma-firefox-launcher": "^2.1.0", - "karma-jasmine": "^1.1.1", - "karma-jasmine-ajax": "^0.1.13", - "karma-safari-launcher": "^1.0.0", - "karma-sauce-launcher": "^4.3.6", - "karma-sinon": "^1.0.5", - "karma-sourcemap-loader": "^0.3.8", - "karma-webpack": "^4.0.2", - "load-grunt-tasks": "^3.5.2", - "minimist": "^1.2.0", - "mocha": "^8.2.1", - "sinon": "^4.5.0", - "terser-webpack-plugin": "^4.2.3", - "typescript": "^4.0.5", - "url-search-params": "^0.10.0", - "webpack": "^4.44.2", - "webpack-dev-server": "^3.11.0" - }, - "homepage": "https://axios-http.com", - "jsdelivr": "dist/axios.min.js", - "keywords": [ - "xhr", - "http", - "ajax", - "promise", - "node" - ], - "license": "MIT", - "main": "index.js", - "name": "axios", - "repository": { - "type": "git", - "url": "git+https://github.com/axios/axios.git" - }, - "scripts": { - "build": "NODE_ENV=production grunt build", - "coveralls": "cat coverage/lcov.info | ./node_modules/coveralls/bin/coveralls.js", - "examples": "node ./examples/server.js", - "fix": "eslint --fix lib/**/*.js", - "postversion": "git push && git push --tags", - "preversion": "npm test", - "start": "node ./sandbox/server.js", - "test": "grunt test", - "version": "npm run build && grunt version && git add -A dist && git add CHANGELOG.md bower.json package.json" - }, - "typings": "./index.d.ts", - "unpkg": "dist/axios.min.js", - "version": "0.21.4" -} - -},{}],50:[function(require,module,exports){ -'use strict' - -exports.byteLength = byteLength -exports.toByteArray = toByteArray -exports.fromByteArray = fromByteArray - -var lookup = [] -var revLookup = [] -var Arr = typeof Uint8Array !== 'undefined' ? Uint8Array : Array - -var code = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/' -for (var i = 0, len = code.length; i < len; ++i) { - lookup[i] = code[i] - revLookup[code.charCodeAt(i)] = i -} - -// Support decoding URL-safe base64 strings, as Node.js does. -// See: https://en.wikipedia.org/wiki/Base64#URL_applications -revLookup['-'.charCodeAt(0)] = 62 -revLookup['_'.charCodeAt(0)] = 63 - -function getLens (b64) { - var len = b64.length - - if (len % 4 > 0) { - throw new Error('Invalid string. Length must be a multiple of 4') - } - - // Trim off extra bytes after placeholder bytes are found - // See: https://github.com/beatgammit/base64-js/issues/42 - var validLen = b64.indexOf('=') - if (validLen === -1) validLen = len - - var placeHoldersLen = validLen === len - ? 0 - : 4 - (validLen % 4) - - return [validLen, placeHoldersLen] -} - -// base64 is 4/3 + up to two characters of the original data -function byteLength (b64) { - var lens = getLens(b64) - var validLen = lens[0] - var placeHoldersLen = lens[1] - return ((validLen + placeHoldersLen) * 3 / 4) - placeHoldersLen -} - -function _byteLength (b64, validLen, placeHoldersLen) { - return ((validLen + placeHoldersLen) * 3 / 4) - placeHoldersLen -} - -function toByteArray (b64) { - var tmp - var lens = getLens(b64) - var validLen = lens[0] - var placeHoldersLen = lens[1] - - var arr = new Arr(_byteLength(b64, validLen, placeHoldersLen)) - - var curByte = 0 - - // if there are placeholders, only get up to the last complete 4 chars - var len = placeHoldersLen > 0 - ? validLen - 4 - : validLen - - for (var i = 0; i < len; i += 4) { - tmp = - (revLookup[b64.charCodeAt(i)] << 18) | - (revLookup[b64.charCodeAt(i + 1)] << 12) | - (revLookup[b64.charCodeAt(i + 2)] << 6) | - revLookup[b64.charCodeAt(i + 3)] - arr[curByte++] = (tmp >> 16) & 0xFF - arr[curByte++] = (tmp >> 8) & 0xFF - arr[curByte++] = tmp & 0xFF - } - - if (placeHoldersLen === 2) { - tmp = - (revLookup[b64.charCodeAt(i)] << 2) | - (revLookup[b64.charCodeAt(i + 1)] >> 4) - arr[curByte++] = tmp & 0xFF - } - - if (placeHoldersLen === 1) { - tmp = - (revLookup[b64.charCodeAt(i)] << 10) | - (revLookup[b64.charCodeAt(i + 1)] << 4) | - (revLookup[b64.charCodeAt(i + 2)] >> 2) - arr[curByte++] = (tmp >> 8) & 0xFF - arr[curByte++] = tmp & 0xFF - } - - return arr -} - -function tripletToBase64 (num) { - return lookup[num >> 18 & 0x3F] + - lookup[num >> 12 & 0x3F] + - lookup[num >> 6 & 0x3F] + - lookup[num & 0x3F] -} - -function encodeChunk (uint8, start, end) { - var tmp - var output = [] - for (var i = start; i < end; i += 3) { - tmp = - ((uint8[i] << 16) & 0xFF0000) + - ((uint8[i + 1] << 8) & 0xFF00) + - (uint8[i + 2] & 0xFF) - output.push(tripletToBase64(tmp)) - } - return output.join('') -} - -function fromByteArray (uint8) { - var tmp - var len = uint8.length - var extraBytes = len % 3 // if we have 1 byte left, pad 2 bytes - var parts = [] - var maxChunkLength = 16383 // must be multiple of 3 - - // go through the array every three bytes, we'll deal with trailing stuff later - for (var i = 0, len2 = len - extraBytes; i < len2; i += maxChunkLength) { - parts.push(encodeChunk( - uint8, i, (i + maxChunkLength) > len2 ? len2 : (i + maxChunkLength) - )) - } - - // pad the end with zeros, but make sure to not forget the extra bytes - if (extraBytes === 1) { - tmp = uint8[len - 1] - parts.push( - lookup[tmp >> 2] + - lookup[(tmp << 4) & 0x3F] + - '==' - ) - } else if (extraBytes === 2) { - tmp = (uint8[len - 2] << 8) + uint8[len - 1] - parts.push( - lookup[tmp >> 10] + - lookup[(tmp >> 4) & 0x3F] + - lookup[(tmp << 2) & 0x3F] + - '=' - ) - } - - return parts.join('') -} - -},{}],51:[function(require,module,exports){ -;(function (globalObject) { - 'use strict'; - -/* - * bignumber.js v9.1.0 - * A JavaScript library for arbitrary-precision arithmetic. - * https://github.com/MikeMcl/bignumber.js - * Copyright (c) 2022 Michael Mclaughlin - * MIT Licensed. - * - * BigNumber.prototype methods | BigNumber methods - * | - * absoluteValue abs | clone - * comparedTo | config set - * decimalPlaces dp | DECIMAL_PLACES - * dividedBy div | ROUNDING_MODE - * dividedToIntegerBy idiv | EXPONENTIAL_AT - * exponentiatedBy pow | RANGE - * integerValue | CRYPTO - * isEqualTo eq | MODULO_MODE - * isFinite | POW_PRECISION - * isGreaterThan gt | FORMAT - * isGreaterThanOrEqualTo gte | ALPHABET - * isInteger | isBigNumber - * isLessThan lt | maximum max - * isLessThanOrEqualTo lte | minimum min - * isNaN | random - * isNegative | sum - * isPositive | - * isZero | - * minus | - * modulo mod | - * multipliedBy times | - * negated | - * plus | - * precision sd | - * shiftedBy | - * squareRoot sqrt | - * toExponential | - * toFixed | - * toFormat | - * toFraction | - * toJSON | - * toNumber | - * toPrecision | - * toString | - * valueOf | - * - */ - - - var BigNumber, - isNumeric = /^-?(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?$/i, - mathceil = Math.ceil, - mathfloor = Math.floor, - - bignumberError = '[BigNumber Error] ', - tooManyDigits = bignumberError + 'Number primitive has more than 15 significant digits: ', - - BASE = 1e14, - LOG_BASE = 14, - MAX_SAFE_INTEGER = 0x1fffffffffffff, // 2^53 - 1 - // MAX_INT32 = 0x7fffffff, // 2^31 - 1 - POWS_TEN = [1, 10, 100, 1e3, 1e4, 1e5, 1e6, 1e7, 1e8, 1e9, 1e10, 1e11, 1e12, 1e13], - SQRT_BASE = 1e7, - - // EDITABLE - // The limit on the value of DECIMAL_PLACES, TO_EXP_NEG, TO_EXP_POS, MIN_EXP, MAX_EXP, and - // the arguments to toExponential, toFixed, toFormat, and toPrecision. - MAX = 1E9; // 0 to MAX_INT32 - - - /* - * Create and return a BigNumber constructor. - */ - function clone(configObject) { - var div, convertBase, parseNumeric, - P = BigNumber.prototype = { constructor: BigNumber, toString: null, valueOf: null }, - ONE = new BigNumber(1), - - - //----------------------------- EDITABLE CONFIG DEFAULTS ------------------------------- - - - // The default values below must be integers within the inclusive ranges stated. - // The values can also be changed at run-time using BigNumber.set. - - // The maximum number of decimal places for operations involving division. - DECIMAL_PLACES = 20, // 0 to MAX - - // The rounding mode used when rounding to the above decimal places, and when using - // toExponential, toFixed, toFormat and toPrecision, and round (default value). - // UP 0 Away from zero. - // DOWN 1 Towards zero. - // CEIL 2 Towards +Infinity. - // FLOOR 3 Towards -Infinity. - // HALF_UP 4 Towards nearest neighbour. If equidistant, up. - // HALF_DOWN 5 Towards nearest neighbour. If equidistant, down. - // HALF_EVEN 6 Towards nearest neighbour. If equidistant, towards even neighbour. - // HALF_CEIL 7 Towards nearest neighbour. If equidistant, towards +Infinity. - // HALF_FLOOR 8 Towards nearest neighbour. If equidistant, towards -Infinity. - ROUNDING_MODE = 4, // 0 to 8 - - // EXPONENTIAL_AT : [TO_EXP_NEG , TO_EXP_POS] - - // The exponent value at and beneath which toString returns exponential notation. - // Number type: -7 - TO_EXP_NEG = -7, // 0 to -MAX - - // The exponent value at and above which toString returns exponential notation. - // Number type: 21 - TO_EXP_POS = 21, // 0 to MAX - - // RANGE : [MIN_EXP, MAX_EXP] - - // The minimum exponent value, beneath which underflow to zero occurs. - // Number type: -324 (5e-324) - MIN_EXP = -1e7, // -1 to -MAX - - // The maximum exponent value, above which overflow to Infinity occurs. - // Number type: 308 (1.7976931348623157e+308) - // For MAX_EXP > 1e7, e.g. new BigNumber('1e100000000').plus(1) may be slow. - MAX_EXP = 1e7, // 1 to MAX - - // Whether to use cryptographically-secure random number generation, if available. - CRYPTO = false, // true or false - - // The modulo mode used when calculating the modulus: a mod n. - // The quotient (q = a / n) is calculated according to the corresponding rounding mode. - // The remainder (r) is calculated as: r = a - n * q. - // - // UP 0 The remainder is positive if the dividend is negative, else is negative. - // DOWN 1 The remainder has the same sign as the dividend. - // This modulo mode is commonly known as 'truncated division' and is - // equivalent to (a % n) in JavaScript. - // FLOOR 3 The remainder has the same sign as the divisor (Python %). - // HALF_EVEN 6 This modulo mode implements the IEEE 754 remainder function. - // EUCLID 9 Euclidian division. q = sign(n) * floor(a / abs(n)). - // The remainder is always positive. - // - // The truncated division, floored division, Euclidian division and IEEE 754 remainder - // modes are commonly used for the modulus operation. - // Although the other rounding modes can also be used, they may not give useful results. - MODULO_MODE = 1, // 0 to 9 - - // The maximum number of significant digits of the result of the exponentiatedBy operation. - // If POW_PRECISION is 0, there will be unlimited significant digits. - POW_PRECISION = 0, // 0 to MAX - - // The format specification used by the BigNumber.prototype.toFormat method. - FORMAT = { - prefix: '', - groupSize: 3, - secondaryGroupSize: 0, - groupSeparator: ',', - decimalSeparator: '.', - fractionGroupSize: 0, - fractionGroupSeparator: '\xA0', // non-breaking space - suffix: '' - }, - - // The alphabet used for base conversion. It must be at least 2 characters long, with no '+', - // '-', '.', whitespace, or repeated character. - // '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ$_' - ALPHABET = '0123456789abcdefghijklmnopqrstuvwxyz', - alphabetHasNormalDecimalDigits = true; - - - //------------------------------------------------------------------------------------------ - - - // CONSTRUCTOR - - - /* - * The BigNumber constructor and exported function. - * Create and return a new instance of a BigNumber object. - * - * v {number|string|BigNumber} A numeric value. - * [b] {number} The base of v. Integer, 2 to ALPHABET.length inclusive. - */ - function BigNumber(v, b) { - var alphabet, c, caseChanged, e, i, isNum, len, str, - x = this; - - // Enable constructor call without `new`. - if (!(x instanceof BigNumber)) return new BigNumber(v, b); - - if (b == null) { - - if (v && v._isBigNumber === true) { - x.s = v.s; - - if (!v.c || v.e > MAX_EXP) { - x.c = x.e = null; - } else if (v.e < MIN_EXP) { - x.c = [x.e = 0]; - } else { - x.e = v.e; - x.c = v.c.slice(); - } - - return; - } - - if ((isNum = typeof v == 'number') && v * 0 == 0) { - - // Use `1 / n` to handle minus zero also. - x.s = 1 / v < 0 ? (v = -v, -1) : 1; - - // Fast path for integers, where n < 2147483648 (2**31). - if (v === ~~v) { - for (e = 0, i = v; i >= 10; i /= 10, e++); - - if (e > MAX_EXP) { - x.c = x.e = null; - } else { - x.e = e; - x.c = [v]; - } - - return; - } - - str = String(v); - } else { - - if (!isNumeric.test(str = String(v))) return parseNumeric(x, str, isNum); - - x.s = str.charCodeAt(0) == 45 ? (str = str.slice(1), -1) : 1; - } - - // Decimal point? - if ((e = str.indexOf('.')) > -1) str = str.replace('.', ''); - - // Exponential form? - if ((i = str.search(/e/i)) > 0) { - - // Determine exponent. - if (e < 0) e = i; - e += +str.slice(i + 1); - str = str.substring(0, i); - } else if (e < 0) { - - // Integer. - e = str.length; - } - - } else { - - // '[BigNumber Error] Base {not a primitive number|not an integer|out of range}: {b}' - intCheck(b, 2, ALPHABET.length, 'Base'); - - // Allow exponential notation to be used with base 10 argument, while - // also rounding to DECIMAL_PLACES as with other bases. - if (b == 10 && alphabetHasNormalDecimalDigits) { - x = new BigNumber(v); - return round(x, DECIMAL_PLACES + x.e + 1, ROUNDING_MODE); - } - - str = String(v); - - if (isNum = typeof v == 'number') { - - // Avoid potential interpretation of Infinity and NaN as base 44+ values. - if (v * 0 != 0) return parseNumeric(x, str, isNum, b); - - x.s = 1 / v < 0 ? (str = str.slice(1), -1) : 1; - - // '[BigNumber Error] Number primitive has more than 15 significant digits: {n}' - if (BigNumber.DEBUG && str.replace(/^0\.0*|\./, '').length > 15) { - throw Error - (tooManyDigits + v); - } - } else { - x.s = str.charCodeAt(0) === 45 ? (str = str.slice(1), -1) : 1; - } - - alphabet = ALPHABET.slice(0, b); - e = i = 0; - - // Check that str is a valid base b number. - // Don't use RegExp, so alphabet can contain special characters. - for (len = str.length; i < len; i++) { - if (alphabet.indexOf(c = str.charAt(i)) < 0) { - if (c == '.') { - - // If '.' is not the first character and it has not be found before. - if (i > e) { - e = len; - continue; - } - } else if (!caseChanged) { - - // Allow e.g. hexadecimal 'FF' as well as 'ff'. - if (str == str.toUpperCase() && (str = str.toLowerCase()) || - str == str.toLowerCase() && (str = str.toUpperCase())) { - caseChanged = true; - i = -1; - e = 0; - continue; - } - } - - return parseNumeric(x, String(v), isNum, b); - } - } - - // Prevent later check for length on converted number. - isNum = false; - str = convertBase(str, b, 10, x.s); - - // Decimal point? - if ((e = str.indexOf('.')) > -1) str = str.replace('.', ''); - else e = str.length; - } - - // Determine leading zeros. - for (i = 0; str.charCodeAt(i) === 48; i++); - - // Determine trailing zeros. - for (len = str.length; str.charCodeAt(--len) === 48;); - - if (str = str.slice(i, ++len)) { - len -= i; - - // '[BigNumber Error] Number primitive has more than 15 significant digits: {n}' - if (isNum && BigNumber.DEBUG && - len > 15 && (v > MAX_SAFE_INTEGER || v !== mathfloor(v))) { - throw Error - (tooManyDigits + (x.s * v)); - } - - // Overflow? - if ((e = e - i - 1) > MAX_EXP) { - - // Infinity. - x.c = x.e = null; - - // Underflow? - } else if (e < MIN_EXP) { - - // Zero. - x.c = [x.e = 0]; - } else { - x.e = e; - x.c = []; - - // Transform base - - // e is the base 10 exponent. - // i is where to slice str to get the first element of the coefficient array. - i = (e + 1) % LOG_BASE; - if (e < 0) i += LOG_BASE; // i < 1 - - if (i < len) { - if (i) x.c.push(+str.slice(0, i)); - - for (len -= LOG_BASE; i < len;) { - x.c.push(+str.slice(i, i += LOG_BASE)); - } - - i = LOG_BASE - (str = str.slice(i)).length; - } else { - i -= len; - } - - for (; i--; str += '0'); - x.c.push(+str); - } - } else { - - // Zero. - x.c = [x.e = 0]; - } - } - - - // CONSTRUCTOR PROPERTIES - - - BigNumber.clone = clone; - - BigNumber.ROUND_UP = 0; - BigNumber.ROUND_DOWN = 1; - BigNumber.ROUND_CEIL = 2; - BigNumber.ROUND_FLOOR = 3; - BigNumber.ROUND_HALF_UP = 4; - BigNumber.ROUND_HALF_DOWN = 5; - BigNumber.ROUND_HALF_EVEN = 6; - BigNumber.ROUND_HALF_CEIL = 7; - BigNumber.ROUND_HALF_FLOOR = 8; - BigNumber.EUCLID = 9; - - - /* - * Configure infrequently-changing library-wide settings. - * - * Accept an object with the following optional properties (if the value of a property is - * a number, it must be an integer within the inclusive range stated): - * - * DECIMAL_PLACES {number} 0 to MAX - * ROUNDING_MODE {number} 0 to 8 - * EXPONENTIAL_AT {number|number[]} -MAX to MAX or [-MAX to 0, 0 to MAX] - * RANGE {number|number[]} -MAX to MAX (not zero) or [-MAX to -1, 1 to MAX] - * CRYPTO {boolean} true or false - * MODULO_MODE {number} 0 to 9 - * POW_PRECISION {number} 0 to MAX - * ALPHABET {string} A string of two or more unique characters which does - * not contain '.'. - * FORMAT {object} An object with some of the following properties: - * prefix {string} - * groupSize {number} - * secondaryGroupSize {number} - * groupSeparator {string} - * decimalSeparator {string} - * fractionGroupSize {number} - * fractionGroupSeparator {string} - * suffix {string} - * - * (The values assigned to the above FORMAT object properties are not checked for validity.) - * - * E.g. - * BigNumber.config({ DECIMAL_PLACES : 20, ROUNDING_MODE : 4 }) - * - * Ignore properties/parameters set to null or undefined, except for ALPHABET. - * - * Return an object with the properties current values. - */ - BigNumber.config = BigNumber.set = function (obj) { - var p, v; - - if (obj != null) { - - if (typeof obj == 'object') { - - // DECIMAL_PLACES {number} Integer, 0 to MAX inclusive. - // '[BigNumber Error] DECIMAL_PLACES {not a primitive number|not an integer|out of range}: {v}' - if (obj.hasOwnProperty(p = 'DECIMAL_PLACES')) { - v = obj[p]; - intCheck(v, 0, MAX, p); - DECIMAL_PLACES = v; - } - - // ROUNDING_MODE {number} Integer, 0 to 8 inclusive. - // '[BigNumber Error] ROUNDING_MODE {not a primitive number|not an integer|out of range}: {v}' - if (obj.hasOwnProperty(p = 'ROUNDING_MODE')) { - v = obj[p]; - intCheck(v, 0, 8, p); - ROUNDING_MODE = v; - } - - // EXPONENTIAL_AT {number|number[]} - // Integer, -MAX to MAX inclusive or - // [integer -MAX to 0 inclusive, 0 to MAX inclusive]. - // '[BigNumber Error] EXPONENTIAL_AT {not a primitive number|not an integer|out of range}: {v}' - if (obj.hasOwnProperty(p = 'EXPONENTIAL_AT')) { - v = obj[p]; - if (v && v.pop) { - intCheck(v[0], -MAX, 0, p); - intCheck(v[1], 0, MAX, p); - TO_EXP_NEG = v[0]; - TO_EXP_POS = v[1]; - } else { - intCheck(v, -MAX, MAX, p); - TO_EXP_NEG = -(TO_EXP_POS = v < 0 ? -v : v); - } - } - - // RANGE {number|number[]} Non-zero integer, -MAX to MAX inclusive or - // [integer -MAX to -1 inclusive, integer 1 to MAX inclusive]. - // '[BigNumber Error] RANGE {not a primitive number|not an integer|out of range|cannot be zero}: {v}' - if (obj.hasOwnProperty(p = 'RANGE')) { - v = obj[p]; - if (v && v.pop) { - intCheck(v[0], -MAX, -1, p); - intCheck(v[1], 1, MAX, p); - MIN_EXP = v[0]; - MAX_EXP = v[1]; - } else { - intCheck(v, -MAX, MAX, p); - if (v) { - MIN_EXP = -(MAX_EXP = v < 0 ? -v : v); - } else { - throw Error - (bignumberError + p + ' cannot be zero: ' + v); - } - } - } - - // CRYPTO {boolean} true or false. - // '[BigNumber Error] CRYPTO not true or false: {v}' - // '[BigNumber Error] crypto unavailable' - if (obj.hasOwnProperty(p = 'CRYPTO')) { - v = obj[p]; - if (v === !!v) { - if (v) { - if (typeof crypto != 'undefined' && crypto && - (crypto.getRandomValues || crypto.randomBytes)) { - CRYPTO = v; - } else { - CRYPTO = !v; - throw Error - (bignumberError + 'crypto unavailable'); - } - } else { - CRYPTO = v; - } - } else { - throw Error - (bignumberError + p + ' not true or false: ' + v); - } - } - - // MODULO_MODE {number} Integer, 0 to 9 inclusive. - // '[BigNumber Error] MODULO_MODE {not a primitive number|not an integer|out of range}: {v}' - if (obj.hasOwnProperty(p = 'MODULO_MODE')) { - v = obj[p]; - intCheck(v, 0, 9, p); - MODULO_MODE = v; - } - - // POW_PRECISION {number} Integer, 0 to MAX inclusive. - // '[BigNumber Error] POW_PRECISION {not a primitive number|not an integer|out of range}: {v}' - if (obj.hasOwnProperty(p = 'POW_PRECISION')) { - v = obj[p]; - intCheck(v, 0, MAX, p); - POW_PRECISION = v; - } - - // FORMAT {object} - // '[BigNumber Error] FORMAT not an object: {v}' - if (obj.hasOwnProperty(p = 'FORMAT')) { - v = obj[p]; - if (typeof v == 'object') FORMAT = v; - else throw Error - (bignumberError + p + ' not an object: ' + v); - } - - // ALPHABET {string} - // '[BigNumber Error] ALPHABET invalid: {v}' - if (obj.hasOwnProperty(p = 'ALPHABET')) { - v = obj[p]; - - // Disallow if less than two characters, - // or if it contains '+', '-', '.', whitespace, or a repeated character. - if (typeof v == 'string' && !/^.?$|[+\-.\s]|(.).*\1/.test(v)) { - alphabetHasNormalDecimalDigits = v.slice(0, 10) == '0123456789'; - ALPHABET = v; - } else { - throw Error - (bignumberError + p + ' invalid: ' + v); - } - } - - } else { - - // '[BigNumber Error] Object expected: {v}' - throw Error - (bignumberError + 'Object expected: ' + obj); - } - } - - return { - DECIMAL_PLACES: DECIMAL_PLACES, - ROUNDING_MODE: ROUNDING_MODE, - EXPONENTIAL_AT: [TO_EXP_NEG, TO_EXP_POS], - RANGE: [MIN_EXP, MAX_EXP], - CRYPTO: CRYPTO, - MODULO_MODE: MODULO_MODE, - POW_PRECISION: POW_PRECISION, - FORMAT: FORMAT, - ALPHABET: ALPHABET - }; - }; - - - /* - * Return true if v is a BigNumber instance, otherwise return false. - * - * If BigNumber.DEBUG is true, throw if a BigNumber instance is not well-formed. - * - * v {any} - * - * '[BigNumber Error] Invalid BigNumber: {v}' - */ - BigNumber.isBigNumber = function (v) { - if (!v || v._isBigNumber !== true) return false; - if (!BigNumber.DEBUG) return true; - - var i, n, - c = v.c, - e = v.e, - s = v.s; - - out: if ({}.toString.call(c) == '[object Array]') { - - if ((s === 1 || s === -1) && e >= -MAX && e <= MAX && e === mathfloor(e)) { - - // If the first element is zero, the BigNumber value must be zero. - if (c[0] === 0) { - if (e === 0 && c.length === 1) return true; - break out; - } - - // Calculate number of digits that c[0] should have, based on the exponent. - i = (e + 1) % LOG_BASE; - if (i < 1) i += LOG_BASE; - - // Calculate number of digits of c[0]. - //if (Math.ceil(Math.log(c[0] + 1) / Math.LN10) == i) { - if (String(c[0]).length == i) { - - for (i = 0; i < c.length; i++) { - n = c[i]; - if (n < 0 || n >= BASE || n !== mathfloor(n)) break out; - } - - // Last element cannot be zero, unless it is the only element. - if (n !== 0) return true; - } - } - - // Infinity/NaN - } else if (c === null && e === null && (s === null || s === 1 || s === -1)) { - return true; - } - - throw Error - (bignumberError + 'Invalid BigNumber: ' + v); - }; - - - /* - * Return a new BigNumber whose value is the maximum of the arguments. - * - * arguments {number|string|BigNumber} - */ - BigNumber.maximum = BigNumber.max = function () { - return maxOrMin(arguments, P.lt); - }; - - - /* - * Return a new BigNumber whose value is the minimum of the arguments. - * - * arguments {number|string|BigNumber} - */ - BigNumber.minimum = BigNumber.min = function () { - return maxOrMin(arguments, P.gt); - }; - - - /* - * Return a new BigNumber with a random value equal to or greater than 0 and less than 1, - * and with dp, or DECIMAL_PLACES if dp is omitted, decimal places (or less if trailing - * zeros are produced). - * - * [dp] {number} Decimal places. Integer, 0 to MAX inclusive. - * - * '[BigNumber Error] Argument {not a primitive number|not an integer|out of range}: {dp}' - * '[BigNumber Error] crypto unavailable' - */ - BigNumber.random = (function () { - var pow2_53 = 0x20000000000000; - - // Return a 53 bit integer n, where 0 <= n < 9007199254740992. - // Check if Math.random() produces more than 32 bits of randomness. - // If it does, assume at least 53 bits are produced, otherwise assume at least 30 bits. - // 0x40000000 is 2^30, 0x800000 is 2^23, 0x1fffff is 2^21 - 1. - var random53bitInt = (Math.random() * pow2_53) & 0x1fffff - ? function () { return mathfloor(Math.random() * pow2_53); } - : function () { return ((Math.random() * 0x40000000 | 0) * 0x800000) + - (Math.random() * 0x800000 | 0); }; - - return function (dp) { - var a, b, e, k, v, - i = 0, - c = [], - rand = new BigNumber(ONE); - - if (dp == null) dp = DECIMAL_PLACES; - else intCheck(dp, 0, MAX); - - k = mathceil(dp / LOG_BASE); - - if (CRYPTO) { - - // Browsers supporting crypto.getRandomValues. - if (crypto.getRandomValues) { - - a = crypto.getRandomValues(new Uint32Array(k *= 2)); - - for (; i < k;) { - - // 53 bits: - // ((Math.pow(2, 32) - 1) * Math.pow(2, 21)).toString(2) - // 11111 11111111 11111111 11111111 11100000 00000000 00000000 - // ((Math.pow(2, 32) - 1) >>> 11).toString(2) - // 11111 11111111 11111111 - // 0x20000 is 2^21. - v = a[i] * 0x20000 + (a[i + 1] >>> 11); - - // Rejection sampling: - // 0 <= v < 9007199254740992 - // Probability that v >= 9e15, is - // 7199254740992 / 9007199254740992 ~= 0.0008, i.e. 1 in 1251 - if (v >= 9e15) { - b = crypto.getRandomValues(new Uint32Array(2)); - a[i] = b[0]; - a[i + 1] = b[1]; - } else { - - // 0 <= v <= 8999999999999999 - // 0 <= (v % 1e14) <= 99999999999999 - c.push(v % 1e14); - i += 2; - } - } - i = k / 2; - - // Node.js supporting crypto.randomBytes. - } else if (crypto.randomBytes) { - - // buffer - a = crypto.randomBytes(k *= 7); - - for (; i < k;) { - - // 0x1000000000000 is 2^48, 0x10000000000 is 2^40 - // 0x100000000 is 2^32, 0x1000000 is 2^24 - // 11111 11111111 11111111 11111111 11111111 11111111 11111111 - // 0 <= v < 9007199254740992 - v = ((a[i] & 31) * 0x1000000000000) + (a[i + 1] * 0x10000000000) + - (a[i + 2] * 0x100000000) + (a[i + 3] * 0x1000000) + - (a[i + 4] << 16) + (a[i + 5] << 8) + a[i + 6]; - - if (v >= 9e15) { - crypto.randomBytes(7).copy(a, i); - } else { - - // 0 <= (v % 1e14) <= 99999999999999 - c.push(v % 1e14); - i += 7; - } - } - i = k / 7; - } else { - CRYPTO = false; - throw Error - (bignumberError + 'crypto unavailable'); - } - } - - // Use Math.random. - if (!CRYPTO) { - - for (; i < k;) { - v = random53bitInt(); - if (v < 9e15) c[i++] = v % 1e14; - } - } - - k = c[--i]; - dp %= LOG_BASE; - - // Convert trailing digits to zeros according to dp. - if (k && dp) { - v = POWS_TEN[LOG_BASE - dp]; - c[i] = mathfloor(k / v) * v; - } - - // Remove trailing elements which are zero. - for (; c[i] === 0; c.pop(), i--); - - // Zero? - if (i < 0) { - c = [e = 0]; - } else { - - // Remove leading elements which are zero and adjust exponent accordingly. - for (e = -1 ; c[0] === 0; c.splice(0, 1), e -= LOG_BASE); - - // Count the digits of the first element of c to determine leading zeros, and... - for (i = 1, v = c[0]; v >= 10; v /= 10, i++); - - // adjust the exponent accordingly. - if (i < LOG_BASE) e -= LOG_BASE - i; - } - - rand.e = e; - rand.c = c; - return rand; - }; - })(); - - - /* - * Return a BigNumber whose value is the sum of the arguments. - * - * arguments {number|string|BigNumber} - */ - BigNumber.sum = function () { - var i = 1, - args = arguments, - sum = new BigNumber(args[0]); - for (; i < args.length;) sum = sum.plus(args[i++]); - return sum; - }; - - - // PRIVATE FUNCTIONS - - - // Called by BigNumber and BigNumber.prototype.toString. - convertBase = (function () { - var decimal = '0123456789'; - - /* - * Convert string of baseIn to an array of numbers of baseOut. - * Eg. toBaseOut('255', 10, 16) returns [15, 15]. - * Eg. toBaseOut('ff', 16, 10) returns [2, 5, 5]. - */ - function toBaseOut(str, baseIn, baseOut, alphabet) { - var j, - arr = [0], - arrL, - i = 0, - len = str.length; - - for (; i < len;) { - for (arrL = arr.length; arrL--; arr[arrL] *= baseIn); - - arr[0] += alphabet.indexOf(str.charAt(i++)); - - for (j = 0; j < arr.length; j++) { - - if (arr[j] > baseOut - 1) { - if (arr[j + 1] == null) arr[j + 1] = 0; - arr[j + 1] += arr[j] / baseOut | 0; - arr[j] %= baseOut; - } - } - } - - return arr.reverse(); - } - - // Convert a numeric string of baseIn to a numeric string of baseOut. - // If the caller is toString, we are converting from base 10 to baseOut. - // If the caller is BigNumber, we are converting from baseIn to base 10. - return function (str, baseIn, baseOut, sign, callerIsToString) { - var alphabet, d, e, k, r, x, xc, y, - i = str.indexOf('.'), - dp = DECIMAL_PLACES, - rm = ROUNDING_MODE; - - // Non-integer. - if (i >= 0) { - k = POW_PRECISION; - - // Unlimited precision. - POW_PRECISION = 0; - str = str.replace('.', ''); - y = new BigNumber(baseIn); - x = y.pow(str.length - i); - POW_PRECISION = k; - - // Convert str as if an integer, then restore the fraction part by dividing the - // result by its base raised to a power. - - y.c = toBaseOut(toFixedPoint(coeffToString(x.c), x.e, '0'), - 10, baseOut, decimal); - y.e = y.c.length; - } - - // Convert the number as integer. - - xc = toBaseOut(str, baseIn, baseOut, callerIsToString - ? (alphabet = ALPHABET, decimal) - : (alphabet = decimal, ALPHABET)); - - // xc now represents str as an integer and converted to baseOut. e is the exponent. - e = k = xc.length; - - // Remove trailing zeros. - for (; xc[--k] == 0; xc.pop()); - - // Zero? - if (!xc[0]) return alphabet.charAt(0); - - // Does str represent an integer? If so, no need for the division. - if (i < 0) { - --e; - } else { - x.c = xc; - x.e = e; - - // The sign is needed for correct rounding. - x.s = sign; - x = div(x, y, dp, rm, baseOut); - xc = x.c; - r = x.r; - e = x.e; - } - - // xc now represents str converted to baseOut. - - // THe index of the rounding digit. - d = e + dp + 1; - - // The rounding digit: the digit to the right of the digit that may be rounded up. - i = xc[d]; - - // Look at the rounding digits and mode to determine whether to round up. - - k = baseOut / 2; - r = r || d < 0 || xc[d + 1] != null; - - r = rm < 4 ? (i != null || r) && (rm == 0 || rm == (x.s < 0 ? 3 : 2)) - : i > k || i == k &&(rm == 4 || r || rm == 6 && xc[d - 1] & 1 || - rm == (x.s < 0 ? 8 : 7)); - - // If the index of the rounding digit is not greater than zero, or xc represents - // zero, then the result of the base conversion is zero or, if rounding up, a value - // such as 0.00001. - if (d < 1 || !xc[0]) { - - // 1^-dp or 0 - str = r ? toFixedPoint(alphabet.charAt(1), -dp, alphabet.charAt(0)) : alphabet.charAt(0); - } else { - - // Truncate xc to the required number of decimal places. - xc.length = d; - - // Round up? - if (r) { - - // Rounding up may mean the previous digit has to be rounded up and so on. - for (--baseOut; ++xc[--d] > baseOut;) { - xc[d] = 0; - - if (!d) { - ++e; - xc = [1].concat(xc); - } - } - } - - // Determine trailing zeros. - for (k = xc.length; !xc[--k];); - - // E.g. [4, 11, 15] becomes 4bf. - for (i = 0, str = ''; i <= k; str += alphabet.charAt(xc[i++])); - - // Add leading zeros, decimal point and trailing zeros as required. - str = toFixedPoint(str, e, alphabet.charAt(0)); - } - - // The caller will add the sign. - return str; - }; - })(); - - - // Perform division in the specified base. Called by div and convertBase. - div = (function () { - - // Assume non-zero x and k. - function multiply(x, k, base) { - var m, temp, xlo, xhi, - carry = 0, - i = x.length, - klo = k % SQRT_BASE, - khi = k / SQRT_BASE | 0; - - for (x = x.slice(); i--;) { - xlo = x[i] % SQRT_BASE; - xhi = x[i] / SQRT_BASE | 0; - m = khi * xlo + xhi * klo; - temp = klo * xlo + ((m % SQRT_BASE) * SQRT_BASE) + carry; - carry = (temp / base | 0) + (m / SQRT_BASE | 0) + khi * xhi; - x[i] = temp % base; - } - - if (carry) x = [carry].concat(x); - - return x; - } - - function compare(a, b, aL, bL) { - var i, cmp; - - if (aL != bL) { - cmp = aL > bL ? 1 : -1; - } else { - - for (i = cmp = 0; i < aL; i++) { - - if (a[i] != b[i]) { - cmp = a[i] > b[i] ? 1 : -1; - break; - } - } - } - - return cmp; - } - - function subtract(a, b, aL, base) { - var i = 0; - - // Subtract b from a. - for (; aL--;) { - a[aL] -= i; - i = a[aL] < b[aL] ? 1 : 0; - a[aL] = i * base + a[aL] - b[aL]; - } - - // Remove leading zeros. - for (; !a[0] && a.length > 1; a.splice(0, 1)); - } - - // x: dividend, y: divisor. - return function (x, y, dp, rm, base) { - var cmp, e, i, more, n, prod, prodL, q, qc, rem, remL, rem0, xi, xL, yc0, - yL, yz, - s = x.s == y.s ? 1 : -1, - xc = x.c, - yc = y.c; - - // Either NaN, Infinity or 0? - if (!xc || !xc[0] || !yc || !yc[0]) { - - return new BigNumber( - - // Return NaN if either NaN, or both Infinity or 0. - !x.s || !y.s || (xc ? yc && xc[0] == yc[0] : !yc) ? NaN : - - // Return ยฑ0 if x is ยฑ0 or y is ยฑInfinity, or return ยฑInfinity as y is ยฑ0. - xc && xc[0] == 0 || !yc ? s * 0 : s / 0 - ); - } - - q = new BigNumber(s); - qc = q.c = []; - e = x.e - y.e; - s = dp + e + 1; - - if (!base) { - base = BASE; - e = bitFloor(x.e / LOG_BASE) - bitFloor(y.e / LOG_BASE); - s = s / LOG_BASE | 0; - } - - // Result exponent may be one less then the current value of e. - // The coefficients of the BigNumbers from convertBase may have trailing zeros. - for (i = 0; yc[i] == (xc[i] || 0); i++); - - if (yc[i] > (xc[i] || 0)) e--; - - if (s < 0) { - qc.push(1); - more = true; - } else { - xL = xc.length; - yL = yc.length; - i = 0; - s += 2; - - // Normalise xc and yc so highest order digit of yc is >= base / 2. - - n = mathfloor(base / (yc[0] + 1)); - - // Not necessary, but to handle odd bases where yc[0] == (base / 2) - 1. - // if (n > 1 || n++ == 1 && yc[0] < base / 2) { - if (n > 1) { - yc = multiply(yc, n, base); - xc = multiply(xc, n, base); - yL = yc.length; - xL = xc.length; - } - - xi = yL; - rem = xc.slice(0, yL); - remL = rem.length; - - // Add zeros to make remainder as long as divisor. - for (; remL < yL; rem[remL++] = 0); - yz = yc.slice(); - yz = [0].concat(yz); - yc0 = yc[0]; - if (yc[1] >= base / 2) yc0++; - // Not necessary, but to prevent trial digit n > base, when using base 3. - // else if (base == 3 && yc0 == 1) yc0 = 1 + 1e-15; - - do { - n = 0; - - // Compare divisor and remainder. - cmp = compare(yc, rem, yL, remL); - - // If divisor < remainder. - if (cmp < 0) { - - // Calculate trial digit, n. - - rem0 = rem[0]; - if (yL != remL) rem0 = rem0 * base + (rem[1] || 0); - - // n is how many times the divisor goes into the current remainder. - n = mathfloor(rem0 / yc0); - - // Algorithm: - // product = divisor multiplied by trial digit (n). - // Compare product and remainder. - // If product is greater than remainder: - // Subtract divisor from product, decrement trial digit. - // Subtract product from remainder. - // If product was less than remainder at the last compare: - // Compare new remainder and divisor. - // If remainder is greater than divisor: - // Subtract divisor from remainder, increment trial digit. - - if (n > 1) { - - // n may be > base only when base is 3. - if (n >= base) n = base - 1; - - // product = divisor * trial digit. - prod = multiply(yc, n, base); - prodL = prod.length; - remL = rem.length; - - // Compare product and remainder. - // If product > remainder then trial digit n too high. - // n is 1 too high about 5% of the time, and is not known to have - // ever been more than 1 too high. - while (compare(prod, rem, prodL, remL) == 1) { - n--; - - // Subtract divisor from product. - subtract(prod, yL < prodL ? yz : yc, prodL, base); - prodL = prod.length; - cmp = 1; - } - } else { - - // n is 0 or 1, cmp is -1. - // If n is 0, there is no need to compare yc and rem again below, - // so change cmp to 1 to avoid it. - // If n is 1, leave cmp as -1, so yc and rem are compared again. - if (n == 0) { - - // divisor < remainder, so n must be at least 1. - cmp = n = 1; - } - - // product = divisor - prod = yc.slice(); - prodL = prod.length; - } - - if (prodL < remL) prod = [0].concat(prod); - - // Subtract product from remainder. - subtract(rem, prod, remL, base); - remL = rem.length; - - // If product was < remainder. - if (cmp == -1) { - - // Compare divisor and new remainder. - // If divisor < new remainder, subtract divisor from remainder. - // Trial digit n too low. - // n is 1 too low about 5% of the time, and very rarely 2 too low. - while (compare(yc, rem, yL, remL) < 1) { - n++; - - // Subtract divisor from remainder. - subtract(rem, yL < remL ? yz : yc, remL, base); - remL = rem.length; - } - } - } else if (cmp === 0) { - n++; - rem = [0]; - } // else cmp === 1 and n will be 0 - - // Add the next digit, n, to the result array. - qc[i++] = n; - - // Update the remainder. - if (rem[0]) { - rem[remL++] = xc[xi] || 0; - } else { - rem = [xc[xi]]; - remL = 1; - } - } while ((xi++ < xL || rem[0] != null) && s--); - - more = rem[0] != null; - - // Leading zero? - if (!qc[0]) qc.splice(0, 1); - } - - if (base == BASE) { - - // To calculate q.e, first get the number of digits of qc[0]. - for (i = 1, s = qc[0]; s >= 10; s /= 10, i++); - - round(q, dp + (q.e = i + e * LOG_BASE - 1) + 1, rm, more); - - // Caller is convertBase. - } else { - q.e = e; - q.r = +more; - } - - return q; - }; - })(); - - - /* - * Return a string representing the value of BigNumber n in fixed-point or exponential - * notation rounded to the specified decimal places or significant digits. - * - * n: a BigNumber. - * i: the index of the last digit required (i.e. the digit that may be rounded up). - * rm: the rounding mode. - * id: 1 (toExponential) or 2 (toPrecision). - */ - function format(n, i, rm, id) { - var c0, e, ne, len, str; - - if (rm == null) rm = ROUNDING_MODE; - else intCheck(rm, 0, 8); - - if (!n.c) return n.toString(); - - c0 = n.c[0]; - ne = n.e; - - if (i == null) { - str = coeffToString(n.c); - str = id == 1 || id == 2 && (ne <= TO_EXP_NEG || ne >= TO_EXP_POS) - ? toExponential(str, ne) - : toFixedPoint(str, ne, '0'); - } else { - n = round(new BigNumber(n), i, rm); - - // n.e may have changed if the value was rounded up. - e = n.e; - - str = coeffToString(n.c); - len = str.length; - - // toPrecision returns exponential notation if the number of significant digits - // specified is less than the number of digits necessary to represent the integer - // part of the value in fixed-point notation. - - // Exponential notation. - if (id == 1 || id == 2 && (i <= e || e <= TO_EXP_NEG)) { - - // Append zeros? - for (; len < i; str += '0', len++); - str = toExponential(str, e); - - // Fixed-point notation. - } else { - i -= ne; - str = toFixedPoint(str, e, '0'); - - // Append zeros? - if (e + 1 > len) { - if (--i > 0) for (str += '.'; i--; str += '0'); - } else { - i += e - len; - if (i > 0) { - if (e + 1 == len) str += '.'; - for (; i--; str += '0'); - } - } - } - } - - return n.s < 0 && c0 ? '-' + str : str; - } - - - // Handle BigNumber.max and BigNumber.min. - function maxOrMin(args, method) { - var n, - i = 1, - m = new BigNumber(args[0]); - - for (; i < args.length; i++) { - n = new BigNumber(args[i]); - - // If any number is NaN, return NaN. - if (!n.s) { - m = n; - break; - } else if (method.call(m, n)) { - m = n; - } - } - - return m; - } - - - /* - * Strip trailing zeros, calculate base 10 exponent and check against MIN_EXP and MAX_EXP. - * Called by minus, plus and times. - */ - function normalise(n, c, e) { - var i = 1, - j = c.length; - - // Remove trailing zeros. - for (; !c[--j]; c.pop()); - - // Calculate the base 10 exponent. First get the number of digits of c[0]. - for (j = c[0]; j >= 10; j /= 10, i++); - - // Overflow? - if ((e = i + e * LOG_BASE - 1) > MAX_EXP) { - - // Infinity. - n.c = n.e = null; - - // Underflow? - } else if (e < MIN_EXP) { - - // Zero. - n.c = [n.e = 0]; - } else { - n.e = e; - n.c = c; - } - - return n; - } - - - // Handle values that fail the validity test in BigNumber. - parseNumeric = (function () { - var basePrefix = /^(-?)0([xbo])(?=\w[\w.]*$)/i, - dotAfter = /^([^.]+)\.$/, - dotBefore = /^\.([^.]+)$/, - isInfinityOrNaN = /^-?(Infinity|NaN)$/, - whitespaceOrPlus = /^\s*\+(?=[\w.])|^\s+|\s+$/g; - - return function (x, str, isNum, b) { - var base, - s = isNum ? str : str.replace(whitespaceOrPlus, ''); - - // No exception on ยฑInfinity or NaN. - if (isInfinityOrNaN.test(s)) { - x.s = isNaN(s) ? null : s < 0 ? -1 : 1; - } else { - if (!isNum) { - - // basePrefix = /^(-?)0([xbo])(?=\w[\w.]*$)/i - s = s.replace(basePrefix, function (m, p1, p2) { - base = (p2 = p2.toLowerCase()) == 'x' ? 16 : p2 == 'b' ? 2 : 8; - return !b || b == base ? p1 : m; - }); - - if (b) { - base = b; - - // E.g. '1.' to '1', '.1' to '0.1' - s = s.replace(dotAfter, '$1').replace(dotBefore, '0.$1'); - } - - if (str != s) return new BigNumber(s, base); - } - - // '[BigNumber Error] Not a number: {n}' - // '[BigNumber Error] Not a base {b} number: {n}' - if (BigNumber.DEBUG) { - throw Error - (bignumberError + 'Not a' + (b ? ' base ' + b : '') + ' number: ' + str); - } - - // NaN - x.s = null; - } - - x.c = x.e = null; - } - })(); - - - /* - * Round x to sd significant digits using rounding mode rm. Check for over/under-flow. - * If r is truthy, it is known that there are more digits after the rounding digit. - */ - function round(x, sd, rm, r) { - var d, i, j, k, n, ni, rd, - xc = x.c, - pows10 = POWS_TEN; - - // if x is not Infinity or NaN... - if (xc) { - - // rd is the rounding digit, i.e. the digit after the digit that may be rounded up. - // n is a base 1e14 number, the value of the element of array x.c containing rd. - // ni is the index of n within x.c. - // d is the number of digits of n. - // i is the index of rd within n including leading zeros. - // j is the actual index of rd within n (if < 0, rd is a leading zero). - out: { - - // Get the number of digits of the first element of xc. - for (d = 1, k = xc[0]; k >= 10; k /= 10, d++); - i = sd - d; - - // If the rounding digit is in the first element of xc... - if (i < 0) { - i += LOG_BASE; - j = sd; - n = xc[ni = 0]; - - // Get the rounding digit at index j of n. - rd = n / pows10[d - j - 1] % 10 | 0; - } else { - ni = mathceil((i + 1) / LOG_BASE); - - if (ni >= xc.length) { - - if (r) { - - // Needed by sqrt. - for (; xc.length <= ni; xc.push(0)); - n = rd = 0; - d = 1; - i %= LOG_BASE; - j = i - LOG_BASE + 1; - } else { - break out; - } - } else { - n = k = xc[ni]; - - // Get the number of digits of n. - for (d = 1; k >= 10; k /= 10, d++); - - // Get the index of rd within n. - i %= LOG_BASE; - - // Get the index of rd within n, adjusted for leading zeros. - // The number of leading zeros of n is given by LOG_BASE - d. - j = i - LOG_BASE + d; - - // Get the rounding digit at index j of n. - rd = j < 0 ? 0 : n / pows10[d - j - 1] % 10 | 0; - } - } - - r = r || sd < 0 || - - // Are there any non-zero digits after the rounding digit? - // The expression n % pows10[d - j - 1] returns all digits of n to the right - // of the digit at j, e.g. if n is 908714 and j is 2, the expression gives 714. - xc[ni + 1] != null || (j < 0 ? n : n % pows10[d - j - 1]); - - r = rm < 4 - ? (rd || r) && (rm == 0 || rm == (x.s < 0 ? 3 : 2)) - : rd > 5 || rd == 5 && (rm == 4 || r || rm == 6 && - - // Check whether the digit to the left of the rounding digit is odd. - ((i > 0 ? j > 0 ? n / pows10[d - j] : 0 : xc[ni - 1]) % 10) & 1 || - rm == (x.s < 0 ? 8 : 7)); - - if (sd < 1 || !xc[0]) { - xc.length = 0; - - if (r) { - - // Convert sd to decimal places. - sd -= x.e + 1; - - // 1, 0.1, 0.01, 0.001, 0.0001 etc. - xc[0] = pows10[(LOG_BASE - sd % LOG_BASE) % LOG_BASE]; - x.e = -sd || 0; - } else { - - // Zero. - xc[0] = x.e = 0; - } - - return x; - } - - // Remove excess digits. - if (i == 0) { - xc.length = ni; - k = 1; - ni--; - } else { - xc.length = ni + 1; - k = pows10[LOG_BASE - i]; - - // E.g. 56700 becomes 56000 if 7 is the rounding digit. - // j > 0 means i > number of leading zeros of n. - xc[ni] = j > 0 ? mathfloor(n / pows10[d - j] % pows10[j]) * k : 0; - } - - // Round up? - if (r) { - - for (; ;) { - - // If the digit to be rounded up is in the first element of xc... - if (ni == 0) { - - // i will be the length of xc[0] before k is added. - for (i = 1, j = xc[0]; j >= 10; j /= 10, i++); - j = xc[0] += k; - for (k = 1; j >= 10; j /= 10, k++); - - // if i != k the length has increased. - if (i != k) { - x.e++; - if (xc[0] == BASE) xc[0] = 1; - } - - break; - } else { - xc[ni] += k; - if (xc[ni] != BASE) break; - xc[ni--] = 0; - k = 1; - } - } - } - - // Remove trailing zeros. - for (i = xc.length; xc[--i] === 0; xc.pop()); - } - - // Overflow? Infinity. - if (x.e > MAX_EXP) { - x.c = x.e = null; - - // Underflow? Zero. - } else if (x.e < MIN_EXP) { - x.c = [x.e = 0]; - } - } - - return x; - } - - - function valueOf(n) { - var str, - e = n.e; - - if (e === null) return n.toString(); - - str = coeffToString(n.c); - - str = e <= TO_EXP_NEG || e >= TO_EXP_POS - ? toExponential(str, e) - : toFixedPoint(str, e, '0'); - - return n.s < 0 ? '-' + str : str; - } - - - // PROTOTYPE/INSTANCE METHODS - - - /* - * Return a new BigNumber whose value is the absolute value of this BigNumber. - */ - P.absoluteValue = P.abs = function () { - var x = new BigNumber(this); - if (x.s < 0) x.s = 1; - return x; - }; - - - /* - * Return - * 1 if the value of this BigNumber is greater than the value of BigNumber(y, b), - * -1 if the value of this BigNumber is less than the value of BigNumber(y, b), - * 0 if they have the same value, - * or null if the value of either is NaN. - */ - P.comparedTo = function (y, b) { - return compare(this, new BigNumber(y, b)); - }; - - - /* - * If dp is undefined or null or true or false, return the number of decimal places of the - * value of this BigNumber, or null if the value of this BigNumber is ยฑInfinity or NaN. - * - * Otherwise, if dp is a number, return a new BigNumber whose value is the value of this - * BigNumber rounded to a maximum of dp decimal places using rounding mode rm, or - * ROUNDING_MODE if rm is omitted. - * - * [dp] {number} Decimal places: integer, 0 to MAX inclusive. - * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive. - * - * '[BigNumber Error] Argument {not a primitive number|not an integer|out of range}: {dp|rm}' - */ - P.decimalPlaces = P.dp = function (dp, rm) { - var c, n, v, - x = this; - - if (dp != null) { - intCheck(dp, 0, MAX); - if (rm == null) rm = ROUNDING_MODE; - else intCheck(rm, 0, 8); - - return round(new BigNumber(x), dp + x.e + 1, rm); - } - - if (!(c = x.c)) return null; - n = ((v = c.length - 1) - bitFloor(this.e / LOG_BASE)) * LOG_BASE; - - // Subtract the number of trailing zeros of the last number. - if (v = c[v]) for (; v % 10 == 0; v /= 10, n--); - if (n < 0) n = 0; - - return n; - }; - - - /* - * n / 0 = I - * n / N = N - * n / I = 0 - * 0 / n = 0 - * 0 / 0 = N - * 0 / N = N - * 0 / I = 0 - * N / n = N - * N / 0 = N - * N / N = N - * N / I = N - * I / n = I - * I / 0 = I - * I / N = N - * I / I = N - * - * Return a new BigNumber whose value is the value of this BigNumber divided by the value of - * BigNumber(y, b), rounded according to DECIMAL_PLACES and ROUNDING_MODE. - */ - P.dividedBy = P.div = function (y, b) { - return div(this, new BigNumber(y, b), DECIMAL_PLACES, ROUNDING_MODE); - }; - - - /* - * Return a new BigNumber whose value is the integer part of dividing the value of this - * BigNumber by the value of BigNumber(y, b). - */ - P.dividedToIntegerBy = P.idiv = function (y, b) { - return div(this, new BigNumber(y, b), 0, 1); - }; - - - /* - * Return a BigNumber whose value is the value of this BigNumber exponentiated by n. - * - * If m is present, return the result modulo m. - * If n is negative round according to DECIMAL_PLACES and ROUNDING_MODE. - * If POW_PRECISION is non-zero and m is not present, round to POW_PRECISION using ROUNDING_MODE. - * - * The modular power operation works efficiently when x, n, and m are integers, otherwise it - * is equivalent to calculating x.exponentiatedBy(n).modulo(m) with a POW_PRECISION of 0. - * - * n {number|string|BigNumber} The exponent. An integer. - * [m] {number|string|BigNumber} The modulus. - * - * '[BigNumber Error] Exponent not an integer: {n}' - */ - P.exponentiatedBy = P.pow = function (n, m) { - var half, isModExp, i, k, more, nIsBig, nIsNeg, nIsOdd, y, - x = this; - - n = new BigNumber(n); - - // Allow NaN and ยฑInfinity, but not other non-integers. - if (n.c && !n.isInteger()) { - throw Error - (bignumberError + 'Exponent not an integer: ' + valueOf(n)); - } - - if (m != null) m = new BigNumber(m); - - // Exponent of MAX_SAFE_INTEGER is 15. - nIsBig = n.e > 14; - - // If x is NaN, ยฑInfinity, ยฑ0 or ยฑ1, or n is ยฑInfinity, NaN or ยฑ0. - if (!x.c || !x.c[0] || x.c[0] == 1 && !x.e && x.c.length == 1 || !n.c || !n.c[0]) { - - // The sign of the result of pow when x is negative depends on the evenness of n. - // If +n overflows to ยฑInfinity, the evenness of n would be not be known. - y = new BigNumber(Math.pow(+valueOf(x), nIsBig ? 2 - isOdd(n) : +valueOf(n))); - return m ? y.mod(m) : y; - } - - nIsNeg = n.s < 0; - - if (m) { - - // x % m returns NaN if abs(m) is zero, or m is NaN. - if (m.c ? !m.c[0] : !m.s) return new BigNumber(NaN); - - isModExp = !nIsNeg && x.isInteger() && m.isInteger(); - - if (isModExp) x = x.mod(m); - - // Overflow to ยฑInfinity: >=2**1e10 or >=1.0000024**1e15. - // Underflow to ยฑ0: <=0.79**1e10 or <=0.9999975**1e15. - } else if (n.e > 9 && (x.e > 0 || x.e < -1 || (x.e == 0 - // [1, 240000000] - ? x.c[0] > 1 || nIsBig && x.c[1] >= 24e7 - // [80000000000000] [99999750000000] - : x.c[0] < 8e13 || nIsBig && x.c[0] <= 9999975e7))) { - - // If x is negative and n is odd, k = -0, else k = 0. - k = x.s < 0 && isOdd(n) ? -0 : 0; - - // If x >= 1, k = ยฑInfinity. - if (x.e > -1) k = 1 / k; - - // If n is negative return ยฑ0, else return ยฑInfinity. - return new BigNumber(nIsNeg ? 1 / k : k); - - } else if (POW_PRECISION) { - - // Truncating each coefficient array to a length of k after each multiplication - // equates to truncating significant digits to POW_PRECISION + [28, 41], - // i.e. there will be a minimum of 28 guard digits retained. - k = mathceil(POW_PRECISION / LOG_BASE + 2); - } - - if (nIsBig) { - half = new BigNumber(0.5); - if (nIsNeg) n.s = 1; - nIsOdd = isOdd(n); - } else { - i = Math.abs(+valueOf(n)); - nIsOdd = i % 2; - } - - y = new BigNumber(ONE); - - // Performs 54 loop iterations for n of 9007199254740991. - for (; ;) { - - if (nIsOdd) { - y = y.times(x); - if (!y.c) break; - - if (k) { - if (y.c.length > k) y.c.length = k; - } else if (isModExp) { - y = y.mod(m); //y = y.minus(div(y, m, 0, MODULO_MODE).times(m)); - } - } - - if (i) { - i = mathfloor(i / 2); - if (i === 0) break; - nIsOdd = i % 2; - } else { - n = n.times(half); - round(n, n.e + 1, 1); - - if (n.e > 14) { - nIsOdd = isOdd(n); - } else { - i = +valueOf(n); - if (i === 0) break; - nIsOdd = i % 2; - } - } - - x = x.times(x); - - if (k) { - if (x.c && x.c.length > k) x.c.length = k; - } else if (isModExp) { - x = x.mod(m); //x = x.minus(div(x, m, 0, MODULO_MODE).times(m)); - } - } - - if (isModExp) return y; - if (nIsNeg) y = ONE.div(y); - - return m ? y.mod(m) : k ? round(y, POW_PRECISION, ROUNDING_MODE, more) : y; - }; - - - /* - * Return a new BigNumber whose value is the value of this BigNumber rounded to an integer - * using rounding mode rm, or ROUNDING_MODE if rm is omitted. - * - * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive. - * - * '[BigNumber Error] Argument {not a primitive number|not an integer|out of range}: {rm}' - */ - P.integerValue = function (rm) { - var n = new BigNumber(this); - if (rm == null) rm = ROUNDING_MODE; - else intCheck(rm, 0, 8); - return round(n, n.e + 1, rm); - }; - - - /* - * Return true if the value of this BigNumber is equal to the value of BigNumber(y, b), - * otherwise return false. - */ - P.isEqualTo = P.eq = function (y, b) { - return compare(this, new BigNumber(y, b)) === 0; - }; - - - /* - * Return true if the value of this BigNumber is a finite number, otherwise return false. - */ - P.isFinite = function () { - return !!this.c; - }; - - - /* - * Return true if the value of this BigNumber is greater than the value of BigNumber(y, b), - * otherwise return false. - */ - P.isGreaterThan = P.gt = function (y, b) { - return compare(this, new BigNumber(y, b)) > 0; - }; - - - /* - * Return true if the value of this BigNumber is greater than or equal to the value of - * BigNumber(y, b), otherwise return false. - */ - P.isGreaterThanOrEqualTo = P.gte = function (y, b) { - return (b = compare(this, new BigNumber(y, b))) === 1 || b === 0; - - }; - - - /* - * Return true if the value of this BigNumber is an integer, otherwise return false. - */ - P.isInteger = function () { - return !!this.c && bitFloor(this.e / LOG_BASE) > this.c.length - 2; - }; - - - /* - * Return true if the value of this BigNumber is less than the value of BigNumber(y, b), - * otherwise return false. - */ - P.isLessThan = P.lt = function (y, b) { - return compare(this, new BigNumber(y, b)) < 0; - }; - - - /* - * Return true if the value of this BigNumber is less than or equal to the value of - * BigNumber(y, b), otherwise return false. - */ - P.isLessThanOrEqualTo = P.lte = function (y, b) { - return (b = compare(this, new BigNumber(y, b))) === -1 || b === 0; - }; - - - /* - * Return true if the value of this BigNumber is NaN, otherwise return false. - */ - P.isNaN = function () { - return !this.s; - }; - - - /* - * Return true if the value of this BigNumber is negative, otherwise return false. - */ - P.isNegative = function () { - return this.s < 0; - }; - - - /* - * Return true if the value of this BigNumber is positive, otherwise return false. - */ - P.isPositive = function () { - return this.s > 0; - }; - - - /* - * Return true if the value of this BigNumber is 0 or -0, otherwise return false. - */ - P.isZero = function () { - return !!this.c && this.c[0] == 0; - }; - - - /* - * n - 0 = n - * n - N = N - * n - I = -I - * 0 - n = -n - * 0 - 0 = 0 - * 0 - N = N - * 0 - I = -I - * N - n = N - * N - 0 = N - * N - N = N - * N - I = N - * I - n = I - * I - 0 = I - * I - N = N - * I - I = N - * - * Return a new BigNumber whose value is the value of this BigNumber minus the value of - * BigNumber(y, b). - */ - P.minus = function (y, b) { - var i, j, t, xLTy, - x = this, - a = x.s; - - y = new BigNumber(y, b); - b = y.s; - - // Either NaN? - if (!a || !b) return new BigNumber(NaN); - - // Signs differ? - if (a != b) { - y.s = -b; - return x.plus(y); - } - - var xe = x.e / LOG_BASE, - ye = y.e / LOG_BASE, - xc = x.c, - yc = y.c; - - if (!xe || !ye) { - - // Either Infinity? - if (!xc || !yc) return xc ? (y.s = -b, y) : new BigNumber(yc ? x : NaN); - - // Either zero? - if (!xc[0] || !yc[0]) { - - // Return y if y is non-zero, x if x is non-zero, or zero if both are zero. - return yc[0] ? (y.s = -b, y) : new BigNumber(xc[0] ? x : - - // IEEE 754 (2008) 6.3: n - n = -0 when rounding to -Infinity - ROUNDING_MODE == 3 ? -0 : 0); - } - } - - xe = bitFloor(xe); - ye = bitFloor(ye); - xc = xc.slice(); - - // Determine which is the bigger number. - if (a = xe - ye) { - - if (xLTy = a < 0) { - a = -a; - t = xc; - } else { - ye = xe; - t = yc; - } - - t.reverse(); - - // Prepend zeros to equalise exponents. - for (b = a; b--; t.push(0)); - t.reverse(); - } else { - - // Exponents equal. Check digit by digit. - j = (xLTy = (a = xc.length) < (b = yc.length)) ? a : b; - - for (a = b = 0; b < j; b++) { - - if (xc[b] != yc[b]) { - xLTy = xc[b] < yc[b]; - break; - } - } - } - - // x < y? Point xc to the array of the bigger number. - if (xLTy) { - t = xc; - xc = yc; - yc = t; - y.s = -y.s; - } - - b = (j = yc.length) - (i = xc.length); - - // Append zeros to xc if shorter. - // No need to add zeros to yc if shorter as subtract only needs to start at yc.length. - if (b > 0) for (; b--; xc[i++] = 0); - b = BASE - 1; - - // Subtract yc from xc. - for (; j > a;) { - - if (xc[--j] < yc[j]) { - for (i = j; i && !xc[--i]; xc[i] = b); - --xc[i]; - xc[j] += BASE; - } - - xc[j] -= yc[j]; - } - - // Remove leading zeros and adjust exponent accordingly. - for (; xc[0] == 0; xc.splice(0, 1), --ye); - - // Zero? - if (!xc[0]) { - - // Following IEEE 754 (2008) 6.3, - // n - n = +0 but n - n = -0 when rounding towards -Infinity. - y.s = ROUNDING_MODE == 3 ? -1 : 1; - y.c = [y.e = 0]; - return y; - } - - // No need to check for Infinity as +x - +y != Infinity && -x - -y != Infinity - // for finite x and y. - return normalise(y, xc, ye); - }; - - - /* - * n % 0 = N - * n % N = N - * n % I = n - * 0 % n = 0 - * -0 % n = -0 - * 0 % 0 = N - * 0 % N = N - * 0 % I = 0 - * N % n = N - * N % 0 = N - * N % N = N - * N % I = N - * I % n = N - * I % 0 = N - * I % N = N - * I % I = N - * - * Return a new BigNumber whose value is the value of this BigNumber modulo the value of - * BigNumber(y, b). The result depends on the value of MODULO_MODE. - */ - P.modulo = P.mod = function (y, b) { - var q, s, - x = this; - - y = new BigNumber(y, b); - - // Return NaN if x is Infinity or NaN, or y is NaN or zero. - if (!x.c || !y.s || y.c && !y.c[0]) { - return new BigNumber(NaN); - - // Return x if y is Infinity or x is zero. - } else if (!y.c || x.c && !x.c[0]) { - return new BigNumber(x); - } - - if (MODULO_MODE == 9) { - - // Euclidian division: q = sign(y) * floor(x / abs(y)) - // r = x - qy where 0 <= r < abs(y) - s = y.s; - y.s = 1; - q = div(x, y, 0, 3); - y.s = s; - q.s *= s; - } else { - q = div(x, y, 0, MODULO_MODE); - } - - y = x.minus(q.times(y)); - - // To match JavaScript %, ensure sign of zero is sign of dividend. - if (!y.c[0] && MODULO_MODE == 1) y.s = x.s; - - return y; - }; - - - /* - * n * 0 = 0 - * n * N = N - * n * I = I - * 0 * n = 0 - * 0 * 0 = 0 - * 0 * N = N - * 0 * I = N - * N * n = N - * N * 0 = N - * N * N = N - * N * I = N - * I * n = I - * I * 0 = N - * I * N = N - * I * I = I - * - * Return a new BigNumber whose value is the value of this BigNumber multiplied by the value - * of BigNumber(y, b). - */ - P.multipliedBy = P.times = function (y, b) { - var c, e, i, j, k, m, xcL, xlo, xhi, ycL, ylo, yhi, zc, - base, sqrtBase, - x = this, - xc = x.c, - yc = (y = new BigNumber(y, b)).c; - - // Either NaN, ยฑInfinity or ยฑ0? - if (!xc || !yc || !xc[0] || !yc[0]) { - - // Return NaN if either is NaN, or one is 0 and the other is Infinity. - if (!x.s || !y.s || xc && !xc[0] && !yc || yc && !yc[0] && !xc) { - y.c = y.e = y.s = null; - } else { - y.s *= x.s; - - // Return ยฑInfinity if either is ยฑInfinity. - if (!xc || !yc) { - y.c = y.e = null; - - // Return ยฑ0 if either is ยฑ0. - } else { - y.c = [0]; - y.e = 0; - } - } - - return y; - } - - e = bitFloor(x.e / LOG_BASE) + bitFloor(y.e / LOG_BASE); - y.s *= x.s; - xcL = xc.length; - ycL = yc.length; - - // Ensure xc points to longer array and xcL to its length. - if (xcL < ycL) { - zc = xc; - xc = yc; - yc = zc; - i = xcL; - xcL = ycL; - ycL = i; - } - - // Initialise the result array with zeros. - for (i = xcL + ycL, zc = []; i--; zc.push(0)); - - base = BASE; - sqrtBase = SQRT_BASE; - - for (i = ycL; --i >= 0;) { - c = 0; - ylo = yc[i] % sqrtBase; - yhi = yc[i] / sqrtBase | 0; - - for (k = xcL, j = i + k; j > i;) { - xlo = xc[--k] % sqrtBase; - xhi = xc[k] / sqrtBase | 0; - m = yhi * xlo + xhi * ylo; - xlo = ylo * xlo + ((m % sqrtBase) * sqrtBase) + zc[j] + c; - c = (xlo / base | 0) + (m / sqrtBase | 0) + yhi * xhi; - zc[j--] = xlo % base; - } - - zc[j] = c; - } - - if (c) { - ++e; - } else { - zc.splice(0, 1); - } - - return normalise(y, zc, e); - }; - - - /* - * Return a new BigNumber whose value is the value of this BigNumber negated, - * i.e. multiplied by -1. - */ - P.negated = function () { - var x = new BigNumber(this); - x.s = -x.s || null; - return x; - }; - - - /* - * n + 0 = n - * n + N = N - * n + I = I - * 0 + n = n - * 0 + 0 = 0 - * 0 + N = N - * 0 + I = I - * N + n = N - * N + 0 = N - * N + N = N - * N + I = N - * I + n = I - * I + 0 = I - * I + N = N - * I + I = I - * - * Return a new BigNumber whose value is the value of this BigNumber plus the value of - * BigNumber(y, b). - */ - P.plus = function (y, b) { - var t, - x = this, - a = x.s; - - y = new BigNumber(y, b); - b = y.s; - - // Either NaN? - if (!a || !b) return new BigNumber(NaN); - - // Signs differ? - if (a != b) { - y.s = -b; - return x.minus(y); - } - - var xe = x.e / LOG_BASE, - ye = y.e / LOG_BASE, - xc = x.c, - yc = y.c; - - if (!xe || !ye) { - - // Return ยฑInfinity if either ยฑInfinity. - if (!xc || !yc) return new BigNumber(a / 0); - - // Either zero? - // Return y if y is non-zero, x if x is non-zero, or zero if both are zero. - if (!xc[0] || !yc[0]) return yc[0] ? y : new BigNumber(xc[0] ? x : a * 0); - } - - xe = bitFloor(xe); - ye = bitFloor(ye); - xc = xc.slice(); - - // Prepend zeros to equalise exponents. Faster to use reverse then do unshifts. - if (a = xe - ye) { - if (a > 0) { - ye = xe; - t = yc; - } else { - a = -a; - t = xc; - } - - t.reverse(); - for (; a--; t.push(0)); - t.reverse(); - } - - a = xc.length; - b = yc.length; - - // Point xc to the longer array, and b to the shorter length. - if (a - b < 0) { - t = yc; - yc = xc; - xc = t; - b = a; - } - - // Only start adding at yc.length - 1 as the further digits of xc can be ignored. - for (a = 0; b;) { - a = (xc[--b] = xc[b] + yc[b] + a) / BASE | 0; - xc[b] = BASE === xc[b] ? 0 : xc[b] % BASE; - } - - if (a) { - xc = [a].concat(xc); - ++ye; - } - - // No need to check for zero, as +x + +y != 0 && -x + -y != 0 - // ye = MAX_EXP + 1 possible - return normalise(y, xc, ye); - }; - - - /* - * If sd is undefined or null or true or false, return the number of significant digits of - * the value of this BigNumber, or null if the value of this BigNumber is ยฑInfinity or NaN. - * If sd is true include integer-part trailing zeros in the count. - * - * Otherwise, if sd is a number, return a new BigNumber whose value is the value of this - * BigNumber rounded to a maximum of sd significant digits using rounding mode rm, or - * ROUNDING_MODE if rm is omitted. - * - * sd {number|boolean} number: significant digits: integer, 1 to MAX inclusive. - * boolean: whether to count integer-part trailing zeros: true or false. - * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive. - * - * '[BigNumber Error] Argument {not a primitive number|not an integer|out of range}: {sd|rm}' - */ - P.precision = P.sd = function (sd, rm) { - var c, n, v, - x = this; - - if (sd != null && sd !== !!sd) { - intCheck(sd, 1, MAX); - if (rm == null) rm = ROUNDING_MODE; - else intCheck(rm, 0, 8); - - return round(new BigNumber(x), sd, rm); - } - - if (!(c = x.c)) return null; - v = c.length - 1; - n = v * LOG_BASE + 1; - - if (v = c[v]) { - - // Subtract the number of trailing zeros of the last element. - for (; v % 10 == 0; v /= 10, n--); - - // Add the number of digits of the first element. - for (v = c[0]; v >= 10; v /= 10, n++); - } - - if (sd && x.e + 1 > n) n = x.e + 1; - - return n; - }; - - - /* - * Return a new BigNumber whose value is the value of this BigNumber shifted by k places - * (powers of 10). Shift to the right if n > 0, and to the left if n < 0. - * - * k {number} Integer, -MAX_SAFE_INTEGER to MAX_SAFE_INTEGER inclusive. - * - * '[BigNumber Error] Argument {not a primitive number|not an integer|out of range}: {k}' - */ - P.shiftedBy = function (k) { - intCheck(k, -MAX_SAFE_INTEGER, MAX_SAFE_INTEGER); - return this.times('1e' + k); - }; - - - /* - * sqrt(-n) = N - * sqrt(N) = N - * sqrt(-I) = N - * sqrt(I) = I - * sqrt(0) = 0 - * sqrt(-0) = -0 - * - * Return a new BigNumber whose value is the square root of the value of this BigNumber, - * rounded according to DECIMAL_PLACES and ROUNDING_MODE. - */ - P.squareRoot = P.sqrt = function () { - var m, n, r, rep, t, - x = this, - c = x.c, - s = x.s, - e = x.e, - dp = DECIMAL_PLACES + 4, - half = new BigNumber('0.5'); - - // Negative/NaN/Infinity/zero? - if (s !== 1 || !c || !c[0]) { - return new BigNumber(!s || s < 0 && (!c || c[0]) ? NaN : c ? x : 1 / 0); - } - - // Initial estimate. - s = Math.sqrt(+valueOf(x)); - - // Math.sqrt underflow/overflow? - // Pass x to Math.sqrt as integer, then adjust the exponent of the result. - if (s == 0 || s == 1 / 0) { - n = coeffToString(c); - if ((n.length + e) % 2 == 0) n += '0'; - s = Math.sqrt(+n); - e = bitFloor((e + 1) / 2) - (e < 0 || e % 2); - - if (s == 1 / 0) { - n = '5e' + e; - } else { - n = s.toExponential(); - n = n.slice(0, n.indexOf('e') + 1) + e; - } - - r = new BigNumber(n); - } else { - r = new BigNumber(s + ''); - } - - // Check for zero. - // r could be zero if MIN_EXP is changed after the this value was created. - // This would cause a division by zero (x/t) and hence Infinity below, which would cause - // coeffToString to throw. - if (r.c[0]) { - e = r.e; - s = e + dp; - if (s < 3) s = 0; - - // Newton-Raphson iteration. - for (; ;) { - t = r; - r = half.times(t.plus(div(x, t, dp, 1))); - - if (coeffToString(t.c).slice(0, s) === (n = coeffToString(r.c)).slice(0, s)) { - - // The exponent of r may here be one less than the final result exponent, - // e.g 0.0009999 (e-4) --> 0.001 (e-3), so adjust s so the rounding digits - // are indexed correctly. - if (r.e < e) --s; - n = n.slice(s - 3, s + 1); - - // The 4th rounding digit may be in error by -1 so if the 4 rounding digits - // are 9999 or 4999 (i.e. approaching a rounding boundary) continue the - // iteration. - if (n == '9999' || !rep && n == '4999') { - - // On the first iteration only, check to see if rounding up gives the - // exact result as the nines may infinitely repeat. - if (!rep) { - round(t, t.e + DECIMAL_PLACES + 2, 0); - - if (t.times(t).eq(x)) { - r = t; - break; - } - } - - dp += 4; - s += 4; - rep = 1; - } else { - - // If rounding digits are null, 0{0,4} or 50{0,3}, check for exact - // result. If not, then there are further digits and m will be truthy. - if (!+n || !+n.slice(1) && n.charAt(0) == '5') { - - // Truncate to the first rounding digit. - round(r, r.e + DECIMAL_PLACES + 2, 1); - m = !r.times(r).eq(x); - } - - break; - } - } - } - } - - return round(r, r.e + DECIMAL_PLACES + 1, ROUNDING_MODE, m); - }; - - - /* - * Return a string representing the value of this BigNumber in exponential notation and - * rounded using ROUNDING_MODE to dp fixed decimal places. - * - * [dp] {number} Decimal places. Integer, 0 to MAX inclusive. - * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive. - * - * '[BigNumber Error] Argument {not a primitive number|not an integer|out of range}: {dp|rm}' - */ - P.toExponential = function (dp, rm) { - if (dp != null) { - intCheck(dp, 0, MAX); - dp++; - } - return format(this, dp, rm, 1); - }; - - - /* - * Return a string representing the value of this BigNumber in fixed-point notation rounding - * to dp fixed decimal places using rounding mode rm, or ROUNDING_MODE if rm is omitted. - * - * Note: as with JavaScript's number type, (-0).toFixed(0) is '0', - * but e.g. (-0.00001).toFixed(0) is '-0'. - * - * [dp] {number} Decimal places. Integer, 0 to MAX inclusive. - * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive. - * - * '[BigNumber Error] Argument {not a primitive number|not an integer|out of range}: {dp|rm}' - */ - P.toFixed = function (dp, rm) { - if (dp != null) { - intCheck(dp, 0, MAX); - dp = dp + this.e + 1; - } - return format(this, dp, rm); - }; - - - /* - * Return a string representing the value of this BigNumber in fixed-point notation rounded - * using rm or ROUNDING_MODE to dp decimal places, and formatted according to the properties - * of the format or FORMAT object (see BigNumber.set). - * - * The formatting object may contain some or all of the properties shown below. - * - * FORMAT = { - * prefix: '', - * groupSize: 3, - * secondaryGroupSize: 0, - * groupSeparator: ',', - * decimalSeparator: '.', - * fractionGroupSize: 0, - * fractionGroupSeparator: '\xA0', // non-breaking space - * suffix: '' - * }; - * - * [dp] {number} Decimal places. Integer, 0 to MAX inclusive. - * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive. - * [format] {object} Formatting options. See FORMAT pbject above. - * - * '[BigNumber Error] Argument {not a primitive number|not an integer|out of range}: {dp|rm}' - * '[BigNumber Error] Argument not an object: {format}' - */ - P.toFormat = function (dp, rm, format) { - var str, - x = this; - - if (format == null) { - if (dp != null && rm && typeof rm == 'object') { - format = rm; - rm = null; - } else if (dp && typeof dp == 'object') { - format = dp; - dp = rm = null; - } else { - format = FORMAT; - } - } else if (typeof format != 'object') { - throw Error - (bignumberError + 'Argument not an object: ' + format); - } - - str = x.toFixed(dp, rm); - - if (x.c) { - var i, - arr = str.split('.'), - g1 = +format.groupSize, - g2 = +format.secondaryGroupSize, - groupSeparator = format.groupSeparator || '', - intPart = arr[0], - fractionPart = arr[1], - isNeg = x.s < 0, - intDigits = isNeg ? intPart.slice(1) : intPart, - len = intDigits.length; - - if (g2) { - i = g1; - g1 = g2; - g2 = i; - len -= i; - } - - if (g1 > 0 && len > 0) { - i = len % g1 || g1; - intPart = intDigits.substr(0, i); - for (; i < len; i += g1) intPart += groupSeparator + intDigits.substr(i, g1); - if (g2 > 0) intPart += groupSeparator + intDigits.slice(i); - if (isNeg) intPart = '-' + intPart; - } - - str = fractionPart - ? intPart + (format.decimalSeparator || '') + ((g2 = +format.fractionGroupSize) - ? fractionPart.replace(new RegExp('\\d{' + g2 + '}\\B', 'g'), - '$&' + (format.fractionGroupSeparator || '')) - : fractionPart) - : intPart; - } - - return (format.prefix || '') + str + (format.suffix || ''); - }; - - - /* - * Return an array of two BigNumbers representing the value of this BigNumber as a simple - * fraction with an integer numerator and an integer denominator. - * The denominator will be a positive non-zero value less than or equal to the specified - * maximum denominator. If a maximum denominator is not specified, the denominator will be - * the lowest value necessary to represent the number exactly. - * - * [md] {number|string|BigNumber} Integer >= 1, or Infinity. The maximum denominator. - * - * '[BigNumber Error] Argument {not an integer|out of range} : {md}' - */ - P.toFraction = function (md) { - var d, d0, d1, d2, e, exp, n, n0, n1, q, r, s, - x = this, - xc = x.c; - - if (md != null) { - n = new BigNumber(md); - - // Throw if md is less than one or is not an integer, unless it is Infinity. - if (!n.isInteger() && (n.c || n.s !== 1) || n.lt(ONE)) { - throw Error - (bignumberError + 'Argument ' + - (n.isInteger() ? 'out of range: ' : 'not an integer: ') + valueOf(n)); - } - } - - if (!xc) return new BigNumber(x); - - d = new BigNumber(ONE); - n1 = d0 = new BigNumber(ONE); - d1 = n0 = new BigNumber(ONE); - s = coeffToString(xc); - - // Determine initial denominator. - // d is a power of 10 and the minimum max denominator that specifies the value exactly. - e = d.e = s.length - x.e - 1; - d.c[0] = POWS_TEN[(exp = e % LOG_BASE) < 0 ? LOG_BASE + exp : exp]; - md = !md || n.comparedTo(d) > 0 ? (e > 0 ? d : n1) : n; - - exp = MAX_EXP; - MAX_EXP = 1 / 0; - n = new BigNumber(s); - - // n0 = d1 = 0 - n0.c[0] = 0; - - for (; ;) { - q = div(n, d, 0, 1); - d2 = d0.plus(q.times(d1)); - if (d2.comparedTo(md) == 1) break; - d0 = d1; - d1 = d2; - n1 = n0.plus(q.times(d2 = n1)); - n0 = d2; - d = n.minus(q.times(d2 = d)); - n = d2; - } - - d2 = div(md.minus(d0), d1, 0, 1); - n0 = n0.plus(d2.times(n1)); - d0 = d0.plus(d2.times(d1)); - n0.s = n1.s = x.s; - e = e * 2; - - // Determine which fraction is closer to x, n0/d0 or n1/d1 - r = div(n1, d1, e, ROUNDING_MODE).minus(x).abs().comparedTo( - div(n0, d0, e, ROUNDING_MODE).minus(x).abs()) < 1 ? [n1, d1] : [n0, d0]; - - MAX_EXP = exp; - - return r; - }; - - - /* - * Return the value of this BigNumber converted to a number primitive. - */ - P.toNumber = function () { - return +valueOf(this); - }; - - - /* - * Return a string representing the value of this BigNumber rounded to sd significant digits - * using rounding mode rm or ROUNDING_MODE. If sd is less than the number of digits - * necessary to represent the integer part of the value in fixed-point notation, then use - * exponential notation. - * - * [sd] {number} Significant digits. Integer, 1 to MAX inclusive. - * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive. - * - * '[BigNumber Error] Argument {not a primitive number|not an integer|out of range}: {sd|rm}' - */ - P.toPrecision = function (sd, rm) { - if (sd != null) intCheck(sd, 1, MAX); - return format(this, sd, rm, 2); - }; - - - /* - * Return a string representing the value of this BigNumber in base b, or base 10 if b is - * omitted. If a base is specified, including base 10, round according to DECIMAL_PLACES and - * ROUNDING_MODE. If a base is not specified, and this BigNumber has a positive exponent - * that is equal to or greater than TO_EXP_POS, or a negative exponent equal to or less than - * TO_EXP_NEG, return exponential notation. - * - * [b] {number} Integer, 2 to ALPHABET.length inclusive. - * - * '[BigNumber Error] Base {not a primitive number|not an integer|out of range}: {b}' - */ - P.toString = function (b) { - var str, - n = this, - s = n.s, - e = n.e; - - // Infinity or NaN? - if (e === null) { - if (s) { - str = 'Infinity'; - if (s < 0) str = '-' + str; - } else { - str = 'NaN'; - } - } else { - if (b == null) { - str = e <= TO_EXP_NEG || e >= TO_EXP_POS - ? toExponential(coeffToString(n.c), e) - : toFixedPoint(coeffToString(n.c), e, '0'); - } else if (b === 10 && alphabetHasNormalDecimalDigits) { - n = round(new BigNumber(n), DECIMAL_PLACES + e + 1, ROUNDING_MODE); - str = toFixedPoint(coeffToString(n.c), n.e, '0'); - } else { - intCheck(b, 2, ALPHABET.length, 'Base'); - str = convertBase(toFixedPoint(coeffToString(n.c), e, '0'), 10, b, s, true); - } - - if (s < 0 && n.c[0]) str = '-' + str; - } - - return str; - }; - - - /* - * Return as toString, but do not accept a base argument, and include the minus sign for - * negative zero. - */ - P.valueOf = P.toJSON = function () { - return valueOf(this); - }; - - - P._isBigNumber = true; - - if (configObject != null) BigNumber.set(configObject); - - return BigNumber; - } - - - // PRIVATE HELPER FUNCTIONS - - // These functions don't need access to variables, - // e.g. DECIMAL_PLACES, in the scope of the `clone` function above. - - - function bitFloor(n) { - var i = n | 0; - return n > 0 || n === i ? i : i - 1; - } - - - // Return a coefficient array as a string of base 10 digits. - function coeffToString(a) { - var s, z, - i = 1, - j = a.length, - r = a[0] + ''; - - for (; i < j;) { - s = a[i++] + ''; - z = LOG_BASE - s.length; - for (; z--; s = '0' + s); - r += s; - } - - // Determine trailing zeros. - for (j = r.length; r.charCodeAt(--j) === 48;); - - return r.slice(0, j + 1 || 1); - } - - - // Compare the value of BigNumbers x and y. - function compare(x, y) { - var a, b, - xc = x.c, - yc = y.c, - i = x.s, - j = y.s, - k = x.e, - l = y.e; - - // Either NaN? - if (!i || !j) return null; - - a = xc && !xc[0]; - b = yc && !yc[0]; - - // Either zero? - if (a || b) return a ? b ? 0 : -j : i; - - // Signs differ? - if (i != j) return i; - - a = i < 0; - b = k == l; - - // Either Infinity? - if (!xc || !yc) return b ? 0 : !xc ^ a ? 1 : -1; - - // Compare exponents. - if (!b) return k > l ^ a ? 1 : -1; - - j = (k = xc.length) < (l = yc.length) ? k : l; - - // Compare digit by digit. - for (i = 0; i < j; i++) if (xc[i] != yc[i]) return xc[i] > yc[i] ^ a ? 1 : -1; - - // Compare lengths. - return k == l ? 0 : k > l ^ a ? 1 : -1; - } - - - /* - * Check that n is a primitive number, an integer, and in range, otherwise throw. - */ - function intCheck(n, min, max, name) { - if (n < min || n > max || n !== mathfloor(n)) { - throw Error - (bignumberError + (name || 'Argument') + (typeof n == 'number' - ? n < min || n > max ? ' out of range: ' : ' not an integer: ' - : ' not a primitive number: ') + String(n)); - } - } - - - // Assumes finite n. - function isOdd(n) { - var k = n.c.length - 1; - return bitFloor(n.e / LOG_BASE) == k && n.c[k] % 2 != 0; - } - - - function toExponential(str, e) { - return (str.length > 1 ? str.charAt(0) + '.' + str.slice(1) : str) + - (e < 0 ? 'e' : 'e+') + e; - } - - - function toFixedPoint(str, e, z) { - var len, zs; - - // Negative exponent? - if (e < 0) { - - // Prepend zeros. - for (zs = z + '.'; ++e; zs += z); - str = zs + str; - - // Positive exponent - } else { - len = str.length; - - // Append zeros. - if (++e > len) { - for (zs = z, e -= len; --e; zs += z); - str += zs; - } else if (e < len) { - str = str.slice(0, e) + '.' + str.slice(e); - } - } - - return str; - } - - - // EXPORT - - - BigNumber = clone(); - BigNumber['default'] = BigNumber.BigNumber = BigNumber; - - // AMD. - if (typeof define == 'function' && define.amd) { - define(function () { return BigNumber; }); - - // Node.js and other environments that support module.exports. - } else if (typeof module != 'undefined' && module.exports) { - module.exports = BigNumber; - - // Browser. - } else { - if (!globalObject) { - globalObject = typeof self != 'undefined' && self ? self : window; - } - - globalObject.BigNumber = BigNumber; - } -})(this); - -},{}],52:[function(require,module,exports){ -(function (module, exports) { - 'use strict'; - - // Utils - function assert (val, msg) { - if (!val) throw new Error(msg || 'Assertion failed'); - } - - // Could use `inherits` module, but don't want to move from single file - // architecture yet. - function inherits (ctor, superCtor) { - ctor.super_ = superCtor; - var TempCtor = function () {}; - TempCtor.prototype = superCtor.prototype; - ctor.prototype = new TempCtor(); - ctor.prototype.constructor = ctor; - } - - // BN - - function BN (number, base, endian) { - if (BN.isBN(number)) { - return number; - } - - this.negative = 0; - this.words = null; - this.length = 0; - - // Reduction context - this.red = null; - - if (number !== null) { - if (base === 'le' || base === 'be') { - endian = base; - base = 10; - } - - this._init(number || 0, base || 10, endian || 'be'); - } - } - if (typeof module === 'object') { - module.exports = BN; - } else { - exports.BN = BN; - } - - BN.BN = BN; - BN.wordSize = 26; - - var Buffer; - try { - Buffer = require('buffer').Buffer; - } catch (e) { - } - - BN.isBN = function isBN (num) { - if (num instanceof BN) { - return true; - } - - return num !== null && typeof num === 'object' && - num.constructor.wordSize === BN.wordSize && Array.isArray(num.words); - }; - - BN.max = function max (left, right) { - if (left.cmp(right) > 0) return left; - return right; - }; - - BN.min = function min (left, right) { - if (left.cmp(right) < 0) return left; - return right; - }; - - BN.prototype._init = function init (number, base, endian) { - if (typeof number === 'number') { - return this._initNumber(number, base, endian); - } - - if (typeof number === 'object') { - return this._initArray(number, base, endian); - } - - if (base === 'hex') { - base = 16; - } - assert(base === (base | 0) && base >= 2 && base <= 36); - - number = number.toString().replace(/\s+/g, ''); - var start = 0; - if (number[0] === '-') { - start++; - } - - if (base === 16) { - this._parseHex(number, start); - } else { - this._parseBase(number, base, start); - } - - if (number[0] === '-') { - this.negative = 1; - } - - this.strip(); - - if (endian !== 'le') return; - - this._initArray(this.toArray(), base, endian); - }; - - BN.prototype._initNumber = function _initNumber (number, base, endian) { - if (number < 0) { - this.negative = 1; - number = -number; - } - if (number < 0x4000000) { - this.words = [ number & 0x3ffffff ]; - this.length = 1; - } else if (number < 0x10000000000000) { - this.words = [ - number & 0x3ffffff, - (number / 0x4000000) & 0x3ffffff - ]; - this.length = 2; - } else { - assert(number < 0x20000000000000); // 2 ^ 53 (unsafe) - this.words = [ - number & 0x3ffffff, - (number / 0x4000000) & 0x3ffffff, - 1 - ]; - this.length = 3; - } - - if (endian !== 'le') return; - - // Reverse the bytes - this._initArray(this.toArray(), base, endian); - }; - - BN.prototype._initArray = function _initArray (number, base, endian) { - // Perhaps a Uint8Array - assert(typeof number.length === 'number'); - if (number.length <= 0) { - this.words = [ 0 ]; - this.length = 1; - return this; - } - - this.length = Math.ceil(number.length / 3); - this.words = new Array(this.length); - for (var i = 0; i < this.length; i++) { - this.words[i] = 0; - } - - var j, w; - var off = 0; - if (endian === 'be') { - for (i = number.length - 1, j = 0; i >= 0; i -= 3) { - w = number[i] | (number[i - 1] << 8) | (number[i - 2] << 16); - this.words[j] |= (w << off) & 0x3ffffff; - this.words[j + 1] = (w >>> (26 - off)) & 0x3ffffff; - off += 24; - if (off >= 26) { - off -= 26; - j++; - } - } - } else if (endian === 'le') { - for (i = 0, j = 0; i < number.length; i += 3) { - w = number[i] | (number[i + 1] << 8) | (number[i + 2] << 16); - this.words[j] |= (w << off) & 0x3ffffff; - this.words[j + 1] = (w >>> (26 - off)) & 0x3ffffff; - off += 24; - if (off >= 26) { - off -= 26; - j++; - } - } - } - return this.strip(); - }; - - function parseHex (str, start, end) { - var r = 0; - var len = Math.min(str.length, end); - for (var i = start; i < len; i++) { - var c = str.charCodeAt(i) - 48; - - r <<= 4; - - // 'a' - 'f' - if (c >= 49 && c <= 54) { - r |= c - 49 + 0xa; - - // 'A' - 'F' - } else if (c >= 17 && c <= 22) { - r |= c - 17 + 0xa; - - // '0' - '9' - } else { - r |= c & 0xf; - } - } - return r; - } - - BN.prototype._parseHex = function _parseHex (number, start) { - // Create possibly bigger array to ensure that it fits the number - this.length = Math.ceil((number.length - start) / 6); - this.words = new Array(this.length); - for (var i = 0; i < this.length; i++) { - this.words[i] = 0; - } - - var j, w; - // Scan 24-bit chunks and add them to the number - var off = 0; - for (i = number.length - 6, j = 0; i >= start; i -= 6) { - w = parseHex(number, i, i + 6); - this.words[j] |= (w << off) & 0x3ffffff; - // NOTE: `0x3fffff` is intentional here, 26bits max shift + 24bit hex limb - this.words[j + 1] |= w >>> (26 - off) & 0x3fffff; - off += 24; - if (off >= 26) { - off -= 26; - j++; - } - } - if (i + 6 !== start) { - w = parseHex(number, start, i + 6); - this.words[j] |= (w << off) & 0x3ffffff; - this.words[j + 1] |= w >>> (26 - off) & 0x3fffff; - } - this.strip(); - }; - - function parseBase (str, start, end, mul) { - var r = 0; - var len = Math.min(str.length, end); - for (var i = start; i < len; i++) { - var c = str.charCodeAt(i) - 48; - - r *= mul; - - // 'a' - if (c >= 49) { - r += c - 49 + 0xa; - - // 'A' - } else if (c >= 17) { - r += c - 17 + 0xa; - - // '0' - '9' - } else { - r += c; - } - } - return r; - } - - BN.prototype._parseBase = function _parseBase (number, base, start) { - // Initialize as zero - this.words = [ 0 ]; - this.length = 1; - - // Find length of limb in base - for (var limbLen = 0, limbPow = 1; limbPow <= 0x3ffffff; limbPow *= base) { - limbLen++; - } - limbLen--; - limbPow = (limbPow / base) | 0; - - var total = number.length - start; - var mod = total % limbLen; - var end = Math.min(total, total - mod) + start; - - var word = 0; - for (var i = start; i < end; i += limbLen) { - word = parseBase(number, i, i + limbLen, base); - - this.imuln(limbPow); - if (this.words[0] + word < 0x4000000) { - this.words[0] += word; - } else { - this._iaddn(word); - } - } - - if (mod !== 0) { - var pow = 1; - word = parseBase(number, i, number.length, base); - - for (i = 0; i < mod; i++) { - pow *= base; - } - - this.imuln(pow); - if (this.words[0] + word < 0x4000000) { - this.words[0] += word; - } else { - this._iaddn(word); - } - } - }; - - BN.prototype.copy = function copy (dest) { - dest.words = new Array(this.length); - for (var i = 0; i < this.length; i++) { - dest.words[i] = this.words[i]; - } - dest.length = this.length; - dest.negative = this.negative; - dest.red = this.red; - }; - - BN.prototype.clone = function clone () { - var r = new BN(null); - this.copy(r); - return r; - }; - - BN.prototype._expand = function _expand (size) { - while (this.length < size) { - this.words[this.length++] = 0; - } - return this; - }; - - // Remove leading `0` from `this` - BN.prototype.strip = function strip () { - while (this.length > 1 && this.words[this.length - 1] === 0) { - this.length--; - } - return this._normSign(); - }; - - BN.prototype._normSign = function _normSign () { - // -0 = 0 - if (this.length === 1 && this.words[0] === 0) { - this.negative = 0; - } - return this; - }; - - BN.prototype.inspect = function inspect () { - return (this.red ? ''; - }; - - /* - - var zeros = []; - var groupSizes = []; - var groupBases = []; - - var s = ''; - var i = -1; - while (++i < BN.wordSize) { - zeros[i] = s; - s += '0'; - } - groupSizes[0] = 0; - groupSizes[1] = 0; - groupBases[0] = 0; - groupBases[1] = 0; - var base = 2 - 1; - while (++base < 36 + 1) { - var groupSize = 0; - var groupBase = 1; - while (groupBase < (1 << BN.wordSize) / base) { - groupBase *= base; - groupSize += 1; - } - groupSizes[base] = groupSize; - groupBases[base] = groupBase; - } - - */ - - var zeros = [ - '', - '0', - '00', - '000', - '0000', - '00000', - '000000', - '0000000', - '00000000', - '000000000', - '0000000000', - '00000000000', - '000000000000', - '0000000000000', - '00000000000000', - '000000000000000', - '0000000000000000', - '00000000000000000', - '000000000000000000', - '0000000000000000000', - '00000000000000000000', - '000000000000000000000', - '0000000000000000000000', - '00000000000000000000000', - '000000000000000000000000', - '0000000000000000000000000' - ]; - - var groupSizes = [ - 0, 0, - 25, 16, 12, 11, 10, 9, 8, - 8, 7, 7, 7, 7, 6, 6, - 6, 6, 6, 6, 6, 5, 5, - 5, 5, 5, 5, 5, 5, 5, - 5, 5, 5, 5, 5, 5, 5 - ]; - - var groupBases = [ - 0, 0, - 33554432, 43046721, 16777216, 48828125, 60466176, 40353607, 16777216, - 43046721, 10000000, 19487171, 35831808, 62748517, 7529536, 11390625, - 16777216, 24137569, 34012224, 47045881, 64000000, 4084101, 5153632, - 6436343, 7962624, 9765625, 11881376, 14348907, 17210368, 20511149, - 24300000, 28629151, 33554432, 39135393, 45435424, 52521875, 60466176 - ]; - - BN.prototype.toString = function toString (base, padding) { - base = base || 10; - padding = padding | 0 || 1; - - var out; - if (base === 16 || base === 'hex') { - out = ''; - var off = 0; - var carry = 0; - for (var i = 0; i < this.length; i++) { - var w = this.words[i]; - var word = (((w << off) | carry) & 0xffffff).toString(16); - carry = (w >>> (24 - off)) & 0xffffff; - if (carry !== 0 || i !== this.length - 1) { - out = zeros[6 - word.length] + word + out; - } else { - out = word + out; - } - off += 2; - if (off >= 26) { - off -= 26; - i--; - } - } - if (carry !== 0) { - out = carry.toString(16) + out; - } - while (out.length % padding !== 0) { - out = '0' + out; - } - if (this.negative !== 0) { - out = '-' + out; - } - return out; - } - - if (base === (base | 0) && base >= 2 && base <= 36) { - // var groupSize = Math.floor(BN.wordSize * Math.LN2 / Math.log(base)); - var groupSize = groupSizes[base]; - // var groupBase = Math.pow(base, groupSize); - var groupBase = groupBases[base]; - out = ''; - var c = this.clone(); - c.negative = 0; - while (!c.isZero()) { - var r = c.modn(groupBase).toString(base); - c = c.idivn(groupBase); - - if (!c.isZero()) { - out = zeros[groupSize - r.length] + r + out; - } else { - out = r + out; - } - } - if (this.isZero()) { - out = '0' + out; - } - while (out.length % padding !== 0) { - out = '0' + out; - } - if (this.negative !== 0) { - out = '-' + out; - } - return out; - } - - assert(false, 'Base should be between 2 and 36'); - }; - - BN.prototype.toNumber = function toNumber () { - var ret = this.words[0]; - if (this.length === 2) { - ret += this.words[1] * 0x4000000; - } else if (this.length === 3 && this.words[2] === 0x01) { - // NOTE: at this stage it is known that the top bit is set - ret += 0x10000000000000 + (this.words[1] * 0x4000000); - } else if (this.length > 2) { - assert(false, 'Number can only safely store up to 53 bits'); - } - return (this.negative !== 0) ? -ret : ret; - }; - - BN.prototype.toJSON = function toJSON () { - return this.toString(16); - }; - - BN.prototype.toBuffer = function toBuffer (endian, length) { - assert(typeof Buffer !== 'undefined'); - return this.toArrayLike(Buffer, endian, length); - }; - - BN.prototype.toArray = function toArray (endian, length) { - return this.toArrayLike(Array, endian, length); - }; - - BN.prototype.toArrayLike = function toArrayLike (ArrayType, endian, length) { - var byteLength = this.byteLength(); - var reqLength = length || Math.max(1, byteLength); - assert(byteLength <= reqLength, 'byte array longer than desired length'); - assert(reqLength > 0, 'Requested array length <= 0'); - - this.strip(); - var littleEndian = endian === 'le'; - var res = new ArrayType(reqLength); - - var b, i; - var q = this.clone(); - if (!littleEndian) { - // Assume big-endian - for (i = 0; i < reqLength - byteLength; i++) { - res[i] = 0; - } - - for (i = 0; !q.isZero(); i++) { - b = q.andln(0xff); - q.iushrn(8); - - res[reqLength - i - 1] = b; - } - } else { - for (i = 0; !q.isZero(); i++) { - b = q.andln(0xff); - q.iushrn(8); - - res[i] = b; - } - - for (; i < reqLength; i++) { - res[i] = 0; - } - } - - return res; - }; - - if (Math.clz32) { - BN.prototype._countBits = function _countBits (w) { - return 32 - Math.clz32(w); - }; - } else { - BN.prototype._countBits = function _countBits (w) { - var t = w; - var r = 0; - if (t >= 0x1000) { - r += 13; - t >>>= 13; - } - if (t >= 0x40) { - r += 7; - t >>>= 7; - } - if (t >= 0x8) { - r += 4; - t >>>= 4; - } - if (t >= 0x02) { - r += 2; - t >>>= 2; - } - return r + t; - }; - } - - BN.prototype._zeroBits = function _zeroBits (w) { - // Short-cut - if (w === 0) return 26; - - var t = w; - var r = 0; - if ((t & 0x1fff) === 0) { - r += 13; - t >>>= 13; - } - if ((t & 0x7f) === 0) { - r += 7; - t >>>= 7; - } - if ((t & 0xf) === 0) { - r += 4; - t >>>= 4; - } - if ((t & 0x3) === 0) { - r += 2; - t >>>= 2; - } - if ((t & 0x1) === 0) { - r++; - } - return r; - }; - - // Return number of used bits in a BN - BN.prototype.bitLength = function bitLength () { - var w = this.words[this.length - 1]; - var hi = this._countBits(w); - return (this.length - 1) * 26 + hi; - }; - - function toBitArray (num) { - var w = new Array(num.bitLength()); - - for (var bit = 0; bit < w.length; bit++) { - var off = (bit / 26) | 0; - var wbit = bit % 26; - - w[bit] = (num.words[off] & (1 << wbit)) >>> wbit; - } - - return w; - } - - // Number of trailing zero bits - BN.prototype.zeroBits = function zeroBits () { - if (this.isZero()) return 0; - - var r = 0; - for (var i = 0; i < this.length; i++) { - var b = this._zeroBits(this.words[i]); - r += b; - if (b !== 26) break; - } - return r; - }; - - BN.prototype.byteLength = function byteLength () { - return Math.ceil(this.bitLength() / 8); - }; - - BN.prototype.toTwos = function toTwos (width) { - if (this.negative !== 0) { - return this.abs().inotn(width).iaddn(1); - } - return this.clone(); - }; - - BN.prototype.fromTwos = function fromTwos (width) { - if (this.testn(width - 1)) { - return this.notn(width).iaddn(1).ineg(); - } - return this.clone(); - }; - - BN.prototype.isNeg = function isNeg () { - return this.negative !== 0; - }; - - // Return negative clone of `this` - BN.prototype.neg = function neg () { - return this.clone().ineg(); - }; - - BN.prototype.ineg = function ineg () { - if (!this.isZero()) { - this.negative ^= 1; - } - - return this; - }; - - // Or `num` with `this` in-place - BN.prototype.iuor = function iuor (num) { - while (this.length < num.length) { - this.words[this.length++] = 0; - } - - for (var i = 0; i < num.length; i++) { - this.words[i] = this.words[i] | num.words[i]; - } - - return this.strip(); - }; - - BN.prototype.ior = function ior (num) { - assert((this.negative | num.negative) === 0); - return this.iuor(num); - }; - - // Or `num` with `this` - BN.prototype.or = function or (num) { - if (this.length > num.length) return this.clone().ior(num); - return num.clone().ior(this); - }; - - BN.prototype.uor = function uor (num) { - if (this.length > num.length) return this.clone().iuor(num); - return num.clone().iuor(this); - }; - - // And `num` with `this` in-place - BN.prototype.iuand = function iuand (num) { - // b = min-length(num, this) - var b; - if (this.length > num.length) { - b = num; - } else { - b = this; - } - - for (var i = 0; i < b.length; i++) { - this.words[i] = this.words[i] & num.words[i]; - } - - this.length = b.length; - - return this.strip(); - }; - - BN.prototype.iand = function iand (num) { - assert((this.negative | num.negative) === 0); - return this.iuand(num); - }; - - // And `num` with `this` - BN.prototype.and = function and (num) { - if (this.length > num.length) return this.clone().iand(num); - return num.clone().iand(this); - }; - - BN.prototype.uand = function uand (num) { - if (this.length > num.length) return this.clone().iuand(num); - return num.clone().iuand(this); - }; - - // Xor `num` with `this` in-place - BN.prototype.iuxor = function iuxor (num) { - // a.length > b.length - var a; - var b; - if (this.length > num.length) { - a = this; - b = num; - } else { - a = num; - b = this; - } - - for (var i = 0; i < b.length; i++) { - this.words[i] = a.words[i] ^ b.words[i]; - } - - if (this !== a) { - for (; i < a.length; i++) { - this.words[i] = a.words[i]; - } - } - - this.length = a.length; - - return this.strip(); - }; - - BN.prototype.ixor = function ixor (num) { - assert((this.negative | num.negative) === 0); - return this.iuxor(num); - }; - - // Xor `num` with `this` - BN.prototype.xor = function xor (num) { - if (this.length > num.length) return this.clone().ixor(num); - return num.clone().ixor(this); - }; - - BN.prototype.uxor = function uxor (num) { - if (this.length > num.length) return this.clone().iuxor(num); - return num.clone().iuxor(this); - }; - - // Not ``this`` with ``width`` bitwidth - BN.prototype.inotn = function inotn (width) { - assert(typeof width === 'number' && width >= 0); - - var bytesNeeded = Math.ceil(width / 26) | 0; - var bitsLeft = width % 26; - - // Extend the buffer with leading zeroes - this._expand(bytesNeeded); - - if (bitsLeft > 0) { - bytesNeeded--; - } - - // Handle complete words - for (var i = 0; i < bytesNeeded; i++) { - this.words[i] = ~this.words[i] & 0x3ffffff; - } - - // Handle the residue - if (bitsLeft > 0) { - this.words[i] = ~this.words[i] & (0x3ffffff >> (26 - bitsLeft)); - } - - // And remove leading zeroes - return this.strip(); - }; - - BN.prototype.notn = function notn (width) { - return this.clone().inotn(width); - }; - - // Set `bit` of `this` - BN.prototype.setn = function setn (bit, val) { - assert(typeof bit === 'number' && bit >= 0); - - var off = (bit / 26) | 0; - var wbit = bit % 26; - - this._expand(off + 1); - - if (val) { - this.words[off] = this.words[off] | (1 << wbit); - } else { - this.words[off] = this.words[off] & ~(1 << wbit); - } - - return this.strip(); - }; - - // Add `num` to `this` in-place - BN.prototype.iadd = function iadd (num) { - var r; - - // negative + positive - if (this.negative !== 0 && num.negative === 0) { - this.negative = 0; - r = this.isub(num); - this.negative ^= 1; - return this._normSign(); - - // positive + negative - } else if (this.negative === 0 && num.negative !== 0) { - num.negative = 0; - r = this.isub(num); - num.negative = 1; - return r._normSign(); - } - - // a.length > b.length - var a, b; - if (this.length > num.length) { - a = this; - b = num; - } else { - a = num; - b = this; - } - - var carry = 0; - for (var i = 0; i < b.length; i++) { - r = (a.words[i] | 0) + (b.words[i] | 0) + carry; - this.words[i] = r & 0x3ffffff; - carry = r >>> 26; - } - for (; carry !== 0 && i < a.length; i++) { - r = (a.words[i] | 0) + carry; - this.words[i] = r & 0x3ffffff; - carry = r >>> 26; - } - - this.length = a.length; - if (carry !== 0) { - this.words[this.length] = carry; - this.length++; - // Copy the rest of the words - } else if (a !== this) { - for (; i < a.length; i++) { - this.words[i] = a.words[i]; - } - } - - return this; - }; - - // Add `num` to `this` - BN.prototype.add = function add (num) { - var res; - if (num.negative !== 0 && this.negative === 0) { - num.negative = 0; - res = this.sub(num); - num.negative ^= 1; - return res; - } else if (num.negative === 0 && this.negative !== 0) { - this.negative = 0; - res = num.sub(this); - this.negative = 1; - return res; - } - - if (this.length > num.length) return this.clone().iadd(num); - - return num.clone().iadd(this); - }; - - // Subtract `num` from `this` in-place - BN.prototype.isub = function isub (num) { - // this - (-num) = this + num - if (num.negative !== 0) { - num.negative = 0; - var r = this.iadd(num); - num.negative = 1; - return r._normSign(); - - // -this - num = -(this + num) - } else if (this.negative !== 0) { - this.negative = 0; - this.iadd(num); - this.negative = 1; - return this._normSign(); - } - - // At this point both numbers are positive - var cmp = this.cmp(num); - - // Optimization - zeroify - if (cmp === 0) { - this.negative = 0; - this.length = 1; - this.words[0] = 0; - return this; - } - - // a > b - var a, b; - if (cmp > 0) { - a = this; - b = num; - } else { - a = num; - b = this; - } - - var carry = 0; - for (var i = 0; i < b.length; i++) { - r = (a.words[i] | 0) - (b.words[i] | 0) + carry; - carry = r >> 26; - this.words[i] = r & 0x3ffffff; - } - for (; carry !== 0 && i < a.length; i++) { - r = (a.words[i] | 0) + carry; - carry = r >> 26; - this.words[i] = r & 0x3ffffff; - } - - // Copy rest of the words - if (carry === 0 && i < a.length && a !== this) { - for (; i < a.length; i++) { - this.words[i] = a.words[i]; - } - } - - this.length = Math.max(this.length, i); - - if (a !== this) { - this.negative = 1; - } - - return this.strip(); - }; - - // Subtract `num` from `this` - BN.prototype.sub = function sub (num) { - return this.clone().isub(num); - }; - - function smallMulTo (self, num, out) { - out.negative = num.negative ^ self.negative; - var len = (self.length + num.length) | 0; - out.length = len; - len = (len - 1) | 0; - - // Peel one iteration (compiler can't do it, because of code complexity) - var a = self.words[0] | 0; - var b = num.words[0] | 0; - var r = a * b; - - var lo = r & 0x3ffffff; - var carry = (r / 0x4000000) | 0; - out.words[0] = lo; - - for (var k = 1; k < len; k++) { - // Sum all words with the same `i + j = k` and accumulate `ncarry`, - // note that ncarry could be >= 0x3ffffff - var ncarry = carry >>> 26; - var rword = carry & 0x3ffffff; - var maxJ = Math.min(k, num.length - 1); - for (var j = Math.max(0, k - self.length + 1); j <= maxJ; j++) { - var i = (k - j) | 0; - a = self.words[i] | 0; - b = num.words[j] | 0; - r = a * b + rword; - ncarry += (r / 0x4000000) | 0; - rword = r & 0x3ffffff; - } - out.words[k] = rword | 0; - carry = ncarry | 0; - } - if (carry !== 0) { - out.words[k] = carry | 0; - } else { - out.length--; - } - - return out.strip(); - } - - // TODO(indutny): it may be reasonable to omit it for users who don't need - // to work with 256-bit numbers, otherwise it gives 20% improvement for 256-bit - // multiplication (like elliptic secp256k1). - var comb10MulTo = function comb10MulTo (self, num, out) { - var a = self.words; - var b = num.words; - var o = out.words; - var c = 0; - var lo; - var mid; - var hi; - var a0 = a[0] | 0; - var al0 = a0 & 0x1fff; - var ah0 = a0 >>> 13; - var a1 = a[1] | 0; - var al1 = a1 & 0x1fff; - var ah1 = a1 >>> 13; - var a2 = a[2] | 0; - var al2 = a2 & 0x1fff; - var ah2 = a2 >>> 13; - var a3 = a[3] | 0; - var al3 = a3 & 0x1fff; - var ah3 = a3 >>> 13; - var a4 = a[4] | 0; - var al4 = a4 & 0x1fff; - var ah4 = a4 >>> 13; - var a5 = a[5] | 0; - var al5 = a5 & 0x1fff; - var ah5 = a5 >>> 13; - var a6 = a[6] | 0; - var al6 = a6 & 0x1fff; - var ah6 = a6 >>> 13; - var a7 = a[7] | 0; - var al7 = a7 & 0x1fff; - var ah7 = a7 >>> 13; - var a8 = a[8] | 0; - var al8 = a8 & 0x1fff; - var ah8 = a8 >>> 13; - var a9 = a[9] | 0; - var al9 = a9 & 0x1fff; - var ah9 = a9 >>> 13; - var b0 = b[0] | 0; - var bl0 = b0 & 0x1fff; - var bh0 = b0 >>> 13; - var b1 = b[1] | 0; - var bl1 = b1 & 0x1fff; - var bh1 = b1 >>> 13; - var b2 = b[2] | 0; - var bl2 = b2 & 0x1fff; - var bh2 = b2 >>> 13; - var b3 = b[3] | 0; - var bl3 = b3 & 0x1fff; - var bh3 = b3 >>> 13; - var b4 = b[4] | 0; - var bl4 = b4 & 0x1fff; - var bh4 = b4 >>> 13; - var b5 = b[5] | 0; - var bl5 = b5 & 0x1fff; - var bh5 = b5 >>> 13; - var b6 = b[6] | 0; - var bl6 = b6 & 0x1fff; - var bh6 = b6 >>> 13; - var b7 = b[7] | 0; - var bl7 = b7 & 0x1fff; - var bh7 = b7 >>> 13; - var b8 = b[8] | 0; - var bl8 = b8 & 0x1fff; - var bh8 = b8 >>> 13; - var b9 = b[9] | 0; - var bl9 = b9 & 0x1fff; - var bh9 = b9 >>> 13; - - out.negative = self.negative ^ num.negative; - out.length = 19; - /* k = 0 */ - lo = Math.imul(al0, bl0); - mid = Math.imul(al0, bh0); - mid = (mid + Math.imul(ah0, bl0)) | 0; - hi = Math.imul(ah0, bh0); - var w0 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0; - c = (((hi + (mid >>> 13)) | 0) + (w0 >>> 26)) | 0; - w0 &= 0x3ffffff; - /* k = 1 */ - lo = Math.imul(al1, bl0); - mid = Math.imul(al1, bh0); - mid = (mid + Math.imul(ah1, bl0)) | 0; - hi = Math.imul(ah1, bh0); - lo = (lo + Math.imul(al0, bl1)) | 0; - mid = (mid + Math.imul(al0, bh1)) | 0; - mid = (mid + Math.imul(ah0, bl1)) | 0; - hi = (hi + Math.imul(ah0, bh1)) | 0; - var w1 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0; - c = (((hi + (mid >>> 13)) | 0) + (w1 >>> 26)) | 0; - w1 &= 0x3ffffff; - /* k = 2 */ - lo = Math.imul(al2, bl0); - mid = Math.imul(al2, bh0); - mid = (mid + Math.imul(ah2, bl0)) | 0; - hi = Math.imul(ah2, bh0); - lo = (lo + Math.imul(al1, bl1)) | 0; - mid = (mid + Math.imul(al1, bh1)) | 0; - mid = (mid + Math.imul(ah1, bl1)) | 0; - hi = (hi + Math.imul(ah1, bh1)) | 0; - lo = (lo + Math.imul(al0, bl2)) | 0; - mid = (mid + Math.imul(al0, bh2)) | 0; - mid = (mid + Math.imul(ah0, bl2)) | 0; - hi = (hi + Math.imul(ah0, bh2)) | 0; - var w2 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0; - c = (((hi + (mid >>> 13)) | 0) + (w2 >>> 26)) | 0; - w2 &= 0x3ffffff; - /* k = 3 */ - lo = Math.imul(al3, bl0); - mid = Math.imul(al3, bh0); - mid = (mid + Math.imul(ah3, bl0)) | 0; - hi = Math.imul(ah3, bh0); - lo = (lo + Math.imul(al2, bl1)) | 0; - mid = (mid + Math.imul(al2, bh1)) | 0; - mid = (mid + Math.imul(ah2, bl1)) | 0; - hi = (hi + Math.imul(ah2, bh1)) | 0; - lo = (lo + Math.imul(al1, bl2)) | 0; - mid = (mid + Math.imul(al1, bh2)) | 0; - mid = (mid + Math.imul(ah1, bl2)) | 0; - hi = (hi + Math.imul(ah1, bh2)) | 0; - lo = (lo + Math.imul(al0, bl3)) | 0; - mid = (mid + Math.imul(al0, bh3)) | 0; - mid = (mid + Math.imul(ah0, bl3)) | 0; - hi = (hi + Math.imul(ah0, bh3)) | 0; - var w3 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0; - c = (((hi + (mid >>> 13)) | 0) + (w3 >>> 26)) | 0; - w3 &= 0x3ffffff; - /* k = 4 */ - lo = Math.imul(al4, bl0); - mid = Math.imul(al4, bh0); - mid = (mid + Math.imul(ah4, bl0)) | 0; - hi = Math.imul(ah4, bh0); - lo = (lo + Math.imul(al3, bl1)) | 0; - mid = (mid + Math.imul(al3, bh1)) | 0; - mid = (mid + Math.imul(ah3, bl1)) | 0; - hi = (hi + Math.imul(ah3, bh1)) | 0; - lo = (lo + Math.imul(al2, bl2)) | 0; - mid = (mid + Math.imul(al2, bh2)) | 0; - mid = (mid + Math.imul(ah2, bl2)) | 0; - hi = (hi + Math.imul(ah2, bh2)) | 0; - lo = (lo + Math.imul(al1, bl3)) | 0; - mid = (mid + Math.imul(al1, bh3)) | 0; - mid = (mid + Math.imul(ah1, bl3)) | 0; - hi = (hi + Math.imul(ah1, bh3)) | 0; - lo = (lo + Math.imul(al0, bl4)) | 0; - mid = (mid + Math.imul(al0, bh4)) | 0; - mid = (mid + Math.imul(ah0, bl4)) | 0; - hi = (hi + Math.imul(ah0, bh4)) | 0; - var w4 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0; - c = (((hi + (mid >>> 13)) | 0) + (w4 >>> 26)) | 0; - w4 &= 0x3ffffff; - /* k = 5 */ - lo = Math.imul(al5, bl0); - mid = Math.imul(al5, bh0); - mid = (mid + Math.imul(ah5, bl0)) | 0; - hi = Math.imul(ah5, bh0); - lo = (lo + Math.imul(al4, bl1)) | 0; - mid = (mid + Math.imul(al4, bh1)) | 0; - mid = (mid + Math.imul(ah4, bl1)) | 0; - hi = (hi + Math.imul(ah4, bh1)) | 0; - lo = (lo + Math.imul(al3, bl2)) | 0; - mid = (mid + Math.imul(al3, bh2)) | 0; - mid = (mid + Math.imul(ah3, bl2)) | 0; - hi = (hi + Math.imul(ah3, bh2)) | 0; - lo = (lo + Math.imul(al2, bl3)) | 0; - mid = (mid + Math.imul(al2, bh3)) | 0; - mid = (mid + Math.imul(ah2, bl3)) | 0; - hi = (hi + Math.imul(ah2, bh3)) | 0; - lo = (lo + Math.imul(al1, bl4)) | 0; - mid = (mid + Math.imul(al1, bh4)) | 0; - mid = (mid + Math.imul(ah1, bl4)) | 0; - hi = (hi + Math.imul(ah1, bh4)) | 0; - lo = (lo + Math.imul(al0, bl5)) | 0; - mid = (mid + Math.imul(al0, bh5)) | 0; - mid = (mid + Math.imul(ah0, bl5)) | 0; - hi = (hi + Math.imul(ah0, bh5)) | 0; - var w5 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0; - c = (((hi + (mid >>> 13)) | 0) + (w5 >>> 26)) | 0; - w5 &= 0x3ffffff; - /* k = 6 */ - lo = Math.imul(al6, bl0); - mid = Math.imul(al6, bh0); - mid = (mid + Math.imul(ah6, bl0)) | 0; - hi = Math.imul(ah6, bh0); - lo = (lo + Math.imul(al5, bl1)) | 0; - mid = (mid + Math.imul(al5, bh1)) | 0; - mid = (mid + Math.imul(ah5, bl1)) | 0; - hi = (hi + Math.imul(ah5, bh1)) | 0; - lo = (lo + Math.imul(al4, bl2)) | 0; - mid = (mid + Math.imul(al4, bh2)) | 0; - mid = (mid + Math.imul(ah4, bl2)) | 0; - hi = (hi + Math.imul(ah4, bh2)) | 0; - lo = (lo + Math.imul(al3, bl3)) | 0; - mid = (mid + Math.imul(al3, bh3)) | 0; - mid = (mid + Math.imul(ah3, bl3)) | 0; - hi = (hi + Math.imul(ah3, bh3)) | 0; - lo = (lo + Math.imul(al2, bl4)) | 0; - mid = (mid + Math.imul(al2, bh4)) | 0; - mid = (mid + Math.imul(ah2, bl4)) | 0; - hi = (hi + Math.imul(ah2, bh4)) | 0; - lo = (lo + Math.imul(al1, bl5)) | 0; - mid = (mid + Math.imul(al1, bh5)) | 0; - mid = (mid + Math.imul(ah1, bl5)) | 0; - hi = (hi + Math.imul(ah1, bh5)) | 0; - lo = (lo + Math.imul(al0, bl6)) | 0; - mid = (mid + Math.imul(al0, bh6)) | 0; - mid = (mid + Math.imul(ah0, bl6)) | 0; - hi = (hi + Math.imul(ah0, bh6)) | 0; - var w6 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0; - c = (((hi + (mid >>> 13)) | 0) + (w6 >>> 26)) | 0; - w6 &= 0x3ffffff; - /* k = 7 */ - lo = Math.imul(al7, bl0); - mid = Math.imul(al7, bh0); - mid = (mid + Math.imul(ah7, bl0)) | 0; - hi = Math.imul(ah7, bh0); - lo = (lo + Math.imul(al6, bl1)) | 0; - mid = (mid + Math.imul(al6, bh1)) | 0; - mid = (mid + Math.imul(ah6, bl1)) | 0; - hi = (hi + Math.imul(ah6, bh1)) | 0; - lo = (lo + Math.imul(al5, bl2)) | 0; - mid = (mid + Math.imul(al5, bh2)) | 0; - mid = (mid + Math.imul(ah5, bl2)) | 0; - hi = (hi + Math.imul(ah5, bh2)) | 0; - lo = (lo + Math.imul(al4, bl3)) | 0; - mid = (mid + Math.imul(al4, bh3)) | 0; - mid = (mid + Math.imul(ah4, bl3)) | 0; - hi = (hi + Math.imul(ah4, bh3)) | 0; - lo = (lo + Math.imul(al3, bl4)) | 0; - mid = (mid + Math.imul(al3, bh4)) | 0; - mid = (mid + Math.imul(ah3, bl4)) | 0; - hi = (hi + Math.imul(ah3, bh4)) | 0; - lo = (lo + Math.imul(al2, bl5)) | 0; - mid = (mid + Math.imul(al2, bh5)) | 0; - mid = (mid + Math.imul(ah2, bl5)) | 0; - hi = (hi + Math.imul(ah2, bh5)) | 0; - lo = (lo + Math.imul(al1, bl6)) | 0; - mid = (mid + Math.imul(al1, bh6)) | 0; - mid = (mid + Math.imul(ah1, bl6)) | 0; - hi = (hi + Math.imul(ah1, bh6)) | 0; - lo = (lo + Math.imul(al0, bl7)) | 0; - mid = (mid + Math.imul(al0, bh7)) | 0; - mid = (mid + Math.imul(ah0, bl7)) | 0; - hi = (hi + Math.imul(ah0, bh7)) | 0; - var w7 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0; - c = (((hi + (mid >>> 13)) | 0) + (w7 >>> 26)) | 0; - w7 &= 0x3ffffff; - /* k = 8 */ - lo = Math.imul(al8, bl0); - mid = Math.imul(al8, bh0); - mid = (mid + Math.imul(ah8, bl0)) | 0; - hi = Math.imul(ah8, bh0); - lo = (lo + Math.imul(al7, bl1)) | 0; - mid = (mid + Math.imul(al7, bh1)) | 0; - mid = (mid + Math.imul(ah7, bl1)) | 0; - hi = (hi + Math.imul(ah7, bh1)) | 0; - lo = (lo + Math.imul(al6, bl2)) | 0; - mid = (mid + Math.imul(al6, bh2)) | 0; - mid = (mid + Math.imul(ah6, bl2)) | 0; - hi = (hi + Math.imul(ah6, bh2)) | 0; - lo = (lo + Math.imul(al5, bl3)) | 0; - mid = (mid + Math.imul(al5, bh3)) | 0; - mid = (mid + Math.imul(ah5, bl3)) | 0; - hi = (hi + Math.imul(ah5, bh3)) | 0; - lo = (lo + Math.imul(al4, bl4)) | 0; - mid = (mid + Math.imul(al4, bh4)) | 0; - mid = (mid + Math.imul(ah4, bl4)) | 0; - hi = (hi + Math.imul(ah4, bh4)) | 0; - lo = (lo + Math.imul(al3, bl5)) | 0; - mid = (mid + Math.imul(al3, bh5)) | 0; - mid = (mid + Math.imul(ah3, bl5)) | 0; - hi = (hi + Math.imul(ah3, bh5)) | 0; - lo = (lo + Math.imul(al2, bl6)) | 0; - mid = (mid + Math.imul(al2, bh6)) | 0; - mid = (mid + Math.imul(ah2, bl6)) | 0; - hi = (hi + Math.imul(ah2, bh6)) | 0; - lo = (lo + Math.imul(al1, bl7)) | 0; - mid = (mid + Math.imul(al1, bh7)) | 0; - mid = (mid + Math.imul(ah1, bl7)) | 0; - hi = (hi + Math.imul(ah1, bh7)) | 0; - lo = (lo + Math.imul(al0, bl8)) | 0; - mid = (mid + Math.imul(al0, bh8)) | 0; - mid = (mid + Math.imul(ah0, bl8)) | 0; - hi = (hi + Math.imul(ah0, bh8)) | 0; - var w8 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0; - c = (((hi + (mid >>> 13)) | 0) + (w8 >>> 26)) | 0; - w8 &= 0x3ffffff; - /* k = 9 */ - lo = Math.imul(al9, bl0); - mid = Math.imul(al9, bh0); - mid = (mid + Math.imul(ah9, bl0)) | 0; - hi = Math.imul(ah9, bh0); - lo = (lo + Math.imul(al8, bl1)) | 0; - mid = (mid + Math.imul(al8, bh1)) | 0; - mid = (mid + Math.imul(ah8, bl1)) | 0; - hi = (hi + Math.imul(ah8, bh1)) | 0; - lo = (lo + Math.imul(al7, bl2)) | 0; - mid = (mid + Math.imul(al7, bh2)) | 0; - mid = (mid + Math.imul(ah7, bl2)) | 0; - hi = (hi + Math.imul(ah7, bh2)) | 0; - lo = (lo + Math.imul(al6, bl3)) | 0; - mid = (mid + Math.imul(al6, bh3)) | 0; - mid = (mid + Math.imul(ah6, bl3)) | 0; - hi = (hi + Math.imul(ah6, bh3)) | 0; - lo = (lo + Math.imul(al5, bl4)) | 0; - mid = (mid + Math.imul(al5, bh4)) | 0; - mid = (mid + Math.imul(ah5, bl4)) | 0; - hi = (hi + Math.imul(ah5, bh4)) | 0; - lo = (lo + Math.imul(al4, bl5)) | 0; - mid = (mid + Math.imul(al4, bh5)) | 0; - mid = (mid + Math.imul(ah4, bl5)) | 0; - hi = (hi + Math.imul(ah4, bh5)) | 0; - lo = (lo + Math.imul(al3, bl6)) | 0; - mid = (mid + Math.imul(al3, bh6)) | 0; - mid = (mid + Math.imul(ah3, bl6)) | 0; - hi = (hi + Math.imul(ah3, bh6)) | 0; - lo = (lo + Math.imul(al2, bl7)) | 0; - mid = (mid + Math.imul(al2, bh7)) | 0; - mid = (mid + Math.imul(ah2, bl7)) | 0; - hi = (hi + Math.imul(ah2, bh7)) | 0; - lo = (lo + Math.imul(al1, bl8)) | 0; - mid = (mid + Math.imul(al1, bh8)) | 0; - mid = (mid + Math.imul(ah1, bl8)) | 0; - hi = (hi + Math.imul(ah1, bh8)) | 0; - lo = (lo + Math.imul(al0, bl9)) | 0; - mid = (mid + Math.imul(al0, bh9)) | 0; - mid = (mid + Math.imul(ah0, bl9)) | 0; - hi = (hi + Math.imul(ah0, bh9)) | 0; - var w9 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0; - c = (((hi + (mid >>> 13)) | 0) + (w9 >>> 26)) | 0; - w9 &= 0x3ffffff; - /* k = 10 */ - lo = Math.imul(al9, bl1); - mid = Math.imul(al9, bh1); - mid = (mid + Math.imul(ah9, bl1)) | 0; - hi = Math.imul(ah9, bh1); - lo = (lo + Math.imul(al8, bl2)) | 0; - mid = (mid + Math.imul(al8, bh2)) | 0; - mid = (mid + Math.imul(ah8, bl2)) | 0; - hi = (hi + Math.imul(ah8, bh2)) | 0; - lo = (lo + Math.imul(al7, bl3)) | 0; - mid = (mid + Math.imul(al7, bh3)) | 0; - mid = (mid + Math.imul(ah7, bl3)) | 0; - hi = (hi + Math.imul(ah7, bh3)) | 0; - lo = (lo + Math.imul(al6, bl4)) | 0; - mid = (mid + Math.imul(al6, bh4)) | 0; - mid = (mid + Math.imul(ah6, bl4)) | 0; - hi = (hi + Math.imul(ah6, bh4)) | 0; - lo = (lo + Math.imul(al5, bl5)) | 0; - mid = (mid + Math.imul(al5, bh5)) | 0; - mid = (mid + Math.imul(ah5, bl5)) | 0; - hi = (hi + Math.imul(ah5, bh5)) | 0; - lo = (lo + Math.imul(al4, bl6)) | 0; - mid = (mid + Math.imul(al4, bh6)) | 0; - mid = (mid + Math.imul(ah4, bl6)) | 0; - hi = (hi + Math.imul(ah4, bh6)) | 0; - lo = (lo + Math.imul(al3, bl7)) | 0; - mid = (mid + Math.imul(al3, bh7)) | 0; - mid = (mid + Math.imul(ah3, bl7)) | 0; - hi = (hi + Math.imul(ah3, bh7)) | 0; - lo = (lo + Math.imul(al2, bl8)) | 0; - mid = (mid + Math.imul(al2, bh8)) | 0; - mid = (mid + Math.imul(ah2, bl8)) | 0; - hi = (hi + Math.imul(ah2, bh8)) | 0; - lo = (lo + Math.imul(al1, bl9)) | 0; - mid = (mid + Math.imul(al1, bh9)) | 0; - mid = (mid + Math.imul(ah1, bl9)) | 0; - hi = (hi + Math.imul(ah1, bh9)) | 0; - var w10 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0; - c = (((hi + (mid >>> 13)) | 0) + (w10 >>> 26)) | 0; - w10 &= 0x3ffffff; - /* k = 11 */ - lo = Math.imul(al9, bl2); - mid = Math.imul(al9, bh2); - mid = (mid + Math.imul(ah9, bl2)) | 0; - hi = Math.imul(ah9, bh2); - lo = (lo + Math.imul(al8, bl3)) | 0; - mid = (mid + Math.imul(al8, bh3)) | 0; - mid = (mid + Math.imul(ah8, bl3)) | 0; - hi = (hi + Math.imul(ah8, bh3)) | 0; - lo = (lo + Math.imul(al7, bl4)) | 0; - mid = (mid + Math.imul(al7, bh4)) | 0; - mid = (mid + Math.imul(ah7, bl4)) | 0; - hi = (hi + Math.imul(ah7, bh4)) | 0; - lo = (lo + Math.imul(al6, bl5)) | 0; - mid = (mid + Math.imul(al6, bh5)) | 0; - mid = (mid + Math.imul(ah6, bl5)) | 0; - hi = (hi + Math.imul(ah6, bh5)) | 0; - lo = (lo + Math.imul(al5, bl6)) | 0; - mid = (mid + Math.imul(al5, bh6)) | 0; - mid = (mid + Math.imul(ah5, bl6)) | 0; - hi = (hi + Math.imul(ah5, bh6)) | 0; - lo = (lo + Math.imul(al4, bl7)) | 0; - mid = (mid + Math.imul(al4, bh7)) | 0; - mid = (mid + Math.imul(ah4, bl7)) | 0; - hi = (hi + Math.imul(ah4, bh7)) | 0; - lo = (lo + Math.imul(al3, bl8)) | 0; - mid = (mid + Math.imul(al3, bh8)) | 0; - mid = (mid + Math.imul(ah3, bl8)) | 0; - hi = (hi + Math.imul(ah3, bh8)) | 0; - lo = (lo + Math.imul(al2, bl9)) | 0; - mid = (mid + Math.imul(al2, bh9)) | 0; - mid = (mid + Math.imul(ah2, bl9)) | 0; - hi = (hi + Math.imul(ah2, bh9)) | 0; - var w11 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0; - c = (((hi + (mid >>> 13)) | 0) + (w11 >>> 26)) | 0; - w11 &= 0x3ffffff; - /* k = 12 */ - lo = Math.imul(al9, bl3); - mid = Math.imul(al9, bh3); - mid = (mid + Math.imul(ah9, bl3)) | 0; - hi = Math.imul(ah9, bh3); - lo = (lo + Math.imul(al8, bl4)) | 0; - mid = (mid + Math.imul(al8, bh4)) | 0; - mid = (mid + Math.imul(ah8, bl4)) | 0; - hi = (hi + Math.imul(ah8, bh4)) | 0; - lo = (lo + Math.imul(al7, bl5)) | 0; - mid = (mid + Math.imul(al7, bh5)) | 0; - mid = (mid + Math.imul(ah7, bl5)) | 0; - hi = (hi + Math.imul(ah7, bh5)) | 0; - lo = (lo + Math.imul(al6, bl6)) | 0; - mid = (mid + Math.imul(al6, bh6)) | 0; - mid = (mid + Math.imul(ah6, bl6)) | 0; - hi = (hi + Math.imul(ah6, bh6)) | 0; - lo = (lo + Math.imul(al5, bl7)) | 0; - mid = (mid + Math.imul(al5, bh7)) | 0; - mid = (mid + Math.imul(ah5, bl7)) | 0; - hi = (hi + Math.imul(ah5, bh7)) | 0; - lo = (lo + Math.imul(al4, bl8)) | 0; - mid = (mid + Math.imul(al4, bh8)) | 0; - mid = (mid + Math.imul(ah4, bl8)) | 0; - hi = (hi + Math.imul(ah4, bh8)) | 0; - lo = (lo + Math.imul(al3, bl9)) | 0; - mid = (mid + Math.imul(al3, bh9)) | 0; - mid = (mid + Math.imul(ah3, bl9)) | 0; - hi = (hi + Math.imul(ah3, bh9)) | 0; - var w12 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0; - c = (((hi + (mid >>> 13)) | 0) + (w12 >>> 26)) | 0; - w12 &= 0x3ffffff; - /* k = 13 */ - lo = Math.imul(al9, bl4); - mid = Math.imul(al9, bh4); - mid = (mid + Math.imul(ah9, bl4)) | 0; - hi = Math.imul(ah9, bh4); - lo = (lo + Math.imul(al8, bl5)) | 0; - mid = (mid + Math.imul(al8, bh5)) | 0; - mid = (mid + Math.imul(ah8, bl5)) | 0; - hi = (hi + Math.imul(ah8, bh5)) | 0; - lo = (lo + Math.imul(al7, bl6)) | 0; - mid = (mid + Math.imul(al7, bh6)) | 0; - mid = (mid + Math.imul(ah7, bl6)) | 0; - hi = (hi + Math.imul(ah7, bh6)) | 0; - lo = (lo + Math.imul(al6, bl7)) | 0; - mid = (mid + Math.imul(al6, bh7)) | 0; - mid = (mid + Math.imul(ah6, bl7)) | 0; - hi = (hi + Math.imul(ah6, bh7)) | 0; - lo = (lo + Math.imul(al5, bl8)) | 0; - mid = (mid + Math.imul(al5, bh8)) | 0; - mid = (mid + Math.imul(ah5, bl8)) | 0; - hi = (hi + Math.imul(ah5, bh8)) | 0; - lo = (lo + Math.imul(al4, bl9)) | 0; - mid = (mid + Math.imul(al4, bh9)) | 0; - mid = (mid + Math.imul(ah4, bl9)) | 0; - hi = (hi + Math.imul(ah4, bh9)) | 0; - var w13 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0; - c = (((hi + (mid >>> 13)) | 0) + (w13 >>> 26)) | 0; - w13 &= 0x3ffffff; - /* k = 14 */ - lo = Math.imul(al9, bl5); - mid = Math.imul(al9, bh5); - mid = (mid + Math.imul(ah9, bl5)) | 0; - hi = Math.imul(ah9, bh5); - lo = (lo + Math.imul(al8, bl6)) | 0; - mid = (mid + Math.imul(al8, bh6)) | 0; - mid = (mid + Math.imul(ah8, bl6)) | 0; - hi = (hi + Math.imul(ah8, bh6)) | 0; - lo = (lo + Math.imul(al7, bl7)) | 0; - mid = (mid + Math.imul(al7, bh7)) | 0; - mid = (mid + Math.imul(ah7, bl7)) | 0; - hi = (hi + Math.imul(ah7, bh7)) | 0; - lo = (lo + Math.imul(al6, bl8)) | 0; - mid = (mid + Math.imul(al6, bh8)) | 0; - mid = (mid + Math.imul(ah6, bl8)) | 0; - hi = (hi + Math.imul(ah6, bh8)) | 0; - lo = (lo + Math.imul(al5, bl9)) | 0; - mid = (mid + Math.imul(al5, bh9)) | 0; - mid = (mid + Math.imul(ah5, bl9)) | 0; - hi = (hi + Math.imul(ah5, bh9)) | 0; - var w14 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0; - c = (((hi + (mid >>> 13)) | 0) + (w14 >>> 26)) | 0; - w14 &= 0x3ffffff; - /* k = 15 */ - lo = Math.imul(al9, bl6); - mid = Math.imul(al9, bh6); - mid = (mid + Math.imul(ah9, bl6)) | 0; - hi = Math.imul(ah9, bh6); - lo = (lo + Math.imul(al8, bl7)) | 0; - mid = (mid + Math.imul(al8, bh7)) | 0; - mid = (mid + Math.imul(ah8, bl7)) | 0; - hi = (hi + Math.imul(ah8, bh7)) | 0; - lo = (lo + Math.imul(al7, bl8)) | 0; - mid = (mid + Math.imul(al7, bh8)) | 0; - mid = (mid + Math.imul(ah7, bl8)) | 0; - hi = (hi + Math.imul(ah7, bh8)) | 0; - lo = (lo + Math.imul(al6, bl9)) | 0; - mid = (mid + Math.imul(al6, bh9)) | 0; - mid = (mid + Math.imul(ah6, bl9)) | 0; - hi = (hi + Math.imul(ah6, bh9)) | 0; - var w15 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0; - c = (((hi + (mid >>> 13)) | 0) + (w15 >>> 26)) | 0; - w15 &= 0x3ffffff; - /* k = 16 */ - lo = Math.imul(al9, bl7); - mid = Math.imul(al9, bh7); - mid = (mid + Math.imul(ah9, bl7)) | 0; - hi = Math.imul(ah9, bh7); - lo = (lo + Math.imul(al8, bl8)) | 0; - mid = (mid + Math.imul(al8, bh8)) | 0; - mid = (mid + Math.imul(ah8, bl8)) | 0; - hi = (hi + Math.imul(ah8, bh8)) | 0; - lo = (lo + Math.imul(al7, bl9)) | 0; - mid = (mid + Math.imul(al7, bh9)) | 0; - mid = (mid + Math.imul(ah7, bl9)) | 0; - hi = (hi + Math.imul(ah7, bh9)) | 0; - var w16 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0; - c = (((hi + (mid >>> 13)) | 0) + (w16 >>> 26)) | 0; - w16 &= 0x3ffffff; - /* k = 17 */ - lo = Math.imul(al9, bl8); - mid = Math.imul(al9, bh8); - mid = (mid + Math.imul(ah9, bl8)) | 0; - hi = Math.imul(ah9, bh8); - lo = (lo + Math.imul(al8, bl9)) | 0; - mid = (mid + Math.imul(al8, bh9)) | 0; - mid = (mid + Math.imul(ah8, bl9)) | 0; - hi = (hi + Math.imul(ah8, bh9)) | 0; - var w17 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0; - c = (((hi + (mid >>> 13)) | 0) + (w17 >>> 26)) | 0; - w17 &= 0x3ffffff; - /* k = 18 */ - lo = Math.imul(al9, bl9); - mid = Math.imul(al9, bh9); - mid = (mid + Math.imul(ah9, bl9)) | 0; - hi = Math.imul(ah9, bh9); - var w18 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0; - c = (((hi + (mid >>> 13)) | 0) + (w18 >>> 26)) | 0; - w18 &= 0x3ffffff; - o[0] = w0; - o[1] = w1; - o[2] = w2; - o[3] = w3; - o[4] = w4; - o[5] = w5; - o[6] = w6; - o[7] = w7; - o[8] = w8; - o[9] = w9; - o[10] = w10; - o[11] = w11; - o[12] = w12; - o[13] = w13; - o[14] = w14; - o[15] = w15; - o[16] = w16; - o[17] = w17; - o[18] = w18; - if (c !== 0) { - o[19] = c; - out.length++; - } - return out; - }; - - // Polyfill comb - if (!Math.imul) { - comb10MulTo = smallMulTo; - } - - function bigMulTo (self, num, out) { - out.negative = num.negative ^ self.negative; - out.length = self.length + num.length; - - var carry = 0; - var hncarry = 0; - for (var k = 0; k < out.length - 1; k++) { - // Sum all words with the same `i + j = k` and accumulate `ncarry`, - // note that ncarry could be >= 0x3ffffff - var ncarry = hncarry; - hncarry = 0; - var rword = carry & 0x3ffffff; - var maxJ = Math.min(k, num.length - 1); - for (var j = Math.max(0, k - self.length + 1); j <= maxJ; j++) { - var i = k - j; - var a = self.words[i] | 0; - var b = num.words[j] | 0; - var r = a * b; - - var lo = r & 0x3ffffff; - ncarry = (ncarry + ((r / 0x4000000) | 0)) | 0; - lo = (lo + rword) | 0; - rword = lo & 0x3ffffff; - ncarry = (ncarry + (lo >>> 26)) | 0; - - hncarry += ncarry >>> 26; - ncarry &= 0x3ffffff; - } - out.words[k] = rword; - carry = ncarry; - ncarry = hncarry; - } - if (carry !== 0) { - out.words[k] = carry; - } else { - out.length--; - } - - return out.strip(); - } - - function jumboMulTo (self, num, out) { - var fftm = new FFTM(); - return fftm.mulp(self, num, out); - } - - BN.prototype.mulTo = function mulTo (num, out) { - var res; - var len = this.length + num.length; - if (this.length === 10 && num.length === 10) { - res = comb10MulTo(this, num, out); - } else if (len < 63) { - res = smallMulTo(this, num, out); - } else if (len < 1024) { - res = bigMulTo(this, num, out); - } else { - res = jumboMulTo(this, num, out); - } - - return res; - }; - - // Cooley-Tukey algorithm for FFT - // slightly revisited to rely on looping instead of recursion - - function FFTM (x, y) { - this.x = x; - this.y = y; - } - - FFTM.prototype.makeRBT = function makeRBT (N) { - var t = new Array(N); - var l = BN.prototype._countBits(N) - 1; - for (var i = 0; i < N; i++) { - t[i] = this.revBin(i, l, N); - } - - return t; - }; - - // Returns binary-reversed representation of `x` - FFTM.prototype.revBin = function revBin (x, l, N) { - if (x === 0 || x === N - 1) return x; - - var rb = 0; - for (var i = 0; i < l; i++) { - rb |= (x & 1) << (l - i - 1); - x >>= 1; - } - - return rb; - }; - - // Performs "tweedling" phase, therefore 'emulating' - // behaviour of the recursive algorithm - FFTM.prototype.permute = function permute (rbt, rws, iws, rtws, itws, N) { - for (var i = 0; i < N; i++) { - rtws[i] = rws[rbt[i]]; - itws[i] = iws[rbt[i]]; - } - }; - - FFTM.prototype.transform = function transform (rws, iws, rtws, itws, N, rbt) { - this.permute(rbt, rws, iws, rtws, itws, N); - - for (var s = 1; s < N; s <<= 1) { - var l = s << 1; - - var rtwdf = Math.cos(2 * Math.PI / l); - var itwdf = Math.sin(2 * Math.PI / l); - - for (var p = 0; p < N; p += l) { - var rtwdf_ = rtwdf; - var itwdf_ = itwdf; - - for (var j = 0; j < s; j++) { - var re = rtws[p + j]; - var ie = itws[p + j]; - - var ro = rtws[p + j + s]; - var io = itws[p + j + s]; - - var rx = rtwdf_ * ro - itwdf_ * io; - - io = rtwdf_ * io + itwdf_ * ro; - ro = rx; - - rtws[p + j] = re + ro; - itws[p + j] = ie + io; - - rtws[p + j + s] = re - ro; - itws[p + j + s] = ie - io; - - /* jshint maxdepth : false */ - if (j !== l) { - rx = rtwdf * rtwdf_ - itwdf * itwdf_; - - itwdf_ = rtwdf * itwdf_ + itwdf * rtwdf_; - rtwdf_ = rx; - } - } - } - } - }; - - FFTM.prototype.guessLen13b = function guessLen13b (n, m) { - var N = Math.max(m, n) | 1; - var odd = N & 1; - var i = 0; - for (N = N / 2 | 0; N; N = N >>> 1) { - i++; - } - - return 1 << i + 1 + odd; - }; - - FFTM.prototype.conjugate = function conjugate (rws, iws, N) { - if (N <= 1) return; - - for (var i = 0; i < N / 2; i++) { - var t = rws[i]; - - rws[i] = rws[N - i - 1]; - rws[N - i - 1] = t; - - t = iws[i]; - - iws[i] = -iws[N - i - 1]; - iws[N - i - 1] = -t; - } - }; - - FFTM.prototype.normalize13b = function normalize13b (ws, N) { - var carry = 0; - for (var i = 0; i < N / 2; i++) { - var w = Math.round(ws[2 * i + 1] / N) * 0x2000 + - Math.round(ws[2 * i] / N) + - carry; - - ws[i] = w & 0x3ffffff; - - if (w < 0x4000000) { - carry = 0; - } else { - carry = w / 0x4000000 | 0; - } - } - - return ws; - }; - - FFTM.prototype.convert13b = function convert13b (ws, len, rws, N) { - var carry = 0; - for (var i = 0; i < len; i++) { - carry = carry + (ws[i] | 0); - - rws[2 * i] = carry & 0x1fff; carry = carry >>> 13; - rws[2 * i + 1] = carry & 0x1fff; carry = carry >>> 13; - } - - // Pad with zeroes - for (i = 2 * len; i < N; ++i) { - rws[i] = 0; - } - - assert(carry === 0); - assert((carry & ~0x1fff) === 0); - }; - - FFTM.prototype.stub = function stub (N) { - var ph = new Array(N); - for (var i = 0; i < N; i++) { - ph[i] = 0; - } - - return ph; - }; - - FFTM.prototype.mulp = function mulp (x, y, out) { - var N = 2 * this.guessLen13b(x.length, y.length); - - var rbt = this.makeRBT(N); - - var _ = this.stub(N); - - var rws = new Array(N); - var rwst = new Array(N); - var iwst = new Array(N); - - var nrws = new Array(N); - var nrwst = new Array(N); - var niwst = new Array(N); - - var rmws = out.words; - rmws.length = N; - - this.convert13b(x.words, x.length, rws, N); - this.convert13b(y.words, y.length, nrws, N); - - this.transform(rws, _, rwst, iwst, N, rbt); - this.transform(nrws, _, nrwst, niwst, N, rbt); - - for (var i = 0; i < N; i++) { - var rx = rwst[i] * nrwst[i] - iwst[i] * niwst[i]; - iwst[i] = rwst[i] * niwst[i] + iwst[i] * nrwst[i]; - rwst[i] = rx; - } - - this.conjugate(rwst, iwst, N); - this.transform(rwst, iwst, rmws, _, N, rbt); - this.conjugate(rmws, _, N); - this.normalize13b(rmws, N); - - out.negative = x.negative ^ y.negative; - out.length = x.length + y.length; - return out.strip(); - }; - - // Multiply `this` by `num` - BN.prototype.mul = function mul (num) { - var out = new BN(null); - out.words = new Array(this.length + num.length); - return this.mulTo(num, out); - }; - - // Multiply employing FFT - BN.prototype.mulf = function mulf (num) { - var out = new BN(null); - out.words = new Array(this.length + num.length); - return jumboMulTo(this, num, out); - }; - - // In-place Multiplication - BN.prototype.imul = function imul (num) { - return this.clone().mulTo(num, this); - }; - - BN.prototype.imuln = function imuln (num) { - assert(typeof num === 'number'); - assert(num < 0x4000000); - - // Carry - var carry = 0; - for (var i = 0; i < this.length; i++) { - var w = (this.words[i] | 0) * num; - var lo = (w & 0x3ffffff) + (carry & 0x3ffffff); - carry >>= 26; - carry += (w / 0x4000000) | 0; - // NOTE: lo is 27bit maximum - carry += lo >>> 26; - this.words[i] = lo & 0x3ffffff; - } - - if (carry !== 0) { - this.words[i] = carry; - this.length++; - } - - return this; - }; - - BN.prototype.muln = function muln (num) { - return this.clone().imuln(num); - }; - - // `this` * `this` - BN.prototype.sqr = function sqr () { - return this.mul(this); - }; - - // `this` * `this` in-place - BN.prototype.isqr = function isqr () { - return this.imul(this.clone()); - }; - - // Math.pow(`this`, `num`) - BN.prototype.pow = function pow (num) { - var w = toBitArray(num); - if (w.length === 0) return new BN(1); - - // Skip leading zeroes - var res = this; - for (var i = 0; i < w.length; i++, res = res.sqr()) { - if (w[i] !== 0) break; - } - - if (++i < w.length) { - for (var q = res.sqr(); i < w.length; i++, q = q.sqr()) { - if (w[i] === 0) continue; - - res = res.mul(q); - } - } - - return res; - }; - - // Shift-left in-place - BN.prototype.iushln = function iushln (bits) { - assert(typeof bits === 'number' && bits >= 0); - var r = bits % 26; - var s = (bits - r) / 26; - var carryMask = (0x3ffffff >>> (26 - r)) << (26 - r); - var i; - - if (r !== 0) { - var carry = 0; - - for (i = 0; i < this.length; i++) { - var newCarry = this.words[i] & carryMask; - var c = ((this.words[i] | 0) - newCarry) << r; - this.words[i] = c | carry; - carry = newCarry >>> (26 - r); - } - - if (carry) { - this.words[i] = carry; - this.length++; - } - } - - if (s !== 0) { - for (i = this.length - 1; i >= 0; i--) { - this.words[i + s] = this.words[i]; - } - - for (i = 0; i < s; i++) { - this.words[i] = 0; - } - - this.length += s; - } - - return this.strip(); - }; - - BN.prototype.ishln = function ishln (bits) { - // TODO(indutny): implement me - assert(this.negative === 0); - return this.iushln(bits); - }; - - // Shift-right in-place - // NOTE: `hint` is a lowest bit before trailing zeroes - // NOTE: if `extended` is present - it will be filled with destroyed bits - BN.prototype.iushrn = function iushrn (bits, hint, extended) { - assert(typeof bits === 'number' && bits >= 0); - var h; - if (hint) { - h = (hint - (hint % 26)) / 26; - } else { - h = 0; - } - - var r = bits % 26; - var s = Math.min((bits - r) / 26, this.length); - var mask = 0x3ffffff ^ ((0x3ffffff >>> r) << r); - var maskedWords = extended; - - h -= s; - h = Math.max(0, h); - - // Extended mode, copy masked part - if (maskedWords) { - for (var i = 0; i < s; i++) { - maskedWords.words[i] = this.words[i]; - } - maskedWords.length = s; - } - - if (s === 0) { - // No-op, we should not move anything at all - } else if (this.length > s) { - this.length -= s; - for (i = 0; i < this.length; i++) { - this.words[i] = this.words[i + s]; - } - } else { - this.words[0] = 0; - this.length = 1; - } - - var carry = 0; - for (i = this.length - 1; i >= 0 && (carry !== 0 || i >= h); i--) { - var word = this.words[i] | 0; - this.words[i] = (carry << (26 - r)) | (word >>> r); - carry = word & mask; - } - - // Push carried bits as a mask - if (maskedWords && carry !== 0) { - maskedWords.words[maskedWords.length++] = carry; - } - - if (this.length === 0) { - this.words[0] = 0; - this.length = 1; - } - - return this.strip(); - }; - - BN.prototype.ishrn = function ishrn (bits, hint, extended) { - // TODO(indutny): implement me - assert(this.negative === 0); - return this.iushrn(bits, hint, extended); - }; - - // Shift-left - BN.prototype.shln = function shln (bits) { - return this.clone().ishln(bits); - }; - - BN.prototype.ushln = function ushln (bits) { - return this.clone().iushln(bits); - }; - - // Shift-right - BN.prototype.shrn = function shrn (bits) { - return this.clone().ishrn(bits); - }; - - BN.prototype.ushrn = function ushrn (bits) { - return this.clone().iushrn(bits); - }; - - // Test if n bit is set - BN.prototype.testn = function testn (bit) { - assert(typeof bit === 'number' && bit >= 0); - var r = bit % 26; - var s = (bit - r) / 26; - var q = 1 << r; - - // Fast case: bit is much higher than all existing words - if (this.length <= s) return false; - - // Check bit and return - var w = this.words[s]; - - return !!(w & q); - }; - - // Return only lowers bits of number (in-place) - BN.prototype.imaskn = function imaskn (bits) { - assert(typeof bits === 'number' && bits >= 0); - var r = bits % 26; - var s = (bits - r) / 26; - - assert(this.negative === 0, 'imaskn works only with positive numbers'); - - if (this.length <= s) { - return this; - } - - if (r !== 0) { - s++; - } - this.length = Math.min(s, this.length); - - if (r !== 0) { - var mask = 0x3ffffff ^ ((0x3ffffff >>> r) << r); - this.words[this.length - 1] &= mask; - } - - return this.strip(); - }; - - // Return only lowers bits of number - BN.prototype.maskn = function maskn (bits) { - return this.clone().imaskn(bits); - }; - - // Add plain number `num` to `this` - BN.prototype.iaddn = function iaddn (num) { - assert(typeof num === 'number'); - assert(num < 0x4000000); - if (num < 0) return this.isubn(-num); - - // Possible sign change - if (this.negative !== 0) { - if (this.length === 1 && (this.words[0] | 0) < num) { - this.words[0] = num - (this.words[0] | 0); - this.negative = 0; - return this; - } - - this.negative = 0; - this.isubn(num); - this.negative = 1; - return this; - } - - // Add without checks - return this._iaddn(num); - }; - - BN.prototype._iaddn = function _iaddn (num) { - this.words[0] += num; - - // Carry - for (var i = 0; i < this.length && this.words[i] >= 0x4000000; i++) { - this.words[i] -= 0x4000000; - if (i === this.length - 1) { - this.words[i + 1] = 1; - } else { - this.words[i + 1]++; - } - } - this.length = Math.max(this.length, i + 1); - - return this; - }; - - // Subtract plain number `num` from `this` - BN.prototype.isubn = function isubn (num) { - assert(typeof num === 'number'); - assert(num < 0x4000000); - if (num < 0) return this.iaddn(-num); - - if (this.negative !== 0) { - this.negative = 0; - this.iaddn(num); - this.negative = 1; - return this; - } - - this.words[0] -= num; - - if (this.length === 1 && this.words[0] < 0) { - this.words[0] = -this.words[0]; - this.negative = 1; - } else { - // Carry - for (var i = 0; i < this.length && this.words[i] < 0; i++) { - this.words[i] += 0x4000000; - this.words[i + 1] -= 1; - } - } - - return this.strip(); - }; - - BN.prototype.addn = function addn (num) { - return this.clone().iaddn(num); - }; - - BN.prototype.subn = function subn (num) { - return this.clone().isubn(num); - }; - - BN.prototype.iabs = function iabs () { - this.negative = 0; - - return this; - }; - - BN.prototype.abs = function abs () { - return this.clone().iabs(); - }; - - BN.prototype._ishlnsubmul = function _ishlnsubmul (num, mul, shift) { - var len = num.length + shift; - var i; - - this._expand(len); - - var w; - var carry = 0; - for (i = 0; i < num.length; i++) { - w = (this.words[i + shift] | 0) + carry; - var right = (num.words[i] | 0) * mul; - w -= right & 0x3ffffff; - carry = (w >> 26) - ((right / 0x4000000) | 0); - this.words[i + shift] = w & 0x3ffffff; - } - for (; i < this.length - shift; i++) { - w = (this.words[i + shift] | 0) + carry; - carry = w >> 26; - this.words[i + shift] = w & 0x3ffffff; - } - - if (carry === 0) return this.strip(); - - // Subtraction overflow - assert(carry === -1); - carry = 0; - for (i = 0; i < this.length; i++) { - w = -(this.words[i] | 0) + carry; - carry = w >> 26; - this.words[i] = w & 0x3ffffff; - } - this.negative = 1; - - return this.strip(); - }; - - BN.prototype._wordDiv = function _wordDiv (num, mode) { - var shift = this.length - num.length; - - var a = this.clone(); - var b = num; - - // Normalize - var bhi = b.words[b.length - 1] | 0; - var bhiBits = this._countBits(bhi); - shift = 26 - bhiBits; - if (shift !== 0) { - b = b.ushln(shift); - a.iushln(shift); - bhi = b.words[b.length - 1] | 0; - } - - // Initialize quotient - var m = a.length - b.length; - var q; - - if (mode !== 'mod') { - q = new BN(null); - q.length = m + 1; - q.words = new Array(q.length); - for (var i = 0; i < q.length; i++) { - q.words[i] = 0; - } - } - - var diff = a.clone()._ishlnsubmul(b, 1, m); - if (diff.negative === 0) { - a = diff; - if (q) { - q.words[m] = 1; - } - } - - for (var j = m - 1; j >= 0; j--) { - var qj = (a.words[b.length + j] | 0) * 0x4000000 + - (a.words[b.length + j - 1] | 0); - - // NOTE: (qj / bhi) is (0x3ffffff * 0x4000000 + 0x3ffffff) / 0x2000000 max - // (0x7ffffff) - qj = Math.min((qj / bhi) | 0, 0x3ffffff); - - a._ishlnsubmul(b, qj, j); - while (a.negative !== 0) { - qj--; - a.negative = 0; - a._ishlnsubmul(b, 1, j); - if (!a.isZero()) { - a.negative ^= 1; - } - } - if (q) { - q.words[j] = qj; - } - } - if (q) { - q.strip(); - } - a.strip(); - - // Denormalize - if (mode !== 'div' && shift !== 0) { - a.iushrn(shift); - } - - return { - div: q || null, - mod: a - }; - }; - - // NOTE: 1) `mode` can be set to `mod` to request mod only, - // to `div` to request div only, or be absent to - // request both div & mod - // 2) `positive` is true if unsigned mod is requested - BN.prototype.divmod = function divmod (num, mode, positive) { - assert(!num.isZero()); - - if (this.isZero()) { - return { - div: new BN(0), - mod: new BN(0) - }; - } - - var div, mod, res; - if (this.negative !== 0 && num.negative === 0) { - res = this.neg().divmod(num, mode); - - if (mode !== 'mod') { - div = res.div.neg(); - } - - if (mode !== 'div') { - mod = res.mod.neg(); - if (positive && mod.negative !== 0) { - mod.iadd(num); - } - } - - return { - div: div, - mod: mod - }; - } - - if (this.negative === 0 && num.negative !== 0) { - res = this.divmod(num.neg(), mode); - - if (mode !== 'mod') { - div = res.div.neg(); - } - - return { - div: div, - mod: res.mod - }; - } - - if ((this.negative & num.negative) !== 0) { - res = this.neg().divmod(num.neg(), mode); - - if (mode !== 'div') { - mod = res.mod.neg(); - if (positive && mod.negative !== 0) { - mod.isub(num); - } - } - - return { - div: res.div, - mod: mod - }; - } - - // Both numbers are positive at this point - - // Strip both numbers to approximate shift value - if (num.length > this.length || this.cmp(num) < 0) { - return { - div: new BN(0), - mod: this - }; - } - - // Very short reduction - if (num.length === 1) { - if (mode === 'div') { - return { - div: this.divn(num.words[0]), - mod: null - }; - } - - if (mode === 'mod') { - return { - div: null, - mod: new BN(this.modn(num.words[0])) - }; - } - - return { - div: this.divn(num.words[0]), - mod: new BN(this.modn(num.words[0])) - }; - } - - return this._wordDiv(num, mode); - }; - - // Find `this` / `num` - BN.prototype.div = function div (num) { - return this.divmod(num, 'div', false).div; - }; - - // Find `this` % `num` - BN.prototype.mod = function mod (num) { - return this.divmod(num, 'mod', false).mod; - }; - - BN.prototype.umod = function umod (num) { - return this.divmod(num, 'mod', true).mod; - }; - - // Find Round(`this` / `num`) - BN.prototype.divRound = function divRound (num) { - var dm = this.divmod(num); - - // Fast case - exact division - if (dm.mod.isZero()) return dm.div; - - var mod = dm.div.negative !== 0 ? dm.mod.isub(num) : dm.mod; - - var half = num.ushrn(1); - var r2 = num.andln(1); - var cmp = mod.cmp(half); - - // Round down - if (cmp < 0 || r2 === 1 && cmp === 0) return dm.div; - - // Round up - return dm.div.negative !== 0 ? dm.div.isubn(1) : dm.div.iaddn(1); - }; - - BN.prototype.modn = function modn (num) { - assert(num <= 0x3ffffff); - var p = (1 << 26) % num; - - var acc = 0; - for (var i = this.length - 1; i >= 0; i--) { - acc = (p * acc + (this.words[i] | 0)) % num; - } - - return acc; - }; - - // In-place division by number - BN.prototype.idivn = function idivn (num) { - assert(num <= 0x3ffffff); - - var carry = 0; - for (var i = this.length - 1; i >= 0; i--) { - var w = (this.words[i] | 0) + carry * 0x4000000; - this.words[i] = (w / num) | 0; - carry = w % num; - } - - return this.strip(); - }; - - BN.prototype.divn = function divn (num) { - return this.clone().idivn(num); - }; - - BN.prototype.egcd = function egcd (p) { - assert(p.negative === 0); - assert(!p.isZero()); - - var x = this; - var y = p.clone(); - - if (x.negative !== 0) { - x = x.umod(p); - } else { - x = x.clone(); - } - - // A * x + B * y = x - var A = new BN(1); - var B = new BN(0); - - // C * x + D * y = y - var C = new BN(0); - var D = new BN(1); - - var g = 0; - - while (x.isEven() && y.isEven()) { - x.iushrn(1); - y.iushrn(1); - ++g; - } - - var yp = y.clone(); - var xp = x.clone(); - - while (!x.isZero()) { - for (var i = 0, im = 1; (x.words[0] & im) === 0 && i < 26; ++i, im <<= 1); - if (i > 0) { - x.iushrn(i); - while (i-- > 0) { - if (A.isOdd() || B.isOdd()) { - A.iadd(yp); - B.isub(xp); - } - - A.iushrn(1); - B.iushrn(1); - } - } - - for (var j = 0, jm = 1; (y.words[0] & jm) === 0 && j < 26; ++j, jm <<= 1); - if (j > 0) { - y.iushrn(j); - while (j-- > 0) { - if (C.isOdd() || D.isOdd()) { - C.iadd(yp); - D.isub(xp); - } - - C.iushrn(1); - D.iushrn(1); - } - } - - if (x.cmp(y) >= 0) { - x.isub(y); - A.isub(C); - B.isub(D); - } else { - y.isub(x); - C.isub(A); - D.isub(B); - } - } - - return { - a: C, - b: D, - gcd: y.iushln(g) - }; - }; - - // This is reduced incarnation of the binary EEA - // above, designated to invert members of the - // _prime_ fields F(p) at a maximal speed - BN.prototype._invmp = function _invmp (p) { - assert(p.negative === 0); - assert(!p.isZero()); - - var a = this; - var b = p.clone(); - - if (a.negative !== 0) { - a = a.umod(p); - } else { - a = a.clone(); - } - - var x1 = new BN(1); - var x2 = new BN(0); - - var delta = b.clone(); - - while (a.cmpn(1) > 0 && b.cmpn(1) > 0) { - for (var i = 0, im = 1; (a.words[0] & im) === 0 && i < 26; ++i, im <<= 1); - if (i > 0) { - a.iushrn(i); - while (i-- > 0) { - if (x1.isOdd()) { - x1.iadd(delta); - } - - x1.iushrn(1); - } - } - - for (var j = 0, jm = 1; (b.words[0] & jm) === 0 && j < 26; ++j, jm <<= 1); - if (j > 0) { - b.iushrn(j); - while (j-- > 0) { - if (x2.isOdd()) { - x2.iadd(delta); - } - - x2.iushrn(1); - } - } - - if (a.cmp(b) >= 0) { - a.isub(b); - x1.isub(x2); - } else { - b.isub(a); - x2.isub(x1); - } - } - - var res; - if (a.cmpn(1) === 0) { - res = x1; - } else { - res = x2; - } - - if (res.cmpn(0) < 0) { - res.iadd(p); - } - - return res; - }; - - BN.prototype.gcd = function gcd (num) { - if (this.isZero()) return num.abs(); - if (num.isZero()) return this.abs(); - - var a = this.clone(); - var b = num.clone(); - a.negative = 0; - b.negative = 0; - - // Remove common factor of two - for (var shift = 0; a.isEven() && b.isEven(); shift++) { - a.iushrn(1); - b.iushrn(1); - } - - do { - while (a.isEven()) { - a.iushrn(1); - } - while (b.isEven()) { - b.iushrn(1); - } - - var r = a.cmp(b); - if (r < 0) { - // Swap `a` and `b` to make `a` always bigger than `b` - var t = a; - a = b; - b = t; - } else if (r === 0 || b.cmpn(1) === 0) { - break; - } - - a.isub(b); - } while (true); - - return b.iushln(shift); - }; - - // Invert number in the field F(num) - BN.prototype.invm = function invm (num) { - return this.egcd(num).a.umod(num); - }; - - BN.prototype.isEven = function isEven () { - return (this.words[0] & 1) === 0; - }; - - BN.prototype.isOdd = function isOdd () { - return (this.words[0] & 1) === 1; - }; - - // And first word and num - BN.prototype.andln = function andln (num) { - return this.words[0] & num; - }; - - // Increment at the bit position in-line - BN.prototype.bincn = function bincn (bit) { - assert(typeof bit === 'number'); - var r = bit % 26; - var s = (bit - r) / 26; - var q = 1 << r; - - // Fast case: bit is much higher than all existing words - if (this.length <= s) { - this._expand(s + 1); - this.words[s] |= q; - return this; - } - - // Add bit and propagate, if needed - var carry = q; - for (var i = s; carry !== 0 && i < this.length; i++) { - var w = this.words[i] | 0; - w += carry; - carry = w >>> 26; - w &= 0x3ffffff; - this.words[i] = w; - } - if (carry !== 0) { - this.words[i] = carry; - this.length++; - } - return this; - }; - - BN.prototype.isZero = function isZero () { - return this.length === 1 && this.words[0] === 0; - }; - - BN.prototype.cmpn = function cmpn (num) { - var negative = num < 0; - - if (this.negative !== 0 && !negative) return -1; - if (this.negative === 0 && negative) return 1; - - this.strip(); - - var res; - if (this.length > 1) { - res = 1; - } else { - if (negative) { - num = -num; - } - - assert(num <= 0x3ffffff, 'Number is too big'); - - var w = this.words[0] | 0; - res = w === num ? 0 : w < num ? -1 : 1; - } - if (this.negative !== 0) return -res | 0; - return res; - }; - - // Compare two numbers and return: - // 1 - if `this` > `num` - // 0 - if `this` == `num` - // -1 - if `this` < `num` - BN.prototype.cmp = function cmp (num) { - if (this.negative !== 0 && num.negative === 0) return -1; - if (this.negative === 0 && num.negative !== 0) return 1; - - var res = this.ucmp(num); - if (this.negative !== 0) return -res | 0; - return res; - }; - - // Unsigned comparison - BN.prototype.ucmp = function ucmp (num) { - // At this point both numbers have the same sign - if (this.length > num.length) return 1; - if (this.length < num.length) return -1; - - var res = 0; - for (var i = this.length - 1; i >= 0; i--) { - var a = this.words[i] | 0; - var b = num.words[i] | 0; - - if (a === b) continue; - if (a < b) { - res = -1; - } else if (a > b) { - res = 1; - } - break; - } - return res; - }; - - BN.prototype.gtn = function gtn (num) { - return this.cmpn(num) === 1; - }; - - BN.prototype.gt = function gt (num) { - return this.cmp(num) === 1; - }; - - BN.prototype.gten = function gten (num) { - return this.cmpn(num) >= 0; - }; - - BN.prototype.gte = function gte (num) { - return this.cmp(num) >= 0; - }; - - BN.prototype.ltn = function ltn (num) { - return this.cmpn(num) === -1; - }; - - BN.prototype.lt = function lt (num) { - return this.cmp(num) === -1; - }; - - BN.prototype.lten = function lten (num) { - return this.cmpn(num) <= 0; - }; - - BN.prototype.lte = function lte (num) { - return this.cmp(num) <= 0; - }; - - BN.prototype.eqn = function eqn (num) { - return this.cmpn(num) === 0; - }; - - BN.prototype.eq = function eq (num) { - return this.cmp(num) === 0; - }; - - // - // A reduce context, could be using montgomery or something better, depending - // on the `m` itself. - // - BN.red = function red (num) { - return new Red(num); - }; - - BN.prototype.toRed = function toRed (ctx) { - assert(!this.red, 'Already a number in reduction context'); - assert(this.negative === 0, 'red works only with positives'); - return ctx.convertTo(this)._forceRed(ctx); - }; - - BN.prototype.fromRed = function fromRed () { - assert(this.red, 'fromRed works only with numbers in reduction context'); - return this.red.convertFrom(this); - }; - - BN.prototype._forceRed = function _forceRed (ctx) { - this.red = ctx; - return this; - }; - - BN.prototype.forceRed = function forceRed (ctx) { - assert(!this.red, 'Already a number in reduction context'); - return this._forceRed(ctx); - }; - - BN.prototype.redAdd = function redAdd (num) { - assert(this.red, 'redAdd works only with red numbers'); - return this.red.add(this, num); - }; - - BN.prototype.redIAdd = function redIAdd (num) { - assert(this.red, 'redIAdd works only with red numbers'); - return this.red.iadd(this, num); - }; - - BN.prototype.redSub = function redSub (num) { - assert(this.red, 'redSub works only with red numbers'); - return this.red.sub(this, num); - }; - - BN.prototype.redISub = function redISub (num) { - assert(this.red, 'redISub works only with red numbers'); - return this.red.isub(this, num); - }; - - BN.prototype.redShl = function redShl (num) { - assert(this.red, 'redShl works only with red numbers'); - return this.red.shl(this, num); - }; - - BN.prototype.redMul = function redMul (num) { - assert(this.red, 'redMul works only with red numbers'); - this.red._verify2(this, num); - return this.red.mul(this, num); - }; - - BN.prototype.redIMul = function redIMul (num) { - assert(this.red, 'redMul works only with red numbers'); - this.red._verify2(this, num); - return this.red.imul(this, num); - }; - - BN.prototype.redSqr = function redSqr () { - assert(this.red, 'redSqr works only with red numbers'); - this.red._verify1(this); - return this.red.sqr(this); - }; - - BN.prototype.redISqr = function redISqr () { - assert(this.red, 'redISqr works only with red numbers'); - this.red._verify1(this); - return this.red.isqr(this); - }; - - // Square root over p - BN.prototype.redSqrt = function redSqrt () { - assert(this.red, 'redSqrt works only with red numbers'); - this.red._verify1(this); - return this.red.sqrt(this); - }; - - BN.prototype.redInvm = function redInvm () { - assert(this.red, 'redInvm works only with red numbers'); - this.red._verify1(this); - return this.red.invm(this); - }; - - // Return negative clone of `this` % `red modulo` - BN.prototype.redNeg = function redNeg () { - assert(this.red, 'redNeg works only with red numbers'); - this.red._verify1(this); - return this.red.neg(this); - }; - - BN.prototype.redPow = function redPow (num) { - assert(this.red && !num.red, 'redPow(normalNum)'); - this.red._verify1(this); - return this.red.pow(this, num); - }; - - // Prime numbers with efficient reduction - var primes = { - k256: null, - p224: null, - p192: null, - p25519: null - }; - - // Pseudo-Mersenne prime - function MPrime (name, p) { - // P = 2 ^ N - K - this.name = name; - this.p = new BN(p, 16); - this.n = this.p.bitLength(); - this.k = new BN(1).iushln(this.n).isub(this.p); - - this.tmp = this._tmp(); - } - - MPrime.prototype._tmp = function _tmp () { - var tmp = new BN(null); - tmp.words = new Array(Math.ceil(this.n / 13)); - return tmp; - }; - - MPrime.prototype.ireduce = function ireduce (num) { - // Assumes that `num` is less than `P^2` - // num = HI * (2 ^ N - K) + HI * K + LO = HI * K + LO (mod P) - var r = num; - var rlen; - - do { - this.split(r, this.tmp); - r = this.imulK(r); - r = r.iadd(this.tmp); - rlen = r.bitLength(); - } while (rlen > this.n); - - var cmp = rlen < this.n ? -1 : r.ucmp(this.p); - if (cmp === 0) { - r.words[0] = 0; - r.length = 1; - } else if (cmp > 0) { - r.isub(this.p); - } else { - r.strip(); - } - - return r; - }; - - MPrime.prototype.split = function split (input, out) { - input.iushrn(this.n, 0, out); - }; - - MPrime.prototype.imulK = function imulK (num) { - return num.imul(this.k); - }; - - function K256 () { - MPrime.call( - this, - 'k256', - 'ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f'); - } - inherits(K256, MPrime); - - K256.prototype.split = function split (input, output) { - // 256 = 9 * 26 + 22 - var mask = 0x3fffff; - - var outLen = Math.min(input.length, 9); - for (var i = 0; i < outLen; i++) { - output.words[i] = input.words[i]; - } - output.length = outLen; - - if (input.length <= 9) { - input.words[0] = 0; - input.length = 1; - return; - } - - // Shift by 9 limbs - var prev = input.words[9]; - output.words[output.length++] = prev & mask; - - for (i = 10; i < input.length; i++) { - var next = input.words[i] | 0; - input.words[i - 10] = ((next & mask) << 4) | (prev >>> 22); - prev = next; - } - prev >>>= 22; - input.words[i - 10] = prev; - if (prev === 0 && input.length > 10) { - input.length -= 10; - } else { - input.length -= 9; - } - }; - - K256.prototype.imulK = function imulK (num) { - // K = 0x1000003d1 = [ 0x40, 0x3d1 ] - num.words[num.length] = 0; - num.words[num.length + 1] = 0; - num.length += 2; - - // bounded at: 0x40 * 0x3ffffff + 0x3d0 = 0x100000390 - var lo = 0; - for (var i = 0; i < num.length; i++) { - var w = num.words[i] | 0; - lo += w * 0x3d1; - num.words[i] = lo & 0x3ffffff; - lo = w * 0x40 + ((lo / 0x4000000) | 0); - } - - // Fast length reduction - if (num.words[num.length - 1] === 0) { - num.length--; - if (num.words[num.length - 1] === 0) { - num.length--; - } - } - return num; - }; - - function P224 () { - MPrime.call( - this, - 'p224', - 'ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001'); - } - inherits(P224, MPrime); - - function P192 () { - MPrime.call( - this, - 'p192', - 'ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff'); - } - inherits(P192, MPrime); - - function P25519 () { - // 2 ^ 255 - 19 - MPrime.call( - this, - '25519', - '7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed'); - } - inherits(P25519, MPrime); - - P25519.prototype.imulK = function imulK (num) { - // K = 0x13 - var carry = 0; - for (var i = 0; i < num.length; i++) { - var hi = (num.words[i] | 0) * 0x13 + carry; - var lo = hi & 0x3ffffff; - hi >>>= 26; - - num.words[i] = lo; - carry = hi; - } - if (carry !== 0) { - num.words[num.length++] = carry; - } - return num; - }; - - // Exported mostly for testing purposes, use plain name instead - BN._prime = function prime (name) { - // Cached version of prime - if (primes[name]) return primes[name]; - - var prime; - if (name === 'k256') { - prime = new K256(); - } else if (name === 'p224') { - prime = new P224(); - } else if (name === 'p192') { - prime = new P192(); - } else if (name === 'p25519') { - prime = new P25519(); - } else { - throw new Error('Unknown prime ' + name); - } - primes[name] = prime; - - return prime; - }; - - // - // Base reduction engine - // - function Red (m) { - if (typeof m === 'string') { - var prime = BN._prime(m); - this.m = prime.p; - this.prime = prime; - } else { - assert(m.gtn(1), 'modulus must be greater than 1'); - this.m = m; - this.prime = null; - } - } - - Red.prototype._verify1 = function _verify1 (a) { - assert(a.negative === 0, 'red works only with positives'); - assert(a.red, 'red works only with red numbers'); - }; - - Red.prototype._verify2 = function _verify2 (a, b) { - assert((a.negative | b.negative) === 0, 'red works only with positives'); - assert(a.red && a.red === b.red, - 'red works only with red numbers'); - }; - - Red.prototype.imod = function imod (a) { - if (this.prime) return this.prime.ireduce(a)._forceRed(this); - return a.umod(this.m)._forceRed(this); - }; - - Red.prototype.neg = function neg (a) { - if (a.isZero()) { - return a.clone(); - } - - return this.m.sub(a)._forceRed(this); - }; - - Red.prototype.add = function add (a, b) { - this._verify2(a, b); - - var res = a.add(b); - if (res.cmp(this.m) >= 0) { - res.isub(this.m); - } - return res._forceRed(this); - }; - - Red.prototype.iadd = function iadd (a, b) { - this._verify2(a, b); - - var res = a.iadd(b); - if (res.cmp(this.m) >= 0) { - res.isub(this.m); - } - return res; - }; - - Red.prototype.sub = function sub (a, b) { - this._verify2(a, b); - - var res = a.sub(b); - if (res.cmpn(0) < 0) { - res.iadd(this.m); - } - return res._forceRed(this); - }; - - Red.prototype.isub = function isub (a, b) { - this._verify2(a, b); - - var res = a.isub(b); - if (res.cmpn(0) < 0) { - res.iadd(this.m); - } - return res; - }; - - Red.prototype.shl = function shl (a, num) { - this._verify1(a); - return this.imod(a.ushln(num)); - }; - - Red.prototype.imul = function imul (a, b) { - this._verify2(a, b); - return this.imod(a.imul(b)); - }; - - Red.prototype.mul = function mul (a, b) { - this._verify2(a, b); - return this.imod(a.mul(b)); - }; - - Red.prototype.isqr = function isqr (a) { - return this.imul(a, a.clone()); - }; - - Red.prototype.sqr = function sqr (a) { - return this.mul(a, a); - }; - - Red.prototype.sqrt = function sqrt (a) { - if (a.isZero()) return a.clone(); - - var mod3 = this.m.andln(3); - assert(mod3 % 2 === 1); - - // Fast case - if (mod3 === 3) { - var pow = this.m.add(new BN(1)).iushrn(2); - return this.pow(a, pow); - } - - // Tonelli-Shanks algorithm (Totally unoptimized and slow) - // - // Find Q and S, that Q * 2 ^ S = (P - 1) - var q = this.m.subn(1); - var s = 0; - while (!q.isZero() && q.andln(1) === 0) { - s++; - q.iushrn(1); - } - assert(!q.isZero()); - - var one = new BN(1).toRed(this); - var nOne = one.redNeg(); - - // Find quadratic non-residue - // NOTE: Max is such because of generalized Riemann hypothesis. - var lpow = this.m.subn(1).iushrn(1); - var z = this.m.bitLength(); - z = new BN(2 * z * z).toRed(this); - - while (this.pow(z, lpow).cmp(nOne) !== 0) { - z.redIAdd(nOne); - } - - var c = this.pow(z, q); - var r = this.pow(a, q.addn(1).iushrn(1)); - var t = this.pow(a, q); - var m = s; - while (t.cmp(one) !== 0) { - var tmp = t; - for (var i = 0; tmp.cmp(one) !== 0; i++) { - tmp = tmp.redSqr(); - } - assert(i < m); - var b = this.pow(c, new BN(1).iushln(m - i - 1)); - - r = r.redMul(b); - c = b.redSqr(); - t = t.redMul(c); - m = i; - } - - return r; - }; - - Red.prototype.invm = function invm (a) { - var inv = a._invmp(this.m); - if (inv.negative !== 0) { - inv.negative = 0; - return this.imod(inv).redNeg(); - } else { - return this.imod(inv); - } - }; - - Red.prototype.pow = function pow (a, num) { - if (num.isZero()) return new BN(1).toRed(this); - if (num.cmpn(1) === 0) return a.clone(); - - var windowSize = 4; - var wnd = new Array(1 << windowSize); - wnd[0] = new BN(1).toRed(this); - wnd[1] = a; - for (var i = 2; i < wnd.length; i++) { - wnd[i] = this.mul(wnd[i - 1], a); - } - - var res = wnd[0]; - var current = 0; - var currentLen = 0; - var start = num.bitLength() % 26; - if (start === 0) { - start = 26; - } - - for (i = num.length - 1; i >= 0; i--) { - var word = num.words[i]; - for (var j = start - 1; j >= 0; j--) { - var bit = (word >> j) & 1; - if (res !== wnd[0]) { - res = this.sqr(res); - } - - if (bit === 0 && current === 0) { - currentLen = 0; - continue; - } - - current <<= 1; - current |= bit; - currentLen++; - if (currentLen !== windowSize && (i !== 0 || j !== 0)) continue; - - res = this.mul(res, wnd[current]); - currentLen = 0; - current = 0; - } - start = 26; - } - - return res; - }; - - Red.prototype.convertTo = function convertTo (num) { - var r = num.umod(this.m); - - return r === num ? r.clone() : r; - }; - - Red.prototype.convertFrom = function convertFrom (num) { - var res = num.clone(); - res.red = null; - return res; - }; - - // - // Montgomery method engine - // - - BN.mont = function mont (num) { - return new Mont(num); - }; - - function Mont (m) { - Red.call(this, m); - - this.shift = this.m.bitLength(); - if (this.shift % 26 !== 0) { - this.shift += 26 - (this.shift % 26); - } - - this.r = new BN(1).iushln(this.shift); - this.r2 = this.imod(this.r.sqr()); - this.rinv = this.r._invmp(this.m); - - this.minv = this.rinv.mul(this.r).isubn(1).div(this.m); - this.minv = this.minv.umod(this.r); - this.minv = this.r.sub(this.minv); - } - inherits(Mont, Red); - - Mont.prototype.convertTo = function convertTo (num) { - return this.imod(num.ushln(this.shift)); - }; - - Mont.prototype.convertFrom = function convertFrom (num) { - var r = this.imod(num.mul(this.rinv)); - r.red = null; - return r; - }; - - Mont.prototype.imul = function imul (a, b) { - if (a.isZero() || b.isZero()) { - a.words[0] = 0; - a.length = 1; - return a; - } - - var t = a.imul(b); - var c = t.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m); - var u = t.isub(c).iushrn(this.shift); - var res = u; - - if (u.cmp(this.m) >= 0) { - res = u.isub(this.m); - } else if (u.cmpn(0) < 0) { - res = u.iadd(this.m); - } - - return res._forceRed(this); - }; - - Mont.prototype.mul = function mul (a, b) { - if (a.isZero() || b.isZero()) return new BN(0)._forceRed(this); - - var t = a.mul(b); - var c = t.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m); - var u = t.isub(c).iushrn(this.shift); - var res = u; - if (u.cmp(this.m) >= 0) { - res = u.isub(this.m); - } else if (u.cmpn(0) < 0) { - res = u.iadd(this.m); - } - - return res._forceRed(this); - }; - - Mont.prototype.invm = function invm (a) { - // (AR)^-1 * R^2 = (A^-1 * R^-1) * R^2 = A^-1 * R - var res = this.imod(a._invmp(this.m).mul(this.r2)); - return res._forceRed(this); - }; -})(typeof module === 'undefined' || module, this); - -},{"buffer":54}],53:[function(require,module,exports){ -var r; - -module.exports = function rand(len) { - if (!r) - r = new Rand(null); - - return r.generate(len); -}; - -function Rand(rand) { - this.rand = rand; -} -module.exports.Rand = Rand; - -Rand.prototype.generate = function generate(len) { - return this._rand(len); -}; - -// Emulate crypto API using randy -Rand.prototype._rand = function _rand(n) { - if (this.rand.getBytes) - return this.rand.getBytes(n); - - var res = new Uint8Array(n); - for (var i = 0; i < res.length; i++) - res[i] = this.rand.getByte(); - return res; -}; - -if (typeof self === 'object') { - if (self.crypto && self.crypto.getRandomValues) { - // Modern browsers - Rand.prototype._rand = function _rand(n) { - var arr = new Uint8Array(n); - self.crypto.getRandomValues(arr); - return arr; - }; - } else if (self.msCrypto && self.msCrypto.getRandomValues) { - // IE - Rand.prototype._rand = function _rand(n) { - var arr = new Uint8Array(n); - self.msCrypto.getRandomValues(arr); - return arr; - }; - - // Safari's WebWorkers do not have `crypto` - } else if (typeof window === 'object') { - // Old junk - Rand.prototype._rand = function() { - throw new Error('Not implemented yet'); - }; - } -} else { - // Node.js or Web worker with no crypto support - try { - var crypto = require('crypto'); - if (typeof crypto.randomBytes !== 'function') - throw new Error('Not supported'); - - Rand.prototype._rand = function _rand(n) { - return crypto.randomBytes(n); - }; - } catch (e) { - } -} - -},{"crypto":54}],54:[function(require,module,exports){ - -},{}],55:[function(require,module,exports){ -// based on the aes implimentation in triple sec -// https://github.com/keybase/triplesec -// which is in turn based on the one from crypto-js -// https://code.google.com/p/crypto-js/ - -var Buffer = require('safe-buffer').Buffer - -function asUInt32Array (buf) { - if (!Buffer.isBuffer(buf)) buf = Buffer.from(buf) - - var len = (buf.length / 4) | 0 - var out = new Array(len) - - for (var i = 0; i < len; i++) { - out[i] = buf.readUInt32BE(i * 4) - } - - return out -} - -function scrubVec (v) { - for (var i = 0; i < v.length; v++) { - v[i] = 0 - } -} - -function cryptBlock (M, keySchedule, SUB_MIX, SBOX, nRounds) { - var SUB_MIX0 = SUB_MIX[0] - var SUB_MIX1 = SUB_MIX[1] - var SUB_MIX2 = SUB_MIX[2] - var SUB_MIX3 = SUB_MIX[3] - - var s0 = M[0] ^ keySchedule[0] - var s1 = M[1] ^ keySchedule[1] - var s2 = M[2] ^ keySchedule[2] - var s3 = M[3] ^ keySchedule[3] - var t0, t1, t2, t3 - var ksRow = 4 - - for (var round = 1; round < nRounds; round++) { - t0 = SUB_MIX0[s0 >>> 24] ^ SUB_MIX1[(s1 >>> 16) & 0xff] ^ SUB_MIX2[(s2 >>> 8) & 0xff] ^ SUB_MIX3[s3 & 0xff] ^ keySchedule[ksRow++] - t1 = SUB_MIX0[s1 >>> 24] ^ SUB_MIX1[(s2 >>> 16) & 0xff] ^ SUB_MIX2[(s3 >>> 8) & 0xff] ^ SUB_MIX3[s0 & 0xff] ^ keySchedule[ksRow++] - t2 = SUB_MIX0[s2 >>> 24] ^ SUB_MIX1[(s3 >>> 16) & 0xff] ^ SUB_MIX2[(s0 >>> 8) & 0xff] ^ SUB_MIX3[s1 & 0xff] ^ keySchedule[ksRow++] - t3 = SUB_MIX0[s3 >>> 24] ^ SUB_MIX1[(s0 >>> 16) & 0xff] ^ SUB_MIX2[(s1 >>> 8) & 0xff] ^ SUB_MIX3[s2 & 0xff] ^ keySchedule[ksRow++] - s0 = t0 - s1 = t1 - s2 = t2 - s3 = t3 - } - - t0 = ((SBOX[s0 >>> 24] << 24) | (SBOX[(s1 >>> 16) & 0xff] << 16) | (SBOX[(s2 >>> 8) & 0xff] << 8) | SBOX[s3 & 0xff]) ^ keySchedule[ksRow++] - t1 = ((SBOX[s1 >>> 24] << 24) | (SBOX[(s2 >>> 16) & 0xff] << 16) | (SBOX[(s3 >>> 8) & 0xff] << 8) | SBOX[s0 & 0xff]) ^ keySchedule[ksRow++] - t2 = ((SBOX[s2 >>> 24] << 24) | (SBOX[(s3 >>> 16) & 0xff] << 16) | (SBOX[(s0 >>> 8) & 0xff] << 8) | SBOX[s1 & 0xff]) ^ keySchedule[ksRow++] - t3 = ((SBOX[s3 >>> 24] << 24) | (SBOX[(s0 >>> 16) & 0xff] << 16) | (SBOX[(s1 >>> 8) & 0xff] << 8) | SBOX[s2 & 0xff]) ^ keySchedule[ksRow++] - t0 = t0 >>> 0 - t1 = t1 >>> 0 - t2 = t2 >>> 0 - t3 = t3 >>> 0 - - return [t0, t1, t2, t3] -} - -// AES constants -var RCON = [0x00, 0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80, 0x1b, 0x36] -var G = (function () { - // Compute double table - var d = new Array(256) - for (var j = 0; j < 256; j++) { - if (j < 128) { - d[j] = j << 1 - } else { - d[j] = (j << 1) ^ 0x11b - } - } - - var SBOX = [] - var INV_SBOX = [] - var SUB_MIX = [[], [], [], []] - var INV_SUB_MIX = [[], [], [], []] - - // Walk GF(2^8) - var x = 0 - var xi = 0 - for (var i = 0; i < 256; ++i) { - // Compute sbox - var sx = xi ^ (xi << 1) ^ (xi << 2) ^ (xi << 3) ^ (xi << 4) - sx = (sx >>> 8) ^ (sx & 0xff) ^ 0x63 - SBOX[x] = sx - INV_SBOX[sx] = x - - // Compute multiplication - var x2 = d[x] - var x4 = d[x2] - var x8 = d[x4] - - // Compute sub bytes, mix columns tables - var t = (d[sx] * 0x101) ^ (sx * 0x1010100) - SUB_MIX[0][x] = (t << 24) | (t >>> 8) - SUB_MIX[1][x] = (t << 16) | (t >>> 16) - SUB_MIX[2][x] = (t << 8) | (t >>> 24) - SUB_MIX[3][x] = t - - // Compute inv sub bytes, inv mix columns tables - t = (x8 * 0x1010101) ^ (x4 * 0x10001) ^ (x2 * 0x101) ^ (x * 0x1010100) - INV_SUB_MIX[0][sx] = (t << 24) | (t >>> 8) - INV_SUB_MIX[1][sx] = (t << 16) | (t >>> 16) - INV_SUB_MIX[2][sx] = (t << 8) | (t >>> 24) - INV_SUB_MIX[3][sx] = t - - if (x === 0) { - x = xi = 1 - } else { - x = x2 ^ d[d[d[x8 ^ x2]]] - xi ^= d[d[xi]] - } - } - - return { - SBOX: SBOX, - INV_SBOX: INV_SBOX, - SUB_MIX: SUB_MIX, - INV_SUB_MIX: INV_SUB_MIX - } -})() - -function AES (key) { - this._key = asUInt32Array(key) - this._reset() -} - -AES.blockSize = 4 * 4 -AES.keySize = 256 / 8 -AES.prototype.blockSize = AES.blockSize -AES.prototype.keySize = AES.keySize -AES.prototype._reset = function () { - var keyWords = this._key - var keySize = keyWords.length - var nRounds = keySize + 6 - var ksRows = (nRounds + 1) * 4 - - var keySchedule = [] - for (var k = 0; k < keySize; k++) { - keySchedule[k] = keyWords[k] - } - - for (k = keySize; k < ksRows; k++) { - var t = keySchedule[k - 1] - - if (k % keySize === 0) { - t = (t << 8) | (t >>> 24) - t = - (G.SBOX[t >>> 24] << 24) | - (G.SBOX[(t >>> 16) & 0xff] << 16) | - (G.SBOX[(t >>> 8) & 0xff] << 8) | - (G.SBOX[t & 0xff]) - - t ^= RCON[(k / keySize) | 0] << 24 - } else if (keySize > 6 && k % keySize === 4) { - t = - (G.SBOX[t >>> 24] << 24) | - (G.SBOX[(t >>> 16) & 0xff] << 16) | - (G.SBOX[(t >>> 8) & 0xff] << 8) | - (G.SBOX[t & 0xff]) - } - - keySchedule[k] = keySchedule[k - keySize] ^ t - } - - var invKeySchedule = [] - for (var ik = 0; ik < ksRows; ik++) { - var ksR = ksRows - ik - var tt = keySchedule[ksR - (ik % 4 ? 0 : 4)] - - if (ik < 4 || ksR <= 4) { - invKeySchedule[ik] = tt - } else { - invKeySchedule[ik] = - G.INV_SUB_MIX[0][G.SBOX[tt >>> 24]] ^ - G.INV_SUB_MIX[1][G.SBOX[(tt >>> 16) & 0xff]] ^ - G.INV_SUB_MIX[2][G.SBOX[(tt >>> 8) & 0xff]] ^ - G.INV_SUB_MIX[3][G.SBOX[tt & 0xff]] - } - } - - this._nRounds = nRounds - this._keySchedule = keySchedule - this._invKeySchedule = invKeySchedule -} - -AES.prototype.encryptBlockRaw = function (M) { - M = asUInt32Array(M) - return cryptBlock(M, this._keySchedule, G.SUB_MIX, G.SBOX, this._nRounds) -} - -AES.prototype.encryptBlock = function (M) { - var out = this.encryptBlockRaw(M) - var buf = Buffer.allocUnsafe(16) - buf.writeUInt32BE(out[0], 0) - buf.writeUInt32BE(out[1], 4) - buf.writeUInt32BE(out[2], 8) - buf.writeUInt32BE(out[3], 12) - return buf -} - -AES.prototype.decryptBlock = function (M) { - M = asUInt32Array(M) - - // swap - var m1 = M[1] - M[1] = M[3] - M[3] = m1 - - var out = cryptBlock(M, this._invKeySchedule, G.INV_SUB_MIX, G.INV_SBOX, this._nRounds) - var buf = Buffer.allocUnsafe(16) - buf.writeUInt32BE(out[0], 0) - buf.writeUInt32BE(out[3], 4) - buf.writeUInt32BE(out[2], 8) - buf.writeUInt32BE(out[1], 12) - return buf -} - -AES.prototype.scrub = function () { - scrubVec(this._keySchedule) - scrubVec(this._invKeySchedule) - scrubVec(this._key) -} - -module.exports.AES = AES - -},{"safe-buffer":216}],56:[function(require,module,exports){ -var aes = require('./aes') -var Buffer = require('safe-buffer').Buffer -var Transform = require('cipher-base') -var inherits = require('inherits') -var GHASH = require('./ghash') -var xor = require('buffer-xor') -var incr32 = require('./incr32') - -function xorTest (a, b) { - var out = 0 - if (a.length !== b.length) out++ - - var len = Math.min(a.length, b.length) - for (var i = 0; i < len; ++i) { - out += (a[i] ^ b[i]) - } - - return out -} - -function calcIv (self, iv, ck) { - if (iv.length === 12) { - self._finID = Buffer.concat([iv, Buffer.from([0, 0, 0, 1])]) - return Buffer.concat([iv, Buffer.from([0, 0, 0, 2])]) - } - var ghash = new GHASH(ck) - var len = iv.length - var toPad = len % 16 - ghash.update(iv) - if (toPad) { - toPad = 16 - toPad - ghash.update(Buffer.alloc(toPad, 0)) - } - ghash.update(Buffer.alloc(8, 0)) - var ivBits = len * 8 - var tail = Buffer.alloc(8) - tail.writeUIntBE(ivBits, 0, 8) - ghash.update(tail) - self._finID = ghash.state - var out = Buffer.from(self._finID) - incr32(out) - return out -} -function StreamCipher (mode, key, iv, decrypt) { - Transform.call(this) - - var h = Buffer.alloc(4, 0) - - this._cipher = new aes.AES(key) - var ck = this._cipher.encryptBlock(h) - this._ghash = new GHASH(ck) - iv = calcIv(this, iv, ck) - - this._prev = Buffer.from(iv) - this._cache = Buffer.allocUnsafe(0) - this._secCache = Buffer.allocUnsafe(0) - this._decrypt = decrypt - this._alen = 0 - this._len = 0 - this._mode = mode - - this._authTag = null - this._called = false -} - -inherits(StreamCipher, Transform) - -StreamCipher.prototype._update = function (chunk) { - if (!this._called && this._alen) { - var rump = 16 - (this._alen % 16) - if (rump < 16) { - rump = Buffer.alloc(rump, 0) - this._ghash.update(rump) - } - } - - this._called = true - var out = this._mode.encrypt(this, chunk) - if (this._decrypt) { - this._ghash.update(chunk) - } else { - this._ghash.update(out) - } - this._len += chunk.length - return out -} - -StreamCipher.prototype._final = function () { - if (this._decrypt && !this._authTag) throw new Error('Unsupported state or unable to authenticate data') - - var tag = xor(this._ghash.final(this._alen * 8, this._len * 8), this._cipher.encryptBlock(this._finID)) - if (this._decrypt && xorTest(tag, this._authTag)) throw new Error('Unsupported state or unable to authenticate data') - - this._authTag = tag - this._cipher.scrub() -} - -StreamCipher.prototype.getAuthTag = function getAuthTag () { - if (this._decrypt || !Buffer.isBuffer(this._authTag)) throw new Error('Attempting to get auth tag in unsupported state') - - return this._authTag -} - -StreamCipher.prototype.setAuthTag = function setAuthTag (tag) { - if (!this._decrypt) throw new Error('Attempting to set auth tag in unsupported state') - - this._authTag = tag -} - -StreamCipher.prototype.setAAD = function setAAD (buf) { - if (this._called) throw new Error('Attempting to set AAD in unsupported state') - - this._ghash.update(buf) - this._alen += buf.length -} - -module.exports = StreamCipher - -},{"./aes":55,"./ghash":60,"./incr32":61,"buffer-xor":88,"cipher-base":91,"inherits":156,"safe-buffer":216}],57:[function(require,module,exports){ -var ciphers = require('./encrypter') -var deciphers = require('./decrypter') -var modes = require('./modes/list.json') - -function getCiphers () { - return Object.keys(modes) -} - -exports.createCipher = exports.Cipher = ciphers.createCipher -exports.createCipheriv = exports.Cipheriv = ciphers.createCipheriv -exports.createDecipher = exports.Decipher = deciphers.createDecipher -exports.createDecipheriv = exports.Decipheriv = deciphers.createDecipheriv -exports.listCiphers = exports.getCiphers = getCiphers - -},{"./decrypter":58,"./encrypter":59,"./modes/list.json":69}],58:[function(require,module,exports){ -var AuthCipher = require('./authCipher') -var Buffer = require('safe-buffer').Buffer -var MODES = require('./modes') -var StreamCipher = require('./streamCipher') -var Transform = require('cipher-base') -var aes = require('./aes') -var ebtk = require('evp_bytestokey') -var inherits = require('inherits') - -function Decipher (mode, key, iv) { - Transform.call(this) - - this._cache = new Splitter() - this._last = void 0 - this._cipher = new aes.AES(key) - this._prev = Buffer.from(iv) - this._mode = mode - this._autopadding = true -} - -inherits(Decipher, Transform) - -Decipher.prototype._update = function (data) { - this._cache.add(data) - var chunk - var thing - var out = [] - while ((chunk = this._cache.get(this._autopadding))) { - thing = this._mode.decrypt(this, chunk) - out.push(thing) - } - return Buffer.concat(out) -} - -Decipher.prototype._final = function () { - var chunk = this._cache.flush() - if (this._autopadding) { - return unpad(this._mode.decrypt(this, chunk)) - } else if (chunk) { - throw new Error('data not multiple of block length') - } -} - -Decipher.prototype.setAutoPadding = function (setTo) { - this._autopadding = !!setTo - return this -} - -function Splitter () { - this.cache = Buffer.allocUnsafe(0) -} - -Splitter.prototype.add = function (data) { - this.cache = Buffer.concat([this.cache, data]) -} - -Splitter.prototype.get = function (autoPadding) { - var out - if (autoPadding) { - if (this.cache.length > 16) { - out = this.cache.slice(0, 16) - this.cache = this.cache.slice(16) - return out - } - } else { - if (this.cache.length >= 16) { - out = this.cache.slice(0, 16) - this.cache = this.cache.slice(16) - return out - } - } - - return null -} - -Splitter.prototype.flush = function () { - if (this.cache.length) return this.cache -} - -function unpad (last) { - var padded = last[15] - if (padded < 1 || padded > 16) { - throw new Error('unable to decrypt data') - } - var i = -1 - while (++i < padded) { - if (last[(i + (16 - padded))] !== padded) { - throw new Error('unable to decrypt data') - } - } - if (padded === 16) return - - return last.slice(0, 16 - padded) -} - -function createDecipheriv (suite, password, iv) { - var config = MODES[suite.toLowerCase()] - if (!config) throw new TypeError('invalid suite type') - - if (typeof iv === 'string') iv = Buffer.from(iv) - if (config.mode !== 'GCM' && iv.length !== config.iv) throw new TypeError('invalid iv length ' + iv.length) - - if (typeof password === 'string') password = Buffer.from(password) - if (password.length !== config.key / 8) throw new TypeError('invalid key length ' + password.length) - - if (config.type === 'stream') { - return new StreamCipher(config.module, password, iv, true) - } else if (config.type === 'auth') { - return new AuthCipher(config.module, password, iv, true) - } - - return new Decipher(config.module, password, iv) -} - -function createDecipher (suite, password) { - var config = MODES[suite.toLowerCase()] - if (!config) throw new TypeError('invalid suite type') - - var keys = ebtk(password, false, config.key, config.iv) - return createDecipheriv(suite, keys.key, keys.iv) -} - -exports.createDecipher = createDecipher -exports.createDecipheriv = createDecipheriv - -},{"./aes":55,"./authCipher":56,"./modes":68,"./streamCipher":71,"cipher-base":91,"evp_bytestokey":131,"inherits":156,"safe-buffer":216}],59:[function(require,module,exports){ -var MODES = require('./modes') -var AuthCipher = require('./authCipher') -var Buffer = require('safe-buffer').Buffer -var StreamCipher = require('./streamCipher') -var Transform = require('cipher-base') -var aes = require('./aes') -var ebtk = require('evp_bytestokey') -var inherits = require('inherits') - -function Cipher (mode, key, iv) { - Transform.call(this) - - this._cache = new Splitter() - this._cipher = new aes.AES(key) - this._prev = Buffer.from(iv) - this._mode = mode - this._autopadding = true -} - -inherits(Cipher, Transform) - -Cipher.prototype._update = function (data) { - this._cache.add(data) - var chunk - var thing - var out = [] - - while ((chunk = this._cache.get())) { - thing = this._mode.encrypt(this, chunk) - out.push(thing) - } - - return Buffer.concat(out) -} - -var PADDING = Buffer.alloc(16, 0x10) - -Cipher.prototype._final = function () { - var chunk = this._cache.flush() - if (this._autopadding) { - chunk = this._mode.encrypt(this, chunk) - this._cipher.scrub() - return chunk - } - - if (!chunk.equals(PADDING)) { - this._cipher.scrub() - throw new Error('data not multiple of block length') - } -} - -Cipher.prototype.setAutoPadding = function (setTo) { - this._autopadding = !!setTo - return this -} - -function Splitter () { - this.cache = Buffer.allocUnsafe(0) -} - -Splitter.prototype.add = function (data) { - this.cache = Buffer.concat([this.cache, data]) -} - -Splitter.prototype.get = function () { - if (this.cache.length > 15) { - var out = this.cache.slice(0, 16) - this.cache = this.cache.slice(16) - return out - } - return null -} - -Splitter.prototype.flush = function () { - var len = 16 - this.cache.length - var padBuff = Buffer.allocUnsafe(len) - - var i = -1 - while (++i < len) { - padBuff.writeUInt8(len, i) - } - - return Buffer.concat([this.cache, padBuff]) -} - -function createCipheriv (suite, password, iv) { - var config = MODES[suite.toLowerCase()] - if (!config) throw new TypeError('invalid suite type') - - if (typeof password === 'string') password = Buffer.from(password) - if (password.length !== config.key / 8) throw new TypeError('invalid key length ' + password.length) - - if (typeof iv === 'string') iv = Buffer.from(iv) - if (config.mode !== 'GCM' && iv.length !== config.iv) throw new TypeError('invalid iv length ' + iv.length) - - if (config.type === 'stream') { - return new StreamCipher(config.module, password, iv) - } else if (config.type === 'auth') { - return new AuthCipher(config.module, password, iv) - } - - return new Cipher(config.module, password, iv) -} - -function createCipher (suite, password) { - var config = MODES[suite.toLowerCase()] - if (!config) throw new TypeError('invalid suite type') - - var keys = ebtk(password, false, config.key, config.iv) - return createCipheriv(suite, keys.key, keys.iv) -} - -exports.createCipheriv = createCipheriv -exports.createCipher = createCipher - -},{"./aes":55,"./authCipher":56,"./modes":68,"./streamCipher":71,"cipher-base":91,"evp_bytestokey":131,"inherits":156,"safe-buffer":216}],60:[function(require,module,exports){ -var Buffer = require('safe-buffer').Buffer -var ZEROES = Buffer.alloc(16, 0) - -function toArray (buf) { - return [ - buf.readUInt32BE(0), - buf.readUInt32BE(4), - buf.readUInt32BE(8), - buf.readUInt32BE(12) - ] -} - -function fromArray (out) { - var buf = Buffer.allocUnsafe(16) - buf.writeUInt32BE(out[0] >>> 0, 0) - buf.writeUInt32BE(out[1] >>> 0, 4) - buf.writeUInt32BE(out[2] >>> 0, 8) - buf.writeUInt32BE(out[3] >>> 0, 12) - return buf -} - -function GHASH (key) { - this.h = key - this.state = Buffer.alloc(16, 0) - this.cache = Buffer.allocUnsafe(0) -} - -// from http://bitwiseshiftleft.github.io/sjcl/doc/symbols/src/core_gcm.js.html -// by Juho Vรคhรค-Herttua -GHASH.prototype.ghash = function (block) { - var i = -1 - while (++i < block.length) { - this.state[i] ^= block[i] - } - this._multiply() -} - -GHASH.prototype._multiply = function () { - var Vi = toArray(this.h) - var Zi = [0, 0, 0, 0] - var j, xi, lsbVi - var i = -1 - while (++i < 128) { - xi = (this.state[~~(i / 8)] & (1 << (7 - (i % 8)))) !== 0 - if (xi) { - // Z_i+1 = Z_i ^ V_i - Zi[0] ^= Vi[0] - Zi[1] ^= Vi[1] - Zi[2] ^= Vi[2] - Zi[3] ^= Vi[3] - } - - // Store the value of LSB(V_i) - lsbVi = (Vi[3] & 1) !== 0 - - // V_i+1 = V_i >> 1 - for (j = 3; j > 0; j--) { - Vi[j] = (Vi[j] >>> 1) | ((Vi[j - 1] & 1) << 31) - } - Vi[0] = Vi[0] >>> 1 - - // If LSB(V_i) is 1, V_i+1 = (V_i >> 1) ^ R - if (lsbVi) { - Vi[0] = Vi[0] ^ (0xe1 << 24) - } - } - this.state = fromArray(Zi) -} - -GHASH.prototype.update = function (buf) { - this.cache = Buffer.concat([this.cache, buf]) - var chunk - while (this.cache.length >= 16) { - chunk = this.cache.slice(0, 16) - this.cache = this.cache.slice(16) - this.ghash(chunk) - } -} - -GHASH.prototype.final = function (abl, bl) { - if (this.cache.length) { - this.ghash(Buffer.concat([this.cache, ZEROES], 16)) - } - - this.ghash(fromArray([0, abl, 0, bl])) - return this.state -} - -module.exports = GHASH - -},{"safe-buffer":216}],61:[function(require,module,exports){ -function incr32 (iv) { - var len = iv.length - var item - while (len--) { - item = iv.readUInt8(len) - if (item === 255) { - iv.writeUInt8(0, len) - } else { - item++ - iv.writeUInt8(item, len) - break - } - } -} -module.exports = incr32 - -},{}],62:[function(require,module,exports){ -var xor = require('buffer-xor') - -exports.encrypt = function (self, block) { - var data = xor(block, self._prev) - - self._prev = self._cipher.encryptBlock(data) - return self._prev -} - -exports.decrypt = function (self, block) { - var pad = self._prev - - self._prev = block - var out = self._cipher.decryptBlock(block) - - return xor(out, pad) -} - -},{"buffer-xor":88}],63:[function(require,module,exports){ -var Buffer = require('safe-buffer').Buffer -var xor = require('buffer-xor') - -function encryptStart (self, data, decrypt) { - var len = data.length - var out = xor(data, self._cache) - self._cache = self._cache.slice(len) - self._prev = Buffer.concat([self._prev, decrypt ? data : out]) - return out -} - -exports.encrypt = function (self, data, decrypt) { - var out = Buffer.allocUnsafe(0) - var len - - while (data.length) { - if (self._cache.length === 0) { - self._cache = self._cipher.encryptBlock(self._prev) - self._prev = Buffer.allocUnsafe(0) - } - - if (self._cache.length <= data.length) { - len = self._cache.length - out = Buffer.concat([out, encryptStart(self, data.slice(0, len), decrypt)]) - data = data.slice(len) - } else { - out = Buffer.concat([out, encryptStart(self, data, decrypt)]) - break - } - } - - return out -} - -},{"buffer-xor":88,"safe-buffer":216}],64:[function(require,module,exports){ -var Buffer = require('safe-buffer').Buffer - -function encryptByte (self, byteParam, decrypt) { - var pad - var i = -1 - var len = 8 - var out = 0 - var bit, value - while (++i < len) { - pad = self._cipher.encryptBlock(self._prev) - bit = (byteParam & (1 << (7 - i))) ? 0x80 : 0 - value = pad[0] ^ bit - out += ((value & 0x80) >> (i % 8)) - self._prev = shiftIn(self._prev, decrypt ? bit : value) - } - return out -} - -function shiftIn (buffer, value) { - var len = buffer.length - var i = -1 - var out = Buffer.allocUnsafe(buffer.length) - buffer = Buffer.concat([buffer, Buffer.from([value])]) - - while (++i < len) { - out[i] = buffer[i] << 1 | buffer[i + 1] >> (7) - } - - return out -} - -exports.encrypt = function (self, chunk, decrypt) { - var len = chunk.length - var out = Buffer.allocUnsafe(len) - var i = -1 - - while (++i < len) { - out[i] = encryptByte(self, chunk[i], decrypt) - } - - return out -} - -},{"safe-buffer":216}],65:[function(require,module,exports){ -var Buffer = require('safe-buffer').Buffer - -function encryptByte (self, byteParam, decrypt) { - var pad = self._cipher.encryptBlock(self._prev) - var out = pad[0] ^ byteParam - - self._prev = Buffer.concat([ - self._prev.slice(1), - Buffer.from([decrypt ? byteParam : out]) - ]) - - return out -} - -exports.encrypt = function (self, chunk, decrypt) { - var len = chunk.length - var out = Buffer.allocUnsafe(len) - var i = -1 - - while (++i < len) { - out[i] = encryptByte(self, chunk[i], decrypt) - } - - return out -} - -},{"safe-buffer":216}],66:[function(require,module,exports){ -var xor = require('buffer-xor') -var Buffer = require('safe-buffer').Buffer -var incr32 = require('../incr32') - -function getBlock (self) { - var out = self._cipher.encryptBlockRaw(self._prev) - incr32(self._prev) - return out -} - -var blockSize = 16 -exports.encrypt = function (self, chunk) { - var chunkNum = Math.ceil(chunk.length / blockSize) - var start = self._cache.length - self._cache = Buffer.concat([ - self._cache, - Buffer.allocUnsafe(chunkNum * blockSize) - ]) - for (var i = 0; i < chunkNum; i++) { - var out = getBlock(self) - var offset = start + i * blockSize - self._cache.writeUInt32BE(out[0], offset + 0) - self._cache.writeUInt32BE(out[1], offset + 4) - self._cache.writeUInt32BE(out[2], offset + 8) - self._cache.writeUInt32BE(out[3], offset + 12) - } - var pad = self._cache.slice(0, chunk.length) - self._cache = self._cache.slice(chunk.length) - return xor(chunk, pad) -} - -},{"../incr32":61,"buffer-xor":88,"safe-buffer":216}],67:[function(require,module,exports){ -exports.encrypt = function (self, block) { - return self._cipher.encryptBlock(block) -} - -exports.decrypt = function (self, block) { - return self._cipher.decryptBlock(block) -} - -},{}],68:[function(require,module,exports){ -var modeModules = { - ECB: require('./ecb'), - CBC: require('./cbc'), - CFB: require('./cfb'), - CFB8: require('./cfb8'), - CFB1: require('./cfb1'), - OFB: require('./ofb'), - CTR: require('./ctr'), - GCM: require('./ctr') -} - -var modes = require('./list.json') - -for (var key in modes) { - modes[key].module = modeModules[modes[key].mode] -} - -module.exports = modes - -},{"./cbc":62,"./cfb":63,"./cfb1":64,"./cfb8":65,"./ctr":66,"./ecb":67,"./list.json":69,"./ofb":70}],69:[function(require,module,exports){ -module.exports={ - "aes-128-ecb": { - "cipher": "AES", - "key": 128, - "iv": 0, - "mode": "ECB", - "type": "block" - }, - "aes-192-ecb": { - "cipher": "AES", - "key": 192, - "iv": 0, - "mode": "ECB", - "type": "block" - }, - "aes-256-ecb": { - "cipher": "AES", - "key": 256, - "iv": 0, - "mode": "ECB", - "type": "block" - }, - "aes-128-cbc": { - "cipher": "AES", - "key": 128, - "iv": 16, - "mode": "CBC", - "type": "block" - }, - "aes-192-cbc": { - "cipher": "AES", - "key": 192, - "iv": 16, - "mode": "CBC", - "type": "block" - }, - "aes-256-cbc": { - "cipher": "AES", - "key": 256, - "iv": 16, - "mode": "CBC", - "type": "block" - }, - "aes128": { - "cipher": "AES", - "key": 128, - "iv": 16, - "mode": "CBC", - "type": "block" - }, - "aes192": { - "cipher": "AES", - "key": 192, - "iv": 16, - "mode": "CBC", - "type": "block" - }, - "aes256": { - "cipher": "AES", - "key": 256, - "iv": 16, - "mode": "CBC", - "type": "block" - }, - "aes-128-cfb": { - "cipher": "AES", - "key": 128, - "iv": 16, - "mode": "CFB", - "type": "stream" - }, - "aes-192-cfb": { - "cipher": "AES", - "key": 192, - "iv": 16, - "mode": "CFB", - "type": "stream" - }, - "aes-256-cfb": { - "cipher": "AES", - "key": 256, - "iv": 16, - "mode": "CFB", - "type": "stream" - }, - "aes-128-cfb8": { - "cipher": "AES", - "key": 128, - "iv": 16, - "mode": "CFB8", - "type": "stream" - }, - "aes-192-cfb8": { - "cipher": "AES", - "key": 192, - "iv": 16, - "mode": "CFB8", - "type": "stream" - }, - "aes-256-cfb8": { - "cipher": "AES", - "key": 256, - "iv": 16, - "mode": "CFB8", - "type": "stream" - }, - "aes-128-cfb1": { - "cipher": "AES", - "key": 128, - "iv": 16, - "mode": "CFB1", - "type": "stream" - }, - "aes-192-cfb1": { - "cipher": "AES", - "key": 192, - "iv": 16, - "mode": "CFB1", - "type": "stream" - }, - "aes-256-cfb1": { - "cipher": "AES", - "key": 256, - "iv": 16, - "mode": "CFB1", - "type": "stream" - }, - "aes-128-ofb": { - "cipher": "AES", - "key": 128, - "iv": 16, - "mode": "OFB", - "type": "stream" - }, - "aes-192-ofb": { - "cipher": "AES", - "key": 192, - "iv": 16, - "mode": "OFB", - "type": "stream" - }, - "aes-256-ofb": { - "cipher": "AES", - "key": 256, - "iv": 16, - "mode": "OFB", - "type": "stream" - }, - "aes-128-ctr": { - "cipher": "AES", - "key": 128, - "iv": 16, - "mode": "CTR", - "type": "stream" - }, - "aes-192-ctr": { - "cipher": "AES", - "key": 192, - "iv": 16, - "mode": "CTR", - "type": "stream" - }, - "aes-256-ctr": { - "cipher": "AES", - "key": 256, - "iv": 16, - "mode": "CTR", - "type": "stream" - }, - "aes-128-gcm": { - "cipher": "AES", - "key": 128, - "iv": 12, - "mode": "GCM", - "type": "auth" - }, - "aes-192-gcm": { - "cipher": "AES", - "key": 192, - "iv": 12, - "mode": "GCM", - "type": "auth" - }, - "aes-256-gcm": { - "cipher": "AES", - "key": 256, - "iv": 12, - "mode": "GCM", - "type": "auth" - } -} - -},{}],70:[function(require,module,exports){ -(function (Buffer){ -var xor = require('buffer-xor') - -function getBlock (self) { - self._prev = self._cipher.encryptBlock(self._prev) - return self._prev -} - -exports.encrypt = function (self, chunk) { - while (self._cache.length < chunk.length) { - self._cache = Buffer.concat([self._cache, getBlock(self)]) - } - - var pad = self._cache.slice(0, chunk.length) - self._cache = self._cache.slice(chunk.length) - return xor(chunk, pad) -} - -}).call(this,require("buffer").Buffer) -},{"buffer":89,"buffer-xor":88}],71:[function(require,module,exports){ -var aes = require('./aes') -var Buffer = require('safe-buffer').Buffer -var Transform = require('cipher-base') -var inherits = require('inherits') - -function StreamCipher (mode, key, iv, decrypt) { - Transform.call(this) - - this._cipher = new aes.AES(key) - this._prev = Buffer.from(iv) - this._cache = Buffer.allocUnsafe(0) - this._secCache = Buffer.allocUnsafe(0) - this._decrypt = decrypt - this._mode = mode -} - -inherits(StreamCipher, Transform) - -StreamCipher.prototype._update = function (chunk) { - return this._mode.encrypt(this, chunk, this._decrypt) -} - -StreamCipher.prototype._final = function () { - this._cipher.scrub() -} - -module.exports = StreamCipher - -},{"./aes":55,"cipher-base":91,"inherits":156,"safe-buffer":216}],72:[function(require,module,exports){ -var DES = require('browserify-des') -var aes = require('browserify-aes/browser') -var aesModes = require('browserify-aes/modes') -var desModes = require('browserify-des/modes') -var ebtk = require('evp_bytestokey') - -function createCipher (suite, password) { - suite = suite.toLowerCase() - - var keyLen, ivLen - if (aesModes[suite]) { - keyLen = aesModes[suite].key - ivLen = aesModes[suite].iv - } else if (desModes[suite]) { - keyLen = desModes[suite].key * 8 - ivLen = desModes[suite].iv - } else { - throw new TypeError('invalid suite type') - } - - var keys = ebtk(password, false, keyLen, ivLen) - return createCipheriv(suite, keys.key, keys.iv) -} - -function createDecipher (suite, password) { - suite = suite.toLowerCase() - - var keyLen, ivLen - if (aesModes[suite]) { - keyLen = aesModes[suite].key - ivLen = aesModes[suite].iv - } else if (desModes[suite]) { - keyLen = desModes[suite].key * 8 - ivLen = desModes[suite].iv - } else { - throw new TypeError('invalid suite type') - } - - var keys = ebtk(password, false, keyLen, ivLen) - return createDecipheriv(suite, keys.key, keys.iv) -} - -function createCipheriv (suite, key, iv) { - suite = suite.toLowerCase() - if (aesModes[suite]) return aes.createCipheriv(suite, key, iv) - if (desModes[suite]) return new DES({ key: key, iv: iv, mode: suite }) - - throw new TypeError('invalid suite type') -} - -function createDecipheriv (suite, key, iv) { - suite = suite.toLowerCase() - if (aesModes[suite]) return aes.createDecipheriv(suite, key, iv) - if (desModes[suite]) return new DES({ key: key, iv: iv, mode: suite, decrypt: true }) - - throw new TypeError('invalid suite type') -} - -function getCiphers () { - return Object.keys(desModes).concat(aes.getCiphers()) -} - -exports.createCipher = exports.Cipher = createCipher -exports.createCipheriv = exports.Cipheriv = createCipheriv -exports.createDecipher = exports.Decipher = createDecipher -exports.createDecipheriv = exports.Decipheriv = createDecipheriv -exports.listCiphers = exports.getCiphers = getCiphers - -},{"browserify-aes/browser":57,"browserify-aes/modes":68,"browserify-des":73,"browserify-des/modes":74,"evp_bytestokey":131}],73:[function(require,module,exports){ -var CipherBase = require('cipher-base') -var des = require('des.js') -var inherits = require('inherits') -var Buffer = require('safe-buffer').Buffer - -var modes = { - 'des-ede3-cbc': des.CBC.instantiate(des.EDE), - 'des-ede3': des.EDE, - 'des-ede-cbc': des.CBC.instantiate(des.EDE), - 'des-ede': des.EDE, - 'des-cbc': des.CBC.instantiate(des.DES), - 'des-ecb': des.DES -} -modes.des = modes['des-cbc'] -modes.des3 = modes['des-ede3-cbc'] -module.exports = DES -inherits(DES, CipherBase) -function DES (opts) { - CipherBase.call(this) - var modeName = opts.mode.toLowerCase() - var mode = modes[modeName] - var type - if (opts.decrypt) { - type = 'decrypt' - } else { - type = 'encrypt' - } - var key = opts.key - if (!Buffer.isBuffer(key)) { - key = Buffer.from(key) - } - if (modeName === 'des-ede' || modeName === 'des-ede-cbc') { - key = Buffer.concat([key, key.slice(0, 8)]) - } - var iv = opts.iv - if (!Buffer.isBuffer(iv)) { - iv = Buffer.from(iv) - } - this._des = mode.create({ - key: key, - iv: iv, - type: type - }) -} -DES.prototype._update = function (data) { - return Buffer.from(this._des.update(data)) -} -DES.prototype._final = function () { - return Buffer.from(this._des.final()) -} - -},{"cipher-base":91,"des.js":101,"inherits":156,"safe-buffer":216}],74:[function(require,module,exports){ -exports['des-ecb'] = { - key: 8, - iv: 0 -} -exports['des-cbc'] = exports.des = { - key: 8, - iv: 8 -} -exports['des-ede3-cbc'] = exports.des3 = { - key: 24, - iv: 8 -} -exports['des-ede3'] = { - key: 24, - iv: 0 -} -exports['des-ede-cbc'] = { - key: 16, - iv: 8 -} -exports['des-ede'] = { - key: 16, - iv: 0 -} - -},{}],75:[function(require,module,exports){ -(function (Buffer){ -var bn = require('bn.js'); -var randomBytes = require('randombytes'); -module.exports = crt; -function blind(priv) { - var r = getr(priv); - var blinder = r.toRed(bn.mont(priv.modulus)) - .redPow(new bn(priv.publicExponent)).fromRed(); - return { - blinder: blinder, - unblinder:r.invm(priv.modulus) - }; -} -function crt(msg, priv) { - var blinds = blind(priv); - var len = priv.modulus.byteLength(); - var mod = bn.mont(priv.modulus); - var blinded = new bn(msg).mul(blinds.blinder).umod(priv.modulus); - var c1 = blinded.toRed(bn.mont(priv.prime1)); - var c2 = blinded.toRed(bn.mont(priv.prime2)); - var qinv = priv.coefficient; - var p = priv.prime1; - var q = priv.prime2; - var m1 = c1.redPow(priv.exponent1); - var m2 = c2.redPow(priv.exponent2); - m1 = m1.fromRed(); - m2 = m2.fromRed(); - var h = m1.isub(m2).imul(qinv).umod(p); - h.imul(q); - m2.iadd(h); - return new Buffer(m2.imul(blinds.unblinder).umod(priv.modulus).toArray(false, len)); -} -crt.getr = getr; -function getr(priv) { - var len = priv.modulus.byteLength(); - var r = new bn(randomBytes(len)); - while (r.cmp(priv.modulus) >= 0 || !r.umod(priv.prime1) || !r.umod(priv.prime2)) { - r = new bn(randomBytes(len)); - } - return r; -} - -}).call(this,require("buffer").Buffer) -},{"bn.js":52,"buffer":89,"randombytes":208}],76:[function(require,module,exports){ -module.exports = require('./browser/algorithms.json') - -},{"./browser/algorithms.json":77}],77:[function(require,module,exports){ -module.exports={ - "sha224WithRSAEncryption": { - "sign": "rsa", - "hash": "sha224", - "id": "302d300d06096086480165030402040500041c" - }, - "RSA-SHA224": { - "sign": "ecdsa/rsa", - "hash": "sha224", - "id": "302d300d06096086480165030402040500041c" - }, - "sha256WithRSAEncryption": { - "sign": "rsa", - "hash": "sha256", - "id": "3031300d060960864801650304020105000420" - }, - "RSA-SHA256": { - "sign": "ecdsa/rsa", - "hash": "sha256", - "id": "3031300d060960864801650304020105000420" - }, - "sha384WithRSAEncryption": { - "sign": "rsa", - "hash": "sha384", - "id": "3041300d060960864801650304020205000430" - }, - "RSA-SHA384": { - "sign": "ecdsa/rsa", - "hash": "sha384", - "id": "3041300d060960864801650304020205000430" - }, - "sha512WithRSAEncryption": { - "sign": "rsa", - "hash": "sha512", - "id": "3051300d060960864801650304020305000440" - }, - "RSA-SHA512": { - "sign": "ecdsa/rsa", - "hash": "sha512", - "id": "3051300d060960864801650304020305000440" - }, - "RSA-SHA1": { - "sign": "rsa", - "hash": "sha1", - "id": "3021300906052b0e03021a05000414" - }, - "ecdsa-with-SHA1": { - "sign": "ecdsa", - "hash": "sha1", - "id": "" - }, - "sha256": { - "sign": "ecdsa", - "hash": "sha256", - "id": "" - }, - "sha224": { - "sign": "ecdsa", - "hash": "sha224", - "id": "" - }, - "sha384": { - "sign": "ecdsa", - "hash": "sha384", - "id": "" - }, - "sha512": { - "sign": "ecdsa", - "hash": "sha512", - "id": "" - }, - "DSA-SHA": { - "sign": "dsa", - "hash": "sha1", - "id": "" - }, - "DSA-SHA1": { - "sign": "dsa", - "hash": "sha1", - "id": "" - }, - "DSA": { - "sign": "dsa", - "hash": "sha1", - "id": "" - }, - "DSA-WITH-SHA224": { - "sign": "dsa", - "hash": "sha224", - "id": "" - }, - "DSA-SHA224": { - "sign": "dsa", - "hash": "sha224", - "id": "" - }, - "DSA-WITH-SHA256": { - "sign": "dsa", - "hash": "sha256", - "id": "" - }, - "DSA-SHA256": { - "sign": "dsa", - "hash": "sha256", - "id": "" - }, - "DSA-WITH-SHA384": { - "sign": "dsa", - "hash": "sha384", - "id": "" - }, - "DSA-SHA384": { - "sign": "dsa", - "hash": "sha384", - "id": "" - }, - "DSA-WITH-SHA512": { - "sign": "dsa", - "hash": "sha512", - "id": "" - }, - "DSA-SHA512": { - "sign": "dsa", - "hash": "sha512", - "id": "" - }, - "DSA-RIPEMD160": { - "sign": "dsa", - "hash": "rmd160", - "id": "" - }, - "ripemd160WithRSA": { - "sign": "rsa", - "hash": "rmd160", - "id": "3021300906052b2403020105000414" - }, - "RSA-RIPEMD160": { - "sign": "rsa", - "hash": "rmd160", - "id": "3021300906052b2403020105000414" - }, - "md5WithRSAEncryption": { - "sign": "rsa", - "hash": "md5", - "id": "3020300c06082a864886f70d020505000410" - }, - "RSA-MD5": { - "sign": "rsa", - "hash": "md5", - "id": "3020300c06082a864886f70d020505000410" - } -} - -},{}],78:[function(require,module,exports){ -module.exports={ - "1.3.132.0.10": "secp256k1", - "1.3.132.0.33": "p224", - "1.2.840.10045.3.1.1": "p192", - "1.2.840.10045.3.1.7": "p256", - "1.3.132.0.34": "p384", - "1.3.132.0.35": "p521" -} - -},{}],79:[function(require,module,exports){ -(function (Buffer){ -var createHash = require('create-hash') -var stream = require('stream') -var inherits = require('inherits') -var sign = require('./sign') -var verify = require('./verify') - -var algorithms = require('./algorithms.json') -Object.keys(algorithms).forEach(function (key) { - algorithms[key].id = new Buffer(algorithms[key].id, 'hex') - algorithms[key.toLowerCase()] = algorithms[key] -}) - -function Sign (algorithm) { - stream.Writable.call(this) - - var data = algorithms[algorithm] - if (!data) throw new Error('Unknown message digest') - - this._hashType = data.hash - this._hash = createHash(data.hash) - this._tag = data.id - this._signType = data.sign -} -inherits(Sign, stream.Writable) - -Sign.prototype._write = function _write (data, _, done) { - this._hash.update(data) - done() -} - -Sign.prototype.update = function update (data, enc) { - if (typeof data === 'string') data = new Buffer(data, enc) - - this._hash.update(data) - return this -} - -Sign.prototype.sign = function signMethod (key, enc) { - this.end() - var hash = this._hash.digest() - var sig = sign(hash, key, this._hashType, this._signType, this._tag) - - return enc ? sig.toString(enc) : sig -} - -function Verify (algorithm) { - stream.Writable.call(this) - - var data = algorithms[algorithm] - if (!data) throw new Error('Unknown message digest') - - this._hash = createHash(data.hash) - this._tag = data.id - this._signType = data.sign -} -inherits(Verify, stream.Writable) - -Verify.prototype._write = function _write (data, _, done) { - this._hash.update(data) - done() -} - -Verify.prototype.update = function update (data, enc) { - if (typeof data === 'string') data = new Buffer(data, enc) - - this._hash.update(data) - return this -} - -Verify.prototype.verify = function verifyMethod (key, sig, enc) { - if (typeof sig === 'string') sig = new Buffer(sig, enc) - - this.end() - var hash = this._hash.digest() - return verify(sig, hash, key, this._signType, this._tag) -} - -function createSign (algorithm) { - return new Sign(algorithm) -} - -function createVerify (algorithm) { - return new Verify(algorithm) -} - -module.exports = { - Sign: createSign, - Verify: createVerify, - createSign: createSign, - createVerify: createVerify -} - -}).call(this,require("buffer").Buffer) -},{"./algorithms.json":77,"./sign":80,"./verify":81,"buffer":89,"create-hash":94,"inherits":156,"stream":225}],80:[function(require,module,exports){ -(function (Buffer){ -// much of this based on https://github.com/indutny/self-signed/blob/gh-pages/lib/rsa.js -var createHmac = require('create-hmac') -var crt = require('browserify-rsa') -var EC = require('elliptic').ec -var BN = require('bn.js') -var parseKeys = require('parse-asn1') -var curves = require('./curves.json') - -function sign (hash, key, hashType, signType, tag) { - var priv = parseKeys(key) - if (priv.curve) { - // rsa keys can be interpreted as ecdsa ones in openssl - if (signType !== 'ecdsa' && signType !== 'ecdsa/rsa') throw new Error('wrong private key type') - return ecSign(hash, priv) - } else if (priv.type === 'dsa') { - if (signType !== 'dsa') throw new Error('wrong private key type') - return dsaSign(hash, priv, hashType) - } else { - if (signType !== 'rsa' && signType !== 'ecdsa/rsa') throw new Error('wrong private key type') - } - hash = Buffer.concat([tag, hash]) - var len = priv.modulus.byteLength() - var pad = [ 0, 1 ] - while (hash.length + pad.length + 1 < len) pad.push(0xff) - pad.push(0x00) - var i = -1 - while (++i < hash.length) pad.push(hash[i]) - - var out = crt(pad, priv) - return out -} - -function ecSign (hash, priv) { - var curveId = curves[priv.curve.join('.')] - if (!curveId) throw new Error('unknown curve ' + priv.curve.join('.')) - - var curve = new EC(curveId) - var key = curve.keyFromPrivate(priv.privateKey) - var out = key.sign(hash) - - return new Buffer(out.toDER()) -} - -function dsaSign (hash, priv, algo) { - var x = priv.params.priv_key - var p = priv.params.p - var q = priv.params.q - var g = priv.params.g - var r = new BN(0) - var k - var H = bits2int(hash, q).mod(q) - var s = false - var kv = getKey(x, q, hash, algo) - while (s === false) { - k = makeKey(q, kv, algo) - r = makeR(g, k, p, q) - s = k.invm(q).imul(H.add(x.mul(r))).mod(q) - if (s.cmpn(0) === 0) { - s = false - r = new BN(0) - } - } - return toDER(r, s) -} - -function toDER (r, s) { - r = r.toArray() - s = s.toArray() - - // Pad values - if (r[0] & 0x80) r = [ 0 ].concat(r) - if (s[0] & 0x80) s = [ 0 ].concat(s) - - var total = r.length + s.length + 4 - var res = [ 0x30, total, 0x02, r.length ] - res = res.concat(r, [ 0x02, s.length ], s) - return new Buffer(res) -} - -function getKey (x, q, hash, algo) { - x = new Buffer(x.toArray()) - if (x.length < q.byteLength()) { - var zeros = new Buffer(q.byteLength() - x.length) - zeros.fill(0) - x = Buffer.concat([ zeros, x ]) - } - var hlen = hash.length - var hbits = bits2octets(hash, q) - var v = new Buffer(hlen) - v.fill(1) - var k = new Buffer(hlen) - k.fill(0) - k = createHmac(algo, k).update(v).update(new Buffer([ 0 ])).update(x).update(hbits).digest() - v = createHmac(algo, k).update(v).digest() - k = createHmac(algo, k).update(v).update(new Buffer([ 1 ])).update(x).update(hbits).digest() - v = createHmac(algo, k).update(v).digest() - return { k: k, v: v } -} - -function bits2int (obits, q) { - var bits = new BN(obits) - var shift = (obits.length << 3) - q.bitLength() - if (shift > 0) bits.ishrn(shift) - return bits -} - -function bits2octets (bits, q) { - bits = bits2int(bits, q) - bits = bits.mod(q) - var out = new Buffer(bits.toArray()) - if (out.length < q.byteLength()) { - var zeros = new Buffer(q.byteLength() - out.length) - zeros.fill(0) - out = Buffer.concat([ zeros, out ]) - } - return out -} - -function makeKey (q, kv, algo) { - var t - var k - - do { - t = new Buffer(0) - - while (t.length * 8 < q.bitLength()) { - kv.v = createHmac(algo, kv.k).update(kv.v).digest() - t = Buffer.concat([ t, kv.v ]) - } - - k = bits2int(t, q) - kv.k = createHmac(algo, kv.k).update(kv.v).update(new Buffer([ 0 ])).digest() - kv.v = createHmac(algo, kv.k).update(kv.v).digest() - } while (k.cmp(q) !== -1) - - return k -} - -function makeR (g, k, p, q) { - return g.toRed(BN.mont(p)).redPow(k).fromRed().mod(q) -} - -module.exports = sign -module.exports.getKey = getKey -module.exports.makeKey = makeKey - -}).call(this,require("buffer").Buffer) -},{"./curves.json":78,"bn.js":52,"browserify-rsa":75,"buffer":89,"create-hmac":96,"elliptic":111,"parse-asn1":189}],81:[function(require,module,exports){ -(function (Buffer){ -// much of this based on https://github.com/indutny/self-signed/blob/gh-pages/lib/rsa.js -var BN = require('bn.js') -var EC = require('elliptic').ec -var parseKeys = require('parse-asn1') -var curves = require('./curves.json') - -function verify (sig, hash, key, signType, tag) { - var pub = parseKeys(key) - if (pub.type === 'ec') { - // rsa keys can be interpreted as ecdsa ones in openssl - if (signType !== 'ecdsa' && signType !== 'ecdsa/rsa') throw new Error('wrong public key type') - return ecVerify(sig, hash, pub) - } else if (pub.type === 'dsa') { - if (signType !== 'dsa') throw new Error('wrong public key type') - return dsaVerify(sig, hash, pub) - } else { - if (signType !== 'rsa' && signType !== 'ecdsa/rsa') throw new Error('wrong public key type') - } - hash = Buffer.concat([tag, hash]) - var len = pub.modulus.byteLength() - var pad = [ 1 ] - var padNum = 0 - while (hash.length + pad.length + 2 < len) { - pad.push(0xff) - padNum++ - } - pad.push(0x00) - var i = -1 - while (++i < hash.length) { - pad.push(hash[i]) - } - pad = new Buffer(pad) - var red = BN.mont(pub.modulus) - sig = new BN(sig).toRed(red) - - sig = sig.redPow(new BN(pub.publicExponent)) - sig = new Buffer(sig.fromRed().toArray()) - var out = padNum < 8 ? 1 : 0 - len = Math.min(sig.length, pad.length) - if (sig.length !== pad.length) out = 1 - - i = -1 - while (++i < len) out |= sig[i] ^ pad[i] - return out === 0 -} - -function ecVerify (sig, hash, pub) { - var curveId = curves[pub.data.algorithm.curve.join('.')] - if (!curveId) throw new Error('unknown curve ' + pub.data.algorithm.curve.join('.')) - - var curve = new EC(curveId) - var pubkey = pub.data.subjectPrivateKey.data - - return curve.verify(hash, sig, pubkey) -} - -function dsaVerify (sig, hash, pub) { - var p = pub.data.p - var q = pub.data.q - var g = pub.data.g - var y = pub.data.pub_key - var unpacked = parseKeys.signature.decode(sig, 'der') - var s = unpacked.s - var r = unpacked.r - checkValue(s, q) - checkValue(r, q) - var montp = BN.mont(p) - var w = s.invm(q) - var v = g.toRed(montp) - .redPow(new BN(hash).mul(w).mod(q)) - .fromRed() - .mul(y.toRed(montp).redPow(r.mul(w).mod(q)).fromRed()) - .mod(p) - .mod(q) - return v.cmp(r) === 0 -} - -function checkValue (b, q) { - if (b.cmpn(0) <= 0) throw new Error('invalid sig') - if (b.cmp(q) >= q) throw new Error('invalid sig') -} - -module.exports = verify - -}).call(this,require("buffer").Buffer) -},{"./curves.json":78,"bn.js":52,"buffer":89,"elliptic":111,"parse-asn1":189}],82:[function(require,module,exports){ -arguments[4][54][0].apply(exports,arguments) -},{"dup":54}],83:[function(require,module,exports){ -// Copyright Joyent, Inc. and other Node contributors. -// -// Permission is hereby granted, free of charge, to any person obtaining a -// copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to permit -// persons to whom the Software is furnished to do so, subject to the -// following conditions: -// -// The above copyright notice and this permission notice shall be included -// in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN -// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR -// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE -// USE OR OTHER DEALINGS IN THE SOFTWARE. - -'use strict'; - -/**/ - -var Buffer = require('safe-buffer').Buffer; -/**/ - -var isEncoding = Buffer.isEncoding || function (encoding) { - encoding = '' + encoding; - switch (encoding && encoding.toLowerCase()) { - case 'hex':case 'utf8':case 'utf-8':case 'ascii':case 'binary':case 'base64':case 'ucs2':case 'ucs-2':case 'utf16le':case 'utf-16le':case 'raw': - return true; - default: - return false; - } -}; - -function _normalizeEncoding(enc) { - if (!enc) return 'utf8'; - var retried; - while (true) { - switch (enc) { - case 'utf8': - case 'utf-8': - return 'utf8'; - case 'ucs2': - case 'ucs-2': - case 'utf16le': - case 'utf-16le': - return 'utf16le'; - case 'latin1': - case 'binary': - return 'latin1'; - case 'base64': - case 'ascii': - case 'hex': - return enc; - default: - if (retried) return; // undefined - enc = ('' + enc).toLowerCase(); - retried = true; - } - } -}; - -// Do not cache `Buffer.isEncoding` when checking encoding names as some -// modules monkey-patch it to support additional encodings -function normalizeEncoding(enc) { - var nenc = _normalizeEncoding(enc); - if (typeof nenc !== 'string' && (Buffer.isEncoding === isEncoding || !isEncoding(enc))) throw new Error('Unknown encoding: ' + enc); - return nenc || enc; -} - -// StringDecoder provides an interface for efficiently splitting a series of -// buffers into a series of JS strings without breaking apart multi-byte -// characters. -exports.StringDecoder = StringDecoder; -function StringDecoder(encoding) { - this.encoding = normalizeEncoding(encoding); - var nb; - switch (this.encoding) { - case 'utf16le': - this.text = utf16Text; - this.end = utf16End; - nb = 4; - break; - case 'utf8': - this.fillLast = utf8FillLast; - nb = 4; - break; - case 'base64': - this.text = base64Text; - this.end = base64End; - nb = 3; - break; - default: - this.write = simpleWrite; - this.end = simpleEnd; - return; - } - this.lastNeed = 0; - this.lastTotal = 0; - this.lastChar = Buffer.allocUnsafe(nb); -} - -StringDecoder.prototype.write = function (buf) { - if (buf.length === 0) return ''; - var r; - var i; - if (this.lastNeed) { - r = this.fillLast(buf); - if (r === undefined) return ''; - i = this.lastNeed; - this.lastNeed = 0; - } else { - i = 0; - } - if (i < buf.length) return r ? r + this.text(buf, i) : this.text(buf, i); - return r || ''; -}; - -StringDecoder.prototype.end = utf8End; - -// Returns only complete characters in a Buffer -StringDecoder.prototype.text = utf8Text; - -// Attempts to complete a partial non-UTF-8 character using bytes from a Buffer -StringDecoder.prototype.fillLast = function (buf) { - if (this.lastNeed <= buf.length) { - buf.copy(this.lastChar, this.lastTotal - this.lastNeed, 0, this.lastNeed); - return this.lastChar.toString(this.encoding, 0, this.lastTotal); - } - buf.copy(this.lastChar, this.lastTotal - this.lastNeed, 0, buf.length); - this.lastNeed -= buf.length; -}; - -// Checks the type of a UTF-8 byte, whether it's ASCII, a leading byte, or a -// continuation byte. If an invalid byte is detected, -2 is returned. -function utf8CheckByte(byte) { - if (byte <= 0x7F) return 0;else if (byte >> 5 === 0x06) return 2;else if (byte >> 4 === 0x0E) return 3;else if (byte >> 3 === 0x1E) return 4; - return byte >> 6 === 0x02 ? -1 : -2; -} - -// Checks at most 3 bytes at the end of a Buffer in order to detect an -// incomplete multi-byte UTF-8 character. The total number of bytes (2, 3, or 4) -// needed to complete the UTF-8 character (if applicable) are returned. -function utf8CheckIncomplete(self, buf, i) { - var j = buf.length - 1; - if (j < i) return 0; - var nb = utf8CheckByte(buf[j]); - if (nb >= 0) { - if (nb > 0) self.lastNeed = nb - 1; - return nb; - } - if (--j < i || nb === -2) return 0; - nb = utf8CheckByte(buf[j]); - if (nb >= 0) { - if (nb > 0) self.lastNeed = nb - 2; - return nb; - } - if (--j < i || nb === -2) return 0; - nb = utf8CheckByte(buf[j]); - if (nb >= 0) { - if (nb > 0) { - if (nb === 2) nb = 0;else self.lastNeed = nb - 3; - } - return nb; - } - return 0; -} - -// Validates as many continuation bytes for a multi-byte UTF-8 character as -// needed or are available. If we see a non-continuation byte where we expect -// one, we "replace" the validated continuation bytes we've seen so far with -// a single UTF-8 replacement character ('\ufffd'), to match v8's UTF-8 decoding -// behavior. The continuation byte check is included three times in the case -// where all of the continuation bytes for a character exist in the same buffer. -// It is also done this way as a slight performance increase instead of using a -// loop. -function utf8CheckExtraBytes(self, buf, p) { - if ((buf[0] & 0xC0) !== 0x80) { - self.lastNeed = 0; - return '\ufffd'; - } - if (self.lastNeed > 1 && buf.length > 1) { - if ((buf[1] & 0xC0) !== 0x80) { - self.lastNeed = 1; - return '\ufffd'; - } - if (self.lastNeed > 2 && buf.length > 2) { - if ((buf[2] & 0xC0) !== 0x80) { - self.lastNeed = 2; - return '\ufffd'; - } - } - } -} - -// Attempts to complete a multi-byte UTF-8 character using bytes from a Buffer. -function utf8FillLast(buf) { - var p = this.lastTotal - this.lastNeed; - var r = utf8CheckExtraBytes(this, buf, p); - if (r !== undefined) return r; - if (this.lastNeed <= buf.length) { - buf.copy(this.lastChar, p, 0, this.lastNeed); - return this.lastChar.toString(this.encoding, 0, this.lastTotal); - } - buf.copy(this.lastChar, p, 0, buf.length); - this.lastNeed -= buf.length; -} - -// Returns all complete UTF-8 characters in a Buffer. If the Buffer ended on a -// partial character, the character's bytes are buffered until the required -// number of bytes are available. -function utf8Text(buf, i) { - var total = utf8CheckIncomplete(this, buf, i); - if (!this.lastNeed) return buf.toString('utf8', i); - this.lastTotal = total; - var end = buf.length - (total - this.lastNeed); - buf.copy(this.lastChar, 0, end); - return buf.toString('utf8', i, end); -} - -// For UTF-8, a replacement character is added when ending on a partial -// character. -function utf8End(buf) { - var r = buf && buf.length ? this.write(buf) : ''; - if (this.lastNeed) return r + '\ufffd'; - return r; -} - -// UTF-16LE typically needs two bytes per character, but even if we have an even -// number of bytes available, we need to check if we end on a leading/high -// surrogate. In that case, we need to wait for the next two bytes in order to -// decode the last character properly. -function utf16Text(buf, i) { - if ((buf.length - i) % 2 === 0) { - var r = buf.toString('utf16le', i); - if (r) { - var c = r.charCodeAt(r.length - 1); - if (c >= 0xD800 && c <= 0xDBFF) { - this.lastNeed = 2; - this.lastTotal = 4; - this.lastChar[0] = buf[buf.length - 2]; - this.lastChar[1] = buf[buf.length - 1]; - return r.slice(0, -1); - } - } - return r; - } - this.lastNeed = 1; - this.lastTotal = 2; - this.lastChar[0] = buf[buf.length - 1]; - return buf.toString('utf16le', i, buf.length - 1); -} - -// For UTF-16LE we do not explicitly append special replacement characters if we -// end on a partial character, we simply let v8 handle that. -function utf16End(buf) { - var r = buf && buf.length ? this.write(buf) : ''; - if (this.lastNeed) { - var end = this.lastTotal - this.lastNeed; - return r + this.lastChar.toString('utf16le', 0, end); - } - return r; -} - -function base64Text(buf, i) { - var n = (buf.length - i) % 3; - if (n === 0) return buf.toString('base64', i); - this.lastNeed = 3 - n; - this.lastTotal = 3; - if (n === 1) { - this.lastChar[0] = buf[buf.length - 1]; - } else { - this.lastChar[0] = buf[buf.length - 2]; - this.lastChar[1] = buf[buf.length - 1]; - } - return buf.toString('base64', i, buf.length - n); -} - -function base64End(buf) { - var r = buf && buf.length ? this.write(buf) : ''; - if (this.lastNeed) return r + this.lastChar.toString('base64', 0, 3 - this.lastNeed); - return r; -} - -// Pass bytes on through for single-byte encodings (e.g. ascii, latin1, hex) -function simpleWrite(buf) { - return buf.toString(this.encoding); -} - -function simpleEnd(buf) { - return buf && buf.length ? this.write(buf) : ''; -} -},{"safe-buffer":216}],84:[function(require,module,exports){ -(function (Buffer){ -function allocUnsafe (size) { - if (typeof size !== 'number') { - throw new TypeError('"size" argument must be a number') - } - - if (size < 0) { - throw new RangeError('"size" argument must not be negative') - } - - if (Buffer.allocUnsafe) { - return Buffer.allocUnsafe(size) - } else { - return new Buffer(size) - } -} - -module.exports = allocUnsafe - -}).call(this,require("buffer").Buffer) -},{"buffer":89}],85:[function(require,module,exports){ -(function (Buffer){ -var bufferFill = require('buffer-fill') -var allocUnsafe = require('buffer-alloc-unsafe') - -module.exports = function alloc (size, fill, encoding) { - if (typeof size !== 'number') { - throw new TypeError('"size" argument must be a number') - } - - if (size < 0) { - throw new RangeError('"size" argument must not be negative') - } - - if (Buffer.alloc) { - return Buffer.alloc(size, fill, encoding) - } - - var buffer = allocUnsafe(size) - - if (size === 0) { - return buffer - } - - if (fill === undefined) { - return bufferFill(buffer, 0) - } - - if (typeof encoding !== 'string') { - encoding = undefined - } - - return bufferFill(buffer, fill, encoding) -} - -}).call(this,require("buffer").Buffer) -},{"buffer":89,"buffer-alloc-unsafe":84,"buffer-fill":86}],86:[function(require,module,exports){ -(function (Buffer){ -/* Node.js 6.4.0 and up has full support */ -var hasFullSupport = (function () { - try { - if (!Buffer.isEncoding('latin1')) { - return false - } - - var buf = Buffer.alloc ? Buffer.alloc(4) : new Buffer(4) - - buf.fill('ab', 'ucs2') - - return (buf.toString('hex') === '61006200') - } catch (_) { - return false - } -}()) - -function isSingleByte (val) { - return (val.length === 1 && val.charCodeAt(0) < 256) -} - -function fillWithNumber (buffer, val, start, end) { - if (start < 0 || end > buffer.length) { - throw new RangeError('Out of range index') - } - - start = start >>> 0 - end = end === undefined ? buffer.length : end >>> 0 - - if (end > start) { - buffer.fill(val, start, end) - } - - return buffer -} - -function fillWithBuffer (buffer, val, start, end) { - if (start < 0 || end > buffer.length) { - throw new RangeError('Out of range index') - } - - if (end <= start) { - return buffer - } - - start = start >>> 0 - end = end === undefined ? buffer.length : end >>> 0 - - var pos = start - var len = val.length - while (pos <= (end - len)) { - val.copy(buffer, pos) - pos += len - } - - if (pos !== end) { - val.copy(buffer, pos, 0, end - pos) - } - - return buffer -} - -function fill (buffer, val, start, end, encoding) { - if (hasFullSupport) { - return buffer.fill(val, start, end, encoding) - } - - if (typeof val === 'number') { - return fillWithNumber(buffer, val, start, end) - } - - if (typeof val === 'string') { - if (typeof start === 'string') { - encoding = start - start = 0 - end = buffer.length - } else if (typeof end === 'string') { - encoding = end - end = buffer.length - } - - if (encoding !== undefined && typeof encoding !== 'string') { - throw new TypeError('encoding must be a string') - } - - if (encoding === 'latin1') { - encoding = 'binary' - } - - if (typeof encoding === 'string' && !Buffer.isEncoding(encoding)) { - throw new TypeError('Unknown encoding: ' + encoding) - } - - if (val === '') { - return fillWithNumber(buffer, 0, start, end) - } - - if (isSingleByte(val)) { - return fillWithNumber(buffer, val.charCodeAt(0), start, end) - } - - val = new Buffer(val, encoding) - } - - if (Buffer.isBuffer(val)) { - return fillWithBuffer(buffer, val, start, end) - } - - // Other values (e.g. undefined, boolean, object) results in zero-fill - return fillWithNumber(buffer, 0, start, end) -} - -module.exports = fill - -}).call(this,require("buffer").Buffer) -},{"buffer":89}],87:[function(require,module,exports){ -(function (Buffer){ -var toString = Object.prototype.toString - -var isModern = ( - typeof Buffer.alloc === 'function' && - typeof Buffer.allocUnsafe === 'function' && - typeof Buffer.from === 'function' -) - -function isArrayBuffer (input) { - return toString.call(input).slice(8, -1) === 'ArrayBuffer' -} - -function fromArrayBuffer (obj, byteOffset, length) { - byteOffset >>>= 0 - - var maxLength = obj.byteLength - byteOffset - - if (maxLength < 0) { - throw new RangeError("'offset' is out of bounds") - } - - if (length === undefined) { - length = maxLength - } else { - length >>>= 0 - - if (length > maxLength) { - throw new RangeError("'length' is out of bounds") - } - } - - return isModern - ? Buffer.from(obj.slice(byteOffset, byteOffset + length)) - : new Buffer(new Uint8Array(obj.slice(byteOffset, byteOffset + length))) -} - -function fromString (string, encoding) { - if (typeof encoding !== 'string' || encoding === '') { - encoding = 'utf8' - } - - if (!Buffer.isEncoding(encoding)) { - throw new TypeError('"encoding" must be a valid string encoding') - } - - return isModern - ? Buffer.from(string, encoding) - : new Buffer(string, encoding) -} - -function bufferFrom (value, encodingOrOffset, length) { - if (typeof value === 'number') { - throw new TypeError('"value" argument must not be a number') - } - - if (isArrayBuffer(value)) { - return fromArrayBuffer(value, encodingOrOffset, length) - } - - if (typeof value === 'string') { - return fromString(value, encodingOrOffset) - } - - return isModern - ? Buffer.from(value) - : new Buffer(value) -} - -module.exports = bufferFrom - -}).call(this,require("buffer").Buffer) -},{"buffer":89}],88:[function(require,module,exports){ -(function (Buffer){ -module.exports = function xor (a, b) { - var length = Math.min(a.length, b.length) - var buffer = new Buffer(length) - - for (var i = 0; i < length; ++i) { - buffer[i] = a[i] ^ b[i] - } - - return buffer -} - -}).call(this,require("buffer").Buffer) -},{"buffer":89}],89:[function(require,module,exports){ -(function (Buffer){ -/*! - * The buffer module from node.js, for the browser. - * - * @author Feross Aboukhadijeh - * @license MIT - */ -/* eslint-disable no-proto */ - -'use strict' - -var base64 = require('base64-js') -var ieee754 = require('ieee754') - -exports.Buffer = Buffer -exports.SlowBuffer = SlowBuffer -exports.INSPECT_MAX_BYTES = 50 - -var K_MAX_LENGTH = 0x7fffffff -exports.kMaxLength = K_MAX_LENGTH - -/** - * If `Buffer.TYPED_ARRAY_SUPPORT`: - * === true Use Uint8Array implementation (fastest) - * === false Print warning and recommend using `buffer` v4.x which has an Object - * implementation (most compatible, even IE6) - * - * Browsers that support typed arrays are IE 10+, Firefox 4+, Chrome 7+, Safari 5.1+, - * Opera 11.6+, iOS 4.2+. - * - * We report that the browser does not support typed arrays if the are not subclassable - * using __proto__. Firefox 4-29 lacks support for adding new properties to `Uint8Array` - * (See: https://bugzilla.mozilla.org/show_bug.cgi?id=695438). IE 10 lacks support - * for __proto__ and has a buggy typed array implementation. - */ -Buffer.TYPED_ARRAY_SUPPORT = typedArraySupport() - -if (!Buffer.TYPED_ARRAY_SUPPORT && typeof console !== 'undefined' && - typeof console.error === 'function') { - console.error( - 'This browser lacks typed array (Uint8Array) support which is required by ' + - '`buffer` v5.x. Use `buffer` v4.x if you require old browser support.' - ) -} - -function typedArraySupport () { - // Can typed array instances can be augmented? - try { - var arr = new Uint8Array(1) - arr.__proto__ = { __proto__: Uint8Array.prototype, foo: function () { return 42 } } - return arr.foo() === 42 - } catch (e) { - return false - } -} - -Object.defineProperty(Buffer.prototype, 'parent', { - enumerable: true, - get: function () { - if (!Buffer.isBuffer(this)) return undefined - return this.buffer - } -}) - -Object.defineProperty(Buffer.prototype, 'offset', { - enumerable: true, - get: function () { - if (!Buffer.isBuffer(this)) return undefined - return this.byteOffset - } -}) - -function createBuffer (length) { - if (length > K_MAX_LENGTH) { - throw new RangeError('The value "' + length + '" is invalid for option "size"') - } - // Return an augmented `Uint8Array` instance - var buf = new Uint8Array(length) - buf.__proto__ = Buffer.prototype - return buf -} - -/** - * The Buffer constructor returns instances of `Uint8Array` that have their - * prototype changed to `Buffer.prototype`. Furthermore, `Buffer` is a subclass of - * `Uint8Array`, so the returned instances will have all the node `Buffer` methods - * and the `Uint8Array` methods. Square bracket notation works as expected -- it - * returns a single octet. - * - * The `Uint8Array` prototype remains unmodified. - */ - -function Buffer (arg, encodingOrOffset, length) { - // Common case. - if (typeof arg === 'number') { - if (typeof encodingOrOffset === 'string') { - throw new TypeError( - 'The "string" argument must be of type string. Received type number' - ) - } - return allocUnsafe(arg) - } - return from(arg, encodingOrOffset, length) -} - -// Fix subarray() in ES2016. See: https://github.com/feross/buffer/pull/97 -if (typeof Symbol !== 'undefined' && Symbol.species != null && - Buffer[Symbol.species] === Buffer) { - Object.defineProperty(Buffer, Symbol.species, { - value: null, - configurable: true, - enumerable: false, - writable: false - }) -} - -Buffer.poolSize = 8192 // not used by this implementation - -function from (value, encodingOrOffset, length) { - if (typeof value === 'string') { - return fromString(value, encodingOrOffset) - } - - if (ArrayBuffer.isView(value)) { - return fromArrayLike(value) - } - - if (value == null) { - throw TypeError( - 'The first argument must be one of type string, Buffer, ArrayBuffer, Array, ' + - 'or Array-like Object. Received type ' + (typeof value) - ) - } - - if (isInstance(value, ArrayBuffer) || - (value && isInstance(value.buffer, ArrayBuffer))) { - return fromArrayBuffer(value, encodingOrOffset, length) - } - - if (typeof value === 'number') { - throw new TypeError( - 'The "value" argument must not be of type number. Received type number' - ) - } - - var valueOf = value.valueOf && value.valueOf() - if (valueOf != null && valueOf !== value) { - return Buffer.from(valueOf, encodingOrOffset, length) - } - - var b = fromObject(value) - if (b) return b - - if (typeof Symbol !== 'undefined' && Symbol.toPrimitive != null && - typeof value[Symbol.toPrimitive] === 'function') { - return Buffer.from( - value[Symbol.toPrimitive]('string'), encodingOrOffset, length - ) - } - - throw new TypeError( - 'The first argument must be one of type string, Buffer, ArrayBuffer, Array, ' + - 'or Array-like Object. Received type ' + (typeof value) - ) -} - -/** - * Functionally equivalent to Buffer(arg, encoding) but throws a TypeError - * if value is a number. - * Buffer.from(str[, encoding]) - * Buffer.from(array) - * Buffer.from(buffer) - * Buffer.from(arrayBuffer[, byteOffset[, length]]) - **/ -Buffer.from = function (value, encodingOrOffset, length) { - return from(value, encodingOrOffset, length) -} - -// Note: Change prototype *after* Buffer.from is defined to workaround Chrome bug: -// https://github.com/feross/buffer/pull/148 -Buffer.prototype.__proto__ = Uint8Array.prototype -Buffer.__proto__ = Uint8Array - -function assertSize (size) { - if (typeof size !== 'number') { - throw new TypeError('"size" argument must be of type number') - } else if (size < 0) { - throw new RangeError('The value "' + size + '" is invalid for option "size"') - } -} - -function alloc (size, fill, encoding) { - assertSize(size) - if (size <= 0) { - return createBuffer(size) - } - if (fill !== undefined) { - // Only pay attention to encoding if it's a string. This - // prevents accidentally sending in a number that would - // be interpretted as a start offset. - return typeof encoding === 'string' - ? createBuffer(size).fill(fill, encoding) - : createBuffer(size).fill(fill) - } - return createBuffer(size) -} - -/** - * Creates a new filled Buffer instance. - * alloc(size[, fill[, encoding]]) - **/ -Buffer.alloc = function (size, fill, encoding) { - return alloc(size, fill, encoding) -} - -function allocUnsafe (size) { - assertSize(size) - return createBuffer(size < 0 ? 0 : checked(size) | 0) -} - -/** - * Equivalent to Buffer(num), by default creates a non-zero-filled Buffer instance. - * */ -Buffer.allocUnsafe = function (size) { - return allocUnsafe(size) -} -/** - * Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance. - */ -Buffer.allocUnsafeSlow = function (size) { - return allocUnsafe(size) -} - -function fromString (string, encoding) { - if (typeof encoding !== 'string' || encoding === '') { - encoding = 'utf8' - } - - if (!Buffer.isEncoding(encoding)) { - throw new TypeError('Unknown encoding: ' + encoding) - } - - var length = byteLength(string, encoding) | 0 - var buf = createBuffer(length) - - var actual = buf.write(string, encoding) - - if (actual !== length) { - // Writing a hex string, for example, that contains invalid characters will - // cause everything after the first invalid character to be ignored. (e.g. - // 'abxxcd' will be treated as 'ab') - buf = buf.slice(0, actual) - } - - return buf -} - -function fromArrayLike (array) { - var length = array.length < 0 ? 0 : checked(array.length) | 0 - var buf = createBuffer(length) - for (var i = 0; i < length; i += 1) { - buf[i] = array[i] & 255 - } - return buf -} - -function fromArrayBuffer (array, byteOffset, length) { - if (byteOffset < 0 || array.byteLength < byteOffset) { - throw new RangeError('"offset" is outside of buffer bounds') - } - - if (array.byteLength < byteOffset + (length || 0)) { - throw new RangeError('"length" is outside of buffer bounds') - } - - var buf - if (byteOffset === undefined && length === undefined) { - buf = new Uint8Array(array) - } else if (length === undefined) { - buf = new Uint8Array(array, byteOffset) - } else { - buf = new Uint8Array(array, byteOffset, length) - } - - // Return an augmented `Uint8Array` instance - buf.__proto__ = Buffer.prototype - return buf -} - -function fromObject (obj) { - if (Buffer.isBuffer(obj)) { - var len = checked(obj.length) | 0 - var buf = createBuffer(len) - - if (buf.length === 0) { - return buf - } - - obj.copy(buf, 0, 0, len) - return buf - } - - if (obj.length !== undefined) { - if (typeof obj.length !== 'number' || numberIsNaN(obj.length)) { - return createBuffer(0) - } - return fromArrayLike(obj) - } - - if (obj.type === 'Buffer' && Array.isArray(obj.data)) { - return fromArrayLike(obj.data) - } -} - -function checked (length) { - // Note: cannot use `length < K_MAX_LENGTH` here because that fails when - // length is NaN (which is otherwise coerced to zero.) - if (length >= K_MAX_LENGTH) { - throw new RangeError('Attempt to allocate Buffer larger than maximum ' + - 'size: 0x' + K_MAX_LENGTH.toString(16) + ' bytes') - } - return length | 0 -} - -function SlowBuffer (length) { - if (+length != length) { // eslint-disable-line eqeqeq - length = 0 - } - return Buffer.alloc(+length) -} - -Buffer.isBuffer = function isBuffer (b) { - return b != null && b._isBuffer === true && - b !== Buffer.prototype // so Buffer.isBuffer(Buffer.prototype) will be false -} - -Buffer.compare = function compare (a, b) { - if (isInstance(a, Uint8Array)) a = Buffer.from(a, a.offset, a.byteLength) - if (isInstance(b, Uint8Array)) b = Buffer.from(b, b.offset, b.byteLength) - if (!Buffer.isBuffer(a) || !Buffer.isBuffer(b)) { - throw new TypeError( - 'The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array' - ) - } - - if (a === b) return 0 - - var x = a.length - var y = b.length - - for (var i = 0, len = Math.min(x, y); i < len; ++i) { - if (a[i] !== b[i]) { - x = a[i] - y = b[i] - break - } - } - - if (x < y) return -1 - if (y < x) return 1 - return 0 -} - -Buffer.isEncoding = function isEncoding (encoding) { - switch (String(encoding).toLowerCase()) { - case 'hex': - case 'utf8': - case 'utf-8': - case 'ascii': - case 'latin1': - case 'binary': - case 'base64': - case 'ucs2': - case 'ucs-2': - case 'utf16le': - case 'utf-16le': - return true - default: - return false - } -} - -Buffer.concat = function concat (list, length) { - if (!Array.isArray(list)) { - throw new TypeError('"list" argument must be an Array of Buffers') - } - - if (list.length === 0) { - return Buffer.alloc(0) - } - - var i - if (length === undefined) { - length = 0 - for (i = 0; i < list.length; ++i) { - length += list[i].length - } - } - - var buffer = Buffer.allocUnsafe(length) - var pos = 0 - for (i = 0; i < list.length; ++i) { - var buf = list[i] - if (isInstance(buf, Uint8Array)) { - buf = Buffer.from(buf) - } - if (!Buffer.isBuffer(buf)) { - throw new TypeError('"list" argument must be an Array of Buffers') - } - buf.copy(buffer, pos) - pos += buf.length - } - return buffer -} - -function byteLength (string, encoding) { - if (Buffer.isBuffer(string)) { - return string.length - } - if (ArrayBuffer.isView(string) || isInstance(string, ArrayBuffer)) { - return string.byteLength - } - if (typeof string !== 'string') { - throw new TypeError( - 'The "string" argument must be one of type string, Buffer, or ArrayBuffer. ' + - 'Received type ' + typeof string - ) - } - - var len = string.length - var mustMatch = (arguments.length > 2 && arguments[2] === true) - if (!mustMatch && len === 0) return 0 - - // Use a for loop to avoid recursion - var loweredCase = false - for (;;) { - switch (encoding) { - case 'ascii': - case 'latin1': - case 'binary': - return len - case 'utf8': - case 'utf-8': - return utf8ToBytes(string).length - case 'ucs2': - case 'ucs-2': - case 'utf16le': - case 'utf-16le': - return len * 2 - case 'hex': - return len >>> 1 - case 'base64': - return base64ToBytes(string).length - default: - if (loweredCase) { - return mustMatch ? -1 : utf8ToBytes(string).length // assume utf8 - } - encoding = ('' + encoding).toLowerCase() - loweredCase = true - } - } -} -Buffer.byteLength = byteLength - -function slowToString (encoding, start, end) { - var loweredCase = false - - // No need to verify that "this.length <= MAX_UINT32" since it's a read-only - // property of a typed array. - - // This behaves neither like String nor Uint8Array in that we set start/end - // to their upper/lower bounds if the value passed is out of range. - // undefined is handled specially as per ECMA-262 6th Edition, - // Section 13.3.3.7 Runtime Semantics: KeyedBindingInitialization. - if (start === undefined || start < 0) { - start = 0 - } - // Return early if start > this.length. Done here to prevent potential uint32 - // coercion fail below. - if (start > this.length) { - return '' - } - - if (end === undefined || end > this.length) { - end = this.length - } - - if (end <= 0) { - return '' - } - - // Force coersion to uint32. This will also coerce falsey/NaN values to 0. - end >>>= 0 - start >>>= 0 - - if (end <= start) { - return '' - } - - if (!encoding) encoding = 'utf8' - - while (true) { - switch (encoding) { - case 'hex': - return hexSlice(this, start, end) - - case 'utf8': - case 'utf-8': - return utf8Slice(this, start, end) - - case 'ascii': - return asciiSlice(this, start, end) - - case 'latin1': - case 'binary': - return latin1Slice(this, start, end) - - case 'base64': - return base64Slice(this, start, end) - - case 'ucs2': - case 'ucs-2': - case 'utf16le': - case 'utf-16le': - return utf16leSlice(this, start, end) - - default: - if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding) - encoding = (encoding + '').toLowerCase() - loweredCase = true - } - } -} - -// This property is used by `Buffer.isBuffer` (and the `is-buffer` npm package) -// to detect a Buffer instance. It's not possible to use `instanceof Buffer` -// reliably in a browserify context because there could be multiple different -// copies of the 'buffer' package in use. This method works even for Buffer -// instances that were created from another copy of the `buffer` package. -// See: https://github.com/feross/buffer/issues/154 -Buffer.prototype._isBuffer = true - -function swap (b, n, m) { - var i = b[n] - b[n] = b[m] - b[m] = i -} - -Buffer.prototype.swap16 = function swap16 () { - var len = this.length - if (len % 2 !== 0) { - throw new RangeError('Buffer size must be a multiple of 16-bits') - } - for (var i = 0; i < len; i += 2) { - swap(this, i, i + 1) - } - return this -} - -Buffer.prototype.swap32 = function swap32 () { - var len = this.length - if (len % 4 !== 0) { - throw new RangeError('Buffer size must be a multiple of 32-bits') - } - for (var i = 0; i < len; i += 4) { - swap(this, i, i + 3) - swap(this, i + 1, i + 2) - } - return this -} - -Buffer.prototype.swap64 = function swap64 () { - var len = this.length - if (len % 8 !== 0) { - throw new RangeError('Buffer size must be a multiple of 64-bits') - } - for (var i = 0; i < len; i += 8) { - swap(this, i, i + 7) - swap(this, i + 1, i + 6) - swap(this, i + 2, i + 5) - swap(this, i + 3, i + 4) - } - return this -} - -Buffer.prototype.toString = function toString () { - var length = this.length - if (length === 0) return '' - if (arguments.length === 0) return utf8Slice(this, 0, length) - return slowToString.apply(this, arguments) -} - -Buffer.prototype.toLocaleString = Buffer.prototype.toString - -Buffer.prototype.equals = function equals (b) { - if (!Buffer.isBuffer(b)) throw new TypeError('Argument must be a Buffer') - if (this === b) return true - return Buffer.compare(this, b) === 0 -} - -Buffer.prototype.inspect = function inspect () { - var str = '' - var max = exports.INSPECT_MAX_BYTES - str = this.toString('hex', 0, max).replace(/(.{2})/g, '$1 ').trim() - if (this.length > max) str += ' ... ' - return '' -} - -Buffer.prototype.compare = function compare (target, start, end, thisStart, thisEnd) { - if (isInstance(target, Uint8Array)) { - target = Buffer.from(target, target.offset, target.byteLength) - } - if (!Buffer.isBuffer(target)) { - throw new TypeError( - 'The "target" argument must be one of type Buffer or Uint8Array. ' + - 'Received type ' + (typeof target) - ) - } - - if (start === undefined) { - start = 0 - } - if (end === undefined) { - end = target ? target.length : 0 - } - if (thisStart === undefined) { - thisStart = 0 - } - if (thisEnd === undefined) { - thisEnd = this.length - } - - if (start < 0 || end > target.length || thisStart < 0 || thisEnd > this.length) { - throw new RangeError('out of range index') - } - - if (thisStart >= thisEnd && start >= end) { - return 0 - } - if (thisStart >= thisEnd) { - return -1 - } - if (start >= end) { - return 1 - } - - start >>>= 0 - end >>>= 0 - thisStart >>>= 0 - thisEnd >>>= 0 - - if (this === target) return 0 - - var x = thisEnd - thisStart - var y = end - start - var len = Math.min(x, y) - - var thisCopy = this.slice(thisStart, thisEnd) - var targetCopy = target.slice(start, end) - - for (var i = 0; i < len; ++i) { - if (thisCopy[i] !== targetCopy[i]) { - x = thisCopy[i] - y = targetCopy[i] - break - } - } - - if (x < y) return -1 - if (y < x) return 1 - return 0 -} - -// Finds either the first index of `val` in `buffer` at offset >= `byteOffset`, -// OR the last index of `val` in `buffer` at offset <= `byteOffset`. -// -// Arguments: -// - buffer - a Buffer to search -// - val - a string, Buffer, or number -// - byteOffset - an index into `buffer`; will be clamped to an int32 -// - encoding - an optional encoding, relevant is val is a string -// - dir - true for indexOf, false for lastIndexOf -function bidirectionalIndexOf (buffer, val, byteOffset, encoding, dir) { - // Empty buffer means no match - if (buffer.length === 0) return -1 - - // Normalize byteOffset - if (typeof byteOffset === 'string') { - encoding = byteOffset - byteOffset = 0 - } else if (byteOffset > 0x7fffffff) { - byteOffset = 0x7fffffff - } else if (byteOffset < -0x80000000) { - byteOffset = -0x80000000 - } - byteOffset = +byteOffset // Coerce to Number. - if (numberIsNaN(byteOffset)) { - // byteOffset: it it's undefined, null, NaN, "foo", etc, search whole buffer - byteOffset = dir ? 0 : (buffer.length - 1) - } - - // Normalize byteOffset: negative offsets start from the end of the buffer - if (byteOffset < 0) byteOffset = buffer.length + byteOffset - if (byteOffset >= buffer.length) { - if (dir) return -1 - else byteOffset = buffer.length - 1 - } else if (byteOffset < 0) { - if (dir) byteOffset = 0 - else return -1 - } - - // Normalize val - if (typeof val === 'string') { - val = Buffer.from(val, encoding) - } - - // Finally, search either indexOf (if dir is true) or lastIndexOf - if (Buffer.isBuffer(val)) { - // Special case: looking for empty string/buffer always fails - if (val.length === 0) { - return -1 - } - return arrayIndexOf(buffer, val, byteOffset, encoding, dir) - } else if (typeof val === 'number') { - val = val & 0xFF // Search for a byte value [0-255] - if (typeof Uint8Array.prototype.indexOf === 'function') { - if (dir) { - return Uint8Array.prototype.indexOf.call(buffer, val, byteOffset) - } else { - return Uint8Array.prototype.lastIndexOf.call(buffer, val, byteOffset) - } - } - return arrayIndexOf(buffer, [ val ], byteOffset, encoding, dir) - } - - throw new TypeError('val must be string, number or Buffer') -} - -function arrayIndexOf (arr, val, byteOffset, encoding, dir) { - var indexSize = 1 - var arrLength = arr.length - var valLength = val.length - - if (encoding !== undefined) { - encoding = String(encoding).toLowerCase() - if (encoding === 'ucs2' || encoding === 'ucs-2' || - encoding === 'utf16le' || encoding === 'utf-16le') { - if (arr.length < 2 || val.length < 2) { - return -1 - } - indexSize = 2 - arrLength /= 2 - valLength /= 2 - byteOffset /= 2 - } - } - - function read (buf, i) { - if (indexSize === 1) { - return buf[i] - } else { - return buf.readUInt16BE(i * indexSize) - } - } - - var i - if (dir) { - var foundIndex = -1 - for (i = byteOffset; i < arrLength; i++) { - if (read(arr, i) === read(val, foundIndex === -1 ? 0 : i - foundIndex)) { - if (foundIndex === -1) foundIndex = i - if (i - foundIndex + 1 === valLength) return foundIndex * indexSize - } else { - if (foundIndex !== -1) i -= i - foundIndex - foundIndex = -1 - } - } - } else { - if (byteOffset + valLength > arrLength) byteOffset = arrLength - valLength - for (i = byteOffset; i >= 0; i--) { - var found = true - for (var j = 0; j < valLength; j++) { - if (read(arr, i + j) !== read(val, j)) { - found = false - break - } - } - if (found) return i - } - } - - return -1 -} - -Buffer.prototype.includes = function includes (val, byteOffset, encoding) { - return this.indexOf(val, byteOffset, encoding) !== -1 -} - -Buffer.prototype.indexOf = function indexOf (val, byteOffset, encoding) { - return bidirectionalIndexOf(this, val, byteOffset, encoding, true) -} - -Buffer.prototype.lastIndexOf = function lastIndexOf (val, byteOffset, encoding) { - return bidirectionalIndexOf(this, val, byteOffset, encoding, false) -} - -function hexWrite (buf, string, offset, length) { - offset = Number(offset) || 0 - var remaining = buf.length - offset - if (!length) { - length = remaining - } else { - length = Number(length) - if (length > remaining) { - length = remaining - } - } - - var strLen = string.length - - if (length > strLen / 2) { - length = strLen / 2 - } - for (var i = 0; i < length; ++i) { - var parsed = parseInt(string.substr(i * 2, 2), 16) - if (numberIsNaN(parsed)) return i - buf[offset + i] = parsed - } - return i -} - -function utf8Write (buf, string, offset, length) { - return blitBuffer(utf8ToBytes(string, buf.length - offset), buf, offset, length) -} - -function asciiWrite (buf, string, offset, length) { - return blitBuffer(asciiToBytes(string), buf, offset, length) -} - -function latin1Write (buf, string, offset, length) { - return asciiWrite(buf, string, offset, length) -} - -function base64Write (buf, string, offset, length) { - return blitBuffer(base64ToBytes(string), buf, offset, length) -} - -function ucs2Write (buf, string, offset, length) { - return blitBuffer(utf16leToBytes(string, buf.length - offset), buf, offset, length) -} - -Buffer.prototype.write = function write (string, offset, length, encoding) { - // Buffer#write(string) - if (offset === undefined) { - encoding = 'utf8' - length = this.length - offset = 0 - // Buffer#write(string, encoding) - } else if (length === undefined && typeof offset === 'string') { - encoding = offset - length = this.length - offset = 0 - // Buffer#write(string, offset[, length][, encoding]) - } else if (isFinite(offset)) { - offset = offset >>> 0 - if (isFinite(length)) { - length = length >>> 0 - if (encoding === undefined) encoding = 'utf8' - } else { - encoding = length - length = undefined - } - } else { - throw new Error( - 'Buffer.write(string, encoding, offset[, length]) is no longer supported' - ) - } - - var remaining = this.length - offset - if (length === undefined || length > remaining) length = remaining - - if ((string.length > 0 && (length < 0 || offset < 0)) || offset > this.length) { - throw new RangeError('Attempt to write outside buffer bounds') - } - - if (!encoding) encoding = 'utf8' - - var loweredCase = false - for (;;) { - switch (encoding) { - case 'hex': - return hexWrite(this, string, offset, length) - - case 'utf8': - case 'utf-8': - return utf8Write(this, string, offset, length) - - case 'ascii': - return asciiWrite(this, string, offset, length) - - case 'latin1': - case 'binary': - return latin1Write(this, string, offset, length) - - case 'base64': - // Warning: maxLength not taken into account in base64Write - return base64Write(this, string, offset, length) - - case 'ucs2': - case 'ucs-2': - case 'utf16le': - case 'utf-16le': - return ucs2Write(this, string, offset, length) - - default: - if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding) - encoding = ('' + encoding).toLowerCase() - loweredCase = true - } - } -} - -Buffer.prototype.toJSON = function toJSON () { - return { - type: 'Buffer', - data: Array.prototype.slice.call(this._arr || this, 0) - } -} - -function base64Slice (buf, start, end) { - if (start === 0 && end === buf.length) { - return base64.fromByteArray(buf) - } else { - return base64.fromByteArray(buf.slice(start, end)) - } -} - -function utf8Slice (buf, start, end) { - end = Math.min(buf.length, end) - var res = [] - - var i = start - while (i < end) { - var firstByte = buf[i] - var codePoint = null - var bytesPerSequence = (firstByte > 0xEF) ? 4 - : (firstByte > 0xDF) ? 3 - : (firstByte > 0xBF) ? 2 - : 1 - - if (i + bytesPerSequence <= end) { - var secondByte, thirdByte, fourthByte, tempCodePoint - - switch (bytesPerSequence) { - case 1: - if (firstByte < 0x80) { - codePoint = firstByte - } - break - case 2: - secondByte = buf[i + 1] - if ((secondByte & 0xC0) === 0x80) { - tempCodePoint = (firstByte & 0x1F) << 0x6 | (secondByte & 0x3F) - if (tempCodePoint > 0x7F) { - codePoint = tempCodePoint - } - } - break - case 3: - secondByte = buf[i + 1] - thirdByte = buf[i + 2] - if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80) { - tempCodePoint = (firstByte & 0xF) << 0xC | (secondByte & 0x3F) << 0x6 | (thirdByte & 0x3F) - if (tempCodePoint > 0x7FF && (tempCodePoint < 0xD800 || tempCodePoint > 0xDFFF)) { - codePoint = tempCodePoint - } - } - break - case 4: - secondByte = buf[i + 1] - thirdByte = buf[i + 2] - fourthByte = buf[i + 3] - if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80 && (fourthByte & 0xC0) === 0x80) { - tempCodePoint = (firstByte & 0xF) << 0x12 | (secondByte & 0x3F) << 0xC | (thirdByte & 0x3F) << 0x6 | (fourthByte & 0x3F) - if (tempCodePoint > 0xFFFF && tempCodePoint < 0x110000) { - codePoint = tempCodePoint - } - } - } - } - - if (codePoint === null) { - // we did not generate a valid codePoint so insert a - // replacement char (U+FFFD) and advance only 1 byte - codePoint = 0xFFFD - bytesPerSequence = 1 - } else if (codePoint > 0xFFFF) { - // encode to utf16 (surrogate pair dance) - codePoint -= 0x10000 - res.push(codePoint >>> 10 & 0x3FF | 0xD800) - codePoint = 0xDC00 | codePoint & 0x3FF - } - - res.push(codePoint) - i += bytesPerSequence - } - - return decodeCodePointsArray(res) -} - -// Based on http://stackoverflow.com/a/22747272/680742, the browser with -// the lowest limit is Chrome, with 0x10000 args. -// We go 1 magnitude less, for safety -var MAX_ARGUMENTS_LENGTH = 0x1000 - -function decodeCodePointsArray (codePoints) { - var len = codePoints.length - if (len <= MAX_ARGUMENTS_LENGTH) { - return String.fromCharCode.apply(String, codePoints) // avoid extra slice() - } - - // Decode in chunks to avoid "call stack size exceeded". - var res = '' - var i = 0 - while (i < len) { - res += String.fromCharCode.apply( - String, - codePoints.slice(i, i += MAX_ARGUMENTS_LENGTH) - ) - } - return res -} - -function asciiSlice (buf, start, end) { - var ret = '' - end = Math.min(buf.length, end) - - for (var i = start; i < end; ++i) { - ret += String.fromCharCode(buf[i] & 0x7F) - } - return ret -} - -function latin1Slice (buf, start, end) { - var ret = '' - end = Math.min(buf.length, end) - - for (var i = start; i < end; ++i) { - ret += String.fromCharCode(buf[i]) - } - return ret -} - -function hexSlice (buf, start, end) { - var len = buf.length - - if (!start || start < 0) start = 0 - if (!end || end < 0 || end > len) end = len - - var out = '' - for (var i = start; i < end; ++i) { - out += toHex(buf[i]) - } - return out -} - -function utf16leSlice (buf, start, end) { - var bytes = buf.slice(start, end) - var res = '' - for (var i = 0; i < bytes.length; i += 2) { - res += String.fromCharCode(bytes[i] + (bytes[i + 1] * 256)) - } - return res -} - -Buffer.prototype.slice = function slice (start, end) { - var len = this.length - start = ~~start - end = end === undefined ? len : ~~end - - if (start < 0) { - start += len - if (start < 0) start = 0 - } else if (start > len) { - start = len - } - - if (end < 0) { - end += len - if (end < 0) end = 0 - } else if (end > len) { - end = len - } - - if (end < start) end = start - - var newBuf = this.subarray(start, end) - // Return an augmented `Uint8Array` instance - newBuf.__proto__ = Buffer.prototype - return newBuf -} - -/* - * Need to make sure that buffer isn't trying to write out of bounds. - */ -function checkOffset (offset, ext, length) { - if ((offset % 1) !== 0 || offset < 0) throw new RangeError('offset is not uint') - if (offset + ext > length) throw new RangeError('Trying to access beyond buffer length') -} - -Buffer.prototype.readUIntLE = function readUIntLE (offset, byteLength, noAssert) { - offset = offset >>> 0 - byteLength = byteLength >>> 0 - if (!noAssert) checkOffset(offset, byteLength, this.length) - - var val = this[offset] - var mul = 1 - var i = 0 - while (++i < byteLength && (mul *= 0x100)) { - val += this[offset + i] * mul - } - - return val -} - -Buffer.prototype.readUIntBE = function readUIntBE (offset, byteLength, noAssert) { - offset = offset >>> 0 - byteLength = byteLength >>> 0 - if (!noAssert) { - checkOffset(offset, byteLength, this.length) - } - - var val = this[offset + --byteLength] - var mul = 1 - while (byteLength > 0 && (mul *= 0x100)) { - val += this[offset + --byteLength] * mul - } - - return val -} - -Buffer.prototype.readUInt8 = function readUInt8 (offset, noAssert) { - offset = offset >>> 0 - if (!noAssert) checkOffset(offset, 1, this.length) - return this[offset] -} - -Buffer.prototype.readUInt16LE = function readUInt16LE (offset, noAssert) { - offset = offset >>> 0 - if (!noAssert) checkOffset(offset, 2, this.length) - return this[offset] | (this[offset + 1] << 8) -} - -Buffer.prototype.readUInt16BE = function readUInt16BE (offset, noAssert) { - offset = offset >>> 0 - if (!noAssert) checkOffset(offset, 2, this.length) - return (this[offset] << 8) | this[offset + 1] -} - -Buffer.prototype.readUInt32LE = function readUInt32LE (offset, noAssert) { - offset = offset >>> 0 - if (!noAssert) checkOffset(offset, 4, this.length) - - return ((this[offset]) | - (this[offset + 1] << 8) | - (this[offset + 2] << 16)) + - (this[offset + 3] * 0x1000000) -} - -Buffer.prototype.readUInt32BE = function readUInt32BE (offset, noAssert) { - offset = offset >>> 0 - if (!noAssert) checkOffset(offset, 4, this.length) - - return (this[offset] * 0x1000000) + - ((this[offset + 1] << 16) | - (this[offset + 2] << 8) | - this[offset + 3]) -} - -Buffer.prototype.readIntLE = function readIntLE (offset, byteLength, noAssert) { - offset = offset >>> 0 - byteLength = byteLength >>> 0 - if (!noAssert) checkOffset(offset, byteLength, this.length) - - var val = this[offset] - var mul = 1 - var i = 0 - while (++i < byteLength && (mul *= 0x100)) { - val += this[offset + i] * mul - } - mul *= 0x80 - - if (val >= mul) val -= Math.pow(2, 8 * byteLength) - - return val -} - -Buffer.prototype.readIntBE = function readIntBE (offset, byteLength, noAssert) { - offset = offset >>> 0 - byteLength = byteLength >>> 0 - if (!noAssert) checkOffset(offset, byteLength, this.length) - - var i = byteLength - var mul = 1 - var val = this[offset + --i] - while (i > 0 && (mul *= 0x100)) { - val += this[offset + --i] * mul - } - mul *= 0x80 - - if (val >= mul) val -= Math.pow(2, 8 * byteLength) - - return val -} - -Buffer.prototype.readInt8 = function readInt8 (offset, noAssert) { - offset = offset >>> 0 - if (!noAssert) checkOffset(offset, 1, this.length) - if (!(this[offset] & 0x80)) return (this[offset]) - return ((0xff - this[offset] + 1) * -1) -} - -Buffer.prototype.readInt16LE = function readInt16LE (offset, noAssert) { - offset = offset >>> 0 - if (!noAssert) checkOffset(offset, 2, this.length) - var val = this[offset] | (this[offset + 1] << 8) - return (val & 0x8000) ? val | 0xFFFF0000 : val -} - -Buffer.prototype.readInt16BE = function readInt16BE (offset, noAssert) { - offset = offset >>> 0 - if (!noAssert) checkOffset(offset, 2, this.length) - var val = this[offset + 1] | (this[offset] << 8) - return (val & 0x8000) ? val | 0xFFFF0000 : val -} - -Buffer.prototype.readInt32LE = function readInt32LE (offset, noAssert) { - offset = offset >>> 0 - if (!noAssert) checkOffset(offset, 4, this.length) - - return (this[offset]) | - (this[offset + 1] << 8) | - (this[offset + 2] << 16) | - (this[offset + 3] << 24) -} - -Buffer.prototype.readInt32BE = function readInt32BE (offset, noAssert) { - offset = offset >>> 0 - if (!noAssert) checkOffset(offset, 4, this.length) - - return (this[offset] << 24) | - (this[offset + 1] << 16) | - (this[offset + 2] << 8) | - (this[offset + 3]) -} - -Buffer.prototype.readFloatLE = function readFloatLE (offset, noAssert) { - offset = offset >>> 0 - if (!noAssert) checkOffset(offset, 4, this.length) - return ieee754.read(this, offset, true, 23, 4) -} - -Buffer.prototype.readFloatBE = function readFloatBE (offset, noAssert) { - offset = offset >>> 0 - if (!noAssert) checkOffset(offset, 4, this.length) - return ieee754.read(this, offset, false, 23, 4) -} - -Buffer.prototype.readDoubleLE = function readDoubleLE (offset, noAssert) { - offset = offset >>> 0 - if (!noAssert) checkOffset(offset, 8, this.length) - return ieee754.read(this, offset, true, 52, 8) -} - -Buffer.prototype.readDoubleBE = function readDoubleBE (offset, noAssert) { - offset = offset >>> 0 - if (!noAssert) checkOffset(offset, 8, this.length) - return ieee754.read(this, offset, false, 52, 8) -} - -function checkInt (buf, value, offset, ext, max, min) { - if (!Buffer.isBuffer(buf)) throw new TypeError('"buffer" argument must be a Buffer instance') - if (value > max || value < min) throw new RangeError('"value" argument is out of bounds') - if (offset + ext > buf.length) throw new RangeError('Index out of range') -} - -Buffer.prototype.writeUIntLE = function writeUIntLE (value, offset, byteLength, noAssert) { - value = +value - offset = offset >>> 0 - byteLength = byteLength >>> 0 - if (!noAssert) { - var maxBytes = Math.pow(2, 8 * byteLength) - 1 - checkInt(this, value, offset, byteLength, maxBytes, 0) - } - - var mul = 1 - var i = 0 - this[offset] = value & 0xFF - while (++i < byteLength && (mul *= 0x100)) { - this[offset + i] = (value / mul) & 0xFF - } - - return offset + byteLength -} - -Buffer.prototype.writeUIntBE = function writeUIntBE (value, offset, byteLength, noAssert) { - value = +value - offset = offset >>> 0 - byteLength = byteLength >>> 0 - if (!noAssert) { - var maxBytes = Math.pow(2, 8 * byteLength) - 1 - checkInt(this, value, offset, byteLength, maxBytes, 0) - } - - var i = byteLength - 1 - var mul = 1 - this[offset + i] = value & 0xFF - while (--i >= 0 && (mul *= 0x100)) { - this[offset + i] = (value / mul) & 0xFF - } - - return offset + byteLength -} - -Buffer.prototype.writeUInt8 = function writeUInt8 (value, offset, noAssert) { - value = +value - offset = offset >>> 0 - if (!noAssert) checkInt(this, value, offset, 1, 0xff, 0) - this[offset] = (value & 0xff) - return offset + 1 -} - -Buffer.prototype.writeUInt16LE = function writeUInt16LE (value, offset, noAssert) { - value = +value - offset = offset >>> 0 - if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0) - this[offset] = (value & 0xff) - this[offset + 1] = (value >>> 8) - return offset + 2 -} - -Buffer.prototype.writeUInt16BE = function writeUInt16BE (value, offset, noAssert) { - value = +value - offset = offset >>> 0 - if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0) - this[offset] = (value >>> 8) - this[offset + 1] = (value & 0xff) - return offset + 2 -} - -Buffer.prototype.writeUInt32LE = function writeUInt32LE (value, offset, noAssert) { - value = +value - offset = offset >>> 0 - if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0) - this[offset + 3] = (value >>> 24) - this[offset + 2] = (value >>> 16) - this[offset + 1] = (value >>> 8) - this[offset] = (value & 0xff) - return offset + 4 -} - -Buffer.prototype.writeUInt32BE = function writeUInt32BE (value, offset, noAssert) { - value = +value - offset = offset >>> 0 - if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0) - this[offset] = (value >>> 24) - this[offset + 1] = (value >>> 16) - this[offset + 2] = (value >>> 8) - this[offset + 3] = (value & 0xff) - return offset + 4 -} - -Buffer.prototype.writeIntLE = function writeIntLE (value, offset, byteLength, noAssert) { - value = +value - offset = offset >>> 0 - if (!noAssert) { - var limit = Math.pow(2, (8 * byteLength) - 1) - - checkInt(this, value, offset, byteLength, limit - 1, -limit) - } - - var i = 0 - var mul = 1 - var sub = 0 - this[offset] = value & 0xFF - while (++i < byteLength && (mul *= 0x100)) { - if (value < 0 && sub === 0 && this[offset + i - 1] !== 0) { - sub = 1 - } - this[offset + i] = ((value / mul) >> 0) - sub & 0xFF - } - - return offset + byteLength -} - -Buffer.prototype.writeIntBE = function writeIntBE (value, offset, byteLength, noAssert) { - value = +value - offset = offset >>> 0 - if (!noAssert) { - var limit = Math.pow(2, (8 * byteLength) - 1) - - checkInt(this, value, offset, byteLength, limit - 1, -limit) - } - - var i = byteLength - 1 - var mul = 1 - var sub = 0 - this[offset + i] = value & 0xFF - while (--i >= 0 && (mul *= 0x100)) { - if (value < 0 && sub === 0 && this[offset + i + 1] !== 0) { - sub = 1 - } - this[offset + i] = ((value / mul) >> 0) - sub & 0xFF - } - - return offset + byteLength -} - -Buffer.prototype.writeInt8 = function writeInt8 (value, offset, noAssert) { - value = +value - offset = offset >>> 0 - if (!noAssert) checkInt(this, value, offset, 1, 0x7f, -0x80) - if (value < 0) value = 0xff + value + 1 - this[offset] = (value & 0xff) - return offset + 1 -} - -Buffer.prototype.writeInt16LE = function writeInt16LE (value, offset, noAssert) { - value = +value - offset = offset >>> 0 - if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000) - this[offset] = (value & 0xff) - this[offset + 1] = (value >>> 8) - return offset + 2 -} - -Buffer.prototype.writeInt16BE = function writeInt16BE (value, offset, noAssert) { - value = +value - offset = offset >>> 0 - if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000) - this[offset] = (value >>> 8) - this[offset + 1] = (value & 0xff) - return offset + 2 -} - -Buffer.prototype.writeInt32LE = function writeInt32LE (value, offset, noAssert) { - value = +value - offset = offset >>> 0 - if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000) - this[offset] = (value & 0xff) - this[offset + 1] = (value >>> 8) - this[offset + 2] = (value >>> 16) - this[offset + 3] = (value >>> 24) - return offset + 4 -} - -Buffer.prototype.writeInt32BE = function writeInt32BE (value, offset, noAssert) { - value = +value - offset = offset >>> 0 - if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000) - if (value < 0) value = 0xffffffff + value + 1 - this[offset] = (value >>> 24) - this[offset + 1] = (value >>> 16) - this[offset + 2] = (value >>> 8) - this[offset + 3] = (value & 0xff) - return offset + 4 -} - -function checkIEEE754 (buf, value, offset, ext, max, min) { - if (offset + ext > buf.length) throw new RangeError('Index out of range') - if (offset < 0) throw new RangeError('Index out of range') -} - -function writeFloat (buf, value, offset, littleEndian, noAssert) { - value = +value - offset = offset >>> 0 - if (!noAssert) { - checkIEEE754(buf, value, offset, 4, 3.4028234663852886e+38, -3.4028234663852886e+38) - } - ieee754.write(buf, value, offset, littleEndian, 23, 4) - return offset + 4 -} - -Buffer.prototype.writeFloatLE = function writeFloatLE (value, offset, noAssert) { - return writeFloat(this, value, offset, true, noAssert) -} - -Buffer.prototype.writeFloatBE = function writeFloatBE (value, offset, noAssert) { - return writeFloat(this, value, offset, false, noAssert) -} - -function writeDouble (buf, value, offset, littleEndian, noAssert) { - value = +value - offset = offset >>> 0 - if (!noAssert) { - checkIEEE754(buf, value, offset, 8, 1.7976931348623157E+308, -1.7976931348623157E+308) - } - ieee754.write(buf, value, offset, littleEndian, 52, 8) - return offset + 8 -} - -Buffer.prototype.writeDoubleLE = function writeDoubleLE (value, offset, noAssert) { - return writeDouble(this, value, offset, true, noAssert) -} - -Buffer.prototype.writeDoubleBE = function writeDoubleBE (value, offset, noAssert) { - return writeDouble(this, value, offset, false, noAssert) -} - -// copy(targetBuffer, targetStart=0, sourceStart=0, sourceEnd=buffer.length) -Buffer.prototype.copy = function copy (target, targetStart, start, end) { - if (!Buffer.isBuffer(target)) throw new TypeError('argument should be a Buffer') - if (!start) start = 0 - if (!end && end !== 0) end = this.length - if (targetStart >= target.length) targetStart = target.length - if (!targetStart) targetStart = 0 - if (end > 0 && end < start) end = start - - // Copy 0 bytes; we're done - if (end === start) return 0 - if (target.length === 0 || this.length === 0) return 0 - - // Fatal error conditions - if (targetStart < 0) { - throw new RangeError('targetStart out of bounds') - } - if (start < 0 || start >= this.length) throw new RangeError('Index out of range') - if (end < 0) throw new RangeError('sourceEnd out of bounds') - - // Are we oob? - if (end > this.length) end = this.length - if (target.length - targetStart < end - start) { - end = target.length - targetStart + start - } - - var len = end - start - - if (this === target && typeof Uint8Array.prototype.copyWithin === 'function') { - // Use built-in when available, missing from IE11 - this.copyWithin(targetStart, start, end) - } else if (this === target && start < targetStart && targetStart < end) { - // descending copy from end - for (var i = len - 1; i >= 0; --i) { - target[i + targetStart] = this[i + start] - } - } else { - Uint8Array.prototype.set.call( - target, - this.subarray(start, end), - targetStart - ) - } - - return len -} - -// Usage: -// buffer.fill(number[, offset[, end]]) -// buffer.fill(buffer[, offset[, end]]) -// buffer.fill(string[, offset[, end]][, encoding]) -Buffer.prototype.fill = function fill (val, start, end, encoding) { - // Handle string cases: - if (typeof val === 'string') { - if (typeof start === 'string') { - encoding = start - start = 0 - end = this.length - } else if (typeof end === 'string') { - encoding = end - end = this.length - } - if (encoding !== undefined && typeof encoding !== 'string') { - throw new TypeError('encoding must be a string') - } - if (typeof encoding === 'string' && !Buffer.isEncoding(encoding)) { - throw new TypeError('Unknown encoding: ' + encoding) - } - if (val.length === 1) { - var code = val.charCodeAt(0) - if ((encoding === 'utf8' && code < 128) || - encoding === 'latin1') { - // Fast path: If `val` fits into a single byte, use that numeric value. - val = code - } - } - } else if (typeof val === 'number') { - val = val & 255 - } - - // Invalid ranges are not set to a default, so can range check early. - if (start < 0 || this.length < start || this.length < end) { - throw new RangeError('Out of range index') - } - - if (end <= start) { - return this - } - - start = start >>> 0 - end = end === undefined ? this.length : end >>> 0 - - if (!val) val = 0 - - var i - if (typeof val === 'number') { - for (i = start; i < end; ++i) { - this[i] = val - } - } else { - var bytes = Buffer.isBuffer(val) - ? val - : Buffer.from(val, encoding) - var len = bytes.length - if (len === 0) { - throw new TypeError('The value "' + val + - '" is invalid for argument "value"') - } - for (i = 0; i < end - start; ++i) { - this[i + start] = bytes[i % len] - } - } - - return this -} - -// HELPER FUNCTIONS -// ================ - -var INVALID_BASE64_RE = /[^+/0-9A-Za-z-_]/g - -function base64clean (str) { - // Node takes equal signs as end of the Base64 encoding - str = str.split('=')[0] - // Node strips out invalid characters like \n and \t from the string, base64-js does not - str = str.trim().replace(INVALID_BASE64_RE, '') - // Node converts strings with length < 2 to '' - if (str.length < 2) return '' - // Node allows for non-padded base64 strings (missing trailing ===), base64-js does not - while (str.length % 4 !== 0) { - str = str + '=' - } - return str -} - -function toHex (n) { - if (n < 16) return '0' + n.toString(16) - return n.toString(16) -} - -function utf8ToBytes (string, units) { - units = units || Infinity - var codePoint - var length = string.length - var leadSurrogate = null - var bytes = [] - - for (var i = 0; i < length; ++i) { - codePoint = string.charCodeAt(i) - - // is surrogate component - if (codePoint > 0xD7FF && codePoint < 0xE000) { - // last char was a lead - if (!leadSurrogate) { - // no lead yet - if (codePoint > 0xDBFF) { - // unexpected trail - if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD) - continue - } else if (i + 1 === length) { - // unpaired lead - if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD) - continue - } - - // valid lead - leadSurrogate = codePoint - - continue - } - - // 2 leads in a row - if (codePoint < 0xDC00) { - if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD) - leadSurrogate = codePoint - continue - } - - // valid surrogate pair - codePoint = (leadSurrogate - 0xD800 << 10 | codePoint - 0xDC00) + 0x10000 - } else if (leadSurrogate) { - // valid bmp char, but last char was a lead - if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD) - } - - leadSurrogate = null - - // encode utf8 - if (codePoint < 0x80) { - if ((units -= 1) < 0) break - bytes.push(codePoint) - } else if (codePoint < 0x800) { - if ((units -= 2) < 0) break - bytes.push( - codePoint >> 0x6 | 0xC0, - codePoint & 0x3F | 0x80 - ) - } else if (codePoint < 0x10000) { - if ((units -= 3) < 0) break - bytes.push( - codePoint >> 0xC | 0xE0, - codePoint >> 0x6 & 0x3F | 0x80, - codePoint & 0x3F | 0x80 - ) - } else if (codePoint < 0x110000) { - if ((units -= 4) < 0) break - bytes.push( - codePoint >> 0x12 | 0xF0, - codePoint >> 0xC & 0x3F | 0x80, - codePoint >> 0x6 & 0x3F | 0x80, - codePoint & 0x3F | 0x80 - ) - } else { - throw new Error('Invalid code point') - } - } - - return bytes -} - -function asciiToBytes (str) { - var byteArray = [] - for (var i = 0; i < str.length; ++i) { - // Node's code seems to be doing this and not & 0x7F.. - byteArray.push(str.charCodeAt(i) & 0xFF) - } - return byteArray -} - -function utf16leToBytes (str, units) { - var c, hi, lo - var byteArray = [] - for (var i = 0; i < str.length; ++i) { - if ((units -= 2) < 0) break - - c = str.charCodeAt(i) - hi = c >> 8 - lo = c % 256 - byteArray.push(lo) - byteArray.push(hi) - } - - return byteArray -} - -function base64ToBytes (str) { - return base64.toByteArray(base64clean(str)) -} - -function blitBuffer (src, dst, offset, length) { - for (var i = 0; i < length; ++i) { - if ((i + offset >= dst.length) || (i >= src.length)) break - dst[i + offset] = src[i] - } - return i -} - -// ArrayBuffer or Uint8Array objects from other contexts (i.e. iframes) do not pass -// the `instanceof` check but they should be treated as of that type. -// See: https://github.com/feross/buffer/issues/166 -function isInstance (obj, type) { - return obj instanceof type || - (obj != null && obj.constructor != null && obj.constructor.name != null && - obj.constructor.name === type.name) -} -function numberIsNaN (obj) { - // For IE11 support - return obj !== obj // eslint-disable-line no-self-compare -} - -}).call(this,require("buffer").Buffer) -},{"base64-js":50,"buffer":89,"ieee754":155}],90:[function(require,module,exports){ -module.exports = { - "100": "Continue", - "101": "Switching Protocols", - "102": "Processing", - "200": "OK", - "201": "Created", - "202": "Accepted", - "203": "Non-Authoritative Information", - "204": "No Content", - "205": "Reset Content", - "206": "Partial Content", - "207": "Multi-Status", - "208": "Already Reported", - "226": "IM Used", - "300": "Multiple Choices", - "301": "Moved Permanently", - "302": "Found", - "303": "See Other", - "304": "Not Modified", - "305": "Use Proxy", - "307": "Temporary Redirect", - "308": "Permanent Redirect", - "400": "Bad Request", - "401": "Unauthorized", - "402": "Payment Required", - "403": "Forbidden", - "404": "Not Found", - "405": "Method Not Allowed", - "406": "Not Acceptable", - "407": "Proxy Authentication Required", - "408": "Request Timeout", - "409": "Conflict", - "410": "Gone", - "411": "Length Required", - "412": "Precondition Failed", - "413": "Payload Too Large", - "414": "URI Too Long", - "415": "Unsupported Media Type", - "416": "Range Not Satisfiable", - "417": "Expectation Failed", - "418": "I'm a teapot", - "421": "Misdirected Request", - "422": "Unprocessable Entity", - "423": "Locked", - "424": "Failed Dependency", - "425": "Unordered Collection", - "426": "Upgrade Required", - "428": "Precondition Required", - "429": "Too Many Requests", - "431": "Request Header Fields Too Large", - "451": "Unavailable For Legal Reasons", - "500": "Internal Server Error", - "501": "Not Implemented", - "502": "Bad Gateway", - "503": "Service Unavailable", - "504": "Gateway Timeout", - "505": "HTTP Version Not Supported", - "506": "Variant Also Negotiates", - "507": "Insufficient Storage", - "508": "Loop Detected", - "509": "Bandwidth Limit Exceeded", - "510": "Not Extended", - "511": "Network Authentication Required" -} - -},{}],91:[function(require,module,exports){ -var Buffer = require('safe-buffer').Buffer -var Transform = require('stream').Transform -var StringDecoder = require('string_decoder').StringDecoder -var inherits = require('inherits') - -function CipherBase (hashMode) { - Transform.call(this) - this.hashMode = typeof hashMode === 'string' - if (this.hashMode) { - this[hashMode] = this._finalOrDigest - } else { - this.final = this._finalOrDigest - } - if (this._final) { - this.__final = this._final - this._final = null - } - this._decoder = null - this._encoding = null -} -inherits(CipherBase, Transform) - -CipherBase.prototype.update = function (data, inputEnc, outputEnc) { - if (typeof data === 'string') { - data = Buffer.from(data, inputEnc) - } - - var outData = this._update(data) - if (this.hashMode) return this - - if (outputEnc) { - outData = this._toString(outData, outputEnc) - } - - return outData -} - -CipherBase.prototype.setAutoPadding = function () {} -CipherBase.prototype.getAuthTag = function () { - throw new Error('trying to get auth tag in unsupported state') -} - -CipherBase.prototype.setAuthTag = function () { - throw new Error('trying to set auth tag in unsupported state') -} - -CipherBase.prototype.setAAD = function () { - throw new Error('trying to set aad in unsupported state') -} - -CipherBase.prototype._transform = function (data, _, next) { - var err - try { - if (this.hashMode) { - this._update(data) - } else { - this.push(this._update(data)) - } - } catch (e) { - err = e - } finally { - next(err) - } -} -CipherBase.prototype._flush = function (done) { - var err - try { - this.push(this.__final()) - } catch (e) { - err = e - } - - done(err) -} -CipherBase.prototype._finalOrDigest = function (outputEnc) { - var outData = this.__final() || Buffer.alloc(0) - if (outputEnc) { - outData = this._toString(outData, outputEnc, true) - } - return outData -} - -CipherBase.prototype._toString = function (value, enc, fin) { - if (!this._decoder) { - this._decoder = new StringDecoder(enc) - this._encoding = enc - } - - if (this._encoding !== enc) throw new Error('can\'t switch encodings') - - var out = this._decoder.write(value) - if (fin) { - out += this._decoder.end() - } - - return out -} - -module.exports = CipherBase - -},{"inherits":156,"safe-buffer":216,"stream":225,"string_decoder":83}],92:[function(require,module,exports){ -(function (Buffer){ -// Copyright Joyent, Inc. and other Node contributors. -// -// Permission is hereby granted, free of charge, to any person obtaining a -// copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to permit -// persons to whom the Software is furnished to do so, subject to the -// following conditions: -// -// The above copyright notice and this permission notice shall be included -// in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN -// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR -// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE -// USE OR OTHER DEALINGS IN THE SOFTWARE. - -// NOTE: These type checking functions intentionally don't use `instanceof` -// because it is fragile and can be easily faked with `Object.create()`. - -function isArray(arg) { - if (Array.isArray) { - return Array.isArray(arg); - } - return objectToString(arg) === '[object Array]'; -} -exports.isArray = isArray; - -function isBoolean(arg) { - return typeof arg === 'boolean'; -} -exports.isBoolean = isBoolean; - -function isNull(arg) { - return arg === null; -} -exports.isNull = isNull; - -function isNullOrUndefined(arg) { - return arg == null; -} -exports.isNullOrUndefined = isNullOrUndefined; - -function isNumber(arg) { - return typeof arg === 'number'; -} -exports.isNumber = isNumber; - -function isString(arg) { - return typeof arg === 'string'; -} -exports.isString = isString; - -function isSymbol(arg) { - return typeof arg === 'symbol'; -} -exports.isSymbol = isSymbol; - -function isUndefined(arg) { - return arg === void 0; -} -exports.isUndefined = isUndefined; - -function isRegExp(re) { - return objectToString(re) === '[object RegExp]'; -} -exports.isRegExp = isRegExp; - -function isObject(arg) { - return typeof arg === 'object' && arg !== null; -} -exports.isObject = isObject; - -function isDate(d) { - return objectToString(d) === '[object Date]'; -} -exports.isDate = isDate; - -function isError(e) { - return (objectToString(e) === '[object Error]' || e instanceof Error); -} -exports.isError = isError; - -function isFunction(arg) { - return typeof arg === 'function'; -} -exports.isFunction = isFunction; - -function isPrimitive(arg) { - return arg === null || - typeof arg === 'boolean' || - typeof arg === 'number' || - typeof arg === 'string' || - typeof arg === 'symbol' || // ES6 symbol - typeof arg === 'undefined'; -} -exports.isPrimitive = isPrimitive; - -exports.isBuffer = Buffer.isBuffer; - -function objectToString(o) { - return Object.prototype.toString.call(o); -} - -}).call(this,{"isBuffer":require("../../insert-module-globals/node_modules/is-buffer/index.js")}) -},{"../../insert-module-globals/node_modules/is-buffer/index.js":157}],93:[function(require,module,exports){ -(function (Buffer){ -var elliptic = require('elliptic') -var BN = require('bn.js') - -module.exports = function createECDH (curve) { - return new ECDH(curve) -} - -var aliases = { - secp256k1: { - name: 'secp256k1', - byteLength: 32 - }, - secp224r1: { - name: 'p224', - byteLength: 28 - }, - prime256v1: { - name: 'p256', - byteLength: 32 - }, - prime192v1: { - name: 'p192', - byteLength: 24 - }, - ed25519: { - name: 'ed25519', - byteLength: 32 - }, - secp384r1: { - name: 'p384', - byteLength: 48 - }, - secp521r1: { - name: 'p521', - byteLength: 66 - } -} - -aliases.p224 = aliases.secp224r1 -aliases.p256 = aliases.secp256r1 = aliases.prime256v1 -aliases.p192 = aliases.secp192r1 = aliases.prime192v1 -aliases.p384 = aliases.secp384r1 -aliases.p521 = aliases.secp521r1 - -function ECDH (curve) { - this.curveType = aliases[curve] - if (!this.curveType) { - this.curveType = { - name: curve - } - } - this.curve = new elliptic.ec(this.curveType.name) // eslint-disable-line new-cap - this.keys = void 0 -} - -ECDH.prototype.generateKeys = function (enc, format) { - this.keys = this.curve.genKeyPair() - return this.getPublicKey(enc, format) -} - -ECDH.prototype.computeSecret = function (other, inenc, enc) { - inenc = inenc || 'utf8' - if (!Buffer.isBuffer(other)) { - other = new Buffer(other, inenc) - } - var otherPub = this.curve.keyFromPublic(other).getPublic() - var out = otherPub.mul(this.keys.getPrivate()).getX() - return formatReturnValue(out, enc, this.curveType.byteLength) -} - -ECDH.prototype.getPublicKey = function (enc, format) { - var key = this.keys.getPublic(format === 'compressed', true) - if (format === 'hybrid') { - if (key[key.length - 1] % 2) { - key[0] = 7 - } else { - key[0] = 6 - } - } - return formatReturnValue(key, enc) -} - -ECDH.prototype.getPrivateKey = function (enc) { - return formatReturnValue(this.keys.getPrivate(), enc) -} - -ECDH.prototype.setPublicKey = function (pub, enc) { - enc = enc || 'utf8' - if (!Buffer.isBuffer(pub)) { - pub = new Buffer(pub, enc) - } - this.keys._importPublic(pub) - return this -} - -ECDH.prototype.setPrivateKey = function (priv, enc) { - enc = enc || 'utf8' - if (!Buffer.isBuffer(priv)) { - priv = new Buffer(priv, enc) - } - - var _priv = new BN(priv) - _priv = _priv.toString(16) - this.keys = this.curve.genKeyPair() - this.keys._importPrivate(_priv) - return this -} - -function formatReturnValue (bn, enc, len) { - if (!Array.isArray(bn)) { - bn = bn.toArray() - } - var buf = new Buffer(bn) - if (len && buf.length < len) { - var zeros = new Buffer(len - buf.length) - zeros.fill(0) - buf = Buffer.concat([zeros, buf]) - } - if (!enc) { - return buf - } else { - return buf.toString(enc) - } -} - -}).call(this,require("buffer").Buffer) -},{"bn.js":52,"buffer":89,"elliptic":111}],94:[function(require,module,exports){ -'use strict' -var inherits = require('inherits') -var MD5 = require('md5.js') -var RIPEMD160 = require('ripemd160') -var sha = require('sha.js') -var Base = require('cipher-base') - -function Hash (hash) { - Base.call(this, 'digest') - - this._hash = hash -} - -inherits(Hash, Base) - -Hash.prototype._update = function (data) { - this._hash.update(data) -} - -Hash.prototype._final = function () { - return this._hash.digest() -} - -module.exports = function createHash (alg) { - alg = alg.toLowerCase() - if (alg === 'md5') return new MD5() - if (alg === 'rmd160' || alg === 'ripemd160') return new RIPEMD160() - - return new Hash(sha(alg)) -} - -},{"cipher-base":91,"inherits":156,"md5.js":162,"ripemd160":215,"sha.js":218}],95:[function(require,module,exports){ -var MD5 = require('md5.js') - -module.exports = function (buffer) { - return new MD5().update(buffer).digest() -} - -},{"md5.js":162}],96:[function(require,module,exports){ -'use strict' -var inherits = require('inherits') -var Legacy = require('./legacy') -var Base = require('cipher-base') -var Buffer = require('safe-buffer').Buffer -var md5 = require('create-hash/md5') -var RIPEMD160 = require('ripemd160') - -var sha = require('sha.js') - -var ZEROS = Buffer.alloc(128) - -function Hmac (alg, key) { - Base.call(this, 'digest') - if (typeof key === 'string') { - key = Buffer.from(key) - } - - var blocksize = (alg === 'sha512' || alg === 'sha384') ? 128 : 64 - - this._alg = alg - this._key = key - if (key.length > blocksize) { - var hash = alg === 'rmd160' ? new RIPEMD160() : sha(alg) - key = hash.update(key).digest() - } else if (key.length < blocksize) { - key = Buffer.concat([key, ZEROS], blocksize) - } - - var ipad = this._ipad = Buffer.allocUnsafe(blocksize) - var opad = this._opad = Buffer.allocUnsafe(blocksize) - - for (var i = 0; i < blocksize; i++) { - ipad[i] = key[i] ^ 0x36 - opad[i] = key[i] ^ 0x5C - } - this._hash = alg === 'rmd160' ? new RIPEMD160() : sha(alg) - this._hash.update(ipad) -} - -inherits(Hmac, Base) - -Hmac.prototype._update = function (data) { - this._hash.update(data) -} - -Hmac.prototype._final = function () { - var h = this._hash.digest() - var hash = this._alg === 'rmd160' ? new RIPEMD160() : sha(this._alg) - return hash.update(this._opad).update(h).digest() -} - -module.exports = function createHmac (alg, key) { - alg = alg.toLowerCase() - if (alg === 'rmd160' || alg === 'ripemd160') { - return new Hmac('rmd160', key) - } - if (alg === 'md5') { - return new Legacy(md5, key) - } - return new Hmac(alg, key) -} - -},{"./legacy":97,"cipher-base":91,"create-hash/md5":95,"inherits":156,"ripemd160":215,"safe-buffer":216,"sha.js":218}],97:[function(require,module,exports){ -'use strict' -var inherits = require('inherits') -var Buffer = require('safe-buffer').Buffer - -var Base = require('cipher-base') - -var ZEROS = Buffer.alloc(128) -var blocksize = 64 - -function Hmac (alg, key) { - Base.call(this, 'digest') - if (typeof key === 'string') { - key = Buffer.from(key) - } - - this._alg = alg - this._key = key - - if (key.length > blocksize) { - key = alg(key) - } else if (key.length < blocksize) { - key = Buffer.concat([key, ZEROS], blocksize) - } - - var ipad = this._ipad = Buffer.allocUnsafe(blocksize) - var opad = this._opad = Buffer.allocUnsafe(blocksize) - - for (var i = 0; i < blocksize; i++) { - ipad[i] = key[i] ^ 0x36 - opad[i] = key[i] ^ 0x5C - } - - this._hash = [ipad] -} - -inherits(Hmac, Base) - -Hmac.prototype._update = function (data) { - this._hash.push(data) -} - -Hmac.prototype._final = function () { - var h = this._alg(Buffer.concat(this._hash)) - return this._alg(Buffer.concat([this._opad, h])) -} -module.exports = Hmac - -},{"cipher-base":91,"inherits":156,"safe-buffer":216}],98:[function(require,module,exports){ -'use strict' - -exports.randomBytes = exports.rng = exports.pseudoRandomBytes = exports.prng = require('randombytes') -exports.createHash = exports.Hash = require('create-hash') -exports.createHmac = exports.Hmac = require('create-hmac') - -var algos = require('browserify-sign/algos') -var algoKeys = Object.keys(algos) -var hashes = ['sha1', 'sha224', 'sha256', 'sha384', 'sha512', 'md5', 'rmd160'].concat(algoKeys) -exports.getHashes = function () { - return hashes -} - -var p = require('pbkdf2') -exports.pbkdf2 = p.pbkdf2 -exports.pbkdf2Sync = p.pbkdf2Sync - -var aes = require('browserify-cipher') - -exports.Cipher = aes.Cipher -exports.createCipher = aes.createCipher -exports.Cipheriv = aes.Cipheriv -exports.createCipheriv = aes.createCipheriv -exports.Decipher = aes.Decipher -exports.createDecipher = aes.createDecipher -exports.Decipheriv = aes.Decipheriv -exports.createDecipheriv = aes.createDecipheriv -exports.getCiphers = aes.getCiphers -exports.listCiphers = aes.listCiphers - -var dh = require('diffie-hellman') - -exports.DiffieHellmanGroup = dh.DiffieHellmanGroup -exports.createDiffieHellmanGroup = dh.createDiffieHellmanGroup -exports.getDiffieHellman = dh.getDiffieHellman -exports.createDiffieHellman = dh.createDiffieHellman -exports.DiffieHellman = dh.DiffieHellman - -var sign = require('browserify-sign') - -exports.createSign = sign.createSign -exports.Sign = sign.Sign -exports.createVerify = sign.createVerify -exports.Verify = sign.Verify - -exports.createECDH = require('create-ecdh') - -var publicEncrypt = require('public-encrypt') - -exports.publicEncrypt = publicEncrypt.publicEncrypt -exports.privateEncrypt = publicEncrypt.privateEncrypt -exports.publicDecrypt = publicEncrypt.publicDecrypt -exports.privateDecrypt = publicEncrypt.privateDecrypt - -// the least I can do is make error messages for the rest of the node.js/crypto api. -// ;[ -// 'createCredentials' -// ].forEach(function (name) { -// exports[name] = function () { -// throw new Error([ -// 'sorry, ' + name + ' is not implemented yet', -// 'we accept pull requests', -// 'https://github.com/crypto-browserify/crypto-browserify' -// ].join('\n')) -// } -// }) - -var rf = require('randomfill') - -exports.randomFill = rf.randomFill -exports.randomFillSync = rf.randomFillSync - -exports.createCredentials = function () { - throw new Error([ - 'sorry, createCredentials is not implemented yet', - 'we accept pull requests', - 'https://github.com/crypto-browserify/crypto-browserify' - ].join('\n')) -} - -exports.constants = { - 'DH_CHECK_P_NOT_SAFE_PRIME': 2, - 'DH_CHECK_P_NOT_PRIME': 1, - 'DH_UNABLE_TO_CHECK_GENERATOR': 4, - 'DH_NOT_SUITABLE_GENERATOR': 8, - 'NPN_ENABLED': 1, - 'ALPN_ENABLED': 1, - 'RSA_PKCS1_PADDING': 1, - 'RSA_SSLV23_PADDING': 2, - 'RSA_NO_PADDING': 3, - 'RSA_PKCS1_OAEP_PADDING': 4, - 'RSA_X931_PADDING': 5, - 'RSA_PKCS1_PSS_PADDING': 6, - 'POINT_CONVERSION_COMPRESSED': 2, - 'POINT_CONVERSION_UNCOMPRESSED': 4, - 'POINT_CONVERSION_HYBRID': 6 -} - -},{"browserify-cipher":72,"browserify-sign":79,"browserify-sign/algos":76,"create-ecdh":93,"create-hash":94,"create-hmac":96,"diffie-hellman":107,"pbkdf2":191,"public-encrypt":198,"randombytes":208,"randomfill":209}],99:[function(require,module,exports){ -(function (process){ -/** - * This is the web browser implementation of `debug()`. - * - * Expose `debug()` as the module. - */ - -exports = module.exports = require('./debug'); -exports.log = log; -exports.formatArgs = formatArgs; -exports.save = save; -exports.load = load; -exports.useColors = useColors; -exports.storage = 'undefined' != typeof chrome - && 'undefined' != typeof chrome.storage - ? chrome.storage.local - : localstorage(); - -/** - * Colors. - */ - -exports.colors = [ - 'lightseagreen', - 'forestgreen', - 'goldenrod', - 'dodgerblue', - 'darkorchid', - 'crimson' -]; - -/** - * Currently only WebKit-based Web Inspectors, Firefox >= v31, - * and the Firebug extension (any Firefox version) are known - * to support "%c" CSS customizations. - * - * TODO: add a `localStorage` variable to explicitly enable/disable colors - */ - -function useColors() { - // NB: In an Electron preload script, document will be defined but not fully - // initialized. Since we know we're in Chrome, we'll just detect this case - // explicitly - if (typeof window !== 'undefined' && window.process && window.process.type === 'renderer') { - return true; - } - - // is webkit? http://stackoverflow.com/a/16459606/376773 - // document is undefined in react-native: https://github.com/facebook/react-native/pull/1632 - return (typeof document !== 'undefined' && document.documentElement && document.documentElement.style && document.documentElement.style.WebkitAppearance) || - // is firebug? http://stackoverflow.com/a/398120/376773 - (typeof window !== 'undefined' && window.console && (window.console.firebug || (window.console.exception && window.console.table))) || - // is firefox >= v31? - // https://developer.mozilla.org/en-US/docs/Tools/Web_Console#Styling_messages - (typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/) && parseInt(RegExp.$1, 10) >= 31) || - // double check webkit in userAgent just in case we are in a worker - (typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)); -} - -/** - * Map %j to `JSON.stringify()`, since no Web Inspectors do that by default. - */ - -exports.formatters.j = function(v) { - try { - return JSON.stringify(v); - } catch (err) { - return '[UnexpectedJSONParseError]: ' + err.message; - } -}; - - -/** - * Colorize log arguments if enabled. - * - * @api public - */ - -function formatArgs(args) { - var useColors = this.useColors; - - args[0] = (useColors ? '%c' : '') - + this.namespace - + (useColors ? ' %c' : ' ') - + args[0] - + (useColors ? '%c ' : ' ') - + '+' + exports.humanize(this.diff); - - if (!useColors) return; - - var c = 'color: ' + this.color; - args.splice(1, 0, c, 'color: inherit') - - // the final "%c" is somewhat tricky, because there could be other - // arguments passed either before or after the %c, so we need to - // figure out the correct index to insert the CSS into - var index = 0; - var lastC = 0; - args[0].replace(/%[a-zA-Z%]/g, function(match) { - if ('%%' === match) return; - index++; - if ('%c' === match) { - // we only are interested in the *last* %c - // (the user may have provided their own) - lastC = index; - } - }); - - args.splice(lastC, 0, c); -} - -/** - * Invokes `console.log()` when available. - * No-op when `console.log` is not a "function". - * - * @api public - */ - -function log() { - // this hackery is required for IE8/9, where - // the `console.log` function doesn't have 'apply' - return 'object' === typeof console - && console.log - && Function.prototype.apply.call(console.log, console, arguments); -} - -/** - * Save `namespaces`. - * - * @param {String} namespaces - * @api private - */ - -function save(namespaces) { - try { - if (null == namespaces) { - exports.storage.removeItem('debug'); - } else { - exports.storage.debug = namespaces; - } - } catch(e) {} -} - -/** - * Load `namespaces`. - * - * @return {String} returns the previously persisted debug modes - * @api private - */ - -function load() { - var r; - try { - r = exports.storage.debug; - } catch(e) {} - - // If debug isn't set in LS, and we're in Electron, try to load $DEBUG - if (!r && typeof process !== 'undefined' && 'env' in process) { - r = process.env.DEBUG; - } - - return r; -} - -/** - * Enable namespaces listed in `localStorage.debug` initially. - */ - -exports.enable(load()); - -/** - * Localstorage attempts to return the localstorage. - * - * This is necessary because safari throws - * when a user disables cookies/localstorage - * and you attempt to access it. - * - * @return {LocalStorage} - * @api private - */ - -function localstorage() { - try { - return window.localStorage; - } catch (e) {} -} - -}).call(this,require('_process')) -},{"./debug":100,"_process":197}],100:[function(require,module,exports){ - -/** - * This is the common logic for both the Node.js and web browser - * implementations of `debug()`. - * - * Expose `debug()` as the module. - */ - -exports = module.exports = createDebug.debug = createDebug['default'] = createDebug; -exports.coerce = coerce; -exports.disable = disable; -exports.enable = enable; -exports.enabled = enabled; -exports.humanize = require('ms'); - -/** - * The currently active debug mode names, and names to skip. - */ - -exports.names = []; -exports.skips = []; - -/** - * Map of special "%n" handling functions, for the debug "format" argument. - * - * Valid key names are a single, lower or upper-case letter, i.e. "n" and "N". - */ - -exports.formatters = {}; - -/** - * Previous log timestamp. - */ - -var prevTime; - -/** - * Select a color. - * @param {String} namespace - * @return {Number} - * @api private - */ - -function selectColor(namespace) { - var hash = 0, i; - - for (i in namespace) { - hash = ((hash << 5) - hash) + namespace.charCodeAt(i); - hash |= 0; // Convert to 32bit integer - } - - return exports.colors[Math.abs(hash) % exports.colors.length]; -} - -/** - * Create a debugger with the given `namespace`. - * - * @param {String} namespace - * @return {Function} - * @api public - */ - -function createDebug(namespace) { - - function debug() { - // disabled? - if (!debug.enabled) return; - - var self = debug; - - // set `diff` timestamp - var curr = +new Date(); - var ms = curr - (prevTime || curr); - self.diff = ms; - self.prev = prevTime; - self.curr = curr; - prevTime = curr; - - // turn the `arguments` into a proper Array - var args = new Array(arguments.length); - for (var i = 0; i < args.length; i++) { - args[i] = arguments[i]; - } - - args[0] = exports.coerce(args[0]); - - if ('string' !== typeof args[0]) { - // anything else let's inspect with %O - args.unshift('%O'); - } - - // apply any `formatters` transformations - var index = 0; - args[0] = args[0].replace(/%([a-zA-Z%])/g, function(match, format) { - // if we encounter an escaped % then don't increase the array index - if (match === '%%') return match; - index++; - var formatter = exports.formatters[format]; - if ('function' === typeof formatter) { - var val = args[index]; - match = formatter.call(self, val); - - // now we need to remove `args[index]` since it's inlined in the `format` - args.splice(index, 1); - index--; - } - return match; - }); - - // apply env-specific formatting (colors, etc.) - exports.formatArgs.call(self, args); - - var logFn = debug.log || exports.log || console.log.bind(console); - logFn.apply(self, args); - } - - debug.namespace = namespace; - debug.enabled = exports.enabled(namespace); - debug.useColors = exports.useColors(); - debug.color = selectColor(namespace); - - // env-specific initialization logic for debug instances - if ('function' === typeof exports.init) { - exports.init(debug); - } - - return debug; -} - -/** - * Enables a debug mode by namespaces. This can include modes - * separated by a colon and wildcards. - * - * @param {String} namespaces - * @api public - */ - -function enable(namespaces) { - exports.save(namespaces); - - exports.names = []; - exports.skips = []; - - var split = (typeof namespaces === 'string' ? namespaces : '').split(/[\s,]+/); - var len = split.length; - - for (var i = 0; i < len; i++) { - if (!split[i]) continue; // ignore empty strings - namespaces = split[i].replace(/\*/g, '.*?'); - if (namespaces[0] === '-') { - exports.skips.push(new RegExp('^' + namespaces.substr(1) + '$')); - } else { - exports.names.push(new RegExp('^' + namespaces + '$')); - } - } -} - -/** - * Disable debug output. - * - * @api public - */ - -function disable() { - exports.enable(''); -} - -/** - * Returns true if the given mode name is enabled, false otherwise. - * - * @param {String} name - * @return {Boolean} - * @api public - */ - -function enabled(name) { - var i, len; - for (i = 0, len = exports.skips.length; i < len; i++) { - if (exports.skips[i].test(name)) { - return false; - } - } - for (i = 0, len = exports.names.length; i < len; i++) { - if (exports.names[i].test(name)) { - return true; - } - } - return false; -} - -/** - * Coerce `val`. - * - * @param {Mixed} val - * @return {Mixed} - * @api private - */ - -function coerce(val) { - if (val instanceof Error) return val.stack || val.message; - return val; -} - -},{"ms":166}],101:[function(require,module,exports){ -'use strict'; - -exports.utils = require('./des/utils'); -exports.Cipher = require('./des/cipher'); -exports.DES = require('./des/des'); -exports.CBC = require('./des/cbc'); -exports.EDE = require('./des/ede'); - -},{"./des/cbc":102,"./des/cipher":103,"./des/des":104,"./des/ede":105,"./des/utils":106}],102:[function(require,module,exports){ -'use strict'; - -var assert = require('minimalistic-assert'); -var inherits = require('inherits'); - -var proto = {}; - -function CBCState(iv) { - assert.equal(iv.length, 8, 'Invalid IV length'); - - this.iv = new Array(8); - for (var i = 0; i < this.iv.length; i++) - this.iv[i] = iv[i]; -} - -function instantiate(Base) { - function CBC(options) { - Base.call(this, options); - this._cbcInit(); - } - inherits(CBC, Base); - - var keys = Object.keys(proto); - for (var i = 0; i < keys.length; i++) { - var key = keys[i]; - CBC.prototype[key] = proto[key]; - } - - CBC.create = function create(options) { - return new CBC(options); - }; - - return CBC; -} - -exports.instantiate = instantiate; - -proto._cbcInit = function _cbcInit() { - var state = new CBCState(this.options.iv); - this._cbcState = state; -}; - -proto._update = function _update(inp, inOff, out, outOff) { - var state = this._cbcState; - var superProto = this.constructor.super_.prototype; - - var iv = state.iv; - if (this.type === 'encrypt') { - for (var i = 0; i < this.blockSize; i++) - iv[i] ^= inp[inOff + i]; - - superProto._update.call(this, iv, 0, out, outOff); - - for (var i = 0; i < this.blockSize; i++) - iv[i] = out[outOff + i]; - } else { - superProto._update.call(this, inp, inOff, out, outOff); - - for (var i = 0; i < this.blockSize; i++) - out[outOff + i] ^= iv[i]; - - for (var i = 0; i < this.blockSize; i++) - iv[i] = inp[inOff + i]; - } -}; - -},{"inherits":156,"minimalistic-assert":164}],103:[function(require,module,exports){ -'use strict'; - -var assert = require('minimalistic-assert'); - -function Cipher(options) { - this.options = options; - - this.type = this.options.type; - this.blockSize = 8; - this._init(); - - this.buffer = new Array(this.blockSize); - this.bufferOff = 0; -} -module.exports = Cipher; - -Cipher.prototype._init = function _init() { - // Might be overrided -}; - -Cipher.prototype.update = function update(data) { - if (data.length === 0) - return []; - - if (this.type === 'decrypt') - return this._updateDecrypt(data); - else - return this._updateEncrypt(data); -}; - -Cipher.prototype._buffer = function _buffer(data, off) { - // Append data to buffer - var min = Math.min(this.buffer.length - this.bufferOff, data.length - off); - for (var i = 0; i < min; i++) - this.buffer[this.bufferOff + i] = data[off + i]; - this.bufferOff += min; - - // Shift next - return min; -}; - -Cipher.prototype._flushBuffer = function _flushBuffer(out, off) { - this._update(this.buffer, 0, out, off); - this.bufferOff = 0; - return this.blockSize; -}; - -Cipher.prototype._updateEncrypt = function _updateEncrypt(data) { - var inputOff = 0; - var outputOff = 0; - - var count = ((this.bufferOff + data.length) / this.blockSize) | 0; - var out = new Array(count * this.blockSize); - - if (this.bufferOff !== 0) { - inputOff += this._buffer(data, inputOff); - - if (this.bufferOff === this.buffer.length) - outputOff += this._flushBuffer(out, outputOff); - } - - // Write blocks - var max = data.length - ((data.length - inputOff) % this.blockSize); - for (; inputOff < max; inputOff += this.blockSize) { - this._update(data, inputOff, out, outputOff); - outputOff += this.blockSize; - } - - // Queue rest - for (; inputOff < data.length; inputOff++, this.bufferOff++) - this.buffer[this.bufferOff] = data[inputOff]; - - return out; -}; - -Cipher.prototype._updateDecrypt = function _updateDecrypt(data) { - var inputOff = 0; - var outputOff = 0; - - var count = Math.ceil((this.bufferOff + data.length) / this.blockSize) - 1; - var out = new Array(count * this.blockSize); - - // TODO(indutny): optimize it, this is far from optimal - for (; count > 0; count--) { - inputOff += this._buffer(data, inputOff); - outputOff += this._flushBuffer(out, outputOff); - } - - // Buffer rest of the input - inputOff += this._buffer(data, inputOff); - - return out; -}; - -Cipher.prototype.final = function final(buffer) { - var first; - if (buffer) - first = this.update(buffer); - - var last; - if (this.type === 'encrypt') - last = this._finalEncrypt(); - else - last = this._finalDecrypt(); - - if (first) - return first.concat(last); - else - return last; -}; - -Cipher.prototype._pad = function _pad(buffer, off) { - if (off === 0) - return false; - - while (off < buffer.length) - buffer[off++] = 0; - - return true; -}; - -Cipher.prototype._finalEncrypt = function _finalEncrypt() { - if (!this._pad(this.buffer, this.bufferOff)) - return []; - - var out = new Array(this.blockSize); - this._update(this.buffer, 0, out, 0); - return out; -}; - -Cipher.prototype._unpad = function _unpad(buffer) { - return buffer; -}; - -Cipher.prototype._finalDecrypt = function _finalDecrypt() { - assert.equal(this.bufferOff, this.blockSize, 'Not enough data to decrypt'); - var out = new Array(this.blockSize); - this._flushBuffer(out, 0); - - return this._unpad(out); -}; - -},{"minimalistic-assert":164}],104:[function(require,module,exports){ -'use strict'; - -var assert = require('minimalistic-assert'); -var inherits = require('inherits'); - -var des = require('../des'); -var utils = des.utils; -var Cipher = des.Cipher; - -function DESState() { - this.tmp = new Array(2); - this.keys = null; -} - -function DES(options) { - Cipher.call(this, options); - - var state = new DESState(); - this._desState = state; - - this.deriveKeys(state, options.key); -} -inherits(DES, Cipher); -module.exports = DES; - -DES.create = function create(options) { - return new DES(options); -}; - -var shiftTable = [ - 1, 1, 2, 2, 2, 2, 2, 2, - 1, 2, 2, 2, 2, 2, 2, 1 -]; - -DES.prototype.deriveKeys = function deriveKeys(state, key) { - state.keys = new Array(16 * 2); - - assert.equal(key.length, this.blockSize, 'Invalid key length'); - - var kL = utils.readUInt32BE(key, 0); - var kR = utils.readUInt32BE(key, 4); - - utils.pc1(kL, kR, state.tmp, 0); - kL = state.tmp[0]; - kR = state.tmp[1]; - for (var i = 0; i < state.keys.length; i += 2) { - var shift = shiftTable[i >>> 1]; - kL = utils.r28shl(kL, shift); - kR = utils.r28shl(kR, shift); - utils.pc2(kL, kR, state.keys, i); - } -}; - -DES.prototype._update = function _update(inp, inOff, out, outOff) { - var state = this._desState; - - var l = utils.readUInt32BE(inp, inOff); - var r = utils.readUInt32BE(inp, inOff + 4); - - // Initial Permutation - utils.ip(l, r, state.tmp, 0); - l = state.tmp[0]; - r = state.tmp[1]; - - if (this.type === 'encrypt') - this._encrypt(state, l, r, state.tmp, 0); - else - this._decrypt(state, l, r, state.tmp, 0); - - l = state.tmp[0]; - r = state.tmp[1]; - - utils.writeUInt32BE(out, l, outOff); - utils.writeUInt32BE(out, r, outOff + 4); -}; - -DES.prototype._pad = function _pad(buffer, off) { - var value = buffer.length - off; - for (var i = off; i < buffer.length; i++) - buffer[i] = value; - - return true; -}; - -DES.prototype._unpad = function _unpad(buffer) { - var pad = buffer[buffer.length - 1]; - for (var i = buffer.length - pad; i < buffer.length; i++) - assert.equal(buffer[i], pad); - - return buffer.slice(0, buffer.length - pad); -}; - -DES.prototype._encrypt = function _encrypt(state, lStart, rStart, out, off) { - var l = lStart; - var r = rStart; - - // Apply f() x16 times - for (var i = 0; i < state.keys.length; i += 2) { - var keyL = state.keys[i]; - var keyR = state.keys[i + 1]; - - // f(r, k) - utils.expand(r, state.tmp, 0); - - keyL ^= state.tmp[0]; - keyR ^= state.tmp[1]; - var s = utils.substitute(keyL, keyR); - var f = utils.permute(s); - - var t = r; - r = (l ^ f) >>> 0; - l = t; - } - - // Reverse Initial Permutation - utils.rip(r, l, out, off); -}; - -DES.prototype._decrypt = function _decrypt(state, lStart, rStart, out, off) { - var l = rStart; - var r = lStart; - - // Apply f() x16 times - for (var i = state.keys.length - 2; i >= 0; i -= 2) { - var keyL = state.keys[i]; - var keyR = state.keys[i + 1]; - - // f(r, k) - utils.expand(l, state.tmp, 0); - - keyL ^= state.tmp[0]; - keyR ^= state.tmp[1]; - var s = utils.substitute(keyL, keyR); - var f = utils.permute(s); - - var t = l; - l = (r ^ f) >>> 0; - r = t; - } - - // Reverse Initial Permutation - utils.rip(l, r, out, off); -}; - -},{"../des":101,"inherits":156,"minimalistic-assert":164}],105:[function(require,module,exports){ -'use strict'; - -var assert = require('minimalistic-assert'); -var inherits = require('inherits'); - -var des = require('../des'); -var Cipher = des.Cipher; -var DES = des.DES; - -function EDEState(type, key) { - assert.equal(key.length, 24, 'Invalid key length'); - - var k1 = key.slice(0, 8); - var k2 = key.slice(8, 16); - var k3 = key.slice(16, 24); - - if (type === 'encrypt') { - this.ciphers = [ - DES.create({ type: 'encrypt', key: k1 }), - DES.create({ type: 'decrypt', key: k2 }), - DES.create({ type: 'encrypt', key: k3 }) - ]; - } else { - this.ciphers = [ - DES.create({ type: 'decrypt', key: k3 }), - DES.create({ type: 'encrypt', key: k2 }), - DES.create({ type: 'decrypt', key: k1 }) - ]; - } -} - -function EDE(options) { - Cipher.call(this, options); - - var state = new EDEState(this.type, this.options.key); - this._edeState = state; -} -inherits(EDE, Cipher); - -module.exports = EDE; - -EDE.create = function create(options) { - return new EDE(options); -}; - -EDE.prototype._update = function _update(inp, inOff, out, outOff) { - var state = this._edeState; - - state.ciphers[0]._update(inp, inOff, out, outOff); - state.ciphers[1]._update(out, outOff, out, outOff); - state.ciphers[2]._update(out, outOff, out, outOff); -}; - -EDE.prototype._pad = DES.prototype._pad; -EDE.prototype._unpad = DES.prototype._unpad; - -},{"../des":101,"inherits":156,"minimalistic-assert":164}],106:[function(require,module,exports){ -'use strict'; - -exports.readUInt32BE = function readUInt32BE(bytes, off) { - var res = (bytes[0 + off] << 24) | - (bytes[1 + off] << 16) | - (bytes[2 + off] << 8) | - bytes[3 + off]; - return res >>> 0; -}; - -exports.writeUInt32BE = function writeUInt32BE(bytes, value, off) { - bytes[0 + off] = value >>> 24; - bytes[1 + off] = (value >>> 16) & 0xff; - bytes[2 + off] = (value >>> 8) & 0xff; - bytes[3 + off] = value & 0xff; -}; - -exports.ip = function ip(inL, inR, out, off) { - var outL = 0; - var outR = 0; - - for (var i = 6; i >= 0; i -= 2) { - for (var j = 0; j <= 24; j += 8) { - outL <<= 1; - outL |= (inR >>> (j + i)) & 1; - } - for (var j = 0; j <= 24; j += 8) { - outL <<= 1; - outL |= (inL >>> (j + i)) & 1; - } - } - - for (var i = 6; i >= 0; i -= 2) { - for (var j = 1; j <= 25; j += 8) { - outR <<= 1; - outR |= (inR >>> (j + i)) & 1; - } - for (var j = 1; j <= 25; j += 8) { - outR <<= 1; - outR |= (inL >>> (j + i)) & 1; - } - } - - out[off + 0] = outL >>> 0; - out[off + 1] = outR >>> 0; -}; - -exports.rip = function rip(inL, inR, out, off) { - var outL = 0; - var outR = 0; - - for (var i = 0; i < 4; i++) { - for (var j = 24; j >= 0; j -= 8) { - outL <<= 1; - outL |= (inR >>> (j + i)) & 1; - outL <<= 1; - outL |= (inL >>> (j + i)) & 1; - } - } - for (var i = 4; i < 8; i++) { - for (var j = 24; j >= 0; j -= 8) { - outR <<= 1; - outR |= (inR >>> (j + i)) & 1; - outR <<= 1; - outR |= (inL >>> (j + i)) & 1; - } - } - - out[off + 0] = outL >>> 0; - out[off + 1] = outR >>> 0; -}; - -exports.pc1 = function pc1(inL, inR, out, off) { - var outL = 0; - var outR = 0; - - // 7, 15, 23, 31, 39, 47, 55, 63 - // 6, 14, 22, 30, 39, 47, 55, 63 - // 5, 13, 21, 29, 39, 47, 55, 63 - // 4, 12, 20, 28 - for (var i = 7; i >= 5; i--) { - for (var j = 0; j <= 24; j += 8) { - outL <<= 1; - outL |= (inR >> (j + i)) & 1; - } - for (var j = 0; j <= 24; j += 8) { - outL <<= 1; - outL |= (inL >> (j + i)) & 1; - } - } - for (var j = 0; j <= 24; j += 8) { - outL <<= 1; - outL |= (inR >> (j + i)) & 1; - } - - // 1, 9, 17, 25, 33, 41, 49, 57 - // 2, 10, 18, 26, 34, 42, 50, 58 - // 3, 11, 19, 27, 35, 43, 51, 59 - // 36, 44, 52, 60 - for (var i = 1; i <= 3; i++) { - for (var j = 0; j <= 24; j += 8) { - outR <<= 1; - outR |= (inR >> (j + i)) & 1; - } - for (var j = 0; j <= 24; j += 8) { - outR <<= 1; - outR |= (inL >> (j + i)) & 1; - } - } - for (var j = 0; j <= 24; j += 8) { - outR <<= 1; - outR |= (inL >> (j + i)) & 1; - } - - out[off + 0] = outL >>> 0; - out[off + 1] = outR >>> 0; -}; - -exports.r28shl = function r28shl(num, shift) { - return ((num << shift) & 0xfffffff) | (num >>> (28 - shift)); -}; - -var pc2table = [ - // inL => outL - 14, 11, 17, 4, 27, 23, 25, 0, - 13, 22, 7, 18, 5, 9, 16, 24, - 2, 20, 12, 21, 1, 8, 15, 26, - - // inR => outR - 15, 4, 25, 19, 9, 1, 26, 16, - 5, 11, 23, 8, 12, 7, 17, 0, - 22, 3, 10, 14, 6, 20, 27, 24 -]; - -exports.pc2 = function pc2(inL, inR, out, off) { - var outL = 0; - var outR = 0; - - var len = pc2table.length >>> 1; - for (var i = 0; i < len; i++) { - outL <<= 1; - outL |= (inL >>> pc2table[i]) & 0x1; - } - for (var i = len; i < pc2table.length; i++) { - outR <<= 1; - outR |= (inR >>> pc2table[i]) & 0x1; - } - - out[off + 0] = outL >>> 0; - out[off + 1] = outR >>> 0; -}; - -exports.expand = function expand(r, out, off) { - var outL = 0; - var outR = 0; - - outL = ((r & 1) << 5) | (r >>> 27); - for (var i = 23; i >= 15; i -= 4) { - outL <<= 6; - outL |= (r >>> i) & 0x3f; - } - for (var i = 11; i >= 3; i -= 4) { - outR |= (r >>> i) & 0x3f; - outR <<= 6; - } - outR |= ((r & 0x1f) << 1) | (r >>> 31); - - out[off + 0] = outL >>> 0; - out[off + 1] = outR >>> 0; -}; - -var sTable = [ - 14, 0, 4, 15, 13, 7, 1, 4, 2, 14, 15, 2, 11, 13, 8, 1, - 3, 10, 10, 6, 6, 12, 12, 11, 5, 9, 9, 5, 0, 3, 7, 8, - 4, 15, 1, 12, 14, 8, 8, 2, 13, 4, 6, 9, 2, 1, 11, 7, - 15, 5, 12, 11, 9, 3, 7, 14, 3, 10, 10, 0, 5, 6, 0, 13, - - 15, 3, 1, 13, 8, 4, 14, 7, 6, 15, 11, 2, 3, 8, 4, 14, - 9, 12, 7, 0, 2, 1, 13, 10, 12, 6, 0, 9, 5, 11, 10, 5, - 0, 13, 14, 8, 7, 10, 11, 1, 10, 3, 4, 15, 13, 4, 1, 2, - 5, 11, 8, 6, 12, 7, 6, 12, 9, 0, 3, 5, 2, 14, 15, 9, - - 10, 13, 0, 7, 9, 0, 14, 9, 6, 3, 3, 4, 15, 6, 5, 10, - 1, 2, 13, 8, 12, 5, 7, 14, 11, 12, 4, 11, 2, 15, 8, 1, - 13, 1, 6, 10, 4, 13, 9, 0, 8, 6, 15, 9, 3, 8, 0, 7, - 11, 4, 1, 15, 2, 14, 12, 3, 5, 11, 10, 5, 14, 2, 7, 12, - - 7, 13, 13, 8, 14, 11, 3, 5, 0, 6, 6, 15, 9, 0, 10, 3, - 1, 4, 2, 7, 8, 2, 5, 12, 11, 1, 12, 10, 4, 14, 15, 9, - 10, 3, 6, 15, 9, 0, 0, 6, 12, 10, 11, 1, 7, 13, 13, 8, - 15, 9, 1, 4, 3, 5, 14, 11, 5, 12, 2, 7, 8, 2, 4, 14, - - 2, 14, 12, 11, 4, 2, 1, 12, 7, 4, 10, 7, 11, 13, 6, 1, - 8, 5, 5, 0, 3, 15, 15, 10, 13, 3, 0, 9, 14, 8, 9, 6, - 4, 11, 2, 8, 1, 12, 11, 7, 10, 1, 13, 14, 7, 2, 8, 13, - 15, 6, 9, 15, 12, 0, 5, 9, 6, 10, 3, 4, 0, 5, 14, 3, - - 12, 10, 1, 15, 10, 4, 15, 2, 9, 7, 2, 12, 6, 9, 8, 5, - 0, 6, 13, 1, 3, 13, 4, 14, 14, 0, 7, 11, 5, 3, 11, 8, - 9, 4, 14, 3, 15, 2, 5, 12, 2, 9, 8, 5, 12, 15, 3, 10, - 7, 11, 0, 14, 4, 1, 10, 7, 1, 6, 13, 0, 11, 8, 6, 13, - - 4, 13, 11, 0, 2, 11, 14, 7, 15, 4, 0, 9, 8, 1, 13, 10, - 3, 14, 12, 3, 9, 5, 7, 12, 5, 2, 10, 15, 6, 8, 1, 6, - 1, 6, 4, 11, 11, 13, 13, 8, 12, 1, 3, 4, 7, 10, 14, 7, - 10, 9, 15, 5, 6, 0, 8, 15, 0, 14, 5, 2, 9, 3, 2, 12, - - 13, 1, 2, 15, 8, 13, 4, 8, 6, 10, 15, 3, 11, 7, 1, 4, - 10, 12, 9, 5, 3, 6, 14, 11, 5, 0, 0, 14, 12, 9, 7, 2, - 7, 2, 11, 1, 4, 14, 1, 7, 9, 4, 12, 10, 14, 8, 2, 13, - 0, 15, 6, 12, 10, 9, 13, 0, 15, 3, 3, 5, 5, 6, 8, 11 -]; - -exports.substitute = function substitute(inL, inR) { - var out = 0; - for (var i = 0; i < 4; i++) { - var b = (inL >>> (18 - i * 6)) & 0x3f; - var sb = sTable[i * 0x40 + b]; - - out <<= 4; - out |= sb; - } - for (var i = 0; i < 4; i++) { - var b = (inR >>> (18 - i * 6)) & 0x3f; - var sb = sTable[4 * 0x40 + i * 0x40 + b]; - - out <<= 4; - out |= sb; - } - return out >>> 0; -}; - -var permuteTable = [ - 16, 25, 12, 11, 3, 20, 4, 15, 31, 17, 9, 6, 27, 14, 1, 22, - 30, 24, 8, 18, 0, 5, 29, 23, 13, 19, 2, 26, 10, 21, 28, 7 -]; - -exports.permute = function permute(num) { - var out = 0; - for (var i = 0; i < permuteTable.length; i++) { - out <<= 1; - out |= (num >>> permuteTable[i]) & 0x1; - } - return out >>> 0; -}; - -exports.padSplit = function padSplit(num, size, group) { - var str = num.toString(2); - while (str.length < size) - str = '0' + str; - - var out = []; - for (var i = 0; i < size; i += group) - out.push(str.slice(i, i + group)); - return out.join(' '); -}; - -},{}],107:[function(require,module,exports){ -(function (Buffer){ -var generatePrime = require('./lib/generatePrime') -var primes = require('./lib/primes.json') - -var DH = require('./lib/dh') - -function getDiffieHellman (mod) { - var prime = new Buffer(primes[mod].prime, 'hex') - var gen = new Buffer(primes[mod].gen, 'hex') - - return new DH(prime, gen) -} - -var ENCODINGS = { - 'binary': true, 'hex': true, 'base64': true -} - -function createDiffieHellman (prime, enc, generator, genc) { - if (Buffer.isBuffer(enc) || ENCODINGS[enc] === undefined) { - return createDiffieHellman(prime, 'binary', enc, generator) - } - - enc = enc || 'binary' - genc = genc || 'binary' - generator = generator || new Buffer([2]) - - if (!Buffer.isBuffer(generator)) { - generator = new Buffer(generator, genc) - } - - if (typeof prime === 'number') { - return new DH(generatePrime(prime, generator), generator, true) - } - - if (!Buffer.isBuffer(prime)) { - prime = new Buffer(prime, enc) - } - - return new DH(prime, generator, true) -} - -exports.DiffieHellmanGroup = exports.createDiffieHellmanGroup = exports.getDiffieHellman = getDiffieHellman -exports.createDiffieHellman = exports.DiffieHellman = createDiffieHellman - -}).call(this,require("buffer").Buffer) -},{"./lib/dh":108,"./lib/generatePrime":109,"./lib/primes.json":110,"buffer":89}],108:[function(require,module,exports){ -(function (Buffer){ -var BN = require('bn.js'); -var MillerRabin = require('miller-rabin'); -var millerRabin = new MillerRabin(); -var TWENTYFOUR = new BN(24); -var ELEVEN = new BN(11); -var TEN = new BN(10); -var THREE = new BN(3); -var SEVEN = new BN(7); -var primes = require('./generatePrime'); -var randomBytes = require('randombytes'); -module.exports = DH; - -function setPublicKey(pub, enc) { - enc = enc || 'utf8'; - if (!Buffer.isBuffer(pub)) { - pub = new Buffer(pub, enc); - } - this._pub = new BN(pub); - return this; -} - -function setPrivateKey(priv, enc) { - enc = enc || 'utf8'; - if (!Buffer.isBuffer(priv)) { - priv = new Buffer(priv, enc); - } - this._priv = new BN(priv); - return this; -} - -var primeCache = {}; -function checkPrime(prime, generator) { - var gen = generator.toString('hex'); - var hex = [gen, prime.toString(16)].join('_'); - if (hex in primeCache) { - return primeCache[hex]; - } - var error = 0; - - if (prime.isEven() || - !primes.simpleSieve || - !primes.fermatTest(prime) || - !millerRabin.test(prime)) { - //not a prime so +1 - error += 1; - - if (gen === '02' || gen === '05') { - // we'd be able to check the generator - // it would fail so +8 - error += 8; - } else { - //we wouldn't be able to test the generator - // so +4 - error += 4; - } - primeCache[hex] = error; - return error; - } - if (!millerRabin.test(prime.shrn(1))) { - //not a safe prime - error += 2; - } - var rem; - switch (gen) { - case '02': - if (prime.mod(TWENTYFOUR).cmp(ELEVEN)) { - // unsuidable generator - error += 8; - } - break; - case '05': - rem = prime.mod(TEN); - if (rem.cmp(THREE) && rem.cmp(SEVEN)) { - // prime mod 10 needs to equal 3 or 7 - error += 8; - } - break; - default: - error += 4; - } - primeCache[hex] = error; - return error; -} - -function DH(prime, generator, malleable) { - this.setGenerator(generator); - this.__prime = new BN(prime); - this._prime = BN.mont(this.__prime); - this._primeLen = prime.length; - this._pub = undefined; - this._priv = undefined; - this._primeCode = undefined; - if (malleable) { - this.setPublicKey = setPublicKey; - this.setPrivateKey = setPrivateKey; - } else { - this._primeCode = 8; - } -} -Object.defineProperty(DH.prototype, 'verifyError', { - enumerable: true, - get: function () { - if (typeof this._primeCode !== 'number') { - this._primeCode = checkPrime(this.__prime, this.__gen); - } - return this._primeCode; - } -}); -DH.prototype.generateKeys = function () { - if (!this._priv) { - this._priv = new BN(randomBytes(this._primeLen)); - } - this._pub = this._gen.toRed(this._prime).redPow(this._priv).fromRed(); - return this.getPublicKey(); -}; - -DH.prototype.computeSecret = function (other) { - other = new BN(other); - other = other.toRed(this._prime); - var secret = other.redPow(this._priv).fromRed(); - var out = new Buffer(secret.toArray()); - var prime = this.getPrime(); - if (out.length < prime.length) { - var front = new Buffer(prime.length - out.length); - front.fill(0); - out = Buffer.concat([front, out]); - } - return out; -}; - -DH.prototype.getPublicKey = function getPublicKey(enc) { - return formatReturnValue(this._pub, enc); -}; - -DH.prototype.getPrivateKey = function getPrivateKey(enc) { - return formatReturnValue(this._priv, enc); -}; - -DH.prototype.getPrime = function (enc) { - return formatReturnValue(this.__prime, enc); -}; - -DH.prototype.getGenerator = function (enc) { - return formatReturnValue(this._gen, enc); -}; - -DH.prototype.setGenerator = function (gen, enc) { - enc = enc || 'utf8'; - if (!Buffer.isBuffer(gen)) { - gen = new Buffer(gen, enc); - } - this.__gen = gen; - this._gen = new BN(gen); - return this; -}; - -function formatReturnValue(bn, enc) { - var buf = new Buffer(bn.toArray()); - if (!enc) { - return buf; - } else { - return buf.toString(enc); - } -} - -}).call(this,require("buffer").Buffer) -},{"./generatePrime":109,"bn.js":52,"buffer":89,"miller-rabin":163,"randombytes":208}],109:[function(require,module,exports){ -var randomBytes = require('randombytes'); -module.exports = findPrime; -findPrime.simpleSieve = simpleSieve; -findPrime.fermatTest = fermatTest; -var BN = require('bn.js'); -var TWENTYFOUR = new BN(24); -var MillerRabin = require('miller-rabin'); -var millerRabin = new MillerRabin(); -var ONE = new BN(1); -var TWO = new BN(2); -var FIVE = new BN(5); -var SIXTEEN = new BN(16); -var EIGHT = new BN(8); -var TEN = new BN(10); -var THREE = new BN(3); -var SEVEN = new BN(7); -var ELEVEN = new BN(11); -var FOUR = new BN(4); -var TWELVE = new BN(12); -var primes = null; - -function _getPrimes() { - if (primes !== null) - return primes; - - var limit = 0x100000; - var res = []; - res[0] = 2; - for (var i = 1, k = 3; k < limit; k += 2) { - var sqrt = Math.ceil(Math.sqrt(k)); - for (var j = 0; j < i && res[j] <= sqrt; j++) - if (k % res[j] === 0) - break; - - if (i !== j && res[j] <= sqrt) - continue; - - res[i++] = k; - } - primes = res; - return res; -} - -function simpleSieve(p) { - var primes = _getPrimes(); - - for (var i = 0; i < primes.length; i++) - if (p.modn(primes[i]) === 0) { - if (p.cmpn(primes[i]) === 0) { - return true; - } else { - return false; - } - } - - return true; -} - -function fermatTest(p) { - var red = BN.mont(p); - return TWO.toRed(red).redPow(p.subn(1)).fromRed().cmpn(1) === 0; -} - -function findPrime(bits, gen) { - if (bits < 16) { - // this is what openssl does - if (gen === 2 || gen === 5) { - return new BN([0x8c, 0x7b]); - } else { - return new BN([0x8c, 0x27]); - } - } - gen = new BN(gen); - - var num, n2; - - while (true) { - num = new BN(randomBytes(Math.ceil(bits / 8))); - while (num.bitLength() > bits) { - num.ishrn(1); - } - if (num.isEven()) { - num.iadd(ONE); - } - if (!num.testn(1)) { - num.iadd(TWO); - } - if (!gen.cmp(TWO)) { - while (num.mod(TWENTYFOUR).cmp(ELEVEN)) { - num.iadd(FOUR); - } - } else if (!gen.cmp(FIVE)) { - while (num.mod(TEN).cmp(THREE)) { - num.iadd(FOUR); - } - } - n2 = num.shrn(1); - if (simpleSieve(n2) && simpleSieve(num) && - fermatTest(n2) && fermatTest(num) && - millerRabin.test(n2) && millerRabin.test(num)) { - return num; - } - } - -} - -},{"bn.js":52,"miller-rabin":163,"randombytes":208}],110:[function(require,module,exports){ -module.exports={ - "modp1": { - "gen": "02", - "prime": "ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a63a3620ffffffffffffffff" - }, - "modp2": { - "gen": "02", - "prime": "ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece65381ffffffffffffffff" - }, - "modp5": { - "gen": "02", - "prime": "ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca237327ffffffffffffffff" - }, - "modp14": { - "gen": "02", - "prime": "ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aacaa68ffffffffffffffff" - }, - "modp15": { - "gen": "02", - "prime": "ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aaac42dad33170d04507a33a85521abdf1cba64ecfb850458dbef0a8aea71575d060c7db3970f85a6e1e4c7abf5ae8cdb0933d71e8c94e04a25619dcee3d2261ad2ee6bf12ffa06d98a0864d87602733ec86a64521f2b18177b200cbbe117577a615d6c770988c0bad946e208e24fa074e5ab3143db5bfce0fd108e4b82d120a93ad2caffffffffffffffff" - }, - "modp16": { - "gen": "02", - "prime": "ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aaac42dad33170d04507a33a85521abdf1cba64ecfb850458dbef0a8aea71575d060c7db3970f85a6e1e4c7abf5ae8cdb0933d71e8c94e04a25619dcee3d2261ad2ee6bf12ffa06d98a0864d87602733ec86a64521f2b18177b200cbbe117577a615d6c770988c0bad946e208e24fa074e5ab3143db5bfce0fd108e4b82d120a92108011a723c12a787e6d788719a10bdba5b2699c327186af4e23c1a946834b6150bda2583e9ca2ad44ce8dbbbc2db04de8ef92e8efc141fbecaa6287c59474e6bc05d99b2964fa090c3a2233ba186515be7ed1f612970cee2d7afb81bdd762170481cd0069127d5b05aa993b4ea988d8fddc186ffb7dc90a6c08f4df435c934063199ffffffffffffffff" - }, - "modp17": { - "gen": "02", - "prime": "ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aaac42dad33170d04507a33a85521abdf1cba64ecfb850458dbef0a8aea71575d060c7db3970f85a6e1e4c7abf5ae8cdb0933d71e8c94e04a25619dcee3d2261ad2ee6bf12ffa06d98a0864d87602733ec86a64521f2b18177b200cbbe117577a615d6c770988c0bad946e208e24fa074e5ab3143db5bfce0fd108e4b82d120a92108011a723c12a787e6d788719a10bdba5b2699c327186af4e23c1a946834b6150bda2583e9ca2ad44ce8dbbbc2db04de8ef92e8efc141fbecaa6287c59474e6bc05d99b2964fa090c3a2233ba186515be7ed1f612970cee2d7afb81bdd762170481cd0069127d5b05aa993b4ea988d8fddc186ffb7dc90a6c08f4df435c93402849236c3fab4d27c7026c1d4dcb2602646dec9751e763dba37bdf8ff9406ad9e530ee5db382f413001aeb06a53ed9027d831179727b0865a8918da3edbebcf9b14ed44ce6cbaced4bb1bdb7f1447e6cc254b332051512bd7af426fb8f401378cd2bf5983ca01c64b92ecf032ea15d1721d03f482d7ce6e74fef6d55e702f46980c82b5a84031900b1c9e59e7c97fbec7e8f323a97a7e36cc88be0f1d45b7ff585ac54bd407b22b4154aacc8f6d7ebf48e1d814cc5ed20f8037e0a79715eef29be32806a1d58bb7c5da76f550aa3d8a1fbff0eb19ccb1a313d55cda56c9ec2ef29632387fe8d76e3c0468043e8f663f4860ee12bf2d5b0b7474d6e694f91e6dcc4024ffffffffffffffff" - }, - "modp18": { - "gen": "02", - "prime": "ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aaac42dad33170d04507a33a85521abdf1cba64ecfb850458dbef0a8aea71575d060c7db3970f85a6e1e4c7abf5ae8cdb0933d71e8c94e04a25619dcee3d2261ad2ee6bf12ffa06d98a0864d87602733ec86a64521f2b18177b200cbbe117577a615d6c770988c0bad946e208e24fa074e5ab3143db5bfce0fd108e4b82d120a92108011a723c12a787e6d788719a10bdba5b2699c327186af4e23c1a946834b6150bda2583e9ca2ad44ce8dbbbc2db04de8ef92e8efc141fbecaa6287c59474e6bc05d99b2964fa090c3a2233ba186515be7ed1f612970cee2d7afb81bdd762170481cd0069127d5b05aa993b4ea988d8fddc186ffb7dc90a6c08f4df435c93402849236c3fab4d27c7026c1d4dcb2602646dec9751e763dba37bdf8ff9406ad9e530ee5db382f413001aeb06a53ed9027d831179727b0865a8918da3edbebcf9b14ed44ce6cbaced4bb1bdb7f1447e6cc254b332051512bd7af426fb8f401378cd2bf5983ca01c64b92ecf032ea15d1721d03f482d7ce6e74fef6d55e702f46980c82b5a84031900b1c9e59e7c97fbec7e8f323a97a7e36cc88be0f1d45b7ff585ac54bd407b22b4154aacc8f6d7ebf48e1d814cc5ed20f8037e0a79715eef29be32806a1d58bb7c5da76f550aa3d8a1fbff0eb19ccb1a313d55cda56c9ec2ef29632387fe8d76e3c0468043e8f663f4860ee12bf2d5b0b7474d6e694f91e6dbe115974a3926f12fee5e438777cb6a932df8cd8bec4d073b931ba3bc832b68d9dd300741fa7bf8afc47ed2576f6936ba424663aab639c5ae4f5683423b4742bf1c978238f16cbe39d652de3fdb8befc848ad922222e04a4037c0713eb57a81a23f0c73473fc646cea306b4bcbc8862f8385ddfa9d4b7fa2c087e879683303ed5bdd3a062b3cf5b3a278a66d2a13f83f44f82ddf310ee074ab6a364597e899a0255dc164f31cc50846851df9ab48195ded7ea1b1d510bd7ee74d73faf36bc31ecfa268359046f4eb879f924009438b481c6cd7889a002ed5ee382bc9190da6fc026e479558e4475677e9aa9e3050e2765694dfc81f56e880b96e7160c980dd98edd3dfffffffffffffffff" - } -} -},{}],111:[function(require,module,exports){ -'use strict'; - -var elliptic = exports; - -elliptic.version = require('../package.json').version; -elliptic.utils = require('./elliptic/utils'); -elliptic.rand = require('brorand'); -elliptic.curve = require('./elliptic/curve'); -elliptic.curves = require('./elliptic/curves'); - -// Protocols -elliptic.ec = require('./elliptic/ec'); -elliptic.eddsa = require('./elliptic/eddsa'); - -},{"../package.json":126,"./elliptic/curve":114,"./elliptic/curves":117,"./elliptic/ec":118,"./elliptic/eddsa":121,"./elliptic/utils":125,"brorand":53}],112:[function(require,module,exports){ -'use strict'; - -var BN = require('bn.js'); -var utils = require('../utils'); -var getNAF = utils.getNAF; -var getJSF = utils.getJSF; -var assert = utils.assert; - -function BaseCurve(type, conf) { - this.type = type; - this.p = new BN(conf.p, 16); - - // Use Montgomery, when there is no fast reduction for the prime - this.red = conf.prime ? BN.red(conf.prime) : BN.mont(this.p); - - // Useful for many curves - this.zero = new BN(0).toRed(this.red); - this.one = new BN(1).toRed(this.red); - this.two = new BN(2).toRed(this.red); - - // Curve configuration, optional - this.n = conf.n && new BN(conf.n, 16); - this.g = conf.g && this.pointFromJSON(conf.g, conf.gRed); - - // Temporary arrays - this._wnafT1 = new Array(4); - this._wnafT2 = new Array(4); - this._wnafT3 = new Array(4); - this._wnafT4 = new Array(4); - - this._bitLength = this.n ? this.n.bitLength() : 0; - - // Generalized Greg Maxwell's trick - var adjustCount = this.n && this.p.div(this.n); - if (!adjustCount || adjustCount.cmpn(100) > 0) { - this.redN = null; - } else { - this._maxwellTrick = true; - this.redN = this.n.toRed(this.red); - } -} -module.exports = BaseCurve; - -BaseCurve.prototype.point = function point() { - throw new Error('Not implemented'); -}; - -BaseCurve.prototype.validate = function validate() { - throw new Error('Not implemented'); -}; - -BaseCurve.prototype._fixedNafMul = function _fixedNafMul(p, k) { - assert(p.precomputed); - var doubles = p._getDoubles(); - - var naf = getNAF(k, 1, this._bitLength); - var I = (1 << (doubles.step + 1)) - (doubles.step % 2 === 0 ? 2 : 1); - I /= 3; - - // Translate into more windowed form - var repr = []; - for (var j = 0; j < naf.length; j += doubles.step) { - var nafW = 0; - for (var k = j + doubles.step - 1; k >= j; k--) - nafW = (nafW << 1) + naf[k]; - repr.push(nafW); - } - - var a = this.jpoint(null, null, null); - var b = this.jpoint(null, null, null); - for (var i = I; i > 0; i--) { - for (var j = 0; j < repr.length; j++) { - var nafW = repr[j]; - if (nafW === i) - b = b.mixedAdd(doubles.points[j]); - else if (nafW === -i) - b = b.mixedAdd(doubles.points[j].neg()); - } - a = a.add(b); - } - return a.toP(); -}; - -BaseCurve.prototype._wnafMul = function _wnafMul(p, k) { - var w = 4; - - // Precompute window - var nafPoints = p._getNAFPoints(w); - w = nafPoints.wnd; - var wnd = nafPoints.points; - - // Get NAF form - var naf = getNAF(k, w, this._bitLength); - - // Add `this`*(N+1) for every w-NAF index - var acc = this.jpoint(null, null, null); - for (var i = naf.length - 1; i >= 0; i--) { - // Count zeroes - for (var k = 0; i >= 0 && naf[i] === 0; i--) - k++; - if (i >= 0) - k++; - acc = acc.dblp(k); - - if (i < 0) - break; - var z = naf[i]; - assert(z !== 0); - if (p.type === 'affine') { - // J +- P - if (z > 0) - acc = acc.mixedAdd(wnd[(z - 1) >> 1]); - else - acc = acc.mixedAdd(wnd[(-z - 1) >> 1].neg()); - } else { - // J +- J - if (z > 0) - acc = acc.add(wnd[(z - 1) >> 1]); - else - acc = acc.add(wnd[(-z - 1) >> 1].neg()); - } - } - return p.type === 'affine' ? acc.toP() : acc; -}; - -BaseCurve.prototype._wnafMulAdd = function _wnafMulAdd(defW, - points, - coeffs, - len, - jacobianResult) { - var wndWidth = this._wnafT1; - var wnd = this._wnafT2; - var naf = this._wnafT3; - - // Fill all arrays - var max = 0; - for (var i = 0; i < len; i++) { - var p = points[i]; - var nafPoints = p._getNAFPoints(defW); - wndWidth[i] = nafPoints.wnd; - wnd[i] = nafPoints.points; - } - - // Comb small window NAFs - for (var i = len - 1; i >= 1; i -= 2) { - var a = i - 1; - var b = i; - if (wndWidth[a] !== 1 || wndWidth[b] !== 1) { - naf[a] = getNAF(coeffs[a], wndWidth[a], this._bitLength); - naf[b] = getNAF(coeffs[b], wndWidth[b], this._bitLength); - max = Math.max(naf[a].length, max); - max = Math.max(naf[b].length, max); - continue; - } - - var comb = [ - points[a], /* 1 */ - null, /* 3 */ - null, /* 5 */ - points[b] /* 7 */ - ]; - - // Try to avoid Projective points, if possible - if (points[a].y.cmp(points[b].y) === 0) { - comb[1] = points[a].add(points[b]); - comb[2] = points[a].toJ().mixedAdd(points[b].neg()); - } else if (points[a].y.cmp(points[b].y.redNeg()) === 0) { - comb[1] = points[a].toJ().mixedAdd(points[b]); - comb[2] = points[a].add(points[b].neg()); - } else { - comb[1] = points[a].toJ().mixedAdd(points[b]); - comb[2] = points[a].toJ().mixedAdd(points[b].neg()); - } - - var index = [ - -3, /* -1 -1 */ - -1, /* -1 0 */ - -5, /* -1 1 */ - -7, /* 0 -1 */ - 0, /* 0 0 */ - 7, /* 0 1 */ - 5, /* 1 -1 */ - 1, /* 1 0 */ - 3 /* 1 1 */ - ]; - - var jsf = getJSF(coeffs[a], coeffs[b]); - max = Math.max(jsf[0].length, max); - naf[a] = new Array(max); - naf[b] = new Array(max); - for (var j = 0; j < max; j++) { - var ja = jsf[0][j] | 0; - var jb = jsf[1][j] | 0; - - naf[a][j] = index[(ja + 1) * 3 + (jb + 1)]; - naf[b][j] = 0; - wnd[a] = comb; - } - } - - var acc = this.jpoint(null, null, null); - var tmp = this._wnafT4; - for (var i = max; i >= 0; i--) { - var k = 0; - - while (i >= 0) { - var zero = true; - for (var j = 0; j < len; j++) { - tmp[j] = naf[j][i] | 0; - if (tmp[j] !== 0) - zero = false; - } - if (!zero) - break; - k++; - i--; - } - if (i >= 0) - k++; - acc = acc.dblp(k); - if (i < 0) - break; - - for (var j = 0; j < len; j++) { - var z = tmp[j]; - var p; - if (z === 0) - continue; - else if (z > 0) - p = wnd[j][(z - 1) >> 1]; - else if (z < 0) - p = wnd[j][(-z - 1) >> 1].neg(); - - if (p.type === 'affine') - acc = acc.mixedAdd(p); - else - acc = acc.add(p); - } - } - // Zeroify references - for (var i = 0; i < len; i++) - wnd[i] = null; - - if (jacobianResult) - return acc; - else - return acc.toP(); -}; - -function BasePoint(curve, type) { - this.curve = curve; - this.type = type; - this.precomputed = null; -} -BaseCurve.BasePoint = BasePoint; - -BasePoint.prototype.eq = function eq(/*other*/) { - throw new Error('Not implemented'); -}; - -BasePoint.prototype.validate = function validate() { - return this.curve.validate(this); -}; - -BaseCurve.prototype.decodePoint = function decodePoint(bytes, enc) { - bytes = utils.toArray(bytes, enc); - - var len = this.p.byteLength(); - - // uncompressed, hybrid-odd, hybrid-even - if ((bytes[0] === 0x04 || bytes[0] === 0x06 || bytes[0] === 0x07) && - bytes.length - 1 === 2 * len) { - if (bytes[0] === 0x06) - assert(bytes[bytes.length - 1] % 2 === 0); - else if (bytes[0] === 0x07) - assert(bytes[bytes.length - 1] % 2 === 1); - - var res = this.point(bytes.slice(1, 1 + len), - bytes.slice(1 + len, 1 + 2 * len)); - - return res; - } else if ((bytes[0] === 0x02 || bytes[0] === 0x03) && - bytes.length - 1 === len) { - return this.pointFromX(bytes.slice(1, 1 + len), bytes[0] === 0x03); - } - throw new Error('Unknown point format'); -}; - -BasePoint.prototype.encodeCompressed = function encodeCompressed(enc) { - return this.encode(enc, true); -}; - -BasePoint.prototype._encode = function _encode(compact) { - var len = this.curve.p.byteLength(); - var x = this.getX().toArray('be', len); - - if (compact) - return [ this.getY().isEven() ? 0x02 : 0x03 ].concat(x); - - return [ 0x04 ].concat(x, this.getY().toArray('be', len)) ; -}; - -BasePoint.prototype.encode = function encode(enc, compact) { - return utils.encode(this._encode(compact), enc); -}; - -BasePoint.prototype.precompute = function precompute(power) { - if (this.precomputed) - return this; - - var precomputed = { - doubles: null, - naf: null, - beta: null - }; - precomputed.naf = this._getNAFPoints(8); - precomputed.doubles = this._getDoubles(4, power); - precomputed.beta = this._getBeta(); - this.precomputed = precomputed; - - return this; -}; - -BasePoint.prototype._hasDoubles = function _hasDoubles(k) { - if (!this.precomputed) - return false; - - var doubles = this.precomputed.doubles; - if (!doubles) - return false; - - return doubles.points.length >= Math.ceil((k.bitLength() + 1) / doubles.step); -}; - -BasePoint.prototype._getDoubles = function _getDoubles(step, power) { - if (this.precomputed && this.precomputed.doubles) - return this.precomputed.doubles; - - var doubles = [ this ]; - var acc = this; - for (var i = 0; i < power; i += step) { - for (var j = 0; j < step; j++) - acc = acc.dbl(); - doubles.push(acc); - } - return { - step: step, - points: doubles - }; -}; - -BasePoint.prototype._getNAFPoints = function _getNAFPoints(wnd) { - if (this.precomputed && this.precomputed.naf) - return this.precomputed.naf; - - var res = [ this ]; - var max = (1 << wnd) - 1; - var dbl = max === 1 ? null : this.dbl(); - for (var i = 1; i < max; i++) - res[i] = res[i - 1].add(dbl); - return { - wnd: wnd, - points: res - }; -}; - -BasePoint.prototype._getBeta = function _getBeta() { - return null; -}; - -BasePoint.prototype.dblp = function dblp(k) { - var r = this; - for (var i = 0; i < k; i++) - r = r.dbl(); - return r; -}; - -},{"../utils":125,"bn.js":52}],113:[function(require,module,exports){ -'use strict'; - -var utils = require('../utils'); -var BN = require('bn.js'); -var inherits = require('inherits'); -var Base = require('./base'); - -var assert = utils.assert; - -function EdwardsCurve(conf) { - // NOTE: Important as we are creating point in Base.call() - this.twisted = (conf.a | 0) !== 1; - this.mOneA = this.twisted && (conf.a | 0) === -1; - this.extended = this.mOneA; - - Base.call(this, 'edwards', conf); - - this.a = new BN(conf.a, 16).umod(this.red.m); - this.a = this.a.toRed(this.red); - this.c = new BN(conf.c, 16).toRed(this.red); - this.c2 = this.c.redSqr(); - this.d = new BN(conf.d, 16).toRed(this.red); - this.dd = this.d.redAdd(this.d); - - assert(!this.twisted || this.c.fromRed().cmpn(1) === 0); - this.oneC = (conf.c | 0) === 1; -} -inherits(EdwardsCurve, Base); -module.exports = EdwardsCurve; - -EdwardsCurve.prototype._mulA = function _mulA(num) { - if (this.mOneA) - return num.redNeg(); - else - return this.a.redMul(num); -}; - -EdwardsCurve.prototype._mulC = function _mulC(num) { - if (this.oneC) - return num; - else - return this.c.redMul(num); -}; - -// Just for compatibility with Short curve -EdwardsCurve.prototype.jpoint = function jpoint(x, y, z, t) { - return this.point(x, y, z, t); -}; - -EdwardsCurve.prototype.pointFromX = function pointFromX(x, odd) { - x = new BN(x, 16); - if (!x.red) - x = x.toRed(this.red); - - var x2 = x.redSqr(); - var rhs = this.c2.redSub(this.a.redMul(x2)); - var lhs = this.one.redSub(this.c2.redMul(this.d).redMul(x2)); - - var y2 = rhs.redMul(lhs.redInvm()); - var y = y2.redSqrt(); - if (y.redSqr().redSub(y2).cmp(this.zero) !== 0) - throw new Error('invalid point'); - - var isOdd = y.fromRed().isOdd(); - if (odd && !isOdd || !odd && isOdd) - y = y.redNeg(); - - return this.point(x, y); -}; - -EdwardsCurve.prototype.pointFromY = function pointFromY(y, odd) { - y = new BN(y, 16); - if (!y.red) - y = y.toRed(this.red); - - // x^2 = (y^2 - c^2) / (c^2 d y^2 - a) - var y2 = y.redSqr(); - var lhs = y2.redSub(this.c2); - var rhs = y2.redMul(this.d).redMul(this.c2).redSub(this.a); - var x2 = lhs.redMul(rhs.redInvm()); - - if (x2.cmp(this.zero) === 0) { - if (odd) - throw new Error('invalid point'); - else - return this.point(this.zero, y); - } - - var x = x2.redSqrt(); - if (x.redSqr().redSub(x2).cmp(this.zero) !== 0) - throw new Error('invalid point'); - - if (x.fromRed().isOdd() !== odd) - x = x.redNeg(); - - return this.point(x, y); -}; - -EdwardsCurve.prototype.validate = function validate(point) { - if (point.isInfinity()) - return true; - - // Curve: A * X^2 + Y^2 = C^2 * (1 + D * X^2 * Y^2) - point.normalize(); - - var x2 = point.x.redSqr(); - var y2 = point.y.redSqr(); - var lhs = x2.redMul(this.a).redAdd(y2); - var rhs = this.c2.redMul(this.one.redAdd(this.d.redMul(x2).redMul(y2))); - - return lhs.cmp(rhs) === 0; -}; - -function Point(curve, x, y, z, t) { - Base.BasePoint.call(this, curve, 'projective'); - if (x === null && y === null && z === null) { - this.x = this.curve.zero; - this.y = this.curve.one; - this.z = this.curve.one; - this.t = this.curve.zero; - this.zOne = true; - } else { - this.x = new BN(x, 16); - this.y = new BN(y, 16); - this.z = z ? new BN(z, 16) : this.curve.one; - this.t = t && new BN(t, 16); - if (!this.x.red) - this.x = this.x.toRed(this.curve.red); - if (!this.y.red) - this.y = this.y.toRed(this.curve.red); - if (!this.z.red) - this.z = this.z.toRed(this.curve.red); - if (this.t && !this.t.red) - this.t = this.t.toRed(this.curve.red); - this.zOne = this.z === this.curve.one; - - // Use extended coordinates - if (this.curve.extended && !this.t) { - this.t = this.x.redMul(this.y); - if (!this.zOne) - this.t = this.t.redMul(this.z.redInvm()); - } - } -} -inherits(Point, Base.BasePoint); - -EdwardsCurve.prototype.pointFromJSON = function pointFromJSON(obj) { - return Point.fromJSON(this, obj); -}; - -EdwardsCurve.prototype.point = function point(x, y, z, t) { - return new Point(this, x, y, z, t); -}; - -Point.fromJSON = function fromJSON(curve, obj) { - return new Point(curve, obj[0], obj[1], obj[2]); -}; - -Point.prototype.inspect = function inspect() { - if (this.isInfinity()) - return ''; - return ''; -}; - -Point.prototype.isInfinity = function isInfinity() { - // XXX This code assumes that zero is always zero in red - return this.x.cmpn(0) === 0 && - (this.y.cmp(this.z) === 0 || - (this.zOne && this.y.cmp(this.curve.c) === 0)); -}; - -Point.prototype._extDbl = function _extDbl() { - // hyperelliptic.org/EFD/g1p/auto-twisted-extended-1.html - // #doubling-dbl-2008-hwcd - // 4M + 4S - - // A = X1^2 - var a = this.x.redSqr(); - // B = Y1^2 - var b = this.y.redSqr(); - // C = 2 * Z1^2 - var c = this.z.redSqr(); - c = c.redIAdd(c); - // D = a * A - var d = this.curve._mulA(a); - // E = (X1 + Y1)^2 - A - B - var e = this.x.redAdd(this.y).redSqr().redISub(a).redISub(b); - // G = D + B - var g = d.redAdd(b); - // F = G - C - var f = g.redSub(c); - // H = D - B - var h = d.redSub(b); - // X3 = E * F - var nx = e.redMul(f); - // Y3 = G * H - var ny = g.redMul(h); - // T3 = E * H - var nt = e.redMul(h); - // Z3 = F * G - var nz = f.redMul(g); - return this.curve.point(nx, ny, nz, nt); -}; - -Point.prototype._projDbl = function _projDbl() { - // hyperelliptic.org/EFD/g1p/auto-twisted-projective.html - // #doubling-dbl-2008-bbjlp - // #doubling-dbl-2007-bl - // and others - // Generally 3M + 4S or 2M + 4S - - // B = (X1 + Y1)^2 - var b = this.x.redAdd(this.y).redSqr(); - // C = X1^2 - var c = this.x.redSqr(); - // D = Y1^2 - var d = this.y.redSqr(); - - var nx; - var ny; - var nz; - if (this.curve.twisted) { - // E = a * C - var e = this.curve._mulA(c); - // F = E + D - var f = e.redAdd(d); - if (this.zOne) { - // X3 = (B - C - D) * (F - 2) - nx = b.redSub(c).redSub(d).redMul(f.redSub(this.curve.two)); - // Y3 = F * (E - D) - ny = f.redMul(e.redSub(d)); - // Z3 = F^2 - 2 * F - nz = f.redSqr().redSub(f).redSub(f); - } else { - // H = Z1^2 - var h = this.z.redSqr(); - // J = F - 2 * H - var j = f.redSub(h).redISub(h); - // X3 = (B-C-D)*J - nx = b.redSub(c).redISub(d).redMul(j); - // Y3 = F * (E - D) - ny = f.redMul(e.redSub(d)); - // Z3 = F * J - nz = f.redMul(j); - } - } else { - // E = C + D - var e = c.redAdd(d); - // H = (c * Z1)^2 - var h = this.curve._mulC(this.z).redSqr(); - // J = E - 2 * H - var j = e.redSub(h).redSub(h); - // X3 = c * (B - E) * J - nx = this.curve._mulC(b.redISub(e)).redMul(j); - // Y3 = c * E * (C - D) - ny = this.curve._mulC(e).redMul(c.redISub(d)); - // Z3 = E * J - nz = e.redMul(j); - } - return this.curve.point(nx, ny, nz); -}; - -Point.prototype.dbl = function dbl() { - if (this.isInfinity()) - return this; - - // Double in extended coordinates - if (this.curve.extended) - return this._extDbl(); - else - return this._projDbl(); -}; - -Point.prototype._extAdd = function _extAdd(p) { - // hyperelliptic.org/EFD/g1p/auto-twisted-extended-1.html - // #addition-add-2008-hwcd-3 - // 8M - - // A = (Y1 - X1) * (Y2 - X2) - var a = this.y.redSub(this.x).redMul(p.y.redSub(p.x)); - // B = (Y1 + X1) * (Y2 + X2) - var b = this.y.redAdd(this.x).redMul(p.y.redAdd(p.x)); - // C = T1 * k * T2 - var c = this.t.redMul(this.curve.dd).redMul(p.t); - // D = Z1 * 2 * Z2 - var d = this.z.redMul(p.z.redAdd(p.z)); - // E = B - A - var e = b.redSub(a); - // F = D - C - var f = d.redSub(c); - // G = D + C - var g = d.redAdd(c); - // H = B + A - var h = b.redAdd(a); - // X3 = E * F - var nx = e.redMul(f); - // Y3 = G * H - var ny = g.redMul(h); - // T3 = E * H - var nt = e.redMul(h); - // Z3 = F * G - var nz = f.redMul(g); - return this.curve.point(nx, ny, nz, nt); -}; - -Point.prototype._projAdd = function _projAdd(p) { - // hyperelliptic.org/EFD/g1p/auto-twisted-projective.html - // #addition-add-2008-bbjlp - // #addition-add-2007-bl - // 10M + 1S - - // A = Z1 * Z2 - var a = this.z.redMul(p.z); - // B = A^2 - var b = a.redSqr(); - // C = X1 * X2 - var c = this.x.redMul(p.x); - // D = Y1 * Y2 - var d = this.y.redMul(p.y); - // E = d * C * D - var e = this.curve.d.redMul(c).redMul(d); - // F = B - E - var f = b.redSub(e); - // G = B + E - var g = b.redAdd(e); - // X3 = A * F * ((X1 + Y1) * (X2 + Y2) - C - D) - var tmp = this.x.redAdd(this.y).redMul(p.x.redAdd(p.y)).redISub(c).redISub(d); - var nx = a.redMul(f).redMul(tmp); - var ny; - var nz; - if (this.curve.twisted) { - // Y3 = A * G * (D - a * C) - ny = a.redMul(g).redMul(d.redSub(this.curve._mulA(c))); - // Z3 = F * G - nz = f.redMul(g); - } else { - // Y3 = A * G * (D - C) - ny = a.redMul(g).redMul(d.redSub(c)); - // Z3 = c * F * G - nz = this.curve._mulC(f).redMul(g); - } - return this.curve.point(nx, ny, nz); -}; - -Point.prototype.add = function add(p) { - if (this.isInfinity()) - return p; - if (p.isInfinity()) - return this; - - if (this.curve.extended) - return this._extAdd(p); - else - return this._projAdd(p); -}; - -Point.prototype.mul = function mul(k) { - if (this._hasDoubles(k)) - return this.curve._fixedNafMul(this, k); - else - return this.curve._wnafMul(this, k); -}; - -Point.prototype.mulAdd = function mulAdd(k1, p, k2) { - return this.curve._wnafMulAdd(1, [ this, p ], [ k1, k2 ], 2, false); -}; - -Point.prototype.jmulAdd = function jmulAdd(k1, p, k2) { - return this.curve._wnafMulAdd(1, [ this, p ], [ k1, k2 ], 2, true); -}; - -Point.prototype.normalize = function normalize() { - if (this.zOne) - return this; - - // Normalize coordinates - var zi = this.z.redInvm(); - this.x = this.x.redMul(zi); - this.y = this.y.redMul(zi); - if (this.t) - this.t = this.t.redMul(zi); - this.z = this.curve.one; - this.zOne = true; - return this; -}; - -Point.prototype.neg = function neg() { - return this.curve.point(this.x.redNeg(), - this.y, - this.z, - this.t && this.t.redNeg()); -}; - -Point.prototype.getX = function getX() { - this.normalize(); - return this.x.fromRed(); -}; - -Point.prototype.getY = function getY() { - this.normalize(); - return this.y.fromRed(); -}; - -Point.prototype.eq = function eq(other) { - return this === other || - this.getX().cmp(other.getX()) === 0 && - this.getY().cmp(other.getY()) === 0; -}; - -Point.prototype.eqXToP = function eqXToP(x) { - var rx = x.toRed(this.curve.red).redMul(this.z); - if (this.x.cmp(rx) === 0) - return true; - - var xc = x.clone(); - var t = this.curve.redN.redMul(this.z); - for (;;) { - xc.iadd(this.curve.n); - if (xc.cmp(this.curve.p) >= 0) - return false; - - rx.redIAdd(t); - if (this.x.cmp(rx) === 0) - return true; - } -}; - -// Compatibility with BaseCurve -Point.prototype.toP = Point.prototype.normalize; -Point.prototype.mixedAdd = Point.prototype.add; - -},{"../utils":125,"./base":112,"bn.js":52,"inherits":156}],114:[function(require,module,exports){ -'use strict'; - -var curve = exports; - -curve.base = require('./base'); -curve.short = require('./short'); -curve.mont = require('./mont'); -curve.edwards = require('./edwards'); - -},{"./base":112,"./edwards":113,"./mont":115,"./short":116}],115:[function(require,module,exports){ -'use strict'; - -var BN = require('bn.js'); -var inherits = require('inherits'); -var Base = require('./base'); - -var utils = require('../utils'); - -function MontCurve(conf) { - Base.call(this, 'mont', conf); - - this.a = new BN(conf.a, 16).toRed(this.red); - this.b = new BN(conf.b, 16).toRed(this.red); - this.i4 = new BN(4).toRed(this.red).redInvm(); - this.two = new BN(2).toRed(this.red); - this.a24 = this.i4.redMul(this.a.redAdd(this.two)); -} -inherits(MontCurve, Base); -module.exports = MontCurve; - -MontCurve.prototype.validate = function validate(point) { - var x = point.normalize().x; - var x2 = x.redSqr(); - var rhs = x2.redMul(x).redAdd(x2.redMul(this.a)).redAdd(x); - var y = rhs.redSqrt(); - - return y.redSqr().cmp(rhs) === 0; -}; - -function Point(curve, x, z) { - Base.BasePoint.call(this, curve, 'projective'); - if (x === null && z === null) { - this.x = this.curve.one; - this.z = this.curve.zero; - } else { - this.x = new BN(x, 16); - this.z = new BN(z, 16); - if (!this.x.red) - this.x = this.x.toRed(this.curve.red); - if (!this.z.red) - this.z = this.z.toRed(this.curve.red); - } -} -inherits(Point, Base.BasePoint); - -MontCurve.prototype.decodePoint = function decodePoint(bytes, enc) { - return this.point(utils.toArray(bytes, enc), 1); -}; - -MontCurve.prototype.point = function point(x, z) { - return new Point(this, x, z); -}; - -MontCurve.prototype.pointFromJSON = function pointFromJSON(obj) { - return Point.fromJSON(this, obj); -}; - -Point.prototype.precompute = function precompute() { - // No-op -}; - -Point.prototype._encode = function _encode() { - return this.getX().toArray('be', this.curve.p.byteLength()); -}; - -Point.fromJSON = function fromJSON(curve, obj) { - return new Point(curve, obj[0], obj[1] || curve.one); -}; - -Point.prototype.inspect = function inspect() { - if (this.isInfinity()) - return ''; - return ''; -}; - -Point.prototype.isInfinity = function isInfinity() { - // XXX This code assumes that zero is always zero in red - return this.z.cmpn(0) === 0; -}; - -Point.prototype.dbl = function dbl() { - // http://hyperelliptic.org/EFD/g1p/auto-montgom-xz.html#doubling-dbl-1987-m-3 - // 2M + 2S + 4A - - // A = X1 + Z1 - var a = this.x.redAdd(this.z); - // AA = A^2 - var aa = a.redSqr(); - // B = X1 - Z1 - var b = this.x.redSub(this.z); - // BB = B^2 - var bb = b.redSqr(); - // C = AA - BB - var c = aa.redSub(bb); - // X3 = AA * BB - var nx = aa.redMul(bb); - // Z3 = C * (BB + A24 * C) - var nz = c.redMul(bb.redAdd(this.curve.a24.redMul(c))); - return this.curve.point(nx, nz); -}; - -Point.prototype.add = function add() { - throw new Error('Not supported on Montgomery curve'); -}; - -Point.prototype.diffAdd = function diffAdd(p, diff) { - // http://hyperelliptic.org/EFD/g1p/auto-montgom-xz.html#diffadd-dadd-1987-m-3 - // 4M + 2S + 6A - - // A = X2 + Z2 - var a = this.x.redAdd(this.z); - // B = X2 - Z2 - var b = this.x.redSub(this.z); - // C = X3 + Z3 - var c = p.x.redAdd(p.z); - // D = X3 - Z3 - var d = p.x.redSub(p.z); - // DA = D * A - var da = d.redMul(a); - // CB = C * B - var cb = c.redMul(b); - // X5 = Z1 * (DA + CB)^2 - var nx = diff.z.redMul(da.redAdd(cb).redSqr()); - // Z5 = X1 * (DA - CB)^2 - var nz = diff.x.redMul(da.redISub(cb).redSqr()); - return this.curve.point(nx, nz); -}; - -Point.prototype.mul = function mul(k) { - var t = k.clone(); - var a = this; // (N / 2) * Q + Q - var b = this.curve.point(null, null); // (N / 2) * Q - var c = this; // Q - - for (var bits = []; t.cmpn(0) !== 0; t.iushrn(1)) - bits.push(t.andln(1)); - - for (var i = bits.length - 1; i >= 0; i--) { - if (bits[i] === 0) { - // N * Q + Q = ((N / 2) * Q + Q)) + (N / 2) * Q - a = a.diffAdd(b, c); - // N * Q = 2 * ((N / 2) * Q + Q)) - b = b.dbl(); - } else { - // N * Q = ((N / 2) * Q + Q) + ((N / 2) * Q) - b = a.diffAdd(b, c); - // N * Q + Q = 2 * ((N / 2) * Q + Q) - a = a.dbl(); - } - } - return b; -}; - -Point.prototype.mulAdd = function mulAdd() { - throw new Error('Not supported on Montgomery curve'); -}; - -Point.prototype.jumlAdd = function jumlAdd() { - throw new Error('Not supported on Montgomery curve'); -}; - -Point.prototype.eq = function eq(other) { - return this.getX().cmp(other.getX()) === 0; -}; - -Point.prototype.normalize = function normalize() { - this.x = this.x.redMul(this.z.redInvm()); - this.z = this.curve.one; - return this; -}; - -Point.prototype.getX = function getX() { - // Normalize coordinates - this.normalize(); - - return this.x.fromRed(); -}; - -},{"../utils":125,"./base":112,"bn.js":52,"inherits":156}],116:[function(require,module,exports){ -'use strict'; - -var utils = require('../utils'); -var BN = require('bn.js'); -var inherits = require('inherits'); -var Base = require('./base'); - -var assert = utils.assert; - -function ShortCurve(conf) { - Base.call(this, 'short', conf); - - this.a = new BN(conf.a, 16).toRed(this.red); - this.b = new BN(conf.b, 16).toRed(this.red); - this.tinv = this.two.redInvm(); - - this.zeroA = this.a.fromRed().cmpn(0) === 0; - this.threeA = this.a.fromRed().sub(this.p).cmpn(-3) === 0; - - // If the curve is endomorphic, precalculate beta and lambda - this.endo = this._getEndomorphism(conf); - this._endoWnafT1 = new Array(4); - this._endoWnafT2 = new Array(4); -} -inherits(ShortCurve, Base); -module.exports = ShortCurve; - -ShortCurve.prototype._getEndomorphism = function _getEndomorphism(conf) { - // No efficient endomorphism - if (!this.zeroA || !this.g || !this.n || this.p.modn(3) !== 1) - return; - - // Compute beta and lambda, that lambda * P = (beta * Px; Py) - var beta; - var lambda; - if (conf.beta) { - beta = new BN(conf.beta, 16).toRed(this.red); - } else { - var betas = this._getEndoRoots(this.p); - // Choose the smallest beta - beta = betas[0].cmp(betas[1]) < 0 ? betas[0] : betas[1]; - beta = beta.toRed(this.red); - } - if (conf.lambda) { - lambda = new BN(conf.lambda, 16); - } else { - // Choose the lambda that is matching selected beta - var lambdas = this._getEndoRoots(this.n); - if (this.g.mul(lambdas[0]).x.cmp(this.g.x.redMul(beta)) === 0) { - lambda = lambdas[0]; - } else { - lambda = lambdas[1]; - assert(this.g.mul(lambda).x.cmp(this.g.x.redMul(beta)) === 0); - } - } - - // Get basis vectors, used for balanced length-two representation - var basis; - if (conf.basis) { - basis = conf.basis.map(function(vec) { - return { - a: new BN(vec.a, 16), - b: new BN(vec.b, 16) - }; - }); - } else { - basis = this._getEndoBasis(lambda); - } - - return { - beta: beta, - lambda: lambda, - basis: basis - }; -}; - -ShortCurve.prototype._getEndoRoots = function _getEndoRoots(num) { - // Find roots of for x^2 + x + 1 in F - // Root = (-1 +- Sqrt(-3)) / 2 - // - var red = num === this.p ? this.red : BN.mont(num); - var tinv = new BN(2).toRed(red).redInvm(); - var ntinv = tinv.redNeg(); - - var s = new BN(3).toRed(red).redNeg().redSqrt().redMul(tinv); - - var l1 = ntinv.redAdd(s).fromRed(); - var l2 = ntinv.redSub(s).fromRed(); - return [ l1, l2 ]; -}; - -ShortCurve.prototype._getEndoBasis = function _getEndoBasis(lambda) { - // aprxSqrt >= sqrt(this.n) - var aprxSqrt = this.n.ushrn(Math.floor(this.n.bitLength() / 2)); - - // 3.74 - // Run EGCD, until r(L + 1) < aprxSqrt - var u = lambda; - var v = this.n.clone(); - var x1 = new BN(1); - var y1 = new BN(0); - var x2 = new BN(0); - var y2 = new BN(1); - - // NOTE: all vectors are roots of: a + b * lambda = 0 (mod n) - var a0; - var b0; - // First vector - var a1; - var b1; - // Second vector - var a2; - var b2; - - var prevR; - var i = 0; - var r; - var x; - while (u.cmpn(0) !== 0) { - var q = v.div(u); - r = v.sub(q.mul(u)); - x = x2.sub(q.mul(x1)); - var y = y2.sub(q.mul(y1)); - - if (!a1 && r.cmp(aprxSqrt) < 0) { - a0 = prevR.neg(); - b0 = x1; - a1 = r.neg(); - b1 = x; - } else if (a1 && ++i === 2) { - break; - } - prevR = r; - - v = u; - u = r; - x2 = x1; - x1 = x; - y2 = y1; - y1 = y; - } - a2 = r.neg(); - b2 = x; - - var len1 = a1.sqr().add(b1.sqr()); - var len2 = a2.sqr().add(b2.sqr()); - if (len2.cmp(len1) >= 0) { - a2 = a0; - b2 = b0; - } - - // Normalize signs - if (a1.negative) { - a1 = a1.neg(); - b1 = b1.neg(); - } - if (a2.negative) { - a2 = a2.neg(); - b2 = b2.neg(); - } - - return [ - { a: a1, b: b1 }, - { a: a2, b: b2 } - ]; -}; - -ShortCurve.prototype._endoSplit = function _endoSplit(k) { - var basis = this.endo.basis; - var v1 = basis[0]; - var v2 = basis[1]; - - var c1 = v2.b.mul(k).divRound(this.n); - var c2 = v1.b.neg().mul(k).divRound(this.n); - - var p1 = c1.mul(v1.a); - var p2 = c2.mul(v2.a); - var q1 = c1.mul(v1.b); - var q2 = c2.mul(v2.b); - - // Calculate answer - var k1 = k.sub(p1).sub(p2); - var k2 = q1.add(q2).neg(); - return { k1: k1, k2: k2 }; -}; - -ShortCurve.prototype.pointFromX = function pointFromX(x, odd) { - x = new BN(x, 16); - if (!x.red) - x = x.toRed(this.red); - - var y2 = x.redSqr().redMul(x).redIAdd(x.redMul(this.a)).redIAdd(this.b); - var y = y2.redSqrt(); - if (y.redSqr().redSub(y2).cmp(this.zero) !== 0) - throw new Error('invalid point'); - - // XXX Is there any way to tell if the number is odd without converting it - // to non-red form? - var isOdd = y.fromRed().isOdd(); - if (odd && !isOdd || !odd && isOdd) - y = y.redNeg(); - - return this.point(x, y); -}; - -ShortCurve.prototype.validate = function validate(point) { - if (point.inf) - return true; - - var x = point.x; - var y = point.y; - - var ax = this.a.redMul(x); - var rhs = x.redSqr().redMul(x).redIAdd(ax).redIAdd(this.b); - return y.redSqr().redISub(rhs).cmpn(0) === 0; -}; - -ShortCurve.prototype._endoWnafMulAdd = - function _endoWnafMulAdd(points, coeffs, jacobianResult) { - var npoints = this._endoWnafT1; - var ncoeffs = this._endoWnafT2; - for (var i = 0; i < points.length; i++) { - var split = this._endoSplit(coeffs[i]); - var p = points[i]; - var beta = p._getBeta(); - - if (split.k1.negative) { - split.k1.ineg(); - p = p.neg(true); - } - if (split.k2.negative) { - split.k2.ineg(); - beta = beta.neg(true); - } - - npoints[i * 2] = p; - npoints[i * 2 + 1] = beta; - ncoeffs[i * 2] = split.k1; - ncoeffs[i * 2 + 1] = split.k2; - } - var res = this._wnafMulAdd(1, npoints, ncoeffs, i * 2, jacobianResult); - - // Clean-up references to points and coefficients - for (var j = 0; j < i * 2; j++) { - npoints[j] = null; - ncoeffs[j] = null; - } - return res; -}; - -function Point(curve, x, y, isRed) { - Base.BasePoint.call(this, curve, 'affine'); - if (x === null && y === null) { - this.x = null; - this.y = null; - this.inf = true; - } else { - this.x = new BN(x, 16); - this.y = new BN(y, 16); - // Force redgomery representation when loading from JSON - if (isRed) { - this.x.forceRed(this.curve.red); - this.y.forceRed(this.curve.red); - } - if (!this.x.red) - this.x = this.x.toRed(this.curve.red); - if (!this.y.red) - this.y = this.y.toRed(this.curve.red); - this.inf = false; - } -} -inherits(Point, Base.BasePoint); - -ShortCurve.prototype.point = function point(x, y, isRed) { - return new Point(this, x, y, isRed); -}; - -ShortCurve.prototype.pointFromJSON = function pointFromJSON(obj, red) { - return Point.fromJSON(this, obj, red); -}; - -Point.prototype._getBeta = function _getBeta() { - if (!this.curve.endo) - return; - - var pre = this.precomputed; - if (pre && pre.beta) - return pre.beta; - - var beta = this.curve.point(this.x.redMul(this.curve.endo.beta), this.y); - if (pre) { - var curve = this.curve; - var endoMul = function(p) { - return curve.point(p.x.redMul(curve.endo.beta), p.y); - }; - pre.beta = beta; - beta.precomputed = { - beta: null, - naf: pre.naf && { - wnd: pre.naf.wnd, - points: pre.naf.points.map(endoMul) - }, - doubles: pre.doubles && { - step: pre.doubles.step, - points: pre.doubles.points.map(endoMul) - } - }; - } - return beta; -}; - -Point.prototype.toJSON = function toJSON() { - if (!this.precomputed) - return [ this.x, this.y ]; - - return [ this.x, this.y, this.precomputed && { - doubles: this.precomputed.doubles && { - step: this.precomputed.doubles.step, - points: this.precomputed.doubles.points.slice(1) - }, - naf: this.precomputed.naf && { - wnd: this.precomputed.naf.wnd, - points: this.precomputed.naf.points.slice(1) - } - } ]; -}; - -Point.fromJSON = function fromJSON(curve, obj, red) { - if (typeof obj === 'string') - obj = JSON.parse(obj); - var res = curve.point(obj[0], obj[1], red); - if (!obj[2]) - return res; - - function obj2point(obj) { - return curve.point(obj[0], obj[1], red); - } - - var pre = obj[2]; - res.precomputed = { - beta: null, - doubles: pre.doubles && { - step: pre.doubles.step, - points: [ res ].concat(pre.doubles.points.map(obj2point)) - }, - naf: pre.naf && { - wnd: pre.naf.wnd, - points: [ res ].concat(pre.naf.points.map(obj2point)) - } - }; - return res; -}; - -Point.prototype.inspect = function inspect() { - if (this.isInfinity()) - return ''; - return ''; -}; - -Point.prototype.isInfinity = function isInfinity() { - return this.inf; -}; - -Point.prototype.add = function add(p) { - // O + P = P - if (this.inf) - return p; - - // P + O = P - if (p.inf) - return this; - - // P + P = 2P - if (this.eq(p)) - return this.dbl(); - - // P + (-P) = O - if (this.neg().eq(p)) - return this.curve.point(null, null); - - // P + Q = O - if (this.x.cmp(p.x) === 0) - return this.curve.point(null, null); - - var c = this.y.redSub(p.y); - if (c.cmpn(0) !== 0) - c = c.redMul(this.x.redSub(p.x).redInvm()); - var nx = c.redSqr().redISub(this.x).redISub(p.x); - var ny = c.redMul(this.x.redSub(nx)).redISub(this.y); - return this.curve.point(nx, ny); -}; - -Point.prototype.dbl = function dbl() { - if (this.inf) - return this; - - // 2P = O - var ys1 = this.y.redAdd(this.y); - if (ys1.cmpn(0) === 0) - return this.curve.point(null, null); - - var a = this.curve.a; - - var x2 = this.x.redSqr(); - var dyinv = ys1.redInvm(); - var c = x2.redAdd(x2).redIAdd(x2).redIAdd(a).redMul(dyinv); - - var nx = c.redSqr().redISub(this.x.redAdd(this.x)); - var ny = c.redMul(this.x.redSub(nx)).redISub(this.y); - return this.curve.point(nx, ny); -}; - -Point.prototype.getX = function getX() { - return this.x.fromRed(); -}; - -Point.prototype.getY = function getY() { - return this.y.fromRed(); -}; - -Point.prototype.mul = function mul(k) { - k = new BN(k, 16); - if (this.isInfinity()) - return this; - else if (this._hasDoubles(k)) - return this.curve._fixedNafMul(this, k); - else if (this.curve.endo) - return this.curve._endoWnafMulAdd([ this ], [ k ]); - else - return this.curve._wnafMul(this, k); -}; - -Point.prototype.mulAdd = function mulAdd(k1, p2, k2) { - var points = [ this, p2 ]; - var coeffs = [ k1, k2 ]; - if (this.curve.endo) - return this.curve._endoWnafMulAdd(points, coeffs); - else - return this.curve._wnafMulAdd(1, points, coeffs, 2); -}; - -Point.prototype.jmulAdd = function jmulAdd(k1, p2, k2) { - var points = [ this, p2 ]; - var coeffs = [ k1, k2 ]; - if (this.curve.endo) - return this.curve._endoWnafMulAdd(points, coeffs, true); - else - return this.curve._wnafMulAdd(1, points, coeffs, 2, true); -}; - -Point.prototype.eq = function eq(p) { - return this === p || - this.inf === p.inf && - (this.inf || this.x.cmp(p.x) === 0 && this.y.cmp(p.y) === 0); -}; - -Point.prototype.neg = function neg(_precompute) { - if (this.inf) - return this; - - var res = this.curve.point(this.x, this.y.redNeg()); - if (_precompute && this.precomputed) { - var pre = this.precomputed; - var negate = function(p) { - return p.neg(); - }; - res.precomputed = { - naf: pre.naf && { - wnd: pre.naf.wnd, - points: pre.naf.points.map(negate) - }, - doubles: pre.doubles && { - step: pre.doubles.step, - points: pre.doubles.points.map(negate) - } - }; - } - return res; -}; - -Point.prototype.toJ = function toJ() { - if (this.inf) - return this.curve.jpoint(null, null, null); - - var res = this.curve.jpoint(this.x, this.y, this.curve.one); - return res; -}; - -function JPoint(curve, x, y, z) { - Base.BasePoint.call(this, curve, 'jacobian'); - if (x === null && y === null && z === null) { - this.x = this.curve.one; - this.y = this.curve.one; - this.z = new BN(0); - } else { - this.x = new BN(x, 16); - this.y = new BN(y, 16); - this.z = new BN(z, 16); - } - if (!this.x.red) - this.x = this.x.toRed(this.curve.red); - if (!this.y.red) - this.y = this.y.toRed(this.curve.red); - if (!this.z.red) - this.z = this.z.toRed(this.curve.red); - - this.zOne = this.z === this.curve.one; -} -inherits(JPoint, Base.BasePoint); - -ShortCurve.prototype.jpoint = function jpoint(x, y, z) { - return new JPoint(this, x, y, z); -}; - -JPoint.prototype.toP = function toP() { - if (this.isInfinity()) - return this.curve.point(null, null); - - var zinv = this.z.redInvm(); - var zinv2 = zinv.redSqr(); - var ax = this.x.redMul(zinv2); - var ay = this.y.redMul(zinv2).redMul(zinv); - - return this.curve.point(ax, ay); -}; - -JPoint.prototype.neg = function neg() { - return this.curve.jpoint(this.x, this.y.redNeg(), this.z); -}; - -JPoint.prototype.add = function add(p) { - // O + P = P - if (this.isInfinity()) - return p; - - // P + O = P - if (p.isInfinity()) - return this; - - // 12M + 4S + 7A - var pz2 = p.z.redSqr(); - var z2 = this.z.redSqr(); - var u1 = this.x.redMul(pz2); - var u2 = p.x.redMul(z2); - var s1 = this.y.redMul(pz2.redMul(p.z)); - var s2 = p.y.redMul(z2.redMul(this.z)); - - var h = u1.redSub(u2); - var r = s1.redSub(s2); - if (h.cmpn(0) === 0) { - if (r.cmpn(0) !== 0) - return this.curve.jpoint(null, null, null); - else - return this.dbl(); - } - - var h2 = h.redSqr(); - var h3 = h2.redMul(h); - var v = u1.redMul(h2); - - var nx = r.redSqr().redIAdd(h3).redISub(v).redISub(v); - var ny = r.redMul(v.redISub(nx)).redISub(s1.redMul(h3)); - var nz = this.z.redMul(p.z).redMul(h); - - return this.curve.jpoint(nx, ny, nz); -}; - -JPoint.prototype.mixedAdd = function mixedAdd(p) { - // O + P = P - if (this.isInfinity()) - return p.toJ(); - - // P + O = P - if (p.isInfinity()) - return this; - - // 8M + 3S + 7A - var z2 = this.z.redSqr(); - var u1 = this.x; - var u2 = p.x.redMul(z2); - var s1 = this.y; - var s2 = p.y.redMul(z2).redMul(this.z); - - var h = u1.redSub(u2); - var r = s1.redSub(s2); - if (h.cmpn(0) === 0) { - if (r.cmpn(0) !== 0) - return this.curve.jpoint(null, null, null); - else - return this.dbl(); - } - - var h2 = h.redSqr(); - var h3 = h2.redMul(h); - var v = u1.redMul(h2); - - var nx = r.redSqr().redIAdd(h3).redISub(v).redISub(v); - var ny = r.redMul(v.redISub(nx)).redISub(s1.redMul(h3)); - var nz = this.z.redMul(h); - - return this.curve.jpoint(nx, ny, nz); -}; - -JPoint.prototype.dblp = function dblp(pow) { - if (pow === 0) - return this; - if (this.isInfinity()) - return this; - if (!pow) - return this.dbl(); - - if (this.curve.zeroA || this.curve.threeA) { - var r = this; - for (var i = 0; i < pow; i++) - r = r.dbl(); - return r; - } - - // 1M + 2S + 1A + N * (4S + 5M + 8A) - // N = 1 => 6M + 6S + 9A - var a = this.curve.a; - var tinv = this.curve.tinv; - - var jx = this.x; - var jy = this.y; - var jz = this.z; - var jz4 = jz.redSqr().redSqr(); - - // Reuse results - var jyd = jy.redAdd(jy); - for (var i = 0; i < pow; i++) { - var jx2 = jx.redSqr(); - var jyd2 = jyd.redSqr(); - var jyd4 = jyd2.redSqr(); - var c = jx2.redAdd(jx2).redIAdd(jx2).redIAdd(a.redMul(jz4)); - - var t1 = jx.redMul(jyd2); - var nx = c.redSqr().redISub(t1.redAdd(t1)); - var t2 = t1.redISub(nx); - var dny = c.redMul(t2); - dny = dny.redIAdd(dny).redISub(jyd4); - var nz = jyd.redMul(jz); - if (i + 1 < pow) - jz4 = jz4.redMul(jyd4); - - jx = nx; - jz = nz; - jyd = dny; - } - - return this.curve.jpoint(jx, jyd.redMul(tinv), jz); -}; - -JPoint.prototype.dbl = function dbl() { - if (this.isInfinity()) - return this; - - if (this.curve.zeroA) - return this._zeroDbl(); - else if (this.curve.threeA) - return this._threeDbl(); - else - return this._dbl(); -}; - -JPoint.prototype._zeroDbl = function _zeroDbl() { - var nx; - var ny; - var nz; - // Z = 1 - if (this.zOne) { - // hyperelliptic.org/EFD/g1p/auto-shortw-jacobian-0.html - // #doubling-mdbl-2007-bl - // 1M + 5S + 14A - - // XX = X1^2 - var xx = this.x.redSqr(); - // YY = Y1^2 - var yy = this.y.redSqr(); - // YYYY = YY^2 - var yyyy = yy.redSqr(); - // S = 2 * ((X1 + YY)^2 - XX - YYYY) - var s = this.x.redAdd(yy).redSqr().redISub(xx).redISub(yyyy); - s = s.redIAdd(s); - // M = 3 * XX + a; a = 0 - var m = xx.redAdd(xx).redIAdd(xx); - // T = M ^ 2 - 2*S - var t = m.redSqr().redISub(s).redISub(s); - - // 8 * YYYY - var yyyy8 = yyyy.redIAdd(yyyy); - yyyy8 = yyyy8.redIAdd(yyyy8); - yyyy8 = yyyy8.redIAdd(yyyy8); - - // X3 = T - nx = t; - // Y3 = M * (S - T) - 8 * YYYY - ny = m.redMul(s.redISub(t)).redISub(yyyy8); - // Z3 = 2*Y1 - nz = this.y.redAdd(this.y); - } else { - // hyperelliptic.org/EFD/g1p/auto-shortw-jacobian-0.html - // #doubling-dbl-2009-l - // 2M + 5S + 13A - - // A = X1^2 - var a = this.x.redSqr(); - // B = Y1^2 - var b = this.y.redSqr(); - // C = B^2 - var c = b.redSqr(); - // D = 2 * ((X1 + B)^2 - A - C) - var d = this.x.redAdd(b).redSqr().redISub(a).redISub(c); - d = d.redIAdd(d); - // E = 3 * A - var e = a.redAdd(a).redIAdd(a); - // F = E^2 - var f = e.redSqr(); - - // 8 * C - var c8 = c.redIAdd(c); - c8 = c8.redIAdd(c8); - c8 = c8.redIAdd(c8); - - // X3 = F - 2 * D - nx = f.redISub(d).redISub(d); - // Y3 = E * (D - X3) - 8 * C - ny = e.redMul(d.redISub(nx)).redISub(c8); - // Z3 = 2 * Y1 * Z1 - nz = this.y.redMul(this.z); - nz = nz.redIAdd(nz); - } - - return this.curve.jpoint(nx, ny, nz); -}; - -JPoint.prototype._threeDbl = function _threeDbl() { - var nx; - var ny; - var nz; - // Z = 1 - if (this.zOne) { - // hyperelliptic.org/EFD/g1p/auto-shortw-jacobian-3.html - // #doubling-mdbl-2007-bl - // 1M + 5S + 15A - - // XX = X1^2 - var xx = this.x.redSqr(); - // YY = Y1^2 - var yy = this.y.redSqr(); - // YYYY = YY^2 - var yyyy = yy.redSqr(); - // S = 2 * ((X1 + YY)^2 - XX - YYYY) - var s = this.x.redAdd(yy).redSqr().redISub(xx).redISub(yyyy); - s = s.redIAdd(s); - // M = 3 * XX + a - var m = xx.redAdd(xx).redIAdd(xx).redIAdd(this.curve.a); - // T = M^2 - 2 * S - var t = m.redSqr().redISub(s).redISub(s); - // X3 = T - nx = t; - // Y3 = M * (S - T) - 8 * YYYY - var yyyy8 = yyyy.redIAdd(yyyy); - yyyy8 = yyyy8.redIAdd(yyyy8); - yyyy8 = yyyy8.redIAdd(yyyy8); - ny = m.redMul(s.redISub(t)).redISub(yyyy8); - // Z3 = 2 * Y1 - nz = this.y.redAdd(this.y); - } else { - // hyperelliptic.org/EFD/g1p/auto-shortw-jacobian-3.html#doubling-dbl-2001-b - // 3M + 5S - - // delta = Z1^2 - var delta = this.z.redSqr(); - // gamma = Y1^2 - var gamma = this.y.redSqr(); - // beta = X1 * gamma - var beta = this.x.redMul(gamma); - // alpha = 3 * (X1 - delta) * (X1 + delta) - var alpha = this.x.redSub(delta).redMul(this.x.redAdd(delta)); - alpha = alpha.redAdd(alpha).redIAdd(alpha); - // X3 = alpha^2 - 8 * beta - var beta4 = beta.redIAdd(beta); - beta4 = beta4.redIAdd(beta4); - var beta8 = beta4.redAdd(beta4); - nx = alpha.redSqr().redISub(beta8); - // Z3 = (Y1 + Z1)^2 - gamma - delta - nz = this.y.redAdd(this.z).redSqr().redISub(gamma).redISub(delta); - // Y3 = alpha * (4 * beta - X3) - 8 * gamma^2 - var ggamma8 = gamma.redSqr(); - ggamma8 = ggamma8.redIAdd(ggamma8); - ggamma8 = ggamma8.redIAdd(ggamma8); - ggamma8 = ggamma8.redIAdd(ggamma8); - ny = alpha.redMul(beta4.redISub(nx)).redISub(ggamma8); - } - - return this.curve.jpoint(nx, ny, nz); -}; - -JPoint.prototype._dbl = function _dbl() { - var a = this.curve.a; - - // 4M + 6S + 10A - var jx = this.x; - var jy = this.y; - var jz = this.z; - var jz4 = jz.redSqr().redSqr(); - - var jx2 = jx.redSqr(); - var jy2 = jy.redSqr(); - - var c = jx2.redAdd(jx2).redIAdd(jx2).redIAdd(a.redMul(jz4)); - - var jxd4 = jx.redAdd(jx); - jxd4 = jxd4.redIAdd(jxd4); - var t1 = jxd4.redMul(jy2); - var nx = c.redSqr().redISub(t1.redAdd(t1)); - var t2 = t1.redISub(nx); - - var jyd8 = jy2.redSqr(); - jyd8 = jyd8.redIAdd(jyd8); - jyd8 = jyd8.redIAdd(jyd8); - jyd8 = jyd8.redIAdd(jyd8); - var ny = c.redMul(t2).redISub(jyd8); - var nz = jy.redAdd(jy).redMul(jz); - - return this.curve.jpoint(nx, ny, nz); -}; - -JPoint.prototype.trpl = function trpl() { - if (!this.curve.zeroA) - return this.dbl().add(this); - - // hyperelliptic.org/EFD/g1p/auto-shortw-jacobian-0.html#tripling-tpl-2007-bl - // 5M + 10S + ... - - // XX = X1^2 - var xx = this.x.redSqr(); - // YY = Y1^2 - var yy = this.y.redSqr(); - // ZZ = Z1^2 - var zz = this.z.redSqr(); - // YYYY = YY^2 - var yyyy = yy.redSqr(); - // M = 3 * XX + a * ZZ2; a = 0 - var m = xx.redAdd(xx).redIAdd(xx); - // MM = M^2 - var mm = m.redSqr(); - // E = 6 * ((X1 + YY)^2 - XX - YYYY) - MM - var e = this.x.redAdd(yy).redSqr().redISub(xx).redISub(yyyy); - e = e.redIAdd(e); - e = e.redAdd(e).redIAdd(e); - e = e.redISub(mm); - // EE = E^2 - var ee = e.redSqr(); - // T = 16*YYYY - var t = yyyy.redIAdd(yyyy); - t = t.redIAdd(t); - t = t.redIAdd(t); - t = t.redIAdd(t); - // U = (M + E)^2 - MM - EE - T - var u = m.redIAdd(e).redSqr().redISub(mm).redISub(ee).redISub(t); - // X3 = 4 * (X1 * EE - 4 * YY * U) - var yyu4 = yy.redMul(u); - yyu4 = yyu4.redIAdd(yyu4); - yyu4 = yyu4.redIAdd(yyu4); - var nx = this.x.redMul(ee).redISub(yyu4); - nx = nx.redIAdd(nx); - nx = nx.redIAdd(nx); - // Y3 = 8 * Y1 * (U * (T - U) - E * EE) - var ny = this.y.redMul(u.redMul(t.redISub(u)).redISub(e.redMul(ee))); - ny = ny.redIAdd(ny); - ny = ny.redIAdd(ny); - ny = ny.redIAdd(ny); - // Z3 = (Z1 + E)^2 - ZZ - EE - var nz = this.z.redAdd(e).redSqr().redISub(zz).redISub(ee); - - return this.curve.jpoint(nx, ny, nz); -}; - -JPoint.prototype.mul = function mul(k, kbase) { - k = new BN(k, kbase); - - return this.curve._wnafMul(this, k); -}; - -JPoint.prototype.eq = function eq(p) { - if (p.type === 'affine') - return this.eq(p.toJ()); - - if (this === p) - return true; - - // x1 * z2^2 == x2 * z1^2 - var z2 = this.z.redSqr(); - var pz2 = p.z.redSqr(); - if (this.x.redMul(pz2).redISub(p.x.redMul(z2)).cmpn(0) !== 0) - return false; - - // y1 * z2^3 == y2 * z1^3 - var z3 = z2.redMul(this.z); - var pz3 = pz2.redMul(p.z); - return this.y.redMul(pz3).redISub(p.y.redMul(z3)).cmpn(0) === 0; -}; - -JPoint.prototype.eqXToP = function eqXToP(x) { - var zs = this.z.redSqr(); - var rx = x.toRed(this.curve.red).redMul(zs); - if (this.x.cmp(rx) === 0) - return true; - - var xc = x.clone(); - var t = this.curve.redN.redMul(zs); - for (;;) { - xc.iadd(this.curve.n); - if (xc.cmp(this.curve.p) >= 0) - return false; - - rx.redIAdd(t); - if (this.x.cmp(rx) === 0) - return true; - } -}; - -JPoint.prototype.inspect = function inspect() { - if (this.isInfinity()) - return ''; - return ''; -}; - -JPoint.prototype.isInfinity = function isInfinity() { - // XXX This code assumes that zero is always zero in red - return this.z.cmpn(0) === 0; -}; - -},{"../utils":125,"./base":112,"bn.js":52,"inherits":156}],117:[function(require,module,exports){ -'use strict'; - -var curves = exports; - -var hash = require('hash.js'); -var curve = require('./curve'); -var utils = require('./utils'); - -var assert = utils.assert; - -function PresetCurve(options) { - if (options.type === 'short') - this.curve = new curve.short(options); - else if (options.type === 'edwards') - this.curve = new curve.edwards(options); - else - this.curve = new curve.mont(options); - this.g = this.curve.g; - this.n = this.curve.n; - this.hash = options.hash; - - assert(this.g.validate(), 'Invalid curve'); - assert(this.g.mul(this.n).isInfinity(), 'Invalid curve, G*N != O'); -} -curves.PresetCurve = PresetCurve; - -function defineCurve(name, options) { - Object.defineProperty(curves, name, { - configurable: true, - enumerable: true, - get: function() { - var curve = new PresetCurve(options); - Object.defineProperty(curves, name, { - configurable: true, - enumerable: true, - value: curve - }); - return curve; - } - }); -} - -defineCurve('p192', { - type: 'short', - prime: 'p192', - p: 'ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff', - a: 'ffffffff ffffffff ffffffff fffffffe ffffffff fffffffc', - b: '64210519 e59c80e7 0fa7e9ab 72243049 feb8deec c146b9b1', - n: 'ffffffff ffffffff ffffffff 99def836 146bc9b1 b4d22831', - hash: hash.sha256, - gRed: false, - g: [ - '188da80e b03090f6 7cbf20eb 43a18800 f4ff0afd 82ff1012', - '07192b95 ffc8da78 631011ed 6b24cdd5 73f977a1 1e794811' - ] -}); - -defineCurve('p224', { - type: 'short', - prime: 'p224', - p: 'ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001', - a: 'ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff fffffffe', - b: 'b4050a85 0c04b3ab f5413256 5044b0b7 d7bfd8ba 270b3943 2355ffb4', - n: 'ffffffff ffffffff ffffffff ffff16a2 e0b8f03e 13dd2945 5c5c2a3d', - hash: hash.sha256, - gRed: false, - g: [ - 'b70e0cbd 6bb4bf7f 321390b9 4a03c1d3 56c21122 343280d6 115c1d21', - 'bd376388 b5f723fb 4c22dfe6 cd4375a0 5a074764 44d58199 85007e34' - ] -}); - -defineCurve('p256', { - type: 'short', - prime: null, - p: 'ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff ffffffff', - a: 'ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff fffffffc', - b: '5ac635d8 aa3a93e7 b3ebbd55 769886bc 651d06b0 cc53b0f6 3bce3c3e 27d2604b', - n: 'ffffffff 00000000 ffffffff ffffffff bce6faad a7179e84 f3b9cac2 fc632551', - hash: hash.sha256, - gRed: false, - g: [ - '6b17d1f2 e12c4247 f8bce6e5 63a440f2 77037d81 2deb33a0 f4a13945 d898c296', - '4fe342e2 fe1a7f9b 8ee7eb4a 7c0f9e16 2bce3357 6b315ece cbb64068 37bf51f5' - ] -}); - -defineCurve('p384', { - type: 'short', - prime: null, - p: 'ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ' + - 'fffffffe ffffffff 00000000 00000000 ffffffff', - a: 'ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ' + - 'fffffffe ffffffff 00000000 00000000 fffffffc', - b: 'b3312fa7 e23ee7e4 988e056b e3f82d19 181d9c6e fe814112 0314088f ' + - '5013875a c656398d 8a2ed19d 2a85c8ed d3ec2aef', - n: 'ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff c7634d81 ' + - 'f4372ddf 581a0db2 48b0a77a ecec196a ccc52973', - hash: hash.sha384, - gRed: false, - g: [ - 'aa87ca22 be8b0537 8eb1c71e f320ad74 6e1d3b62 8ba79b98 59f741e0 82542a38 ' + - '5502f25d bf55296c 3a545e38 72760ab7', - '3617de4a 96262c6f 5d9e98bf 9292dc29 f8f41dbd 289a147c e9da3113 b5f0b8c0 ' + - '0a60b1ce 1d7e819d 7a431d7c 90ea0e5f' - ] -}); - -defineCurve('p521', { - type: 'short', - prime: null, - p: '000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ' + - 'ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ' + - 'ffffffff ffffffff ffffffff ffffffff ffffffff', - a: '000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ' + - 'ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ' + - 'ffffffff ffffffff ffffffff ffffffff fffffffc', - b: '00000051 953eb961 8e1c9a1f 929a21a0 b68540ee a2da725b ' + - '99b315f3 b8b48991 8ef109e1 56193951 ec7e937b 1652c0bd ' + - '3bb1bf07 3573df88 3d2c34f1 ef451fd4 6b503f00', - n: '000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ' + - 'ffffffff ffffffff fffffffa 51868783 bf2f966b 7fcc0148 ' + - 'f709a5d0 3bb5c9b8 899c47ae bb6fb71e 91386409', - hash: hash.sha512, - gRed: false, - g: [ - '000000c6 858e06b7 0404e9cd 9e3ecb66 2395b442 9c648139 ' + - '053fb521 f828af60 6b4d3dba a14b5e77 efe75928 fe1dc127 ' + - 'a2ffa8de 3348b3c1 856a429b f97e7e31 c2e5bd66', - '00000118 39296a78 9a3bc004 5c8a5fb4 2c7d1bd9 98f54449 ' + - '579b4468 17afbd17 273e662c 97ee7299 5ef42640 c550b901 ' + - '3fad0761 353c7086 a272c240 88be9476 9fd16650' - ] -}); - -defineCurve('curve25519', { - type: 'mont', - prime: 'p25519', - p: '7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed', - a: '76d06', - b: '1', - n: '1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed', - hash: hash.sha256, - gRed: false, - g: [ - '9' - ] -}); - -defineCurve('ed25519', { - type: 'edwards', - prime: 'p25519', - p: '7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed', - a: '-1', - c: '1', - // -121665 * (121666^(-1)) (mod P) - d: '52036cee2b6ffe73 8cc740797779e898 00700a4d4141d8ab 75eb4dca135978a3', - n: '1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed', - hash: hash.sha256, - gRed: false, - g: [ - '216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51a', - - // 4/5 - '6666666666666666666666666666666666666666666666666666666666666658' - ] -}); - -var pre; -try { - pre = require('./precomputed/secp256k1'); -} catch (e) { - pre = undefined; -} - -defineCurve('secp256k1', { - type: 'short', - prime: 'k256', - p: 'ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f', - a: '0', - b: '7', - n: 'ffffffff ffffffff ffffffff fffffffe baaedce6 af48a03b bfd25e8c d0364141', - h: '1', - hash: hash.sha256, - - // Precomputed endomorphism - beta: '7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee', - lambda: '5363ad4cc05c30e0a5261c028812645a122e22ea20816678df02967c1b23bd72', - basis: [ - { - a: '3086d221a7d46bcde86c90e49284eb15', - b: '-e4437ed6010e88286f547fa90abfe4c3' - }, - { - a: '114ca50f7a8e2f3f657c1108d9d44cfd8', - b: '3086d221a7d46bcde86c90e49284eb15' - } - ], - - gRed: false, - g: [ - '79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798', - '483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8', - pre - ] -}); - -},{"./curve":114,"./precomputed/secp256k1":124,"./utils":125,"hash.js":133}],118:[function(require,module,exports){ -'use strict'; - -var BN = require('bn.js'); -var HmacDRBG = require('hmac-drbg'); -var utils = require('../utils'); -var curves = require('../curves'); -var rand = require('brorand'); -var assert = utils.assert; - -var KeyPair = require('./key'); -var Signature = require('./signature'); - -function EC(options) { - if (!(this instanceof EC)) - return new EC(options); - - // Shortcut `elliptic.ec(curve-name)` - if (typeof options === 'string') { - assert(curves.hasOwnProperty(options), 'Unknown curve ' + options); - - options = curves[options]; - } - - // Shortcut for `elliptic.ec(elliptic.curves.curveName)` - if (options instanceof curves.PresetCurve) - options = { curve: options }; - - this.curve = options.curve.curve; - this.n = this.curve.n; - this.nh = this.n.ushrn(1); - this.g = this.curve.g; - - // Point on curve - this.g = options.curve.g; - this.g.precompute(options.curve.n.bitLength() + 1); - - // Hash for function for DRBG - this.hash = options.hash || options.curve.hash; -} -module.exports = EC; - -EC.prototype.keyPair = function keyPair(options) { - return new KeyPair(this, options); -}; - -EC.prototype.keyFromPrivate = function keyFromPrivate(priv, enc) { - return KeyPair.fromPrivate(this, priv, enc); -}; - -EC.prototype.keyFromPublic = function keyFromPublic(pub, enc) { - return KeyPair.fromPublic(this, pub, enc); -}; - -EC.prototype.genKeyPair = function genKeyPair(options) { - if (!options) - options = {}; - - // Instantiate Hmac_DRBG - var drbg = new HmacDRBG({ - hash: this.hash, - pers: options.pers, - persEnc: options.persEnc || 'utf8', - entropy: options.entropy || rand(this.hash.hmacStrength), - entropyEnc: options.entropy && options.entropyEnc || 'utf8', - nonce: this.n.toArray() - }); - - var bytes = this.n.byteLength(); - var ns2 = this.n.sub(new BN(2)); - do { - var priv = new BN(drbg.generate(bytes)); - if (priv.cmp(ns2) > 0) - continue; - - priv.iaddn(1); - return this.keyFromPrivate(priv); - } while (true); -}; - -EC.prototype._truncateToN = function truncateToN(msg, truncOnly) { - var delta = msg.byteLength() * 8 - this.n.bitLength(); - if (delta > 0) - msg = msg.ushrn(delta); - if (!truncOnly && msg.cmp(this.n) >= 0) - return msg.sub(this.n); - else - return msg; -}; - -EC.prototype.sign = function sign(msg, key, enc, options) { - if (typeof enc === 'object') { - options = enc; - enc = null; - } - if (!options) - options = {}; - - key = this.keyFromPrivate(key, enc); - msg = this._truncateToN(new BN(msg, 16)); - - // Zero-extend key to provide enough entropy - var bytes = this.n.byteLength(); - var bkey = key.getPrivate().toArray('be', bytes); - - // Zero-extend nonce to have the same byte size as N - var nonce = msg.toArray('be', bytes); - - // Instantiate Hmac_DRBG - var drbg = new HmacDRBG({ - hash: this.hash, - entropy: bkey, - nonce: nonce, - pers: options.pers, - persEnc: options.persEnc || 'utf8' - }); - - // Number of bytes to generate - var ns1 = this.n.sub(new BN(1)); - - for (var iter = 0; true; iter++) { - var k = options.k ? - options.k(iter) : - new BN(drbg.generate(this.n.byteLength())); - k = this._truncateToN(k, true); - if (k.cmpn(1) <= 0 || k.cmp(ns1) >= 0) - continue; - - var kp = this.g.mul(k); - if (kp.isInfinity()) - continue; - - var kpX = kp.getX(); - var r = kpX.umod(this.n); - if (r.cmpn(0) === 0) - continue; - - var s = k.invm(this.n).mul(r.mul(key.getPrivate()).iadd(msg)); - s = s.umod(this.n); - if (s.cmpn(0) === 0) - continue; - - var recoveryParam = (kp.getY().isOdd() ? 1 : 0) | - (kpX.cmp(r) !== 0 ? 2 : 0); - - // Use complement of `s`, if it is > `n / 2` - if (options.canonical && s.cmp(this.nh) > 0) { - s = this.n.sub(s); - recoveryParam ^= 1; - } - - return new Signature({ r: r, s: s, recoveryParam: recoveryParam }); - } -}; - -EC.prototype.verify = function verify(msg, signature, key, enc) { - msg = this._truncateToN(new BN(msg, 16)); - key = this.keyFromPublic(key, enc); - signature = new Signature(signature, 'hex'); - - // Perform primitive values validation - var r = signature.r; - var s = signature.s; - if (r.cmpn(1) < 0 || r.cmp(this.n) >= 0) - return false; - if (s.cmpn(1) < 0 || s.cmp(this.n) >= 0) - return false; - - // Validate signature - var sinv = s.invm(this.n); - var u1 = sinv.mul(msg).umod(this.n); - var u2 = sinv.mul(r).umod(this.n); - - if (!this.curve._maxwellTrick) { - var p = this.g.mulAdd(u1, key.getPublic(), u2); - if (p.isInfinity()) - return false; - - return p.getX().umod(this.n).cmp(r) === 0; - } - - // NOTE: Greg Maxwell's trick, inspired by: - // https://git.io/vad3K - - var p = this.g.jmulAdd(u1, key.getPublic(), u2); - if (p.isInfinity()) - return false; - - // Compare `p.x` of Jacobian point with `r`, - // this will do `p.x == r * p.z^2` instead of multiplying `p.x` by the - // inverse of `p.z^2` - return p.eqXToP(r); -}; - -EC.prototype.recoverPubKey = function(msg, signature, j, enc) { - assert((3 & j) === j, 'The recovery param is more than two bits'); - signature = new Signature(signature, enc); - - var n = this.n; - var e = new BN(msg); - var r = signature.r; - var s = signature.s; - - // A set LSB signifies that the y-coordinate is odd - var isYOdd = j & 1; - var isSecondKey = j >> 1; - if (r.cmp(this.curve.p.umod(this.curve.n)) >= 0 && isSecondKey) - throw new Error('Unable to find sencond key candinate'); - - // 1.1. Let x = r + jn. - if (isSecondKey) - r = this.curve.pointFromX(r.add(this.curve.n), isYOdd); - else - r = this.curve.pointFromX(r, isYOdd); - - var rInv = signature.r.invm(n); - var s1 = n.sub(e).mul(rInv).umod(n); - var s2 = s.mul(rInv).umod(n); - - // 1.6.1 Compute Q = r^-1 (sR - eG) - // Q = r^-1 (sR + -eG) - return this.g.mulAdd(s1, r, s2); -}; - -EC.prototype.getKeyRecoveryParam = function(e, signature, Q, enc) { - signature = new Signature(signature, enc); - if (signature.recoveryParam !== null) - return signature.recoveryParam; - - for (var i = 0; i < 4; i++) { - var Qprime; - try { - Qprime = this.recoverPubKey(e, signature, i); - } catch (e) { - continue; - } - - if (Qprime.eq(Q)) - return i; - } - throw new Error('Unable to find valid recovery factor'); -}; - -},{"../curves":117,"../utils":125,"./key":119,"./signature":120,"bn.js":52,"brorand":53,"hmac-drbg":145}],119:[function(require,module,exports){ -'use strict'; - -var BN = require('bn.js'); -var utils = require('../utils'); -var assert = utils.assert; - -function KeyPair(ec, options) { - this.ec = ec; - this.priv = null; - this.pub = null; - - // KeyPair(ec, { priv: ..., pub: ... }) - if (options.priv) - this._importPrivate(options.priv, options.privEnc); - if (options.pub) - this._importPublic(options.pub, options.pubEnc); -} -module.exports = KeyPair; - -KeyPair.fromPublic = function fromPublic(ec, pub, enc) { - if (pub instanceof KeyPair) - return pub; - - return new KeyPair(ec, { - pub: pub, - pubEnc: enc - }); -}; - -KeyPair.fromPrivate = function fromPrivate(ec, priv, enc) { - if (priv instanceof KeyPair) - return priv; - - return new KeyPair(ec, { - priv: priv, - privEnc: enc - }); -}; - -KeyPair.prototype.validate = function validate() { - var pub = this.getPublic(); - - if (pub.isInfinity()) - return { result: false, reason: 'Invalid public key' }; - if (!pub.validate()) - return { result: false, reason: 'Public key is not a point' }; - if (!pub.mul(this.ec.curve.n).isInfinity()) - return { result: false, reason: 'Public key * N != O' }; - - return { result: true, reason: null }; -}; - -KeyPair.prototype.getPublic = function getPublic(compact, enc) { - // compact is optional argument - if (typeof compact === 'string') { - enc = compact; - compact = null; - } - - if (!this.pub) - this.pub = this.ec.g.mul(this.priv); - - if (!enc) - return this.pub; - - return this.pub.encode(enc, compact); -}; - -KeyPair.prototype.getPrivate = function getPrivate(enc) { - if (enc === 'hex') - return this.priv.toString(16, 2); - else - return this.priv; -}; - -KeyPair.prototype._importPrivate = function _importPrivate(key, enc) { - this.priv = new BN(key, enc || 16); - - // Ensure that the priv won't be bigger than n, otherwise we may fail - // in fixed multiplication method - this.priv = this.priv.umod(this.ec.curve.n); -}; - -KeyPair.prototype._importPublic = function _importPublic(key, enc) { - if (key.x || key.y) { - // Montgomery points only have an `x` coordinate. - // Weierstrass/Edwards points on the other hand have both `x` and - // `y` coordinates. - if (this.ec.curve.type === 'mont') { - assert(key.x, 'Need x coordinate'); - } else if (this.ec.curve.type === 'short' || - this.ec.curve.type === 'edwards') { - assert(key.x && key.y, 'Need both x and y coordinate'); - } - this.pub = this.ec.curve.point(key.x, key.y); - return; - } - this.pub = this.ec.curve.decodePoint(key, enc); -}; - -// ECDH -KeyPair.prototype.derive = function derive(pub) { - return pub.mul(this.priv).getX(); -}; - -// ECDSA -KeyPair.prototype.sign = function sign(msg, enc, options) { - return this.ec.sign(msg, this, enc, options); -}; - -KeyPair.prototype.verify = function verify(msg, signature) { - return this.ec.verify(msg, signature, this); -}; - -KeyPair.prototype.inspect = function inspect() { - return ''; -}; - -},{"../utils":125,"bn.js":52}],120:[function(require,module,exports){ -'use strict'; - -var BN = require('bn.js'); - -var utils = require('../utils'); -var assert = utils.assert; - -function Signature(options, enc) { - if (options instanceof Signature) - return options; - - if (this._importDER(options, enc)) - return; - - assert(options.r && options.s, 'Signature without r or s'); - this.r = new BN(options.r, 16); - this.s = new BN(options.s, 16); - if (options.recoveryParam === undefined) - this.recoveryParam = null; - else - this.recoveryParam = options.recoveryParam; -} -module.exports = Signature; - -function Position() { - this.place = 0; -} - -function getLength(buf, p) { - var initial = buf[p.place++]; - if (!(initial & 0x80)) { - return initial; - } - var octetLen = initial & 0xf; - - // Indefinite length or overflow - if (octetLen === 0 || octetLen > 4) { - return false; - } - - var val = 0; - for (var i = 0, off = p.place; i < octetLen; i++, off++) { - val <<= 8; - val |= buf[off]; - val >>>= 0; - } - - // Leading zeroes - if (val <= 0x7f) { - return false; - } - - p.place = off; - return val; -} - -function rmPadding(buf) { - var i = 0; - var len = buf.length - 1; - while (!buf[i] && !(buf[i + 1] & 0x80) && i < len) { - i++; - } - if (i === 0) { - return buf; - } - return buf.slice(i); -} - -Signature.prototype._importDER = function _importDER(data, enc) { - data = utils.toArray(data, enc); - var p = new Position(); - if (data[p.place++] !== 0x30) { - return false; - } - var len = getLength(data, p); - if (len === false) { - return false; - } - if ((len + p.place) !== data.length) { - return false; - } - if (data[p.place++] !== 0x02) { - return false; - } - var rlen = getLength(data, p); - if (rlen === false) { - return false; - } - var r = data.slice(p.place, rlen + p.place); - p.place += rlen; - if (data[p.place++] !== 0x02) { - return false; - } - var slen = getLength(data, p); - if (slen === false) { - return false; - } - if (data.length !== slen + p.place) { - return false; - } - var s = data.slice(p.place, slen + p.place); - if (r[0] === 0) { - if (r[1] & 0x80) { - r = r.slice(1); - } else { - // Leading zeroes - return false; - } - } - if (s[0] === 0) { - if (s[1] & 0x80) { - s = s.slice(1); - } else { - // Leading zeroes - return false; - } - } - - this.r = new BN(r); - this.s = new BN(s); - this.recoveryParam = null; - - return true; -}; - -function constructLength(arr, len) { - if (len < 0x80) { - arr.push(len); - return; - } - var octets = 1 + (Math.log(len) / Math.LN2 >>> 3); - arr.push(octets | 0x80); - while (--octets) { - arr.push((len >>> (octets << 3)) & 0xff); - } - arr.push(len); -} - -Signature.prototype.toDER = function toDER(enc) { - var r = this.r.toArray(); - var s = this.s.toArray(); - - // Pad values - if (r[0] & 0x80) - r = [ 0 ].concat(r); - // Pad values - if (s[0] & 0x80) - s = [ 0 ].concat(s); - - r = rmPadding(r); - s = rmPadding(s); - - while (!s[0] && !(s[1] & 0x80)) { - s = s.slice(1); - } - var arr = [ 0x02 ]; - constructLength(arr, r.length); - arr = arr.concat(r); - arr.push(0x02); - constructLength(arr, s.length); - var backHalf = arr.concat(s); - var res = [ 0x30 ]; - constructLength(res, backHalf.length); - res = res.concat(backHalf); - return utils.encode(res, enc); -}; - -},{"../utils":125,"bn.js":52}],121:[function(require,module,exports){ -'use strict'; - -var hash = require('hash.js'); -var curves = require('../curves'); -var utils = require('../utils'); -var assert = utils.assert; -var parseBytes = utils.parseBytes; -var KeyPair = require('./key'); -var Signature = require('./signature'); - -function EDDSA(curve) { - assert(curve === 'ed25519', 'only tested with ed25519 so far'); - - if (!(this instanceof EDDSA)) - return new EDDSA(curve); - - var curve = curves[curve].curve; - this.curve = curve; - this.g = curve.g; - this.g.precompute(curve.n.bitLength() + 1); - - this.pointClass = curve.point().constructor; - this.encodingLength = Math.ceil(curve.n.bitLength() / 8); - this.hash = hash.sha512; -} - -module.exports = EDDSA; - -/** -* @param {Array|String} message - message bytes -* @param {Array|String|KeyPair} secret - secret bytes or a keypair -* @returns {Signature} - signature -*/ -EDDSA.prototype.sign = function sign(message, secret) { - message = parseBytes(message); - var key = this.keyFromSecret(secret); - var r = this.hashInt(key.messagePrefix(), message); - var R = this.g.mul(r); - var Rencoded = this.encodePoint(R); - var s_ = this.hashInt(Rencoded, key.pubBytes(), message) - .mul(key.priv()); - var S = r.add(s_).umod(this.curve.n); - return this.makeSignature({ R: R, S: S, Rencoded: Rencoded }); -}; - -/** -* @param {Array} message - message bytes -* @param {Array|String|Signature} sig - sig bytes -* @param {Array|String|Point|KeyPair} pub - public key -* @returns {Boolean} - true if public key matches sig of message -*/ -EDDSA.prototype.verify = function verify(message, sig, pub) { - message = parseBytes(message); - sig = this.makeSignature(sig); - var key = this.keyFromPublic(pub); - var h = this.hashInt(sig.Rencoded(), key.pubBytes(), message); - var SG = this.g.mul(sig.S()); - var RplusAh = sig.R().add(key.pub().mul(h)); - return RplusAh.eq(SG); -}; - -EDDSA.prototype.hashInt = function hashInt() { - var hash = this.hash(); - for (var i = 0; i < arguments.length; i++) - hash.update(arguments[i]); - return utils.intFromLE(hash.digest()).umod(this.curve.n); -}; - -EDDSA.prototype.keyFromPublic = function keyFromPublic(pub) { - return KeyPair.fromPublic(this, pub); -}; - -EDDSA.prototype.keyFromSecret = function keyFromSecret(secret) { - return KeyPair.fromSecret(this, secret); -}; - -EDDSA.prototype.makeSignature = function makeSignature(sig) { - if (sig instanceof Signature) - return sig; - return new Signature(this, sig); -}; - -/** -* * https://tools.ietf.org/html/draft-josefsson-eddsa-ed25519-03#section-5.2 -* -* EDDSA defines methods for encoding and decoding points and integers. These are -* helper convenience methods, that pass along to utility functions implied -* parameters. -* -*/ -EDDSA.prototype.encodePoint = function encodePoint(point) { - var enc = point.getY().toArray('le', this.encodingLength); - enc[this.encodingLength - 1] |= point.getX().isOdd() ? 0x80 : 0; - return enc; -}; - -EDDSA.prototype.decodePoint = function decodePoint(bytes) { - bytes = utils.parseBytes(bytes); - - var lastIx = bytes.length - 1; - var normed = bytes.slice(0, lastIx).concat(bytes[lastIx] & ~0x80); - var xIsOdd = (bytes[lastIx] & 0x80) !== 0; - - var y = utils.intFromLE(normed); - return this.curve.pointFromY(y, xIsOdd); -}; - -EDDSA.prototype.encodeInt = function encodeInt(num) { - return num.toArray('le', this.encodingLength); -}; - -EDDSA.prototype.decodeInt = function decodeInt(bytes) { - return utils.intFromLE(bytes); -}; - -EDDSA.prototype.isPoint = function isPoint(val) { - return val instanceof this.pointClass; -}; - -},{"../curves":117,"../utils":125,"./key":122,"./signature":123,"hash.js":133}],122:[function(require,module,exports){ -'use strict'; - -var utils = require('../utils'); -var assert = utils.assert; -var parseBytes = utils.parseBytes; -var cachedProperty = utils.cachedProperty; - -/** -* @param {EDDSA} eddsa - instance -* @param {Object} params - public/private key parameters -* -* @param {Array} [params.secret] - secret seed bytes -* @param {Point} [params.pub] - public key point (aka `A` in eddsa terms) -* @param {Array} [params.pub] - public key point encoded as bytes -* -*/ -function KeyPair(eddsa, params) { - this.eddsa = eddsa; - this._secret = parseBytes(params.secret); - if (eddsa.isPoint(params.pub)) - this._pub = params.pub; - else - this._pubBytes = parseBytes(params.pub); -} - -KeyPair.fromPublic = function fromPublic(eddsa, pub) { - if (pub instanceof KeyPair) - return pub; - return new KeyPair(eddsa, { pub: pub }); -}; - -KeyPair.fromSecret = function fromSecret(eddsa, secret) { - if (secret instanceof KeyPair) - return secret; - return new KeyPair(eddsa, { secret: secret }); -}; - -KeyPair.prototype.secret = function secret() { - return this._secret; -}; - -cachedProperty(KeyPair, 'pubBytes', function pubBytes() { - return this.eddsa.encodePoint(this.pub()); -}); - -cachedProperty(KeyPair, 'pub', function pub() { - if (this._pubBytes) - return this.eddsa.decodePoint(this._pubBytes); - return this.eddsa.g.mul(this.priv()); -}); - -cachedProperty(KeyPair, 'privBytes', function privBytes() { - var eddsa = this.eddsa; - var hash = this.hash(); - var lastIx = eddsa.encodingLength - 1; - - var a = hash.slice(0, eddsa.encodingLength); - a[0] &= 248; - a[lastIx] &= 127; - a[lastIx] |= 64; - - return a; -}); - -cachedProperty(KeyPair, 'priv', function priv() { - return this.eddsa.decodeInt(this.privBytes()); -}); - -cachedProperty(KeyPair, 'hash', function hash() { - return this.eddsa.hash().update(this.secret()).digest(); -}); - -cachedProperty(KeyPair, 'messagePrefix', function messagePrefix() { - return this.hash().slice(this.eddsa.encodingLength); -}); - -KeyPair.prototype.sign = function sign(message) { - assert(this._secret, 'KeyPair can only verify'); - return this.eddsa.sign(message, this); -}; - -KeyPair.prototype.verify = function verify(message, sig) { - return this.eddsa.verify(message, sig, this); -}; - -KeyPair.prototype.getSecret = function getSecret(enc) { - assert(this._secret, 'KeyPair is public only'); - return utils.encode(this.secret(), enc); -}; - -KeyPair.prototype.getPublic = function getPublic(enc) { - return utils.encode(this.pubBytes(), enc); -}; - -module.exports = KeyPair; - -},{"../utils":125}],123:[function(require,module,exports){ -'use strict'; - -var BN = require('bn.js'); -var utils = require('../utils'); -var assert = utils.assert; -var cachedProperty = utils.cachedProperty; -var parseBytes = utils.parseBytes; - -/** -* @param {EDDSA} eddsa - eddsa instance -* @param {Array|Object} sig - -* @param {Array|Point} [sig.R] - R point as Point or bytes -* @param {Array|bn} [sig.S] - S scalar as bn or bytes -* @param {Array} [sig.Rencoded] - R point encoded -* @param {Array} [sig.Sencoded] - S scalar encoded -*/ -function Signature(eddsa, sig) { - this.eddsa = eddsa; - - if (typeof sig !== 'object') - sig = parseBytes(sig); - - if (Array.isArray(sig)) { - sig = { - R: sig.slice(0, eddsa.encodingLength), - S: sig.slice(eddsa.encodingLength) - }; - } - - assert(sig.R && sig.S, 'Signature without R or S'); - - if (eddsa.isPoint(sig.R)) - this._R = sig.R; - if (sig.S instanceof BN) - this._S = sig.S; - - this._Rencoded = Array.isArray(sig.R) ? sig.R : sig.Rencoded; - this._Sencoded = Array.isArray(sig.S) ? sig.S : sig.Sencoded; -} - -cachedProperty(Signature, 'S', function S() { - return this.eddsa.decodeInt(this.Sencoded()); -}); - -cachedProperty(Signature, 'R', function R() { - return this.eddsa.decodePoint(this.Rencoded()); -}); - -cachedProperty(Signature, 'Rencoded', function Rencoded() { - return this.eddsa.encodePoint(this.R()); -}); - -cachedProperty(Signature, 'Sencoded', function Sencoded() { - return this.eddsa.encodeInt(this.S()); -}); - -Signature.prototype.toBytes = function toBytes() { - return this.Rencoded().concat(this.Sencoded()); -}; - -Signature.prototype.toHex = function toHex() { - return utils.encode(this.toBytes(), 'hex').toUpperCase(); -}; - -module.exports = Signature; - -},{"../utils":125,"bn.js":52}],124:[function(require,module,exports){ -module.exports = { - doubles: { - step: 4, - points: [ - [ - 'e60fce93b59e9ec53011aabc21c23e97b2a31369b87a5ae9c44ee89e2a6dec0a', - 'f7e3507399e595929db99f34f57937101296891e44d23f0be1f32cce69616821' - ], - [ - '8282263212c609d9ea2a6e3e172de238d8c39cabd5ac1ca10646e23fd5f51508', - '11f8a8098557dfe45e8256e830b60ace62d613ac2f7b17bed31b6eaff6e26caf' - ], - [ - '175e159f728b865a72f99cc6c6fc846de0b93833fd2222ed73fce5b551e5b739', - 'd3506e0d9e3c79eba4ef97a51ff71f5eacb5955add24345c6efa6ffee9fed695' - ], - [ - '363d90d447b00c9c99ceac05b6262ee053441c7e55552ffe526bad8f83ff4640', - '4e273adfc732221953b445397f3363145b9a89008199ecb62003c7f3bee9de9' - ], - [ - '8b4b5f165df3c2be8c6244b5b745638843e4a781a15bcd1b69f79a55dffdf80c', - '4aad0a6f68d308b4b3fbd7813ab0da04f9e336546162ee56b3eff0c65fd4fd36' - ], - [ - '723cbaa6e5db996d6bf771c00bd548c7b700dbffa6c0e77bcb6115925232fcda', - '96e867b5595cc498a921137488824d6e2660a0653779494801dc069d9eb39f5f' - ], - [ - 'eebfa4d493bebf98ba5feec812c2d3b50947961237a919839a533eca0e7dd7fa', - '5d9a8ca3970ef0f269ee7edaf178089d9ae4cdc3a711f712ddfd4fdae1de8999' - ], - [ - '100f44da696e71672791d0a09b7bde459f1215a29b3c03bfefd7835b39a48db0', - 'cdd9e13192a00b772ec8f3300c090666b7ff4a18ff5195ac0fbd5cd62bc65a09' - ], - [ - 'e1031be262c7ed1b1dc9227a4a04c017a77f8d4464f3b3852c8acde6e534fd2d', - '9d7061928940405e6bb6a4176597535af292dd419e1ced79a44f18f29456a00d' - ], - [ - 'feea6cae46d55b530ac2839f143bd7ec5cf8b266a41d6af52d5e688d9094696d', - 'e57c6b6c97dce1bab06e4e12bf3ecd5c981c8957cc41442d3155debf18090088' - ], - [ - 'da67a91d91049cdcb367be4be6ffca3cfeed657d808583de33fa978bc1ec6cb1', - '9bacaa35481642bc41f463f7ec9780e5dec7adc508f740a17e9ea8e27a68be1d' - ], - [ - '53904faa0b334cdda6e000935ef22151ec08d0f7bb11069f57545ccc1a37b7c0', - '5bc087d0bc80106d88c9eccac20d3c1c13999981e14434699dcb096b022771c8' - ], - [ - '8e7bcd0bd35983a7719cca7764ca906779b53a043a9b8bcaeff959f43ad86047', - '10b7770b2a3da4b3940310420ca9514579e88e2e47fd68b3ea10047e8460372a' - ], - [ - '385eed34c1cdff21e6d0818689b81bde71a7f4f18397e6690a841e1599c43862', - '283bebc3e8ea23f56701de19e9ebf4576b304eec2086dc8cc0458fe5542e5453' - ], - [ - '6f9d9b803ecf191637c73a4413dfa180fddf84a5947fbc9c606ed86c3fac3a7', - '7c80c68e603059ba69b8e2a30e45c4d47ea4dd2f5c281002d86890603a842160' - ], - [ - '3322d401243c4e2582a2147c104d6ecbf774d163db0f5e5313b7e0e742d0e6bd', - '56e70797e9664ef5bfb019bc4ddaf9b72805f63ea2873af624f3a2e96c28b2a0' - ], - [ - '85672c7d2de0b7da2bd1770d89665868741b3f9af7643397721d74d28134ab83', - '7c481b9b5b43b2eb6374049bfa62c2e5e77f17fcc5298f44c8e3094f790313a6' - ], - [ - '948bf809b1988a46b06c9f1919413b10f9226c60f668832ffd959af60c82a0a', - '53a562856dcb6646dc6b74c5d1c3418c6d4dff08c97cd2bed4cb7f88d8c8e589' - ], - [ - '6260ce7f461801c34f067ce0f02873a8f1b0e44dfc69752accecd819f38fd8e8', - 'bc2da82b6fa5b571a7f09049776a1ef7ecd292238051c198c1a84e95b2b4ae17' - ], - [ - 'e5037de0afc1d8d43d8348414bbf4103043ec8f575bfdc432953cc8d2037fa2d', - '4571534baa94d3b5f9f98d09fb990bddbd5f5b03ec481f10e0e5dc841d755bda' - ], - [ - 'e06372b0f4a207adf5ea905e8f1771b4e7e8dbd1c6a6c5b725866a0ae4fce725', - '7a908974bce18cfe12a27bb2ad5a488cd7484a7787104870b27034f94eee31dd' - ], - [ - '213c7a715cd5d45358d0bbf9dc0ce02204b10bdde2a3f58540ad6908d0559754', - '4b6dad0b5ae462507013ad06245ba190bb4850f5f36a7eeddff2c27534b458f2' - ], - [ - '4e7c272a7af4b34e8dbb9352a5419a87e2838c70adc62cddf0cc3a3b08fbd53c', - '17749c766c9d0b18e16fd09f6def681b530b9614bff7dd33e0b3941817dcaae6' - ], - [ - 'fea74e3dbe778b1b10f238ad61686aa5c76e3db2be43057632427e2840fb27b6', - '6e0568db9b0b13297cf674deccb6af93126b596b973f7b77701d3db7f23cb96f' - ], - [ - '76e64113f677cf0e10a2570d599968d31544e179b760432952c02a4417bdde39', - 'c90ddf8dee4e95cf577066d70681f0d35e2a33d2b56d2032b4b1752d1901ac01' - ], - [ - 'c738c56b03b2abe1e8281baa743f8f9a8f7cc643df26cbee3ab150242bcbb891', - '893fb578951ad2537f718f2eacbfbbbb82314eef7880cfe917e735d9699a84c3' - ], - [ - 'd895626548b65b81e264c7637c972877d1d72e5f3a925014372e9f6588f6c14b', - 'febfaa38f2bc7eae728ec60818c340eb03428d632bb067e179363ed75d7d991f' - ], - [ - 'b8da94032a957518eb0f6433571e8761ceffc73693e84edd49150a564f676e03', - '2804dfa44805a1e4d7c99cc9762808b092cc584d95ff3b511488e4e74efdf6e7' - ], - [ - 'e80fea14441fb33a7d8adab9475d7fab2019effb5156a792f1a11778e3c0df5d', - 'eed1de7f638e00771e89768ca3ca94472d155e80af322ea9fcb4291b6ac9ec78' - ], - [ - 'a301697bdfcd704313ba48e51d567543f2a182031efd6915ddc07bbcc4e16070', - '7370f91cfb67e4f5081809fa25d40f9b1735dbf7c0a11a130c0d1a041e177ea1' - ], - [ - '90ad85b389d6b936463f9d0512678de208cc330b11307fffab7ac63e3fb04ed4', - 'e507a3620a38261affdcbd9427222b839aefabe1582894d991d4d48cb6ef150' - ], - [ - '8f68b9d2f63b5f339239c1ad981f162ee88c5678723ea3351b7b444c9ec4c0da', - '662a9f2dba063986de1d90c2b6be215dbbea2cfe95510bfdf23cbf79501fff82' - ], - [ - 'e4f3fb0176af85d65ff99ff9198c36091f48e86503681e3e6686fd5053231e11', - '1e63633ad0ef4f1c1661a6d0ea02b7286cc7e74ec951d1c9822c38576feb73bc' - ], - [ - '8c00fa9b18ebf331eb961537a45a4266c7034f2f0d4e1d0716fb6eae20eae29e', - 'efa47267fea521a1a9dc343a3736c974c2fadafa81e36c54e7d2a4c66702414b' - ], - [ - 'e7a26ce69dd4829f3e10cec0a9e98ed3143d084f308b92c0997fddfc60cb3e41', - '2a758e300fa7984b471b006a1aafbb18d0a6b2c0420e83e20e8a9421cf2cfd51' - ], - [ - 'b6459e0ee3662ec8d23540c223bcbdc571cbcb967d79424f3cf29eb3de6b80ef', - '67c876d06f3e06de1dadf16e5661db3c4b3ae6d48e35b2ff30bf0b61a71ba45' - ], - [ - 'd68a80c8280bb840793234aa118f06231d6f1fc67e73c5a5deda0f5b496943e8', - 'db8ba9fff4b586d00c4b1f9177b0e28b5b0e7b8f7845295a294c84266b133120' - ], - [ - '324aed7df65c804252dc0270907a30b09612aeb973449cea4095980fc28d3d5d', - '648a365774b61f2ff130c0c35aec1f4f19213b0c7e332843967224af96ab7c84' - ], - [ - '4df9c14919cde61f6d51dfdbe5fee5dceec4143ba8d1ca888e8bd373fd054c96', - '35ec51092d8728050974c23a1d85d4b5d506cdc288490192ebac06cad10d5d' - ], - [ - '9c3919a84a474870faed8a9c1cc66021523489054d7f0308cbfc99c8ac1f98cd', - 'ddb84f0f4a4ddd57584f044bf260e641905326f76c64c8e6be7e5e03d4fc599d' - ], - [ - '6057170b1dd12fdf8de05f281d8e06bb91e1493a8b91d4cc5a21382120a959e5', - '9a1af0b26a6a4807add9a2daf71df262465152bc3ee24c65e899be932385a2a8' - ], - [ - 'a576df8e23a08411421439a4518da31880cef0fba7d4df12b1a6973eecb94266', - '40a6bf20e76640b2c92b97afe58cd82c432e10a7f514d9f3ee8be11ae1b28ec8' - ], - [ - '7778a78c28dec3e30a05fe9629de8c38bb30d1f5cf9a3a208f763889be58ad71', - '34626d9ab5a5b22ff7098e12f2ff580087b38411ff24ac563b513fc1fd9f43ac' - ], - [ - '928955ee637a84463729fd30e7afd2ed5f96274e5ad7e5cb09eda9c06d903ac', - 'c25621003d3f42a827b78a13093a95eeac3d26efa8a8d83fc5180e935bcd091f' - ], - [ - '85d0fef3ec6db109399064f3a0e3b2855645b4a907ad354527aae75163d82751', - '1f03648413a38c0be29d496e582cf5663e8751e96877331582c237a24eb1f962' - ], - [ - 'ff2b0dce97eece97c1c9b6041798b85dfdfb6d8882da20308f5404824526087e', - '493d13fef524ba188af4c4dc54d07936c7b7ed6fb90e2ceb2c951e01f0c29907' - ], - [ - '827fbbe4b1e880ea9ed2b2e6301b212b57f1ee148cd6dd28780e5e2cf856e241', - 'c60f9c923c727b0b71bef2c67d1d12687ff7a63186903166d605b68baec293ec' - ], - [ - 'eaa649f21f51bdbae7be4ae34ce6e5217a58fdce7f47f9aa7f3b58fa2120e2b3', - 'be3279ed5bbbb03ac69a80f89879aa5a01a6b965f13f7e59d47a5305ba5ad93d' - ], - [ - 'e4a42d43c5cf169d9391df6decf42ee541b6d8f0c9a137401e23632dda34d24f', - '4d9f92e716d1c73526fc99ccfb8ad34ce886eedfa8d8e4f13a7f7131deba9414' - ], - [ - '1ec80fef360cbdd954160fadab352b6b92b53576a88fea4947173b9d4300bf19', - 'aeefe93756b5340d2f3a4958a7abbf5e0146e77f6295a07b671cdc1cc107cefd' - ], - [ - '146a778c04670c2f91b00af4680dfa8bce3490717d58ba889ddb5928366642be', - 'b318e0ec3354028add669827f9d4b2870aaa971d2f7e5ed1d0b297483d83efd0' - ], - [ - 'fa50c0f61d22e5f07e3acebb1aa07b128d0012209a28b9776d76a8793180eef9', - '6b84c6922397eba9b72cd2872281a68a5e683293a57a213b38cd8d7d3f4f2811' - ], - [ - 'da1d61d0ca721a11b1a5bf6b7d88e8421a288ab5d5bba5220e53d32b5f067ec2', - '8157f55a7c99306c79c0766161c91e2966a73899d279b48a655fba0f1ad836f1' - ], - [ - 'a8e282ff0c9706907215ff98e8fd416615311de0446f1e062a73b0610d064e13', - '7f97355b8db81c09abfb7f3c5b2515888b679a3e50dd6bd6cef7c73111f4cc0c' - ], - [ - '174a53b9c9a285872d39e56e6913cab15d59b1fa512508c022f382de8319497c', - 'ccc9dc37abfc9c1657b4155f2c47f9e6646b3a1d8cb9854383da13ac079afa73' - ], - [ - '959396981943785c3d3e57edf5018cdbe039e730e4918b3d884fdff09475b7ba', - '2e7e552888c331dd8ba0386a4b9cd6849c653f64c8709385e9b8abf87524f2fd' - ], - [ - 'd2a63a50ae401e56d645a1153b109a8fcca0a43d561fba2dbb51340c9d82b151', - 'e82d86fb6443fcb7565aee58b2948220a70f750af484ca52d4142174dcf89405' - ], - [ - '64587e2335471eb890ee7896d7cfdc866bacbdbd3839317b3436f9b45617e073', - 'd99fcdd5bf6902e2ae96dd6447c299a185b90a39133aeab358299e5e9faf6589' - ], - [ - '8481bde0e4e4d885b3a546d3e549de042f0aa6cea250e7fd358d6c86dd45e458', - '38ee7b8cba5404dd84a25bf39cecb2ca900a79c42b262e556d64b1b59779057e' - ], - [ - '13464a57a78102aa62b6979ae817f4637ffcfed3c4b1ce30bcd6303f6caf666b', - '69be159004614580ef7e433453ccb0ca48f300a81d0942e13f495a907f6ecc27' - ], - [ - 'bc4a9df5b713fe2e9aef430bcc1dc97a0cd9ccede2f28588cada3a0d2d83f366', - 'd3a81ca6e785c06383937adf4b798caa6e8a9fbfa547b16d758d666581f33c1' - ], - [ - '8c28a97bf8298bc0d23d8c749452a32e694b65e30a9472a3954ab30fe5324caa', - '40a30463a3305193378fedf31f7cc0eb7ae784f0451cb9459e71dc73cbef9482' - ], - [ - '8ea9666139527a8c1dd94ce4f071fd23c8b350c5a4bb33748c4ba111faccae0', - '620efabbc8ee2782e24e7c0cfb95c5d735b783be9cf0f8e955af34a30e62b945' - ], - [ - 'dd3625faef5ba06074669716bbd3788d89bdde815959968092f76cc4eb9a9787', - '7a188fa3520e30d461da2501045731ca941461982883395937f68d00c644a573' - ], - [ - 'f710d79d9eb962297e4f6232b40e8f7feb2bc63814614d692c12de752408221e', - 'ea98e67232d3b3295d3b535532115ccac8612c721851617526ae47a9c77bfc82' - ] - ] - }, - naf: { - wnd: 7, - points: [ - [ - 'f9308a019258c31049344f85f89d5229b531c845836f99b08601f113bce036f9', - '388f7b0f632de8140fe337e62a37f3566500a99934c2231b6cb9fd7584b8e672' - ], - [ - '2f8bde4d1a07209355b4a7250a5c5128e88b84bddc619ab7cba8d569b240efe4', - 'd8ac222636e5e3d6d4dba9dda6c9c426f788271bab0d6840dca87d3aa6ac62d6' - ], - [ - '5cbdf0646e5db4eaa398f365f2ea7a0e3d419b7e0330e39ce92bddedcac4f9bc', - '6aebca40ba255960a3178d6d861a54dba813d0b813fde7b5a5082628087264da' - ], - [ - 'acd484e2f0c7f65309ad178a9f559abde09796974c57e714c35f110dfc27ccbe', - 'cc338921b0a7d9fd64380971763b61e9add888a4375f8e0f05cc262ac64f9c37' - ], - [ - '774ae7f858a9411e5ef4246b70c65aac5649980be5c17891bbec17895da008cb', - 'd984a032eb6b5e190243dd56d7b7b365372db1e2dff9d6a8301d74c9c953c61b' - ], - [ - 'f28773c2d975288bc7d1d205c3748651b075fbc6610e58cddeeddf8f19405aa8', - 'ab0902e8d880a89758212eb65cdaf473a1a06da521fa91f29b5cb52db03ed81' - ], - [ - 'd7924d4f7d43ea965a465ae3095ff41131e5946f3c85f79e44adbcf8e27e080e', - '581e2872a86c72a683842ec228cc6defea40af2bd896d3a5c504dc9ff6a26b58' - ], - [ - 'defdea4cdb677750a420fee807eacf21eb9898ae79b9768766e4faa04a2d4a34', - '4211ab0694635168e997b0ead2a93daeced1f4a04a95c0f6cfb199f69e56eb77' - ], - [ - '2b4ea0a797a443d293ef5cff444f4979f06acfebd7e86d277475656138385b6c', - '85e89bc037945d93b343083b5a1c86131a01f60c50269763b570c854e5c09b7a' - ], - [ - '352bbf4a4cdd12564f93fa332ce333301d9ad40271f8107181340aef25be59d5', - '321eb4075348f534d59c18259dda3e1f4a1b3b2e71b1039c67bd3d8bcf81998c' - ], - [ - '2fa2104d6b38d11b0230010559879124e42ab8dfeff5ff29dc9cdadd4ecacc3f', - '2de1068295dd865b64569335bd5dd80181d70ecfc882648423ba76b532b7d67' - ], - [ - '9248279b09b4d68dab21a9b066edda83263c3d84e09572e269ca0cd7f5453714', - '73016f7bf234aade5d1aa71bdea2b1ff3fc0de2a887912ffe54a32ce97cb3402' - ], - [ - 'daed4f2be3a8bf278e70132fb0beb7522f570e144bf615c07e996d443dee8729', - 'a69dce4a7d6c98e8d4a1aca87ef8d7003f83c230f3afa726ab40e52290be1c55' - ], - [ - 'c44d12c7065d812e8acf28d7cbb19f9011ecd9e9fdf281b0e6a3b5e87d22e7db', - '2119a460ce326cdc76c45926c982fdac0e106e861edf61c5a039063f0e0e6482' - ], - [ - '6a245bf6dc698504c89a20cfded60853152b695336c28063b61c65cbd269e6b4', - 'e022cf42c2bd4a708b3f5126f16a24ad8b33ba48d0423b6efd5e6348100d8a82' - ], - [ - '1697ffa6fd9de627c077e3d2fe541084ce13300b0bec1146f95ae57f0d0bd6a5', - 'b9c398f186806f5d27561506e4557433a2cf15009e498ae7adee9d63d01b2396' - ], - [ - '605bdb019981718b986d0f07e834cb0d9deb8360ffb7f61df982345ef27a7479', - '2972d2de4f8d20681a78d93ec96fe23c26bfae84fb14db43b01e1e9056b8c49' - ], - [ - '62d14dab4150bf497402fdc45a215e10dcb01c354959b10cfe31c7e9d87ff33d', - '80fc06bd8cc5b01098088a1950eed0db01aa132967ab472235f5642483b25eaf' - ], - [ - '80c60ad0040f27dade5b4b06c408e56b2c50e9f56b9b8b425e555c2f86308b6f', - '1c38303f1cc5c30f26e66bad7fe72f70a65eed4cbe7024eb1aa01f56430bd57a' - ], - [ - '7a9375ad6167ad54aa74c6348cc54d344cc5dc9487d847049d5eabb0fa03c8fb', - 'd0e3fa9eca8726909559e0d79269046bdc59ea10c70ce2b02d499ec224dc7f7' - ], - [ - 'd528ecd9b696b54c907a9ed045447a79bb408ec39b68df504bb51f459bc3ffc9', - 'eecf41253136e5f99966f21881fd656ebc4345405c520dbc063465b521409933' - ], - [ - '49370a4b5f43412ea25f514e8ecdad05266115e4a7ecb1387231808f8b45963', - '758f3f41afd6ed428b3081b0512fd62a54c3f3afbb5b6764b653052a12949c9a' - ], - [ - '77f230936ee88cbbd73df930d64702ef881d811e0e1498e2f1c13eb1fc345d74', - '958ef42a7886b6400a08266e9ba1b37896c95330d97077cbbe8eb3c7671c60d6' - ], - [ - 'f2dac991cc4ce4b9ea44887e5c7c0bce58c80074ab9d4dbaeb28531b7739f530', - 'e0dedc9b3b2f8dad4da1f32dec2531df9eb5fbeb0598e4fd1a117dba703a3c37' - ], - [ - '463b3d9f662621fb1b4be8fbbe2520125a216cdfc9dae3debcba4850c690d45b', - '5ed430d78c296c3543114306dd8622d7c622e27c970a1de31cb377b01af7307e' - ], - [ - 'f16f804244e46e2a09232d4aff3b59976b98fac14328a2d1a32496b49998f247', - 'cedabd9b82203f7e13d206fcdf4e33d92a6c53c26e5cce26d6579962c4e31df6' - ], - [ - 'caf754272dc84563b0352b7a14311af55d245315ace27c65369e15f7151d41d1', - 'cb474660ef35f5f2a41b643fa5e460575f4fa9b7962232a5c32f908318a04476' - ], - [ - '2600ca4b282cb986f85d0f1709979d8b44a09c07cb86d7c124497bc86f082120', - '4119b88753c15bd6a693b03fcddbb45d5ac6be74ab5f0ef44b0be9475a7e4b40' - ], - [ - '7635ca72d7e8432c338ec53cd12220bc01c48685e24f7dc8c602a7746998e435', - '91b649609489d613d1d5e590f78e6d74ecfc061d57048bad9e76f302c5b9c61' - ], - [ - '754e3239f325570cdbbf4a87deee8a66b7f2b33479d468fbc1a50743bf56cc18', - '673fb86e5bda30fb3cd0ed304ea49a023ee33d0197a695d0c5d98093c536683' - ], - [ - 'e3e6bd1071a1e96aff57859c82d570f0330800661d1c952f9fe2694691d9b9e8', - '59c9e0bba394e76f40c0aa58379a3cb6a5a2283993e90c4167002af4920e37f5' - ], - [ - '186b483d056a033826ae73d88f732985c4ccb1f32ba35f4b4cc47fdcf04aa6eb', - '3b952d32c67cf77e2e17446e204180ab21fb8090895138b4a4a797f86e80888b' - ], - [ - 'df9d70a6b9876ce544c98561f4be4f725442e6d2b737d9c91a8321724ce0963f', - '55eb2dafd84d6ccd5f862b785dc39d4ab157222720ef9da217b8c45cf2ba2417' - ], - [ - '5edd5cc23c51e87a497ca815d5dce0f8ab52554f849ed8995de64c5f34ce7143', - 'efae9c8dbc14130661e8cec030c89ad0c13c66c0d17a2905cdc706ab7399a868' - ], - [ - '290798c2b6476830da12fe02287e9e777aa3fba1c355b17a722d362f84614fba', - 'e38da76dcd440621988d00bcf79af25d5b29c094db2a23146d003afd41943e7a' - ], - [ - 'af3c423a95d9f5b3054754efa150ac39cd29552fe360257362dfdecef4053b45', - 'f98a3fd831eb2b749a93b0e6f35cfb40c8cd5aa667a15581bc2feded498fd9c6' - ], - [ - '766dbb24d134e745cccaa28c99bf274906bb66b26dcf98df8d2fed50d884249a', - '744b1152eacbe5e38dcc887980da38b897584a65fa06cedd2c924f97cbac5996' - ], - [ - '59dbf46f8c94759ba21277c33784f41645f7b44f6c596a58ce92e666191abe3e', - 'c534ad44175fbc300f4ea6ce648309a042ce739a7919798cd85e216c4a307f6e' - ], - [ - 'f13ada95103c4537305e691e74e9a4a8dd647e711a95e73cb62dc6018cfd87b8', - 'e13817b44ee14de663bf4bc808341f326949e21a6a75c2570778419bdaf5733d' - ], - [ - '7754b4fa0e8aced06d4167a2c59cca4cda1869c06ebadfb6488550015a88522c', - '30e93e864e669d82224b967c3020b8fa8d1e4e350b6cbcc537a48b57841163a2' - ], - [ - '948dcadf5990e048aa3874d46abef9d701858f95de8041d2a6828c99e2262519', - 'e491a42537f6e597d5d28a3224b1bc25df9154efbd2ef1d2cbba2cae5347d57e' - ], - [ - '7962414450c76c1689c7b48f8202ec37fb224cf5ac0bfa1570328a8a3d7c77ab', - '100b610ec4ffb4760d5c1fc133ef6f6b12507a051f04ac5760afa5b29db83437' - ], - [ - '3514087834964b54b15b160644d915485a16977225b8847bb0dd085137ec47ca', - 'ef0afbb2056205448e1652c48e8127fc6039e77c15c2378b7e7d15a0de293311' - ], - [ - 'd3cc30ad6b483e4bc79ce2c9dd8bc54993e947eb8df787b442943d3f7b527eaf', - '8b378a22d827278d89c5e9be8f9508ae3c2ad46290358630afb34db04eede0a4' - ], - [ - '1624d84780732860ce1c78fcbfefe08b2b29823db913f6493975ba0ff4847610', - '68651cf9b6da903e0914448c6cd9d4ca896878f5282be4c8cc06e2a404078575' - ], - [ - '733ce80da955a8a26902c95633e62a985192474b5af207da6df7b4fd5fc61cd4', - 'f5435a2bd2badf7d485a4d8b8db9fcce3e1ef8e0201e4578c54673bc1dc5ea1d' - ], - [ - '15d9441254945064cf1a1c33bbd3b49f8966c5092171e699ef258dfab81c045c', - 'd56eb30b69463e7234f5137b73b84177434800bacebfc685fc37bbe9efe4070d' - ], - [ - 'a1d0fcf2ec9de675b612136e5ce70d271c21417c9d2b8aaaac138599d0717940', - 'edd77f50bcb5a3cab2e90737309667f2641462a54070f3d519212d39c197a629' - ], - [ - 'e22fbe15c0af8ccc5780c0735f84dbe9a790badee8245c06c7ca37331cb36980', - 'a855babad5cd60c88b430a69f53a1a7a38289154964799be43d06d77d31da06' - ], - [ - '311091dd9860e8e20ee13473c1155f5f69635e394704eaa74009452246cfa9b3', - '66db656f87d1f04fffd1f04788c06830871ec5a64feee685bd80f0b1286d8374' - ], - [ - '34c1fd04d301be89b31c0442d3e6ac24883928b45a9340781867d4232ec2dbdf', - '9414685e97b1b5954bd46f730174136d57f1ceeb487443dc5321857ba73abee' - ], - [ - 'f219ea5d6b54701c1c14de5b557eb42a8d13f3abbcd08affcc2a5e6b049b8d63', - '4cb95957e83d40b0f73af4544cccf6b1f4b08d3c07b27fb8d8c2962a400766d1' - ], - [ - 'd7b8740f74a8fbaab1f683db8f45de26543a5490bca627087236912469a0b448', - 'fa77968128d9c92ee1010f337ad4717eff15db5ed3c049b3411e0315eaa4593b' - ], - [ - '32d31c222f8f6f0ef86f7c98d3a3335ead5bcd32abdd94289fe4d3091aa824bf', - '5f3032f5892156e39ccd3d7915b9e1da2e6dac9e6f26e961118d14b8462e1661' - ], - [ - '7461f371914ab32671045a155d9831ea8793d77cd59592c4340f86cbc18347b5', - '8ec0ba238b96bec0cbdddcae0aa442542eee1ff50c986ea6b39847b3cc092ff6' - ], - [ - 'ee079adb1df1860074356a25aa38206a6d716b2c3e67453d287698bad7b2b2d6', - '8dc2412aafe3be5c4c5f37e0ecc5f9f6a446989af04c4e25ebaac479ec1c8c1e' - ], - [ - '16ec93e447ec83f0467b18302ee620f7e65de331874c9dc72bfd8616ba9da6b5', - '5e4631150e62fb40d0e8c2a7ca5804a39d58186a50e497139626778e25b0674d' - ], - [ - 'eaa5f980c245f6f038978290afa70b6bd8855897f98b6aa485b96065d537bd99', - 'f65f5d3e292c2e0819a528391c994624d784869d7e6ea67fb18041024edc07dc' - ], - [ - '78c9407544ac132692ee1910a02439958ae04877151342ea96c4b6b35a49f51', - 'f3e0319169eb9b85d5404795539a5e68fa1fbd583c064d2462b675f194a3ddb4' - ], - [ - '494f4be219a1a77016dcd838431aea0001cdc8ae7a6fc688726578d9702857a5', - '42242a969283a5f339ba7f075e36ba2af925ce30d767ed6e55f4b031880d562c' - ], - [ - 'a598a8030da6d86c6bc7f2f5144ea549d28211ea58faa70ebf4c1e665c1fe9b5', - '204b5d6f84822c307e4b4a7140737aec23fc63b65b35f86a10026dbd2d864e6b' - ], - [ - 'c41916365abb2b5d09192f5f2dbeafec208f020f12570a184dbadc3e58595997', - '4f14351d0087efa49d245b328984989d5caf9450f34bfc0ed16e96b58fa9913' - ], - [ - '841d6063a586fa475a724604da03bc5b92a2e0d2e0a36acfe4c73a5514742881', - '73867f59c0659e81904f9a1c7543698e62562d6744c169ce7a36de01a8d6154' - ], - [ - '5e95bb399a6971d376026947f89bde2f282b33810928be4ded112ac4d70e20d5', - '39f23f366809085beebfc71181313775a99c9aed7d8ba38b161384c746012865' - ], - [ - '36e4641a53948fd476c39f8a99fd974e5ec07564b5315d8bf99471bca0ef2f66', - 'd2424b1b1abe4eb8164227b085c9aa9456ea13493fd563e06fd51cf5694c78fc' - ], - [ - '336581ea7bfbbb290c191a2f507a41cf5643842170e914faeab27c2c579f726', - 'ead12168595fe1be99252129b6e56b3391f7ab1410cd1e0ef3dcdcabd2fda224' - ], - [ - '8ab89816dadfd6b6a1f2634fcf00ec8403781025ed6890c4849742706bd43ede', - '6fdcef09f2f6d0a044e654aef624136f503d459c3e89845858a47a9129cdd24e' - ], - [ - '1e33f1a746c9c5778133344d9299fcaa20b0938e8acff2544bb40284b8c5fb94', - '60660257dd11b3aa9c8ed618d24edff2306d320f1d03010e33a7d2057f3b3b6' - ], - [ - '85b7c1dcb3cec1b7ee7f30ded79dd20a0ed1f4cc18cbcfcfa410361fd8f08f31', - '3d98a9cdd026dd43f39048f25a8847f4fcafad1895d7a633c6fed3c35e999511' - ], - [ - '29df9fbd8d9e46509275f4b125d6d45d7fbe9a3b878a7af872a2800661ac5f51', - 'b4c4fe99c775a606e2d8862179139ffda61dc861c019e55cd2876eb2a27d84b' - ], - [ - 'a0b1cae06b0a847a3fea6e671aaf8adfdfe58ca2f768105c8082b2e449fce252', - 'ae434102edde0958ec4b19d917a6a28e6b72da1834aff0e650f049503a296cf2' - ], - [ - '4e8ceafb9b3e9a136dc7ff67e840295b499dfb3b2133e4ba113f2e4c0e121e5', - 'cf2174118c8b6d7a4b48f6d534ce5c79422c086a63460502b827ce62a326683c' - ], - [ - 'd24a44e047e19b6f5afb81c7ca2f69080a5076689a010919f42725c2b789a33b', - '6fb8d5591b466f8fc63db50f1c0f1c69013f996887b8244d2cdec417afea8fa3' - ], - [ - 'ea01606a7a6c9cdd249fdfcfacb99584001edd28abbab77b5104e98e8e3b35d4', - '322af4908c7312b0cfbfe369f7a7b3cdb7d4494bc2823700cfd652188a3ea98d' - ], - [ - 'af8addbf2b661c8a6c6328655eb96651252007d8c5ea31be4ad196de8ce2131f', - '6749e67c029b85f52a034eafd096836b2520818680e26ac8f3dfbcdb71749700' - ], - [ - 'e3ae1974566ca06cc516d47e0fb165a674a3dabcfca15e722f0e3450f45889', - '2aeabe7e4531510116217f07bf4d07300de97e4874f81f533420a72eeb0bd6a4' - ], - [ - '591ee355313d99721cf6993ffed1e3e301993ff3ed258802075ea8ced397e246', - 'b0ea558a113c30bea60fc4775460c7901ff0b053d25ca2bdeee98f1a4be5d196' - ], - [ - '11396d55fda54c49f19aa97318d8da61fa8584e47b084945077cf03255b52984', - '998c74a8cd45ac01289d5833a7beb4744ff536b01b257be4c5767bea93ea57a4' - ], - [ - '3c5d2a1ba39c5a1790000738c9e0c40b8dcdfd5468754b6405540157e017aa7a', - 'b2284279995a34e2f9d4de7396fc18b80f9b8b9fdd270f6661f79ca4c81bd257' - ], - [ - 'cc8704b8a60a0defa3a99a7299f2e9c3fbc395afb04ac078425ef8a1793cc030', - 'bdd46039feed17881d1e0862db347f8cf395b74fc4bcdc4e940b74e3ac1f1b13' - ], - [ - 'c533e4f7ea8555aacd9777ac5cad29b97dd4defccc53ee7ea204119b2889b197', - '6f0a256bc5efdf429a2fb6242f1a43a2d9b925bb4a4b3a26bb8e0f45eb596096' - ], - [ - 'c14f8f2ccb27d6f109f6d08d03cc96a69ba8c34eec07bbcf566d48e33da6593', - 'c359d6923bb398f7fd4473e16fe1c28475b740dd098075e6c0e8649113dc3a38' - ], - [ - 'a6cbc3046bc6a450bac24789fa17115a4c9739ed75f8f21ce441f72e0b90e6ef', - '21ae7f4680e889bb130619e2c0f95a360ceb573c70603139862afd617fa9b9f' - ], - [ - '347d6d9a02c48927ebfb86c1359b1caf130a3c0267d11ce6344b39f99d43cc38', - '60ea7f61a353524d1c987f6ecec92f086d565ab687870cb12689ff1e31c74448' - ], - [ - 'da6545d2181db8d983f7dcb375ef5866d47c67b1bf31c8cf855ef7437b72656a', - '49b96715ab6878a79e78f07ce5680c5d6673051b4935bd897fea824b77dc208a' - ], - [ - 'c40747cc9d012cb1a13b8148309c6de7ec25d6945d657146b9d5994b8feb1111', - '5ca560753be2a12fc6de6caf2cb489565db936156b9514e1bb5e83037e0fa2d4' - ], - [ - '4e42c8ec82c99798ccf3a610be870e78338c7f713348bd34c8203ef4037f3502', - '7571d74ee5e0fb92a7a8b33a07783341a5492144cc54bcc40a94473693606437' - ], - [ - '3775ab7089bc6af823aba2e1af70b236d251cadb0c86743287522a1b3b0dedea', - 'be52d107bcfa09d8bcb9736a828cfa7fac8db17bf7a76a2c42ad961409018cf7' - ], - [ - 'cee31cbf7e34ec379d94fb814d3d775ad954595d1314ba8846959e3e82f74e26', - '8fd64a14c06b589c26b947ae2bcf6bfa0149ef0be14ed4d80f448a01c43b1c6d' - ], - [ - 'b4f9eaea09b6917619f6ea6a4eb5464efddb58fd45b1ebefcdc1a01d08b47986', - '39e5c9925b5a54b07433a4f18c61726f8bb131c012ca542eb24a8ac07200682a' - ], - [ - 'd4263dfc3d2df923a0179a48966d30ce84e2515afc3dccc1b77907792ebcc60e', - '62dfaf07a0f78feb30e30d6295853ce189e127760ad6cf7fae164e122a208d54' - ], - [ - '48457524820fa65a4f8d35eb6930857c0032acc0a4a2de422233eeda897612c4', - '25a748ab367979d98733c38a1fa1c2e7dc6cc07db2d60a9ae7a76aaa49bd0f77' - ], - [ - 'dfeeef1881101f2cb11644f3a2afdfc2045e19919152923f367a1767c11cceda', - 'ecfb7056cf1de042f9420bab396793c0c390bde74b4bbdff16a83ae09a9a7517' - ], - [ - '6d7ef6b17543f8373c573f44e1f389835d89bcbc6062ced36c82df83b8fae859', - 'cd450ec335438986dfefa10c57fea9bcc521a0959b2d80bbf74b190dca712d10' - ], - [ - 'e75605d59102a5a2684500d3b991f2e3f3c88b93225547035af25af66e04541f', - 'f5c54754a8f71ee540b9b48728473e314f729ac5308b06938360990e2bfad125' - ], - [ - 'eb98660f4c4dfaa06a2be453d5020bc99a0c2e60abe388457dd43fefb1ed620c', - '6cb9a8876d9cb8520609af3add26cd20a0a7cd8a9411131ce85f44100099223e' - ], - [ - '13e87b027d8514d35939f2e6892b19922154596941888336dc3563e3b8dba942', - 'fef5a3c68059a6dec5d624114bf1e91aac2b9da568d6abeb2570d55646b8adf1' - ], - [ - 'ee163026e9fd6fe017c38f06a5be6fc125424b371ce2708e7bf4491691e5764a', - '1acb250f255dd61c43d94ccc670d0f58f49ae3fa15b96623e5430da0ad6c62b2' - ], - [ - 'b268f5ef9ad51e4d78de3a750c2dc89b1e626d43505867999932e5db33af3d80', - '5f310d4b3c99b9ebb19f77d41c1dee018cf0d34fd4191614003e945a1216e423' - ], - [ - 'ff07f3118a9df035e9fad85eb6c7bfe42b02f01ca99ceea3bf7ffdba93c4750d', - '438136d603e858a3a5c440c38eccbaddc1d2942114e2eddd4740d098ced1f0d8' - ], - [ - '8d8b9855c7c052a34146fd20ffb658bea4b9f69e0d825ebec16e8c3ce2b526a1', - 'cdb559eedc2d79f926baf44fb84ea4d44bcf50fee51d7ceb30e2e7f463036758' - ], - [ - '52db0b5384dfbf05bfa9d472d7ae26dfe4b851ceca91b1eba54263180da32b63', - 'c3b997d050ee5d423ebaf66a6db9f57b3180c902875679de924b69d84a7b375' - ], - [ - 'e62f9490d3d51da6395efd24e80919cc7d0f29c3f3fa48c6fff543becbd43352', - '6d89ad7ba4876b0b22c2ca280c682862f342c8591f1daf5170e07bfd9ccafa7d' - ], - [ - '7f30ea2476b399b4957509c88f77d0191afa2ff5cb7b14fd6d8e7d65aaab1193', - 'ca5ef7d4b231c94c3b15389a5f6311e9daff7bb67b103e9880ef4bff637acaec' - ], - [ - '5098ff1e1d9f14fb46a210fada6c903fef0fb7b4a1dd1d9ac60a0361800b7a00', - '9731141d81fc8f8084d37c6e7542006b3ee1b40d60dfe5362a5b132fd17ddc0' - ], - [ - '32b78c7de9ee512a72895be6b9cbefa6e2f3c4ccce445c96b9f2c81e2778ad58', - 'ee1849f513df71e32efc3896ee28260c73bb80547ae2275ba497237794c8753c' - ], - [ - 'e2cb74fddc8e9fbcd076eef2a7c72b0ce37d50f08269dfc074b581550547a4f7', - 'd3aa2ed71c9dd2247a62df062736eb0baddea9e36122d2be8641abcb005cc4a4' - ], - [ - '8438447566d4d7bedadc299496ab357426009a35f235cb141be0d99cd10ae3a8', - 'c4e1020916980a4da5d01ac5e6ad330734ef0d7906631c4f2390426b2edd791f' - ], - [ - '4162d488b89402039b584c6fc6c308870587d9c46f660b878ab65c82c711d67e', - '67163e903236289f776f22c25fb8a3afc1732f2b84b4e95dbda47ae5a0852649' - ], - [ - '3fad3fa84caf0f34f0f89bfd2dcf54fc175d767aec3e50684f3ba4a4bf5f683d', - 'cd1bc7cb6cc407bb2f0ca647c718a730cf71872e7d0d2a53fa20efcdfe61826' - ], - [ - '674f2600a3007a00568c1a7ce05d0816c1fb84bf1370798f1c69532faeb1a86b', - '299d21f9413f33b3edf43b257004580b70db57da0b182259e09eecc69e0d38a5' - ], - [ - 'd32f4da54ade74abb81b815ad1fb3b263d82d6c692714bcff87d29bd5ee9f08f', - 'f9429e738b8e53b968e99016c059707782e14f4535359d582fc416910b3eea87' - ], - [ - '30e4e670435385556e593657135845d36fbb6931f72b08cb1ed954f1e3ce3ff6', - '462f9bce619898638499350113bbc9b10a878d35da70740dc695a559eb88db7b' - ], - [ - 'be2062003c51cc3004682904330e4dee7f3dcd10b01e580bf1971b04d4cad297', - '62188bc49d61e5428573d48a74e1c655b1c61090905682a0d5558ed72dccb9bc' - ], - [ - '93144423ace3451ed29e0fb9ac2af211cb6e84a601df5993c419859fff5df04a', - '7c10dfb164c3425f5c71a3f9d7992038f1065224f72bb9d1d902a6d13037b47c' - ], - [ - 'b015f8044f5fcbdcf21ca26d6c34fb8197829205c7b7d2a7cb66418c157b112c', - 'ab8c1e086d04e813744a655b2df8d5f83b3cdc6faa3088c1d3aea1454e3a1d5f' - ], - [ - 'd5e9e1da649d97d89e4868117a465a3a4f8a18de57a140d36b3f2af341a21b52', - '4cb04437f391ed73111a13cc1d4dd0db1693465c2240480d8955e8592f27447a' - ], - [ - 'd3ae41047dd7ca065dbf8ed77b992439983005cd72e16d6f996a5316d36966bb', - 'bd1aeb21ad22ebb22a10f0303417c6d964f8cdd7df0aca614b10dc14d125ac46' - ], - [ - '463e2763d885f958fc66cdd22800f0a487197d0a82e377b49f80af87c897b065', - 'bfefacdb0e5d0fd7df3a311a94de062b26b80c61fbc97508b79992671ef7ca7f' - ], - [ - '7985fdfd127c0567c6f53ec1bb63ec3158e597c40bfe747c83cddfc910641917', - '603c12daf3d9862ef2b25fe1de289aed24ed291e0ec6708703a5bd567f32ed03' - ], - [ - '74a1ad6b5f76e39db2dd249410eac7f99e74c59cb83d2d0ed5ff1543da7703e9', - 'cc6157ef18c9c63cd6193d83631bbea0093e0968942e8c33d5737fd790e0db08' - ], - [ - '30682a50703375f602d416664ba19b7fc9bab42c72747463a71d0896b22f6da3', - '553e04f6b018b4fa6c8f39e7f311d3176290d0e0f19ca73f17714d9977a22ff8' - ], - [ - '9e2158f0d7c0d5f26c3791efefa79597654e7a2b2464f52b1ee6c1347769ef57', - '712fcdd1b9053f09003a3481fa7762e9ffd7c8ef35a38509e2fbf2629008373' - ], - [ - '176e26989a43c9cfeba4029c202538c28172e566e3c4fce7322857f3be327d66', - 'ed8cc9d04b29eb877d270b4878dc43c19aefd31f4eee09ee7b47834c1fa4b1c3' - ], - [ - '75d46efea3771e6e68abb89a13ad747ecf1892393dfc4f1b7004788c50374da8', - '9852390a99507679fd0b86fd2b39a868d7efc22151346e1a3ca4726586a6bed8' - ], - [ - '809a20c67d64900ffb698c4c825f6d5f2310fb0451c869345b7319f645605721', - '9e994980d9917e22b76b061927fa04143d096ccc54963e6a5ebfa5f3f8e286c1' - ], - [ - '1b38903a43f7f114ed4500b4eac7083fdefece1cf29c63528d563446f972c180', - '4036edc931a60ae889353f77fd53de4a2708b26b6f5da72ad3394119daf408f9' - ] - ] - } -}; - -},{}],125:[function(require,module,exports){ -'use strict'; - -var utils = exports; -var BN = require('bn.js'); -var minAssert = require('minimalistic-assert'); -var minUtils = require('minimalistic-crypto-utils'); - -utils.assert = minAssert; -utils.toArray = minUtils.toArray; -utils.zero2 = minUtils.zero2; -utils.toHex = minUtils.toHex; -utils.encode = minUtils.encode; - -// Represent num in a w-NAF form -function getNAF(num, w, bits) { - var naf = new Array(Math.max(num.bitLength(), bits) + 1); - naf.fill(0); - - var ws = 1 << (w + 1); - var k = num.clone(); - - for (var i = 0; i < naf.length; i++) { - var z; - var mod = k.andln(ws - 1); - if (k.isOdd()) { - if (mod > (ws >> 1) - 1) - z = (ws >> 1) - mod; - else - z = mod; - k.isubn(z); - } else { - z = 0; - } - - naf[i] = z; - k.iushrn(1); - } - - return naf; -} -utils.getNAF = getNAF; - -// Represent k1, k2 in a Joint Sparse Form -function getJSF(k1, k2) { - var jsf = [ - [], - [] - ]; - - k1 = k1.clone(); - k2 = k2.clone(); - var d1 = 0; - var d2 = 0; - while (k1.cmpn(-d1) > 0 || k2.cmpn(-d2) > 0) { - - // First phase - var m14 = (k1.andln(3) + d1) & 3; - var m24 = (k2.andln(3) + d2) & 3; - if (m14 === 3) - m14 = -1; - if (m24 === 3) - m24 = -1; - var u1; - if ((m14 & 1) === 0) { - u1 = 0; - } else { - var m8 = (k1.andln(7) + d1) & 7; - if ((m8 === 3 || m8 === 5) && m24 === 2) - u1 = -m14; - else - u1 = m14; - } - jsf[0].push(u1); - - var u2; - if ((m24 & 1) === 0) { - u2 = 0; - } else { - var m8 = (k2.andln(7) + d2) & 7; - if ((m8 === 3 || m8 === 5) && m14 === 2) - u2 = -m24; - else - u2 = m24; - } - jsf[1].push(u2); - - // Second phase - if (2 * d1 === u1 + 1) - d1 = 1 - d1; - if (2 * d2 === u2 + 1) - d2 = 1 - d2; - k1.iushrn(1); - k2.iushrn(1); - } - - return jsf; -} -utils.getJSF = getJSF; - -function cachedProperty(obj, name, computer) { - var key = '_' + name; - obj.prototype[name] = function cachedProperty() { - return this[key] !== undefined ? this[key] : - this[key] = computer.call(this); - }; -} -utils.cachedProperty = cachedProperty; - -function parseBytes(bytes) { - return typeof bytes === 'string' ? utils.toArray(bytes, 'hex') : - bytes; -} -utils.parseBytes = parseBytes; - -function intFromLE(bytes) { - return new BN(bytes, 'hex', 'le'); -} -utils.intFromLE = intFromLE; - - -},{"bn.js":52,"minimalistic-assert":164,"minimalistic-crypto-utils":165}],126:[function(require,module,exports){ -module.exports={ - "_args": [ - [ - "elliptic@6.5.3", - "/Users/nikkisharifli/src/external/hound-sdk-web-example" - ] - ], - "_development": true, - "_from": "elliptic@6.5.3", - "_id": "elliptic@6.5.3", - "_inBundle": false, - "_integrity": "sha512-IMqzv5wNQf+E6aHeIqATs0tOLeOTwj1QKbRcS3jBbYkl5oLAserA8yJTT7/VyHUYG91PRmPyeQDObKLPpeS4dw==", - "_location": "/elliptic", - "_phantomChildren": {}, - "_requested": { - "type": "version", - "registry": true, - "raw": "elliptic@6.5.3", - "name": "elliptic", - "escapedName": "elliptic", - "rawSpec": "6.5.3", - "saveSpec": null, - "fetchSpec": "6.5.3" - }, - "_requiredBy": [ - "/browserify-sign", - "/create-ecdh" - ], - "_resolved": "https://registry.npmjs.org/elliptic/-/elliptic-6.5.3.tgz", - "_spec": "6.5.3", - "_where": "/Users/nikkisharifli/src/external/hound-sdk-web-example", - "author": { - "name": "Fedor Indutny", - "email": "fedor@indutny.com" - }, - "bugs": { - "url": "https://github.com/indutny/elliptic/issues" - }, - "dependencies": { - "bn.js": "^4.4.0", - "brorand": "^1.0.1", - "hash.js": "^1.0.0", - "hmac-drbg": "^1.0.0", - "inherits": "^2.0.1", - "minimalistic-assert": "^1.0.0", - "minimalistic-crypto-utils": "^1.0.0" - }, - "description": "EC cryptography", - "devDependencies": { - "brfs": "^1.4.3", - "coveralls": "^3.0.8", - "grunt": "^1.0.4", - "grunt-browserify": "^5.0.0", - "grunt-cli": "^1.2.0", - "grunt-contrib-connect": "^1.0.0", - "grunt-contrib-copy": "^1.0.0", - "grunt-contrib-uglify": "^1.0.1", - "grunt-mocha-istanbul": "^3.0.1", - "grunt-saucelabs": "^9.0.1", - "istanbul": "^0.4.2", - "jscs": "^3.0.7", - "jshint": "^2.10.3", - "mocha": "^6.2.2" - }, - "files": [ - "lib" - ], - "homepage": "https://github.com/indutny/elliptic", - "keywords": [ - "EC", - "Elliptic", - "curve", - "Cryptography" - ], - "license": "MIT", - "main": "lib/elliptic.js", - "name": "elliptic", - "repository": { - "type": "git", - "url": "git+ssh://git@github.com/indutny/elliptic.git" - }, - "scripts": { - "jscs": "jscs benchmarks/*.js lib/*.js lib/**/*.js lib/**/**/*.js test/index.js", - "jshint": "jscs benchmarks/*.js lib/*.js lib/**/*.js lib/**/**/*.js test/index.js", - "lint": "npm run jscs && npm run jshint", - "test": "npm run lint && npm run unit", - "unit": "istanbul test _mocha --reporter=spec test/index.js", - "version": "grunt dist && git add dist/" - }, - "version": "6.5.3" -} - -},{}],127:[function(require,module,exports){ -(function (process,global){ -/*! - * @overview es6-promise - a tiny implementation of Promises/A+. - * @copyright Copyright (c) 2014 Yehuda Katz, Tom Dale, Stefan Penner and contributors (Conversion to ES6 API by Jake Archibald) - * @license Licensed under MIT license - * See https://raw.githubusercontent.com/stefanpenner/es6-promise/master/LICENSE - * @version v4.2.8+1e68dce6 - */ - -(function (global, factory) { - typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() : - typeof define === 'function' && define.amd ? define(factory) : - (global.ES6Promise = factory()); -}(this, (function () { 'use strict'; - -function objectOrFunction(x) { - var type = typeof x; - return x !== null && (type === 'object' || type === 'function'); -} - -function isFunction(x) { - return typeof x === 'function'; -} - - - -var _isArray = void 0; -if (Array.isArray) { - _isArray = Array.isArray; -} else { - _isArray = function (x) { - return Object.prototype.toString.call(x) === '[object Array]'; - }; -} - -var isArray = _isArray; - -var len = 0; -var vertxNext = void 0; -var customSchedulerFn = void 0; - -var asap = function asap(callback, arg) { - queue[len] = callback; - queue[len + 1] = arg; - len += 2; - if (len === 2) { - // If len is 2, that means that we need to schedule an async flush. - // If additional callbacks are queued before the queue is flushed, they - // will be processed by this flush that we are scheduling. - if (customSchedulerFn) { - customSchedulerFn(flush); - } else { - scheduleFlush(); - } - } -}; - -function setScheduler(scheduleFn) { - customSchedulerFn = scheduleFn; -} - -function setAsap(asapFn) { - asap = asapFn; -} - -var browserWindow = typeof window !== 'undefined' ? window : undefined; -var browserGlobal = browserWindow || {}; -var BrowserMutationObserver = browserGlobal.MutationObserver || browserGlobal.WebKitMutationObserver; -var isNode = typeof self === 'undefined' && typeof process !== 'undefined' && {}.toString.call(process) === '[object process]'; - -// test for web worker but not in IE10 -var isWorker = typeof Uint8ClampedArray !== 'undefined' && typeof importScripts !== 'undefined' && typeof MessageChannel !== 'undefined'; - -// node -function useNextTick() { - // node version 0.10.x displays a deprecation warning when nextTick is used recursively - // see https://github.com/cujojs/when/issues/410 for details - return function () { - return process.nextTick(flush); - }; -} - -// vertx -function useVertxTimer() { - if (typeof vertxNext !== 'undefined') { - return function () { - vertxNext(flush); - }; - } - - return useSetTimeout(); -} - -function useMutationObserver() { - var iterations = 0; - var observer = new BrowserMutationObserver(flush); - var node = document.createTextNode(''); - observer.observe(node, { characterData: true }); - - return function () { - node.data = iterations = ++iterations % 2; - }; -} - -// web worker -function useMessageChannel() { - var channel = new MessageChannel(); - channel.port1.onmessage = flush; - return function () { - return channel.port2.postMessage(0); - }; -} - -function useSetTimeout() { - // Store setTimeout reference so es6-promise will be unaffected by - // other code modifying setTimeout (like sinon.useFakeTimers()) - var globalSetTimeout = setTimeout; - return function () { - return globalSetTimeout(flush, 1); - }; -} - -var queue = new Array(1000); -function flush() { - for (var i = 0; i < len; i += 2) { - var callback = queue[i]; - var arg = queue[i + 1]; - - callback(arg); - - queue[i] = undefined; - queue[i + 1] = undefined; - } - - len = 0; -} - -function attemptVertx() { - try { - var vertx = Function('return this')().require('vertx'); - vertxNext = vertx.runOnLoop || vertx.runOnContext; - return useVertxTimer(); - } catch (e) { - return useSetTimeout(); - } -} - -var scheduleFlush = void 0; -// Decide what async method to use to triggering processing of queued callbacks: -if (isNode) { - scheduleFlush = useNextTick(); -} else if (BrowserMutationObserver) { - scheduleFlush = useMutationObserver(); -} else if (isWorker) { - scheduleFlush = useMessageChannel(); -} else if (browserWindow === undefined && typeof require === 'function') { - scheduleFlush = attemptVertx(); -} else { - scheduleFlush = useSetTimeout(); -} - -function then(onFulfillment, onRejection) { - var parent = this; - - var child = new this.constructor(noop); - - if (child[PROMISE_ID] === undefined) { - makePromise(child); - } - - var _state = parent._state; - - - if (_state) { - var callback = arguments[_state - 1]; - asap(function () { - return invokeCallback(_state, child, callback, parent._result); - }); - } else { - subscribe(parent, child, onFulfillment, onRejection); - } - - return child; -} - -/** - `Promise.resolve` returns a promise that will become resolved with the - passed `value`. It is shorthand for the following: - - ```javascript - let promise = new Promise(function(resolve, reject){ - resolve(1); - }); - - promise.then(function(value){ - // value === 1 - }); - ``` - - Instead of writing the above, your code now simply becomes the following: - - ```javascript - let promise = Promise.resolve(1); - - promise.then(function(value){ - // value === 1 - }); - ``` - - @method resolve - @static - @param {Any} value value that the returned promise will be resolved with - Useful for tooling. - @return {Promise} a promise that will become fulfilled with the given - `value` -*/ -function resolve$1(object) { - /*jshint validthis:true */ - var Constructor = this; - - if (object && typeof object === 'object' && object.constructor === Constructor) { - return object; - } - - var promise = new Constructor(noop); - resolve(promise, object); - return promise; -} - -var PROMISE_ID = Math.random().toString(36).substring(2); - -function noop() {} - -var PENDING = void 0; -var FULFILLED = 1; -var REJECTED = 2; - -function selfFulfillment() { - return new TypeError("You cannot resolve a promise with itself"); -} - -function cannotReturnOwn() { - return new TypeError('A promises callback cannot return that same promise.'); -} - -function tryThen(then$$1, value, fulfillmentHandler, rejectionHandler) { - try { - then$$1.call(value, fulfillmentHandler, rejectionHandler); - } catch (e) { - return e; - } -} - -function handleForeignThenable(promise, thenable, then$$1) { - asap(function (promise) { - var sealed = false; - var error = tryThen(then$$1, thenable, function (value) { - if (sealed) { - return; - } - sealed = true; - if (thenable !== value) { - resolve(promise, value); - } else { - fulfill(promise, value); - } - }, function (reason) { - if (sealed) { - return; - } - sealed = true; - - reject(promise, reason); - }, 'Settle: ' + (promise._label || ' unknown promise')); - - if (!sealed && error) { - sealed = true; - reject(promise, error); - } - }, promise); -} - -function handleOwnThenable(promise, thenable) { - if (thenable._state === FULFILLED) { - fulfill(promise, thenable._result); - } else if (thenable._state === REJECTED) { - reject(promise, thenable._result); - } else { - subscribe(thenable, undefined, function (value) { - return resolve(promise, value); - }, function (reason) { - return reject(promise, reason); - }); - } -} - -function handleMaybeThenable(promise, maybeThenable, then$$1) { - if (maybeThenable.constructor === promise.constructor && then$$1 === then && maybeThenable.constructor.resolve === resolve$1) { - handleOwnThenable(promise, maybeThenable); - } else { - if (then$$1 === undefined) { - fulfill(promise, maybeThenable); - } else if (isFunction(then$$1)) { - handleForeignThenable(promise, maybeThenable, then$$1); - } else { - fulfill(promise, maybeThenable); - } - } -} - -function resolve(promise, value) { - if (promise === value) { - reject(promise, selfFulfillment()); - } else if (objectOrFunction(value)) { - var then$$1 = void 0; - try { - then$$1 = value.then; - } catch (error) { - reject(promise, error); - return; - } - handleMaybeThenable(promise, value, then$$1); - } else { - fulfill(promise, value); - } -} - -function publishRejection(promise) { - if (promise._onerror) { - promise._onerror(promise._result); - } - - publish(promise); -} - -function fulfill(promise, value) { - if (promise._state !== PENDING) { - return; - } - - promise._result = value; - promise._state = FULFILLED; - - if (promise._subscribers.length !== 0) { - asap(publish, promise); - } -} - -function reject(promise, reason) { - if (promise._state !== PENDING) { - return; - } - promise._state = REJECTED; - promise._result = reason; - - asap(publishRejection, promise); -} - -function subscribe(parent, child, onFulfillment, onRejection) { - var _subscribers = parent._subscribers; - var length = _subscribers.length; - - - parent._onerror = null; - - _subscribers[length] = child; - _subscribers[length + FULFILLED] = onFulfillment; - _subscribers[length + REJECTED] = onRejection; - - if (length === 0 && parent._state) { - asap(publish, parent); - } -} - -function publish(promise) { - var subscribers = promise._subscribers; - var settled = promise._state; - - if (subscribers.length === 0) { - return; - } - - var child = void 0, - callback = void 0, - detail = promise._result; - - for (var i = 0; i < subscribers.length; i += 3) { - child = subscribers[i]; - callback = subscribers[i + settled]; - - if (child) { - invokeCallback(settled, child, callback, detail); - } else { - callback(detail); - } - } - - promise._subscribers.length = 0; -} - -function invokeCallback(settled, promise, callback, detail) { - var hasCallback = isFunction(callback), - value = void 0, - error = void 0, - succeeded = true; - - if (hasCallback) { - try { - value = callback(detail); - } catch (e) { - succeeded = false; - error = e; - } - - if (promise === value) { - reject(promise, cannotReturnOwn()); - return; - } - } else { - value = detail; - } - - if (promise._state !== PENDING) { - // noop - } else if (hasCallback && succeeded) { - resolve(promise, value); - } else if (succeeded === false) { - reject(promise, error); - } else if (settled === FULFILLED) { - fulfill(promise, value); - } else if (settled === REJECTED) { - reject(promise, value); - } -} - -function initializePromise(promise, resolver) { - try { - resolver(function resolvePromise(value) { - resolve(promise, value); - }, function rejectPromise(reason) { - reject(promise, reason); - }); - } catch (e) { - reject(promise, e); - } -} - -var id = 0; -function nextId() { - return id++; -} - -function makePromise(promise) { - promise[PROMISE_ID] = id++; - promise._state = undefined; - promise._result = undefined; - promise._subscribers = []; -} - -function validationError() { - return new Error('Array Methods must be provided an Array'); -} - -var Enumerator = function () { - function Enumerator(Constructor, input) { - this._instanceConstructor = Constructor; - this.promise = new Constructor(noop); - - if (!this.promise[PROMISE_ID]) { - makePromise(this.promise); - } - - if (isArray(input)) { - this.length = input.length; - this._remaining = input.length; - - this._result = new Array(this.length); - - if (this.length === 0) { - fulfill(this.promise, this._result); - } else { - this.length = this.length || 0; - this._enumerate(input); - if (this._remaining === 0) { - fulfill(this.promise, this._result); - } - } - } else { - reject(this.promise, validationError()); - } - } - - Enumerator.prototype._enumerate = function _enumerate(input) { - for (var i = 0; this._state === PENDING && i < input.length; i++) { - this._eachEntry(input[i], i); - } - }; - - Enumerator.prototype._eachEntry = function _eachEntry(entry, i) { - var c = this._instanceConstructor; - var resolve$$1 = c.resolve; - - - if (resolve$$1 === resolve$1) { - var _then = void 0; - var error = void 0; - var didError = false; - try { - _then = entry.then; - } catch (e) { - didError = true; - error = e; - } - - if (_then === then && entry._state !== PENDING) { - this._settledAt(entry._state, i, entry._result); - } else if (typeof _then !== 'function') { - this._remaining--; - this._result[i] = entry; - } else if (c === Promise$1) { - var promise = new c(noop); - if (didError) { - reject(promise, error); - } else { - handleMaybeThenable(promise, entry, _then); - } - this._willSettleAt(promise, i); - } else { - this._willSettleAt(new c(function (resolve$$1) { - return resolve$$1(entry); - }), i); - } - } else { - this._willSettleAt(resolve$$1(entry), i); - } - }; - - Enumerator.prototype._settledAt = function _settledAt(state, i, value) { - var promise = this.promise; - - - if (promise._state === PENDING) { - this._remaining--; - - if (state === REJECTED) { - reject(promise, value); - } else { - this._result[i] = value; - } - } - - if (this._remaining === 0) { - fulfill(promise, this._result); - } - }; - - Enumerator.prototype._willSettleAt = function _willSettleAt(promise, i) { - var enumerator = this; - - subscribe(promise, undefined, function (value) { - return enumerator._settledAt(FULFILLED, i, value); - }, function (reason) { - return enumerator._settledAt(REJECTED, i, reason); - }); - }; - - return Enumerator; -}(); - -/** - `Promise.all` accepts an array of promises, and returns a new promise which - is fulfilled with an array of fulfillment values for the passed promises, or - rejected with the reason of the first passed promise to be rejected. It casts all - elements of the passed iterable to promises as it runs this algorithm. - - Example: - - ```javascript - let promise1 = resolve(1); - let promise2 = resolve(2); - let promise3 = resolve(3); - let promises = [ promise1, promise2, promise3 ]; - - Promise.all(promises).then(function(array){ - // The array here would be [ 1, 2, 3 ]; - }); - ``` - - If any of the `promises` given to `all` are rejected, the first promise - that is rejected will be given as an argument to the returned promises's - rejection handler. For example: - - Example: - - ```javascript - let promise1 = resolve(1); - let promise2 = reject(new Error("2")); - let promise3 = reject(new Error("3")); - let promises = [ promise1, promise2, promise3 ]; - - Promise.all(promises).then(function(array){ - // Code here never runs because there are rejected promises! - }, function(error) { - // error.message === "2" - }); - ``` - - @method all - @static - @param {Array} entries array of promises - @param {String} label optional string for labeling the promise. - Useful for tooling. - @return {Promise} promise that is fulfilled when all `promises` have been - fulfilled, or rejected if any of them become rejected. - @static -*/ -function all(entries) { - return new Enumerator(this, entries).promise; -} - -/** - `Promise.race` returns a new promise which is settled in the same way as the - first passed promise to settle. - - Example: - - ```javascript - let promise1 = new Promise(function(resolve, reject){ - setTimeout(function(){ - resolve('promise 1'); - }, 200); - }); - - let promise2 = new Promise(function(resolve, reject){ - setTimeout(function(){ - resolve('promise 2'); - }, 100); - }); - - Promise.race([promise1, promise2]).then(function(result){ - // result === 'promise 2' because it was resolved before promise1 - // was resolved. - }); - ``` - - `Promise.race` is deterministic in that only the state of the first - settled promise matters. For example, even if other promises given to the - `promises` array argument are resolved, but the first settled promise has - become rejected before the other promises became fulfilled, the returned - promise will become rejected: - - ```javascript - let promise1 = new Promise(function(resolve, reject){ - setTimeout(function(){ - resolve('promise 1'); - }, 200); - }); - - let promise2 = new Promise(function(resolve, reject){ - setTimeout(function(){ - reject(new Error('promise 2')); - }, 100); - }); - - Promise.race([promise1, promise2]).then(function(result){ - // Code here never runs - }, function(reason){ - // reason.message === 'promise 2' because promise 2 became rejected before - // promise 1 became fulfilled - }); - ``` - - An example real-world use case is implementing timeouts: - - ```javascript - Promise.race([ajax('foo.json'), timeout(5000)]) - ``` - - @method race - @static - @param {Array} promises array of promises to observe - Useful for tooling. - @return {Promise} a promise which settles in the same way as the first passed - promise to settle. -*/ -function race(entries) { - /*jshint validthis:true */ - var Constructor = this; - - if (!isArray(entries)) { - return new Constructor(function (_, reject) { - return reject(new TypeError('You must pass an array to race.')); - }); - } else { - return new Constructor(function (resolve, reject) { - var length = entries.length; - for (var i = 0; i < length; i++) { - Constructor.resolve(entries[i]).then(resolve, reject); - } - }); - } -} - -/** - `Promise.reject` returns a promise rejected with the passed `reason`. - It is shorthand for the following: - - ```javascript - let promise = new Promise(function(resolve, reject){ - reject(new Error('WHOOPS')); - }); - - promise.then(function(value){ - // Code here doesn't run because the promise is rejected! - }, function(reason){ - // reason.message === 'WHOOPS' - }); - ``` - - Instead of writing the above, your code now simply becomes the following: - - ```javascript - let promise = Promise.reject(new Error('WHOOPS')); - - promise.then(function(value){ - // Code here doesn't run because the promise is rejected! - }, function(reason){ - // reason.message === 'WHOOPS' - }); - ``` - - @method reject - @static - @param {Any} reason value that the returned promise will be rejected with. - Useful for tooling. - @return {Promise} a promise rejected with the given `reason`. -*/ -function reject$1(reason) { - /*jshint validthis:true */ - var Constructor = this; - var promise = new Constructor(noop); - reject(promise, reason); - return promise; -} - -function needsResolver() { - throw new TypeError('You must pass a resolver function as the first argument to the promise constructor'); -} - -function needsNew() { - throw new TypeError("Failed to construct 'Promise': Please use the 'new' operator, this object constructor cannot be called as a function."); -} - -/** - Promise objects represent the eventual result of an asynchronous operation. The - primary way of interacting with a promise is through its `then` method, which - registers callbacks to receive either a promise's eventual value or the reason - why the promise cannot be fulfilled. - - Terminology - ----------- - - - `promise` is an object or function with a `then` method whose behavior conforms to this specification. - - `thenable` is an object or function that defines a `then` method. - - `value` is any legal JavaScript value (including undefined, a thenable, or a promise). - - `exception` is a value that is thrown using the throw statement. - - `reason` is a value that indicates why a promise was rejected. - - `settled` the final resting state of a promise, fulfilled or rejected. - - A promise can be in one of three states: pending, fulfilled, or rejected. - - Promises that are fulfilled have a fulfillment value and are in the fulfilled - state. Promises that are rejected have a rejection reason and are in the - rejected state. A fulfillment value is never a thenable. - - Promises can also be said to *resolve* a value. If this value is also a - promise, then the original promise's settled state will match the value's - settled state. So a promise that *resolves* a promise that rejects will - itself reject, and a promise that *resolves* a promise that fulfills will - itself fulfill. - - - Basic Usage: - ------------ - - ```js - let promise = new Promise(function(resolve, reject) { - // on success - resolve(value); - - // on failure - reject(reason); - }); - - promise.then(function(value) { - // on fulfillment - }, function(reason) { - // on rejection - }); - ``` - - Advanced Usage: - --------------- - - Promises shine when abstracting away asynchronous interactions such as - `XMLHttpRequest`s. - - ```js - function getJSON(url) { - return new Promise(function(resolve, reject){ - let xhr = new XMLHttpRequest(); - - xhr.open('GET', url); - xhr.onreadystatechange = handler; - xhr.responseType = 'json'; - xhr.setRequestHeader('Accept', 'application/json'); - xhr.send(); - - function handler() { - if (this.readyState === this.DONE) { - if (this.status === 200) { - resolve(this.response); - } else { - reject(new Error('getJSON: `' + url + '` failed with status: [' + this.status + ']')); - } - } - }; - }); - } - - getJSON('/posts.json').then(function(json) { - // on fulfillment - }, function(reason) { - // on rejection - }); - ``` - - Unlike callbacks, promises are great composable primitives. - - ```js - Promise.all([ - getJSON('/posts'), - getJSON('/comments') - ]).then(function(values){ - values[0] // => postsJSON - values[1] // => commentsJSON - - return values; - }); - ``` - - @class Promise - @param {Function} resolver - Useful for tooling. - @constructor -*/ - -var Promise$1 = function () { - function Promise(resolver) { - this[PROMISE_ID] = nextId(); - this._result = this._state = undefined; - this._subscribers = []; - - if (noop !== resolver) { - typeof resolver !== 'function' && needsResolver(); - this instanceof Promise ? initializePromise(this, resolver) : needsNew(); - } - } - - /** - The primary way of interacting with a promise is through its `then` method, - which registers callbacks to receive either a promise's eventual value or the - reason why the promise cannot be fulfilled. - ```js - findUser().then(function(user){ - // user is available - }, function(reason){ - // user is unavailable, and you are given the reason why - }); - ``` - Chaining - -------- - The return value of `then` is itself a promise. This second, 'downstream' - promise is resolved with the return value of the first promise's fulfillment - or rejection handler, or rejected if the handler throws an exception. - ```js - findUser().then(function (user) { - return user.name; - }, function (reason) { - return 'default name'; - }).then(function (userName) { - // If `findUser` fulfilled, `userName` will be the user's name, otherwise it - // will be `'default name'` - }); - findUser().then(function (user) { - throw new Error('Found user, but still unhappy'); - }, function (reason) { - throw new Error('`findUser` rejected and we're unhappy'); - }).then(function (value) { - // never reached - }, function (reason) { - // if `findUser` fulfilled, `reason` will be 'Found user, but still unhappy'. - // If `findUser` rejected, `reason` will be '`findUser` rejected and we're unhappy'. - }); - ``` - If the downstream promise does not specify a rejection handler, rejection reasons will be propagated further downstream. - ```js - findUser().then(function (user) { - throw new PedagogicalException('Upstream error'); - }).then(function (value) { - // never reached - }).then(function (value) { - // never reached - }, function (reason) { - // The `PedgagocialException` is propagated all the way down to here - }); - ``` - Assimilation - ------------ - Sometimes the value you want to propagate to a downstream promise can only be - retrieved asynchronously. This can be achieved by returning a promise in the - fulfillment or rejection handler. The downstream promise will then be pending - until the returned promise is settled. This is called *assimilation*. - ```js - findUser().then(function (user) { - return findCommentsByAuthor(user); - }).then(function (comments) { - // The user's comments are now available - }); - ``` - If the assimliated promise rejects, then the downstream promise will also reject. - ```js - findUser().then(function (user) { - return findCommentsByAuthor(user); - }).then(function (comments) { - // If `findCommentsByAuthor` fulfills, we'll have the value here - }, function (reason) { - // If `findCommentsByAuthor` rejects, we'll have the reason here - }); - ``` - Simple Example - -------------- - Synchronous Example - ```javascript - let result; - try { - result = findResult(); - // success - } catch(reason) { - // failure - } - ``` - Errback Example - ```js - findResult(function(result, err){ - if (err) { - // failure - } else { - // success - } - }); - ``` - Promise Example; - ```javascript - findResult().then(function(result){ - // success - }, function(reason){ - // failure - }); - ``` - Advanced Example - -------------- - Synchronous Example - ```javascript - let author, books; - try { - author = findAuthor(); - books = findBooksByAuthor(author); - // success - } catch(reason) { - // failure - } - ``` - Errback Example - ```js - function foundBooks(books) { - } - function failure(reason) { - } - findAuthor(function(author, err){ - if (err) { - failure(err); - // failure - } else { - try { - findBoooksByAuthor(author, function(books, err) { - if (err) { - failure(err); - } else { - try { - foundBooks(books); - } catch(reason) { - failure(reason); - } - } - }); - } catch(error) { - failure(err); - } - // success - } - }); - ``` - Promise Example; - ```javascript - findAuthor(). - then(findBooksByAuthor). - then(function(books){ - // found books - }).catch(function(reason){ - // something went wrong - }); - ``` - @method then - @param {Function} onFulfilled - @param {Function} onRejected - Useful for tooling. - @return {Promise} - */ - - /** - `catch` is simply sugar for `then(undefined, onRejection)` which makes it the same - as the catch block of a try/catch statement. - ```js - function findAuthor(){ - throw new Error('couldn't find that author'); - } - // synchronous - try { - findAuthor(); - } catch(reason) { - // something went wrong - } - // async with promises - findAuthor().catch(function(reason){ - // something went wrong - }); - ``` - @method catch - @param {Function} onRejection - Useful for tooling. - @return {Promise} - */ - - - Promise.prototype.catch = function _catch(onRejection) { - return this.then(null, onRejection); - }; - - /** - `finally` will be invoked regardless of the promise's fate just as native - try/catch/finally behaves - - Synchronous example: - - ```js - findAuthor() { - if (Math.random() > 0.5) { - throw new Error(); - } - return new Author(); - } - - try { - return findAuthor(); // succeed or fail - } catch(error) { - return findOtherAuther(); - } finally { - // always runs - // doesn't affect the return value - } - ``` - - Asynchronous example: - - ```js - findAuthor().catch(function(reason){ - return findOtherAuther(); - }).finally(function(){ - // author was either found, or not - }); - ``` - - @method finally - @param {Function} callback - @return {Promise} - */ - - - Promise.prototype.finally = function _finally(callback) { - var promise = this; - var constructor = promise.constructor; - - if (isFunction(callback)) { - return promise.then(function (value) { - return constructor.resolve(callback()).then(function () { - return value; - }); - }, function (reason) { - return constructor.resolve(callback()).then(function () { - throw reason; - }); - }); - } - - return promise.then(callback, callback); - }; - - return Promise; -}(); - -Promise$1.prototype.then = then; -Promise$1.all = all; -Promise$1.race = race; -Promise$1.resolve = resolve$1; -Promise$1.reject = reject$1; -Promise$1._setScheduler = setScheduler; -Promise$1._setAsap = setAsap; -Promise$1._asap = asap; - -/*global self*/ -function polyfill() { - var local = void 0; - - if (typeof global !== 'undefined') { - local = global; - } else if (typeof self !== 'undefined') { - local = self; - } else { - try { - local = Function('return this')(); - } catch (e) { - throw new Error('polyfill failed because global object is unavailable in this environment'); - } - } - - var P = local.Promise; - - if (P) { - var promiseToString = null; - try { - promiseToString = Object.prototype.toString.call(P.resolve()); - } catch (e) { - // silently ignored - } - - if (promiseToString === '[object Promise]' && !P.cast) { - return; - } - } - - local.Promise = Promise$1; -} - -// Strange compat.. -Promise$1.polyfill = polyfill; -Promise$1.Promise = Promise$1; - -return Promise$1; - -}))); - - - - - -}).call(this,require('_process'),typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) -},{"_process":197}],128:[function(require,module,exports){ -(function (global){ -"use strict"; - -/* global self, window, module, global, require */ -module.exports = function () { - - "use strict"; - - var globalObject = void 0; - - function isFunction(x) { - return typeof x === "function"; - } - - // Seek the global object - if (global !== undefined) { - globalObject = global; - } else if (window !== undefined && window.document) { - globalObject = window; - } else { - globalObject = self; - } - - // Test for any native promise implementation, and if that - // implementation appears to conform to the specificaton. - // This code mostly nicked from the es6-promise module polyfill - // and then fooled with. - var hasPromiseSupport = function () { - - // No promise object at all, and it's a non-starter - if (!globalObject.hasOwnProperty("Promise")) { - return false; - } - - // There is a Promise object. Does it conform to the spec? - var P = globalObject.Promise; - - // Some of these methods are missing from - // Firefox/Chrome experimental implementations - if (!P.hasOwnProperty("resolve") || !P.hasOwnProperty("reject")) { - return false; - } - - if (!P.hasOwnProperty("all") || !P.hasOwnProperty("race")) { - return false; - } - - // Older version of the spec had a resolver object - // as the arg rather than a function - return function () { - - var resolve = void 0; - - var p = new globalObject.Promise(function (r) { - resolve = r; - }); - - if (p) { - return isFunction(resolve); - } - - return false; - }(); - }(); - - // Export the native Promise implementation if it - // looks like it matches the spec - if (hasPromiseSupport) { - return globalObject.Promise; - } - - // Otherwise, return the es6-promise polyfill by @jaffathecake. - return require("es6-promise").Promise; -}(); -}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) -},{"es6-promise":127}],129:[function(require,module,exports){ -"use strict"; - -/* global module, require */ -module.exports = function () { - - "use strict"; - - // Get a promise object. This may be native, or it may be polyfilled - - var ES6Promise = require("./promise.js"); - - /** - * thatLooksLikeAPromiseToMe() - * - * Duck-types a promise. - * - * @param {object} o - * @return {bool} True if this resembles a promise - */ - function thatLooksLikeAPromiseToMe(o) { - return o && typeof o.then === "function" && typeof o.catch === "function"; - } - - /** - * promisify() - * - * Transforms callback-based function -- func(arg1, arg2 .. argN, callback) -- into - * an ES6-compatible Promise. Promisify provides a default callback of the form (error, result) - * and rejects when `error` is truthy. You can also supply settings object as the second argument. - * - * @param {function} original - The function to promisify - * @param {object} settings - Settings object - * @param {object} settings.thisArg - A `this` context to use. If not set, assume `settings` _is_ `thisArg` - * @param {bool} settings.multiArgs - Should multiple arguments be returned as an array? - * @return {function} A promisified version of `original` - */ - return function promisify(original, settings) { - - return function () { - for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) { - args[_key] = arguments[_key]; - } - - var returnMultipleArguments = settings && settings.multiArgs; - - var target = void 0; - if (settings && settings.thisArg) { - target = settings.thisArg; - } else if (settings) { - target = settings; - } - - // Return the promisified function - return new ES6Promise(function (resolve, reject) { - - // Append the callback bound to the context - args.push(function callback(err) { - - if (err) { - return reject(err); - } - - for (var _len2 = arguments.length, values = Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) { - values[_key2 - 1] = arguments[_key2]; - } - - if (false === !!returnMultipleArguments) { - return resolve(values[0]); - } - - resolve(values); - }); - - // Call the function - var response = original.apply(target, args); - - // If it looks like original already returns a promise, - // then just resolve with that promise. Hopefully, the callback function we added will just be ignored. - if (thatLooksLikeAPromiseToMe(response)) { - resolve(response); - } - }); - }; - }; -}(); -},{"./promise.js":128}],130:[function(require,module,exports){ -// Copyright Joyent, Inc. and other Node contributors. -// -// Permission is hereby granted, free of charge, to any person obtaining a -// copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to permit -// persons to whom the Software is furnished to do so, subject to the -// following conditions: -// -// The above copyright notice and this permission notice shall be included -// in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN -// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR -// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE -// USE OR OTHER DEALINGS IN THE SOFTWARE. - -var objectCreate = Object.create || objectCreatePolyfill -var objectKeys = Object.keys || objectKeysPolyfill -var bind = Function.prototype.bind || functionBindPolyfill - -function EventEmitter() { - if (!this._events || !Object.prototype.hasOwnProperty.call(this, '_events')) { - this._events = objectCreate(null); - this._eventsCount = 0; - } - - this._maxListeners = this._maxListeners || undefined; -} -module.exports = EventEmitter; - -// Backwards-compat with node 0.10.x -EventEmitter.EventEmitter = EventEmitter; - -EventEmitter.prototype._events = undefined; -EventEmitter.prototype._maxListeners = undefined; - -// By default EventEmitters will print a warning if more than 10 listeners are -// added to it. This is a useful default which helps finding memory leaks. -var defaultMaxListeners = 10; - -var hasDefineProperty; -try { - var o = {}; - if (Object.defineProperty) Object.defineProperty(o, 'x', { value: 0 }); - hasDefineProperty = o.x === 0; -} catch (err) { hasDefineProperty = false } -if (hasDefineProperty) { - Object.defineProperty(EventEmitter, 'defaultMaxListeners', { - enumerable: true, - get: function() { - return defaultMaxListeners; - }, - set: function(arg) { - // check whether the input is a positive number (whose value is zero or - // greater and not a NaN). - if (typeof arg !== 'number' || arg < 0 || arg !== arg) - throw new TypeError('"defaultMaxListeners" must be a positive number'); - defaultMaxListeners = arg; - } - }); -} else { - EventEmitter.defaultMaxListeners = defaultMaxListeners; -} - -// Obviously not all Emitters should be limited to 10. This function allows -// that to be increased. Set to zero for unlimited. -EventEmitter.prototype.setMaxListeners = function setMaxListeners(n) { - if (typeof n !== 'number' || n < 0 || isNaN(n)) - throw new TypeError('"n" argument must be a positive number'); - this._maxListeners = n; - return this; -}; - -function $getMaxListeners(that) { - if (that._maxListeners === undefined) - return EventEmitter.defaultMaxListeners; - return that._maxListeners; -} - -EventEmitter.prototype.getMaxListeners = function getMaxListeners() { - return $getMaxListeners(this); -}; - -// These standalone emit* functions are used to optimize calling of event -// handlers for fast cases because emit() itself often has a variable number of -// arguments and can be deoptimized because of that. These functions always have -// the same number of arguments and thus do not get deoptimized, so the code -// inside them can execute faster. -function emitNone(handler, isFn, self) { - if (isFn) - handler.call(self); - else { - var len = handler.length; - var listeners = arrayClone(handler, len); - for (var i = 0; i < len; ++i) - listeners[i].call(self); - } -} -function emitOne(handler, isFn, self, arg1) { - if (isFn) - handler.call(self, arg1); - else { - var len = handler.length; - var listeners = arrayClone(handler, len); - for (var i = 0; i < len; ++i) - listeners[i].call(self, arg1); - } -} -function emitTwo(handler, isFn, self, arg1, arg2) { - if (isFn) - handler.call(self, arg1, arg2); - else { - var len = handler.length; - var listeners = arrayClone(handler, len); - for (var i = 0; i < len; ++i) - listeners[i].call(self, arg1, arg2); - } -} -function emitThree(handler, isFn, self, arg1, arg2, arg3) { - if (isFn) - handler.call(self, arg1, arg2, arg3); - else { - var len = handler.length; - var listeners = arrayClone(handler, len); - for (var i = 0; i < len; ++i) - listeners[i].call(self, arg1, arg2, arg3); - } -} - -function emitMany(handler, isFn, self, args) { - if (isFn) - handler.apply(self, args); - else { - var len = handler.length; - var listeners = arrayClone(handler, len); - for (var i = 0; i < len; ++i) - listeners[i].apply(self, args); - } -} - -EventEmitter.prototype.emit = function emit(type) { - var er, handler, len, args, i, events; - var doError = (type === 'error'); - - events = this._events; - if (events) - doError = (doError && events.error == null); - else if (!doError) - return false; - - // If there is no 'error' event listener then throw. - if (doError) { - if (arguments.length > 1) - er = arguments[1]; - if (er instanceof Error) { - throw er; // Unhandled 'error' event - } else { - // At least give some kind of context to the user - var err = new Error('Unhandled "error" event. (' + er + ')'); - err.context = er; - throw err; - } - return false; - } - - handler = events[type]; - - if (!handler) - return false; - - var isFn = typeof handler === 'function'; - len = arguments.length; - switch (len) { - // fast cases - case 1: - emitNone(handler, isFn, this); - break; - case 2: - emitOne(handler, isFn, this, arguments[1]); - break; - case 3: - emitTwo(handler, isFn, this, arguments[1], arguments[2]); - break; - case 4: - emitThree(handler, isFn, this, arguments[1], arguments[2], arguments[3]); - break; - // slower - default: - args = new Array(len - 1); - for (i = 1; i < len; i++) - args[i - 1] = arguments[i]; - emitMany(handler, isFn, this, args); - } - - return true; -}; - -function _addListener(target, type, listener, prepend) { - var m; - var events; - var existing; - - if (typeof listener !== 'function') - throw new TypeError('"listener" argument must be a function'); - - events = target._events; - if (!events) { - events = target._events = objectCreate(null); - target._eventsCount = 0; - } else { - // To avoid recursion in the case that type === "newListener"! Before - // adding it to the listeners, first emit "newListener". - if (events.newListener) { - target.emit('newListener', type, - listener.listener ? listener.listener : listener); - - // Re-assign `events` because a newListener handler could have caused the - // this._events to be assigned to a new object - events = target._events; - } - existing = events[type]; - } - - if (!existing) { - // Optimize the case of one listener. Don't need the extra array object. - existing = events[type] = listener; - ++target._eventsCount; - } else { - if (typeof existing === 'function') { - // Adding the second element, need to change to array. - existing = events[type] = - prepend ? [listener, existing] : [existing, listener]; - } else { - // If we've already got an array, just append. - if (prepend) { - existing.unshift(listener); - } else { - existing.push(listener); - } - } - - // Check for listener leak - if (!existing.warned) { - m = $getMaxListeners(target); - if (m && m > 0 && existing.length > m) { - existing.warned = true; - var w = new Error('Possible EventEmitter memory leak detected. ' + - existing.length + ' "' + String(type) + '" listeners ' + - 'added. Use emitter.setMaxListeners() to ' + - 'increase limit.'); - w.name = 'MaxListenersExceededWarning'; - w.emitter = target; - w.type = type; - w.count = existing.length; - if (typeof console === 'object' && console.warn) { - console.warn('%s: %s', w.name, w.message); - } - } - } - } - - return target; -} - -EventEmitter.prototype.addListener = function addListener(type, listener) { - return _addListener(this, type, listener, false); -}; - -EventEmitter.prototype.on = EventEmitter.prototype.addListener; - -EventEmitter.prototype.prependListener = - function prependListener(type, listener) { - return _addListener(this, type, listener, true); - }; - -function onceWrapper() { - if (!this.fired) { - this.target.removeListener(this.type, this.wrapFn); - this.fired = true; - switch (arguments.length) { - case 0: - return this.listener.call(this.target); - case 1: - return this.listener.call(this.target, arguments[0]); - case 2: - return this.listener.call(this.target, arguments[0], arguments[1]); - case 3: - return this.listener.call(this.target, arguments[0], arguments[1], - arguments[2]); - default: - var args = new Array(arguments.length); - for (var i = 0; i < args.length; ++i) - args[i] = arguments[i]; - this.listener.apply(this.target, args); - } - } -} - -function _onceWrap(target, type, listener) { - var state = { fired: false, wrapFn: undefined, target: target, type: type, listener: listener }; - var wrapped = bind.call(onceWrapper, state); - wrapped.listener = listener; - state.wrapFn = wrapped; - return wrapped; -} - -EventEmitter.prototype.once = function once(type, listener) { - if (typeof listener !== 'function') - throw new TypeError('"listener" argument must be a function'); - this.on(type, _onceWrap(this, type, listener)); - return this; -}; - -EventEmitter.prototype.prependOnceListener = - function prependOnceListener(type, listener) { - if (typeof listener !== 'function') - throw new TypeError('"listener" argument must be a function'); - this.prependListener(type, _onceWrap(this, type, listener)); - return this; - }; - -// Emits a 'removeListener' event if and only if the listener was removed. -EventEmitter.prototype.removeListener = - function removeListener(type, listener) { - var list, events, position, i, originalListener; - - if (typeof listener !== 'function') - throw new TypeError('"listener" argument must be a function'); - - events = this._events; - if (!events) - return this; - - list = events[type]; - if (!list) - return this; - - if (list === listener || list.listener === listener) { - if (--this._eventsCount === 0) - this._events = objectCreate(null); - else { - delete events[type]; - if (events.removeListener) - this.emit('removeListener', type, list.listener || listener); - } - } else if (typeof list !== 'function') { - position = -1; - - for (i = list.length - 1; i >= 0; i--) { - if (list[i] === listener || list[i].listener === listener) { - originalListener = list[i].listener; - position = i; - break; - } - } - - if (position < 0) - return this; - - if (position === 0) - list.shift(); - else - spliceOne(list, position); - - if (list.length === 1) - events[type] = list[0]; - - if (events.removeListener) - this.emit('removeListener', type, originalListener || listener); - } - - return this; - }; - -EventEmitter.prototype.removeAllListeners = - function removeAllListeners(type) { - var listeners, events, i; - - events = this._events; - if (!events) - return this; - - // not listening for removeListener, no need to emit - if (!events.removeListener) { - if (arguments.length === 0) { - this._events = objectCreate(null); - this._eventsCount = 0; - } else if (events[type]) { - if (--this._eventsCount === 0) - this._events = objectCreate(null); - else - delete events[type]; - } - return this; - } - - // emit removeListener for all listeners on all events - if (arguments.length === 0) { - var keys = objectKeys(events); - var key; - for (i = 0; i < keys.length; ++i) { - key = keys[i]; - if (key === 'removeListener') continue; - this.removeAllListeners(key); - } - this.removeAllListeners('removeListener'); - this._events = objectCreate(null); - this._eventsCount = 0; - return this; - } - - listeners = events[type]; - - if (typeof listeners === 'function') { - this.removeListener(type, listeners); - } else if (listeners) { - // LIFO order - for (i = listeners.length - 1; i >= 0; i--) { - this.removeListener(type, listeners[i]); - } - } - - return this; - }; - -function _listeners(target, type, unwrap) { - var events = target._events; - - if (!events) - return []; - - var evlistener = events[type]; - if (!evlistener) - return []; - - if (typeof evlistener === 'function') - return unwrap ? [evlistener.listener || evlistener] : [evlistener]; - - return unwrap ? unwrapListeners(evlistener) : arrayClone(evlistener, evlistener.length); -} - -EventEmitter.prototype.listeners = function listeners(type) { - return _listeners(this, type, true); -}; - -EventEmitter.prototype.rawListeners = function rawListeners(type) { - return _listeners(this, type, false); -}; - -EventEmitter.listenerCount = function(emitter, type) { - if (typeof emitter.listenerCount === 'function') { - return emitter.listenerCount(type); - } else { - return listenerCount.call(emitter, type); - } -}; - -EventEmitter.prototype.listenerCount = listenerCount; -function listenerCount(type) { - var events = this._events; - - if (events) { - var evlistener = events[type]; - - if (typeof evlistener === 'function') { - return 1; - } else if (evlistener) { - return evlistener.length; - } - } - - return 0; -} - -EventEmitter.prototype.eventNames = function eventNames() { - return this._eventsCount > 0 ? Reflect.ownKeys(this._events) : []; -}; - -// About 1.5x faster than the two-arg version of Array#splice(). -function spliceOne(list, index) { - for (var i = index, k = i + 1, n = list.length; k < n; i += 1, k += 1) - list[i] = list[k]; - list.pop(); -} - -function arrayClone(arr, n) { - var copy = new Array(n); - for (var i = 0; i < n; ++i) - copy[i] = arr[i]; - return copy; -} - -function unwrapListeners(arr) { - var ret = new Array(arr.length); - for (var i = 0; i < ret.length; ++i) { - ret[i] = arr[i].listener || arr[i]; - } - return ret; -} - -function objectCreatePolyfill(proto) { - var F = function() {}; - F.prototype = proto; - return new F; -} -function objectKeysPolyfill(obj) { - var keys = []; - for (var k in obj) if (Object.prototype.hasOwnProperty.call(obj, k)) { - keys.push(k); - } - return k; -} -function functionBindPolyfill(context) { - var fn = this; - return function () { - return fn.apply(context, arguments); - }; -} - -},{}],131:[function(require,module,exports){ -var Buffer = require('safe-buffer').Buffer -var MD5 = require('md5.js') - -/* eslint-disable camelcase */ -function EVP_BytesToKey (password, salt, keyBits, ivLen) { - if (!Buffer.isBuffer(password)) password = Buffer.from(password, 'binary') - if (salt) { - if (!Buffer.isBuffer(salt)) salt = Buffer.from(salt, 'binary') - if (salt.length !== 8) throw new RangeError('salt should be Buffer with 8 byte length') - } - - var keyLen = keyBits / 8 - var key = Buffer.alloc(keyLen) - var iv = Buffer.alloc(ivLen || 0) - var tmp = Buffer.alloc(0) - - while (keyLen > 0 || ivLen > 0) { - var hash = new MD5() - hash.update(tmp) - hash.update(password) - if (salt) hash.update(salt) - tmp = hash.digest() - - var used = 0 - - if (keyLen > 0) { - var keyStart = key.length - keyLen - used = Math.min(keyLen, tmp.length) - tmp.copy(key, keyStart, 0, used) - keyLen -= used - } - - if (used < tmp.length && ivLen > 0) { - var ivStart = iv.length - ivLen - var length = Math.min(ivLen, tmp.length - used) - tmp.copy(iv, ivStart, used, used + length) - ivLen -= length - } - } - - tmp.fill(0) - return { key: key, iv: iv } -} - -module.exports = EVP_BytesToKey - -},{"md5.js":162,"safe-buffer":216}],132:[function(require,module,exports){ -'use strict' -var Buffer = require('safe-buffer').Buffer -var Transform = require('stream').Transform -var inherits = require('inherits') - -function throwIfNotStringOrBuffer (val, prefix) { - if (!Buffer.isBuffer(val) && typeof val !== 'string') { - throw new TypeError(prefix + ' must be a string or a buffer') - } -} - -function HashBase (blockSize) { - Transform.call(this) - - this._block = Buffer.allocUnsafe(blockSize) - this._blockSize = blockSize - this._blockOffset = 0 - this._length = [0, 0, 0, 0] - - this._finalized = false -} - -inherits(HashBase, Transform) - -HashBase.prototype._transform = function (chunk, encoding, callback) { - var error = null - try { - this.update(chunk, encoding) - } catch (err) { - error = err - } - - callback(error) -} - -HashBase.prototype._flush = function (callback) { - var error = null - try { - this.push(this.digest()) - } catch (err) { - error = err - } - - callback(error) -} - -HashBase.prototype.update = function (data, encoding) { - throwIfNotStringOrBuffer(data, 'Data') - if (this._finalized) throw new Error('Digest already called') - if (!Buffer.isBuffer(data)) data = Buffer.from(data, encoding) - - // consume data - var block = this._block - var offset = 0 - while (this._blockOffset + data.length - offset >= this._blockSize) { - for (var i = this._blockOffset; i < this._blockSize;) block[i++] = data[offset++] - this._update() - this._blockOffset = 0 - } - while (offset < data.length) block[this._blockOffset++] = data[offset++] - - // update length - for (var j = 0, carry = data.length * 8; carry > 0; ++j) { - this._length[j] += carry - carry = (this._length[j] / 0x0100000000) | 0 - if (carry > 0) this._length[j] -= 0x0100000000 * carry - } - - return this -} - -HashBase.prototype._update = function () { - throw new Error('_update is not implemented') -} - -HashBase.prototype.digest = function (encoding) { - if (this._finalized) throw new Error('Digest already called') - this._finalized = true - - var digest = this._digest() - if (encoding !== undefined) digest = digest.toString(encoding) - - // reset state - this._block.fill(0) - this._blockOffset = 0 - for (var i = 0; i < 4; ++i) this._length[i] = 0 - - return digest -} - -HashBase.prototype._digest = function () { - throw new Error('_digest is not implemented') -} - -module.exports = HashBase - -},{"inherits":156,"safe-buffer":216,"stream":225}],133:[function(require,module,exports){ -var hash = exports; - -hash.utils = require('./hash/utils'); -hash.common = require('./hash/common'); -hash.sha = require('./hash/sha'); -hash.ripemd = require('./hash/ripemd'); -hash.hmac = require('./hash/hmac'); - -// Proxy hash functions to the main object -hash.sha1 = hash.sha.sha1; -hash.sha256 = hash.sha.sha256; -hash.sha224 = hash.sha.sha224; -hash.sha384 = hash.sha.sha384; -hash.sha512 = hash.sha.sha512; -hash.ripemd160 = hash.ripemd.ripemd160; - -},{"./hash/common":134,"./hash/hmac":135,"./hash/ripemd":136,"./hash/sha":137,"./hash/utils":144}],134:[function(require,module,exports){ -'use strict'; - -var utils = require('./utils'); -var assert = require('minimalistic-assert'); - -function BlockHash() { - this.pending = null; - this.pendingTotal = 0; - this.blockSize = this.constructor.blockSize; - this.outSize = this.constructor.outSize; - this.hmacStrength = this.constructor.hmacStrength; - this.padLength = this.constructor.padLength / 8; - this.endian = 'big'; - - this._delta8 = this.blockSize / 8; - this._delta32 = this.blockSize / 32; -} -exports.BlockHash = BlockHash; - -BlockHash.prototype.update = function update(msg, enc) { - // Convert message to array, pad it, and join into 32bit blocks - msg = utils.toArray(msg, enc); - if (!this.pending) - this.pending = msg; - else - this.pending = this.pending.concat(msg); - this.pendingTotal += msg.length; - - // Enough data, try updating - if (this.pending.length >= this._delta8) { - msg = this.pending; - - // Process pending data in blocks - var r = msg.length % this._delta8; - this.pending = msg.slice(msg.length - r, msg.length); - if (this.pending.length === 0) - this.pending = null; - - msg = utils.join32(msg, 0, msg.length - r, this.endian); - for (var i = 0; i < msg.length; i += this._delta32) - this._update(msg, i, i + this._delta32); - } - - return this; -}; - -BlockHash.prototype.digest = function digest(enc) { - this.update(this._pad()); - assert(this.pending === null); - - return this._digest(enc); -}; - -BlockHash.prototype._pad = function pad() { - var len = this.pendingTotal; - var bytes = this._delta8; - var k = bytes - ((len + this.padLength) % bytes); - var res = new Array(k + this.padLength); - res[0] = 0x80; - for (var i = 1; i < k; i++) - res[i] = 0; - - // Append length - len <<= 3; - if (this.endian === 'big') { - for (var t = 8; t < this.padLength; t++) - res[i++] = 0; - - res[i++] = 0; - res[i++] = 0; - res[i++] = 0; - res[i++] = 0; - res[i++] = (len >>> 24) & 0xff; - res[i++] = (len >>> 16) & 0xff; - res[i++] = (len >>> 8) & 0xff; - res[i++] = len & 0xff; - } else { - res[i++] = len & 0xff; - res[i++] = (len >>> 8) & 0xff; - res[i++] = (len >>> 16) & 0xff; - res[i++] = (len >>> 24) & 0xff; - res[i++] = 0; - res[i++] = 0; - res[i++] = 0; - res[i++] = 0; - - for (t = 8; t < this.padLength; t++) - res[i++] = 0; - } - - return res; -}; - -},{"./utils":144,"minimalistic-assert":164}],135:[function(require,module,exports){ -'use strict'; - -var utils = require('./utils'); -var assert = require('minimalistic-assert'); - -function Hmac(hash, key, enc) { - if (!(this instanceof Hmac)) - return new Hmac(hash, key, enc); - this.Hash = hash; - this.blockSize = hash.blockSize / 8; - this.outSize = hash.outSize / 8; - this.inner = null; - this.outer = null; - - this._init(utils.toArray(key, enc)); -} -module.exports = Hmac; - -Hmac.prototype._init = function init(key) { - // Shorten key, if needed - if (key.length > this.blockSize) - key = new this.Hash().update(key).digest(); - assert(key.length <= this.blockSize); - - // Add padding to key - for (var i = key.length; i < this.blockSize; i++) - key.push(0); - - for (i = 0; i < key.length; i++) - key[i] ^= 0x36; - this.inner = new this.Hash().update(key); - - // 0x36 ^ 0x5c = 0x6a - for (i = 0; i < key.length; i++) - key[i] ^= 0x6a; - this.outer = new this.Hash().update(key); -}; - -Hmac.prototype.update = function update(msg, enc) { - this.inner.update(msg, enc); - return this; -}; - -Hmac.prototype.digest = function digest(enc) { - this.outer.update(this.inner.digest()); - return this.outer.digest(enc); -}; - -},{"./utils":144,"minimalistic-assert":164}],136:[function(require,module,exports){ -'use strict'; - -var utils = require('./utils'); -var common = require('./common'); - -var rotl32 = utils.rotl32; -var sum32 = utils.sum32; -var sum32_3 = utils.sum32_3; -var sum32_4 = utils.sum32_4; -var BlockHash = common.BlockHash; - -function RIPEMD160() { - if (!(this instanceof RIPEMD160)) - return new RIPEMD160(); - - BlockHash.call(this); - - this.h = [ 0x67452301, 0xefcdab89, 0x98badcfe, 0x10325476, 0xc3d2e1f0 ]; - this.endian = 'little'; -} -utils.inherits(RIPEMD160, BlockHash); -exports.ripemd160 = RIPEMD160; - -RIPEMD160.blockSize = 512; -RIPEMD160.outSize = 160; -RIPEMD160.hmacStrength = 192; -RIPEMD160.padLength = 64; - -RIPEMD160.prototype._update = function update(msg, start) { - var A = this.h[0]; - var B = this.h[1]; - var C = this.h[2]; - var D = this.h[3]; - var E = this.h[4]; - var Ah = A; - var Bh = B; - var Ch = C; - var Dh = D; - var Eh = E; - for (var j = 0; j < 80; j++) { - var T = sum32( - rotl32( - sum32_4(A, f(j, B, C, D), msg[r[j] + start], K(j)), - s[j]), - E); - A = E; - E = D; - D = rotl32(C, 10); - C = B; - B = T; - T = sum32( - rotl32( - sum32_4(Ah, f(79 - j, Bh, Ch, Dh), msg[rh[j] + start], Kh(j)), - sh[j]), - Eh); - Ah = Eh; - Eh = Dh; - Dh = rotl32(Ch, 10); - Ch = Bh; - Bh = T; - } - T = sum32_3(this.h[1], C, Dh); - this.h[1] = sum32_3(this.h[2], D, Eh); - this.h[2] = sum32_3(this.h[3], E, Ah); - this.h[3] = sum32_3(this.h[4], A, Bh); - this.h[4] = sum32_3(this.h[0], B, Ch); - this.h[0] = T; -}; - -RIPEMD160.prototype._digest = function digest(enc) { - if (enc === 'hex') - return utils.toHex32(this.h, 'little'); - else - return utils.split32(this.h, 'little'); -}; - -function f(j, x, y, z) { - if (j <= 15) - return x ^ y ^ z; - else if (j <= 31) - return (x & y) | ((~x) & z); - else if (j <= 47) - return (x | (~y)) ^ z; - else if (j <= 63) - return (x & z) | (y & (~z)); - else - return x ^ (y | (~z)); -} - -function K(j) { - if (j <= 15) - return 0x00000000; - else if (j <= 31) - return 0x5a827999; - else if (j <= 47) - return 0x6ed9eba1; - else if (j <= 63) - return 0x8f1bbcdc; - else - return 0xa953fd4e; -} - -function Kh(j) { - if (j <= 15) - return 0x50a28be6; - else if (j <= 31) - return 0x5c4dd124; - else if (j <= 47) - return 0x6d703ef3; - else if (j <= 63) - return 0x7a6d76e9; - else - return 0x00000000; -} - -var r = [ - 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, - 7, 4, 13, 1, 10, 6, 15, 3, 12, 0, 9, 5, 2, 14, 11, 8, - 3, 10, 14, 4, 9, 15, 8, 1, 2, 7, 0, 6, 13, 11, 5, 12, - 1, 9, 11, 10, 0, 8, 12, 4, 13, 3, 7, 15, 14, 5, 6, 2, - 4, 0, 5, 9, 7, 12, 2, 10, 14, 1, 3, 8, 11, 6, 15, 13 -]; - -var rh = [ - 5, 14, 7, 0, 9, 2, 11, 4, 13, 6, 15, 8, 1, 10, 3, 12, - 6, 11, 3, 7, 0, 13, 5, 10, 14, 15, 8, 12, 4, 9, 1, 2, - 15, 5, 1, 3, 7, 14, 6, 9, 11, 8, 12, 2, 10, 0, 4, 13, - 8, 6, 4, 1, 3, 11, 15, 0, 5, 12, 2, 13, 9, 7, 10, 14, - 12, 15, 10, 4, 1, 5, 8, 7, 6, 2, 13, 14, 0, 3, 9, 11 -]; - -var s = [ - 11, 14, 15, 12, 5, 8, 7, 9, 11, 13, 14, 15, 6, 7, 9, 8, - 7, 6, 8, 13, 11, 9, 7, 15, 7, 12, 15, 9, 11, 7, 13, 12, - 11, 13, 6, 7, 14, 9, 13, 15, 14, 8, 13, 6, 5, 12, 7, 5, - 11, 12, 14, 15, 14, 15, 9, 8, 9, 14, 5, 6, 8, 6, 5, 12, - 9, 15, 5, 11, 6, 8, 13, 12, 5, 12, 13, 14, 11, 8, 5, 6 -]; - -var sh = [ - 8, 9, 9, 11, 13, 15, 15, 5, 7, 7, 8, 11, 14, 14, 12, 6, - 9, 13, 15, 7, 12, 8, 9, 11, 7, 7, 12, 7, 6, 15, 13, 11, - 9, 7, 15, 11, 8, 6, 6, 14, 12, 13, 5, 14, 13, 13, 7, 5, - 15, 5, 8, 11, 14, 14, 6, 14, 6, 9, 12, 9, 12, 5, 15, 8, - 8, 5, 12, 9, 12, 5, 14, 6, 8, 13, 6, 5, 15, 13, 11, 11 -]; - -},{"./common":134,"./utils":144}],137:[function(require,module,exports){ -'use strict'; - -exports.sha1 = require('./sha/1'); -exports.sha224 = require('./sha/224'); -exports.sha256 = require('./sha/256'); -exports.sha384 = require('./sha/384'); -exports.sha512 = require('./sha/512'); - -},{"./sha/1":138,"./sha/224":139,"./sha/256":140,"./sha/384":141,"./sha/512":142}],138:[function(require,module,exports){ -'use strict'; - -var utils = require('../utils'); -var common = require('../common'); -var shaCommon = require('./common'); - -var rotl32 = utils.rotl32; -var sum32 = utils.sum32; -var sum32_5 = utils.sum32_5; -var ft_1 = shaCommon.ft_1; -var BlockHash = common.BlockHash; - -var sha1_K = [ - 0x5A827999, 0x6ED9EBA1, - 0x8F1BBCDC, 0xCA62C1D6 -]; - -function SHA1() { - if (!(this instanceof SHA1)) - return new SHA1(); - - BlockHash.call(this); - this.h = [ - 0x67452301, 0xefcdab89, 0x98badcfe, - 0x10325476, 0xc3d2e1f0 ]; - this.W = new Array(80); -} - -utils.inherits(SHA1, BlockHash); -module.exports = SHA1; - -SHA1.blockSize = 512; -SHA1.outSize = 160; -SHA1.hmacStrength = 80; -SHA1.padLength = 64; - -SHA1.prototype._update = function _update(msg, start) { - var W = this.W; - - for (var i = 0; i < 16; i++) - W[i] = msg[start + i]; - - for(; i < W.length; i++) - W[i] = rotl32(W[i - 3] ^ W[i - 8] ^ W[i - 14] ^ W[i - 16], 1); - - var a = this.h[0]; - var b = this.h[1]; - var c = this.h[2]; - var d = this.h[3]; - var e = this.h[4]; - - for (i = 0; i < W.length; i++) { - var s = ~~(i / 20); - var t = sum32_5(rotl32(a, 5), ft_1(s, b, c, d), e, W[i], sha1_K[s]); - e = d; - d = c; - c = rotl32(b, 30); - b = a; - a = t; - } - - this.h[0] = sum32(this.h[0], a); - this.h[1] = sum32(this.h[1], b); - this.h[2] = sum32(this.h[2], c); - this.h[3] = sum32(this.h[3], d); - this.h[4] = sum32(this.h[4], e); -}; - -SHA1.prototype._digest = function digest(enc) { - if (enc === 'hex') - return utils.toHex32(this.h, 'big'); - else - return utils.split32(this.h, 'big'); -}; - -},{"../common":134,"../utils":144,"./common":143}],139:[function(require,module,exports){ -'use strict'; - -var utils = require('../utils'); -var SHA256 = require('./256'); - -function SHA224() { - if (!(this instanceof SHA224)) - return new SHA224(); - - SHA256.call(this); - this.h = [ - 0xc1059ed8, 0x367cd507, 0x3070dd17, 0xf70e5939, - 0xffc00b31, 0x68581511, 0x64f98fa7, 0xbefa4fa4 ]; -} -utils.inherits(SHA224, SHA256); -module.exports = SHA224; - -SHA224.blockSize = 512; -SHA224.outSize = 224; -SHA224.hmacStrength = 192; -SHA224.padLength = 64; - -SHA224.prototype._digest = function digest(enc) { - // Just truncate output - if (enc === 'hex') - return utils.toHex32(this.h.slice(0, 7), 'big'); - else - return utils.split32(this.h.slice(0, 7), 'big'); -}; - - -},{"../utils":144,"./256":140}],140:[function(require,module,exports){ -'use strict'; - -var utils = require('../utils'); -var common = require('../common'); -var shaCommon = require('./common'); -var assert = require('minimalistic-assert'); - -var sum32 = utils.sum32; -var sum32_4 = utils.sum32_4; -var sum32_5 = utils.sum32_5; -var ch32 = shaCommon.ch32; -var maj32 = shaCommon.maj32; -var s0_256 = shaCommon.s0_256; -var s1_256 = shaCommon.s1_256; -var g0_256 = shaCommon.g0_256; -var g1_256 = shaCommon.g1_256; - -var BlockHash = common.BlockHash; - -var sha256_K = [ - 0x428a2f98, 0x71374491, 0xb5c0fbcf, 0xe9b5dba5, - 0x3956c25b, 0x59f111f1, 0x923f82a4, 0xab1c5ed5, - 0xd807aa98, 0x12835b01, 0x243185be, 0x550c7dc3, - 0x72be5d74, 0x80deb1fe, 0x9bdc06a7, 0xc19bf174, - 0xe49b69c1, 0xefbe4786, 0x0fc19dc6, 0x240ca1cc, - 0x2de92c6f, 0x4a7484aa, 0x5cb0a9dc, 0x76f988da, - 0x983e5152, 0xa831c66d, 0xb00327c8, 0xbf597fc7, - 0xc6e00bf3, 0xd5a79147, 0x06ca6351, 0x14292967, - 0x27b70a85, 0x2e1b2138, 0x4d2c6dfc, 0x53380d13, - 0x650a7354, 0x766a0abb, 0x81c2c92e, 0x92722c85, - 0xa2bfe8a1, 0xa81a664b, 0xc24b8b70, 0xc76c51a3, - 0xd192e819, 0xd6990624, 0xf40e3585, 0x106aa070, - 0x19a4c116, 0x1e376c08, 0x2748774c, 0x34b0bcb5, - 0x391c0cb3, 0x4ed8aa4a, 0x5b9cca4f, 0x682e6ff3, - 0x748f82ee, 0x78a5636f, 0x84c87814, 0x8cc70208, - 0x90befffa, 0xa4506ceb, 0xbef9a3f7, 0xc67178f2 -]; - -function SHA256() { - if (!(this instanceof SHA256)) - return new SHA256(); - - BlockHash.call(this); - this.h = [ - 0x6a09e667, 0xbb67ae85, 0x3c6ef372, 0xa54ff53a, - 0x510e527f, 0x9b05688c, 0x1f83d9ab, 0x5be0cd19 - ]; - this.k = sha256_K; - this.W = new Array(64); -} -utils.inherits(SHA256, BlockHash); -module.exports = SHA256; - -SHA256.blockSize = 512; -SHA256.outSize = 256; -SHA256.hmacStrength = 192; -SHA256.padLength = 64; - -SHA256.prototype._update = function _update(msg, start) { - var W = this.W; - - for (var i = 0; i < 16; i++) - W[i] = msg[start + i]; - for (; i < W.length; i++) - W[i] = sum32_4(g1_256(W[i - 2]), W[i - 7], g0_256(W[i - 15]), W[i - 16]); - - var a = this.h[0]; - var b = this.h[1]; - var c = this.h[2]; - var d = this.h[3]; - var e = this.h[4]; - var f = this.h[5]; - var g = this.h[6]; - var h = this.h[7]; - - assert(this.k.length === W.length); - for (i = 0; i < W.length; i++) { - var T1 = sum32_5(h, s1_256(e), ch32(e, f, g), this.k[i], W[i]); - var T2 = sum32(s0_256(a), maj32(a, b, c)); - h = g; - g = f; - f = e; - e = sum32(d, T1); - d = c; - c = b; - b = a; - a = sum32(T1, T2); - } - - this.h[0] = sum32(this.h[0], a); - this.h[1] = sum32(this.h[1], b); - this.h[2] = sum32(this.h[2], c); - this.h[3] = sum32(this.h[3], d); - this.h[4] = sum32(this.h[4], e); - this.h[5] = sum32(this.h[5], f); - this.h[6] = sum32(this.h[6], g); - this.h[7] = sum32(this.h[7], h); -}; - -SHA256.prototype._digest = function digest(enc) { - if (enc === 'hex') - return utils.toHex32(this.h, 'big'); - else - return utils.split32(this.h, 'big'); -}; - -},{"../common":134,"../utils":144,"./common":143,"minimalistic-assert":164}],141:[function(require,module,exports){ -'use strict'; - -var utils = require('../utils'); - -var SHA512 = require('./512'); - -function SHA384() { - if (!(this instanceof SHA384)) - return new SHA384(); - - SHA512.call(this); - this.h = [ - 0xcbbb9d5d, 0xc1059ed8, - 0x629a292a, 0x367cd507, - 0x9159015a, 0x3070dd17, - 0x152fecd8, 0xf70e5939, - 0x67332667, 0xffc00b31, - 0x8eb44a87, 0x68581511, - 0xdb0c2e0d, 0x64f98fa7, - 0x47b5481d, 0xbefa4fa4 ]; -} -utils.inherits(SHA384, SHA512); -module.exports = SHA384; - -SHA384.blockSize = 1024; -SHA384.outSize = 384; -SHA384.hmacStrength = 192; -SHA384.padLength = 128; - -SHA384.prototype._digest = function digest(enc) { - if (enc === 'hex') - return utils.toHex32(this.h.slice(0, 12), 'big'); - else - return utils.split32(this.h.slice(0, 12), 'big'); -}; - -},{"../utils":144,"./512":142}],142:[function(require,module,exports){ -'use strict'; - -var utils = require('../utils'); -var common = require('../common'); -var assert = require('minimalistic-assert'); - -var rotr64_hi = utils.rotr64_hi; -var rotr64_lo = utils.rotr64_lo; -var shr64_hi = utils.shr64_hi; -var shr64_lo = utils.shr64_lo; -var sum64 = utils.sum64; -var sum64_hi = utils.sum64_hi; -var sum64_lo = utils.sum64_lo; -var sum64_4_hi = utils.sum64_4_hi; -var sum64_4_lo = utils.sum64_4_lo; -var sum64_5_hi = utils.sum64_5_hi; -var sum64_5_lo = utils.sum64_5_lo; - -var BlockHash = common.BlockHash; - -var sha512_K = [ - 0x428a2f98, 0xd728ae22, 0x71374491, 0x23ef65cd, - 0xb5c0fbcf, 0xec4d3b2f, 0xe9b5dba5, 0x8189dbbc, - 0x3956c25b, 0xf348b538, 0x59f111f1, 0xb605d019, - 0x923f82a4, 0xaf194f9b, 0xab1c5ed5, 0xda6d8118, - 0xd807aa98, 0xa3030242, 0x12835b01, 0x45706fbe, - 0x243185be, 0x4ee4b28c, 0x550c7dc3, 0xd5ffb4e2, - 0x72be5d74, 0xf27b896f, 0x80deb1fe, 0x3b1696b1, - 0x9bdc06a7, 0x25c71235, 0xc19bf174, 0xcf692694, - 0xe49b69c1, 0x9ef14ad2, 0xefbe4786, 0x384f25e3, - 0x0fc19dc6, 0x8b8cd5b5, 0x240ca1cc, 0x77ac9c65, - 0x2de92c6f, 0x592b0275, 0x4a7484aa, 0x6ea6e483, - 0x5cb0a9dc, 0xbd41fbd4, 0x76f988da, 0x831153b5, - 0x983e5152, 0xee66dfab, 0xa831c66d, 0x2db43210, - 0xb00327c8, 0x98fb213f, 0xbf597fc7, 0xbeef0ee4, - 0xc6e00bf3, 0x3da88fc2, 0xd5a79147, 0x930aa725, - 0x06ca6351, 0xe003826f, 0x14292967, 0x0a0e6e70, - 0x27b70a85, 0x46d22ffc, 0x2e1b2138, 0x5c26c926, - 0x4d2c6dfc, 0x5ac42aed, 0x53380d13, 0x9d95b3df, - 0x650a7354, 0x8baf63de, 0x766a0abb, 0x3c77b2a8, - 0x81c2c92e, 0x47edaee6, 0x92722c85, 0x1482353b, - 0xa2bfe8a1, 0x4cf10364, 0xa81a664b, 0xbc423001, - 0xc24b8b70, 0xd0f89791, 0xc76c51a3, 0x0654be30, - 0xd192e819, 0xd6ef5218, 0xd6990624, 0x5565a910, - 0xf40e3585, 0x5771202a, 0x106aa070, 0x32bbd1b8, - 0x19a4c116, 0xb8d2d0c8, 0x1e376c08, 0x5141ab53, - 0x2748774c, 0xdf8eeb99, 0x34b0bcb5, 0xe19b48a8, - 0x391c0cb3, 0xc5c95a63, 0x4ed8aa4a, 0xe3418acb, - 0x5b9cca4f, 0x7763e373, 0x682e6ff3, 0xd6b2b8a3, - 0x748f82ee, 0x5defb2fc, 0x78a5636f, 0x43172f60, - 0x84c87814, 0xa1f0ab72, 0x8cc70208, 0x1a6439ec, - 0x90befffa, 0x23631e28, 0xa4506ceb, 0xde82bde9, - 0xbef9a3f7, 0xb2c67915, 0xc67178f2, 0xe372532b, - 0xca273ece, 0xea26619c, 0xd186b8c7, 0x21c0c207, - 0xeada7dd6, 0xcde0eb1e, 0xf57d4f7f, 0xee6ed178, - 0x06f067aa, 0x72176fba, 0x0a637dc5, 0xa2c898a6, - 0x113f9804, 0xbef90dae, 0x1b710b35, 0x131c471b, - 0x28db77f5, 0x23047d84, 0x32caab7b, 0x40c72493, - 0x3c9ebe0a, 0x15c9bebc, 0x431d67c4, 0x9c100d4c, - 0x4cc5d4be, 0xcb3e42b6, 0x597f299c, 0xfc657e2a, - 0x5fcb6fab, 0x3ad6faec, 0x6c44198c, 0x4a475817 -]; - -function SHA512() { - if (!(this instanceof SHA512)) - return new SHA512(); - - BlockHash.call(this); - this.h = [ - 0x6a09e667, 0xf3bcc908, - 0xbb67ae85, 0x84caa73b, - 0x3c6ef372, 0xfe94f82b, - 0xa54ff53a, 0x5f1d36f1, - 0x510e527f, 0xade682d1, - 0x9b05688c, 0x2b3e6c1f, - 0x1f83d9ab, 0xfb41bd6b, - 0x5be0cd19, 0x137e2179 ]; - this.k = sha512_K; - this.W = new Array(160); -} -utils.inherits(SHA512, BlockHash); -module.exports = SHA512; - -SHA512.blockSize = 1024; -SHA512.outSize = 512; -SHA512.hmacStrength = 192; -SHA512.padLength = 128; - -SHA512.prototype._prepareBlock = function _prepareBlock(msg, start) { - var W = this.W; - - // 32 x 32bit words - for (var i = 0; i < 32; i++) - W[i] = msg[start + i]; - for (; i < W.length; i += 2) { - var c0_hi = g1_512_hi(W[i - 4], W[i - 3]); // i - 2 - var c0_lo = g1_512_lo(W[i - 4], W[i - 3]); - var c1_hi = W[i - 14]; // i - 7 - var c1_lo = W[i - 13]; - var c2_hi = g0_512_hi(W[i - 30], W[i - 29]); // i - 15 - var c2_lo = g0_512_lo(W[i - 30], W[i - 29]); - var c3_hi = W[i - 32]; // i - 16 - var c3_lo = W[i - 31]; - - W[i] = sum64_4_hi( - c0_hi, c0_lo, - c1_hi, c1_lo, - c2_hi, c2_lo, - c3_hi, c3_lo); - W[i + 1] = sum64_4_lo( - c0_hi, c0_lo, - c1_hi, c1_lo, - c2_hi, c2_lo, - c3_hi, c3_lo); - } -}; - -SHA512.prototype._update = function _update(msg, start) { - this._prepareBlock(msg, start); - - var W = this.W; - - var ah = this.h[0]; - var al = this.h[1]; - var bh = this.h[2]; - var bl = this.h[3]; - var ch = this.h[4]; - var cl = this.h[5]; - var dh = this.h[6]; - var dl = this.h[7]; - var eh = this.h[8]; - var el = this.h[9]; - var fh = this.h[10]; - var fl = this.h[11]; - var gh = this.h[12]; - var gl = this.h[13]; - var hh = this.h[14]; - var hl = this.h[15]; - - assert(this.k.length === W.length); - for (var i = 0; i < W.length; i += 2) { - var c0_hi = hh; - var c0_lo = hl; - var c1_hi = s1_512_hi(eh, el); - var c1_lo = s1_512_lo(eh, el); - var c2_hi = ch64_hi(eh, el, fh, fl, gh, gl); - var c2_lo = ch64_lo(eh, el, fh, fl, gh, gl); - var c3_hi = this.k[i]; - var c3_lo = this.k[i + 1]; - var c4_hi = W[i]; - var c4_lo = W[i + 1]; - - var T1_hi = sum64_5_hi( - c0_hi, c0_lo, - c1_hi, c1_lo, - c2_hi, c2_lo, - c3_hi, c3_lo, - c4_hi, c4_lo); - var T1_lo = sum64_5_lo( - c0_hi, c0_lo, - c1_hi, c1_lo, - c2_hi, c2_lo, - c3_hi, c3_lo, - c4_hi, c4_lo); - - c0_hi = s0_512_hi(ah, al); - c0_lo = s0_512_lo(ah, al); - c1_hi = maj64_hi(ah, al, bh, bl, ch, cl); - c1_lo = maj64_lo(ah, al, bh, bl, ch, cl); - - var T2_hi = sum64_hi(c0_hi, c0_lo, c1_hi, c1_lo); - var T2_lo = sum64_lo(c0_hi, c0_lo, c1_hi, c1_lo); - - hh = gh; - hl = gl; - - gh = fh; - gl = fl; - - fh = eh; - fl = el; - - eh = sum64_hi(dh, dl, T1_hi, T1_lo); - el = sum64_lo(dl, dl, T1_hi, T1_lo); - - dh = ch; - dl = cl; - - ch = bh; - cl = bl; - - bh = ah; - bl = al; - - ah = sum64_hi(T1_hi, T1_lo, T2_hi, T2_lo); - al = sum64_lo(T1_hi, T1_lo, T2_hi, T2_lo); - } - - sum64(this.h, 0, ah, al); - sum64(this.h, 2, bh, bl); - sum64(this.h, 4, ch, cl); - sum64(this.h, 6, dh, dl); - sum64(this.h, 8, eh, el); - sum64(this.h, 10, fh, fl); - sum64(this.h, 12, gh, gl); - sum64(this.h, 14, hh, hl); -}; - -SHA512.prototype._digest = function digest(enc) { - if (enc === 'hex') - return utils.toHex32(this.h, 'big'); - else - return utils.split32(this.h, 'big'); -}; - -function ch64_hi(xh, xl, yh, yl, zh) { - var r = (xh & yh) ^ ((~xh) & zh); - if (r < 0) - r += 0x100000000; - return r; -} - -function ch64_lo(xh, xl, yh, yl, zh, zl) { - var r = (xl & yl) ^ ((~xl) & zl); - if (r < 0) - r += 0x100000000; - return r; -} - -function maj64_hi(xh, xl, yh, yl, zh) { - var r = (xh & yh) ^ (xh & zh) ^ (yh & zh); - if (r < 0) - r += 0x100000000; - return r; -} - -function maj64_lo(xh, xl, yh, yl, zh, zl) { - var r = (xl & yl) ^ (xl & zl) ^ (yl & zl); - if (r < 0) - r += 0x100000000; - return r; -} - -function s0_512_hi(xh, xl) { - var c0_hi = rotr64_hi(xh, xl, 28); - var c1_hi = rotr64_hi(xl, xh, 2); // 34 - var c2_hi = rotr64_hi(xl, xh, 7); // 39 - - var r = c0_hi ^ c1_hi ^ c2_hi; - if (r < 0) - r += 0x100000000; - return r; -} - -function s0_512_lo(xh, xl) { - var c0_lo = rotr64_lo(xh, xl, 28); - var c1_lo = rotr64_lo(xl, xh, 2); // 34 - var c2_lo = rotr64_lo(xl, xh, 7); // 39 - - var r = c0_lo ^ c1_lo ^ c2_lo; - if (r < 0) - r += 0x100000000; - return r; -} - -function s1_512_hi(xh, xl) { - var c0_hi = rotr64_hi(xh, xl, 14); - var c1_hi = rotr64_hi(xh, xl, 18); - var c2_hi = rotr64_hi(xl, xh, 9); // 41 - - var r = c0_hi ^ c1_hi ^ c2_hi; - if (r < 0) - r += 0x100000000; - return r; -} - -function s1_512_lo(xh, xl) { - var c0_lo = rotr64_lo(xh, xl, 14); - var c1_lo = rotr64_lo(xh, xl, 18); - var c2_lo = rotr64_lo(xl, xh, 9); // 41 - - var r = c0_lo ^ c1_lo ^ c2_lo; - if (r < 0) - r += 0x100000000; - return r; -} - -function g0_512_hi(xh, xl) { - var c0_hi = rotr64_hi(xh, xl, 1); - var c1_hi = rotr64_hi(xh, xl, 8); - var c2_hi = shr64_hi(xh, xl, 7); - - var r = c0_hi ^ c1_hi ^ c2_hi; - if (r < 0) - r += 0x100000000; - return r; -} - -function g0_512_lo(xh, xl) { - var c0_lo = rotr64_lo(xh, xl, 1); - var c1_lo = rotr64_lo(xh, xl, 8); - var c2_lo = shr64_lo(xh, xl, 7); - - var r = c0_lo ^ c1_lo ^ c2_lo; - if (r < 0) - r += 0x100000000; - return r; -} - -function g1_512_hi(xh, xl) { - var c0_hi = rotr64_hi(xh, xl, 19); - var c1_hi = rotr64_hi(xl, xh, 29); // 61 - var c2_hi = shr64_hi(xh, xl, 6); - - var r = c0_hi ^ c1_hi ^ c2_hi; - if (r < 0) - r += 0x100000000; - return r; -} - -function g1_512_lo(xh, xl) { - var c0_lo = rotr64_lo(xh, xl, 19); - var c1_lo = rotr64_lo(xl, xh, 29); // 61 - var c2_lo = shr64_lo(xh, xl, 6); - - var r = c0_lo ^ c1_lo ^ c2_lo; - if (r < 0) - r += 0x100000000; - return r; -} - -},{"../common":134,"../utils":144,"minimalistic-assert":164}],143:[function(require,module,exports){ -'use strict'; - -var utils = require('../utils'); -var rotr32 = utils.rotr32; - -function ft_1(s, x, y, z) { - if (s === 0) - return ch32(x, y, z); - if (s === 1 || s === 3) - return p32(x, y, z); - if (s === 2) - return maj32(x, y, z); -} -exports.ft_1 = ft_1; - -function ch32(x, y, z) { - return (x & y) ^ ((~x) & z); -} -exports.ch32 = ch32; - -function maj32(x, y, z) { - return (x & y) ^ (x & z) ^ (y & z); -} -exports.maj32 = maj32; - -function p32(x, y, z) { - return x ^ y ^ z; -} -exports.p32 = p32; - -function s0_256(x) { - return rotr32(x, 2) ^ rotr32(x, 13) ^ rotr32(x, 22); -} -exports.s0_256 = s0_256; - -function s1_256(x) { - return rotr32(x, 6) ^ rotr32(x, 11) ^ rotr32(x, 25); -} -exports.s1_256 = s1_256; - -function g0_256(x) { - return rotr32(x, 7) ^ rotr32(x, 18) ^ (x >>> 3); -} -exports.g0_256 = g0_256; - -function g1_256(x) { - return rotr32(x, 17) ^ rotr32(x, 19) ^ (x >>> 10); -} -exports.g1_256 = g1_256; - -},{"../utils":144}],144:[function(require,module,exports){ -'use strict'; - -var assert = require('minimalistic-assert'); -var inherits = require('inherits'); - -exports.inherits = inherits; - -function isSurrogatePair(msg, i) { - if ((msg.charCodeAt(i) & 0xFC00) !== 0xD800) { - return false; - } - if (i < 0 || i + 1 >= msg.length) { - return false; - } - return (msg.charCodeAt(i + 1) & 0xFC00) === 0xDC00; -} - -function toArray(msg, enc) { - if (Array.isArray(msg)) - return msg.slice(); - if (!msg) - return []; - var res = []; - if (typeof msg === 'string') { - if (!enc) { - // Inspired by stringToUtf8ByteArray() in closure-library by Google - // https://github.com/google/closure-library/blob/8598d87242af59aac233270742c8984e2b2bdbe0/closure/goog/crypt/crypt.js#L117-L143 - // Apache License 2.0 - // https://github.com/google/closure-library/blob/master/LICENSE - var p = 0; - for (var i = 0; i < msg.length; i++) { - var c = msg.charCodeAt(i); - if (c < 128) { - res[p++] = c; - } else if (c < 2048) { - res[p++] = (c >> 6) | 192; - res[p++] = (c & 63) | 128; - } else if (isSurrogatePair(msg, i)) { - c = 0x10000 + ((c & 0x03FF) << 10) + (msg.charCodeAt(++i) & 0x03FF); - res[p++] = (c >> 18) | 240; - res[p++] = ((c >> 12) & 63) | 128; - res[p++] = ((c >> 6) & 63) | 128; - res[p++] = (c & 63) | 128; - } else { - res[p++] = (c >> 12) | 224; - res[p++] = ((c >> 6) & 63) | 128; - res[p++] = (c & 63) | 128; - } - } - } else if (enc === 'hex') { - msg = msg.replace(/[^a-z0-9]+/ig, ''); - if (msg.length % 2 !== 0) - msg = '0' + msg; - for (i = 0; i < msg.length; i += 2) - res.push(parseInt(msg[i] + msg[i + 1], 16)); - } - } else { - for (i = 0; i < msg.length; i++) - res[i] = msg[i] | 0; - } - return res; -} -exports.toArray = toArray; - -function toHex(msg) { - var res = ''; - for (var i = 0; i < msg.length; i++) - res += zero2(msg[i].toString(16)); - return res; -} -exports.toHex = toHex; - -function htonl(w) { - var res = (w >>> 24) | - ((w >>> 8) & 0xff00) | - ((w << 8) & 0xff0000) | - ((w & 0xff) << 24); - return res >>> 0; -} -exports.htonl = htonl; - -function toHex32(msg, endian) { - var res = ''; - for (var i = 0; i < msg.length; i++) { - var w = msg[i]; - if (endian === 'little') - w = htonl(w); - res += zero8(w.toString(16)); - } - return res; -} -exports.toHex32 = toHex32; - -function zero2(word) { - if (word.length === 1) - return '0' + word; - else - return word; -} -exports.zero2 = zero2; - -function zero8(word) { - if (word.length === 7) - return '0' + word; - else if (word.length === 6) - return '00' + word; - else if (word.length === 5) - return '000' + word; - else if (word.length === 4) - return '0000' + word; - else if (word.length === 3) - return '00000' + word; - else if (word.length === 2) - return '000000' + word; - else if (word.length === 1) - return '0000000' + word; - else - return word; -} -exports.zero8 = zero8; - -function join32(msg, start, end, endian) { - var len = end - start; - assert(len % 4 === 0); - var res = new Array(len / 4); - for (var i = 0, k = start; i < res.length; i++, k += 4) { - var w; - if (endian === 'big') - w = (msg[k] << 24) | (msg[k + 1] << 16) | (msg[k + 2] << 8) | msg[k + 3]; - else - w = (msg[k + 3] << 24) | (msg[k + 2] << 16) | (msg[k + 1] << 8) | msg[k]; - res[i] = w >>> 0; - } - return res; -} -exports.join32 = join32; - -function split32(msg, endian) { - var res = new Array(msg.length * 4); - for (var i = 0, k = 0; i < msg.length; i++, k += 4) { - var m = msg[i]; - if (endian === 'big') { - res[k] = m >>> 24; - res[k + 1] = (m >>> 16) & 0xff; - res[k + 2] = (m >>> 8) & 0xff; - res[k + 3] = m & 0xff; - } else { - res[k + 3] = m >>> 24; - res[k + 2] = (m >>> 16) & 0xff; - res[k + 1] = (m >>> 8) & 0xff; - res[k] = m & 0xff; - } - } - return res; -} -exports.split32 = split32; - -function rotr32(w, b) { - return (w >>> b) | (w << (32 - b)); -} -exports.rotr32 = rotr32; - -function rotl32(w, b) { - return (w << b) | (w >>> (32 - b)); -} -exports.rotl32 = rotl32; - -function sum32(a, b) { - return (a + b) >>> 0; -} -exports.sum32 = sum32; - -function sum32_3(a, b, c) { - return (a + b + c) >>> 0; -} -exports.sum32_3 = sum32_3; - -function sum32_4(a, b, c, d) { - return (a + b + c + d) >>> 0; -} -exports.sum32_4 = sum32_4; - -function sum32_5(a, b, c, d, e) { - return (a + b + c + d + e) >>> 0; -} -exports.sum32_5 = sum32_5; - -function sum64(buf, pos, ah, al) { - var bh = buf[pos]; - var bl = buf[pos + 1]; - - var lo = (al + bl) >>> 0; - var hi = (lo < al ? 1 : 0) + ah + bh; - buf[pos] = hi >>> 0; - buf[pos + 1] = lo; -} -exports.sum64 = sum64; - -function sum64_hi(ah, al, bh, bl) { - var lo = (al + bl) >>> 0; - var hi = (lo < al ? 1 : 0) + ah + bh; - return hi >>> 0; -} -exports.sum64_hi = sum64_hi; - -function sum64_lo(ah, al, bh, bl) { - var lo = al + bl; - return lo >>> 0; -} -exports.sum64_lo = sum64_lo; - -function sum64_4_hi(ah, al, bh, bl, ch, cl, dh, dl) { - var carry = 0; - var lo = al; - lo = (lo + bl) >>> 0; - carry += lo < al ? 1 : 0; - lo = (lo + cl) >>> 0; - carry += lo < cl ? 1 : 0; - lo = (lo + dl) >>> 0; - carry += lo < dl ? 1 : 0; - - var hi = ah + bh + ch + dh + carry; - return hi >>> 0; -} -exports.sum64_4_hi = sum64_4_hi; - -function sum64_4_lo(ah, al, bh, bl, ch, cl, dh, dl) { - var lo = al + bl + cl + dl; - return lo >>> 0; -} -exports.sum64_4_lo = sum64_4_lo; - -function sum64_5_hi(ah, al, bh, bl, ch, cl, dh, dl, eh, el) { - var carry = 0; - var lo = al; - lo = (lo + bl) >>> 0; - carry += lo < al ? 1 : 0; - lo = (lo + cl) >>> 0; - carry += lo < cl ? 1 : 0; - lo = (lo + dl) >>> 0; - carry += lo < dl ? 1 : 0; - lo = (lo + el) >>> 0; - carry += lo < el ? 1 : 0; - - var hi = ah + bh + ch + dh + eh + carry; - return hi >>> 0; -} -exports.sum64_5_hi = sum64_5_hi; - -function sum64_5_lo(ah, al, bh, bl, ch, cl, dh, dl, eh, el) { - var lo = al + bl + cl + dl + el; - - return lo >>> 0; -} -exports.sum64_5_lo = sum64_5_lo; - -function rotr64_hi(ah, al, num) { - var r = (al << (32 - num)) | (ah >>> num); - return r >>> 0; -} -exports.rotr64_hi = rotr64_hi; - -function rotr64_lo(ah, al, num) { - var r = (ah << (32 - num)) | (al >>> num); - return r >>> 0; -} -exports.rotr64_lo = rotr64_lo; - -function shr64_hi(ah, al, num) { - return ah >>> num; -} -exports.shr64_hi = shr64_hi; - -function shr64_lo(ah, al, num) { - var r = (ah << (32 - num)) | (al >>> num); - return r >>> 0; -} -exports.shr64_lo = shr64_lo; - -},{"inherits":156,"minimalistic-assert":164}],145:[function(require,module,exports){ -'use strict'; - -var hash = require('hash.js'); -var utils = require('minimalistic-crypto-utils'); -var assert = require('minimalistic-assert'); - -function HmacDRBG(options) { - if (!(this instanceof HmacDRBG)) - return new HmacDRBG(options); - this.hash = options.hash; - this.predResist = !!options.predResist; - - this.outLen = this.hash.outSize; - this.minEntropy = options.minEntropy || this.hash.hmacStrength; - - this._reseed = null; - this.reseedInterval = null; - this.K = null; - this.V = null; - - var entropy = utils.toArray(options.entropy, options.entropyEnc || 'hex'); - var nonce = utils.toArray(options.nonce, options.nonceEnc || 'hex'); - var pers = utils.toArray(options.pers, options.persEnc || 'hex'); - assert(entropy.length >= (this.minEntropy / 8), - 'Not enough entropy. Minimum is: ' + this.minEntropy + ' bits'); - this._init(entropy, nonce, pers); -} -module.exports = HmacDRBG; - -HmacDRBG.prototype._init = function init(entropy, nonce, pers) { - var seed = entropy.concat(nonce).concat(pers); - - this.K = new Array(this.outLen / 8); - this.V = new Array(this.outLen / 8); - for (var i = 0; i < this.V.length; i++) { - this.K[i] = 0x00; - this.V[i] = 0x01; - } - - this._update(seed); - this._reseed = 1; - this.reseedInterval = 0x1000000000000; // 2^48 -}; - -HmacDRBG.prototype._hmac = function hmac() { - return new hash.hmac(this.hash, this.K); -}; - -HmacDRBG.prototype._update = function update(seed) { - var kmac = this._hmac() - .update(this.V) - .update([ 0x00 ]); - if (seed) - kmac = kmac.update(seed); - this.K = kmac.digest(); - this.V = this._hmac().update(this.V).digest(); - if (!seed) - return; - - this.K = this._hmac() - .update(this.V) - .update([ 0x01 ]) - .update(seed) - .digest(); - this.V = this._hmac().update(this.V).digest(); -}; - -HmacDRBG.prototype.reseed = function reseed(entropy, entropyEnc, add, addEnc) { - // Optional entropy enc - if (typeof entropyEnc !== 'string') { - addEnc = add; - add = entropyEnc; - entropyEnc = null; - } - - entropy = utils.toArray(entropy, entropyEnc); - add = utils.toArray(add, addEnc); - - assert(entropy.length >= (this.minEntropy / 8), - 'Not enough entropy. Minimum is: ' + this.minEntropy + ' bits'); - - this._update(entropy.concat(add || [])); - this._reseed = 1; -}; - -HmacDRBG.prototype.generate = function generate(len, enc, add, addEnc) { - if (this._reseed > this.reseedInterval) - throw new Error('Reseed is required'); - - // Optional encoding - if (typeof enc !== 'string') { - addEnc = add; - add = enc; - enc = null; - } - - // Optional additional data - if (add) { - add = utils.toArray(add, addEnc || 'hex'); - this._update(add); - } - - var temp = []; - while (temp.length < len) { - this.V = this._hmac().update(this.V).digest(); - temp = temp.concat(this.V); - } - - var res = temp.slice(0, len); - this._update(add); - this._reseed++; - return utils.encode(res, enc); -}; - -},{"hash.js":133,"minimalistic-assert":164,"minimalistic-crypto-utils":165}],146:[function(require,module,exports){ -(function (Buffer){ - -/* - * - * HoundifyExpress - * Three methods used for authenticating and proxying - * voice and text queries to Houndify backend. - * - */ - -'use strict'; - -var axios = require('axios'); -var crypto = require('crypto'); -var querystring = require('querystring'); -const JSONbig = require('json-bigint'); -const createReactNativeProxy = require("./houndify-react-native-proxy"); - -module.exports = { - /** - * Given Houndify Client Id and Client Key in options objects - * returns an Express request handler for authenticating Voice Requests. - * Signs a token/message with Houndify Client Key using the HMAC scheme. - * The request for authentications will contain "token" query parameter - * that needs to be signed with secret Client Key. - * - * @param {Object} opts - Options - * @return {Function} An Express request handler - */ - createAuthenticationHandler: function(opts) { - return function(req, res) { - var clientKey = opts.clientKey.replace(/-/g, '+').replace(/_/g, '/'); - var clientKeyBin = new Buffer(clientKey, 'base64'); - var hash = crypto - .createHmac('sha256', clientKeyBin) - .update(req.query.token) - .digest('base64'); - var signature = hash.replace(/\+/g, '-').replace(/\//g, '_'); - res.send(signature); - }; - }, - - /** - * Returns a simple Express handler for proxying Text Requests. - * The handler takes query parameters and houndify headers, - * and sends them in the request to backend (GET https://api.houndify.com/v1/text). - * - * @return {Function} An Express request handler - */ - createTextProxyHandler: function(opts) { - return function(req, res) { - //houndify backend endpoint for text requests - var houndifyBackend = - (opts && opts.backend) || 'https://api.houndify.com/v1/text'; - - //copy over hound- headers - var houndifyHeaders = {}; - for (var key in req.headers) { - var splitKey = key.toLowerCase().split('-'); - if (splitKey[0] == 'hound') { - var houndHeader = splitKey - .map(function(pt) { - return pt.charAt(0).toUpperCase() + pt.slice(1); - }) - .join('-'); - houndifyHeaders[houndHeader] = req.headers[key]; - } - } - - let houndRequestInfo = houndifyHeaders['Hound-Request-Info'] || req.body; - - // Since we are sending request info in the body of post request, we don't need it in houndifyHeaders anymore. - delete houndifyHeaders["Hound-Request-Info"]; - - if (houndRequestInfo instanceof Object) { - houndRequestInfo = JSONbig.stringify(req.body); - } - - houndifyHeaders['Hound-Request-Info-Length'] = Buffer.byteLength(houndRequestInfo, "utf8"); - - axios({ - // From H 20190301 - // If we use parmas, axios will parse space as '+', - // Also if we replace '+' with '%20' in code - // In the response the transcription will show '%20' instead of space - url: houndifyBackend + '?query=' + encodeURIComponent(req.query.query), - method: "post", - headers: houndifyHeaders, - data: houndRequestInfo, - proxy: opts && opts.proxy - }) - .then(function(response) { - res.status(response.status).send(response.data); - }) - .catch(function(error) { - if (error.response) { - res.status(error.response.status).send(error.response.data); - } else { - res.status(500).send(error.toString()); - } - }); - }; - }, - - /** - * Given a clientId and clientKey, this returns a router that will proxy requests from a react-native client. - * If a user uses this function, they must: - * 1. include express-ws - * 2. add: require('express-ws')(app) to their express app - * 3. add a router, app.use('/houndify-proxy', createReactNativeProxy) - * - * @returns {Router} Express Router. - * */ - createReactNativeProxy -}; -}).call(this,require("buffer").Buffer) -},{"./houndify-react-native-proxy":148,"axios":21,"buffer":89,"crypto":98,"json-bigint":159,"querystring":207}],147:[function(require,module,exports){ -(function (process,global,Buffer){ -(function webpackUniversalModuleDefinition(root, factory) { - if(typeof exports === 'object' && typeof module === 'object') - module.exports = factory(require("json-bigint"), require("uuid"), require("pako"), require("create-hmac"), require("node-fetch"), require("ws"), require("https-proxy-agent"), require("url")); - else if(typeof define === 'function' && define.amd) - define(["json-bigint", "uuid", "pako", "create-hmac", "node-fetch", "ws", "https-proxy-agent", "url"], factory); - else if(typeof exports === 'object') - exports["Houndify"] = factory(require("json-bigint"), require("uuid"), require("pako"), require("create-hmac"), require("node-fetch"), require("ws"), require("https-proxy-agent"), require("url")); - else - root["Houndify"] = factory(root["json-bigint"], root["uuid"], root["pako"], root["create-hmac"], root["node-fetch"], root["ws"], root["https-proxy-agent"], root["url"]); -})(typeof self !== 'undefined' ? self : this, function(__WEBPACK_EXTERNAL_MODULE_2__, __WEBPACK_EXTERNAL_MODULE_5__, __WEBPACK_EXTERNAL_MODULE_9__, __WEBPACK_EXTERNAL_MODULE_13__, __WEBPACK_EXTERNAL_MODULE_16__, __WEBPACK_EXTERNAL_MODULE_21__, __WEBPACK_EXTERNAL_MODULE_22__, __WEBPACK_EXTERNAL_MODULE_23__) { -return /******/ (function(modules) { // webpackBootstrap -/******/ // The module cache -/******/ var installedModules = {}; -/******/ -/******/ // The require function -/******/ function __webpack_require__(moduleId) { -/******/ -/******/ // Check if module is in cache -/******/ if(installedModules[moduleId]) { -/******/ return installedModules[moduleId].exports; -/******/ } -/******/ // Create a new module (and put it into the cache) -/******/ var module = installedModules[moduleId] = { -/******/ i: moduleId, -/******/ l: false, -/******/ exports: {} -/******/ }; -/******/ -/******/ // Execute the module function -/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); -/******/ -/******/ // Flag the module as loaded -/******/ module.l = true; -/******/ -/******/ // Return the exports of the module -/******/ return module.exports; -/******/ } -/******/ -/******/ -/******/ // expose the modules object (__webpack_modules__) -/******/ __webpack_require__.m = modules; -/******/ -/******/ // expose the module cache -/******/ __webpack_require__.c = installedModules; -/******/ -/******/ // define getter function for harmony exports -/******/ __webpack_require__.d = function(exports, name, getter) { -/******/ if(!__webpack_require__.o(exports, name)) { -/******/ Object.defineProperty(exports, name, { -/******/ configurable: false, -/******/ enumerable: true, -/******/ get: getter -/******/ }); -/******/ } -/******/ }; -/******/ -/******/ // getDefaultExport function for compatibility with non-harmony modules -/******/ __webpack_require__.n = function(module) { -/******/ var getter = module && module.__esModule ? -/******/ function getDefault() { return module['default']; } : -/******/ function getModuleExports() { return module; }; -/******/ __webpack_require__.d(getter, 'a', getter); -/******/ return getter; -/******/ }; -/******/ -/******/ // Object.prototype.hasOwnProperty.call -/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); }; -/******/ -/******/ // __webpack_public_path__ -/******/ __webpack_require__.p = ""; -/******/ -/******/ // Load entry module and return exports -/******/ return __webpack_require__(__webpack_require__.s = 10); -/******/ }) -/************************************************************************/ -/******/ ([ -/* 0 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - - -var createHmac = __webpack_require__(13); -var JSONbig = __webpack_require__(2); -var uuid = __webpack_require__(5); -__webpack_require__(14); - -var Module = __webpack_require__(17); -var speex = __webpack_require__(8); -var config = __webpack_require__(1); - -/* - * We use the URL-encoded version of base64. The conversion is very simple: - */ -function convertBase64URL(encoded, isURL) { - if (isURL) { - encoded = encoded.replace(/-/g, "+"); - encoded = encoded.replace(/_/g, "/"); - } else { - encoded = encoded.replace(/\+/g, "-"); - encoded = encoded.replace(/\//g, "_"); - } - - return encoded; -} - -/* HMAC sign the token with the access key */ -function sign(token, accessKey) { - var clientKeyBin = new Buffer(convertBase64URL(accessKey, true), "base64"); - var hash = createHmac("sha256", clientKeyBin).update(token).digest("base64"); - return convertBase64URL(hash, false); -} - -module.exports = { - cloneObject: function cloneObject(obj) { - if (!obj) return {}; - - return JSONbig.parse(JSONbig.stringify(obj)); - }, - setDebug: function setDebug(isDebugging) { - config.debug = !!isDebugging; - }, - log: function log() { - if (config.debug) { - console.log.apply(console, arguments); - } - }, - wrapListener: function wrapListener(fn, name) { - return function () { - try { - if (fn) { - fn.apply(this, arguments); - } - } catch (e) { - console.log("Error in \'" + name + "\' handler: " + e); - if (e.stack) { - console.log(e.stack); - } - } - }; - }, - signToken: function signToken(token, houndifyRequest, callback) { - if (houndifyRequest.clientKey) { - var signed = sign(token, houndifyRequest.clientKey); - callback(null, signed); - } else if (houndifyRequest.authURL) { - this.request({ - uri: houndifyRequest.authURL, - qs: { token: token } - }, function (error, response, body) { - if (error) return callback(error, null); - - if (response.statusCode !== 200) return callback(body, null); - - callback(null, body); - }); - } else { - throw new Error("Authentication failed"); - } - }, - escapeUnicode: function escapeUnicode(string) { - return string.split("").map(function (char) { - var charCode = char.charCodeAt(0); - if (charCode > 127) { - var hex = charCode.toString(16); - var leadingZeros = new Array(5 - hex.length).join("0"); - return '\\u' + leadingZeros + hex; - } else { - return char; - } - }).join(""); - }, - request: function request(opts, callback) { - // request "lite" for browser side (add more features as needed) - - var url = (opts.proxy || opts.uri) + "?"; - for (var query_key in opts.qs) { - url += query_key + "=" + encodeURIComponent(opts.qs[query_key]); - } - - var reqOpts = { - method: opts.method || 'GET', - headers: opts.headers || {} - }; - - if (reqOpts.method !== 'GET') { - reqOpts.body = opts.body; - } - - fetch(url, reqOpts).then(function (response) { - return response.text().then(function (responseText) { - callback(null, { statusCode: response.status }, responseText); - }); - }).catch(function (error) { - callback(error, null, null); - }); - }, - decodeAudioData: function decodeAudioData(arrayBuffer, callback) { - try { - if (typeof AudioContext === 'undefined') AudioContext = webkitAudioContext; - config.audioCtx = config.audioCtx || new AudioContext(); - } catch (error) { - callback("Web Audio API is not supported by your browser."); - } - - config.audioCtx.decodeAudioData(arrayBuffer, function (audioBuffer) { - callback(null, { - audioData: audioBuffer.getChannelData(0).slice(), - sampleRate: config.audioCtx.sampleRate - }); - }, callback); - }, - decodeBase64: function decodeBase64(b64) { - return new Buffer(b64, 'base64'); - }, - decodeSpeex: function decodeSpeex(buffer) { - var inputSize = buffer.length; - - var inBuffer = new Uint8Array(Module.HEAPU8.buffer, Module._malloc(inputSize), inputSize); - for (var idx = 0; idx < inputSize; idx++) { - inBuffer[idx] = buffer[idx]; - } - - var outputPointerBuf = new Uint32Array(Module.HEAPU32.buffer, Module._malloc(Module.HEAPU32.BYTES_PER_ELEMENT), 1); - var outputSizeBuf = new Uint32Array(Module.HEAPU32.buffer, Module._malloc(Module.HEAPU32.BYTES_PER_ELEMENT), 1); - - var isWB = speex.decodeSpeex(inBuffer.byteOffset, inputSize, outputPointerBuf.byteOffset, outputSizeBuf.byteOffset); - - var outputPointer = outputPointerBuf[0]; - var outputSize = outputSizeBuf[0] / 2; // in shorts - var outBuffer = new Int16Array(Module.HEAP16.buffer, outputPointer, outputSize); - - var result = { - sampleRate: isWB ? 16000 : 8000, - audioData: outBuffer.slice() - }; - - Module._free(outputPointerBuf.byteOffset); - Module._free(outputSizeBuf.byteOffset); - Module._free(inBuffer.byteOffset); - Module._free(outBuffer.byteOffset); - - return result; - }, - generateAuthenticationHeaders: function generateAuthenticationHeaders(_ref) { - var clientId = _ref.clientId, - clientKey = _ref.clientKey, - userId = _ref.userId, - requestId = _ref.requestId, - timestamp = _ref.timestamp; - - if (!clientId || !clientKey) throw "Error: clientId and clientKey are required to generate authentication headers."; - - userId = userId || uuid.v1(); - requestId = requestId || uuid.v1(); - timestamp = timestamp || Math.floor(Date.now() / 1000); - - var requestData = userId + ';' + requestId; - var token = requestData + timestamp; - - return { - 'Hound-Request-Authentication': requestData, - 'Hound-Client-Authentication': clientId + ';' + timestamp + ';' + sign(token, clientKey) - }; - }, - isString: function isString(obj) { - try { - return typeof obj === 'string' || obj instanceof String; - } catch (e) { - return false; - } - }, - isBlob: function isBlob(obj) { - try { - return obj instanceof Blob; - } catch (e) { - return false; - } - } -}; - -/***/ }), -/* 1 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - - -module.exports = { - version: __webpack_require__(11).version, - VOICE_ENDPOINT_WS: "wss://apiws.houndify.com:443", - TEXT_ENDPOINT: "https://api.houndify.com/v1/text", - debug: false -}; - -/***/ }), -/* 2 */ -/***/ (function(module, exports) { - -module.exports = __WEBPACK_EXTERNAL_MODULE_2__; - -/***/ }), -/* 3 */ -/***/ (function(module, exports) { - -module.exports = require("path"); - -/***/ }), -/* 4 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - - -var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); - -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - -var StateEventDispatcher = function () { - function StateEventDispatcher(state) { - _classCallCheck(this, StateEventDispatcher); - - this.events = {}; - this.state = state; - } - - _createClass(StateEventDispatcher, [{ - key: "on", - value: function on(state, listener) { - if (!this.events[state]) { - this.events[state] = []; - } - - var idx = this.getListeners(state).indexOf(listener); - if (idx === -1) { - this.events[state] = this.getListeners(state); - this.events[state].push(listener); - } - - return this; - } - }, { - key: "getListeners", - value: function getListeners(state) { - return this.events[state] || []; - } - }, { - key: "off", - value: function off(state, listener) { - var idx = this.getListeners(state).indexOf(listener); - if (idx > -1) { - this.events[state].splice(idx, 1); - } - - return this; - } - }, { - key: "setState", - value: function setState(state, data) { - this.state = state; - this.fire(state, data); - } - }, { - key: "setStateSilent", - value: function setStateSilent(state) { - this.state = state; - } - }, { - key: "fire", - value: function fire(evt, data) { - var _this = this; - - var listeners = this.events[evt]; - if (listeners) { - listeners.forEach(function (listener) { - try { - listener.call(_this, data); - } catch (e) { - console.log("Error in \'" + evt + "\' handler: " + e); - if (e.stack) { - console.log(e.stack); - } - } - }); - } - } - }, { - key: "isState", - value: function isState(state) { - return this.state == state; - } - }]); - - return StateEventDispatcher; -}(); - -module.exports = StateEventDispatcher; - -/***/ }), -/* 5 */ -/***/ (function(module, exports) { - -module.exports = __WEBPACK_EXTERNAL_MODULE_5__; - -/***/ }), -/* 6 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - - -var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); - -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - -var JSONbig = __webpack_require__(2); - -var config = __webpack_require__(1); - -var Response = function () { - function Response(body) { - _classCallCheck(this, Response); - - var _json = JSONbig.parse(body); - for (var key in _json) { - this[key] = _json[key]; - } - } - - _createClass(Response, [{ - key: 'stringify', - value: function stringify(replacer, space) { - return JSONbig.stringify(this, replacer, space); - } - }, { - key: 'getConversationStates', - value: function getConversationStates() { - if (!this["AllResults"]) return []; - - return this.AllResults.map(function (result) { - var obj = {}; - - obj.CommandKind = result.CommandKind; - - if (!!result.ConversationState) { - obj.Default = result.ConversationState; - } - - for (var key in result) { - if (!!result[key].ConversationState) { - obj[key] = result[key].ConversationState; - } - } - - return obj; - }); - } - }]); - - return Response; -}(); - -module.exports = Response; - -/***/ }), -/* 7 */ -/***/ (function(module, exports) { - -module.exports = require("fs"); - -/***/ }), -/* 8 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - - -var factory = __webpack_require__(18); - -var speexInstance = null; - -var onReady = function onReady() { - return new Promise(function (resolve, reject) { - if (speexInstance) { - resolve(speexInstance); - } else { - factory().then(function (speexModule) { - var init = speexModule.cwrap('SH_speex_init', 'number', ['number', 'number', 'number', 'number', 'number']); - var _encodeFrame = speexModule.cwrap('SH_speex_encode_frame', 'number', ['number', 'number', 'number']); - var speexToRaw = speexModule.cwrap('SH_speex_speex_to_raw', 'boolean', ['number', 'number', 'number', 'number']); - - var headerSize = 80; - var headerPtrNB = speexModule._malloc(headerSize); - var headerPtrWB = speexModule._malloc(headerSize); - var headerBufferNB = new Uint8Array(speexModule.HEAPU8.buffer, headerPtrNB, headerSize); - var headerBufferWB = new Uint8Array(speexModule.HEAPU8.buffer, headerPtrWB, headerSize); - - var FRAMESIZE_NB = 160; - var framePtrNB = speexModule._malloc(FRAMESIZE_NB * 2); - var frameBufferNB = new Int16Array(speexModule.HEAP16.buffer, framePtrNB, FRAMESIZE_NB); - - var FRAMESIZE_WB = 320; - var framePtrWB = speexModule._malloc(FRAMESIZE_WB * 2); - var frameBufferWB = new Int16Array(speexModule.HEAP16.buffer, framePtrWB, FRAMESIZE_WB); - - var OUTBUFSIZE = 202; // Each Speex frame is a maximum of 200 bytes + 2 bytes for the size prefix - var outBytesPtr = speexModule._malloc(OUTBUFSIZE); - var outBytesBuffer = new Uint8Array(speexModule.HEAPU8.buffer, outBytesBuffer, OUTBUFSIZE); - - var speexSize = 40; - var speexPtrNB = speexModule._malloc(speexSize); - var speexPtrWB = speexModule._malloc(speexSize); - - init(10, headerPtrNB, headerSize, 1, speexPtrNB); - init(10, headerPtrWB, headerSize, 0, speexPtrWB); - - speexInstance = { - encodeFrame: function encodeFrame(framePtr, outBytesPtr, isNB) { - return _encodeFrame(framePtr, outBytesPtr, isNB ? speexPtrNB : speexPtrWB); - }, - decodeSpeex: function decodeSpeex(inputBufferPtr, inputSize, outputBufferPtr, outputSizePtr) { - return speexToRaw(inputBufferPtr, inputSize, outputBufferPtr, outputSizePtr); - }, - headerNB: headerBufferNB, - headerWB: headerBufferWB, - frameSizeNB: FRAMESIZE_NB, - frameSizeWB: FRAMESIZE_WB, - frameBufferNB: frameBufferNB, - frameBufferWB: frameBufferWB, - outBytesBuffer: outBytesBuffer - }; - - resolve(speexInstance); - }).catch(function (error) { - return reject(error); - }); - } - }); -}; - -module.exports = { - onReady: onReady -}; - -/***/ }), -/* 9 */ -/***/ (function(module, exports) { - -module.exports = __WEBPACK_EXTERNAL_MODULE_9__; - -/***/ }), -/* 10 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - - -var config = __webpack_require__(1); - -module.exports = { - - version: config.version, - - TextRequest: __webpack_require__(12), - - VoiceRequest: __webpack_require__(19), - - AudioRecorder: __webpack_require__(26), - - decodeAudioData: __webpack_require__(0).decodeAudioData, - - decodeSpeex: __webpack_require__(0).decodeSpeex, - - decodeBase64: __webpack_require__(0).decodeBase64, - - generateAuthenticationHeaders: __webpack_require__(0).generateAuthenticationHeaders, - - setDebug: __webpack_require__(0).setDebug - -}; - -/***/ }), -/* 11 */ -/***/ (function(module, exports) { - -module.exports = {"name":"houndify","version":"3.1.13","description":"The Houndify JavaScript SDK allows you to make voice and text queries to the Houndify API from your browser or Node.js script.","main":"index.js","scripts":{"build":"grunt build","test":"jest --runInBand; rm -rf example","test:build":"node pullExamples","posttest:build":"grunt distTest"},"devDependencies":{"babel-core":"^6.26.0","babel-loader":"^7.1.2","babel-preset-env":"^1.6.1","exports-loader":"^0.6.4","fs-extra":"^4.0.2","grunt":"^1.3.0","grunt-contrib-clean":"^1.0.0","grunt-contrib-copy":"^1.0.0","grunt-contrib-watch":"^1.0.0","grunt-shell":"^1.3.1","grunt-webpack":"^3.0.2","jest":"^28.1.3","node-libs-browser":"^2.1.0","selenium-webdriver":"^3.6.0","uglifyjs-webpack-plugin":"^1.2.4","webpack":"^3.11.0","webpack-dev-server":"^2.11.5"},"license":"MIT","dependencies":{"axios":"^0.21.4","create-hmac":"^1.1.6","cross-fetch":"^3.1.5","express":"^4.17.0","express-ws":"^5.0.2","https-proxy-agent":"^2.2.4","json-bigint":"^1.0.0","pako":"^1.0.5","uuid":"^3.1.0","wav":"^1.0.2","ws":"^7.5.7"},"author":{"name":"Asif Amirguliyev "}} - -/***/ }), -/* 12 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - - -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - -var uuid = __webpack_require__(5); -var JSONbig = __webpack_require__(2); - -var Response = __webpack_require__(6); -var utils = __webpack_require__(0); -var request = utils.request; -var config = __webpack_require__(1); - -var TextRequest = function TextRequest(opts) { - _classCallCheck(this, TextRequest); - - if (opts["clientId"]) { - this.clientId = opts["clientId"]; - } else { - throw new Error("TextRequest requires Houndify Client ID 'clientId'."); - } - - if (opts["clientKey"]) { - this.clientKey = opts["clientKey"]; - } else if (opts["authURL"]) { - this.authURL = opts["authURL"]; - } else { - throw new Error("TextRequest requires either 'clientKey' or 'authURL' for authentication."); - } - - if (opts["query"]) { - this.query = opts["query"]; - } else { - throw new Error("TextRequest requires 'query'."); - } - - this.onResponse = utils.wrapListener(opts["onResponse"], "onResponse"); - this.onError = utils.wrapListener(opts["onError"], "onError"); - - this.requestInfo = utils.cloneObject(opts["requestInfo"]); - this.conversationState = opts["conversationState"]; - - this.proxy = utils.cloneObject(opts["proxy"] || {}); - this.endpoint = opts["endpoint"] || config.TEXT_ENDPOINT; - this.method = opts["method"] || "GET"; - - _runQuery.apply(this); -}; - -function _runQuery() { - var _this = this; - - //Set SDK fields - this.requestInfo["ClientID"] = this.clientId; - this.requestInfo["SDK"] = "web"; - this.requestInfo["SDKVersion"] = config.version; - - //Set Conversation State - if (this.conversationState) { - this.requestInfo["ConversationState"] = this.conversationState; - this.requestInfo["ConversationStateTime"] = this.conversationState.ConversationStateTime; - } - - //Create Search Info object - var searchInfo = { - type: "text", - startTime: new Date(), - endTime: -1, - requestInfo: this.requestInfo, - getTotalDuration: function getTotalDuration() { - return this["endTime"] - this["startTime"]; - } - }; - - //onError wrapper - var _onError = function _onError(errorObj) { - searchInfo["error"] = errorObj; - searchInfo["endTime"] = new Date(); - _this.onError(errorObj, searchInfo); - }; - - var requestInfoString = JSONbig.stringify(this.requestInfo); - var requestInfoHeader = utils.escapeUnicode(requestInfoString); - - var endpoint = this.endpoint; - var method = this.method; - var headers = {}; - var proxyHeaderExclusiveList = []; - - if (this.proxy && this.proxy.url) { - method = this.proxy.method || method; - if (this.proxy.headers) { - for (var headerName in this.proxy.headers) { - proxyHeaderExclusiveList.push(headerName); - headers[headerName] = this.proxy.headers[headerName]; - } - } - - if (this.proxy.url.indexOf('http') !== 0 && window) { - if (!window.location.origin) { - window.location.origin = window.location.protocol + "//" + window.location.hostname; - if (window.location.port) window.location.origin += ':' + window.location.port; - } - this.proxy.url = window.location.origin + this.proxy.url; - } - } - - headers["Content-Type"] = "text/plain"; - - if (method === 'GET') headers["Hound-Request-Info"] = requestInfoHeader; - - if (method === "POST") { - headers['Hound-Request-Info-Length'] = Buffer.byteLength(requestInfoHeader, "utf8"); - } - - if (this.requestInfo["InputLanguageEnglishName"]) headers["Hound-Input-Language-English-Name"] = this.requestInfo["InputLanguageEnglishName"]; - if (this.requestInfo["InputLanguageIETFTag"]) headers["Hound-Input-Language-IETF-Tag"] = this.requestInfo["InputLanguageIETFTag"]; - - utils.log("Generating authentication headers..."); - generateAuthHeaders(this, function (err, authHeaders) { - if (err) { - return _onError({ type: "AUTHENTICATION", exception: err }); - } - - headers["Hound-Request-Authentication"] = authHeaders["Hound-Request-Authentication"]; - headers["Hound-Client-Authentication"] = authHeaders["Hound-Client-Authentication"]; - - var opts = { - method: method, - uri: endpoint, - qs: { query: _this.query }, - headers: headers, - body: requestInfoHeader - }; - - if (_this.proxy && _this.proxy.url) { - opts.proxy = _this.proxy.url; - opts.proxyHeaderExclusiveList = proxyHeaderExclusiveList; - } - - utils.log("Sending request with this opts object:", opts); - request(opts, function (error, response, body) { - utils.log("Request came back with following objects:"); - utils.log("error: ", error); - utils.log("response: ", response); - if (error) { - return _onError({ type: "CONNECTION", exception: error }); - } - - if (response.statusCode === 403) { - return _onError({ type: "AUTHENTICATION", exception: body }); - } - - if (response.statusCode === 400) { - return _onError({ type: "BAD_REQUEST", exception: body }); - } - - var parsedResponse = null; - try { - parsedResponse = new Response(body); - utils.log("parsedResponse: ", parsedResponse); - } catch (e) { - utils.log("body: ", body); - return _onError({ type: "PROXY", exception: body }); - } - - if ("Format" in parsedResponse && parsedResponse["Status"] !== "Error") { - searchInfo["endTime"] = new Date(); - searchInfo["contentBody"] = body; - - _this.onResponse(parsedResponse, searchInfo); - } else { - return _onError({ type: "SERVER", exception: parsedResponse }); - } - }); - }); -} - -function generateAuthHeaders(textRequest, callback) { - var clientId = textRequest.clientId; - var userId = textRequest.requestInfo["UserID"] || uuid.v1(); - var requestId = textRequest.requestInfo["RequestID"] || uuid.v1(); - var timeStamp = textRequest.requestInfo["TimeStamp"] || Math.floor(Date.now() / 1000); - - var requestData = userId + ';' + requestId; - var token = requestData + timeStamp; - var headers = { - 'Hound-Request-Authentication': requestData - }; - utils.log("Signing authentication token..."); - utils.log("token: ", token); - utils.log("textRequest: ", textRequest); - utils.signToken(token, textRequest, function (err, encodedData) { - utils.log("Token signed and returned with these objects:"); - utils.log("err: ", err); - utils.log("encodedData: ", encodedData); - headers['Hound-Client-Authentication'] = clientId + ';' + timeStamp + ';' + encodedData; - utils.log("Authentication headers: ", headers); - callback(err, headers); - }); -}; - -module.exports = TextRequest; - -/***/ }), -/* 13 */ -/***/ (function(module, exports) { - -module.exports = __WEBPACK_EXTERNAL_MODULE_13__; - -/***/ }), -/* 14 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - - -var fetchNode = __webpack_require__(15); -var fetch = fetchNode.fetch.bind({}); - -fetch.polyfill = true; - -if (!global.fetch) { - global.fetch = fetch; - global.Response = fetchNode.Response; - global.Headers = fetchNode.Headers; - global.Request = fetchNode.Request; -} - -/***/ }), -/* 15 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - - -var nodeFetch = __webpack_require__(16); -var realFetch = nodeFetch.default || nodeFetch; - -var fetch = function fetch(url, options) { - // Support schemaless URIs on the server for parity with the browser. - // Ex: //github.com/ -> https://github.com/ - if (/^\/\//.test(url)) { - url = 'https:' + url; - } - return realFetch.call(this, url, options); -}; - -fetch.ponyfill = true; - -module.exports = exports = fetch; -exports.fetch = fetch; -exports.Headers = nodeFetch.Headers; -exports.Request = nodeFetch.Request; -exports.Response = nodeFetch.Response; - -// Needed for TypeScript consumers without esModuleInterop. -exports.default = fetch; - -/***/ }), -/* 16 */ -/***/ (function(module, exports) { - -module.exports = __WEBPACK_EXTERNAL_MODULE_16__; - -/***/ }), -/* 17 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; -/* WEBPACK VAR INJECTION */(function(__filename, __dirname) { - -var Module = function () { - var _scriptDir = typeof document !== 'undefined' && document.currentScript ? document.currentScript.src : undefined; - if (true) _scriptDir = _scriptDir || __filename; - return function (Module) { - Module = Module || {}; - - var Module = typeof Module !== "undefined" ? Module : {};var readyPromiseResolve, readyPromiseReject;Module["ready"] = new Promise(function (resolve, reject) { - readyPromiseResolve = resolve;readyPromiseReject = reject; - });var moduleOverrides = {};var key;for (key in Module) { - if (Module.hasOwnProperty(key)) { - moduleOverrides[key] = Module[key]; - } - }var arguments_ = [];var thisProgram = "./this.program";var quit_ = function quit_(status, toThrow) { - throw toThrow; - };var ENVIRONMENT_IS_WEB = false;var ENVIRONMENT_IS_WORKER = false;var ENVIRONMENT_IS_NODE = false;var ENVIRONMENT_IS_SHELL = false;ENVIRONMENT_IS_WEB = typeof window === "object";ENVIRONMENT_IS_WORKER = typeof importScripts === "function";ENVIRONMENT_IS_NODE = typeof process === "object" && typeof process.versions === "object" && typeof process.versions.node === "string";ENVIRONMENT_IS_SHELL = !ENVIRONMENT_IS_WEB && !ENVIRONMENT_IS_NODE && !ENVIRONMENT_IS_WORKER;var scriptDirectory = "";function locateFile(path) { - if (Module["locateFile"]) { - return Module["locateFile"](path, scriptDirectory); - }return scriptDirectory + path; - }var read_, readAsync, readBinary, setWindowTitle;var nodeFS;var nodePath;if (ENVIRONMENT_IS_NODE) { - if (ENVIRONMENT_IS_WORKER) { - scriptDirectory = __webpack_require__(3).dirname(scriptDirectory) + "/"; - } else { - scriptDirectory = __dirname + "/"; - }read_ = function shell_read(filename, binary) { - var ret = tryParseAsDataURI(filename);if (ret) { - return binary ? ret : ret.toString(); - }if (!nodeFS) nodeFS = __webpack_require__(7);if (!nodePath) nodePath = __webpack_require__(3);filename = nodePath["normalize"](filename);return nodeFS["readFileSync"](filename, binary ? null : "utf8"); - };readBinary = function readBinary(filename) { - var ret = read_(filename, true);if (!ret.buffer) { - ret = new Uint8Array(ret); - }assert(ret.buffer);return ret; - };if (process["argv"].length > 1) { - thisProgram = process["argv"][1].replace(/\\/g, "/"); - }arguments_ = process["argv"].slice(2);process["on"]("uncaughtException", function (ex) { - if (!(ex instanceof ExitStatus)) { - throw ex; - } - });process["on"]("unhandledRejection", abort);quit_ = function quit_(status) { - process["exit"](status); - };Module["inspect"] = function () { - return "[Emscripten Module object]"; - }; - } else if (ENVIRONMENT_IS_SHELL) { - if (typeof read != "undefined") { - read_ = function shell_read(f) { - var data = tryParseAsDataURI(f);if (data) { - return intArrayToString(data); - }return read(f); - }; - }readBinary = function readBinary(f) { - var data;data = tryParseAsDataURI(f);if (data) { - return data; - }if (typeof readbuffer === "function") { - return new Uint8Array(readbuffer(f)); - }data = read(f, "binary");assert(typeof data === "object");return data; - };if (typeof scriptArgs != "undefined") { - arguments_ = scriptArgs; - } else if (typeof arguments != "undefined") { - arguments_ = arguments; - }if (typeof quit === "function") { - quit_ = function quit_(status) { - quit(status); - }; - }if (typeof print !== "undefined") { - if (typeof console === "undefined") console = {};console.log = print;console.warn = console.error = typeof printErr !== "undefined" ? printErr : print; - } - } else if (ENVIRONMENT_IS_WEB || ENVIRONMENT_IS_WORKER) { - if (ENVIRONMENT_IS_WORKER) { - scriptDirectory = self.location.href; - } else if (document.currentScript) { - scriptDirectory = document.currentScript.src; - }if (_scriptDir) { - scriptDirectory = _scriptDir; - }if (scriptDirectory.indexOf("blob:") !== 0) { - scriptDirectory = scriptDirectory.substr(0, scriptDirectory.lastIndexOf("/") + 1); - } else { - scriptDirectory = ""; - }{ - read_ = function shell_read(url) { - try { - var xhr = new XMLHttpRequest();xhr.open("GET", url, false);xhr.send(null);return xhr.responseText; - } catch (err) { - var data = tryParseAsDataURI(url);if (data) { - return intArrayToString(data); - }throw err; - } - };if (ENVIRONMENT_IS_WORKER) { - readBinary = function readBinary(url) { - try { - var xhr = new XMLHttpRequest();xhr.open("GET", url, false);xhr.responseType = "arraybuffer";xhr.send(null);return new Uint8Array(xhr.response); - } catch (err) { - var data = tryParseAsDataURI(url);if (data) { - return data; - }throw err; - } - }; - }readAsync = function readAsync(url, onload, onerror) { - var xhr = new XMLHttpRequest();xhr.open("GET", url, true);xhr.responseType = "arraybuffer";xhr.onload = function xhr_onload() { - if (xhr.status == 200 || xhr.status == 0 && xhr.response) { - onload(xhr.response);return; - }var data = tryParseAsDataURI(url);if (data) { - onload(data.buffer);return; - }onerror(); - };xhr.onerror = onerror;xhr.send(null); - }; - }setWindowTitle = function setWindowTitle(title) { - document.title = title; - }; - } else {}var out = Module["print"] || console.log.bind(console);var err = Module["printErr"] || console.warn.bind(console);for (key in moduleOverrides) { - if (moduleOverrides.hasOwnProperty(key)) { - Module[key] = moduleOverrides[key]; - } - }moduleOverrides = null;if (Module["arguments"]) arguments_ = Module["arguments"];if (Module["thisProgram"]) thisProgram = Module["thisProgram"];if (Module["quit"]) quit_ = Module["quit"];var wasmBinary;if (Module["wasmBinary"]) wasmBinary = Module["wasmBinary"];var noExitRuntime;if (Module["noExitRuntime"]) noExitRuntime = Module["noExitRuntime"];var WebAssembly = { Memory: function Memory(opts) { - this.buffer = new ArrayBuffer(opts["initial"] * 65536); - }, Module: function Module(binary) {}, Instance: function Instance(module, info) { - this.exports = - // EMSCRIPTEN_START_ASM - function instantiate(rc, sc) { - function jc(tc) { - tc.set = function (M, uc) { - this[M] = uc; - };tc.get = function (M) { - return this[M]; - };return tc; - }var a = new ArrayBuffer(16);var b = new Int32Array(a);var c = new Float32Array(a);var d = new Float64Array(a);function kc(vc) { - return b[vc]; - }function lc(vc, wc) { - b[vc] = wc; - }function mc() { - return d[0]; - }function nc(wc) { - d[0] = wc; - }function oc(xc, yc) { - var e = yc.a;var f = e.buffer;var g = new xc.Int8Array(f);var h = new xc.Int16Array(f);var i = new xc.Int32Array(f);var j = new xc.Uint8Array(f);var k = new xc.Uint16Array(f);var l = new xc.Uint32Array(f);var m = new xc.Float32Array(f);var n = new xc.Float64Array(f);var o = xc.Math.imul;var p = xc.Math.fround;var q = xc.Math.abs;var r = xc.Math.clz32;var s = xc.Math.min;var t = xc.Math.max;var u = xc.Math.floor;var v = xc.Math.ceil;var w = xc.Math.sqrt;var x = yc.abort;var y = xc.NaN;var z = xc.Infinity;var A = yc.b;var B = yc.c;var C = yc.d;var D = yc.e;var E = yc.f;var F = yc.g;var G = yc.h;var H = 5259648;var I = 0; - // EMSCRIPTEN_START_FUNCS - function Bb(a, b, c) { - a = a | 0;b = b | 0;c = c | 0;var d = 0, - e = 0, - f = 0, - g = 0, - j = 0, - l = 0, - n = p(0), - r = p(0), - v = 0, - w = 0, - y = p(0), - z = 0, - A = 0, - B = 0, - C = p(0), - D = 0, - E = 0, - F = 0, - G = 0, - I = 0, - K = 0, - L = 0, - M = 0, - N = 0, - O = 0, - P = 0, - Q = 0, - R = 0, - S = 0, - T = 0, - V = 0, - Y = p(0), - $ = 0, - ba = 0, - ea = 0, - ia = 0, - ja = 0, - ka = 0, - ma = 0, - na = 0, - oa = 0, - ra = 0, - ua = 0, - wa = 0, - xa = 0, - ya = p(0);z = H - 48 | 0;H = z;D = i[a + 64 >> 2];F = i[a + 24 >> 2];l = i[a + 72 >> 2];qa(l, l + (i[a + 8 >> 2] << 1) | 0, (i[a + 32 >> 2] << 1) + 4 | 0);l = i[a + 80 >> 2];qa(l, l + (i[a + 8 >> 2] << 1) | 0, (i[a + 32 >> 2] << 1) + 4 | 0);K = D & 1;w = K + D | 0;d = F << 1;l = w + d | 0;N = l & 1;L = l + N | 0;l = d + L | 0;R = l & 1;G = l + R | 0;l = d + G | 0;S = l & 1;O = l + S | 0;l = d + O | 0;ka = l & 1;ma = l + ka | 0;l = d + ma | 0;na = l & 1;T = l + na | 0;l = d + T | 0;ea = l & 1;ra = l + ea | 0;l = d + ra | 0;ua = l & 1;V = l + ua | 0;l = d + V | 0;wa = l & 1;M = l + wa | 0;l = d + M | 0;if (i[a + 220 >> 2]) { - sa(b, b, i[a + 8 >> 2], (i[a + 216 >> 2] != 0) << 1, a + 124 | 0); - }I = l & 1;A = I + l | 0;B = i[a + 20 >> 2];l = A + (B << 1) | 0;xa = l & 1;P = l + xa | 0;ia = i[a + 24 >> 2];j = ia << 1;v = i[a + 8 >> 2];if ((B | 0) > (v | 0)) { - l = B - v | 0;f = (l | 0) > 1 ? l : 1;d = i[a + 88 >> 2];l = i[a + 68 >> 2];while (1) { - e = g << 1;h[e + A >> 1] = o(h[d + e >> 1], h[e + l >> 1]) >>> 14;g = g + 1 | 0;if ((g | 0) != (f | 0)) { - continue; - }break; - } - }if ((f | 0) < (B | 0)) { - e = v - B | 0;d = i[a + 88 >> 2];while (1) { - l = f << 1;h[l + A >> 1] = o(h[d + l >> 1], h[(e + f << 1) + b >> 1]) >>> 14;f = f + 1 | 0;if ((B | 0) != (f | 0)) { - continue; - }break; - } - }Q = (j + P | 0) + 2 | 0;f = 1;Da(A, P, ia + 1 | 0, B);l = h[P >> 1];l = (o(l, h[a + 60 >> 1]) >>> 15 | 0) + l | 0;h[P >> 1] = l;j = i[a + 24 >> 2];a: { - if ((j | 0) < 0) { - break a; - }e = i[a + 92 >> 2];h[P >> 1] = o(h[e >> 1], l << 16 >> 16) >>> 14;if (!j) { - break a; - }while (1) { - d = f << 1;l = d + P | 0;h[l >> 1] = o(h[d + e >> 1], h[l >> 1]) >>> 14;l = (f | 0) != (j | 0);f = f + 1 | 0;if (l) { - continue; - }break; - } - }Ea(w, P, j);l = ta(w, i[a + 24 >> 2], O, 6553, Q);g = i[a + 24 >> 2];if (!((l | 0) == (g | 0) | (g | 0) < 1)) { - d = i[a + 96 >> 2];f = 0;while (1) { - l = f << 1;h[l + O >> 1] = k[d + l >> 1];f = f + 1 | 0;if ((g | 0) != (f | 0)) { - continue; - }break; - } - }e = i[a + 8 >> 2];d = i[a + 20 >> 2];b: { - if (i[a + 4 >> 2]) { - if ((g | 0) < 1) { - break b; - }f = 0;while (1) { - l = f << 1;h[l + T >> 1] = k[l + O >> 1];f = f + 1 | 0;if ((g | 0) != (f | 0)) { - continue; - }break; - }break b; - }l = i[a + 16 >> 2];fa(i[a + 96 >> 2], O, T, g, l, l << 1);g = i[a + 24 >> 2]; - }w = d - e | 0;ga(T, g, 16);ha(T, V, i[a + 24 >> 2], Q);c: { - d: { - l = i[i[a + 204 >> 2] + (i[a + 208 >> 2] << 2) >> 2];if (!l | (i[l + 8 >> 2] < 3 ? i[a + 188 >> 2] >= 3 : 0) | (i[l + 4 >> 2] | i[l >> 2] != -1)) { - break d; - }if (i[a + 152 >> 2] | i[a + 160 >> 2]) { - break d; - }g = w << 1;l = 0;break c; - }ca(h[a + 56 >> 1], V, L, i[a + 24 >> 2]);ca(h[a + 58 >> 1], V, G, i[a + 24 >> 2]);g = w << 1;X(i[a + 84 >> 2], i[a + 68 >> 2], g);X(i[a + 84 >> 2] + g | 0, b, i[a + 8 >> 2] - w << 1);l = i[a + 84 >> 2];aa(l, L, G, l, i[a + 8 >> 2], i[a + 24 >> 2], i[a + 112 >> 2]);Ia(i[a + 84 >> 2], i[a + 28 >> 2], i[a + 32 >> 2], i[a + 8 >> 2], z + 16 | 0, z + 4 | 0, 6, Q);l = i[z + 16 >> 2];ba = h[z + 4 >> 1];v = o(ba, 27853) >> 15;e: { - if ((v | 0) >= h[z + 6 >> 1]) { - break e; - }d = i[z + 20 >> 2];e = (d << 1) - l | 0;j = e >> 31;f: { - if ((j ^ e + j) < 3) { - break f; - }e = o(d, 3) - l | 0;j = e >> 31;if ((j ^ e + j) < 4) { - break f; - }e = (d << 2) - l | 0;j = e >> 31;if ((j ^ e + j) < 5) { - break f; - }e = o(d, 5) - l | 0;j = e >> 31;if ((j ^ e + j) > 5) { - break e; - } - }l = d; - }g: { - if ((v | 0) >= h[z + 8 >> 1]) { - break g; - }d = i[z + 24 >> 2];e = (d << 1) - l | 0;j = e >> 31;h: { - if ((j ^ e + j) < 3) { - break h; - }e = o(d, 3) - l | 0;j = e >> 31;if ((j ^ e + j) < 4) { - break h; - }e = (d << 2) - l | 0;j = e >> 31;if ((j ^ e + j) < 5) { - break h; - }e = o(d, 5) - l | 0;j = e >> 31;if ((j ^ e + j) > 5) { - break g; - } - }l = d; - }i: { - if ((v | 0) >= h[z + 10 >> 1]) { - break i; - }d = i[z + 28 >> 2];e = (d << 1) - l | 0;j = e >> 31;j: { - if ((j ^ e + j) < 3) { - break j; - }e = o(d, 3) - l | 0;j = e >> 31;if ((j ^ e + j) < 4) { - break j; - }e = (d << 2) - l | 0;j = e >> 31;if ((j ^ e + j) < 5) { - break j; - }e = o(d, 5) - l | 0;j = e >> 31;if ((j ^ e + j) > 5) { - break i; - } - }l = d; - }k: { - if ((v | 0) >= h[z + 12 >> 1]) { - break k; - }d = i[z + 32 >> 2];e = (d << 1) - l | 0;j = e >> 31;l: { - if ((j ^ e + j) < 3) { - break l; - }e = o(d, 3) - l | 0;j = e >> 31;if ((j ^ e + j) < 4) { - break l; - }e = (d << 2) - l | 0;j = e >> 31;if ((j ^ e + j) < 5) { - break l; - }e = o(d, 5) - l | 0;j = e >> 31;if ((j ^ e + j) > 5) { - break k; - } - }l = d; - }if ((v | 0) >= h[z + 14 >> 1]) { - break c; - }d = i[z + 36 >> 2];e = (d << 1) - l | 0;j = e >> 31;m: { - if ((j ^ e + j) < 3) { - break m; - }e = o(d, 3) - l | 0;j = e >> 31;if ((j ^ e + j) < 4) { - break m; - }e = (d << 2) - l | 0;j = e >> 31;if ((j ^ e + j) < 5) { - break m; - }e = o(d, 5) - l | 0;j = e >> 31;if ((j ^ e + j) > 5) { - break c; - } - }l = d; - }X(i[a + 76 >> 2], i[a + 68 >> 2], g);X(i[a + 76 >> 2] + (w << 1) | 0, b, i[a + 8 >> 2] - w << 1);d = i[a + 76 >> 2];va(d, V, d, i[a + 8 >> 2], i[a + 24 >> 2], i[a + 116 >> 2]);v = Z(i[a + 76 >> 2], i[a + 8 >> 2]);n: { - if (!(i[a + 208 >> 2] == 1 | (l | 0) < 1)) { - w = o(o(ba, ba) << 17 >> 16, -26214) + 268435456 | 0;e = w >>> 0 > 65535;d = e << 3;j = e ? w >>> 16 | 0 : w;e = j >>> 0 > 255;d = e ? d | 4 : d;f = d | 2;g = d;e = e ? j >>> 8 | 0 : j;d = e >>> 0 > 15;g = (d ? f : g) | (d ? e >>> 4 | 0 : e) >>> 0 > 3;d = g << 1;j = g << 16 >> 16;d = ((j | 0) > 6 ? w >> d + -12 : w << 12 - d) << 16 >> 16;e = (o((o(o(d, 16816) + -827523072 >> 16, d) << 2 & -65536) + 1387593728 >> 16, d) << 2 & -65536) + 238157824 >> 16;d = 13 - g | 0;e = o(v, o(((j | 0) < 13 ? e >> d : e << 0 - d) << 16 >> 16, 72088) >> 16);break n; - }e = v << 14; - }o: { - p: { - q: { - r: { - s: { - v = i[a + 140 >> 2];if (!(!v | (i[a + 160 >> 2] ? 0 : !i[a + 152 >> 2]))) { - g = i[a + 24 >> 2];if ((g | 0) >= 1) { - j = i[a + 96 >> 2];f = 0;while (1) { - d = f << 1;d = h[d + j >> 1] - h[d + O >> 1] | 0;C = p(C + p(o(d, d) | 0));f = f + 1 | 0;if ((g | 0) != (f | 0)) { - continue; - }break; - } - }if (i[a + 172 >> 2]) { - n = m[a + 176 >> 2];t: { - if (p(m[a + 180 >> 2] * n) > p(0) ^ 1) { - break t; - }r = p(+n * -1e-5 / +p(m[a + 184 >> 2] + p(1)));r = +r > .05 ? p(.05000000074505806) : r;if (+r < -.05 ^ 1) { - break t; - }r = p(-.05000000074505806); - }m[a + 144 >> 2] = t(p(s(p(r + m[a + 144 >> 2]), p(10))), p(0)); - }ya = p(C * p(1.4901161193847656e-8));y = Kb(v, b, i[a + 8 >> 2], p(+(ba | 0) * .015625));m[a + 148 >> 2] = y;if (i[a + 152 >> 2]) { - i[z + 16 >> 2] = 8;n = m[a + 144 >> 2];r = p(u(n));u: { - if (p(q(r)) < p(2147483648)) { - d = ~~r;break u; - }d = -2147483648; - }if ((d | 0) != 10) { - g = 0;Y = p(n - p(d | 0));w = d + 1 | 0;v = w << 2;C = p(p(w | 0) - n);j = d << 2;n = p(p(Y * m[v + 5440 >> 2]) + p(C * m[j + 5440 >> 2]));r = p(100);v: { - if (!(y > n)) { - break v; - }n = p(y - n);r = p(100);if (n < p(100) ^ 1) { - break v; - }g = 8;r = n; - }n = p(p(Y * m[v + 5396 >> 2]) + p(C * m[j + 5396 >> 2]));w: { - if (!(y > n)) { - break w; - }n = p(y - n);if (n < r ^ 1) { - break w; - }g = 7;r = n; - }v = w << 2;j = d << 2;n = p(p(Y * m[v + 5352 >> 2]) + p(C * m[j + 5352 >> 2]));x: { - if (y > n ^ 1) { - break x; - }n = p(y - n);if (n < r ^ 1) { - break x; - }g = 6;r = n; - }n = p(p(Y * m[v + 5308 >> 2]) + p(C * m[j + 5308 >> 2]));y: { - if (y > n ^ 1) { - break y; - }n = p(y - n);if (n < r ^ 1) { - break y; - }g = 5;r = n; - }v = w << 2;j = d << 2;n = p(p(Y * m[v + 5264 >> 2]) + p(C * m[j + 5264 >> 2]));z: { - if (y > n ^ 1) { - break z; - }n = p(y - n);if (n < r ^ 1) { - break z; - }g = 4;r = n; - }n = p(p(Y * m[v + 5220 >> 2]) + p(C * m[j + 5220 >> 2]));A: { - if (y > n ^ 1) { - break A; - }n = p(y - n);if (n < r ^ 1) { - break A; - }g = 3;r = n; - }j = w << 2;d = d << 2;n = p(p(Y * m[j + 5176 >> 2]) + p(C * m[d + 5176 >> 2]));B: { - if (y > n ^ 1) { - break B; - }n = p(y - n);if (n < r ^ 1) { - break B; - }g = 2;r = n; - }C = p(p(Y * m[j + 5132 >> 2]) + p(C * m[d + 5132 >> 2]));if (y > C ^ 1) { - break r; - }break s; - }g = 0;n = m[1370];r = p(100);C: { - if (y > n ^ 1) { - break C; - }n = p(y - n);r = p(100);if (n < p(100) ^ 1) { - break C; - }g = 8;r = n; - }n = m[1359];D: { - if (!(y > n)) { - break D; - }n = p(y - n);if (n < r ^ 1) { - break D; - }g = 7;r = n; - }n = m[1348];E: { - if (y > n ^ 1) { - break E; - }n = p(y - n);if (n < r ^ 1) { - break E; - }g = 6;r = n; - }n = m[1337];F: { - if (y > n ^ 1) { - break F; - }n = p(y - n);if (n < r ^ 1) { - break F; - }g = 5;r = n; - }n = m[1326];G: { - if (y > n ^ 1) { - break G; - }n = p(y - n);if (n < r ^ 1) { - break G; - }g = 4;r = n; - }n = m[1315];H: { - if (y > n ^ 1) { - break H; - }n = p(y - n);if (n < r ^ 1) { - break H; - }g = 3;r = n; - }n = m[1304];I: { - if (y > n ^ 1) { - break I; - }n = p(y - n);if (n < r ^ 1) { - break I; - }g = 2;r = n; - }C = m[1293];if (!(y > C ^ 1)) { - break s; - }break r; - }if (!(y < p(2) ^ 1)) { - J: { - K: { - if (+ya > .05) { - break K; - }d = i[a + 168 >> 2];if (!d | (d | 0) > 20) { - break K; - }if (i[a + 164 >> 2]) { - break J; - } - }i[a + 168 >> 2] = 1;i[a + 208 >> 2] = 1;break o; - }i[a + 168 >> 2] = d + 1;i[a + 208 >> 2] = 0;break o; - }i[a + 168 >> 2] = 0;i[a + 208 >> 2] = i[a + 212 >> 2];break o; - }i[a + 148 >> 2] = -1082130432;break o; - }if (!(p(y - C) < r)) { - break r; - }i[z + 16 >> 2] = 1;f = a + 168 | 0;break q; - }i[z + 16 >> 2] = g;f = a + 168 | 0;if (g) { - break q; - }L: { - M: { - if (+ya > .05) { - break M; - }d = i[a + 168 >> 2];if (!d | (d | 0) > 20) { - break M; - }if (i[a + 164 >> 2]) { - break L; - } - }i[z + 16 >> 2] = 1;i[a + 168 >> 2] = 1;break p; - }i[z + 16 >> 2] = 0;i[a + 168 >> 2] = d + 1;break p; - }i[f >> 2] = 0; - }J[i[i[a >> 2] + 44 >> 2]](a, 6, z + 16 | 0) | 0;N: { - if (i[a + 156 >> 2] < 1) { - break N; - }J[i[i[a >> 2] + 44 >> 2]](a, 19, z + 4 | 0) | 0;d = i[a + 156 >> 2];if (i[z + 4 >> 2] <= (d | 0)) { - break N; - }i[z + 4 >> 2] = d;J[i[i[a >> 2] + 44 >> 2]](a, 18, z + 4 | 0) | 0; - }if (!i[a + 172 >> 2]) { - break o; - }J[i[i[a >> 2] + 44 >> 2]](a, 19, z + 4 | 0) | 0;d = i[z + 4 >> 2];m[a + 184 >> 2] = m[a + 184 >> 2] + p(1);d = d - i[a + 172 >> 2] | 0;m[a + 176 >> 2] = m[a + 176 >> 2] + p(d | 0);m[a + 180 >> 2] = +(d | 0) * .05 + +m[a + 180 >> 2] * .95; - }if (i[a + 200 >> 2]) { - W(c, 0, 1);W(c, i[a + 208 >> 2], 4); - }O: { - P: { - Q: { - g = i[i[a + 204 >> 2] + (i[a + 208 >> 2] << 2) >> 2];R: { - if (!g) { - g = i[a + 8 >> 2];if ((g | 0) >= 1) { - d = i[a + 76 >> 2];l = i[a + 84 >> 2];f = 0;while (1) { - c = f << 1;h[c + l >> 1] = 0;h[c + d >> 1] = 0;f = f + 1 | 0;if ((g | 0) != (f | 0)) { - continue; - }break; - } - }if (i[a + 24 >> 2] >= 1) { - c = i[a + 108 >> 2];f = 0;while (1) { - i[c + (f << 2) >> 2] = 0;f = f + 1 | 0;if ((f | 0) < i[a + 24 >> 2]) { - continue; - }break; - }g = i[a + 8 >> 2]; - }i[a + 40 >> 2] = 1;i[a + 4 >> 2] = 1;c = (g << 2) + b | 0;b = i[a + 20 >> 2];X(i[a + 68 >> 2], c - (b << 1) | 0, b - g << 1);if (i[a + 24 >> 2] < 1) { - g = 0;break R; - }b = i[a + 104 >> 2];g = 0;f = 0;while (1) { - i[b + (f << 2) >> 2] = 0;f = f + 1 | 0;if ((f | 0) < i[a + 24 >> 2]) { - continue; - }break; - }break R; - }v = i[a + 24 >> 2];if (!(!i[a + 4 >> 2] | (v | 0) < 1)) { - j = i[a + 96 >> 2];f = 0;while (1) { - d = f << 1;h[d + j >> 1] = k[d + O >> 1];f = f + 1 | 0;if ((v | 0) != (f | 0)) { - continue; - }break; - } - }J[i[g + 16 >> 2]](O, ma, v, c);d = i[i[a + 204 >> 2] + (i[a + 208 >> 2] << 2) >> 2];if (i[d >> 2] != -1) { - W(c, l - i[a + 28 >> 2] | 0, 7);d = i[i[a + 204 >> 2] + (i[a + 208 >> 2] << 2) >> 2]; - }if (i[d + 4 >> 2]) { - d = o(o(ba, 58982) >> 16, 15) + 32 >> 6;d = (d | 0) < 15 ? d : 15;d = (d | 0) > 0 ? d : 0;W(c, d, 4);ba = o(d << 22 >> 16, 2185) + 16384 >> 15; - }w = Jb(e);W(c, w, 5);f = i[a + 24 >> 2];if (!(!i[a + 4 >> 2] | (f | 0) < 1)) { - e = i[a + 100 >> 2];g = 0;while (1) { - d = g << 1;h[d + e >> 1] = k[d + ma >> 1];g = g + 1 | 0;if ((g | 0) != (f | 0)) { - continue; - }break; - } - }S: { - g = i[a + 16 >> 2];if ((g | 0) < 1) { - break S; - }v = Q & 1;$ = v + Q | 0;ja = i[a + 12 >> 2];E = ja << 1;d = $ + E | 0;Q = 0 - d & 3;P = d + Q | 0;e = ja << 2;d = P + e | 0;j = 0 - d & 3;oa = d + j | 0;d = oa + e | 0;A = d & 1;F = Q + (j + ((o(F, 18) + o(ja, 12) | 0) + (B + ia << 1) | 0) | 0) | 0;B = d + A | 0;j = B + E | 0;e = j & 1;ua = (D + (K + (N + ((S + ((((ua + (wa + (I + ((v + (A + (F + e | 0) | 0) | 0) + xa | 0) | 0) | 0) | 0) + ea | 0) + na | 0) + ka | 0) | 0) + R | 0) | 0) | 0) | 0) + 2 | 0;d = i[(w << 2) + 12144 >> 2];v = o(d << 1 >> 16, 28406) + (o(d & 32767, 28406) >>> 15 | 0) | 0;ka = v & 16383;wa = a + 36 | 0;na = v << 2 >> 16;R = e + j | 0;d = R + E | 0;F = (d & 1) + d | 0;d = F + E | 0;E = (0 - d & 3) + d | 0;N = E + (f << 2) | 0;xa = (0 - N & 3) + N | 0;ia = v - -8192 >> 14;Q = ia << 16 >> 17;D = 0;while (1) { - A = i[a + 76 >> 2];j = i[a + 84 >> 2];fa(i[a + 96 >> 2], O, T, f, D, g);fa(i[a + 100 >> 2], ma, ra, i[a + 24 >> 2], D, i[a + 16 >> 2]);ga(T, i[a + 24 >> 2], 16);ga(ra, i[a + 24 >> 2], 16);ha(T, V, i[a + 24 >> 2], N);ha(ra, M, i[a + 24 >> 2], N);f = 0;g = 8192;e = i[a + 24 >> 2];if ((e | 0) >= 1) { - while (1) { - d = f << 1;g = (h[(d | 2) + M >> 1] + g | 0) - h[d + M >> 1] | 0;f = f + 2 | 0;if ((f | 0) < (e | 0)) { - continue; - }break; - } - }K = D << 2;i[K + i[a + 132 >> 2] >> 2] = g;ca(h[a + 56 >> 1], V, L, i[a + 24 >> 2]);e = i[a + 24 >> 2];d = h[a + 58 >> 1];T: { - if ((d | 0) <= -1) { - if ((e | 0) < 1) { - break T; - }U(G, 0, e << 1);break T; - }ca(d, V, G, e); - }g = i[a + 20 >> 2] - i[a + 8 >> 2] | 0;if ((g | 0) != i[a + 12 >> 2]) { - break Q; - }ea = o(D, ja);I = ea << 1;w = I + j | 0;U: { - if (D) { - if ((g | 0) < 1) { - break U; - }j = o(g, D + -1 | 0);f = 0;while (1) { - e = f << 1;d = k[(f + j << 1) + b >> 1];h[e + w >> 1] = d;h[e + F >> 1] = d;f = f + 1 | 0;if ((g | 0) != (f | 0)) { - continue; - }break; - }break U; - }if ((g | 0) < 1) { - break U; - }d = i[a + 68 >> 2];f = 0;while (1) { - j = f << 1;e = k[j + d >> 1];h[j + w >> 1] = e;h[j + F >> 1] = e;f = f + 1 | 0;if ((g | 0) != (f | 0)) { - continue; - }break; - } - }va(F, M, F, g, i[a + 24 >> 2], i[a + 120 >> 2]);d = ja >> !i[a + 188 >> 2];La(M, L, G, R, d, i[a + 24 >> 2], N);j = i[a + 12 >> 2];if ((d | 0) < (j | 0)) { - e = d << 1;d = d + 1 | 0;U(e + ua | 0, 0, (((j | 0) > (d | 0) ? j : d) << 1) - e | 0); - }g = i[a + 24 >> 2];if ((g | 0) >= 1) { - e = i[a + 104 >> 2];f = 0;while (1) { - d = f << 2;i[d + E >> 2] = i[d + e >> 2] << 1;f = f + 1 | 0;g = i[a + 24 >> 2];if ((f | 0) < (g | 0)) { - continue; - }break; - } - }d = i[a + 12 >> 2];if ((d | 0) >= 1) { - U(B, 0, d << 1); - }_(B, M, B, d, g, E);g = i[a + 24 >> 2];if ((g | 0) >= 1) { - e = i[a + 108 >> 2];f = 0;while (1) { - d = f << 2;i[d + E >> 2] = i[d + e >> 2] << 1;f = f + 1 | 0;g = i[a + 24 >> 2];if ((f | 0) < (g | 0)) { - continue; - }break; - } - }aa(B, L, G, B, i[a + 12 >> 2], g, E);g = i[a + 24 >> 2];if ((g | 0) >= 1) { - e = i[a + 108 >> 2];f = 0;while (1) { - d = f << 2;i[d + E >> 2] = i[d + e >> 2];f = f + 1 | 0;g = i[a + 24 >> 2];if ((f | 0) < (g | 0)) { - continue; - }break; - } - }aa(w, L, G, w, i[a + 12 >> 2], g, E);if (!(i[a + 188 >> 2] | i[a + 24 >> 2] < 1)) { - e = i[a + 108 >> 2];f = 0;while (1) { - d = f << 2;i[d + e >> 2] = i[d + E >> 2];f = f + 1 | 0;if ((f | 0) < i[a + 24 >> 2]) { - continue; - }break; - } - }f = 0;j = i[a + 12 >> 2];if ((j | 0) >= 1) { - while (1) { - e = f << 1;d = h[e + w >> 1] - (h[e + B >> 1] + 1 >> 1) | 0;d = (d | 0) > -32767 ? d : -32767;h[e + $ >> 1] = (d | 0) < 32767 ? d : 32767;f = f + 1 | 0;if ((j | 0) != (f | 0)) { - continue; - }break; - } - }j = U(A + I | 0, 0, j << 1);A = i[i[a + 204 >> 2] + (i[a + 208 >> 2] << 2) >> 2];I = i[A + 24 >> 2];if (!I) { - break P; - }d = l;g = d;V: { - W: { - X: { - S = i[A >> 2];switch (S + 1 | 0) {case 1: - break V;case 0: - break W;default: - break X;} - }e = i[a + 32 >> 2] - S | 0;d = (S + i[a + 28 >> 2] | 0) + -1 | 0;l = (l | 0) < (d | 0) ? d : l;l = (l | 0) > (e | 0) ? e : l;g = S + l | 0;d = (l - S | 0) + 1 | 0;break V; - }g = i[a + 32 >> 2];d = i[a + 28 >> 2]; - }f = 0;d = J[I | 0]($, w, M, L, G, oa, i[A + 32 >> 2], d, (g | 0) > (ea | 0) ? i[a + 40 >> 2] ? ea : g : g, ba, i[a + 24 >> 2], i[a + 12 >> 2], c, N, j, R, i[a + 188 >> 2], 0, i[a + 196 >> 2], wa) | 0;i[K + i[a + 52 >> 2] >> 2] = d;A = U(P, 0, i[a + 12 >> 2] << 2);e = i[a + 12 >> 2];if ((e | 0) >= 1) { - while (1) { - d = F + (f << 1) | 0;h[d >> 1] = k[d >> 1] - (i[oa + (f << 2) >> 2] + 4096 >>> 13 | 0);f = f + 1 | 0;if ((e | 0) != (f | 0)) { - continue; - }break; - } - }d = ((Z(F, e) << 14) + Q | 0) / (ia | 0) | 0;e = (d | 0) < 32768 ? d : 32767;d = v;Y: { - Z: { - switch (i[i[i[a + 204 >> 2] + (i[a + 208 >> 2] << 2) >> 2] + 8 >> 2]) {case 3: - d = pa(e << 16 >> 16, 12272, 8);W(c, d, 3);d = h[(d << 1) + 12288 >> 1];d = (o(d, ka) >> 14) + o(d, na) | 0;break Y;case 0: - break Y;default: - break Z;} - }d = pa(e << 16 >> 16, 12304, 2);W(c, d, 1);d = h[(d << 1) + 12306 >> 1];d = (o(d, ka) >> 14) + o(d, na) | 0; - }Aa($, $, d, i[a + 12 >> 2]);g = i[i[a + 204 >> 2] + (i[a + 208 >> 2] << 2) >> 2];e = i[g + 36 >> 2];if (!e) { - break O; - }J[e | 0]($, M, L, G, i[g + 44 >> 2], i[a + 24 >> 2], i[a + 12 >> 2], A, R, c, N, i[a + 188 >> 2], i[g + 12 >> 2]);da(A, A, d, i[a + 12 >> 2]);f = 0;g = i[a + 12 >> 2];if ((g | 0) >= 1) { - while (1) { - e = f << 2;e = (i[e + oa >> 2] << 1) + i[e + A >> 2] | 0;h[j + (f << 1) >> 1] = (e | 0) > 536862719 ? 32767 : (e | 0) < -536862720 ? -32767 : e - -8192 >>> 14 | 0;f = f + 1 | 0;if ((g | 0) != (f | 0)) { - continue; - }break; - } - }_: { - if (i[i[i[a + 204 >> 2] + (i[a + 208 >> 2] << 2) >> 2] + 12 >> 2]) { - f = 0;e = g << 2;K = U(xa, 0, e);g = e + K | 0;I = i[a + 12 >> 2];if ((I | 0) >= 1) { - while (1) { - e = $ + (f << 1) | 0;h[e >> 1] = o(h[e >> 1], 18022) + 4096 >>> 13;f = f + 1 | 0;if ((I | 0) != (f | 0)) { - continue; - }break; - } - }f = 0;e = i[i[a + 204 >> 2] + (i[a + 208 >> 2] << 2) >> 2];J[i[e + 36 >> 2]]($, M, L, G, i[e + 44 >> 2], i[a + 24 >> 2], I, K, R, c, g, i[a + 188 >> 2], 0);da(K, K, o(d << 1 >> 16, 14895) + (o(d & 32767, 14895) >>> 15 | 0) | 0, i[a + 12 >> 2]);g = i[a + 12 >> 2];if ((g | 0) < 1) { - break _; - }while (1) { - e = f << 2;d = e + A | 0;i[d >> 2] = i[e + K >> 2] + i[d >> 2];f = f + 1 | 0;g = i[a + 12 >> 2];if ((f | 0) < (g | 0)) { - continue; - }break; - } - }f = 0;if ((g | 0) < 1) { - break _; - }while (1) { - d = f << 2;d = (i[d + oa >> 2] << 1) + i[d + A >> 2] | 0;h[j + (f << 1) >> 1] = (d | 0) > 536862719 ? 32767 : (d | 0) < -536862720 ? -32767 : d - -8192 >>> 14 | 0;f = f + 1 | 0;if ((g | 0) != (f | 0)) { - continue; - }break; - } - }e = M;d = w;if (i[a + 136 >> 2]) { - g = Ra(A, g);h[i[a + 136 >> 2] + (D << 1) >> 1] = g;g = i[a + 12 >> 2]; - }_(j, e, d, g, i[a + 24 >> 2], i[a + 104 >> 2]);if (i[a + 188 >> 2]) { - aa(w, L, G, w, i[a + 12 >> 2], i[a + 24 >> 2], i[a + 108 >> 2]); - }D = D + 1 | 0;g = i[a + 16 >> 2];if ((D | 0) >= (g | 0)) { - break S; - }f = i[a + 24 >> 2];ja = i[a + 12 >> 2];continue; - } - }e = i[a + 208 >> 2];$: { - if ((e | 0) < 1) { - break $; - }j = i[a + 24 >> 2];aa: { - if ((j | 0) < 1) { - break aa; - }d = i[a + 96 >> 2];f = 0;while (1) { - l = f << 1;h[l + d >> 1] = k[l + O >> 1];f = f + 1 | 0;if ((j | 0) != (f | 0)) { - continue; - }break; - }if ((j | 0) < 1) { - break aa; - }d = i[a + 100 >> 2];f = 0;while (1) { - l = f << 1;h[l + d >> 1] = k[l + ma >> 1];f = f + 1 | 0;if ((j | 0) != (f | 0)) { - continue; - }break; - } - }if ((e | 0) != 1) { - break $; - }if (i[a + 168 >> 2]) { - W(c, 15, 4);break $; - }W(c, 0, 4); - }i[a + 4 >> 2] = 0;c = i[a + 8 >> 2];d = (c << 2) + b | 0;b = i[a + 20 >> 2];X(i[a + 68 >> 2], d - (b << 1) | 0, b - c << 1);b = i[a + 208 >> 2];if (!(i[i[i[a + 204 >> 2] + (b << 2) >> 2] + 36 >> 2] != 14 ? b : 0)) { - g = 1;i[a + 40 >> 2] = 1;break R; - }i[a + 40 >> 2] = 0;g = 1; - }H = z + 48 | 0;return g | 0; - }la(12310, 708);x(); - }la(12391, 760);x(); - }la(12428, 842);x(); - }function na(a) { - a = a | 0;var b = 0, - c = 0, - d = 0, - e = 0, - f = 0, - g = 0, - h = 0, - k = 0, - m = 0, - n = 0, - o = 0;o = H - 16 | 0;H = o;a: { - b: { - c: { - d: { - e: { - f: { - g: { - h: { - i: { - j: { - k: { - if (a >>> 0 <= 244) { - f = i[3808];g = a >>> 0 < 11 ? 16 : a + 11 & -8;a = g >>> 3 | 0;b = f >>> a | 0;if (b & 3) { - c = a + ((b ^ -1) & 1) | 0;e = c << 3;b = i[e + 15280 >> 2];a = b + 8 | 0;d = i[b + 8 >> 2];e = e + 15272 | 0;l: { - if ((d | 0) == (e | 0)) { - i[3808] = ic(c) & f;break l; - }i[d + 12 >> 2] = e;i[e + 8 >> 2] = d; - }c = c << 3;i[b + 4 >> 2] = c | 3;b = b + c | 0;i[b + 4 >> 2] = i[b + 4 >> 2] | 1;break a; - }k = i[3810];if (g >>> 0 <= k >>> 0) { - break k; - }if (b) { - c = 2 << a;a = (0 - c | c) & b << a;a = (0 - a & a) + -1 | 0;b = a >>> 12 & 16;c = b;a = a >>> b | 0;b = a >>> 5 & 8;c = c | b;a = a >>> b | 0;b = a >>> 2 & 4;c = c | b;a = a >>> b | 0;b = a >>> 1 & 2;c = c | b;a = a >>> b | 0;b = a >>> 1 & 1;c = (c | b) + (a >>> b | 0) | 0;d = c << 3;b = i[d + 15280 >> 2];a = i[b + 8 >> 2];d = d + 15272 | 0;m: { - if ((a | 0) == (d | 0)) { - f = ic(c) & f;i[3808] = f;break m; - }i[a + 12 >> 2] = d;i[d + 8 >> 2] = a; - }a = b + 8 | 0;i[b + 4 >> 2] = g | 3;h = b + g | 0;c = c << 3;e = c - g | 0;i[h + 4 >> 2] = e | 1;i[b + c >> 2] = e;if (k) { - c = k >>> 3 | 0;b = (c << 3) + 15272 | 0;d = i[3813];c = 1 << c;n: { - if (!(c & f)) { - i[3808] = c | f;c = b;break n; - }c = i[b + 8 >> 2]; - }i[b + 8 >> 2] = d;i[c + 12 >> 2] = d;i[d + 12 >> 2] = b;i[d + 8 >> 2] = c; - }i[3813] = h;i[3810] = e;break a; - }n = i[3809];if (!n) { - break k; - }a = (n & 0 - n) + -1 | 0;b = a >>> 12 & 16;c = b;a = a >>> b | 0;b = a >>> 5 & 8;c = c | b;a = a >>> b | 0;b = a >>> 2 & 4;c = c | b;a = a >>> b | 0;b = a >>> 1 & 2;c = c | b;a = a >>> b | 0;b = a >>> 1 & 1;b = i[((c | b) + (a >>> b | 0) << 2) + 15536 >> 2];d = (i[b + 4 >> 2] & -8) - g | 0;c = b;while (1) { - o: { - a = i[c + 16 >> 2];if (!a) { - a = i[c + 20 >> 2];if (!a) { - break o; - } - }e = (i[a + 4 >> 2] & -8) - g | 0;c = e >>> 0 < d >>> 0;d = c ? e : d;b = c ? a : b;c = a;continue; - }break; - }m = i[b + 24 >> 2];e = i[b + 12 >> 2];if ((e | 0) != (b | 0)) { - a = i[b + 8 >> 2];i[a + 12 >> 2] = e;i[e + 8 >> 2] = a;break b; - }c = b + 20 | 0;a = i[c >> 2];if (!a) { - a = i[b + 16 >> 2];if (!a) { - break j; - }c = b + 16 | 0; - }while (1) { - h = c;e = a;c = a + 20 | 0;a = i[c >> 2];if (a) { - continue; - }c = e + 16 | 0;a = i[e + 16 >> 2];if (a) { - continue; - }break; - }i[h >> 2] = 0;break b; - }g = -1;if (a >>> 0 > 4294967231) { - break k; - }b = a + 11 | 0;g = b & -8;k = i[3809];if (!k) { - break k; - }c = 0 - g | 0;b = b >>> 8 | 0;f = 0;p: { - if (!b) { - break p; - }f = 31;if (g >>> 0 > 16777215) { - break p; - }d = b + 1048320 >>> 16 & 8;b = b << d;a = b + 520192 >>> 16 & 4;f = b << a;b = f + 245760 >>> 16 & 2;a = (f << b >>> 15 | 0) - (b | (a | d)) | 0;f = (a << 1 | g >>> a + 21 & 1) + 28 | 0; - }d = i[(f << 2) + 15536 >> 2];q: { - r: { - s: { - if (!d) { - a = 0;break s; - }b = g << ((f | 0) == 31 ? 0 : 25 - (f >>> 1 | 0) | 0);a = 0;while (1) { - t: { - h = (i[d + 4 >> 2] & -8) - g | 0;if (h >>> 0 >= c >>> 0) { - break t; - }e = d;c = h;if (c) { - break t; - }c = 0;a = d;break r; - }h = i[d + 20 >> 2];d = i[((b >>> 29 & 4) + d | 0) + 16 >> 2];a = h ? (h | 0) == (d | 0) ? a : h : a;b = b << ((d | 0) != 0);if (d) { - continue; - }break; - } - }if (!(a | e)) { - a = 2 << f;a = (0 - a | a) & k;if (!a) { - break k; - }a = (a & 0 - a) + -1 | 0;b = a >>> 12 & 16;d = b;a = a >>> b | 0;b = a >>> 5 & 8;d = d | b;a = a >>> b | 0;b = a >>> 2 & 4;d = d | b;a = a >>> b | 0;b = a >>> 1 & 2;d = d | b;a = a >>> b | 0;b = a >>> 1 & 1;a = i[((d | b) + (a >>> b | 0) << 2) + 15536 >> 2]; - }if (!a) { - break q; - } - }while (1) { - d = (i[a + 4 >> 2] & -8) - g | 0;b = d >>> 0 < c >>> 0;c = b ? d : c;e = b ? a : e;b = i[a + 16 >> 2];if (b) { - a = b; - } else { - a = i[a + 20 >> 2]; - }if (a) { - continue; - }break; - } - }if (!e | c >>> 0 >= i[3810] - g >>> 0) { - break k; - }h = i[e + 24 >> 2];b = i[e + 12 >> 2];if ((e | 0) != (b | 0)) { - a = i[e + 8 >> 2];i[a + 12 >> 2] = b;i[b + 8 >> 2] = a;break c; - }d = e + 20 | 0;a = i[d >> 2];if (!a) { - a = i[e + 16 >> 2];if (!a) { - break i; - }d = e + 16 | 0; - }while (1) { - f = d;b = a;d = a + 20 | 0;a = i[d >> 2];if (a) { - continue; - }d = b + 16 | 0;a = i[b + 16 >> 2];if (a) { - continue; - }break; - }i[f >> 2] = 0;break c; - }b = i[3810];if (b >>> 0 >= g >>> 0) { - a = i[3813];c = b - g | 0;u: { - if (c >>> 0 >= 16) { - i[3810] = c;d = a + g | 0;i[3813] = d;i[d + 4 >> 2] = c | 1;i[a + b >> 2] = c;i[a + 4 >> 2] = g | 3;break u; - }i[3813] = 0;i[3810] = 0;i[a + 4 >> 2] = b | 3;b = a + b | 0;i[b + 4 >> 2] = i[b + 4 >> 2] | 1; - }a = a + 8 | 0;break a; - }d = i[3811];if (d >>> 0 > g >>> 0) { - b = d - g | 0;i[3811] = b;a = i[3814];c = a + g | 0;i[3814] = c;i[c + 4 >> 2] = b | 1;i[a + 4 >> 2] = g | 3;a = a + 8 | 0;break a; - }a = 0;e = g + 47 | 0;c = e;if (i[3926]) { - b = i[3928]; - } else { - i[3929] = -1;i[3930] = -1;i[3927] = 4096;i[3928] = 4096;i[3926] = o + 12 & -16 ^ 1431655768;i[3931] = 0;i[3919] = 0;b = 4096; - }f = c + b | 0;h = 0 - b | 0;c = f & h;if (c >>> 0 <= g >>> 0) { - break a; - }b = i[3918];if (b) { - k = i[3916];m = k + c | 0;if (m >>> 0 <= k >>> 0 | m >>> 0 > b >>> 0) { - break a; - } - }if (j[15676] & 4) { - break f; - }v: { - w: { - b = i[3814];if (b) { - a = 15680;while (1) { - k = i[a >> 2];if (k + i[a + 4 >> 2] >>> 0 > b >>> 0 ? k >>> 0 <= b >>> 0 : 0) { - break w; - }a = i[a + 8 >> 2];if (a) { - continue; - }break; - } - }b = ia(0);if ((b | 0) == -1) { - break g; - }f = c;a = i[3927];d = a + -1 | 0;if (d & b) { - f = (c - b | 0) + (b + d & 0 - a) | 0; - }if (f >>> 0 <= g >>> 0 | f >>> 0 > 2147483646) { - break g; - }a = i[3918];if (a) { - d = i[3916];h = d + f | 0;if (h >>> 0 <= d >>> 0 | h >>> 0 > a >>> 0) { - break g; - } - }a = ia(f);if ((b | 0) != (a | 0)) { - break v; - }break e; - }f = h & f - d;if (f >>> 0 > 2147483646) { - break g; - }b = ia(f);if ((b | 0) == (i[a >> 2] + i[a + 4 >> 2] | 0)) { - break h; - }a = b; - }if (!((a | 0) == -1 | g + 48 >>> 0 <= f >>> 0)) { - b = i[3928];b = b + (e - f | 0) & 0 - b;if (b >>> 0 > 2147483646) { - b = a;break e; - }if ((ia(b) | 0) != -1) { - f = b + f | 0;b = a;break e; - }ia(0 - f | 0);break g; - }b = a;if ((a | 0) != -1) { - break e; - }break g; - }e = 0;break b; - }b = 0;break c; - }if ((b | 0) != -1) { - break e; - } - }i[3919] = i[3919] | 4; - }if (c >>> 0 > 2147483646) { - break d; - }b = ia(c);a = ia(0);if (b >>> 0 >= a >>> 0 | (b | 0) == -1 | (a | 0) == -1) { - break d; - }f = a - b | 0;if (f >>> 0 <= g + 40 >>> 0) { - break d; - } - }a = i[3916] + f | 0;i[3916] = a;if (a >>> 0 > l[3917]) { - i[3917] = a; - }x: { - y: { - z: { - c = i[3814];if (c) { - a = 15680;while (1) { - d = i[a >> 2];e = i[a + 4 >> 2];if ((d + e | 0) == (b | 0)) { - break z; - }a = i[a + 8 >> 2];if (a) { - continue; - }break; - }break y; - }a = i[3812];if (!(b >>> 0 >= a >>> 0 ? a : 0)) { - i[3812] = b; - }a = 0;i[3921] = f;i[3920] = b;i[3816] = -1;i[3817] = i[3926];i[3923] = 0;while (1) { - c = a << 3;d = c + 15272 | 0;i[c + 15280 >> 2] = d;i[c + 15284 >> 2] = d;a = a + 1 | 0;if ((a | 0) != 32) { - continue; - }break; - }a = f + -40 | 0;c = b + 8 & 7 ? -8 - b & 7 : 0;d = a - c | 0;i[3811] = d;c = b + c | 0;i[3814] = c;i[c + 4 >> 2] = d | 1;i[(a + b | 0) + 4 >> 2] = 40;i[3815] = i[3930];break x; - }if (j[a + 12 | 0] & 8 | b >>> 0 <= c >>> 0 | d >>> 0 > c >>> 0) { - break y; - }i[a + 4 >> 2] = e + f;a = c + 8 & 7 ? -8 - c & 7 : 0;b = a + c | 0;i[3814] = b;d = i[3811] + f | 0;a = d - a | 0;i[3811] = a;i[b + 4 >> 2] = a | 1;i[(c + d | 0) + 4 >> 2] = 40;i[3815] = i[3930];break x; - }e = i[3812];if (b >>> 0 < e >>> 0) { - i[3812] = b;e = 0; - }d = b + f | 0;a = 15680;A: { - B: { - C: { - D: { - E: { - F: { - while (1) { - if ((d | 0) != i[a >> 2]) { - a = i[a + 8 >> 2];if (a) { - continue; - }break F; - }break; - }if (!(j[a + 12 | 0] & 8)) { - break E; - } - }a = 15680;while (1) { - d = i[a >> 2];if (d >>> 0 <= c >>> 0) { - e = d + i[a + 4 >> 2] | 0;if (e >>> 0 > c >>> 0) { - break D; - } - }a = i[a + 8 >> 2];continue; - } - }i[a >> 2] = b;i[a + 4 >> 2] = i[a + 4 >> 2] + f;m = (b + 8 & 7 ? -8 - b & 7 : 0) + b | 0;i[m + 4 >> 2] = g | 3;b = d + (d + 8 & 7 ? -8 - d & 7 : 0) | 0;a = (b - m | 0) - g | 0;h = g + m | 0;if ((b | 0) == (c | 0)) { - i[3814] = h;a = i[3811] + a | 0;i[3811] = a;i[h + 4 >> 2] = a | 1;break B; - }if (i[3813] == (b | 0)) { - i[3813] = h;a = i[3810] + a | 0;i[3810] = a;i[h + 4 >> 2] = a | 1;i[a + h >> 2] = a;break B; - }c = i[b + 4 >> 2];if ((c & 3) == 1) { - n = c & -8;G: { - if (c >>> 0 <= 255) { - e = c >>> 3 | 0;c = i[b + 8 >> 2];d = i[b + 12 >> 2];if ((d | 0) == (c | 0)) { - i[3808] = i[3808] & ic(e);break G; - }i[c + 12 >> 2] = d;i[d + 8 >> 2] = c;break G; - }k = i[b + 24 >> 2];f = i[b + 12 >> 2];H: { - if ((f | 0) != (b | 0)) { - c = i[b + 8 >> 2];i[c + 12 >> 2] = f;i[f + 8 >> 2] = c;break H; - }I: { - d = b + 20 | 0;g = i[d >> 2];if (g) { - break I; - }d = b + 16 | 0;g = i[d >> 2];if (g) { - break I; - }f = 0;break H; - }while (1) { - c = d;f = g;d = g + 20 | 0;g = i[d >> 2];if (g) { - continue; - }d = f + 16 | 0;g = i[f + 16 >> 2];if (g) { - continue; - }break; - }i[c >> 2] = 0; - }if (!k) { - break G; - }c = i[b + 28 >> 2];d = (c << 2) + 15536 | 0;J: { - if (i[d >> 2] == (b | 0)) { - i[d >> 2] = f;if (f) { - break J; - }i[3809] = i[3809] & ic(c);break G; - }i[k + (i[k + 16 >> 2] == (b | 0) ? 16 : 20) >> 2] = f;if (!f) { - break G; - } - }i[f + 24 >> 2] = k;c = i[b + 16 >> 2];if (c) { - i[f + 16 >> 2] = c;i[c + 24 >> 2] = f; - }c = i[b + 20 >> 2];if (!c) { - break G; - }i[f + 20 >> 2] = c;i[c + 24 >> 2] = f; - }b = b + n | 0;a = a + n | 0; - }i[b + 4 >> 2] = i[b + 4 >> 2] & -2;i[h + 4 >> 2] = a | 1;i[a + h >> 2] = a;if (a >>> 0 <= 255) { - b = a >>> 3 | 0;a = (b << 3) + 15272 | 0;c = i[3808];b = 1 << b;K: { - if (!(c & b)) { - i[3808] = b | c;b = a;break K; - }b = i[a + 8 >> 2]; - }i[a + 8 >> 2] = h;i[b + 12 >> 2] = h;i[h + 12 >> 2] = a;i[h + 8 >> 2] = b;break B; - }c = h;d = a >>> 8 | 0;b = 0;L: { - if (!d) { - break L; - }b = 31;if (a >>> 0 > 16777215) { - break L; - }e = d + 1048320 >>> 16 & 8;d = d << e;b = d + 520192 >>> 16 & 4;g = d << b;d = g + 245760 >>> 16 & 2;b = (g << d >>> 15 | 0) - (d | (b | e)) | 0;b = (b << 1 | a >>> b + 21 & 1) + 28 | 0; - }i[c + 28 >> 2] = b;i[h + 16 >> 2] = 0;i[h + 20 >> 2] = 0;c = (b << 2) + 15536 | 0;d = i[3809];e = 1 << b;M: { - if (!(d & e)) { - i[3809] = d | e;i[c >> 2] = h;break M; - }d = a << ((b | 0) == 31 ? 0 : 25 - (b >>> 1 | 0) | 0);b = i[c >> 2];while (1) { - c = b;if ((i[b + 4 >> 2] & -8) == (a | 0)) { - break C; - }b = d >>> 29 | 0;d = d << 1;e = (b & 4) + c | 0;b = i[e + 16 >> 2];if (b) { - continue; - }break; - }i[e + 16 >> 2] = h; - }i[h + 24 >> 2] = c;i[h + 12 >> 2] = h;i[h + 8 >> 2] = h;break B; - }a = f + -40 | 0;d = b + 8 & 7 ? -8 - b & 7 : 0;h = a - d | 0;i[3811] = h;d = b + d | 0;i[3814] = d;i[d + 4 >> 2] = h | 1;i[(a + b | 0) + 4 >> 2] = 40;i[3815] = i[3930];a = (e + (e + -39 & 7 ? 39 - e & 7 : 0) | 0) + -47 | 0;d = a >>> 0 < c + 16 >>> 0 ? c : a;i[d + 4 >> 2] = 27;a = i[3923];i[d + 16 >> 2] = i[3922];i[d + 20 >> 2] = a;a = i[3921];i[d + 8 >> 2] = i[3920];i[d + 12 >> 2] = a;i[3922] = d + 8;i[3921] = f;i[3920] = b;i[3923] = 0;a = d + 24 | 0;while (1) { - i[a + 4 >> 2] = 7;b = a + 8 | 0;a = a + 4 | 0;if (e >>> 0 > b >>> 0) { - continue; - }break; - }if ((c | 0) == (d | 0)) { - break x; - }i[d + 4 >> 2] = i[d + 4 >> 2] & -2;e = d - c | 0;i[c + 4 >> 2] = e | 1;i[d >> 2] = e;if (e >>> 0 <= 255) { - b = e >>> 3 | 0;a = (b << 3) + 15272 | 0;d = i[3808];b = 1 << b;N: { - if (!(d & b)) { - i[3808] = b | d;b = a;break N; - }b = i[a + 8 >> 2]; - }i[a + 8 >> 2] = c;i[b + 12 >> 2] = c;i[c + 12 >> 2] = a;i[c + 8 >> 2] = b;break x; - }i[c + 16 >> 2] = 0;i[c + 20 >> 2] = 0;b = c;d = e >>> 8 | 0;a = 0;O: { - if (!d) { - break O; - }a = 31;if (e >>> 0 > 16777215) { - break O; - }f = d + 1048320 >>> 16 & 8;d = d << f;a = d + 520192 >>> 16 & 4;h = d << a;d = h + 245760 >>> 16 & 2;a = (h << d >>> 15 | 0) - (d | (a | f)) | 0;a = (a << 1 | e >>> a + 21 & 1) + 28 | 0; - }i[b + 28 >> 2] = a;b = (a << 2) + 15536 | 0;d = i[3809];f = 1 << a;P: { - if (!(d & f)) { - i[3809] = d | f;i[b >> 2] = c;i[c + 24 >> 2] = b;break P; - }a = e << ((a | 0) == 31 ? 0 : 25 - (a >>> 1 | 0) | 0);b = i[b >> 2];while (1) { - d = b;if ((e | 0) == (i[b + 4 >> 2] & -8)) { - break A; - }b = a >>> 29 | 0;a = a << 1;f = d + (b & 4) | 0;b = i[f + 16 >> 2];if (b) { - continue; - }break; - }i[f + 16 >> 2] = c;i[c + 24 >> 2] = d; - }i[c + 12 >> 2] = c;i[c + 8 >> 2] = c;break x; - }a = i[c + 8 >> 2];i[a + 12 >> 2] = h;i[c + 8 >> 2] = h;i[h + 24 >> 2] = 0;i[h + 12 >> 2] = c;i[h + 8 >> 2] = a; - }a = m + 8 | 0;break a; - }a = i[d + 8 >> 2];i[a + 12 >> 2] = c;i[d + 8 >> 2] = c;i[c + 24 >> 2] = 0;i[c + 12 >> 2] = d;i[c + 8 >> 2] = a; - }a = i[3811];if (a >>> 0 <= g >>> 0) { - break d; - }b = a - g | 0;i[3811] = b;a = i[3814];c = a + g | 0;i[3814] = c;i[c + 4 >> 2] = b | 1;i[a + 4 >> 2] = g | 3;a = a + 8 | 0;break a; - }i[3790] = 48;a = 0;break a; - }Q: { - if (!h) { - break Q; - }a = i[e + 28 >> 2];d = (a << 2) + 15536 | 0;R: { - if (i[d >> 2] == (e | 0)) { - i[d >> 2] = b;if (b) { - break R; - }k = ic(a) & k;i[3809] = k;break Q; - }i[h + (i[h + 16 >> 2] == (e | 0) ? 16 : 20) >> 2] = b;if (!b) { - break Q; - } - }i[b + 24 >> 2] = h;a = i[e + 16 >> 2];if (a) { - i[b + 16 >> 2] = a;i[a + 24 >> 2] = b; - }a = i[e + 20 >> 2];if (!a) { - break Q; - }i[b + 20 >> 2] = a;i[a + 24 >> 2] = b; - }S: { - if (c >>> 0 <= 15) { - a = c + g | 0;i[e + 4 >> 2] = a | 3;a = a + e | 0;i[a + 4 >> 2] = i[a + 4 >> 2] | 1;break S; - }i[e + 4 >> 2] = g | 3;d = e + g | 0;i[d + 4 >> 2] = c | 1;i[c + d >> 2] = c;if (c >>> 0 <= 255) { - b = c >>> 3 | 0;a = (b << 3) + 15272 | 0;c = i[3808];b = 1 << b;T: { - if (!(c & b)) { - i[3808] = b | c;b = a;break T; - }b = i[a + 8 >> 2]; - }i[a + 8 >> 2] = d;i[b + 12 >> 2] = d;i[d + 12 >> 2] = a;i[d + 8 >> 2] = b;break S; - }b = d;g = c >>> 8 | 0;a = 0;U: { - if (!g) { - break U; - }a = 31;if (c >>> 0 > 16777215) { - break U; - }f = g + 1048320 >>> 16 & 8;g = g << f;a = g + 520192 >>> 16 & 4;h = g << a;g = h + 245760 >>> 16 & 2;a = (h << g >>> 15 | 0) - (g | (a | f)) | 0;a = (a << 1 | c >>> a + 21 & 1) + 28 | 0; - }i[b + 28 >> 2] = a;i[d + 16 >> 2] = 0;i[d + 20 >> 2] = 0;b = (a << 2) + 15536 | 0;V: { - g = 1 << a;W: { - if (!(g & k)) { - i[3809] = g | k;i[b >> 2] = d;break W; - }a = c << ((a | 0) == 31 ? 0 : 25 - (a >>> 1 | 0) | 0);g = i[b >> 2];while (1) { - b = g;if ((i[b + 4 >> 2] & -8) == (c | 0)) { - break V; - }g = a >>> 29 | 0;a = a << 1;f = (g & 4) + b | 0;g = i[f + 16 >> 2];if (g) { - continue; - }break; - }i[f + 16 >> 2] = d; - }i[d + 24 >> 2] = b;i[d + 12 >> 2] = d;i[d + 8 >> 2] = d;break S; - }a = i[b + 8 >> 2];i[a + 12 >> 2] = d;i[b + 8 >> 2] = d;i[d + 24 >> 2] = 0;i[d + 12 >> 2] = b;i[d + 8 >> 2] = a; - }a = e + 8 | 0;break a; - }X: { - if (!m) { - break X; - }a = i[b + 28 >> 2];c = (a << 2) + 15536 | 0;Y: { - if (i[c >> 2] == (b | 0)) { - i[c >> 2] = e;if (e) { - break Y; - }i[3809] = ic(a) & n;break X; - }i[m + (i[m + 16 >> 2] == (b | 0) ? 16 : 20) >> 2] = e;if (!e) { - break X; - } - }i[e + 24 >> 2] = m;a = i[b + 16 >> 2];if (a) { - i[e + 16 >> 2] = a;i[a + 24 >> 2] = e; - }a = i[b + 20 >> 2];if (!a) { - break X; - }i[e + 20 >> 2] = a;i[a + 24 >> 2] = e; - }Z: { - if (d >>> 0 <= 15) { - a = d + g | 0;i[b + 4 >> 2] = a | 3;a = a + b | 0;i[a + 4 >> 2] = i[a + 4 >> 2] | 1;break Z; - }i[b + 4 >> 2] = g | 3;g = b + g | 0;i[g + 4 >> 2] = d | 1;i[d + g >> 2] = d;if (k) { - c = k >>> 3 | 0;a = (c << 3) + 15272 | 0;e = i[3813];c = 1 << c;_: { - if (!(c & f)) { - i[3808] = c | f;c = a;break _; - }c = i[a + 8 >> 2]; - }i[a + 8 >> 2] = e;i[c + 12 >> 2] = e;i[e + 12 >> 2] = a;i[e + 8 >> 2] = c; - }i[3813] = g;i[3810] = d; - }a = b + 8 | 0; - }H = o + 16 | 0;return a | 0; - }function yb(a, b, c) { - a = a | 0;b = b | 0;c = c | 0;var d = 0, - e = 0, - f = 0, - g = 0, - j = 0, - l = 0, - m = 0, - n = 0, - p = 0, - q = 0, - r = 0, - s = 0, - t = 0, - u = 0, - v = 0, - w = 0, - y = 0, - z = 0, - A = 0, - B = 0, - C = 0, - D = 0, - E = 0, - F = 0, - G = 0, - I = 0, - K = 0, - L = 0, - M = 0, - N = 0;r = H - 32 | 0;H = r;f = i[a + 44 >> 2];a: { - b: { - c: { - d: { - e: { - if (!b) { - if (i[a + 484 >> 2]) { - break e; - }b = i[a + 8 >> 2];if ((b | 0) <= 9) { - j = h[(b << 1) + 12480 >> 1] << 1; - }b = h[a + 102 >> 1];f = h[a + 98 >> 1];d = h[a + 100 >> 1];f: { - if ((f | 0) < (d | 0)) { - if ((d | 0) < (b | 0)) { - break f; - }d = (f | 0) < (b | 0) ? b : f;break f; - }if ((b | 0) < (d | 0)) { - break f; - }d = (b | 0) < (f | 0) ? b : f; - }b = h[a + 96 >> 1];if ((d | 0) < (b | 0)) { - h[a + 96 >> 1] = d;b = d; - }f = Z(i[a + 52 >> 2], i[a + 12 >> 2]);d = i[a + 48 >> 2];qa(d, d + (i[a + 12 >> 2] << 1) | 0, (i[a + 16 >> 2] + (i[a + 32 >> 2] << 1) << 1) + 24 | 0);e = o(i[a + 108 >> 2], 1664525) + 1013904223 | 0;i[a + 108 >> 2] = e;b = o(((b | 0) < 54 ? b : 54) << 25 >> 16, j) >> 16;n = i[a + 12 >> 2];if ((n | 0) >= 1) { - d = i[a + 28 >> 2];p = i[a + 32 >> 2];g = o(e >> 16, (i[a + 8 >> 2] << 16) + 65536 >> 16);g = i[a + 92 >> 2] + ((g - (g >> 3) << 2) + 32768 >> 30) | 0;p = (g | 0) > (p | 0) ? p : g;p = (p | 0) < (d | 0) ? d : p;j = o(f, o(2147418112 - (o(b, b) << 1 & -65536) >> 16, j) >> 16) << 1 >> 16;f = i[a + 52 >> 2];d = 0;while (1) { - e = o(e, 1664525) + 1013904223 | 0;g = o(j, e >> 16);h[f + (d << 1) >> 1] = ((g - (g >> 3) | 0) - -8192 >>> 14) + (o(b, h[f + (d - p << 1) >> 1]) >>> 15);d = d + 1 | 0;if ((n | 0) != (d | 0)) { - continue; - }break; - }i[a + 108 >> 2] = e; - }f = i[a + 60 >> 2];ca(32113, f, f, i[a + 24 >> 2]);_(i[a + 52 >> 2] - (i[a + 16 >> 2] << 1) | 0, i[a + 60 >> 2], c, i[a + 12 >> 2], i[a + 24 >> 2], i[a + 64 >> 2]);sa(c, c, i[a + 12 >> 2], 1, a + 68 | 0);d = 0;i[a + 4 >> 2] = 0;i[a + 8 >> 2] = i[a + 8 >> 2] + 1;c = i[a + 104 >> 2];i[a + 104 >> 2] = c + 1;h[((c << 1) + a | 0) + 98 >> 1] = b + 256 >>> 9;if ((c | 0) < 2) { - break c; - }i[a + 104 >> 2] = 0;break c; - }if (!i[a + 112 >> 2]) { - break d; - }if (((i[b + 20 >> 2] ? -1 : (i[b + 4 >> 2] - i[b + 12 >> 2] | 0) - (i[b + 8 >> 2] << 3) | 0) | 0) < 5) { - d = -1;break c; - }j = a + 128 | 0;while (1) { - g: { - if (!V(b, 1)) { - break g; - }oa(b, i[(V(b, 3) << 2) + 12512 >> 2] + -4 | 0);if (((i[b + 20 >> 2] ? -1 : (i[b + 4 >> 2] - i[b + 12 >> 2] | 0) - (i[b + 8 >> 2] << 3) | 0) | 0) < 5) { - d = -1;break c; - }if (!V(b, 1)) { - break g; - }oa(b, i[(V(b, 3) << 2) + 12512 >> 2] + -4 | 0);if (!V(b, 1)) { - break g; - }i[r + 16 >> 2] = 12595;Y(i[3524], 12810, r + 16 | 0);d = -2;break c; - }if (((i[b + 20 >> 2] ? -1 : (i[b + 4 >> 2] - i[b + 12 >> 2] | 0) - (i[b + 8 >> 2] << 3) | 0) | 0) < 4) { - d = -1;break c; - }d = -1;h: { - i: { - j: { - k: { - e = V(b, 4);switch (e + -13 | 0) {case 1: - break i;case 0: - break k;case 2: - break c;default: - break j;} - }d = J[i[a + 452 >> 2]](b, a, i[a + 456 >> 2]) | 0;if (!d) { - break h; - }break c; - }if ((e | 0) < 9) { - break e; - }i[r >> 2] = 12544;Y(i[3524], 12810, r);d = -2;break c; - }d = gb(b, j, a);if (d) { - break c; - } - }if (((i[b + 20 >> 2] ? -1 : (i[b + 4 >> 2] - i[b + 12 >> 2] | 0) - (i[b + 8 >> 2] << 3) | 0) | 0) >= 5) { - continue; - }break; - }d = -1;break c; - }i[a + 120 >> 2] = e; - }d = i[a + 48 >> 2];qa(d, d + (i[a + 12 >> 2] << 1) | 0, (i[a + 16 >> 2] + (i[a + 32 >> 2] << 1) << 1) + 24 | 0);s = f + (f & 1) | 0;f = i[a + 24 >> 2];j = s + (f << 1) | 0;d = i[i[a + 116 >> 2] + (i[a + 120 >> 2] << 2) >> 2];if (!d) { - ca(30474, i[a + 60 >> 2], s, f);f = Z(i[a + 52 >> 2], i[a + 12 >> 2]);d = 0;b = i[a + 12 >> 2];l: { - if ((b | 0) <= 0) { - g = i[a + 52 >> 2];break l; - }e = i[a + 108 >> 2];g = i[a + 52 >> 2];while (1) { - e = o(e, 1664525) + 1013904223 | 0;j = o(f, e >> 16);h[(d << 1) + g >> 1] = (j - (j >> 3) | 0) - -8192 >>> 14;d = d + 1 | 0;if ((b | 0) != (d | 0)) { - continue; - }break; - }i[a + 108 >> 2] = e; - }i[a + 4 >> 2] = 1;_(g, s, c, b, i[a + 24 >> 2], i[a + 64 >> 2]);d = 0;i[a + 8 >> 2] = 0;break c; - }J[i[d + 20 >> 2]](s, f, b);m: { - if (!i[a + 8 >> 2]) { - break m; - }f = i[a + 24 >> 2];if ((f | 0) < 1) { - break m; - }g = i[a + 56 >> 2];d = 0;e = 0;while (1) { - n = d << 1;q = h[n + g >> 1] - h[n + s >> 1] | 0;n = q >> 31;e = (n ^ n + q) + e | 0;d = d + 1 | 0;if ((f | 0) != (d | 0)) { - continue; - }break; - }if ((f | 0) < 1) { - break m; - }f = 19661 >>> (e >>> 15) | 0;n = i[a + 64 >> 2];d = 0;while (1) { - g = n + (d << 2) | 0;e = i[g >> 2];i[g >> 2] = o(f, e << 1 >> 16) + (o(f, e & 32767) >>> 15 | 0);d = d + 1 | 0;if ((d | 0) < i[a + 24 >> 2]) { - continue; - }break; - } - }n: { - if (i[a + 8 >> 2] ? 0 : !i[a + 4 >> 2]) { - break n; - }f = i[a + 24 >> 2];if ((f | 0) < 1) { - break n; - }e = i[a + 56 >> 2];d = 0;while (1) { - n = d << 1;h[n + e >> 1] = k[n + s >> 1];d = d + 1 | 0;if ((f | 0) != (d | 0)) { - continue; - }break; - } - }f = i[i[a + 116 >> 2] + (i[a + 120 >> 2] << 2) >> 2];if (i[f >> 2] != -1) { - p = i[a + 28 >> 2] + V(b, 7) | 0;f = i[i[a + 116 >> 2] + (i[a + 120 >> 2] << 2) >> 2]; - }if (i[f + 4 >> 2]) { - A = o(V(b, 4) << 22 >> 16, 2185) + 16384 >> 15; - }f = V(b, 5);v = j + (j & 1) | 0;d = v + (i[a + 24 >> 2] << 1) | 0;B = (0 - d & 3) + d | 0;d = i[a + 16 >> 2] << 2;j = B + d | 0;e = 0 - j & 3;n = i[(f << 2) + 12144 >> 2];g = o(n & 32767, 28406);f = i[a + 120 >> 2];if ((f | 0) == 1) { - i[a + 484 >> 2] = (V(b, 4) | 0) == 15;f = i[a + 120 >> 2]; - }if ((f | 0) >= 2) { - i[a + 484 >> 2] = 0; - }t = e + j | 0;q = t + d | 0;n = o(n << 1 >> 16, 28406) + (g >>> 15 | 0) | 0;o: { - if (i[a + 20 >> 2] <= 0) { - f = 40;break o; - }f = p << 16 >> 15;d = f >>> 0 > 65535;j = d << 3;g = j | 4;e = j;d = d ? f >>> 16 | 0 : f;j = d >>> 0 > 255;e = j ? g : e;d = j ? d >>> 8 | 0 : d;j = d >>> 0 > 15;d = (j ? e | 2 : e) | (j ? d >>> 4 | 0 : d) >>> 0 > 3;j = d << 1;g = n << 2;e = o(A, 24576) + -311296 | 0;e = e & 536870912 ? 0 : e >>> 14 | 0;e = e << 16 >> 16 < 64 ? e : 64;m = f >> j + -12;f = f << 12 - j;j = d << 16 >> 16;f = ((j | 0) > 6 ? m : f) << 16 >> 16;f = (o((o(o(f, 16816) + -827523072 >> 16, f) << 2 & -65536) + 1387593728 >> 16, f) << 2 & -65536) + 238157824 >> 16;d = 13 - d | 0;K = o((o(g + 32768 >> 16, e << 16 >> 16) << 10) + 32768 >>> 16 | 0, (j | 0) < 13 ? f >> d : f << 0 - d);L = o(e, 5046272) >> 16;M = o(e, -28508160) + 2147418112 >> 16;C = a + 108 | 0;D = n & 16383;E = g >> 16;N = q + (0 - q & 3) | 0;d = i[a + 16 >> 2];f = 40;while (1) { - w = i[a + 80 >> 2];l = o(d, z);F = l << 1;u = U(F + i[a + 52 >> 2] | 0, 0, d << 1);e = i[i[a + 116 >> 2] + (i[a + 120 >> 2] << 2) >> 2];m = i[e + 28 >> 2];if (!m) { - break b; - }d = f;j = p;g = j;p: { - q: { - r: { - f = i[e >> 2];switch (f + 1 | 0) {case 1: - break p;case 0: - break q;default: - break r;} - }j = i[a + 32 >> 2];g = f + p | 0;g = (g | 0) > (j | 0) ? j : g;j = i[a + 28 >> 2];f = (p - f | 0) + 1 | 0;j = (f | 0) < (j | 0) ? j : f;break p; - }g = i[a + 32 >> 2];j = i[a + 28 >> 2]; - }J[m | 0](u, t, j, g, A, i[e + 32 >> 2], i[a + 16 >> 2], r + 28 | 0, r + 22 | 0, b, q, i[a + 8 >> 2], l, h[a + 96 >> 1], 0);vb(t, i[a + 16 >> 2]);j = h[r + 24 >> 1];f = j >> 31;s: { - t: { - j = f ^ f + j;f = h[r + 22 >> 1];j = j + ((f | 0) > 0 ? f : 0 - (f >>> 1 | 0) | 0) | 0;f = h[r + 26 >> 1];j = j + ((f | 0) > 0 ? f : 0 - (f >>> 1 | 0) | 0) << 16 >> 16;e = G << 16 >> 16;u: { - if ((j | 0) <= (e | 0)) { - break u; - }f = i[r + 28 >> 2];l = (d << 1) - f | 0;g = l >> 31;if ((g ^ g + l) < 3) { - break u; - }l = o(d, 3) - f | 0;g = l >> 31;if ((g ^ g + l) < 4) { - break u; - }l = (d << 2) - f | 0;g = l >> 31;if ((g ^ g + l) > 4) { - break t; - } - }if (o(e, 19661) >> 15 < (j | 0)) { - f = i[r + 28 >> 2];l = d - (f << 1) | 0;g = l >> 31;if ((g ^ g + l) < 3) { - break t; - }l = d + o(f, -3) | 0;g = l >> 31;if ((g ^ g + l) < 4) { - break t; - }l = d - (f << 2) | 0;g = l >> 31;if ((g ^ g + l) < 5) { - break t; - } - }if (o(j, 21955) >> 15 <= (e | 0)) { - f = d;break s; - }f = i[r + 28 >> 2];l = (d << 1) - f | 0;g = l >> 31;if ((g ^ g + l) < 3) { - break t; - }l = o(d, 3) - f | 0;g = l >> 31;if ((g ^ g + l) < 4) { - break t; - }l = (d << 2) - f | 0;g = l >> 31;if ((g ^ g + l) <= 4) { - break t; - }f = d;break s; - }G = (j | 0) > (e | 0) ? j : G; - }l = U(B, 0, i[a + 16 >> 2] << 2);e = n;v: { - w: { - switch (i[i[i[a + 116 >> 2] + (i[a + 120 >> 2] << 2) >> 2] + 8 >> 2] + -1 | 0) {case 2: - d = h[(V(b, 3) << 1) + 12288 >> 1];e = (o(d, D) >> 14) + o(d, E) | 0;break v;case 0: - break w;default: - break v;} - }d = h[(V(b, 1) << 1) + 12306 >> 1];e = (o(d, D) >> 14) + o(d, E) | 0; - }d = i[i[a + 116 >> 2] + (i[a + 120 >> 2] << 2) >> 2];g = i[d + 40 >> 2];if (!g) { - break a; - }J[g | 0](l, i[d + 44 >> 2], i[a + 16 >> 2], b, q, C);da(l, l, e, i[a + 16 >> 2]);d = i[a + 16 >> 2];x: { - y: { - if (i[i[i[a + 116 >> 2] + (i[a + 120 >> 2] << 2) >> 2] + 12 >> 2]) { - g = 0;d = d << 2;m = U(N, 0, d);I = i[i[a + 116 >> 2] + (i[a + 120 >> 2] << 2) >> 2];J[i[I + 40 >> 2]](m, i[I + 44 >> 2], i[a + 16 >> 2], b, d + m | 0, C);da(m, m, o(e << 1 >> 16, 14895) + (o(e & 32767, 14895) >>> 15 | 0) | 0, i[a + 16 >> 2]);d = i[a + 16 >> 2];if ((d | 0) < 1) { - break y; - }while (1) { - d = g << 2;e = d + l | 0;i[e >> 2] = i[d + m >> 2] + i[e >> 2];g = g + 1 | 0;d = i[a + 16 >> 2];if ((g | 0) < (d | 0)) { - continue; - }break; - } - }if ((d | 0) < 1) { - break x; - }e = 0;g = (d | 0) > 0;while (1) { - m = e << 2;m = (i[m + t >> 2] << 1) + i[l + m >> 2] | 0;h[u + (e << 1) >> 1] = (m | 0) > 536862719 ? 32767 : (m | 0) < -536862720 ? -32767 : m - -8192 >>> 14 | 0;e = e + 1 | 0;if ((e | 0) != (d | 0)) { - continue; - }break; - } - }m = w ? w + F | 0 : 0;if (!m) { - break x; - }e = 0;if (!g) { - break x; - }while (1) { - h[m + (e << 1) >> 1] = i[l + (e << 2) >> 2] - -8192 >>> 14;e = e + 1 | 0;if ((e | 0) != (d | 0)) { - continue; - }break; - } - }y = j + y | 0;z: { - if (i[a + 120 >> 2] != 1) { - break z; - }u = U(u, 0, d << 1);e = i[a + 480 >> 2];d = i[a + 16 >> 2];if ((e | 0) < (d | 0)) { - while (1) { - if ((e | 0) >= 0) { - h[u + (e << 1) >> 1] = K; - }e = e + p | 0;if ((e | 0) < (d | 0)) { - continue; - }break; - }i[a + 480 >> 2] = e; - }i[a + 480 >> 2] = e - d;if ((d | 0) < 1) { - break z; - }j = i[a + 472 >> 2];g = 0;while (1) { - m = u + (g << 1) | 0;w = h[m >> 1];e = i[l + (g << 2) >> 2];h[m >> 1] = (o((e << 2) + 32768 >> 16, M) >>> 15) + (o(h[a + 468 >> 1], 19660) + (o(w, 45876) & -65536) >>> 16) - (o((j << 2) + 32768 >> 16, L) >>> 15);i[a + 472 >> 2] = e;h[a + 468 >> 1] = w;j = (o(h[a + 476 >> 1], 26214) + o(h[m >> 1], 6554) | 0) + 16384 >>> 15 | 0;h[a + 476 >> 1] = j;h[m >> 1] = k[m >> 1] - j;j = e;g = g + 1 | 0;if ((g | 0) != (d | 0)) { - continue; - }break; - } - }y = y << 16 >> 16;z = z + 1 | 0;if ((z | 0) < i[a + 20 >> 2]) { - continue; - }break; - }l = y + 2 >> 2; - }b = q + (q & 1) | 0;d = i[a + 24 >> 2];p = b + (d << 1) | 0;A: { - B: { - if (!i[a + 124 >> 2]) { - break B; - }j = h[i[i[a + 116 >> 2] + (i[a + 120 >> 2] << 2) >> 2] + 48 >> 1];if (i[a + 8 >> 2] | (j | 0) < 1) { - break B; - }e = i[a + 16 >> 2] << 1;Ja(i[a + 52 >> 2] - e | 0, c, e, f, j, p);d = i[a + 16 >> 2];j = d << 1;Ja(j + i[a + 52 >> 2] | 0, (d << 2) + c | 0, j, f, h[i[i[a + 116 >> 2] + (i[a + 120 >> 2] << 2) >> 2] + 48 >> 1], p);break A; - }X(c, i[a + 52 >> 2] - (i[a + 16 >> 2] << 1) | 0, i[a + 12 >> 2] << 1); - }C: { - if (!i[a + 8 >> 2]) { - break C; - }d = Z(i[a + 52 >> 2], i[a + 12 >> 2]);e = i[a + 12 >> 2];if ((e | 0) < 1) { - break C; - }d = (d << 16) + 65536 | 0;d = (n + (d >> 17) | 0) / (d >> 16) | 0;g = ((d | 0) < 32767 ? d : 32767) << 16 >> 16;q = i[a + 16 >> 2];j = i[a + 52 >> 2];d = 0;while (1) { - m = d << 1;t = m + j | 0;h[t >> 1] = o(g, h[t >> 1]) >>> 14;h[c + m >> 1] = k[j + (d - q << 1) >> 1];d = d + 1 | 0;if ((e | 0) != (d | 0)) { - continue; - }break; - } - }d = i[a + 20 >> 2];if ((d | 0) >= 1) { - j = i[a + 24 >> 2];g = 0;while (1) { - q = i[a + 16 >> 2];fa(i[a + 56 >> 2], s, b, j, g, d);ga(b, i[a + 24 >> 2], 16);ha(b, v, i[a + 24 >> 2], p);e = 8192;d = 0;j = i[a + 24 >> 2];if ((j | 0) >= 1) { - while (1) { - m = e;e = d << 1;e = (m + h[(e | 2) + v >> 1] | 0) - h[e + v >> 1] | 0;d = d + 2 | 0;if ((d | 0) < (j | 0)) { - continue; - }break; - } - }i[i[a + 76 >> 2] + (g << 2) >> 2] = e;d = (o(g, q) << 1) + c | 0;_(d, i[a + 60 >> 2], d, i[a + 16 >> 2], i[a + 24 >> 2], i[a + 64 >> 2]);j = i[a + 24 >> 2];if ((j | 0) >= 1) { - e = i[a + 60 >> 2];d = 0;while (1) { - q = d << 1;h[q + e >> 1] = k[q + v >> 1];d = d + 1 | 0;if ((j | 0) != (d | 0)) { - continue; - }break; - } - }g = g + 1 | 0;d = i[a + 20 >> 2];if ((g | 0) < (d | 0)) { - continue; - }break; - } - }if (i[a + 492 >> 2]) { - sa(c, c, i[a + 12 >> 2], i[a + 488 >> 2] ? 3 : 1, a + 68 | 0); - }b = (n - -8192 >>> 14 | 0) + 1 | 0;h[a + 84 >> 1] = b;c = o(h[a + 86 >> 1], 32440) >> 15;b = b << 16 >> 16;c = (c | 0) > (b | 0) ? c : b;h[a + 86 >> 1] = c;d = o(h[a + 88 >> 1], 66192) + 65536 >> 16;b = (d | 0) < (b | 0) ? d : b;h[a + 88 >> 1] = b;if ((b | 0) >= (c | 0)) { - h[a + 86 >> 1] = b + 1; - }b = i[a + 24 >> 2];if ((b | 0) >= 1) { - c = i[a + 56 >> 2];d = 0;while (1) { - j = d << 1;h[j + c >> 1] = k[j + s >> 1];d = d + 1 | 0;if ((b | 0) != (d | 0)) { - continue; - }break; - } - }h[a + 96 >> 1] = l;i[a + 92 >> 2] = f;i[a + 4 >> 2] = 0;i[a + 8 >> 2] = 0;b = i[a + 104 >> 2];i[a + 104 >> 2] = b + 1;h[((b << 1) + a | 0) + 98 >> 1] = l;if ((b | 0) >= 2) { - i[a + 104 >> 2] = 0; - }h[a + 40 >> 1] = n;d = 0; - }H = r + 32 | 0;return d | 0; - }la(12657, 1321);x(); - }la(12696, 1397);x(); - }function mb(a, b, c) { - a = a | 0;b = b | 0;c = c | 0;var d = 0, - e = 0, - f = 0, - g = 0, - j = 0, - l = 0, - n = 0, - r = 0, - v = 0, - w = 0, - x = 0, - y = p(0), - z = 0, - A = 0, - B = p(0), - C = 0, - D = 0, - E = 0, - F = 0, - G = 0, - I = p(0), - K = 0, - L = 0, - M = 0, - N = 0, - O = 0, - P = 0, - Q = 0, - R = 0, - S = 0, - T = 0, - V = p(0), - Y = 0, - $ = 0, - ea = 0;x = H - 16 | 0;H = x;z = i[i[a >> 2] >> 2];v = i[a + 12 >> 2];d = (v << 1) + b | 0;f = i[a + 44 >> 2];Ub(b, b, d, i[a + 8 >> 2], i[a + 52 >> 2], f);a: { - if (!(i[a + 108 >> 2] | i[a + 136 >> 2])) { - B = p(1);I = p(1);break a; - }B = p(p(Z(b, i[a + 12 >> 2]) | 0) + p(1));I = p(p(Z(d, i[a + 12 >> 2]) | 0) + p(1)); - }e = i[a + 20 >> 2];g = i[a + 4 >> 2];R = f + (f & 1) | 0;J[i[i[g >> 2] + 44 >> 2]](g, 104, R) | 0;f = i[a + 4 >> 2];J[i[i[f >> 2] + 28 >> 2]](f, b, c) | 0;f = d;j = i[a + 24 >> 2];G = i[a + 12 >> 2];d = j - G << 1;K = X(f - d | 0, i[a + 48 >> 2], d);d = i[a + 12 >> 2];X(i[a + 48 >> 2], (d << 1) + K | 0, i[a + 24 >> 2] - d << 1);f = i[a + 20 >> 2];d = i[a + 4 >> 2];e = (e << 1) + R | 0;S = (0 - e & 3) + e | 0;J[i[i[d >> 2] + 44 >> 2]](d, 100, S) | 0;d = i[a + 4 >> 2];e = (f << 2) + S | 0;T = (e & 1) + e | 0;J[i[i[d >> 2] + 44 >> 2]](d, 101, T) | 0;d = i[a + 4 >> 2];J[i[i[d >> 2] + 44 >> 2]](d, 9, x + 12 | 0) | 0;i[x + 12 >> 2] = !i[x + 12 >> 2];A = i[a + 28 >> 2];d = A << 1;f = (f << 1) + T | 0;w = (f & 1) + f | 0;f = d + w | 0;N = (f & 1) + f | 0;f = N + d | 0;C = (f & 1) + f | 0;f = C + d | 0;D = (f & 1) + f | 0;f = D + d | 0;E = (f & 1) + f | 0;f = E + d | 0;L = (f & 1) + f | 0;f = L + d | 0;O = (f & 1) + f | 0;f = O + d | 0;P = (f & 1) + f | 0;f = P + d | 0;f = (f & 1) + f | 0;d = (d + f | 0) + 2 | 0;g = (d & 1) + d | 0;d = i[a + 24 >> 2];n = d << 1;b: { - if (i[a + 16 >> 2] != 80) { - if ((d | 0) < 1) { - break b; - }r = i[a + 60 >> 2];e = 0;while (1) { - l = e << 1;h[l + g >> 1] = o(h[l + r >> 1], h[l + K >> 1]) >>> 14;e = e + 1 | 0;if ((d | 0) != (e | 0)) { - continue; - }break; - }break b; - }if ((d | 0) < 1) { - break b; - }l = i[a + 60 >> 2];e = 0;while (1) { - r = e << 1;h[r + g >> 1] = o(h[l + (e & -2) >> 1], h[r + K >> 1]) >>> 14;e = e + 1 | 0;if ((d | 0) != (e | 0)) { - continue; - }break; - } - }l = g + n | 0;e = 1;Da(g, f, A + 1 | 0, d);d = h[f >> 1];g = (o(d, h[a + 36 >> 1]) >>> 15 | 0) + d | 0;h[f >> 1] = g;d = i[a + 28 >> 2];c: { - if ((d | 0) < 0) { - break c; - }A = i[a + 64 >> 2];h[f >> 1] = o(h[A >> 1], g << 16 >> 16) >>> 14;if (!d) { - break c; - }while (1) { - g = e << 1;n = g + f | 0;h[n >> 1] = o(h[g + A >> 1], h[n >> 1]) >>> 14;g = (d | 0) != (e | 0);e = e + 1 | 0;if (g) { - continue; - }break; - } - }Ea(w, f, d);f = ta(w, i[a + 28 >> 2], E, 6553, l);d = i[a + 28 >> 2];d: { - if ((f | 0) == (d | 0)) { - break d; - }f = ta(w, d, E, 1638, l);d = i[a + 28 >> 2];if ((f | 0) == (d | 0) | (d | 0) < 1) { - break d; - }f = i[a + 68 >> 2];e = 0;while (1) { - g = e << 1;h[g + E >> 1] = k[f + g >> 1];e = e + 1 | 0;if ((d | 0) != (e | 0)) { - continue; - }break; - } - }e: { - if (i[x + 12 >> 2] | (i[a + 136 >> 2] ? 0 : !i[a + 108 >> 2])) { - break e; - }if (i[a + 120 >> 2]) { - V = m[a + 124 >> 2];f: { - if (p(m[a + 128 >> 2] * V) > p(0) ^ 1) { - break f; - }y = p(+V * -1e-5 / +p(m[a + 132 >> 2] + p(1)));y = +y > .1 ? p(.10000000149011612) : y;if (+y < -.1 ^ 1) { - break f; - }y = p(-.10000000149011612); - }m[a + 104 >> 2] = t(p(s(p(y + m[a + 104 >> 2]), p(10))), p(0)); - }d = i[a + 4 >> 2];J[i[i[d >> 2] + 44 >> 2]](d, 29, a + 140 | 0) | 0;Y = ba(+p(I / B));if (i[a + 108 >> 2]) { - e = i[z + 152 >> 2] + -1 | 0;i[x + 8 >> 2] = e;I = p(t(p(p(p(s(p(t(p(Y + Y), p(-4))), p(2))) + p(2)) + m[a + 140 >> 2]), p(-1)));m[a + 140 >> 2] = I;g: { - if (!e) { - break g; - }f = i[z + 148 >> 2];B = m[a + 104 >> 2];y = p(u(B));h: { - if (p(q(y)) < p(2147483648)) { - d = ~~y;break h; - }d = -2147483648; - }if ((d | 0) == 10) { - while (1) { - if (((o(i[i[i[a + 148 >> 2] + (e << 2) >> 2] + 52 >> 2], i[a + 164 >> 2]) | 0) / i[a + 8 >> 2] | 0) <= i[a + 116 >> 2] ? !(I >= m[(f + o(e, 44) | 0) + 40 >> 2] ^ 1) : 0) { - break g; - }e = e + -1 | 0;i[x + 8 >> 2] = e;if (e) { - continue; - }break g; - } - }y = p(B - p(d | 0));g = d + 1 | 0;B = p(p(g | 0) - B);while (1) { - w = f + o(e, 44) | 0;if (((o(i[i[i[a + 148 >> 2] + (e << 2) >> 2] + 52 >> 2], i[a + 164 >> 2]) | 0) / i[a + 8 >> 2] | 0) <= i[a + 116 >> 2] ? !(I >= p(p(y * m[w + (g << 2) >> 2]) + p(B * m[w + (d << 2) >> 2])) ^ 1) : 0) { - break g; - }e = e + -1 | 0;i[x + 8 >> 2] = e;if (e) { - continue; - }break; - } - }J[i[i[a >> 2] + 44 >> 2]](a, 10, x + 8 | 0) | 0;if (!i[a + 120 >> 2]) { - break e; - }J[i[i[a >> 2] + 44 >> 2]](a, 19, x + 4 | 0) | 0;d = i[x + 4 >> 2];m[a + 132 >> 2] = m[a + 132 >> 2] + p(1);d = d - i[a + 120 >> 2] | 0;m[a + 124 >> 2] = m[a + 124 >> 2] + p(d | 0);m[a + 128 >> 2] = +(d | 0) * .05 + +m[a + 128 >> 2] * .95;break e; - }i[a + 152 >> 2] = m[a + 140 >> 2] < p(2) ? 1 : i[a + 156 >> 2]; - }if (i[a + 144 >> 2]) { - W(c, 1, 1);W(c, i[x + 12 >> 2] ? 0 : i[a + 152 >> 2], 3); - }i: { - j: { - if (!i[x + 12 >> 2]) { - d = i[i[a + 148 >> 2] + (i[a + 152 >> 2] << 2) >> 2];if (d) { - break j; - } - }c = i[a + 12 >> 2];if ((c | 0) >= 1) { - U(((v + G | 0) - j << 1) + b | 0, 0, c << 1); - }d = i[a + 28 >> 2];if ((d | 0) >= 1) { - b = i[a + 88 >> 2];e = 0;while (1) { - i[b + (e << 2) >> 2] = 0;e = e + 1 | 0;d = i[a + 28 >> 2];if ((e | 0) < (d | 0)) { - continue; - }break; - } - }i[a + 32 >> 2] = 1;_(K, i[a + 76 >> 2], K, i[a + 12 >> 2], d, i[a + 80 >> 2]);a = !i[x + 12 >> 2];break i; - }J[i[d + 16 >> 2]](E, L, i[a + 28 >> 2], c);e = i[a + 28 >> 2];k: { - if (!i[a + 32 >> 2] | (e | 0) < 1) { - break k; - }b = i[a + 68 >> 2];d = 0;while (1) { - f = d << 1;h[f + b >> 1] = k[f + E >> 1];d = d + 1 | 0;if ((d | 0) != (e | 0)) { - continue; - }break; - }if ((e | 0) < 1) { - break k; - }b = i[a + 72 >> 2];d = 0;while (1) { - f = d << 1;h[f + b >> 1] = k[f + L >> 1];d = d + 1 | 0;if ((d | 0) != (e | 0)) { - continue; - }break; - } - }d = i[a + 20 >> 2];if ((d | 0) >= 1) { - w = l + (0 - l & 3) | 0;b = w + (e << 2) | 0;G = (b & 1) + b | 0;b = i[a + 16 >> 2];f = b << 1;g = G + f | 0;$ = (0 - g & 3) + g | 0;g = $ + (b << 2) | 0;z = (g & 1) + g | 0;l = f + z | 0;g = 0;while (1) { - fa(i[a + 68 >> 2], E, O, e, g, d);fa(i[a + 72 >> 2], L, P, i[a + 28 >> 2], g, i[a + 20 >> 2]);ga(O, i[a + 28 >> 2], 410);ga(P, i[a + 28 >> 2], 410);f = (l & 1) + l | 0;d = b << 1;e = f + d | 0;v = (e & 1) + e | 0;n = d;d = d + v | 0;A = (d & 1) + d | 0;l = n + A | 0;ha(O, N, i[a + 28 >> 2], l);ha(P, i[a + 76 >> 2], i[a + 28 >> 2], l);ca(h[a + 38 >> 1], N, C, i[a + 28 >> 2]);ca(h[a + 40 >> 1], N, D, i[a + 28 >> 2]);M = g << 2;Q = M + i[a + 92 >> 2] | 0;i[Q >> 2] = 8192;j = i[a + 76 >> 2];e = 0;n = 8192;d = 8192;r = i[a + 28 >> 2];if ((r | 0) >= 1) { - while (1) { - ea = n;n = e << 1;r = h[n + j >> 1];F = h[j + (n | 2) >> 1];n = ea + (r + F | 0) | 0;i[Q >> 2] = n;d = (d + F | 0) - r | 0;e = e + 2 | 0;r = i[a + 28 >> 2];if ((e | 0) < (r | 0)) { - continue; - }break; - } - }e = i[M + S >> 2];n = (o(b, g) << 1) + K | 0;va(n, j, f, i[a + 16 >> 2], r, i[a + 84 >> 2]);b = d + 82 | 0;b = (((e << 7) + (b << 16 >> 17) | 0) + 10496 | 0) / (b | 0) | 0;b = (b | 0) > -32767 ? b : -32767;j = (b | 0) < 32767 ? b : 32767;e = Z(f, i[a + 16 >> 2]);l: { - if (!i[i[i[a + 148 >> 2] + (i[a + 152 >> 2] << 2) >> 2] + 36 >> 2]) { - b = g << 1;d = (k[b + R >> 1] << 16) + 65536 | 0;d = pa((o(e, j) + (d >> 17) | 0) / (d >> 16) << 16 >> 16, 12976, 32);d = (d | 0) > 0 ? d : 0;W(c, (d | 0) < 31 ? d : 31, 5);d = i[a + 100 >> 2];if (!d) { - break l; - }h[b + d >> 1] = e;break l; - }M = g << 1;b = (k[M + T >> 1] << 16) + 65536 | 0;r = b >> 16;b = (o(j, (e << 16) + 65536 >> 16) + (b >> 17) | 0) / (r | 0) | 0;d = c;if (i[a + 16 >> 2] == 80) { - b = o(b << 16 >> 16, 23171) + 16384 >>> 15 | 0; - }b = pa(b << 16 >> 16, 13040, 16);W(d, b, 4);e = o(h[(b << 1) + 13040 >> 1], 28626) >>> 15 | 0;b = i[a + 16 >> 2];if ((b | 0) == 80) { - e = o(e << 16 >> 16, 23170) - -8192 >> 14; - }La(i[a + 76 >> 2], C, D, G, b, i[a + 28 >> 2], l);j = ((e << 16 >> 8) + (j >> 1) | 0) / (j | 0) | 0;b = i[a + 16 >> 2];if ((b | 0) >= 1) { - U(v, 0, b << 1); - }b = i[a + 28 >> 2];if ((b | 0) >= 1) { - d = i[a + 80 >> 2];e = 0;while (1) { - b = e << 2;i[b + w >> 2] = i[b + d >> 2];e = e + 1 | 0;b = i[a + 28 >> 2];if ((e | 0) < (b | 0)) { - continue; - }break; - } - }_(v, i[a + 76 >> 2], v, i[a + 16 >> 2], b, w);b = i[a + 28 >> 2];if ((b | 0) >= 1) { - d = i[a + 88 >> 2];e = 0;while (1) { - b = e << 2;i[b + w >> 2] = i[b + d >> 2];e = e + 1 | 0;b = i[a + 28 >> 2];if ((e | 0) < (b | 0)) { - continue; - }break; - } - }aa(v, C, D, v, i[a + 16 >> 2], b, w);b = i[a + 28 >> 2];if ((b | 0) >= 1) { - d = i[a + 88 >> 2];e = 0;while (1) { - b = e << 2;i[b + w >> 2] = i[b + d >> 2];e = e + 1 | 0;b = i[a + 28 >> 2];if ((e | 0) < (b | 0)) { - continue; - }break; - } - }aa(n, C, D, A, i[a + 16 >> 2], b, w);e = 0;b = i[a + 16 >> 2];if ((b | 0) >= 1) { - while (1) { - d = e << 1;h[d + z >> 1] = k[d + A >> 1] - k[d + v >> 1];e = e + 1 | 0;if ((b | 0) != (e | 0)) { - continue; - }break; - } - }r = o(r, j << 16 >> 16);d = r << 6;Aa(z, z, d, b);v = U($, 0, i[a + 16 >> 2] << 2);b = i[i[a + 148 >> 2] + (i[a + 152 >> 2] << 2) >> 2];J[i[b + 36 >> 2]](z, i[a + 76 >> 2], C, D, i[b + 44 >> 2], i[a + 28 >> 2], i[a + 16 >> 2], v, G, c, l, i[a + 160 >> 2], i[b + 12 >> 2]);da(v, v, d, i[a + 16 >> 2]);m: { - n: { - if (!i[i[i[a + 148 >> 2] + (i[a + 152 >> 2] << 2) >> 2] + 12 >> 2]) { - d = i[a + 16 >> 2];break n; - }e = 0;j = i[a + 16 >> 2] << 2;b = U((0 - l & 3) + l | 0, 0, j);Q = b + j | 0;j = i[a + 16 >> 2];if ((j | 0) >= 1) { - while (1) { - F = z + (e << 1) | 0;h[F >> 1] = o(h[F >> 1], 20480) + 4096 >>> 13;e = e + 1 | 0;if ((j | 0) != (e | 0)) { - continue; - }break; - } - }e = 0;F = i[i[a + 148 >> 2] + (i[a + 152 >> 2] << 2) >> 2];J[i[F + 36 >> 2]](z, i[a + 76 >> 2], C, D, i[F + 44 >> 2], i[a + 28 >> 2], j, b, G, c, Q, i[a + 160 >> 2], 0);da(b, b, o(r << 7 >> 16, 13107) + (o(d & 32704, 13107) + 16384 >>> 15 | 0) | 0, i[a + 16 >> 2]);d = i[a + 16 >> 2];if ((d | 0) < 1) { - break m; - }while (1) { - d = e << 2;j = d + v | 0;i[j >> 2] = i[b + d >> 2] + i[j >> 2];e = e + 1 | 0;d = i[a + 16 >> 2];if ((e | 0) < (d | 0)) { - continue; - }break; - } - }e = 0;if ((d | 0) < 1) { - break m; - }while (1) { - h[f + (e << 1) >> 1] = i[v + (e << 2) >> 2] - -8192 >>> 14;e = e + 1 | 0;if ((d | 0) != (e | 0)) { - continue; - }break; - } - }b = f;if (i[a + 100 >> 2]) { - d = Ra(v, d);h[M + i[a + 100 >> 2] >> 1] = o(d, 23171) >>> 15;d = i[a + 16 >> 2]; - }e = Z(b, d); - }h[i[a + 96 >> 2] + (g << 1) >> 1] = e;d = i[a + 80 >> 2];e = 0;b = i[a + 28 >> 2];if ((b | 0) >= 1) { - while (1) { - b = e << 2;i[b + w >> 2] = i[b + d >> 2];e = e + 1 | 0;b = i[a + 28 >> 2];if ((e | 0) < (b | 0)) { - continue; - }break; - } - }_(f, i[a + 76 >> 2], n, i[a + 16 >> 2], b, d);aa(n, C, D, A, i[a + 16 >> 2], i[a + 28 >> 2], i[a + 88 >> 2]);g = g + 1 | 0;d = i[a + 20 >> 2];if ((g | 0) < (d | 0)) { - e = i[a + 28 >> 2];b = i[a + 16 >> 2];continue; - }break; - }e = i[a + 28 >> 2]; - }o: { - if ((e | 0) < 1) { - break o; - }b = i[a + 68 >> 2];d = 0;while (1) { - c = d << 1;h[c + b >> 1] = k[c + E >> 1];d = d + 1 | 0;if ((d | 0) != (e | 0)) { - continue; - }break; - }if ((e | 0) < 1) { - break o; - }b = i[a + 72 >> 2];d = 0;while (1) { - c = d << 1;h[c + b >> 1] = k[c + L >> 1];d = d + 1 | 0;if ((d | 0) != (e | 0)) { - continue; - }break; - } - }i[a + 32 >> 2] = 0;a = 1; - }H = x + 16 | 0;return a | 0; - }function fc(a, b, c, d, e, f, j, l, m, n, p, q, r) { - a = a | 0;b = b | 0;c = c | 0;d = d | 0;e = e | 0;f = f | 0;j = j | 0;l = l | 0;m = m | 0;n = n | 0;p = p | 0;q = q | 0;r = r | 0;var s = 0, - t = 0, - u = 0, - v = 0, - w = 0, - x = 0, - y = 0, - z = 0, - A = 0, - B = 0, - C = 0, - D = 0, - E = 0, - F = 0, - G = 0, - I = 0, - J = 0, - K = 0, - L = 0, - M = 0, - N = 0, - O = 0, - P = 0, - Q = 0, - R = 0, - S = 0, - T = 0, - V = 0, - Y = 0, - Z = 0, - _ = 0, - $ = 0, - aa = 0, - ba = 0, - ca = 0, - da = 0, - ea = 0, - fa = 0, - ga = 0, - ha = 0, - ia = 0;R = H - 16 | 0;H = R;Y = (q | 0) < 10 ? q : 10;q = Y << 1;E = (q | 0) / 3 | 0;a: { - b: { - if (!(q + -3 >>> 0 > 2 ? (Y | 0) >= 3 : 0)) { - G = i[e + 16 >> 2];S = i[e + 8 >> 2];u = i[e + 4 >> 2];J = (p & 1) + p | 0;x = i[e >> 2];v = i[e + 12 >> 2];p = J + (x << v << 1) | 0;F = (0 - p & 3) + p | 0;N = 1 << v;q = N << 2;p = F + q | 0;B = j << 1;T = X((p & 1) + p | 0, a, B);p = B + T | 0;O = (0 - p & 3) + p | 0;p = O + (j << 2) | 0;I = (p & 1) + p | 0;c: { - if ((v | 0) == 31) { - break c; - }if ((x | 0) > 0) { - while (1) { - p = o(x, P);q = 0;while (1) { - h[I + (q << 1) >> 1] = g[S + (p + q | 0) | 0];q = q + 1 | 0;if ((x | 0) != (q | 0)) { - continue; - }break; - }t = 0;C = F + (P << 2) | 0;i[C >> 2] = 0;s = 1;v = J + (p << 1) | 0;y = 0;while (1) { - p = 0;q = 0;while (1) { - p = o(h[(y - q << 1) + m >> 1], h[I + (q << 1) >> 1]) + p | 0;q = q + 1 | 0;if ((s | 0) != (q | 0)) { - continue; - }break; - }h[v + (y << 1) >> 1] = p >>> 13;s = s + 1 | 0;p = p << 3 >> 16;t = o(p, p) + t | 0;y = y + 1 | 0;if ((x | 0) != (y | 0)) { - continue; - }break; - }i[C >> 2] = t;P = P + 1 | 0;if ((N | 0) != (P | 0)) { - continue; - }break; - }break c; - }U(F, 0, q); - }if ((u | 0) < 1) { - break b; - }p = 0;while (1) { - D = o(p, x);q = T + (D << 1) | 0;d: { - if (G) { - Ga(q, J, x, N, F, 1, R + 12 | 0, R + 8 | 0);break d; - }Ha(q, J, x, N, F, 1, R + 12 | 0, R + 8 | 0); - }W(n, i[R + 12 >> 2], G + i[e + 12 >> 2] | 0);s = i[R + 12 >> 2];t = (s | 0) < (N | 0);K = o(x, s - (t ? 0 : N) | 0);C = J + (K << 1) | 0;e: { - f: { - g: { - h: { - if (!t) { - q = 0;if ((x | 0) <= 0) { - break g; - }while (1) { - v = T + (q + D << 1) | 0;h[v >> 1] = k[C + (q << 1) >> 1] + k[v >> 1];q = q + 1 | 0;if ((x | 0) != (q | 0)) { - continue; - }break; - }break h; - }q = 0;if ((x | 0) < 1) { - break g; - }while (1) { - v = T + (q + D << 1) | 0;h[v >> 1] = k[v >> 1] - k[C + (q << 1) >> 1];q = q + 1 | 0;if ((x | 0) != (q | 0)) { - continue; - }break; - } - }i: { - if (!t) { - q = 0;if ((x | 0) <= 0) { - break g; - }while (1) { - i[O + (q + D << 2) >> 2] = 0 - (g[S + (q + K | 0) | 0] << 9);q = q + 1 | 0;if ((x | 0) != (q | 0)) { - continue; - }break; - }break i; - }q = 0;if ((x | 0) < 1) { - break g; - }while (1) { - i[O + (q + D << 2) >> 2] = g[S + (q + K | 0) | 0] << 9;q = q + 1 | 0;if ((x | 0) != (q | 0)) { - continue; - }break; - } - }if ((x | 0) > 0) { - break f; - } - }p = p + 1 | 0;break e; - }p = p + 1 | 0;q = o(x, p);w = j - q | 0;if ((w | 0) < 1) { - break e; - }z = T + (q << 1) | 0;t = 0;if ((s | 0) < (N | 0)) { - while (1) { - D = (x - t << 1) + m | 0;s = g[S + (t + K | 0) | 0] << 3;q = 0;while (1) { - C = q << 1;v = C + z | 0;h[v >> 1] = k[v >> 1] - (o(s, h[C + D >> 1]) + 32768 >>> 16 | 0);q = q + 1 | 0;if ((w | 0) != (q | 0)) { - continue; - }break; - }t = t + 1 | 0;if ((x | 0) != (t | 0)) { - continue; - }break e; - } - }while (1) { - D = (x - t << 1) + m | 0;s = g[S + (t + K | 0) | 0] << 3;q = 0;while (1) { - C = q << 1;v = C + z | 0;h[v >> 1] = k[v >> 1] - (32768 - o(s, h[C + D >> 1]) >>> 16 | 0);q = q + 1 | 0;if ((w | 0) != (q | 0)) { - continue; - }break; - }t = t + 1 | 0;if ((x | 0) != (t | 0)) { - continue; - }break; - } - }if ((p | 0) != (u | 0)) { - continue; - }break; - }break b; - }q = 0;t = (0 - p & 3) + p | 0;u = E << 2;p = t + u | 0;C = (0 - p & 3) + p | 0;p = C + u | 0;fa = (0 - p & 3) + p | 0;p = fa + u | 0;ba = (0 - p & 3) + p | 0;p = u + ba | 0;ga = (p & 1) + p | 0;A = i[e >> 2];y = i[e + 12 >> 2];p = ga + (A << y << 1) | 0;ca = (0 - p & 3) + p | 0;Q = 1 << y;D = Q << 2;p = ca + D | 0;J = (p & 1) + p | 0;V = j << 1;p = J + V | 0;da = (0 - p & 3) + p | 0;p = da + (j << 2) | 0;N = (0 - p & 3) + p | 0;L = i[e + 4 >> 2];p = N + (L << 2) | 0;w = (p & 1) + p | 0;z = w + (o(E, V) << 1) | 0;s = (E | 0) > 1 ? E : 1;S = 0 - V | 0;M = 0 - u | 0;T = i[e + 16 >> 2];ea = i[e + 8 >> 2];while (1) { - v = q << 2;p = q << 1;i[v + t >> 2] = w + (o(p, j) << 1);i[v + C >> 2] = w + (o(p | 1, j) << 1);q = q + 1 | 0;if ((s | 0) != (q | 0)) { - continue; - }break; - }q = 0;F = u + (z + (0 - z & 3) | 0) | 0;B = u + ((0 - F & 3) + F | 0) | 0;O = u + ((0 - B & 3) + B | 0) | 0;I = u + ((0 - O & 3) + O | 0) | 0;K = u + ((0 - I & 3) + I | 0) | 0;z = (0 - K & 3) + K | 0;G = z + u | 0;u = (0 - G & 3) + G | 0;w = u + (o(E, L) << 3) | 0;j: { - if ((Y | 0) <= 1) { - X(J, a, V);break j; - }s = (E | 0) > 1 ? E : 1;while (1) { - v = q << 2;p = q << 1;i[v + ba >> 2] = u + (o(p, L) << 2);i[v + fa >> 2] = u + (o(L, p | 1) << 2);q = q + 1 | 0;if ((s | 0) != (q | 0)) { - continue; - }break; - }v = X(J, a, V);if ((Y | 0) < 2) { - break j; - }p = (E | 0) > 1 ? E : 1;q = 0;while (1) { - X(i[(q << 2) + t >> 2], v, V);q = q + 1 | 0;if ((p | 0) != (q | 0)) { - continue; - }break; - } - }ha = (w & 1) + w | 0;k: { - if ((y | 0) == 31) { - break k; - }w = 0;if ((A | 0) > 0) { - while (1) { - p = o(w, A);q = 0;while (1) { - h[ha + (q << 1) >> 1] = g[ea + (p + q | 0) | 0];q = q + 1 | 0;if ((A | 0) != (q | 0)) { - continue; - }break; - }u = 0;D = ca + (w << 2) | 0;i[D >> 2] = 0;s = 1;v = (p << 1) + ga | 0;y = 0;while (1) { - p = 0;q = 0;while (1) { - p = o(h[(y - q << 1) + m >> 1], h[ha + (q << 1) >> 1]) + p | 0;q = q + 1 | 0;if ((s | 0) != (q | 0)) { - continue; - }break; - }h[v + (y << 1) >> 1] = p >>> 13;s = s + 1 | 0;p = p << 3 >> 16;u = o(p, p) + u | 0;y = y + 1 | 0;if ((A | 0) != (y | 0)) { - continue; - }break; - }i[D >> 2] = u;w = w + 1 | 0;if ((Q | 0) != (w | 0)) { - continue; - }break k; - } - }U(ca, 0, D); - }if ((Y | 0) >= 2) { - U(z, 0, ((E | 0) > 1 ? E : 1) << 2); - }l: { - if ((L | 0) < 1) { - break l; - }J = G + M | 0;_ = I + M | 0;$ = M + O | 0;ia = B + M | 0;x = F + M | 0;Z = (E | 0) > 1 ? E : 1;aa = M + K | 0;D = E + -1 | 0;O = aa + (D << 2) | 0;while (1) { - v = C;C = t;q = 0;p = (Y | 0) > 1;m: { - if (!p) { - break m; - }while (1) { - i[aa + (q << 2) >> 2] = 2147483647;q = q + 1 | 0;if ((Z | 0) != (q | 0)) { - continue; - }break; - }q = 0;if (!p) { - break m; - }while (1) { - p = q << 2;i[p + _ >> 2] = 0;i[p + $ >> 2] = 0;q = q + 1 | 0;if ((Z | 0) != (q | 0)) { - continue; - }break; - }y = (Y | 0) < 2;if (y) { - break m; - }I = o(A, P);M = 0;while (1) { - s = M << 2;t = i[s + C >> 2] + (I << 1) | 0;p = 0;q = 0;K = (A | 0) < 1;if (!K) { - while (1) { - B = p;p = h[t + (q << 1) >> 1];p = B + o(p, p) | 0;q = q + 1 | 0;if ((A | 0) != (q | 0)) { - continue; - }break; - } - }n: { - if (T) { - Ga(t, ga, A, Q, ca, E, x, ia);break n; - }Ha(t, ga, A, Q, ca, E, x, ia); - }G = p >>> 1 | 0;u = s + J | 0;t = 0;while (1) { - q = 0;w = t << 2;F = i[w + ia >> 2] + (G + i[u >> 2] | 0) | 0;o: { - if ((F | 0) >= i[O >> 2]) { - break o; - }while (1) { - z = aa + (q << 2) | 0;if ((F | 0) >= i[z >> 2]) { - q = q + 1 | 0;if ((Z | 0) != (q | 0)) { - continue; - }break o; - }break; - }s = D;p = s;if ((p | 0) > (q | 0)) { - while (1) { - B = p << 2;p = p + -1 | 0;s = p << 2;i[B + aa >> 2] = i[s + aa >> 2];i[B + $ >> 2] = i[s + $ >> 2];i[B + _ >> 2] = i[s + _ >> 2];if ((p | 0) > (q | 0)) { - continue; - }break; - }s = q; - }i[z >> 2] = F;p = s << 2;i[p + $ >> 2] = i[x + w >> 2];i[p + _ >> 2] = M; - }t = t + 1 | 0;if ((Z | 0) != (t | 0)) { - continue; - }break; - }if (P) { - M = M + 1 | 0;if ((M | 0) < (E | 0)) { - continue; - } - }break; - }if (y) { - break m; - }p = o(A, P + 1 | 0);F = j - p | 0;t = 0;while (1) { - if ((p | 0) < (j | 0)) { - q = t << 2;w = i[q + v >> 2];z = i[(i[q + _ >> 2] << 2) + C >> 2];q = p;while (1) { - s = q << 1;h[s + w >> 1] = k[s + z >> 1];q = q + 1 | 0;if ((q | 0) < (j | 0)) { - continue; - }break; - } - }p: { - if ((F | 0) < 1 | K) { - break p; - }q = t << 2;B = i[q + v >> 2] + (p << 1) | 0;q = i[q + $ >> 2];I = o(A, q - ((q | 0) < (Q | 0) ? 0 : Q) | 0);s = 0;if ((q | 0) < (Q | 0)) { - while (1) { - G = (A - s << 1) + m | 0;u = g[ea + (s + I | 0) | 0] << 3;q = 0;while (1) { - w = q << 1;z = w + B | 0;h[z >> 1] = k[z >> 1] - (o(u, h[w + G >> 1]) + 32768 >>> 16 | 0);q = q + 1 | 0;if ((F | 0) != (q | 0)) { - continue; - }break; - }s = s + 1 | 0;if ((A | 0) != (s | 0)) { - continue; - }break p; - } - }while (1) { - G = (A - s << 1) + m | 0;u = g[ea + (s + I | 0) | 0] << 3;q = 0;while (1) { - w = q << 1;z = w + B | 0;h[z >> 1] = k[z >> 1] - (32768 - o(u, h[w + G >> 1]) >>> 16 | 0);q = q + 1 | 0;if ((F | 0) != (q | 0)) { - continue; - }break; - }s = s + 1 | 0;if ((A | 0) != (s | 0)) { - continue; - }break; - } - }G = t << 2;u = G + _ | 0;w = G + ba | 0;z = i[w >> 2];q = 0;while (1) { - s = q << 2;i[s + z >> 2] = i[s + i[(i[u >> 2] << 2) + fa >> 2] >> 2];q = q + 1 | 0;if ((L | 0) != (q | 0)) { - continue; - }break; - }i[i[w >> 2] + (P << 2) >> 2] = i[G + $ >> 2];t = t + 1 | 0;if ((Z | 0) != (t | 0)) { - continue; - }break; - }t = 0;if (y) { - break m; - }while (1) { - p = t << 2;z = i[p + fa >> 2];s = i[p + ba >> 2];q = 0;while (1) { - p = q << 2;i[p + z >> 2] = i[p + s >> 2];q = q + 1 | 0;if ((L | 0) != (q | 0)) { - continue; - }break; - }t = t + 1 | 0;if ((Z | 0) != (t | 0)) { - continue; - }break; - }q = 0;if (y) { - break m; - }while (1) { - p = q << 2;i[p + J >> 2] = i[p + aa >> 2];q = q + 1 | 0;if ((Z | 0) != (q | 0)) { - continue; - }break; - } - }t = v;P = P + 1 | 0;if ((L | 0) != (P | 0)) { - continue; - }break; - }q = 0;if ((L | 0) <= 0) { - break l; - }while (1) { - m = q << 2;p = i[m + i[ba >> 2] >> 2];i[m + N >> 2] = p;W(n, p, i[e + 12 >> 2] + T | 0);q = q + 1 | 0;if ((L | 0) != (q | 0)) { - continue; - }break; - }if ((L | 0) < 1 | (A | 0) < 1) { - break l; - }u = 0;while (1) { - e = i[(u << 2) + N >> 2];n = (e | 0) < (Q | 0);m = o(A, e - (n ? 0 : Q) | 0);e = o(u, A);q = 0;p = 0;q: { - if (!n) { - while (1) { - i[da + (e + q << 2) >> 2] = 0 - (g[ea + (m + q | 0) | 0] << 9);q = q + 1 | 0;if ((A | 0) != (q | 0)) { - continue; - }break q; - } - }while (1) { - i[da + (e + p << 2) >> 2] = g[ea + (m + p | 0) | 0] << 9;p = p + 1 | 0;if ((A | 0) != (p | 0)) { - continue; - }break; - } - }u = u + 1 | 0;if ((L | 0) != (u | 0)) { - continue; - }break; - } - }r: { - if ((j | 0) >= 1) { - q = 0;while (1) { - m = q << 2;e = m + l | 0;i[e >> 2] = i[m + da >> 2] + i[e >> 2];q = q + 1 | 0;if ((q | 0) != (j | 0)) { - continue; - }break; - }if (!r) { - break a; - }y = V + ha | 0;l = S + y | 0;e = l;if ((j | 0) < 1) { - break r; - }q = 0;while (1) { - h[l + (q << 1) >> 1] = i[da + (q << 2) >> 2] + 32 >>> 6;q = q + 1 | 0;if ((q | 0) != (j | 0)) { - continue; - }break; - }ka(l, b, c, d, l, j, f, y);if ((j | 0) < 1) { - break a; - }q = 0;while (1) { - c = q << 1;b = c + a | 0;h[b >> 1] = k[b >> 1] - (h[c + l >> 1] + 2 >>> 2 | 0);q = q + 1 | 0;if ((q | 0) != (j | 0)) { - continue; - }break; - }break a; - }if (!r) { - break a; - }y = V + ha | 0;e = S + y | 0; - }ka(e, b, c, d, e, j, f, y);break a; - }n = 0 - B | 0;q = 0;if ((j | 0) > 0) { - while (1) { - m = q << 2;e = m + l | 0;i[e >> 2] = i[m + O >> 2] + i[e >> 2];q = q + 1 | 0;if ((q | 0) != (j | 0)) { - continue; - }break; - }if (!r) { - break a; - }e = B + I | 0;l = e + n | 0;q = 0;while (1) { - h[l + (q << 1) >> 1] = i[O + (q << 2) >> 2] + 32 >>> 6;q = q + 1 | 0;if ((q | 0) != (j | 0)) { - continue; - }break; - }ka(l, b, c, d, l, j, f, e);q = 0;while (1) { - c = q << 1;b = c + a | 0;h[b >> 1] = k[b >> 1] - (h[c + l >> 1] + 2 >>> 2 | 0);q = q + 1 | 0;if ((q | 0) != (j | 0)) { - continue; - }break; - }break a; - }if (!r) { - break a; - }e = B + I | 0;a = e + n | 0;ka(a, b, c, d, a, j, f, e); - }H = R + 16 | 0; - }function Sb(a, b, c, d, e, f, l, m, n, p, q, r, s, t, u, v, w, x, y, z) { - a = a | 0;b = b | 0;c = c | 0;d = d | 0;e = e | 0;f = f | 0;l = l | 0;m = m | 0;n = n | 0;p = p | 0;q = q | 0;r = r | 0;s = s | 0;t = t | 0;u = u | 0;v = v | 0;w = w | 0;x = x | 0;y = y | 0;z = z | 0;var A = 0, - B = 0, - C = 0, - D = 0, - E = 0, - F = 0, - G = 0, - I = 0, - J = 0, - K = 0, - L = 0, - M = 0, - N = 0, - O = 0, - P = 0, - Q = 0, - R = 0, - S = 0, - T = 0, - V = 0, - Y = 0, - Z = 0, - $ = 0, - ba = 0, - ca = 0, - da = 0, - ea = 0, - fa = 0, - ga = 0, - ha = 0, - ia = 0, - ja = 0, - ka = 0, - la = 0, - ma = 0, - na = 0, - oa = 0, - pa = 0, - qa = 0;B = H - 80 | 0;H = B;a: { - b: { - c: { - if ((n | 0) >= (m | 0)) { - p = (w | 0) < 10 ? w : 10;Q = (p | 0) > 1 ? p : 1;J = 0 - t & 3;A = i[l + 4 >> 2];F = i[l >> 2];if ((r | 0) <= 0) { - break b; - }w = 0;break c; - }W(s, 0, i[l + 8 >> 2]);W(s, 0, i[l + 4 >> 2]);U(f, 0, r << 2);break a; - }while (1) { - p = h[(w << 1) + a >> 1];G = p >> 31;if ((G ^ p + G) < 16384) { - w = w + 1 | 0;if ((w | 0) != (r | 0)) { - continue; - }break b; - }break; - }Z = 1; - }G = Q << 2;$ = t + J | 0;w = 0 - n | 0;d: { - if ((w | 0) >= (r | 0)) { - break d; - }while (1) { - p = h[(w << 1) + u >> 1];t = p >> 31;if ((t ^ p + t) < 16384) { - w = w + 1 | 0;if ((w | 0) != (r | 0)) { - continue; - }break d; - }break; - }Z = 1; - }t = G + $ | 0;p = (n - m | 0) + 1 | 0;da = (Q | 0) > (p | 0) ? p : Q;e: { - if ((m | 0) != (n | 0)) { - Ia(b, m, n, r, $, 0, da, t);break e; - }i[$ >> 2] = n; - }L = r << 1;R = r << 2;ea = t + (0 - t & 3) | 0;b = R + ea | 0;G = (b & 1) + b | 0;b = L + G | 0;fa = (b & 1) + b | 0;if ((da | 0) >= 1) { - na = 1 << A;ba = F + (x << 2 << A) | 0;b = L + fa | 0;F = (b & 1) + b | 0;b = F + o(r, 6) | 0;b = (b + L | 0) + (b & 1) | 0;ga = (0 - b & 3) + b | 0;ka = q << 2;K = b - L | 0;x = F + (L << 1) | 0;J = F + L | 0;b = (y | 0) > 2 ? y : 2;P = o((b | 0) < 30 ? b : 30, 655);b = r >> 2;la = r + -1 | 0;Q = !Z;oa = (A | 0) == 31;ha = -1;while (1) { - E = i[(ia << 2) + $ >> 2];pa = U(f, 0, R);N = i[z >> 2];i[B + 76 >> 2] = x;i[B + 72 >> 2] = J;i[B + 68 >> 2] = F;w = 0;n = Q;f: { - if ((r | 0) < 1) { - break f; - }while (1) { - n = w << 1;h[n + G >> 1] = k[a + n >> 1];w = w + 1 | 0;if ((w | 0) != (r | 0)) { - continue; - }break; - }t = 1 - E | 0;w = 0;while (1) { - y = (w << 1) + K | 0;p = t + w | 0;g: { - if ((p | 0) >= 0) { - p = p - E | 0;n = 0;if ((p | 0) > -1) { - break g; - } - }n = k[(p << 1) + u >> 1]; - }h[y >> 1] = n;w = w + 1 | 0;if ((w | 0) != (r | 0)) { - continue; - }break; - }w = 0;p = 0;n = 1;if (!Z) { - break f; - }while (1) { - n = (p << 1) + K | 0;h[n >> 1] = h[n >> 1] >>> 1;p = p + 1 | 0;if ((r | 0) != (p | 0)) { - continue; - }break; - }while (1) { - n = G + (w << 1) | 0;h[n >> 1] = h[n >> 1] >>> 1;w = w + 1 | 0;if ((w | 0) != (r | 0)) { - continue; - }break; - }n = 0; - }h: { - if ((q | 0) <= 0) { - _(K, c, K, r, q, ga);break h; - }p = U(ga, 0, ka);_(K, c, K, r, q, p);U(p, 0, ka); - }aa(K, d, e, K, r, q, ga);w = 0;i: { - j: { - k: { - if ((r | 0) <= 0) { - D = n ^ 1;y = E ^ -1;break k; - }while (1) { - p = w << 1;h[p + x >> 1] = k[p + K >> 1];w = w + 1 | 0;if ((w | 0) != (r | 0)) { - continue; - }break; - }D = n ^ 1;y = E ^ -1;if ((r | 0) > 1) { - break j; - } - }h[J >> 1] = o(h[v >> 1], h[u - (E << 1) >> 1] >> D) >>> 14;C = o(h[v >> 1], h[(y << 1) + u >> 1] >> D) >>> 14 | 0;h[F >> 1] = C;break i; - }t = h[u - (E << 1) >> 1] >> D;h[J >> 1] = o(t, h[v >> 1]) >>> 14;w = 0;while (1) { - n = w + 1 | 0;p = n << 1;h[p + J >> 1] = k[x + (w << 1) >> 1] + (o(t, h[p + v >> 1]) - -8192 >>> 14 | 0);w = n;if ((la | 0) != (w | 0)) { - continue; - }break; - }t = h[(y << 1) + u >> 1] >> D;C = o(t, h[v >> 1]) >>> 14 | 0;h[F >> 1] = C;w = 0;while (1) { - n = w + 1 | 0;p = n << 1;h[p + F >> 1] = k[J + (w << 1) >> 1] + (o(t, h[p + v >> 1]) - -8192 >>> 14 | 0);w = n;if ((la | 0) != (w | 0)) { - continue; - }break; - } - }S = 0;t = 0;D = 0;n = 0;y = 0;T = 0;A = 0;V = 0;Y = 0;I = 0;if (b) { - p = F;n = b;w = G;while (1) { - I = (((o(h[w + 2 >> 1], h[p + 2 >> 1]) + o(h[w >> 1], C << 16 >> 16) | 0) + o(h[w + 4 >> 1], h[p + 4 >> 1]) | 0) + o(h[w + 6 >> 1], h[p + 6 >> 1]) >> 6) + I | 0;n = n + -1 | 0;if (n) { - w = w + 8 | 0;p = p + 8 | 0;C = k[p >> 1];continue; - } else { - w = J;n = b;p = G;while (1) { - Y = (((o(h[p + 2 >> 1], h[w + 2 >> 1]) + o(h[p >> 1], h[w >> 1]) | 0) + o(h[p + 4 >> 1], h[w + 4 >> 1]) | 0) + o(h[p + 6 >> 1], h[w + 6 >> 1]) >> 6) + Y | 0;p = p + 8 | 0;w = w + 8 | 0;n = n + -1 | 0;if (n) { - continue; - }break; - }w = x;n = b;p = G;while (1) { - V = (((o(h[p + 2 >> 1], h[w + 2 >> 1]) + o(h[p >> 1], h[w >> 1]) | 0) + o(h[p + 4 >> 1], h[w + 4 >> 1]) | 0) + o(h[p + 6 >> 1], h[w + 6 >> 1]) >> 6) + V | 0;p = p + 8 | 0;w = w + 8 | 0;n = n + -1 | 0;if (n) { - continue; - }break; - }w = F;p = b;while (1) { - n = h[w + 2 >> 1];A = o(n, n);n = h[w >> 1];A = A + o(n, n) | 0;n = h[w + 4 >> 1];A = A + o(n, n) | 0;n = h[w + 6 >> 1];t = (A + o(n, n) >>> 6 | 0) + t | 0;w = w + 8 | 0;p = p + -1 | 0;if (p) { - continue; - }break; - }w = J;n = b;p = F;while (1) { - T = (((o(h[p + 2 >> 1], h[w + 2 >> 1]) + o(h[p >> 1], h[w >> 1]) | 0) + o(h[p + 4 >> 1], h[w + 4 >> 1]) | 0) + o(h[p + 6 >> 1], h[w + 6 >> 1]) >> 6) + T | 0;p = p + 8 | 0;w = w + 8 | 0;n = n + -1 | 0;if (n) { - continue; - }break; - }w = J;A = b;p = i[B + 72 >> 2];n = p;while (1) { - D = (((o(h[n + 2 >> 1], h[w + 2 >> 1]) + o(h[n >> 1], h[w >> 1]) | 0) + o(h[n + 4 >> 1], h[w + 4 >> 1]) | 0) + o(h[n + 6 >> 1], h[w + 6 >> 1]) >> 6) + D | 0;n = n + 8 | 0;w = w + 8 | 0;A = A + -1 | 0;if (A) { - continue; - }break; - }w = x;A = b;n = F;while (1) { - y = (((o(h[n + 2 >> 1], h[w + 2 >> 1]) + o(h[n >> 1], h[w >> 1]) | 0) + o(h[n + 4 >> 1], h[w + 4 >> 1]) | 0) + o(h[n + 6 >> 1], h[w + 6 >> 1]) >> 6) + y | 0;n = n + 8 | 0;w = w + 8 | 0;A = A + -1 | 0;if (A) { - continue; - }break; - }A = 0;w = x;n = b;while (1) { - A = (((o(h[p + 2 >> 1], h[w + 2 >> 1]) + o(h[p >> 1], h[w >> 1]) | 0) + o(h[p + 4 >> 1], h[w + 4 >> 1]) | 0) + o(h[p + 6 >> 1], h[w + 6 >> 1]) >> 6) + A | 0;p = p + 8 | 0;w = w + 8 | 0;n = n + -1 | 0;if (n) { - continue; - }break; - }n = 0;w = i[B + 76 >> 2];p = x;C = b;while (1) { - n = (((o(h[w + 2 >> 1], h[p + 2 >> 1]) + o(h[w >> 1], h[p >> 1]) | 0) + o(h[w + 4 >> 1], h[p + 4 >> 1]) | 0) + o(h[w + 6 >> 1], h[p + 6 >> 1]) >> 6) + n | 0;w = w + 8 | 0;p = p + 8 | 0;C = C + -1 | 0;if (C) { - continue; - }break; - } - }break; - } - }i[B + 52 >> 2] = y << 1;i[B + 48 >> 2] = T << 1;i[B + 44 >> 2] = A << 1;i[B + 40 >> 2] = I << 1;i[B + 36 >> 2] = Y << 1;i[B + 32 >> 2] = V << 1;i[B + 64 >> 2] = ((o(t & 32767, P) >>> 15 | 0) + t | 0) + o(t << 1 >> 16, P);i[B + 60 >> 2] = ((o(D & 32767, P) >>> 15 | 0) + D | 0) + o(D << 1 >> 16, P);i[B + 56 >> 2] = ((o(n & 32767, P) >>> 15 | 0) + n | 0) + o(n << 1 >> 16, P);wa(B + 32 | 0, B, 32767, 9);if (!oa) { - T = (N | 0) > 262144 ? 31 : 128;t = -2147483647;D = 0;V = h[B + 16 >> 1];Y = h[B + 14 >> 1];I = h[B + 12 >> 1];N = h[B + 10 >> 1];C = h[B + 8 >> 1];A = h[B + 6 >> 1];y = h[B + 4 >> 1];w = h[B + 2 >> 1];p = h[B >> 1];while (1) { - ca = (D << 2) + ba | 0;O = g[ca + 1 | 0] + 32 | 0;M = g[ca | 0] + 32 | 0;n = g[ca + 2 | 0] + 32 | 0;n = ((o(O, w) << 6) + (o(M, p) << 6) | 0) + (o(n, y) << 6) - (((((o(A, o(M, O) << 16 >> 16) + o(I, o(M, M) & 65535) | 0) + o(Y, o(O, O) & 65535) | 0) + o(V, o(n, n) & 65535) | 0) + o(C, o(n, O) << 16 >> 16) | 0) + o(N, o(n, M) << 16 >> 16)) | 0;M = (n | 0) > (t | 0);O = n;n = (T | 0) < g[ca + 3 | 0];t = M ? n ? t : O : t;S = M ? n ? S : D : S;D = D + 1 | 0;if ((na | 0) != (D | 0)) { - continue; - }break; - } - }p = S << 2;A = g[(p | 1) + ba | 0];n = g[(p | 2) + ba | 0];y = g[p + ba | 0];I = U(pa, 0, R);N = n + 32 | 0;C = E + 1 | 0;w = (C | 0) > (r | 0) ? r : C;if ((w | 0) > 0) { - t = N << 7;n = 0;while (1) { - p = I + (n << 2) | 0;i[p >> 2] = i[p >> 2] + o(t, h[(n - C << 1) + u >> 1]);n = n + 1 | 0;if ((w | 0) != (n | 0)) { - continue; - }break; - } - }C = C + E | 0;t = (C | 0) < (r | 0) ? C : r;if ((w | 0) < (t | 0)) { - p = N << 7;while (1) { - n = I + (w << 2) | 0;i[n >> 2] = i[n >> 2] + o(p, h[(w - C << 1) + u >> 1]);w = w + 1 | 0;if ((t | 0) != (w | 0)) { - continue; - }break; - } - }C = A + 32 | 0;w = (E | 0) > (r | 0) ? r : E;if ((w | 0) > 0) { - t = C << 7;n = 0;while (1) { - p = I + (n << 2) | 0;i[p >> 2] = i[p >> 2] + o(t, h[(n - E << 1) + u >> 1]);n = n + 1 | 0;if ((w | 0) != (n | 0)) { - continue; - }break; - } - }A = E << 1;t = (A | 0) < (r | 0) ? A : r;if ((w | 0) < (t | 0)) { - p = C << 7;while (1) { - n = I + (w << 2) | 0;i[n >> 2] = i[n >> 2] + o(p, h[(w - A << 1) + u >> 1]);w = w + 1 | 0;if ((t | 0) != (w | 0)) { - continue; - }break; - } - }A = y + 32 | 0;y = E + -1 | 0;w = (y | 0) > (r | 0) ? r : y;if ((w | 0) >= 1) { - t = A << 7;n = 0;while (1) { - p = I + (n << 2) | 0;i[p >> 2] = i[p >> 2] + o(t, h[(n - y << 1) + u >> 1]);n = n + 1 | 0;if ((w | 0) != (n | 0)) { - continue; - }break; - } - }y = y + E | 0;t = (y | 0) < (r | 0) ? y : r;if ((w | 0) < (t | 0)) { - p = A << 7;while (1) { - n = I + (w << 2) | 0;i[n >> 2] = i[n >> 2] + o(p, h[(w - y << 1) + u >> 1]);w = w + 1 | 0;if ((t | 0) != (w | 0)) { - continue; - }break; - } - }if ((r | 0) > 0) { - n = 0;while (1) { - t = n << 1;p = t + G | 0;h[p >> 1] = k[p >> 1] - (((o(C, h[t + J >> 1]) + o(A, h[t + x >> 1]) | 0) + o(N, h[t + F >> 1]) << 10) + 32768 >>> 16 | 0);n = n + 1 | 0;if ((r | 0) != (n | 0)) { - continue; - }break; - } - }n = 0;w = G;t = b;if (t) { - while (1) { - p = n;n = h[w + 2 >> 1];y = o(n, n);n = h[w >> 1];y = y + o(n, n) | 0;n = h[w + 4 >> 1];y = y + o(n, n) | 0;n = h[w + 6 >> 1];n = p + (y + o(n, n) >>> 6 | 0) | 0;w = w + 8 | 0;t = t + -1 | 0;if (t) { - continue; - }break; - } - }if (!((n | 0) >= (ha | 0) ? (ha | 0) >= 0 : 0)) { - X(ea, I, R);X(fa, G, L);ha = n;ma = S;qa = E; - }ia = ia + 1 | 0;if ((ia | 0) != (da | 0)) { - continue; - }break; - } - }W(s, qa - m | 0, i[l + 8 >> 2]);W(s, ma, i[l + 4 >> 2]);d = i[z >> 2];c = (d | 0) < 1024;b = j[i[l >> 2] + (ma << 2 | 3) | 0] << 24 >> 16;i[z >> 2] = o(b, c ? 0 : d << 3 >> 16) + (o(b, c ? 1024 : d & 8191) >> 13);X(f, ea, R);b = X(a, fa, L);if (!(!Z | (r | 0) < 1)) { - while (1) { - a = b + (ja << 1) | 0;h[a >> 1] = k[a >> 1] << 1;ja = ja + 1 | 0;if ((ja | 0) != (r | 0)) { - continue; - }break; - } - }m = E; - }H = B + 80 | 0;return m | 0; - }function ub(a, b, c, d) { - a = a | 0;b = b | 0;c = c | 0;d = d | 0;var e = 0, - f = 0, - i = 0, - j = 0, - l = 0, - m = 0, - n = 0, - p = 0, - q = 0, - r = 0, - s = 0, - t = 0, - u = 0, - v = 0, - w = 0, - x = 0, - y = 0, - z = 0;r = H - 32 | 0;H = r;a: { - b: { - if ((c | 0) < 1) { - break b; - }while (1) { - f = e << 1;h[f + b >> 1] = k[a + f >> 1];e = e + 1 | 0;if ((e | 0) != (c | 0)) { - continue; - }break; - }if ((c | 0) < 1) { - break b; - }f = h[b >> 1];n = r;l = c + -1 | 0;e = 25736;c: { - if (!l) { - break c; - }e = k[b + 2 >> 1]; - }e = e - f | 0;h[n >> 1] = 81920 / (((e << 16 >> 16 < (f | 0) ? e : f) << 16) + 19660800 >> 16);e = 1;if ((c | 0) != 1) { - while (1) { - n = e << 1;f = n + b | 0;q = k[f >> 1];m = q - k[f + -2 >> 1] << 16 >> 16;f = e + 1 | 0;e = ((e | 0) != (l | 0) ? k[(f << 1) + b >> 1] : 25736) - q | 0;h[n + r >> 1] = 81920 / (((e << 16 >> 16 < (m | 0) ? e : m) << 16) + 19660800 >> 16);e = f;if ((e | 0) != (c | 0)) { - continue; - }break; - } - }if ((c | 0) < 1) { - break b; - }e = 0;while (1) { - f = (e << 1) + b | 0;e = e + 1 | 0;h[f >> 1] = k[f >> 1] - (e << 11);if ((c | 0) != (e | 0)) { - continue; - }break; - }if ((c | 0) < 1) { - break b; - }q = 2147483647;m = 0;f = 8848;l = 0;while (1) { - n = 0;e = f;s = 0;while (1) { - p = n;n = k[(s << 1) + b >> 1] - (g[e | 0] << 5) << 16 >> 16;n = p + o(n, n) | 0;e = e + 1 | 0;s = s + 1 | 0;if ((s | 0) != (c | 0)) { - continue; - }break; - }e = (n | 0) < (q | 0);m = e ? l : m;q = e ? n : q;f = c + f | 0;l = l + 1 | 0;if ((l | 0) != 64) { - continue; - }break; - }f = o(c, m);e = 0;while (1) { - l = (e << 1) + b | 0;h[l >> 1] = k[l >> 1] - (g[(e + f | 0) + 8848 | 0] << 5);e = e + 1 | 0;if ((e | 0) != (c | 0)) { - continue; - }break; - }W(d, m, 6);e = 0;if ((c | 0) <= 0) { - break a; - }while (1) { - f = (e << 1) + b | 0;h[f >> 1] = k[f >> 1] << 1;e = e + 1 | 0;if ((e | 0) != (c | 0)) { - continue; - }break; - }break a; - }W(d, 0, 6); - }t = k[b >> 1];u = k[b + 8 >> 1];v = k[b + 6 >> 1];w = k[b + 4 >> 1];i = k[b + 2 >> 1];l = 2147483647;f = 0;e = 9488;n = h[r + 8 >> 1];q = h[r + 6 >> 1];s = h[r + 4 >> 1];y = h[r + 2 >> 1];z = h[r >> 1];m = 0;while (1) { - j = t - (g[e | 0] << 5) << 16 >> 16;j = o(j, j);p = (o(z, j & 32767) >> 15) + o(z, j << 1 >> 16) | 0;j = i - (g[e + 1 | 0] << 5) << 16 >> 16;j = o(j, j);p = (p + (o(y, j & 32767) >> 15) | 0) + o(y, j << 1 >> 16) | 0;j = w - (g[e + 2 | 0] << 5) << 16 >> 16;j = o(j, j);p = (p + (o(s, j & 32767) >> 15) | 0) + o(s, j << 1 >> 16) | 0;j = v - (g[e + 3 | 0] << 5) << 16 >> 16;j = o(j, j);p = (p + (o(q, j & 32767) >> 15) | 0) + o(q, j << 1 >> 16) | 0;j = u - (g[e + 4 | 0] << 5) << 16 >> 16;j = o(j, j);x = (p + (o(n, j & 32767) >> 15) | 0) + o(n, j << 1 >> 16) | 0;j = (x | 0) < (l | 0);l = j ? x : l;f = j ? m : f;e = e + 5 | 0;m = m + 1 | 0;if ((m | 0) != 64) { - continue; - }break; - }e = o(f, 5);h[b >> 1] = k[b >> 1] - (g[e + 9488 | 0] << 5);h[b + 2 >> 1] = k[b + 2 >> 1] - (g[e + 9489 | 0] << 5);h[b + 4 >> 1] = k[b + 4 >> 1] - (g[e + 9490 | 0] << 5);h[b + 6 >> 1] = k[b + 6 >> 1] - (g[e + 9491 | 0] << 5);h[b + 8 >> 1] = k[b + 8 >> 1] - (g[e + 9492 | 0] << 5);W(d, f, 6);j = k[b >> 1] << 1;h[b >> 1] = j;t = k[b + 2 >> 1] << 1;h[b + 2 >> 1] = t;u = k[b + 4 >> 1] << 1;h[b + 4 >> 1] = u;v = k[b + 6 >> 1] << 1;h[b + 6 >> 1] = v;w = k[b + 8 >> 1] << 1;h[b + 8 >> 1] = w;m = 2147483647;f = 0;e = 9808;l = 0;while (1) { - p = f;f = j - (g[e | 0] << 5) << 16 >> 16;f = o(f, f);i = (o(z, f & 32764) >> 15) + o(z, f << 1 >> 16) | 0;f = t - (g[e + 1 | 0] << 5) << 16 >> 16;f = o(f, f);i = (i + (o(y, f & 32764) >> 15) | 0) + o(y, f << 1 >> 16) | 0;f = u - (g[e + 2 | 0] << 5) << 16 >> 16;f = o(f, f);i = (i + (o(s, f & 32764) >> 15) | 0) + o(s, f << 1 >> 16) | 0;f = v - (g[e + 3 | 0] << 5) << 16 >> 16;f = o(f, f);i = (i + (o(q, f & 32764) >> 15) | 0) + o(q, f << 1 >> 16) | 0;f = w - (g[e + 4 | 0] << 5) << 16 >> 16;f = o(f, f);i = (i + (o(n, f & 32764) >> 15) | 0) + o(n, f << 1 >> 16) | 0;x = (i | 0) < (m | 0);f = x ? l : p;l = l + 1 | 0;if ((l | 0) != 64) { - m = x ? i : m;e = e + 5 | 0;continue; - }break; - }e = o(f, 5);h[b + 8 >> 1] = w - (g[e + 9812 | 0] << 5);h[b + 6 >> 1] = v - (g[e + 9811 | 0] << 5);h[b + 4 >> 1] = u - (g[e + 9810 | 0] << 5);h[b + 2 >> 1] = t - (g[e + 9809 | 0] << 5);h[b >> 1] = j - (g[e + 9808 | 0] << 5);W(d, f, 6);j = k[b + 10 >> 1];t = k[b + 18 >> 1];u = k[b + 16 >> 1];v = k[b + 14 >> 1];w = k[b + 12 >> 1];l = 2147483647;f = 0;e = 10128;n = h[r + 18 >> 1];q = h[r + 16 >> 1];s = h[r + 14 >> 1];y = h[r + 12 >> 1];z = h[r + 10 >> 1];m = 0;while (1) { - i = j - (g[e | 0] << 5) << 16 >> 16;i = o(i, i);p = (o(z, i & 32767) >> 15) + o(z, i << 1 >> 16) | 0;i = w - (g[e + 1 | 0] << 5) << 16 >> 16;i = o(i, i);p = (p + (o(y, i & 32767) >> 15) | 0) + o(y, i << 1 >> 16) | 0;i = v - (g[e + 2 | 0] << 5) << 16 >> 16;i = o(i, i);p = (p + (o(s, i & 32767) >> 15) | 0) + o(s, i << 1 >> 16) | 0;i = u - (g[e + 3 | 0] << 5) << 16 >> 16;i = o(i, i);p = (p + (o(q, i & 32767) >> 15) | 0) + o(q, i << 1 >> 16) | 0;i = t - (g[e + 4 | 0] << 5) << 16 >> 16;i = o(i, i);x = (p + (o(n, i & 32767) >> 15) | 0) + o(n, i << 1 >> 16) | 0;i = (x | 0) < (l | 0);l = i ? x : l;f = i ? m : f;e = e + 5 | 0;m = m + 1 | 0;if ((m | 0) != 64) { - continue; - }break; - }e = o(f, 5);h[b + 18 >> 1] = t - (g[e + 10132 | 0] << 5);h[b + 16 >> 1] = u - (g[e + 10131 | 0] << 5);h[b + 14 >> 1] = v - (g[e + 10130 | 0] << 5);h[b + 12 >> 1] = w - (g[e + 10129 | 0] << 5);h[b + 10 >> 1] = j - (g[e + 10128 | 0] << 5);W(d, f, 6);j = k[b + 10 >> 1] << 1;h[b + 10 >> 1] = j;t = k[b + 12 >> 1] << 1;h[b + 12 >> 1] = t;u = k[b + 14 >> 1] << 1;h[b + 14 >> 1] = u;v = k[b + 16 >> 1] << 1;h[b + 16 >> 1] = v;w = k[b + 18 >> 1] << 1;h[b + 18 >> 1] = w;m = 2147483647;f = 0;e = 10448;l = 0;while (1) { - p = f;f = j - (g[e | 0] << 5) << 16 >> 16;f = o(f, f);i = (o(z, f & 32764) >> 15) + o(z, f << 1 >> 16) | 0;f = t - (g[e + 1 | 0] << 5) << 16 >> 16;f = o(f, f);i = (i + (o(y, f & 32764) >> 15) | 0) + o(y, f << 1 >> 16) | 0;f = u - (g[e + 2 | 0] << 5) << 16 >> 16;f = o(f, f);i = (i + (o(s, f & 32764) >> 15) | 0) + o(s, f << 1 >> 16) | 0;f = v - (g[e + 3 | 0] << 5) << 16 >> 16;f = o(f, f);i = (i + (o(q, f & 32764) >> 15) | 0) + o(q, f << 1 >> 16) | 0;f = w - (g[e + 4 | 0] << 5) << 16 >> 16;f = o(f, f);i = (i + (o(n, f & 32764) >> 15) | 0) + o(n, f << 1 >> 16) | 0;x = (i | 0) < (m | 0);f = x ? l : p;l = l + 1 | 0;if ((l | 0) != 64) { - m = x ? i : m;e = e + 5 | 0;continue; - }break; - }e = o(f, 5);h[b + 18 >> 1] = w - (g[e + 10452 | 0] << 5);h[b + 16 >> 1] = v - (g[e + 10451 | 0] << 5);h[b + 14 >> 1] = u - (g[e + 10450 | 0] << 5);h[b + 12 >> 1] = t - (g[e + 10449 | 0] << 5);h[b + 10 >> 1] = j - (g[e + 10448 | 0] << 5);W(d, f, 6);e = 0;d: { - if ((c | 0) <= 0) { - break d; - }while (1) { - d = (e << 1) + b | 0;h[d >> 1] = h[d >> 1] + 2 >>> 2;e = e + 1 | 0;if ((e | 0) != (c | 0)) { - continue; - }break; - }e = 0;if ((c | 0) <= 0) { - break d; - }while (1) { - d = e << 1;f = d + b | 0;h[f >> 1] = k[a + d >> 1] - k[f >> 1];e = e + 1 | 0;if ((e | 0) != (c | 0)) { - continue; - }break; - } - }H = r + 32 | 0; - }function ra(a, b, c, d, e) { - var f = 0, - k = 0, - l = 0, - m = 0, - p = 0, - q = 0, - r = 0, - s = 0, - t = 0, - u = 0, - v = 0, - w = 0, - x = 0, - y = 0, - z = 0;f = H - 80 | 0;H = f;i[f + 76 >> 2] = b;z = f + 55 | 0;w = f + 56 | 0;b = 0;a: { - b: while (1) { - c: { - if ((t | 0) < 0) { - break c; - }if ((b | 0) > (2147483647 - t | 0)) { - i[3790] = 61;t = -1;break c; - }t = b + t | 0; - }d: { - e: { - f: { - p = i[f + 76 >> 2];b = p;l = j[b | 0];if (l) { - while (1) { - g: { - k = l & 255;h: { - if (!k) { - l = b;break h; - }if ((k | 0) != 37) { - break g; - }l = b;while (1) { - if (j[b + 1 | 0] != 37) { - break h; - }k = b + 2 | 0;i[f + 76 >> 2] = k;l = l + 1 | 0;m = j[b + 2 | 0];b = k;if ((m | 0) == 37) { - continue; - }break; - } - }b = l - p | 0;if (a) { - ja(a, p, b); - }if (b) { - continue b; - }u = -1;l = 1;k = f;b = i[f + 76 >> 2];if (!(j[b + 2 | 0] != 36 | g[i[f + 76 >> 2] + 1 | 0] + -48 >>> 0 >= 10)) { - u = g[b + 1 | 0] + -48 | 0;x = 1;l = 3; - }b = l + b | 0;i[k + 76 >> 2] = b;l = 0;v = g[b | 0];m = v + -32 | 0;i: { - if (m >>> 0 > 31) { - k = b;break i; - }k = b;m = 1 << m;if (!(m & 75913)) { - break i; - }while (1) { - k = b + 1 | 0;i[f + 76 >> 2] = k;l = l | m;v = g[b + 1 | 0];m = v + -32 | 0;if (m >>> 0 > 31) { - break i; - }b = k;m = 1 << m;if (m & 75913) { - continue; - }break; - } - }j: { - if ((v | 0) == 42) { - m = f;k: { - l: { - if (g[k + 1 | 0] + -48 >>> 0 >= 10) { - break l; - }b = i[f + 76 >> 2];if (j[b + 2 | 0] != 36) { - break l; - }i[((g[b + 1 | 0] << 2) + e | 0) + -192 >> 2] = 10;r = i[((g[b + 1 | 0] << 3) + d | 0) + -384 >> 2];x = 1;b = b + 3 | 0;break k; - }if (x) { - break f; - }x = 0;r = 0;if (a) { - b = i[c >> 2];i[c >> 2] = b + 4;r = i[b >> 2]; - }b = i[f + 76 >> 2] + 1 | 0; - }i[m + 76 >> 2] = b;if ((r | 0) > -1) { - break j; - }r = 0 - r | 0;l = l | 8192;break j; - }r = za(f + 76 | 0);if ((r | 0) < 0) { - break f; - }b = i[f + 76 >> 2]; - }q = -1;m: { - if (j[b | 0] != 46) { - break m; - }if (j[b + 1 | 0] == 42) { - n: { - if (g[b + 2 | 0] + -48 >>> 0 >= 10) { - break n; - }b = i[f + 76 >> 2];if (j[b + 3 | 0] != 36) { - break n; - }i[((g[b + 2 | 0] << 2) + e | 0) + -192 >> 2] = 10;q = i[((g[b + 2 | 0] << 3) + d | 0) + -384 >> 2];b = b + 4 | 0;i[f + 76 >> 2] = b;break m; - }if (x) { - break f; - }if (a) { - b = i[c >> 2];i[c >> 2] = b + 4;q = i[b >> 2]; - } else { - q = 0; - }b = i[f + 76 >> 2] + 2 | 0;i[f + 76 >> 2] = b;break m; - }i[f + 76 >> 2] = b + 1;q = za(f + 76 | 0);b = i[f + 76 >> 2]; - }k = 0;while (1) { - y = k;s = -1;if (g[b | 0] + -65 >>> 0 > 57) { - break a; - }v = b + 1 | 0;i[f + 76 >> 2] = v;k = g[b | 0];b = v;k = j[(k + o(y, 58) | 0) + 14063 | 0];if (k + -1 >>> 0 < 8) { - continue; - }break; - }if (!k) { - break a; - }o: { - p: { - q: { - if ((k | 0) == 19) { - if ((u | 0) <= -1) { - break q; - }break a; - }if ((u | 0) < 0) { - break p; - }i[(u << 2) + e >> 2] = k;b = (u << 3) + d | 0;k = i[b + 4 >> 2];i[f + 64 >> 2] = i[b >> 2];i[f + 68 >> 2] = k; - }b = 0;if (!a) { - continue b; - }break o; - }if (!a) { - break d; - }ya(f - -64 | 0, k, c);v = i[f + 76 >> 2]; - }m = l & -65537;l = l & 8192 ? m : l;s = 0;u = 14100;k = w;r: { - s: { - t: { - u: { - v: { - w: { - x: { - y: { - z: { - A: { - B: { - C: { - D: { - E: { - F: { - G: { - b = g[v + -1 | 0];b = y ? (b & 15) == 3 ? b & -33 : b : b;switch (b + -88 | 0) {case 11: - break r;case 9:case 13:case 14:case 15: - break s;case 27: - break x;case 12:case 17: - break A;case 23: - break B;case 0:case 32: - break C;case 24: - break D;case 22: - break E;case 29: - break F;case 1:case 2:case 3:case 4:case 5:case 6:case 7:case 8:case 10:case 16:case 18:case 19:case 20:case 21:case 25:case 26:case 28:case 30:case 31: - break e;default: - break G;} - }H: { - switch (b + -65 | 0) {case 0:case 4:case 5:case 6: - break s;case 2: - break v;case 1:case 3: - break e;default: - break H;} - }if ((b | 0) == 83) { - break w; - }break e; - }b = i[f + 64 >> 2];p = i[f + 68 >> 2];u = 14100;break z; - }b = 0;I: { - switch (y & 255) {case 0: - i[i[f + 64 >> 2] >> 2] = t;continue b;case 1: - i[i[f + 64 >> 2] >> 2] = t;continue b;case 2: - k = i[f + 64 >> 2];i[k >> 2] = t;i[k + 4 >> 2] = t >> 31;continue b;case 3: - h[i[f + 64 >> 2] >> 1] = t;continue b;case 4: - g[i[f + 64 >> 2]] = t;continue b;case 6: - i[i[f + 64 >> 2] >> 2] = t;continue b;case 7: - break I;default: - continue b;} - }k = i[f + 64 >> 2];i[k >> 2] = t;i[k + 4 >> 2] = t >> 31;continue b; - }q = q >>> 0 > 8 ? q : 8;l = l | 8;b = 120; - }p = Wa(i[f + 64 >> 2], i[f + 68 >> 2], w, b & 32);if (!(l & 8) | !(i[f + 64 >> 2] | i[f + 68 >> 2])) { - break y; - }u = (b >>> 4 | 0) + 14100 | 0;s = 2;break y; - }p = Va(i[f + 64 >> 2], i[f + 68 >> 2], w);if (!(l & 8)) { - break y; - }b = w - p | 0;q = (q | 0) > (b | 0) ? q : b + 1 | 0;break y; - }m = i[f + 68 >> 2];p = m;b = i[f + 64 >> 2];if ((m | 0) < -1 ? 1 : (m | 0) <= -1) { - p = 0 - (p + (0 < b >>> 0) | 0) | 0;b = 0 - b | 0;i[f + 64 >> 2] = b;i[f + 68 >> 2] = p;s = 1;u = 14100;break z; - }if (l & 2048) { - s = 1;u = 14101;break z; - }s = l & 1;u = s ? 14102 : 14100; - }p = Ua(b, p, w); - }l = (q | 0) > -1 ? l & -65537 : l;b = i[f + 64 >> 2];m = i[f + 68 >> 2];if (!(!!(b | m) | q)) { - q = 0;p = w;break e; - }b = !(b | m) + (w - p | 0) | 0;q = (q | 0) > (b | 0) ? q : b;break e; - }b = i[f + 64 >> 2];p = b ? b : 14110;b = Ta(p, q);k = b ? b : p + q | 0;l = m;q = b ? b - p | 0 : q;break e; - }k = i[f + 64 >> 2];if (q) { - break u; - }b = 0;ea(a, 32, r, 0, l);break t; - }i[f + 12 >> 2] = 0;i[f + 8 >> 2] = i[f + 64 >> 2];i[f + 64 >> 2] = f + 8;q = -1;k = f + 8 | 0; - }b = 0;J: { - while (1) { - p = i[k >> 2];if (!p) { - break J; - }p = Qa(f + 4 | 0, p);m = (p | 0) < 0;if (!(m | p >>> 0 > q - b >>> 0)) { - k = k + 4 | 0;b = b + p | 0;if (q >>> 0 > b >>> 0) { - continue; - }break J; - }break; - }s = -1;if (m) { - break a; - } - }ea(a, 32, r, b, l);if (!b) { - b = 0;break t; - }m = 0;k = i[f + 64 >> 2];while (1) { - p = i[k >> 2];if (!p) { - break t; - }p = Qa(f + 4 | 0, p);m = p + m | 0;if ((m | 0) > (b | 0)) { - break t; - }ja(a, f + 4 | 0, p);k = k + 4 | 0;if (m >>> 0 < b >>> 0) { - continue; - }break; - } - }ea(a, 32, r, b, l ^ 8192);b = (r | 0) > (b | 0) ? r : b;continue b; - }b = J[0](a, n[f + 64 >> 3], r, q, l, b) | 0;continue b; - }g[f + 55 | 0] = i[f + 64 >> 2];q = 1;p = z;l = m;break e; - }k = b + 1 | 0;i[f + 76 >> 2] = k;l = j[b + 1 | 0];b = k;continue; - } - }s = t;if (a) { - break a; - }if (!x) { - break d; - }b = 1;while (1) { - a = i[(b << 2) + e >> 2];if (a) { - ya((b << 3) + d | 0, a, c);s = 1;b = b + 1 | 0;if ((b | 0) != 10) { - continue; - }break a; - }break; - }s = 1;if (b >>> 0 >= 10) { - break a; - }while (1) { - if (i[(b << 2) + e >> 2]) { - break f; - }b = b + 1 | 0;if ((b | 0) != 10) { - continue; - }break; - }break a; - }s = -1;break a; - }m = k - p | 0;q = (q | 0) < (m | 0) ? m : q;k = q + s | 0;b = (r | 0) < (k | 0) ? k : r;ea(a, 32, b, k, l);ja(a, u, s);ea(a, 48, b, k, l ^ 65536);ea(a, 48, q, m, 0);ja(a, p, m);ea(a, 32, b, k, l ^ 8192);continue; - }break; - }s = 0; - }H = f + 80 | 0;return s; - }function jb(a, b, c) { - a = a | 0;b = b | 0;c = c | 0;var d = 0, - e = 0, - f = 0, - g = 0, - j = 0, - l = 0, - m = 0, - n = 0, - p = 0, - q = 0, - r = 0, - s = 0, - t = 0, - u = 0, - v = 0, - w = 0, - x = 0, - y = 0, - z = 0, - A = 0, - B = 0, - C = 0, - D = 0, - E = 0;r = H - 16 | 0;H = r;j = i[a + 40 >> 2];E = i[i[a >> 2] >> 2];e = i[a + 4 >> 2];C = (i[a + 12 >> 2] << 1) + c | 0;J[i[i[e >> 2] + 48 >> 2]](e, 104, C) | 0;e = i[a + 4 >> 2];e = J[i[i[e >> 2] + 40 >> 2]](e, b, c) | 0;f = i[a + 4 >> 2];J[i[i[f >> 2] + 48 >> 2]](f, 103, r + 12 | 0) | 0;a: { - if (e) { - break a; - }if (!b) { - Ca(a, c, i[r + 12 >> 2], j);e = 0;break a; - }b: { - if (!i[a + 88 >> 2]) { - d = i[a + 96 >> 2];break b; - }c: { - if (((i[b + 20 >> 2] ? -1 : (i[b + 4 >> 2] - i[b + 12 >> 2] | 0) - (i[b + 8 >> 2] << 3) | 0) | 0) >= 1) { - if (Fb(b)) { - break c; - } - }i[a + 96 >> 2] = 0;break b; - }V(b, 1);d = V(b, 3);i[a + 96 >> 2] = d;if (!d) { - d = 0;break b; - }if (i[i[a + 92 >> 2] + (d << 2) >> 2]) { - break b; - }i[r >> 2] = 13072;Y(i[3524], 13148, r);e = -2;break a; - }d: { - if (!i[i[a + 92 >> 2] + (d << 2) >> 2]) { - if (i[r + 12 >> 2]) { - break d; - }d = 0;b = i[a + 12 >> 2];if ((b | 0) > 0) { - while (1) { - h[(b + d << 1) + c >> 1] = 0;d = d + 1 | 0;if ((b | 0) != (d | 0)) { - continue; - }break; - } - }i[a + 28 >> 2] = 1;d = (b << 1) + c | 0;_(d, i[a + 60 >> 2], d, b, i[a + 24 >> 2], i[a + 64 >> 2]);ua(c, (i[a + 12 >> 2] << 1) + c | 0, c, i[a + 8 >> 2], i[a + 44 >> 2], i[a + 48 >> 2], j);e = 0;break a; - }d = i[a + 20 >> 2];e = i[a + 4 >> 2];A = j + (0 - j & 3) | 0;J[i[i[e >> 2] + 48 >> 2]](e, 100, A) | 0;e = i[a + 4 >> 2];j = (d << 2) + A | 0;B = (j & 1) + j | 0;J[i[i[e >> 2] + 48 >> 2]](e, 101, B) | 0;d = (d << 1) + B | 0;u = (d & 1) + d | 0;d = i[a + 24 >> 2];J[i[i[i[a + 92 >> 2] + (i[a + 96 >> 2] << 2) >> 2] + 20 >> 2]](u, d, b);d = d << 1;e = d + u | 0;x = (e & 1) + e | 0;j = x + d | 0;e = i[a + 24 >> 2];if (!(!i[a + 28 >> 2] | (e | 0) < 1)) { - f = i[a + 56 >> 2];d = 0;while (1) { - n = d << 1;h[n + f >> 1] = k[n + u >> 1];d = d + 1 | 0;if ((e | 0) != (d | 0)) { - continue; - }break; - } - }v = j + (j & 1) | 0;j = v + (e << 1) | 0;d = i[a + 20 >> 2];if ((d | 0) >= 1) { - D = a + 84 | 0;n = 0;while (1) { - g = (0 - j & 3) + j | 0;e = i[a + 16 >> 2];f = e << 2;j = g + f | 0;l = o(e, n);m = i[a + 12 >> 2];s = 0;e = i[a + 76 >> 2];if (e) { - s = e + (l << 2) | 0;U(s, 0, f);d = i[a + 20 >> 2]; - }fa(i[a + 56 >> 2], u, x, i[a + 24 >> 2], n, d);ga(x, i[a + 24 >> 2], 410);ha(x, v, i[a + 24 >> 2], j);f = 8192;p = n << 2;y = p + i[a + 68 >> 2] | 0;i[y >> 2] = 8192;d = 0;e = 8192;if (i[a + 24 >> 2] >= 1) { - while (1) { - q = f;f = d << 1;z = h[f + v >> 1];w = h[(f | 2) + v >> 1];f = q + (z + w | 0) | 0;i[y >> 2] = f;e = (e + w | 0) - z | 0;d = d + 2 | 0;if ((d | 0) < i[a + 24 >> 2]) { - continue; - }break; - } - }y = l << 1;z = (m << 1) + c | 0;d = i[p + A >> 2];f = U(g, 0, i[a + 16 >> 2] << 2);q = d << 7;d = e + 82 | 0;d = ((q + (d << 16 >> 17) | 0) + 10496 | 0) / (d | 0) | 0;d = (d | 0) > -32767 ? d : -32767;d = (d | 0) < 32767 ? d : 32767;e: { - if (!i[i[i[a + 92 >> 2] + (i[a + 96 >> 2] << 2) >> 2] + 40 >> 2]) { - g = (V(b, 5) << 16) + 16121856 | 0;m = g << 8 >> 16;e = 2147483647;f: { - if ((m | 0) > 21290) { - break f; - }e = 0;if (g >>> 8 << 16 >> 16 < -21290) { - break f; - }g = o(m, 23637) - -8192 | 0;e = g >>> 11 & 16376;e = (o((o((o(e, 1301) >>> 14 | 0) + 3726 | 0, e) << 2 & 536805376) + 744226816 >>> 16 | 0, e) << 2 & 2147418112) + 1073741824 >>> 16 | 0;g = g << 2;m = -2 - (g >> 27) | 0;e = g >> 16 < -4096 ? e >>> m | 0 : e << 0 - m; - }if (i[a + 16 >> 2] < 1) { - break e; - }d = ((d >> 1) + e | 0) / (d | 0) | 0;e = d << 6 & 32704;g = d << 7 >> 16;m = h[E + 22 >> 1] << 1;d = 0;while (1) { - p = d << 2;w = (d + l << 1) + C | 0;q = o(m, h[w >> 1]) >> 16;i[p + f >> 2] = (o(e, q) + 16384 >> 15) + o(g, q) << 14;q = f + (p | 4) | 0;p = o(m, h[w + 2 >> 1]) >> 16;i[q >> 2] = 0 - ((o(p, e) + 16384 >> 15) + o(g, p) << 14);d = d + 2 | 0;if ((d | 0) < i[a + 16 >> 2]) { - continue; - }break; - }break e; - }e = o(h[(V(b, 4) << 1) + 13040 >> 1], 28626) >>> 15 | 0;l = h[(n << 1) + B >> 1];g = i[a + 16 >> 2];if ((g | 0) == 80) { - e = o(e << 16 >> 16, 23170) - -8192 >> 14; - }m = i[i[a + 92 >> 2] + (i[a + 96 >> 2] << 2) >> 2];J[i[m + 40 >> 2]](f, i[m + 44 >> 2], g, b, j, D);l = ((o(l, e << 16 >> 16) << 3) + (d >> 1) | 0) / (d | 0) | 0;g = l << 11;da(f, f, g, i[a + 16 >> 2]);if (!i[i[i[a + 92 >> 2] + (i[a + 96 >> 2] << 2) >> 2] + 12 >> 2]) { - break e; - }d = 0;m = i[a + 16 >> 2] << 2;e = U((0 - j & 3) + j | 0, 0, m);p = i[i[a + 92 >> 2] + (i[a + 96 >> 2] << 2) >> 2];J[i[p + 40 >> 2]](e, i[p + 44 >> 2], i[a + 16 >> 2], b, e + m | 0, D);da(e, e, o(l << 12 >> 16, 13107) + (o(g & 30720, 13107) + 16384 >>> 15 | 0) | 0, i[a + 16 >> 2]);if (i[a + 16 >> 2] < 1) { - break e; - }while (1) { - l = d << 2;g = l + f | 0;i[g >> 2] = i[e + l >> 2] + i[g >> 2];d = d + 1 | 0;if ((d | 0) < i[a + 16 >> 2]) { - continue; - }break; - } - }l = y + z | 0;e = i[a + 16 >> 2];g: { - if (!i[a + 76 >> 2]) { - break g; - }d = 0;if ((e | 0) < 1) { - break g; - }while (1) { - g = d << 2;h[g + s >> 1] = i[f + g >> 2] - -8192 >>> 14;d = d + 1 | 0;if ((e | 0) != (d | 0)) { - continue; - }break; - } - }_(i[a + 52 >> 2], i[a + 60 >> 2], l, e, i[a + 24 >> 2], i[a + 64 >> 2]);e = i[a + 16 >> 2];if ((e | 0) >= 1) { - l = i[a + 52 >> 2];d = 0;while (1) { - h[l + (d << 1) >> 1] = i[f + (d << 2) >> 2] - -8192 >>> 14;d = d + 1 | 0;if ((e | 0) != (d | 0)) { - continue; - }break; - } - }f = i[a + 24 >> 2];if ((f | 0) >= 1) { - l = i[a + 60 >> 2];d = 0;while (1) { - s = d << 1;h[s + l >> 1] = k[v + s >> 1];d = d + 1 | 0;if ((f | 0) != (d | 0)) { - continue; - }break; - } - }d = Z(i[a + 52 >> 2], e);h[i[a + 72 >> 2] + (n << 1) >> 1] = d;e = o(d, d);d = i[a + 20 >> 2];t = ((e | 0) / (d | 0) | 0) + t | 0;n = n + 1 | 0;if ((n | 0) < (d | 0)) { - continue; - }break; - } - }e = 0;b = t >>> 0 > 65535;d = b << 3;q = d | 4;f = d;b = b ? t >>> 16 | 0 : t;d = b >>> 0 > 255;f = d ? q : f;b = d ? b >>> 8 | 0 : b;d = b >>> 0 > 15;b = (d ? f | 2 : f) | (d ? b >>> 4 | 0 : b) >>> 0 > 3;d = b << 1;f = b & 65535;d = (f >>> 0 > 6 ? t >> d + -12 : t << 12 - d) << 16 >> 16;d = (o((o(o(d, 16816) + -827523072 >> 16, d) << 2 & -65536) + 1387593728 >> 16, d) << 2 & -65536) + 238157824 >> 16;b = 13 - b | 0;h[a + 80 >> 1] = f >>> 0 < 13 ? d >> b : d << 0 - b;ua(c, (i[a + 12 >> 2] << 1) + c | 0, c, i[a + 8 >> 2], i[a + 44 >> 2], i[a + 48 >> 2], j);b = i[a + 24 >> 2];if ((b | 0) >= 1) { - c = i[a + 56 >> 2];d = 0;while (1) { - j = d << 1;h[j + c >> 1] = k[j + u >> 1];d = d + 1 | 0;if ((b | 0) != (d | 0)) { - continue; - }break; - } - }i[a + 28 >> 2] = 0;break a; - }Ca(a, c, 1, j);e = 0; - }H = r + 16 | 0;return e | 0; - }function ib(a, b, c) { - a = a | 0;b = b | 0;c = c | 0;var d = 0, - e = 0, - f = 0, - g = 0, - j = p(0), - l = p(0), - n = 0;e = H - 32 | 0;H = e;a: { - b: { - c: { - d: { - e: { - f: { - g: { - h: { - switch (b + -3 | 0) {case 98: - d = i[a + 20 >> 2];if ((d | 0) >= 1) { - break g; - }b = 0;break a;case 0: - i[c >> 2] = i[a + 8 >> 2];b = 0;break a;case 7: - b = i[c >> 2];i[a + 156 >> 2] = b;i[a + 152 >> 2] = b;b = 0;break a;case 5: - a = i[a + 4 >> 2];J[i[i[a >> 2] + 44 >> 2]](a, 8, c) | 0;b = 0;break a;case 31: - a = i[a + 4 >> 2];J[i[i[a >> 2] + 44 >> 2]](a, 34, c) | 0;b = 0;break a;case 32: - a = i[a + 4 >> 2];J[i[i[a >> 2] + 44 >> 2]](a, 35, c) | 0;b = 0;break a;case 6: - a = i[a + 4 >> 2];J[i[i[a >> 2] + 44 >> 2]](a, 9, c) | 0;b = 0;break a;case 3: - J[i[i[a >> 2] + 44 >> 2]](a, 4, c) | 0;b = 0;break a;case 9: - i[a + 108 >> 2] = i[c >> 2];a = i[a + 4 >> 2];J[i[i[a >> 2] + 44 >> 2]](a, 12, c) | 0;b = 0;break a;case 10: - i[c >> 2] = i[a + 108 >> 2];b = 0;break a;case 27: - i[a + 136 >> 2] = i[c >> 2];a = i[a + 4 >> 2];J[i[i[a >> 2] + 44 >> 2]](a, 30, c) | 0;b = 0;break a;case 28: - i[c >> 2] = i[a + 136 >> 2];b = 0;break a;case 11: - j = m[c >> 2];l = p(+j + .6);m[e + 24 >> 2] = l;m[a + 104 >> 2] = j;if (!(l > p(10) ^ 1)) { - i[e + 24 >> 2] = 1092616192; - }b = e;n = u(+m[c >> 2] + .5);i: { - if (q(n) < 2147483648) { - c = ~~n;break i; - }c = -2147483648; - }i[b + 28 >> 2] = (c | 0) < 10 ? c : 10;b = i[a + 4 >> 2];J[i[i[b >> 2] + 44 >> 2]](b, 14, e + 24 | 0) | 0;J[i[i[a >> 2] + 44 >> 2]](a, 4, e + 28 | 0) | 0;b = 0;break a;case 12: - i[c >> 2] = i[a + 104 >> 2];b = 0;break a;case 29: - d = i[c >> 2];i[a + 120 >> 2] = d;b = 0;i[a + 108 >> 2] = (d | 0) != 0;d = i[a + 4 >> 2];J[i[i[d >> 2] + 44 >> 2]](d, 12, a + 108 | 0) | 0;if (!i[a + 108 >> 2]) { - break a; - }i[e + 28 >> 2] = 10;c = i[c >> 2];while (1) { - j: { - J[i[i[a >> 2] + 44 >> 2]](a, 4, e + 28 | 0) | 0;J[i[i[a >> 2] + 44 >> 2]](a, 19, e + 24 | 0) | 0;b = i[e + 28 >> 2];if (i[e + 24 >> 2] <= (c | 0)) { - d = b;break j; - }d = b + -1 | 0;i[e + 28 >> 2] = d;if ((b | 0) > 0) { - continue; - } - }break; - }b = 0;m[e + 20 >> 2] = ((d | 0) > 0 ? d : 0) | 0;J[i[i[a >> 2] + 44 >> 2]](a, 14, e + 20 | 0) | 0;i[a + 124 >> 2] = 0;i[a + 128 >> 2] = 0;i[a + 132 >> 2] = 0;break a;case 30: - i[c >> 2] = i[a + 120 >> 2];b = 0;break a;case 1: - b = 0;c = i[c >> 2];c = (c | 0) > 0 ? c : 0;c = i[i[a >> 2] >> 2] + (((c | 0) < 10 ? c : 10) << 2) | 0;d = i[c + 104 >> 2];i[a + 156 >> 2] = d;i[a + 152 >> 2] = d;i[e + 28 >> 2] = i[c + 60 >> 2];a = i[a + 4 >> 2];J[i[i[a >> 2] + 44 >> 2]](a, 6, e + 28 | 0) | 0;break a;case 13: - b = i[a + 4 >> 2];J[i[i[b >> 2] + 44 >> 2]](b, 16, c) | 0;b = a;a = i[c >> 2];i[b + 160 >> 2] = (a | 0) > 1 ? a : 1;H = e + 32 | 0;return 0;case 14: - i[c >> 2] = i[a + 160 >> 2];b = 0;break a;case 15: - i[e + 28 >> 2] = 10;b = i[c >> 2];while (1) { - k: { - J[i[i[a >> 2] + 44 >> 2]](a, 4, e + 28 | 0) | 0;J[i[i[a >> 2] + 44 >> 2]](a, 19, e + 24 | 0) | 0;if (i[e + 24 >> 2] <= (b | 0)) { - break k; - }c = i[e + 28 >> 2];i[e + 28 >> 2] = c + -1;if ((c | 0) > 0) { - continue; - } - }break; - }b = 0;break a;case 16: - b = i[a + 4 >> 2];J[i[i[b >> 2] + 44 >> 2]](b, 19, c) | 0;b = i[a + 164 >> 2];d = i[i[a + 148 >> 2] + (i[a + 152 >> 2] << 2) >> 2];if (d) { - i[c >> 2] = i[c >> 2] + ((o(b, i[d + 52 >> 2]) | 0) / i[a + 8 >> 2] | 0);b = 0;break a; - }i[c >> 2] = i[c >> 2] + ((b << 2) / i[a + 8 >> 2] | 0);b = 0;break a;case 21: - b = i[c >> 2];i[a + 164 >> 2] = b;i[e + 28 >> 2] = b >> 1;a = i[a + 4 >> 2];J[i[i[a >> 2] + 44 >> 2]](a, 24, e + 28 | 0) | 0;b = 0;break a;case 22: - i[c >> 2] = i[a + 164 >> 2];b = 0;break a;case 23: - i[a + 32 >> 2] = 1;b = i[a + 28 >> 2];l: { - if ((b | 0) < 1) { - break l; - }d = b + 1 | 0;f = i[a + 68 >> 2];c = 0;while (1) { - g = f + (c << 1) | 0;c = c + 1 | 0;h[g >> 1] = (o(c << 16 >> 16, 25736) | 0) / (d | 0);if ((b | 0) != (c | 0)) { - continue; - }break; - }if ((b | 0) < 1) { - break l; - }d = i[a + 88 >> 2];f = i[a + 80 >> 2];g = i[a + 84 >> 2];c = 0;while (1) { - b = c << 2;i[b + g >> 2] = 0;i[b + f >> 2] = 0;i[b + d >> 2] = 0;c = c + 1 | 0;if ((c | 0) < i[a + 28 >> 2]) { - continue; - }break; - } - }c = i[a + 52 >> 2];d = i[a + 56 >> 2];b = 0;a = 0;while (1) { - f = a << 1;h[f + d >> 1] = 0;h[c + f >> 1] = 0;a = a + 1 | 0;if ((a | 0) != 64) { - continue; - }break; - }break a;case 33: - i[a + 144 >> 2] = i[c >> 2];a = i[a + 4 >> 2];J[i[i[a >> 2] + 44 >> 2]](a, 36, c) | 0;b = 0;break a;case 34: - i[c >> 2] = i[a + 144 >> 2];b = 0;break a;case 36: - a = i[a + 4 >> 2];J[i[i[a >> 2] + 44 >> 2]](a, 39, c) | 0;i[c >> 2] = (i[c >> 2] << 1) + 63;b = 0;break a;case 37: - a = i[a + 4 >> 2];J[i[i[a >> 2] + 44 >> 2]](a, 40, c) | 0;b = 0;break a;case 38: - a = i[a + 4 >> 2];J[i[i[a >> 2] + 44 >> 2]](a, 41, c) | 0;b = 0;break a;case 39: - d = i[c >> 2];i[a + 112 >> 2] = d;m: { - if ((d | 0) >= 42200) { - i[a + 116 >> 2] = 17600;b = -17600;break m; - }if ((d | 0) >= 27800) { - i[a + 116 >> 2] = 9600;b = -9600;break m; - }if ((d | 0) >= 20601) { - i[a + 116 >> 2] = 5600;b = -5600;break m; - }i[a + 116 >> 2] = 1800;b = -1800; - }c = e;if (i[a + 16 >> 2] == 80) { - i[a + 116 >> 2] = 1800;b = -1800; - }i[c + 28 >> 2] = b + d;a = i[a + 4 >> 2];J[i[i[a >> 2] + 44 >> 2]](a, 42, e + 28 | 0) | 0;b = 0;break a;case 40: - i[c >> 2] = i[a + 112 >> 2];b = 0;break a;case 41: - a = i[a + 4 >> 2];J[i[i[a >> 2] + 44 >> 2]](a, 44, c) | 0;b = 0;break a;case 42: - a = i[a + 4 >> 2];J[i[i[a >> 2] + 44 >> 2]](a, 45, c) | 0;b = 0;break a;case 103: - break c;case 102: - break d;case 101: - break e;case 26: - break f;case 97: - break h;default: - break b;} - }if (i[a + 20 >> 2] < 1) { - b = 0;break a; - }f = i[a + 92 >> 2];b = 0;while (1) { - g = d << 2;i[g + c >> 2] = i[f + g >> 2];d = d + 1 | 0;if ((d | 0) < i[a + 20 >> 2]) { - continue; - }break; - }break a; - }f = i[a + 96 >> 2];b = 0;a = 0;while (1) { - g = a << 1;h[g + c >> 1] = k[f + g >> 1];a = a + 1 | 0;if ((d | 0) != (a | 0)) { - continue; - }break; - }break a; - }i[c >> 2] = i[a + 140 >> 2];b = 0;break a; - }i[a + 100 >> 2] = c;b = 0;break a; - }a = i[a + 4 >> 2];J[i[i[a >> 2] + 44 >> 2]](a, 105, c) | 0;b = 0;break a; - }i[c >> 2] = i[a + 44 >> 2];b = 0;break a; - }i[e + 4 >> 2] = b;i[e >> 2] = 13123;Y(i[3524], 13166, e);b = -1; - }H = e + 32 | 0;return b | 0; - }function Ka(a, b, c) { - var d = 0, - e = 0, - f = 0, - g = 0, - j = 0, - l = 0, - m = 0, - n = 0, - p = 0, - q = 0, - r = 0, - s = 0, - t = 0, - u = 0, - v = 0, - w = 0, - x = 0, - y = 0, - z = 0, - A = 0, - B = 0, - C = 0, - D = 0, - E = 0, - F = 0, - G = 0, - I = 0, - J = 0, - K = 0, - L = 0, - M = 0;g = H - 112 | 0;H = g;j = a - (c << 1) | 0;G = $(a, j + -6 | 0, 80);i[g >> 2] = G;I = $(a, j + -4 | 0, 80);i[g + 4 >> 2] = I;J = $(a, j + -2 | 0, 80);i[g + 8 >> 2] = J;K = $(a, j, 80);i[g + 12 >> 2] = K;L = $(a, j + 2 | 0, 80);i[g + 16 >> 2] = L;M = $(a, j + 4 | 0, 80);i[g + 20 >> 2] = M;w = $(a, j + 6 | 0, 80);i[g + 24 >> 2] = w;B = w & 32767;C = w << 1 >> 16;j = i[g + 20 >> 2];x = j & 32767;d = i[g + 16 >> 2];s = d & 32767;e = i[g + 12 >> 2];p = e & 32767;l = i[g + 8 >> 2];t = l & 32767;m = i[g + 4 >> 2];y = m & 32767;f = i[g >> 2];D = f & 32767;z = j << 1 >> 16;u = d << 1 >> 16;q = e << 1 >> 16;v = l << 1 >> 16;A = m << 1 >> 16;E = f << 1 >> 16;while (1) { - f = o(F, 14);F = F + 1 | 0;r = o(F, 28) + g | 0;n = h[f + 2432 >> 1];l = h[f + 2434 >> 1];d = h[f + 2436 >> 1];j = h[f + 2438 >> 1];i[r + 24 >> 2] = (((((((o(n, p) >> 15) + o(q, n) | 0) + (o(l, s) >> 15) | 0) + o(l, u) | 0) + (o(d, x) >> 15) | 0) + o(d, z) | 0) + (o(j, B) >> 15) | 0) + o(j, C);e = h[f + 2440 >> 1];m = h[f + 2442 >> 1];f = h[f + 2444 >> 1];i[r >> 2] = ((((((o(j, E) + (o(j, D) >> 15) | 0) + (o(e, y) >> 15) | 0) + o(e, A) | 0) + (o(m, t) >> 15) | 0) + o(m, v) | 0) + (o(f, p) >> 15) | 0) + o(f, q);i[r + 20 >> 2] = ((((((((o(n, v) + (o(n, t) >> 15) | 0) + (o(l, p) >> 15) | 0) + o(l, q) | 0) + (o(d, s) >> 15) | 0) + o(d, u) | 0) + (o(j, x) >> 15) | 0) + o(j, z) | 0) + (o(e, B) >> 15) | 0) + o(e, C);i[r + 4 >> 2] = ((((((((o(d, E) + (o(d, D) >> 15) | 0) + (o(j, y) >> 15) | 0) + o(j, A) | 0) + (o(e, t) >> 15) | 0) + o(e, v) | 0) + (o(m, p) >> 15) | 0) + o(m, q) | 0) + (o(f, s) >> 15) | 0) + o(f, u);i[r + 16 >> 2] = ((((((((((o(n, A) + (o(n, y) >> 15) | 0) + (o(l, t) >> 15) | 0) + o(l, v) | 0) + (o(d, p) >> 15) | 0) + o(d, q) | 0) + (o(j, s) >> 15) | 0) + o(j, u) | 0) + (o(e, x) >> 15) | 0) + o(e, z) | 0) + (o(m, B) >> 15) | 0) + o(m, C);i[r + 8 >> 2] = ((((((((((o(l, E) + (o(l, D) >> 15) | 0) + (o(d, y) >> 15) | 0) + o(d, A) | 0) + (o(j, t) >> 15) | 0) + o(j, v) | 0) + (o(e, p) >> 15) | 0) + o(e, q) | 0) + (o(m, s) >> 15) | 0) + o(m, u) | 0) + (o(f, x) >> 15) | 0) + o(f, z);i[r + 12 >> 2] = ((((((((((((o(n, E) + (o(n, D) >> 15) | 0) + (o(l, y) >> 15) | 0) + o(l, A) | 0) + (o(d, t) >> 15) | 0) + o(d, v) | 0) + (o(j, p) >> 15) | 0) + o(j, q) | 0) + (o(e, s) >> 15) | 0) + o(e, u) | 0) + (o(m, x) >> 15) | 0) + o(m, z) | 0) + (o(f, B) >> 15) | 0) + o(f, C);if ((F | 0) != 3) { - continue; - }break; - }j = 0;e = (I | 0) > (G | 0);l = e ? I : G;d = (J | 0) > (l | 0);f = d ? 2 : e;d = d ? J : l;e = (K | 0) > (d | 0);f = e ? 3 : f;d = e ? K : d;e = (L | 0) > (d | 0);f = e ? 4 : f;d = e ? L : d;e = (M | 0) > (d | 0);f = e ? 5 : f;d = e ? M : d;e = (w | 0) > (d | 0);F = e ? 6 : f;l = i[g + 28 >> 2];e = e ? w : d;d = (l | 0) > (e | 0);m = i[g + 32 >> 2];l = d ? l : e;e = (m | 0) > (l | 0);p = i[g + 36 >> 2];m = e ? m : l;l = (p | 0) > (m | 0);q = i[g + 40 >> 2];p = l ? p : m;m = (q | 0) > (p | 0);f = i[g + 44 >> 2];q = m ? q : p;p = (f | 0) > (q | 0);n = i[g + 48 >> 2];f = p ? f : q;q = (n | 0) > (f | 0);s = i[g + 52 >> 2];n = q ? n : f;f = (s | 0) > (n | 0);t = i[g + 56 >> 2];s = f ? s : n;n = (t | 0) > (s | 0);u = i[g + 60 >> 2];t = n ? t : s;s = (u | 0) > (t | 0);v = i[g - -64 >> 2];u = s ? u : t;t = (v | 0) > (u | 0);r = i[g + 68 >> 2];v = t ? v : u;u = (r | 0) > (v | 0);x = i[g + 72 >> 2];r = u ? r : v;v = (x | 0) > (r | 0);y = i[g + 76 >> 2];x = v ? x : r;r = (y | 0) > (x | 0);z = i[g + 80 >> 2];y = r ? y : x;x = (z | 0) > (y | 0);A = i[g + 84 >> 2];z = x ? z : y;y = (A | 0) > (z | 0);w = i[g + 88 >> 2];A = y ? A : z;z = (w | 0) > (A | 0);B = i[g + 92 >> 2];w = z ? w : A;A = (B | 0) > (w | 0);C = i[g + 96 >> 2];B = A ? B : w;w = (C | 0) > (B | 0);D = i[g + 100 >> 2];C = w ? C : B;B = (D | 0) > (C | 0);E = i[g + 104 >> 2];D = B ? D : C;C = (E | 0) > (D | 0);E = i[g + 108 >> 2] > ((C ? E : D) | 0);D = E ? 6 : C ? 5 : B ? 4 : w ? 3 : A ? 2 : z ? 1 : y ? 0 : x ? 6 : r ? 5 : v ? 4 : u ? 3 : t ? 2 : s ? 1 : n ? 0 : f ? 6 : q ? 5 : p ? 4 : m ? 3 : l ? 2 : e ? 1 : d ? 0 : F;d = E ? 3 : C ? 3 : B ? 3 : w ? 3 : A ? 3 : z ? 3 : y ? 3 : x ? 2 : r ? 2 : v ? 2 : u ? 2 : t ? 2 : s ? 2 : n ? 2 : f | (q | (p | (m | (l | (d | e)))));a: { - if (!d) { - while (1) { - h[(j << 1) + b >> 1] = k[((D + (j - c | 0) << 1) + a | 0) + -6 >> 1];j = j + 1 | 0;if ((j | 0) != 80) { - continue; - }break a; - } - }e = (D - c | 0) + -6 | 0;c = o(d + -1 | 0, 14);d = h[c + 2444 >> 1];l = h[c + 2442 >> 1];m = h[c + 2440 >> 1];p = h[c + 2438 >> 1];q = h[c + 2436 >> 1];f = h[c + 2434 >> 1];n = h[c + 2432 >> 1];while (1) { - c = (j + e << 1) + a | 0;h[(j << 1) + b >> 1] = (o(d, h[c + 12 >> 1]) + (((((o(f, h[c + 2 >> 1]) + o(n, h[c >> 1]) | 0) + o(q, h[c + 4 >> 1]) | 0) + o(p, h[c + 6 >> 1]) | 0) + o(m, h[c + 8 >> 1]) | 0) + o(l, h[c + 10 >> 1]) | 0) | 0) + 16384 >>> 15;j = j + 1 | 0;if ((j | 0) != 80) { - continue; - }break; - } - }H = g + 112 | 0; - }function Ia(a, b, c, d, e, f, g, j) { - var l = 0, - m = 0, - n = 0, - p = 0, - q = 0, - r = 0, - s = 0, - t = 0, - u = 0, - v = 0, - w = 0, - x = 0, - y = 0, - z = 0, - A = 0, - B = 0, - C = 0, - D = 0;z = (j & 1) + j | 0;t = c - b | 0;w = t + 1 | 0;j = w << 1;n = z + j | 0;A = (n & 1) + n | 0;j = A + j | 0;r = (0 - j & 3) + j | 0;s = w << 2;j = r + s | 0;x = (0 - j & 3) + j | 0;j = x + (g << 2) | 0;B = (0 - j & 3) + j | 0;if ((g | 0) >= 1) { - while (1) { - j = l << 2;i[j + x >> 2] = -1;i[j + B >> 2] = 0;i[e + j >> 2] = b;l = l + 1 | 0;if ((l | 0) != (g | 0)) { - continue; - }break; - } - }p = 0 - c | 0;a: { - if ((p | 0) >= (d | 0)) { - break a; - }l = p;while (1) { - n = h[(l << 1) + a >> 1];j = n >> 31;if ((j ^ j + n) < 16384) { - l = l + 1 | 0;if ((l | 0) != (d | 0)) { - continue; - }break a; - }break; - }l = p;while (1) { - C = 1;j = (l << 1) + a | 0;h[j >> 1] = h[j >> 1] >>> 1;l = l + 1 | 0;if ((l | 0) != (d | 0)) { - continue; - }break; - } - }n = d >> 2;b: { - if (n) { - l = a - (b << 1) | 0;j = 0;m = n;while (1) { - q = j;j = h[l + 2 >> 1];u = o(j, j);j = h[l >> 1];u = u + o(j, j) | 0;j = h[l + 4 >> 1];u = u + o(j, j) | 0;j = h[l + 6 >> 1];j = q + (u + o(j, j) >>> 6 | 0) | 0;l = l + 8 | 0;m = m + -1 | 0;if (m) { - continue; - }break; - }i[r >> 2] = j;l = a;j = n;while (1) { - m = h[l + 2 >> 1];q = o(m, m);m = h[l >> 1];q = q + o(m, m) | 0;m = h[l + 4 >> 1];q = q + o(m, m) | 0;m = h[l + 6 >> 1];y = (q + o(m, m) >>> 6 | 0) + y | 0;l = l + 8 | 0;j = j + -1 | 0;if (j) { - continue; - }break; - }break b; - }i[r >> 2] = 0; - }if ((c | 0) > (b | 0)) { - j = i[r >> 2];l = b;while (1) { - q = j;j = l ^ -1;m = h[(j << 1) + a >> 1];j = h[(d + j << 1) + a >> 1];j = q + (o(m, m) >>> 6 | 0) - (o(j, j) >>> 6) | 0;j = (j | 0) > 0 ? j : 0;i[(r + (l - b << 2) | 0) + 4 >> 2] = j;l = l + 1 | 0;if ((l | 0) != (c | 0)) { - continue; - }break; - } - }D = wa(r, A, 32766, w);c: { - if ((t | 0) < 0) { - break c; - }if (n) { - q = (p << 1) + a | 0;while (1) { - l = q + (v << 1) | 0;m = 0;j = a;s = n;while (1) { - m = (((o(h[l + 2 >> 1], h[j + 2 >> 1]) + o(h[l >> 1], h[j >> 1]) | 0) + o(h[l + 4 >> 1], h[j + 4 >> 1]) | 0) + o(h[l + 6 >> 1], h[j + 6 >> 1]) >> 6) + m | 0;l = l + 8 | 0;j = j + 8 | 0;s = s + -1 | 0;if (s) { - continue; - }break; - }i[r + (t - v << 2) >> 2] = m;j = (v | 0) != (t | 0);v = v + 1 | 0;if (j) { - continue; - }break; - }break c; - }U(r, 0, s); - }w = wa(r, z, 180, w);if (!(C ^ 1 | (p | 0) >= (d | 0))) { - while (1) { - j = (p << 1) + a | 0;h[j >> 1] = k[j >> 1] << 1;p = p + 1 | 0;if ((p | 0) != (d | 0)) { - continue; - }break; - } - }d: { - if ((c | 0) < (b | 0)) { - break d; - }p = (c | 0) > (b | 0) ? c : b;c = g + -1 | 0;a = c << 2;s = a + e | 0;d = a + x | 0;j = a + B | 0;if ((g | 0) >= 2) { - l = b;while (1) { - a = l;l = a - b << 1;n = k[l + z >> 1];n = o(n, n) << 16 >> 16;l = h[l + A >> 1];m = (l << 16) + 65536 >> 16;e: { - if ((o(n, h[j >> 1]) | 0) <= (o(m, h[d >> 1]) | 0)) { - break e; - }i[d >> 2] = n;C = l + 1 | 0;i[j >> 2] = C;i[s >> 2] = a;l = 0;while (1) { - r = l << 2;q = r + B | 0;u = r + x | 0;if ((o(n, h[q >> 1]) | 0) <= (o(m, h[u >> 1]) | 0)) { - l = l + 1 | 0;if ((c | 0) != (l | 0)) { - continue; - }break e; - }break; - }m = c;if ((c | 0) > (l | 0)) { - while (1) { - v = m << 2;m = m + -1 | 0;t = m << 2;i[v + x >> 2] = i[t + x >> 2];i[v + B >> 2] = i[t + B >> 2];i[e + v >> 2] = i[e + t >> 2];if ((m | 0) > (l | 0)) { - continue; - }break; - } - }i[u >> 2] = n;i[q >> 2] = C;i[e + r >> 2] = a; - }l = a + 1 | 0;if ((a | 0) != (p | 0)) { - continue; - }break; - }break d; - }l = b;while (1) { - a = l - b << 1;c = k[a + z >> 1];c = o(c, c) << 16 >> 16;a = h[a + A >> 1];if ((o(c, h[j >> 1]) | 0) > (o(h[d >> 1], (a << 16) + 65536 >> 16) | 0)) { - i[d >> 2] = c;i[j >> 2] = a + 1;i[s >> 2] = l; - }a = (l | 0) != (p | 0);l = l + 1 | 0;if (a) { - continue; - }break; - } - }if (!(!f | (g | 0) < 1)) { - a = y >>> 0 > 65535;c = a << 3;j = c | 4;d = c;a = a ? y >>> 16 | 0 : y;c = a >>> 0 > 255;d = c ? j : d;a = c ? a >>> 8 | 0 : a;c = a >>> 0 > 15;a = (c ? d | 2 : d) | (c ? a >>> 4 | 0 : a) >>> 0 > 3;c = a << 1;d = a << 16 >> 16;c = ((d | 0) > 6 ? y >> c + -12 : y << 12 - c) << 16 >> 16;c = (o((o(o(c, 16816) + -827523072 >> 16, c) << 2 & -65536) + 1387593728 >> 16, c) << 2 & -65536) + 238157824 >> 16;a = 13 - a | 0;l = ((d | 0) < 13 ? c >> a : c << 0 - a) << 16 >> 16;j = 0;while (1) { - n = i[(j << 2) + e >> 2] - b << 1;a = h[n + A >> 1] << D;c = a >>> 0 > 65535;d = c << 3;p = d | 4;m = d;c = c ? a >>> 16 | 0 : a;d = c >>> 0 > 255;m = d ? p : m;c = d ? c >>> 8 | 0 : c;d = c >>> 0 > 15;c = (d ? m | 2 : m) | (d ? c >>> 4 | 0 : c) >>> 0 > 3;d = c << 1;m = a >> d + -12;a = a << 12 - d;d = c << 16 >> 16;a = ((d | 0) > 6 ? m : a) << 16 >> 16;a = (o((o(o(a, 16816) + -827523072 >> 16, a) << 2 & -65536) + 1387593728 >> 16, a) << 2 & -65536) + 238157824 >> 16;c = 13 - c | 0;a = (h[n + z >> 1] << w) / ((o(l, ((d | 0) < 13 ? a >> c : a << 0 - c) << 16 >> 16) >> 6) + 10 | 0) | 0;h[(j << 1) + f >> 1] = a & 32768 ? 0 : a;j = j + 1 | 0;if ((j | 0) != (g | 0)) { - continue; - }break; - } - } - }function ta(a, b, c, d, e) { - var f = 0, - g = 0, - j = 0, - l = 0, - m = 0, - n = 0, - p = 0, - q = 0, - r = 0, - s = 0, - t = 0, - u = 0, - v = 0, - w = 0, - x = 0, - y = 0, - z = 0, - A = 0, - B = 0, - C = 0, - D = 0;m = (0 - e & 3) + e | 0;q = (b | 0) / 2 | 0;p = q + 1 | 0;e = p << 2;j = m + e | 0;g = (0 - j & 3) + j | 0;i[g >> 2] = 8192;i[m >> 2] = 8192;t = e + g | 0;a: { - if ((b | 0) < 2) { - break a; - }e = m + 4 | 0;f = g + 4 | 0;b: { - if (!(f >>> 0 >= j >>> 0 | m >>> 0 >= t >>> 0)) { - j = m;l = g;while (1) { - r = h[((n ^ -1) + b << 1) + a >> 1];s = h[(n << 1) + a >> 1];i[f >> 2] = (r + s | 0) - i[l >> 2];i[e >> 2] = i[j >> 2] + (s - r | 0);e = e + 4 | 0;j = j + 4 | 0;f = f + 4 | 0;l = l + 4 | 0;n = n + 1 | 0;if ((q | 0) != (n | 0)) { - continue; - }break; - }break b; - }l = i[m >> 2];j = g;while (1) { - r = h[((n ^ -1) + b << 1) + a >> 1];s = h[(n << 1) + a >> 1];i[f >> 2] = (r + s | 0) - i[j >> 2];l = (s - r | 0) + l | 0;i[e >> 2] = l;e = e + 4 | 0;f = f + 4 | 0;j = j + 4 | 0;n = n + 1 | 0;if ((q | 0) != (n | 0)) { - continue; - }break; - } - }if ((b | 0) <= 1) { - break a; - }a = 0;e = m;f = g;while (1) { - i[f >> 2] = i[f >> 2] + 2 >> 2;i[e >> 2] = i[e >> 2] + 2 >> 2;e = e + 4 | 0;f = f + 4 | 0;a = a + 1 | 0;if ((q | 0) != (a | 0)) { - continue; - }break; - } - }a = q << 2;e = a + g | 0;i[e >> 2] = i[e >> 2] + 4 >> 3;a = a + m | 0;i[a >> 2] = i[a >> 2] + 4 >> 3;c: { - if ((b | 0) < -1) { - break c; - }x = t + (t & 1) | 0;a = x + (p << 1) | 0;z = (a & 1) + a | 0;e = 0;while (1) { - a = e << 1;f = e << 2;h[a + x >> 1] = i[f + g >> 2];h[a + z >> 1] = i[f + m >> 2];a = (e | 0) == (q | 0);e = e + 1 | 0;if (!a) { - continue; - }break; - }if ((b | 0) < 1) { - break c; - }g = 16384;C = q + -1 << 1;A = (b | 0) < 4;m = 0;while (1) { - s = w & 1 ? z : x;t = C + s | 0;r = h[t >> 1];u = (q << 1) + s | 0;p = h[u >> 1];a = g << 16 >> 16 < 16383 ? g : 16383;f = a << 16 >> 16 > -16383 ? a : -16383;n = f << 16 >> 16;j = p + (o(n, r) - -8192 >> 14) | 0;a = 16384;e = 2;if (!A) { - while (1) { - l = (o(n, f << 16 >> 16) >>> 13 | 0) - a | 0;j = (o(h[(q - e << 1) + s >> 1], l << 16 >> 16) - -8192 >> 14) + j | 0;v = (e | 0) != (q | 0);a = f;f = l;e = e + 1 | 0;if (v) { - continue; - }break; - } - }d: { - if (m << 16 >> 16 < -16384) { - break d; - }D = (w << 1) + c | 0;while (1) { - e = 2;a = g << 16 >> 16;a = o(1073741824 - (o(o(a, a) << 2 >> 16, 56e3) & -65536) >> 16, d);a = g - (j + 511 >>> 0 < 1023 ? (a << 1 >> 16) + 1 >>> 1 | 0 : a >>> 15 | 0) | 0;m = a << 16 >> 16;v = p << 16 >> 16;a = (m | 0) < 16383 ? a : 16383;f = a << 16 >> 16 > -16383 ? a : -16383;p = f << 16 >> 16;a = v + (o(p, r) - -8192 >> 14) | 0;n = 16384;if (!A) { - while (1) { - l = (o(p, f << 16 >> 16) >>> 13 | 0) - n | 0;a = (o(h[(q - e << 1) + s >> 1], l << 16 >> 16) - -8192 >> 14) + a | 0;y = (e | 0) != (q | 0);n = f;f = l;e = e + 1 | 0;if (y) { - continue; - }break; - } - }if (!((a ^ j) & 1879048192 ? 0 : j)) { - p = 0;e: { - if ((b | 0) <= 3) { - while (1) { - l = ((g << 16 >> 16 << 15) + 32768 >>> 16) + ((m << 16 >> 16 << 15) + 32768 >>> 16) | 0;a = l << 16 >> 16 < 16383 ? l : 16383;e = (o((a << 16 >> 16 > -16383 ? a : -16383) << 16 >> 16, r) - -8192 >> 14) + v | 0;a = !j | ((e ^ j) & 1879048192) != 0;j = a ? j : e;g = a ? g : l;m = a ? l : m;a = (p | 0) == 10;p = p + 1 | 0;if (!a) { - continue; - }break e; - } - }while (1) { - l = ((g << 16 >> 16 << 15) + 32768 >>> 16) + ((m << 16 >> 16 << 15) + 32768 >>> 16) | 0;a = l << 16 >> 16 < 16383 ? l : 16383;f = a << 16 >> 16 > -16383 ? a : -16383;u = f << 16 >> 16;a = (o(u, r) - -8192 >> 14) + v | 0;e = 2;n = 16384;while (1) { - t = (o(u, f << 16 >> 16) >>> 13 | 0) - n | 0;a = (o(h[(q - e << 1) + s >> 1], t << 16 >> 16) - -8192 >> 14) + a | 0;y = (e | 0) != (q | 0);n = f;f = t;e = e + 1 | 0;if (y) { - continue; - }break; - }e = !j | ((a ^ j) & 1879048192) != 0;g = e ? g : l;m = e ? l : m;j = e ? j : a;a = (p | 0) == 10;p = p + 1 | 0;if (!a) { - continue; - }break; - } - }B = B + 1 | 0;j = l << 16 >> 16 < 0;a = ((j ? l : 0 - l | 0) << 16) + 1073741824 >> 17;e = o((o((o(a, 1486) >> 13) + 2242 | 0, a) << 3 & -65536) + 1079312384 >> 16, a) << 3 >> 16;a = e << 13;f = a >>> 0 > 65535;g = f << 3;e = f ? e >>> 3 & 65535 : a;f = e >>> 0 > 255;g = f ? g | 4 : g;e = f ? e >>> 8 | 0 : e;f = e >>> 0 > 15;e = (f ? g | 2 : g) | (f ? e >>> 4 | 0 : e) >>> 0 > 3;f = e << 1;g = a >> f + -12;a = a << 12 - f;f = e << 16 >> 16;a = ((f | 0) > 6 ? g : a) << 16 >> 16;a = (o((o(o(a, 16816) + -827523072 >> 16, a) << 2 & -65536) + 1387593728 >> 16, a) << 2 & -65536) + 238157824 >> 16;e = 13 - e | 0;a = (f | 0) < 13 ? a >> e : a << 0 - e;h[D >> 1] = j ? 25736 - a | 0 : a;g = l;break d; - }if ((m | 0) < -16384) { - g = m; - } else { - r = h[t >> 1];p = k[u >> 1];g = m;j = a;continue; - }break; - } - }w = w + 1 | 0;if ((w | 0) != (b | 0)) { - continue; - }break; - } - }return B; - }function xb(a, b, c) { - a = a | 0;b = b | 0;c = c | 0;var d = 0, - e = 0, - f = 0, - g = 0, - j = 0;d = H - 32 | 0;H = d;a: { - b: { - switch (b + -3 | 0) {case 98: - if (i[a + 16 >> 2] < 1) { - break a; - }b = 0;while (1) { - f = i[a + 12 >> 2];h[(b << 1) + c >> 1] = Z(i[a + 76 >> 2] + (o(f, b) << 1) | 0, f);b = b + 1 | 0;if ((b | 0) < i[a + 16 >> 2]) { - continue; - }break; - }break a;case 0: - i[c >> 2] = i[a + 8 >> 2];break a;case 3:case 5: - b = i[c >> 2];i[a + 212 >> 2] = b;i[a + 208 >> 2] = b;break a;case 4:case 6: - i[c >> 2] = i[a + 208 >> 2];break a;case 9: - i[a + 152 >> 2] = i[c >> 2];break a;case 10: - i[c >> 2] = i[a + 152 >> 2];break a;case 27: - i[a + 160 >> 2] = i[c >> 2];break a;case 28: - i[c >> 2] = i[a + 160 >> 2];break a;case 31: - i[a + 164 >> 2] = i[c >> 2];break a;case 32: - i[c >> 2] = i[a + 164 >> 2];break a;case 29: - b = i[c >> 2];i[a + 172 >> 2] = b;i[a + 152 >> 2] = (b | 0) != 0;if (!b) { - break a; - }i[d + 28 >> 2] = 10;e = i[c >> 2];while (1) { - c: { - J[i[i[a >> 2] + 44 >> 2]](a, 4, d + 28 | 0) | 0;J[i[i[a >> 2] + 44 >> 2]](a, 19, d + 24 | 0) | 0;c = i[d + 28 >> 2];if (i[d + 24 >> 2] <= (e | 0)) { - b = c;break c; - }b = c + -1 | 0;i[d + 28 >> 2] = b;if ((c | 0) > 0) { - continue; - } - }break; - }e = 0;m[d + 20 >> 2] = ((b | 0) > 0 ? b : 0) | 0;J[i[i[a >> 2] + 44 >> 2]](a, 14, d + 20 | 0) | 0;i[a + 176 >> 2] = 0;i[a + 180 >> 2] = 0;i[a + 184 >> 2] = 0;break a;case 30: - i[c >> 2] = i[a + 172 >> 2];break a;case 11: - i[a + 144 >> 2] = i[c >> 2];break a;case 12: - i[c >> 2] = i[a + 144 >> 2];break a;case 1: - b = i[c >> 2];b = (b | 0) > 0 ? b : 0;b = i[(i[i[a >> 2] >> 2] + (((b | 0) < 10 ? b : 10) << 2) | 0) + 96 >> 2];i[a + 212 >> 2] = b;i[a + 208 >> 2] = b;break a;case 13: - b = a;a = i[c >> 2];i[b + 188 >> 2] = (a | 0) > 0 ? a : 0;break a;case 14: - i[c >> 2] = i[a + 188 >> 2];break a;case 15: - i[d + 28 >> 2] = 10;b = i[c >> 2];while (1) { - d: { - J[i[i[a >> 2] + 44 >> 2]](a, 4, d + 28 | 0) | 0;J[i[i[a >> 2] + 44 >> 2]](a, 19, d + 24 | 0) | 0;if (i[d + 24 >> 2] <= (b | 0)) { - break d; - }c = i[d + 28 >> 2];i[d + 28 >> 2] = c + -1;if ((c | 0) > 0) { - continue; - } - }break; - }break a;case 16: - b = i[a + 192 >> 2];e = i[i[a + 204 >> 2] + (i[a + 208 >> 2] << 2) >> 2];if (e) { - i[c >> 2] = (o(b, i[e + 52 >> 2]) | 0) / i[a + 8 >> 2];e = 0;break a; - }i[c >> 2] = (o(b, 5) | 0) / i[a + 8 >> 2];e = 0;break a;case 21: - i[a + 192 >> 2] = i[c >> 2];break a;case 22: - i[c >> 2] = i[a + 192 >> 2];break a;case 23: - i[a + 4 >> 2] = 1;i[a + 40 >> 2] = 1;b = i[a + 24 >> 2];e: { - if ((b | 0) < 1) { - break e; - }e = b + 1 | 0;f = i[a + 96 >> 2];c = 0;while (1) { - g = f + (c << 1) | 0;c = c + 1 | 0;h[g >> 1] = (o(c << 16 >> 16, 25736) | 0) / (e | 0);if ((b | 0) != (c | 0)) { - continue; - }break; - }if ((b | 0) < 1) { - break e; - }e = i[a + 108 >> 2];f = i[a + 112 >> 2];g = i[a + 104 >> 2];j = i[a + 116 >> 2];b = 0;while (1) { - c = b << 2;i[c + j >> 2] = 0;i[c + g >> 2] = 0;i[c + f >> 2] = 0;i[c + e >> 2] = 0;b = b + 1 | 0;if ((b | 0) < i[a + 24 >> 2]) { - continue; - }break; - } - }b = i[a + 8 >> 2];e = b + i[a + 32 >> 2] | 0;if ((e | 0) >= 0) { - f = i[a + 72 >> 2];g = i[a + 80 >> 2];c = 0;while (1) { - j = c << 1;h[j + g >> 1] = 0;h[f + j >> 1] = 0;j = (c | 0) == (e | 0);c = c + 1 | 0;if (!j) { - continue; - }break; - } - }e = 0;c = i[a + 20 >> 2];if ((c | 0) <= (b | 0)) { - break a; - }f = i[a + 68 >> 2];a = c - b | 0;U(f, 0, ((a | 0) > 1 ? a : 1) << 1);break a;case 33: - i[a + 200 >> 2] = i[c >> 2];break a;case 34: - i[c >> 2] = i[a + 200 >> 2];break a;case 36: - i[c >> 2] = i[a + 20 >> 2] - i[a + 8 >> 2];break a;case 37: - b = a;a = i[c >> 2];i[b + 196 >> 2] = (a | 0) < 100 ? a : 100;H = d + 32 | 0;return 0;case 38: - i[c >> 2] = i[a + 196 >> 2];break a;case 39: - i[a + 156 >> 2] = i[c >> 2];break a;case 40: - i[c >> 2] = i[a + 156 >> 2];break a;case 41: - i[a + 220 >> 2] = i[c >> 2];break a;case 42: - i[c >> 2] = i[a + 220 >> 2];break a;case 97: - if (i[a + 16 >> 2] < 1) { - break a; - }f = i[a + 132 >> 2];b = 0;while (1) { - g = b << 2;i[g + c >> 2] = i[f + g >> 2];b = b + 1 | 0;if ((b | 0) < i[a + 16 >> 2]) { - continue; - }break; - }break a;case 26: - i[c >> 2] = i[a + 148 >> 2];break a;case 101: - i[a + 136 >> 2] = c;break a;case 102: - i[a + 216 >> 2] = i[c >> 2];break a;case 103: - i[c >> 2] = i[a + 64 >> 2];break a;default: - break b;} - }i[d + 4 >> 2] = b;i[d >> 2] = 12742;Y(i[3524], 12828, d);e = -1; - }H = d + 32 | 0;return e | 0; - }function sb(a, b, c, d) { - a = a | 0;b = b | 0;c = c | 0;d = d | 0;var e = 0, - f = 0, - i = 0, - j = 0, - l = 0, - m = 0, - n = 0, - p = 0, - q = 0, - r = 0, - s = 0, - t = 0, - u = 0, - v = 0, - w = 0, - x = 0, - y = 0;q = H - 32 | 0;H = q;a: { - b: { - if ((c | 0) < 1) { - break b; - }while (1) { - j = e << 1;h[j + b >> 1] = k[a + j >> 1];e = e + 1 | 0;if ((e | 0) != (c | 0)) { - continue; - }break; - }if ((c | 0) < 1) { - break b; - }j = h[b >> 1];l = q;m = c + -1 | 0;e = 25736;c: { - if (!m) { - break c; - }e = k[b + 2 >> 1]; - }e = e - j | 0;h[l >> 1] = 81920 / (((e << 16 >> 16 < (j | 0) ? e : j) << 16) + 19660800 >> 16);e = 1;if ((c | 0) != 1) { - while (1) { - p = e << 1;j = p + b | 0;r = k[j >> 1];n = r - k[j + -2 >> 1] << 16 >> 16;j = e + 1 | 0;e = ((e | 0) != (m | 0) ? k[(j << 1) + b >> 1] : 25736) - r | 0;h[q + p >> 1] = 81920 / (((e << 16 >> 16 < (n | 0) ? e : n) << 16) + 19660800 >> 16);e = j;if ((e | 0) != (c | 0)) { - continue; - }break; - } - }if ((c | 0) < 1) { - break b; - }e = 0;while (1) { - j = (e << 1) + b | 0;e = e + 1 | 0;h[j >> 1] = k[j >> 1] - (e << 11);if ((c | 0) != (e | 0)) { - continue; - }break; - }if ((c | 0) < 1) { - break b; - }r = 2147483647;n = 0;j = 8848;while (1) { - m = 0;e = j;p = 0;while (1) { - l = m;m = k[(p << 1) + b >> 1] - (g[e | 0] << 5) << 16 >> 16;m = l + o(m, m) | 0;e = e + 1 | 0;p = p + 1 | 0;if ((p | 0) != (c | 0)) { - continue; - }break; - }e = (m | 0) < (r | 0);n = e ? s : n;r = e ? m : r;j = c + j | 0;s = s + 1 | 0;if ((s | 0) != 64) { - continue; - }break; - }j = o(c, n);e = 0;while (1) { - m = (e << 1) + b | 0;h[m >> 1] = k[m >> 1] - (g[(e + j | 0) + 8848 | 0] << 5);e = e + 1 | 0;if ((e | 0) != (c | 0)) { - continue; - }break; - }W(d, n, 6);e = 0;if ((c | 0) <= 0) { - break a; - }while (1) { - j = (e << 1) + b | 0;h[j >> 1] = k[j >> 1] << 1;e = e + 1 | 0;if ((e | 0) != (c | 0)) { - continue; - }break; - }break a; - }W(d, 0, 6); - }v = k[b >> 1];w = k[b + 8 >> 1];x = k[b + 6 >> 1];i = k[b + 4 >> 1];y = k[b + 2 >> 1];p = 2147483647;n = 0;e = 9488;j = h[q + 8 >> 1];r = h[q + 6 >> 1];s = h[q + 4 >> 1];t = h[q + 2 >> 1];u = h[q >> 1];m = 0;while (1) { - f = v - (g[e | 0] << 5) << 16 >> 16;f = o(f, f);l = (o(u, f & 32767) >> 15) + o(u, f << 1 >> 16) | 0;f = y - (g[e + 1 | 0] << 5) << 16 >> 16;f = o(f, f);l = (l + (o(t, f & 32767) >> 15) | 0) + o(t, f << 1 >> 16) | 0;f = i - (g[e + 2 | 0] << 5) << 16 >> 16;f = o(f, f);l = (l + (o(s, f & 32767) >> 15) | 0) + o(s, f << 1 >> 16) | 0;f = x - (g[e + 3 | 0] << 5) << 16 >> 16;f = o(f, f);l = (l + (o(r, f & 32767) >> 15) | 0) + o(r, f << 1 >> 16) | 0;f = w - (g[e + 4 | 0] << 5) << 16 >> 16;f = o(f, f);l = (l + (o(j, f & 32767) >> 15) | 0) + o(j, f << 1 >> 16) | 0;f = (l | 0) < (p | 0);p = f ? l : p;n = f ? m : n;e = e + 5 | 0;m = m + 1 | 0;if ((m | 0) != 64) { - continue; - }break; - }e = o(n, 5);h[b >> 1] = k[b >> 1] - (g[e + 9488 | 0] << 5);h[b + 2 >> 1] = k[b + 2 >> 1] - (g[e + 9489 | 0] << 5);h[b + 4 >> 1] = k[b + 4 >> 1] - (g[e + 9490 | 0] << 5);h[b + 6 >> 1] = k[b + 6 >> 1] - (g[e + 9491 | 0] << 5);h[b + 8 >> 1] = k[b + 8 >> 1] - (g[e + 9492 | 0] << 5);W(d, n, 6);y = k[b + 10 >> 1];j = k[b + 18 >> 1];r = k[b + 16 >> 1];s = k[b + 14 >> 1];t = k[b + 12 >> 1];p = 2147483647;n = 0;e = 10128;u = h[q + 18 >> 1];f = h[q + 16 >> 1];v = h[q + 14 >> 1];w = h[q + 12 >> 1];x = h[q + 10 >> 1];m = 0;while (1) { - i = y - (g[e | 0] << 5) << 16 >> 16;i = o(i, i);l = (o(x, i & 32767) >> 15) + o(x, i << 1 >> 16) | 0;i = t - (g[e + 1 | 0] << 5) << 16 >> 16;i = o(i, i);l = (l + (o(w, i & 32767) >> 15) | 0) + o(w, i << 1 >> 16) | 0;i = s - (g[e + 2 | 0] << 5) << 16 >> 16;i = o(i, i);l = (l + (o(v, i & 32767) >> 15) | 0) + o(v, i << 1 >> 16) | 0;i = r - (g[e + 3 | 0] << 5) << 16 >> 16;i = o(i, i);l = (l + (o(f, i & 32767) >> 15) | 0) + o(f, i << 1 >> 16) | 0;i = j - (g[e + 4 | 0] << 5) << 16 >> 16;i = o(i, i);l = (l + (o(u, i & 32767) >> 15) | 0) + o(u, i << 1 >> 16) | 0;i = (l | 0) < (p | 0);p = i ? l : p;n = i ? m : n;e = e + 5 | 0;m = m + 1 | 0;if ((m | 0) != 64) { - continue; - }break; - }e = o(n, 5);h[b + 18 >> 1] = j - (g[e + 10132 | 0] << 5);h[b + 16 >> 1] = r - (g[e + 10131 | 0] << 5);h[b + 14 >> 1] = s - (g[e + 10130 | 0] << 5);h[b + 12 >> 1] = t - (g[e + 10129 | 0] << 5);h[b + 10 >> 1] = k[b + 10 >> 1] - (g[e + 10128 | 0] << 5);W(d, n, 6);e = 0;d: { - if ((c | 0) <= 0) { - break d; - }while (1) { - d = (e << 1) + b | 0;h[d >> 1] = h[d >> 1] + 1 >>> 1;e = e + 1 | 0;if ((e | 0) != (c | 0)) { - continue; - }break; - }e = 0;if ((c | 0) <= 0) { - break d; - }while (1) { - d = e << 1;j = d + b | 0;h[j >> 1] = k[a + d >> 1] - k[j >> 1];e = e + 1 | 0;if ((e | 0) != (c | 0)) { - continue; - }break; - } - }H = q + 32 | 0; - }function Ja(a, b, c, d, e, f) { - var g = 0, - i = 0, - j = 0, - l = 0, - m = 0, - n = 0, - p = 0, - q = 0, - r = 0, - s = 0, - t = 0, - u = 0, - v = 0;r = (f & 1) + f | 0;Ka(a, r, d);f = 0;j = r + (c << 1) | 0;Ka(a, j, (d | 0) > 40 ? d << 1 : 0 - d | 0);t = 1;a: { - if ((c | 0) <= 0) { - break a; - }b: { - while (1) { - i = h[(f << 1) + a >> 1];g = i >> 31;if ((g ^ g + i) > 16383) { - break b; - }f = f + 1 | 0;if ((f | 0) != (c | 0)) { - continue; - }break; - }break a; - }f = 0;while (1) { - g = (f << 1) + a | 0;h[g >> 1] = h[g >> 1] >>> 1;f = f + 1 | 0;if ((f | 0) != (c | 0)) { - continue; - }break; - }f = c << 1;g = (f | 0) > 1 ? f : 1;t = 0;f = 0;while (1) { - i = r + (f << 1) | 0;h[i >> 1] = h[i >> 1] >>> 1;f = f + 1 | 0;if ((g | 0) != (f | 0)) { - continue; - }break; - } - }p = $(r, r, c);i = $(j, j, c);f = $(a, a, c) + 1 | 0;g = f >>> 0 > 65535;l = g << 3;q = l | 4;n = l;g = g ? f >>> 16 | 0 : f;l = g >>> 0 > 255;m = l ? q : n;g = l ? g >>> 8 | 0 : g;l = g >>> 0 > 15;g = (l ? m | 2 : m) | (l ? g >>> 4 | 0 : g) >>> 0 > 3;l = g << 1;i = i + 1e3 | 0;m = i >>> 0 > 65535;n = m << 3;s = n | 4;q = n;m = m ? i >>> 16 | 0 : i;n = m >>> 0 > 255;s = n ? s : q;m = n ? m >>> 8 | 0 : m;n = m >>> 0 > 15;m = (n ? s | 2 : s) | (n ? m >>> 4 | 0 : m) >>> 0 > 3;n = m << 1;q = f >> l + -12;f = f << 12 - l;l = g << 16 >> 16;f = ((l | 0) > 6 ? q : f) << 16 >> 16;f = (o((o(o(f, 16816) + -827523072 >> 16, f) << 2 & -65536) + 1387593728 >> 16, f) << 2 & -65536) + 238157824 >> 16;g = 13 - g | 0;l = ((l | 0) < 13 ? f >> g : f << 0 - g) << 16;g = l >> 16;s = (g + 32 >>> 6 | 0) + 1 | 0;f = i >> n + -12;n = i << 12 - n;i = m << 16 >> 16;f = ((i | 0) > 6 ? f : n) << 16 >> 16;f = (o((o(o(f, 16816) + -827523072 >> 16, f) << 2 & -65536) + 1387593728 >> 16, f) << 2 & -65536) + 238157824 >> 16;m = 13 - m | 0;f = (i | 0) < 13 ? f >> m : f << 0 - m;u = f << 16 >> 10 < (g | 0) ? s : f;i = $(r, a, c);f = $(j, a, c);n = (f | 0) > 0 ? f : 0;m = 16384;f = p + 1e3 | 0;j = f >>> 0 > 65535;p = j << 3;v = p | 4;q = p;j = j ? f >>> 16 | 0 : f;p = j >>> 0 > 255;q = p ? v : q;j = p ? j >>> 8 | 0 : j;p = j >>> 0 > 15;j = (p ? q | 2 : q) | (p ? j >>> 4 | 0 : j) >>> 0 > 3;p = j << 1;q = (i | 0) > 0 ? i : 0;i = j << 16 >> 16;f = ((i | 0) > 6 ? f >> p + -12 : f << 12 - p) << 16 >> 16;f = (o((o(o(f, 16816) + -827523072 >> 16, f) << 2 & -65536) + 1387593728 >> 16, f) << 2 & -65536) + 238157824 >> 16;j = 13 - j | 0;f = (i | 0) < 13 ? f >> j : f << 0 - j;i = (f << 16 >> 10 < (g | 0) ? s : f) << 16 >> 16;if ((q | 0) <= (o(i, g) | 0)) { - m = ((((l >> 17) + q | 0) / (g | 0) << 14) + (i >> 1) | 0) / (i | 0) << 16 >> 16; - }j = u << 16 >> 16;c: { - if ((n | 0) > (o(j, g) | 0)) { - f = j >> 1;g = 16384;break c; - }f = j >> 1;g = (f + ((n + (l >> 17) | 0) / (g | 0) << 14) | 0) / (j | 0) << 16 >> 16; - }l = l >> 8;n = (l + (i >> 1) | 0) / (i | 0) | 0;i = (f + l | 0) / (j | 0) | 0;d: { - if ((e | 0) < 1) { - f = 0;e = 0;break d; - }e = o(e & 65535, 13107) >>> 15 | 0;f = e + 2294 | 0;e = (o(e, 112720) & -65536) + 1073741824 >> 16; - }j = f << 14;g = 32767 - (o(g, o(e, g) << 1 >> 16) >>> 13 | 0) | 0;l = f << 16 >> 16;g = (g << 16 >> 16 < (l | 0) ? f : g) << 16;g = (j + (g >> 17) | 0) / (g >> 16) | 0;e = 32767 - (o(o(e, m) << 1 >> 16, m) >>> 13 | 0) | 0;e = (e << 16 >> 16 < (l | 0) ? f : e) << 16;e = o(n << 16 >> 14, (j + (e >> 17) | 0) / (e >> 16) << 16 >> 16) >> 16;e: { - if ((d | 0) > 40) { - f = o(e, 22938) >> 15;d = o(o(i << 16 >> 14, g << 16 >> 16) >> 16, 9830) >> 15;break e; - }f = o(e, 19661) >>> 15 | 0;d = o(o(i << 16 >> 14, g << 16 >> 16) >> 16, 19661) >>> 15 | 0; - }g = (c | 0) < 1;if (!g) { - e = d << 16 >> 16;i = f << 16 >> 16;f = 0;while (1) { - d = f << 1;h[d + b >> 1] = k[a + d >> 1] + ((o(e, h[r + (c + f << 1) >> 1]) + o(i, h[d + r >> 1]) << 8) + 32768 >>> 16 | 0);f = f + 1 | 0;if ((f | 0) != (c | 0)) { - continue; - }break; - } - }d = Z(b, c);e = Z(a, c);f: { - if (g) { - break f; - }f = (d | 0) > 1 ? d : 1;d = f & 65535;e = (e | 0) > 1 ? e : 1;d = (((((e & 65535) >>> 0 > d >>> 0 ? f : e) & 65535) << 14 | d >>> 1) >>> 0) / (d >>> 0) << 16 >> 16;f = 0;while (1) { - e = (f << 1) + b | 0;h[e >> 1] = o(d, h[e >> 1]) >>> 14;f = f + 1 | 0;if ((f | 0) != (c | 0)) { - continue; - }break; - }if ((c | 0) < 1 | t) { - break f; - }f = 0;while (1) { - d = (f << 1) + a | 0;h[d >> 1] = k[d >> 1] << 1;f = f + 1 | 0;if ((f | 0) != (c | 0)) { - continue; - }break; - }f = 0;if ((c | 0) <= 0) { - break f; - }while (1) { - d = (f << 1) + b | 0;a = h[d >> 1];a = (a | 0) > -16383 ? a : -16383;h[d >> 1] = ((a | 0) < 16383 ? a : 16383) << 1;f = f + 1 | 0;if ((f | 0) != (c | 0)) { - continue; - }break; - } - } - }function S(a) { - var b = 0, - c = 0, - d = 0, - e = 0, - f = 0, - g = 0, - h = 0;a: { - if (!a) { - break a; - }d = a + -8 | 0;c = i[a + -4 >> 2];a = c & -8;f = d + a | 0;b: { - if (c & 1) { - break b; - }if (!(c & 3)) { - break a; - }c = i[d >> 2];d = d - c | 0;if (d >>> 0 < l[3812]) { - break a; - }a = a + c | 0;if (i[3813] != (d | 0)) { - if (c >>> 0 <= 255) { - e = i[d + 8 >> 2];c = c >>> 3 | 0;b = i[d + 12 >> 2];if ((b | 0) == (e | 0)) { - i[3808] = i[3808] & ic(c);break b; - }i[e + 12 >> 2] = b;i[b + 8 >> 2] = e;break b; - }h = i[d + 24 >> 2];c = i[d + 12 >> 2];c: { - if ((d | 0) != (c | 0)) { - b = i[d + 8 >> 2];i[b + 12 >> 2] = c;i[c + 8 >> 2] = b;break c; - }d: { - e = d + 20 | 0;b = i[e >> 2];if (b) { - break d; - }e = d + 16 | 0;b = i[e >> 2];if (b) { - break d; - }c = 0;break c; - }while (1) { - g = e;c = b;e = c + 20 | 0;b = i[e >> 2];if (b) { - continue; - }e = c + 16 | 0;b = i[c + 16 >> 2];if (b) { - continue; - }break; - }i[g >> 2] = 0; - }if (!h) { - break b; - }e = i[d + 28 >> 2];b = (e << 2) + 15536 | 0;e: { - if (i[b >> 2] == (d | 0)) { - i[b >> 2] = c;if (c) { - break e; - }i[3809] = i[3809] & ic(e);break b; - }i[h + (i[h + 16 >> 2] == (d | 0) ? 16 : 20) >> 2] = c;if (!c) { - break b; - } - }i[c + 24 >> 2] = h;b = i[d + 16 >> 2];if (b) { - i[c + 16 >> 2] = b;i[b + 24 >> 2] = c; - }b = i[d + 20 >> 2];if (!b) { - break b; - }i[c + 20 >> 2] = b;i[b + 24 >> 2] = c;break b; - }c = i[f + 4 >> 2];if ((c & 3) != 3) { - break b; - }i[3810] = a;i[f + 4 >> 2] = c & -2;i[d + 4 >> 2] = a | 1;i[a + d >> 2] = a;return; - }if (f >>> 0 <= d >>> 0) { - break a; - }c = i[f + 4 >> 2];if (!(c & 1)) { - break a; - }f: { - if (!(c & 2)) { - if (i[3814] == (f | 0)) { - i[3814] = d;a = i[3811] + a | 0;i[3811] = a;i[d + 4 >> 2] = a | 1;if (i[3813] != (d | 0)) { - break a; - }i[3810] = 0;i[3813] = 0;return; - }if (i[3813] == (f | 0)) { - i[3813] = d;a = i[3810] + a | 0;i[3810] = a;i[d + 4 >> 2] = a | 1;i[a + d >> 2] = a;return; - }a = (c & -8) + a | 0;g: { - if (c >>> 0 <= 255) { - b = i[f + 8 >> 2];c = c >>> 3 | 0;e = i[f + 12 >> 2];if ((b | 0) == (e | 0)) { - i[3808] = i[3808] & ic(c);break g; - }i[b + 12 >> 2] = e;i[e + 8 >> 2] = b;break g; - }h = i[f + 24 >> 2];c = i[f + 12 >> 2];h: { - if ((f | 0) != (c | 0)) { - b = i[f + 8 >> 2];i[b + 12 >> 2] = c;i[c + 8 >> 2] = b;break h; - }i: { - e = f + 20 | 0;b = i[e >> 2];if (b) { - break i; - }e = f + 16 | 0;b = i[e >> 2];if (b) { - break i; - }c = 0;break h; - }while (1) { - g = e;c = b;e = c + 20 | 0;b = i[e >> 2];if (b) { - continue; - }e = c + 16 | 0;b = i[c + 16 >> 2];if (b) { - continue; - }break; - }i[g >> 2] = 0; - }if (!h) { - break g; - }e = i[f + 28 >> 2];b = (e << 2) + 15536 | 0;j: { - if (i[b >> 2] == (f | 0)) { - i[b >> 2] = c;if (c) { - break j; - }i[3809] = i[3809] & ic(e);break g; - }i[h + (i[h + 16 >> 2] == (f | 0) ? 16 : 20) >> 2] = c;if (!c) { - break g; - } - }i[c + 24 >> 2] = h;b = i[f + 16 >> 2];if (b) { - i[c + 16 >> 2] = b;i[b + 24 >> 2] = c; - }b = i[f + 20 >> 2];if (!b) { - break g; - }i[c + 20 >> 2] = b;i[b + 24 >> 2] = c; - }i[d + 4 >> 2] = a | 1;i[a + d >> 2] = a;if (i[3813] != (d | 0)) { - break f; - }i[3810] = a;return; - }i[f + 4 >> 2] = c & -2;i[d + 4 >> 2] = a | 1;i[a + d >> 2] = a; - }if (a >>> 0 <= 255) { - a = a >>> 3 | 0;c = (a << 3) + 15272 | 0;b = i[3808];a = 1 << a;k: { - if (!(b & a)) { - i[3808] = a | b;a = c;break k; - }a = i[c + 8 >> 2]; - }i[c + 8 >> 2] = d;i[a + 12 >> 2] = d;i[d + 12 >> 2] = c;i[d + 8 >> 2] = a;return; - }i[d + 16 >> 2] = 0;i[d + 20 >> 2] = 0;f = d;e = a >>> 8 | 0;b = 0;l: { - if (!e) { - break l; - }b = 31;if (a >>> 0 > 16777215) { - break l; - }c = e;e = e + 1048320 >>> 16 & 8;b = c << e;h = b + 520192 >>> 16 & 4;b = b << h;g = b + 245760 >>> 16 & 2;b = (b << g >>> 15 | 0) - (g | (e | h)) | 0;b = (b << 1 | a >>> b + 21 & 1) + 28 | 0; - }i[f + 28 >> 2] = b;g = (b << 2) + 15536 | 0;m: { - n: { - e = i[3809];c = 1 << b;o: { - if (!(e & c)) { - i[3809] = c | e;i[g >> 2] = d;i[d + 24 >> 2] = g;break o; - }e = a << ((b | 0) == 31 ? 0 : 25 - (b >>> 1 | 0) | 0);c = i[g >> 2];while (1) { - b = c;if ((i[c + 4 >> 2] & -8) == (a | 0)) { - break n; - }c = e >>> 29 | 0;e = e << 1;g = b + (c & 4) | 0;c = i[g + 16 >> 2];if (c) { - continue; - }break; - }i[g + 16 >> 2] = d;i[d + 24 >> 2] = b; - }i[d + 12 >> 2] = d;i[d + 8 >> 2] = d;break m; - }a = i[b + 8 >> 2];i[a + 12 >> 2] = d;i[b + 8 >> 2] = d;i[d + 24 >> 2] = 0;i[d + 12 >> 2] = b;i[d + 8 >> 2] = a; - }a = i[3816] + -1 | 0;i[3816] = a;if (a) { - break a; - }d = 15688;while (1) { - a = i[d >> 2];d = a + 8 | 0;if (a) { - continue; - }break; - }i[3816] = -1; - } - }function Na(a, b) { - var c = 0, - d = 0, - e = 0, - f = 0, - g = 0, - h = 0;f = a + b | 0;a: { - b: { - c = i[a + 4 >> 2];if (c & 1) { - break b; - }if (!(c & 3)) { - break a; - }c = i[a >> 2];b = c + b | 0;a = a - c | 0;if ((a | 0) != i[3813]) { - if (c >>> 0 <= 255) { - e = c >>> 3 | 0;c = i[a + 8 >> 2];d = i[a + 12 >> 2];if ((d | 0) == (c | 0)) { - i[3808] = i[3808] & ic(e);break b; - }i[c + 12 >> 2] = d;i[d + 8 >> 2] = c;break b; - }h = i[a + 24 >> 2];c = i[a + 12 >> 2];c: { - if ((c | 0) != (a | 0)) { - d = i[a + 8 >> 2];i[d + 12 >> 2] = c;i[c + 8 >> 2] = d;break c; - }d: { - d = a + 20 | 0;e = i[d >> 2];if (e) { - break d; - }d = a + 16 | 0;e = i[d >> 2];if (e) { - break d; - }c = 0;break c; - }while (1) { - g = d;c = e;d = c + 20 | 0;e = i[d >> 2];if (e) { - continue; - }d = c + 16 | 0;e = i[c + 16 >> 2];if (e) { - continue; - }break; - }i[g >> 2] = 0; - }if (!h) { - break b; - }d = i[a + 28 >> 2];e = (d << 2) + 15536 | 0;e: { - if (i[e >> 2] == (a | 0)) { - i[e >> 2] = c;if (c) { - break e; - }i[3809] = i[3809] & ic(d);break b; - }i[h + (i[h + 16 >> 2] == (a | 0) ? 16 : 20) >> 2] = c;if (!c) { - break b; - } - }i[c + 24 >> 2] = h;d = i[a + 16 >> 2];if (d) { - i[c + 16 >> 2] = d;i[d + 24 >> 2] = c; - }d = i[a + 20 >> 2];if (!d) { - break b; - }i[c + 20 >> 2] = d;i[d + 24 >> 2] = c;break b; - }c = i[f + 4 >> 2];if ((c & 3) != 3) { - break b; - }i[3810] = b;i[f + 4 >> 2] = c & -2;i[a + 4 >> 2] = b | 1;i[f >> 2] = b;return; - }c = i[f + 4 >> 2];f: { - if (!(c & 2)) { - if (i[3814] == (f | 0)) { - i[3814] = a;b = i[3811] + b | 0;i[3811] = b;i[a + 4 >> 2] = b | 1;if (i[3813] != (a | 0)) { - break a; - }i[3810] = 0;i[3813] = 0;return; - }if (i[3813] == (f | 0)) { - i[3813] = a;b = i[3810] + b | 0;i[3810] = b;i[a + 4 >> 2] = b | 1;i[a + b >> 2] = b;return; - }b = (c & -8) + b | 0;g: { - if (c >>> 0 <= 255) { - e = c >>> 3 | 0;c = i[f + 8 >> 2];d = i[f + 12 >> 2];if ((d | 0) == (c | 0)) { - i[3808] = i[3808] & ic(e);break g; - }i[c + 12 >> 2] = d;i[d + 8 >> 2] = c;break g; - }h = i[f + 24 >> 2];c = i[f + 12 >> 2];h: { - if ((f | 0) != (c | 0)) { - d = i[f + 8 >> 2];i[d + 12 >> 2] = c;i[c + 8 >> 2] = d;break h; - }i: { - d = f + 20 | 0;e = i[d >> 2];if (e) { - break i; - }d = f + 16 | 0;e = i[d >> 2];if (e) { - break i; - }c = 0;break h; - }while (1) { - g = d;c = e;d = c + 20 | 0;e = i[d >> 2];if (e) { - continue; - }d = c + 16 | 0;e = i[c + 16 >> 2];if (e) { - continue; - }break; - }i[g >> 2] = 0; - }if (!h) { - break g; - }d = i[f + 28 >> 2];e = (d << 2) + 15536 | 0;j: { - if (i[e >> 2] == (f | 0)) { - i[e >> 2] = c;if (c) { - break j; - }i[3809] = i[3809] & ic(d);break g; - }i[h + (i[h + 16 >> 2] == (f | 0) ? 16 : 20) >> 2] = c;if (!c) { - break g; - } - }i[c + 24 >> 2] = h;d = i[f + 16 >> 2];if (d) { - i[c + 16 >> 2] = d;i[d + 24 >> 2] = c; - }d = i[f + 20 >> 2];if (!d) { - break g; - }i[c + 20 >> 2] = d;i[d + 24 >> 2] = c; - }i[a + 4 >> 2] = b | 1;i[a + b >> 2] = b;if (i[3813] != (a | 0)) { - break f; - }i[3810] = b;return; - }i[f + 4 >> 2] = c & -2;i[a + 4 >> 2] = b | 1;i[a + b >> 2] = b; - }if (b >>> 0 <= 255) { - c = b >>> 3 | 0;b = (c << 3) + 15272 | 0;d = i[3808];c = 1 << c;k: { - if (!(d & c)) { - i[3808] = c | d;c = b;break k; - }c = i[b + 8 >> 2]; - }i[b + 8 >> 2] = a;i[c + 12 >> 2] = a;i[a + 12 >> 2] = b;i[a + 8 >> 2] = c;return; - }i[a + 16 >> 2] = 0;i[a + 20 >> 2] = 0;d = a;e = b >>> 8 | 0;c = 0;l: { - if (!e) { - break l; - }c = 31;if (b >>> 0 > 16777215) { - break l; - }g = e + 1048320 >>> 16 & 8;e = e << g;c = e + 520192 >>> 16 & 4;f = e << c;e = f + 245760 >>> 16 & 2;c = (f << e >>> 15 | 0) - (e | (c | g)) | 0;c = (c << 1 | b >>> c + 21 & 1) + 28 | 0; - }i[d + 28 >> 2] = c;e = (c << 2) + 15536 | 0;m: { - d = i[3809];g = 1 << c;n: { - if (!(d & g)) { - i[3809] = d | g;i[e >> 2] = a;break n; - }d = b << ((c | 0) == 31 ? 0 : 25 - (c >>> 1 | 0) | 0);c = i[e >> 2];while (1) { - e = c;if ((i[c + 4 >> 2] & -8) == (b | 0)) { - break m; - }c = d >>> 29 | 0;d = d << 1;g = e + (c & 4) | 0;c = i[g + 16 >> 2];if (c) { - continue; - }break; - }i[g + 16 >> 2] = a; - }i[a + 24 >> 2] = e;i[a + 12 >> 2] = a;i[a + 8 >> 2] = a;return; - }b = i[e + 8 >> 2];i[b + 12 >> 2] = a;i[e + 8 >> 2] = a;i[a + 24 >> 2] = 0;i[a + 12 >> 2] = e;i[a + 8 >> 2] = b; - } - }function hb(a, b, c) { - a = a | 0;b = b | 0;c = c | 0;var d = 0, - e = 0, - f = 0, - g = 0;d = H - 16 | 0;H = d;a: { - b: { - c: { - d: { - e: { - f: { - g: { - h: { - switch (b | 0) {case 101: - b = i[a + 20 >> 2];if ((b | 0) >= 1) { - break g; - }break a;case 26: - if (i[a + 24 >> 2] >= 1) { - b = i[a + 64 >> 2];c = 0;while (1) { - i[b + (c << 2) >> 2] = 0;c = c + 1 | 0;if ((c | 0) < i[a + 24 >> 2] << 1) { - continue; - }break; - } - }b = i[a + 44 >> 2];e = i[a + 48 >> 2];c = 0;while (1) { - f = c << 1;h[f + e >> 1] = 0;h[b + f >> 1] = 0;c = c + 1 | 0;if ((c | 0) != 64) { - continue; - }break; - }e = 0;h[a + 80 >> 1] = 0;break a;case 10: - i[a + 96 >> 2] = i[c >> 2];break a;case 8: - a = i[a + 4 >> 2];J[i[i[a >> 2] + 48 >> 2]](a, 8, c) | 0;break a;case 9: - a = i[a + 4 >> 2];J[i[i[a >> 2] + 48 >> 2]](a, 9, c) | 0;break a;case 3: - i[c >> 2] = i[a + 8 >> 2];break a;case 0: - b = i[a + 4 >> 2];J[i[i[b >> 2] + 48 >> 2]](b, 0, c) | 0;i[a + 36 >> 2] = i[c >> 2];break a;case 1: - i[c >> 2] = i[a + 36 >> 2];break a;case 4:case 6: - b = i[c >> 2];b = (b | 0) > 0 ? b : 0;b = i[i[a >> 2] >> 2] + (((b | 0) < 10 ? b : 10) << 2) | 0;i[a + 96 >> 2] = i[b + 104 >> 2];i[d + 12 >> 2] = i[b + 60 >> 2];a = i[a + 4 >> 2];J[i[i[a >> 2] + 48 >> 2]](a, 6, d + 12 | 0) | 0;break a;case 19: - b = i[a + 4 >> 2];J[i[i[b >> 2] + 48 >> 2]](b, 19, c) | 0;b = i[a + 32 >> 2];e = i[i[a + 92 >> 2] + (i[a + 96 >> 2] << 2) >> 2];if (e) { - i[c >> 2] = i[c >> 2] + ((o(b, i[e + 52 >> 2]) | 0) / i[a + 8 >> 2] | 0);e = 0;break a; - }i[c >> 2] = i[c >> 2] + ((b << 2) / i[a + 8 >> 2] | 0);e = 0;break a;case 24: - b = i[c >> 2];i[a + 32 >> 2] = b;i[d + 12 >> 2] = b >> 1;a = i[a + 4 >> 2];J[i[i[a >> 2] + 48 >> 2]](a, 24, d + 12 | 0) | 0;break a;case 25: - i[c >> 2] = i[a + 32 >> 2];break a;case 20: - a = i[a + 4 >> 2];J[i[i[a >> 2] + 48 >> 2]](a, 20, c) | 0;break a;case 22: - a = i[a + 4 >> 2];J[i[i[a >> 2] + 48 >> 2]](a, 22, c) | 0;break a;case 36: - i[a + 88 >> 2] = i[c >> 2];a = i[a + 4 >> 2];J[i[i[a >> 2] + 48 >> 2]](a, 36, c) | 0;break a;case 37: - i[c >> 2] = i[a + 88 >> 2];break a;case 39: - a = i[a + 4 >> 2];J[i[i[a >> 2] + 48 >> 2]](a, 39, c) | 0;i[c >> 2] = i[c >> 2] << 1;break a;case 44: - a = i[a + 4 >> 2];J[i[i[a >> 2] + 48 >> 2]](a, 44, c) | 0;break a;case 45: - a = i[a + 4 >> 2];J[i[i[a >> 2] + 48 >> 2]](a, 45, c) | 0;break a;case 47: - a = i[a + 4 >> 2];J[i[i[a >> 2] + 48 >> 2]](a, 47, c) | 0;break a;case 106: - break c;case 105: - break d;case 104: - break e;case 103: - break f;case 100: - break h;default: - break b;} - }if (i[a + 20 >> 2] < 1) { - break a; - }f = i[a + 68 >> 2];b = 0;while (1) { - g = b << 2;i[g + c >> 2] = i[f + g >> 2];b = b + 1 | 0;if ((b | 0) < i[a + 20 >> 2]) { - continue; - }break; - }break a; - }f = i[a + 72 >> 2];a = 0;while (1) { - g = a << 1;h[g + c >> 1] = k[f + g >> 1];a = a + 1 | 0;if ((b | 0) != (a | 0)) { - continue; - }break; - }break a; - }a = i[a + 4 >> 2];J[i[i[a >> 2] + 48 >> 2]](a, 103, c) | 0;break a; - }i[a + 76 >> 2] = c;break a; - }a = i[a + 4 >> 2];J[i[i[a >> 2] + 48 >> 2]](a, 105, c) | 0;break a; - }i[c >> 2] = i[a + 40 >> 2];break a; - }i[d + 4 >> 2] = b;i[d >> 2] = 13123;Y(i[3524], 13166, d);e = -1; - }H = d + 16 | 0;return e | 0; - }function $a(a) { - var b = 0, - c = 0, - d = 0, - e = 0, - f = 0, - g = 0, - h = 0, - i = 0, - j = 0, - k = 0, - l = 0, - m = 0, - o = 0, - p = 0;c = 1;a: { - b: { - nc(+a);e = kc(1) | 0;g = kc(0) | 0;b = e;c: { - if ((b | 0) == 1072693248 ? !g : 0) { - break c; - }e = b & 2147483647;if (e >>> 0 > 2146435072 | (e | 0) == 2146435072 & (g | 0) != 0) { - return a + .3; - }c = q(a);if (!((e ? (b & 1073741823) != 1072693248 : 0) | g)) { - if ((b | 0) > -1) { - break c; - }if (!(e + -1072693248 | 0)) { - a = c - c;return a / a; - }return c; - }if ((b | 0) <= -1) { - a = a - a;return a / a; - }d = c * 9007199254740992;h = e >>> 0 < 1048576;a = h ? d : c;nc(+d);b = kc(1) | 0;kc(0) | 0;b = h ? b : e;g = b & 1048575;e = g | 1072693248;m = (b >> 20) + (h ? -1076 : -1023) | 0;d: { - if (g >>> 0 < 235663) { - break d; - }if (g >>> 0 < 767610) { - j = 1;break d; - }e = e + -1048576 | 0;m = m + 1 | 0; - }h = j << 3;p = n[h + 14080 >> 3];nc(+a);kc(1) | 0;lc(0, kc(0) | 0);lc(1, e | 0);c = +mc();i = n[h + 14048 >> 3];d = c - i;a = 1 / (i + c);l = d * a;nc(+l);b = kc(1) | 0;kc(0) | 0;lc(0, 0);lc(1, b | 0);k = +mc();f = k * k;o = a;lc(0, 0);lc(1, ((e >> 1 | 536870912) + (j << 18) | 0) + 524288 | 0);a = +mc();i = o * (d - k * a - k * (c - (a - i)));a = l * l;a = (l + k) * i + a * a * (a * (a * (a * (a * (a * .20697501780033842 + .23066074577556175) + .272728123808534) + .33333332981837743) + .4285714285785502) + .5999999999999946);nc(+(f + 3 + a));b = kc(1) | 0;kc(0) | 0;lc(0, 0);lc(1, b | 0);c = +mc();d = k * c;a = i * c + l * (a - (c + -3 - f));nc(+(d + a));b = kc(1) | 0;kc(0) | 0;lc(0, 0);lc(1, b | 0);f = +mc();i = f * .9617967009544373;d = n[h + 14064 >> 3] + ((a - (f - d)) * .9617966939259756 + f * -7.028461650952758e-9);a = +(m | 0);nc(+(p + (i + d) + a));b = kc(1) | 0;kc(0) | 0;lc(0, 0);lc(1, b | 0);f = +mc();c = f * .2999999523162842;d = (d - (f - a - p - i)) * .3 + f * 4.768371580921027e-8;a = c + d;nc(+a);h = kc(1) | 0;g = kc(0) | 0;e: { - b = h;h = b;if ((b | 0) >= 1083179008) { - if (g | h + -1083179008) { - break b; - }if (d + 8.008566259537294e-17 > a - c ^ 1) { - break e; - }break b; - }if ((h & 2147482624) >>> 0 < 1083231232) { - break e; - }if (g | h + 1064252416) { - break a; - }if (d <= a - c ^ 1) { - break e; - }break a; - }j = 0;e = h & 2147483647;if (e >>> 0 >= 1071644673) { - g = h + (1048576 >>> (e >>> 20 | 0) + -1022 | 0) | 0;e = g >>> 20 & 2047;b = (g & 1048575 | 1048576) >>> 1043 - e | 0;j = (h | 0) < 0 ? 0 - b | 0 : b;lc(0, 0);lc(1, g & -1048576 >> e + -1023);c = c - +mc();nc(+(d + c));b = kc(1) | 0;kc(0) | 0; - }lc(0, 0);lc(1, b | 0);a = +mc();i = a * .6931471824645996;d = (d - (a - c)) * .6931471805599453 + a * -1.904654299957768e-9;f = i + d;a = f * f;a = f - a * (a * (a * (a * (a * 4.1381367970572385e-8 + -16533902205465252e-22) + 6613756321437934e-20) + -.0027777777777015593) + .16666666666666602);o = f * a / (a + -2);a = d - (f - i);a = f - (o - (a + f * a)) + 1;nc(+a);b = kc(1) | 0;g = kc(0) | 0;b = (j << 20) + b | 0;f: { - if ((b | 0) <= 1048575) { - a = cc(a, j);break f; - }lc(0, g | 0);lc(1, b | 0);a = +mc(); - }c = a * 1; - }return c; - }return z; - }return 0; - }function ha(a, b, c, d) { - var e = 0, - f = 0, - g = 0, - j = 0, - k = 0, - l = 0, - m = 0, - n = 0, - p = 0, - q = 0, - r = 0, - s = 0, - t = 0, - u = 0, - v = 0, - w = 0, - x = 0, - y = 0, - z = 0;q = (0 - d & 3) + d | 0;n = c >> 1;f = n + 1 | 0;j = f << 2;d = q + j | 0;d = (0 - d & 3) + d | 0;g = j;k = c + 3 | 0;l = o(k, f) << 2;f = l + d | 0;j = (0 - f & 3) + f | 0;f = g + j | 0;f = (0 - f & 3) + f | 0;l = f + l | 0;if ((c | 0) >= 0) { - p = (n | 0) > 0 ? n : 0;while (1) { - g = e << 2;r = o(e, k) << 2;i[g + q >> 2] = r + d;i[j + g >> 2] = f + r;g = (e | 0) != (p | 0);e = e + 1 | 0;if (g) { - continue; - }break; - } - }l = l + (l & 1) | 0;e = 0;if ((c | 0) > 0) { - while (1) { - f = e << 1;d = h[f + a >> 1];a: { - if ((d | 0) <= 12867) { - d = (o(d, d) << 3) + 32768 >> 16;d = (o(((o((o(d, -10) + 4096 >> 13) + 340 | 0, d) << 3) + 32768 & -65536) + -268435456 >> 16, d) + 4096 >>> 13 | 0) - -8192 | 0;break a; - }d = 25736 - d << 16 >> 16;d = (o(d, d) << 3) + 32768 >> 16;d = -8192 - (o(((o((o(d, -10) + 4096 >> 13) + 340 | 0, d) << 3) + 32768 & -65536) + -268435456 >> 16, d) + 4096 >>> 13 | 0) | 0; - }h[f + l >> 1] = d << 2;e = e + 1 | 0;if ((e | 0) != (c | 0)) { - continue; - }break; - } - }e = 0;if ((c | 0) >= 0) { - d = (n | 0) > 0 ? n : 0;while (1) { - f = e << 2;a = i[f + q >> 2];i[a + 4 >> 2] = 0;i[a + 8 >> 2] = 1048576;k = (e << 3) + 8 | 0;i[k + a >> 2] = 1048576;a = i[f + j >> 2];i[a + 4 >> 2] = 0;i[a + 8 >> 2] = 1048576;i[a + k >> 2] = 1048576;a = (d | 0) != (e | 0);e = e + 1 | 0;if (a) { - continue; - }break; - } - }d = i[q + 4 >> 2];e = h[l >> 1];a = i[i[q >> 2] + 8 >> 2];i[d + 12 >> 2] = 0 - (o(e, a << 2 >> 16) + (o(e, a & 16383) >> 14) | 0);e = h[l + 2 >> 1];a = i[i[j >> 2] + 8 >> 2];i[i[j + 4 >> 2] + 12 >> 2] = 0 - (o(e, a << 2 >> 16) + (o(e, a & 16383) >> 14) | 0);if ((c | 0) >= 4) { - x = (n | 0) > 2 ? n : 2;e = 3;k = 1;while (1) { - f = 2;a = k << 2;p = h[a + l >> 1];g = i[d + 8 >> 2];g = o(p, g << 2 >> 16) + (o(p, g & 16383) >> 14) | 0;s = a + j | 0;r = i[s >> 2];k = k + 1 | 0;m = k << 2;t = m + j | 0;y = i[t >> 2];u = l + (a | 2) | 0;v = h[u >> 1];w = q + m | 0;z = i[w >> 2];a = 1;while (1) { - m = a << 2;a = m + 8 | 0;i[a + z >> 2] = i[d + m >> 2] + (i[a + d >> 2] - g | 0);g = a + y | 0;m = i[m + r >> 2] + i[a + r >> 2] | 0;a = f;f = i[r + (a << 2) >> 2];i[g >> 2] = (m - (o(f & 16383, v) >> 14) | 0) - o(f << 2 >> 16, v);f = a + 1 | 0;m = f << 2;g = i[m + d >> 2];g = o(p, g << 2 >> 16) + (o(p, g & 16383) >> 14) | 0;if ((a | 0) != (e | 0)) { - continue; - }break; - }a = i[w >> 2];f = e + 2 | 0;p = f << 2;e = e << 2;i[a + p >> 2] = i[e + d >> 2] - g;g = i[s >> 2];d = i[g + m >> 2];g = i[e + g >> 2];e = h[u >> 1];i[p + i[t >> 2] >> 2] = (g - (o(e, d & 16383) >> 14) | 0) - o(e, d << 2 >> 16);d = a;e = f;if ((k | 0) != (x | 0)) { - continue; - }break; - } - }if ((c | 0) >= 1) { - a = n << 2;f = i[a + j >> 2];n = i[a + q >> 2];d = 0;e = 1;a = 0;while (1) { - j = d - a | 0;a = (e << 2) + 8 | 0;d = i[a + n >> 2];a = i[a + f >> 2];j = a + (d + j | 0) | 0;j = (j | 0) < -8388480 ? -32767 : j + 128 >> 8;h[((e << 1) + b | 0) + -2 >> 1] = (j | 0) < 32767 ? j : 32767;j = (c | 0) != (e | 0);e = e + 1 | 0;if (j) { - continue; - }break; - } - } - }function Kb(a, b, c, d) { - var e = p(0), - f = p(0), - g = 0, - j = p(0), - k = p(0), - l = p(0), - n = 0, - o = p(0), - r = p(0), - u = p(0), - v = p(0), - w = 0, - x = p(0), - y = 0, - z = 0, - A = p(0), - B = p(0), - C = p(0), - D = p(0), - E = p(0), - F = 0, - G = 0, - H = 0, - I = 0;g = c >> 1;if ((c | 0) >= 2) { - I = (g | 0) > 1 ? g : 1;while (1) { - e = f;f = p(h[(w << 1) + b >> 1]);f = p(e + p(f * f));w = w + 1 | 0;if ((I | 0) != (w | 0)) { - continue; - }break; - } - }if ((g | 0) < (c | 0)) { - while (1) { - j = p(h[(g << 1) + b >> 1]);x = p(x + p(j * j));g = g + 1 | 0;if ((g | 0) != (c | 0)) { - continue; - }break; - } - }l = m[a + 52 >> 2];u = m[a + 56 >> 2];k = p(l / u);m[a + 48 >> 2] = k;j = p(f + x);e = m[a >> 2];A = p(p(j * e) + p(p(p(1) - e) * m[a + 4 >> 2]));m[a + 4 >> 2] = A;B = m[a + 16 >> 2];r = p(ba(+p(j + p(6e3))));C = m[a + 12 >> 2];e = p(r - C);o = p(p(e * e) + p(0));e = p(r - B);o = p(o + p(e * e));D = m[a + 20 >> 2];e = p(r - D);o = p(o + p(e * e));E = m[a + 24 >> 2];e = p(r - E);o = p(o + p(e * e));e = p(r - m[a + 28 >> 2]);o = p(s(p(p(o + p(e * e)) / p(150)), p(1)));F = +d;y = F + -.4;v = p(y * 3 * q(y));G = +j;e = p($a(G));H = +u;if (!(j > p(6e3) ^ 1 | H < .06 ^ 1)) { - l = p(+e * .05);m[a + 52 >> 2] = l; - }a: { - b: { - z = +v;n = +o;c: { - if ((+k * 1.2 > +e ? !(z < .3 ^ 1 | n < .2 ^ 1) : 0) | (+k * 1.5 > +e ? !(z < .3 ^ 1 | n < .05 ^ 1) : 0)) { - break c; - }if (+k * 1.2 > +e ? !(z < .4 ^ 1 | n < .05 ^ 1) : 0) { - break c; - }if (v < p(0) ^ 1 | n < .05 ^ 1) { - break b; - } - }b = i[a + 60 >> 2];g = b + 1 | 0;i[a + 60 >> 2] = g;if ((b | 0) < 3) { - break a; - }u = p(H * .95 + .05);m[a + 56 >> 2] = u;v = p(k * p(3));l = p(+(v < e ? v : e) * .05 + +l * .95);m[a + 52 >> 2] = l;break a; - }g = 0;i[a + 60 >> 2] = 0; - }if (!(j > p(6e3) ^ 1 | k > e ^ 1)) { - m[a + 56 >> 2] = +u * .95 + .05;m[a + 52 >> 2] = +e * .05 + +l * .95; - }d: { - if (!(j < p(3e4) ^ 1)) { - e = j < p(1e4) ? p(5.600000381469727) : p(6.300000190734863);f = e;if (j < p(3e3) ^ 1) { - break d; - }f = p(+e + -.7);break d; - }l = p(j + p(1));e = p(s(p(t(p(ba(+p(l / p(A + p(1))))), p(-5))), p(2)));n = +e;k = e > p(0) ? p(n * .6 + 7) : p(7);e = e < p(0) ? p(n * .5 + +k) : k;k = p(ba(+p(l / p(m[a + 8 >> 2] + p(1)))));if (!(k > p(0) ^ 1)) { - e = p(+p(s(k, p(5))) * .5 + +e); - }f = +f * 1.6 < +x ? p(e + p(.5)) : e; - }m[a + 8 >> 2] = j;e = p(F * .4 + +m[a + 40 >> 2] * .6);m[a + 40 >> 2] = e;k = m[a + 44 >> 2];f = p((y + (+e + -.4)) * 2.2 + +f);if (!(k > f ^ 1)) { - f = p(+k * .5 + +f * .5); - }f = (g | 0) > 2 ? p(4) : p(s(p(t(f, p(4))), p(10)));if (g) { - f = p(+f - (ba(+(g | 0) + 3) + -1.0986122886681098)); - }f = p(t(f, p(0)));if (!(j < p(6e4) ^ 1)) { - e: { - if ((g | 0) < 3) { - break e; - }n = (ba(+(g | 0) + 3) + -1.0986122886681098) * .5;f = p(+f - n);if (j < p(1e4) ^ 1) { - break e; - }f = p(+f - n); - }f = p(ba(G / 6e4 + 1e-4) * .3 + +p(t(f, p(0)))); - }m[a + 36 >> 2] = d;m[a + 28 >> 2] = E;m[a + 24 >> 2] = D;m[a + 20 >> 2] = B;m[a + 16 >> 2] = C;m[a + 12 >> 2] = r;d = p(t(f, p(-1)));m[a + 44 >> 2] = d;return d; - }function qb(a, b, c, d) { - a = a | 0;b = b | 0;c = c | 0;d = d | 0;var e = 0, - f = 0, - i = 0, - j = 0, - l = 0, - m = 0, - n = 0, - p = 0, - q = 0, - r = 0;p = H - 32 | 0;H = p;a: { - b: { - c: { - if ((c | 0) < 1) { - break c; - }while (1) { - f = e << 1;h[f + b >> 1] = k[a + f >> 1];e = e + 1 | 0;if ((e | 0) != (c | 0)) { - continue; - }break; - }if ((c | 0) < 1) { - break c; - }f = h[b >> 1];j = p;i = c + -1 | 0;e = 25736;d: { - if (!i) { - break d; - }e = k[b + 2 >> 1]; - }e = e - f | 0;h[j >> 1] = 81920 / (((e << 16 >> 16 < (f | 0) ? e : f) << 16) + 19660800 >> 16);e = 1;if ((c | 0) != 1) { - while (1) { - m = e << 1;f = m + b | 0;l = k[f >> 1];j = l - k[f + -2 >> 1] << 16 >> 16;f = e + 1 | 0;e = ((e | 0) != (i | 0) ? k[(f << 1) + b >> 1] : 25736) - l | 0;h[m + p >> 1] = 81920 / (((e << 16 >> 16 < (j | 0) ? e : j) << 16) + 19660800 >> 16);e = f;if ((e | 0) != (c | 0)) { - continue; - }break; - } - }if ((c | 0) < 1) { - break c; - }e = 0;while (1) { - f = (e << 1) + b | 0;h[f >> 1] = k[f >> 1] - (o(e, 167772160) + 402653184 >>> 16 | 0);e = e + 1 | 0;if ((e | 0) != (c | 0)) { - continue; - }break; - }if ((c | 0) < 1) { - break c; - }m = 2147483647;l = 0;f = 4016;j = 0;while (1) { - i = 0;e = f;n = 0;while (1) { - r = i;i = k[(n << 1) + b >> 1] - (g[e | 0] << 5) << 16 >> 16;i = r + o(i, i) | 0;e = e + 1 | 0;n = n + 1 | 0;if ((n | 0) != (c | 0)) { - continue; - }break; - }e = (i | 0) < (m | 0);l = e ? j : l;m = e ? i : m;f = c + f | 0;j = j + 1 | 0;if ((j | 0) != 64) { - continue; - }break; - }f = o(c, l);e = 0;while (1) { - j = (e << 1) + b | 0;h[j >> 1] = k[j >> 1] - (g[(e + f | 0) + 4016 | 0] << 5);e = e + 1 | 0;if ((e | 0) != (c | 0)) { - continue; - }break; - }W(d, l, 6);if ((c | 0) < 1) { - break b; - }e = 0;while (1) { - f = (e << 1) + b | 0;h[f >> 1] = k[f >> 1] << 1;e = e + 1 | 0;if ((e | 0) != (c | 0)) { - continue; - }break; - }if ((c | 0) < 1) { - break b; - }f = 2147483647;m = 0;j = 4528;l = 0;while (1) { - i = 0;e = j;n = 0;while (1) { - r = i;i = n << 1;q = k[i + b >> 1] - (g[e | 0] << 5) << 16 >> 16;q = o(q, q);i = h[i + p >> 1];i = (r + (o(q & 32767, i) >> 15) | 0) + o(i, q << 1 >> 16) | 0;e = e + 1 | 0;n = n + 1 | 0;if ((n | 0) != (c | 0)) { - continue; - }break; - }e = (i | 0) < (f | 0);m = e ? l : m;f = e ? i : f;j = c + j | 0;l = l + 1 | 0;if ((l | 0) != 64) { - continue; - }break; - }f = o(c, m);e = 0;while (1) { - j = (e << 1) + b | 0;h[j >> 1] = k[j >> 1] - (g[(e + f | 0) + 4528 | 0] << 5);e = e + 1 | 0;if ((e | 0) != (c | 0)) { - continue; - }break; - }W(d, m, 6);e = 0;if ((c | 0) <= 0) { - break a; - }while (1) { - d = (e << 1) + b | 0;h[d >> 1] = h[d >> 1] + 1 >>> 1;e = e + 1 | 0;if ((e | 0) != (c | 0)) { - continue; - }break; - }e = 0;if ((c | 0) <= 0) { - break a; - }while (1) { - d = e << 1;f = d + b | 0;h[f >> 1] = k[a + d >> 1] - k[f >> 1];e = e + 1 | 0;if ((e | 0) != (c | 0)) { - continue; - }break; - }break a; - }W(d, 0, 6); - }W(d, 0, 6); - }H = p + 32 | 0; - }function wb(a, b, c) { - a = a | 0;b = b | 0;c = c | 0;var d = 0, - e = 0, - f = 0, - g = p(0), - j = 0;f = H - 16 | 0;H = f;a: { - b: { - switch (b | 0) {case 101: - if (i[a + 20 >> 2] < 1) { - break a; - }b = 0;while (1) { - d = i[a + 16 >> 2];h[(b << 1) + c >> 1] = Z(i[a + 52 >> 2] + (o(d, b) << 1) | 0, d);b = b + 1 | 0;if ((b | 0) < i[a + 20 >> 2]) { - continue; - }break; - }break a;case 26: - if (i[a + 24 >> 2] >= 1) { - b = i[a + 64 >> 2];c = 0;while (1) { - i[b + (c << 2) >> 2] = 0;c = c + 1 | 0;if ((c | 0) < i[a + 24 >> 2]) { - continue; - }break; - } - }b = i[a + 32 >> 2] + i[a + 12 >> 2] | 0;if ((b | 0) < 0) { - break a; - }U(i[a + 48 >> 2], 0, (b << 1) + 2 | 0);break a;case 6:case 8: - i[a + 120 >> 2] = i[c >> 2];break a;case 7:case 9: - i[c >> 2] = i[a + 120 >> 2];break a;case 0: - i[a + 124 >> 2] = i[c >> 2];break a;case 1: - i[c >> 2] = i[a + 124 >> 2];break a;case 3: - i[c >> 2] = i[a + 12 >> 2];break a;case 19: - b = i[a + 36 >> 2];e = i[i[a + 116 >> 2] + (i[a + 120 >> 2] << 2) >> 2];if (e) { - i[c >> 2] = (o(b, i[e + 52 >> 2]) | 0) / i[a + 12 >> 2];e = 0;break a; - }i[c >> 2] = (o(b, 5) | 0) / i[a + 12 >> 2];e = 0;break a;case 24: - i[a + 36 >> 2] = i[c >> 2];break a;case 25: - i[c >> 2] = i[a + 36 >> 2];break a;case 20: - b = i[c >> 2];a = o(b, 20) + a | 0;i[a + 132 >> 2] = i[c + 4 >> 2];c = i[c + 8 >> 2];i[a + 128 >> 2] = b;i[a + 136 >> 2] = c;break a;case 22: - i[a + 452 >> 2] = i[c + 4 >> 2];i[a + 456 >> 2] = i[c + 8 >> 2];i[a + 448 >> 2] = i[c >> 2];break a;case 36: - i[a + 112 >> 2] = i[c >> 2];break a;case 37: - i[c >> 2] = i[a + 112 >> 2];break a;case 39: - i[c >> 2] = i[a + 16 >> 2];break a;case 44: - i[a + 492 >> 2] = i[c >> 2];break a;case 45: - i[c >> 2] = i[a + 492 >> 2];break a;case 47: - b = h[a + 86 >> 1];d = h[a + 84 >> 1];a = h[a + 88 >> 1];g = p(s(p(ba(+((d | 0) / (a | 0) | 0)) / ba(+((b | 0) / (a | 0) | 0))), p(1)));g = p((g > p(0) ? g : p(0)) * p(100));c: { - if (p(q(g)) < p(2147483648)) { - a = ~~g;break c; - }a = -2147483648; - }i[c >> 2] = a;break a;case 100: - if (i[a + 20 >> 2] < 1) { - break a; - }d = i[a + 76 >> 2];b = 0;while (1) { - j = b << 2;i[j + c >> 2] = i[d + j >> 2];b = b + 1 | 0;if ((b | 0) < i[a + 20 >> 2]) { - continue; - }break; - }break a;case 103: - i[c >> 2] = i[a + 484 >> 2];break a;case 104: - i[a + 80 >> 2] = c;break a;case 105: - i[a + 488 >> 2] = i[c >> 2];break a;case 106: - i[c >> 2] = i[a + 44 >> 2];break a;default: - break b;} - }i[f + 4 >> 2] = b;i[f >> 2] = 12742;Y(i[3524], 12828, f);e = -1; - }H = f + 16 | 0;return e | 0; - }function dc(a, b) { - var c = 0, - d = 0, - e = 0, - f = 0, - g = 0, - h = 0, - j = 0, - k = 0, - l = 0;g = i[a + 4 >> 2];c = g & 3;d = g & -8;f = d + a | 0;a: { - if (!c) { - c = 0;if (b >>> 0 < 256) { - break a; - }if (d >>> 0 >= b + 4 >>> 0) { - c = a;if (d - b >>> 0 <= i[3928] << 1 >>> 0) { - break a; - } - }return 0; - }b: { - if (d >>> 0 >= b >>> 0) { - c = d - b | 0;if (c >>> 0 < 16) { - break b; - }i[a + 4 >> 2] = g & 1 | b | 2;b = a + b | 0;i[b + 4 >> 2] = c | 3;i[f + 4 >> 2] = i[f + 4 >> 2] | 1;Na(b, c);break b; - }c = 0;if (i[3814] == (f | 0)) { - d = d + i[3811] | 0;if (d >>> 0 <= b >>> 0) { - break a; - }i[a + 4 >> 2] = g & 1 | b | 2;c = a + b | 0;b = d - b | 0;i[c + 4 >> 2] = b | 1;i[3811] = b;i[3814] = c;break b; - }if (i[3813] == (f | 0)) { - d = d + i[3810] | 0;if (d >>> 0 < b >>> 0) { - break a; - }c = d - b | 0;c: { - if (c >>> 0 >= 16) { - i[a + 4 >> 2] = g & 1 | b | 2;b = a + b | 0;i[b + 4 >> 2] = c | 1;d = a + d | 0;i[d >> 2] = c;i[d + 4 >> 2] = i[d + 4 >> 2] & -2;break c; - }i[a + 4 >> 2] = d | g & 1 | 2;b = a + d | 0;i[b + 4 >> 2] = i[b + 4 >> 2] | 1;c = 0;b = 0; - }i[3813] = b;i[3810] = c;break b; - }e = i[f + 4 >> 2];if (e & 2) { - break a; - }h = d + (e & -8) | 0;if (h >>> 0 < b >>> 0) { - break a; - }k = h - b | 0;d: { - if (e >>> 0 <= 255) { - c = i[f + 8 >> 2];e = e >>> 3 | 0;d = i[f + 12 >> 2];if ((d | 0) == (c | 0)) { - i[3808] = i[3808] & ic(e);break d; - }i[c + 12 >> 2] = d;i[d + 8 >> 2] = c;break d; - }j = i[f + 24 >> 2];d = i[f + 12 >> 2];e: { - if ((f | 0) != (d | 0)) { - c = i[f + 8 >> 2];i[c + 12 >> 2] = d;i[d + 8 >> 2] = c;break e; - }f: { - c = f + 20 | 0;e = i[c >> 2];if (e) { - break f; - }c = f + 16 | 0;e = i[c >> 2];if (e) { - break f; - }d = 0;break e; - }while (1) { - l = c;d = e;c = d + 20 | 0;e = i[c >> 2];if (e) { - continue; - }c = d + 16 | 0;e = i[d + 16 >> 2];if (e) { - continue; - }break; - }i[l >> 2] = 0; - }if (!j) { - break d; - }c = i[f + 28 >> 2];e = (c << 2) + 15536 | 0;g: { - if (i[e >> 2] == (f | 0)) { - i[e >> 2] = d;if (d) { - break g; - }i[3809] = i[3809] & ic(c);break d; - }i[j + (i[j + 16 >> 2] == (f | 0) ? 16 : 20) >> 2] = d;if (!d) { - break d; - } - }i[d + 24 >> 2] = j;c = i[f + 16 >> 2];if (c) { - i[d + 16 >> 2] = c;i[c + 24 >> 2] = d; - }c = i[f + 20 >> 2];if (!c) { - break d; - }i[d + 20 >> 2] = c;i[c + 24 >> 2] = d; - }if (k >>> 0 <= 15) { - i[a + 4 >> 2] = g & 1 | h | 2;b = a + h | 0;i[b + 4 >> 2] = i[b + 4 >> 2] | 1;break b; - }i[a + 4 >> 2] = g & 1 | b | 2;b = a + b | 0;i[b + 4 >> 2] = k | 3;c = a + h | 0;i[c + 4 >> 2] = i[c + 4 >> 2] | 1;Na(b, k); - }c = a; - }return c; - }function Qb(a, b, c, d, e, f, j, k, l, m, n, p, q, r, s) { - a = a | 0;b = b | 0;c = c | 0;d = d | 0;e = e | 0;f = f | 0;j = j | 0;k = k | 0;l = l | 0;m = m | 0;n = n | 0;p = p | 0;q = q | 0;r = r | 0;s = s | 0;var t = 0;d = i[f + 4 >> 2];e = i[f >> 2];n = V(m, i[f + 8 >> 2]);e = e + o(4 << d, s) | 0;f = V(m, i[f + 4 >> 2]) << 2;s = g[e + f | 0];d = s + 32 | 0;t = g[e + (f | 2) | 0];m = t + 32 | 0;e = g[e + (f | 1) | 0] + 32 | 0;c = c + n | 0;a: { - if (!p | (c | 0) <= (q | 0)) { - break a; - }f = e >> 31;f = ((f + e ^ f) + ((s | 0) > -32 ? d : 0 - (d >>> 1 | 0) | 0) | 0) + ((t | 0) > -32 ? m : 0 - (m >>> 1 | 0) | 0) << 16 >> 16;n = r >> ((p | 0) > 3);n = (n | 0) < 62 ? n : 62;if ((f | 0) <= (n | 0)) { - break a; - }f = (n << 14) / (f | 0) << 16 >> 16;m = o(f, m) >>> 14 | 0;e = o(e, f) >>> 14 | 0;d = o(d, f) >>> 14 | 0; - }i[k >> 2] = c;h[l + 4 >> 1] = m;h[l + 2 >> 1] = e;h[l >> 1] = d;l = 0;b = U(b, 0, j << 2);k = m << 7;f = c + 1 | 0;m = (f | 0) < (j | 0) ? f : j;if ((m | 0) >= 1) { - n = (f | 0) > (j | 0) ? j : f;p = k << 16 >> 16;while (1) { - q = b + (l << 2) | 0;i[q >> 2] = i[q >> 2] + o(p, h[(l - f << 1) + a >> 1]);l = l + 1 | 0;if ((n | 0) != (l | 0)) { - continue; - }break; - } - }f = c + f | 0;l = (f | 0) < (j | 0) ? f : j;if ((m | 0) < (l | 0)) { - k = k << 16 >> 16;while (1) { - n = b + (m << 2) | 0;i[n >> 2] = i[n >> 2] + o(k, h[(m - f << 1) + a >> 1]);m = m + 1 | 0;if ((m | 0) < (l | 0)) { - continue; - }break; - } - }e = e << 7;m = (c | 0) < (j | 0) ? c : j;if ((m | 0) >= 1) { - f = (c | 0) > (j | 0) ? j : c;k = e << 16 >> 16;l = 0;while (1) { - n = b + (l << 2) | 0;i[n >> 2] = i[n >> 2] + o(k, h[(l - c << 1) + a >> 1]);l = l + 1 | 0;if ((f | 0) != (l | 0)) { - continue; - }break; - } - }f = c << 1;k = (f | 0) < (j | 0) ? f : j;if ((m | 0) < (k | 0)) { - e = e << 16 >> 16;while (1) { - l = b + (m << 2) | 0;i[l >> 2] = i[l >> 2] + o(e, h[(m - f << 1) + a >> 1]);m = m + 1 | 0;if ((m | 0) < (k | 0)) { - continue; - }break; - } - }e = d << 7;d = c + -1 | 0;m = (d | 0) < (j | 0) ? d : j;if ((m | 0) >= 1) { - f = (d | 0) > (j | 0) ? j : d;k = e << 16 >> 16;l = 0;while (1) { - n = b + (l << 2) | 0;i[n >> 2] = i[n >> 2] + o(k, h[(l - d << 1) + a >> 1]);l = l + 1 | 0;if ((f | 0) != (l | 0)) { - continue; - }break; - } - }c = c + d | 0;d = (c | 0) < (j | 0) ? c : j;if ((m | 0) < (d | 0)) { - e = e << 16 >> 16;while (1) { - f = b + (m << 2) | 0;i[f >> 2] = i[f >> 2] + o(e, h[(m - c << 1) + a >> 1]);m = m + 1 | 0;if ((m | 0) < (d | 0)) { - continue; - }break; - } - } - }function ua(a, b, c, d, e, f, g) { - var i = 0, - j = 0, - l = 0, - m = 0, - n = 0, - p = 0, - q = 0, - r = 0, - s = 0, - t = 0, - u = 0, - v = 0, - w = 0, - x = 0, - y = 0, - z = 0, - A = 0, - B = 0, - C = 0;n = (g & 1) + g | 0;i = d >> 1;j = n + (i + 32 << 1) | 0;if ((d | 0) >= 2) { - l = (i | 0) > 1 ? i : 1;g = 0;while (1) { - h[(g << 1) + n >> 1] = k[((g ^ -1) + i << 1) + a >> 1];g = g + 1 | 0;if ((l | 0) != (g | 0)) { - continue; - }break; - } - }g = 0;while (1) { - h[(g + i << 1) + n >> 1] = k[(g << 2 | 2) + e >> 1];g = g + 1 | 0;if ((g | 0) != 32) { - continue; - }break; - }j = j + (j & 1) | 0;if ((d | 0) >= 2) { - a = (i | 0) > 1 ? i : 1;g = 0;while (1) { - h[j + (g << 1) >> 1] = k[((g ^ -1) + i << 1) + b >> 1];g = g + 1 | 0;if ((a | 0) != (g | 0)) { - continue; - }break; - } - }g = 0;while (1) { - h[j + (g + i << 1) >> 1] = k[(g << 2 | 2) + f >> 1];g = g + 1 | 0;if ((g | 0) != 32) { - continue; - }break; - }if ((d | 0) >= 2) { - C = i + -2 | 0;while (1) { - d = 0;l = 0;q = 0;b = v + C << 1;a = k[b + n >> 1];b = k[b + j >> 1];g = 0;r = 0;while (1) { - m = g << 2;w = h[(m | 2) + 12848 >> 1];x = b << 16 >> 16;a = a << 16 >> 16;p = o(w, x + a | 0) + l | 0;b = (g + i | 0) + v << 1;l = b + -2 | 0;t = h[l + j >> 1];u = h[l + n >> 1];y = t + u | 0;z = h[(m | 6) + 12848 >> 1];l = p + o(y, z) | 0;p = h[m + 12848 >> 1];A = 0 - p << 16 >> 16;m = h[(m | 4) + 12848 >> 1];B = 0 - m << 16 >> 16;q = (((o(a, p) + q | 0) + o(A, x) | 0) + o(m, u) | 0) + o(t, B) | 0;a = h[b + n >> 1];b = h[b + j >> 1];d = (o(w, y) + d | 0) + o(a + b | 0, z) | 0;r = (((o(u, p) + r | 0) + o(t, A) | 0) + o(a, m) | 0) + o(b, B) | 0;g = g + 2 | 0;if ((g | 0) < 32) { - continue; - }break; - }a = s << 2;b = r + 16384 >> 15;h[a + c >> 1] = (r | 0) > 1073725439 ? 32767 : (b | 0) > -32767 ? b : -32767;b = d + 16384 >> 15;h[(a | 2) + c >> 1] = (d | 0) > 1073725439 ? 32767 : (b | 0) > -32767 ? b : -32767;b = q + 16384 >> 15;h[(a | 4) + c >> 1] = (q | 0) > 1073725439 ? 32767 : (b | 0) > -32767 ? b : -32767;b = (a | 6) + c | 0;a = l + 16384 >> 15;h[b >> 1] = (l | 0) > 1073725439 ? 32767 : (a | 0) > -32767 ? a : -32767;v = -2 - s | 0;s = s + 2 | 0;if ((s | 0) < (i | 0)) { - continue; - }break; - } - }g = 0;while (1) { - h[(g << 2 | 2) + e >> 1] = k[(g << 1) + n >> 1];g = g + 1 | 0;if ((g | 0) != 32) { - continue; - }break; - }g = 0;while (1) { - h[(g << 2 | 2) + f >> 1] = k[j + (g << 1) >> 1];g = g + 1 | 0;if ((g | 0) != 32) { - continue; - }break; - } - }function Z(a, b) { - var c = 0, - d = 0, - e = 0, - f = 0, - g = 0, - i = 0;c = 10;a: { - b: { - c: { - if ((b | 0) < 1) { - break c; - }while (1) { - f = h[(e << 1) + a >> 1];d = f >> 31;d = d ^ d + f;c = ((d | 0) > c << 16 >> 16 ? d : c) << 16 >> 16;e = e + 1 | 0;if ((e | 0) != (b | 0)) { - continue; - }break; - }if ((c | 0) >= 16384) { - c = 0;if ((b | 0) >= 1) { - e = 0;while (1) { - g = c;c = e << 1;d = h[(c | 2) + a >> 1] >> 1;f = o(d, d);d = h[a + c >> 1] >> 1;f = f + o(d, d) | 0;d = h[(c | 4) + a >> 1] >> 1;c = h[(c | 6) + a >> 1] >> 1;c = g + ((f + o(d, d) | 0) + o(c, c) >>> 6 | 0) | 0;e = e + 4 | 0;if ((e | 0) < (b | 0)) { - continue; - }break; - } - }a = (c | 0) / (b | 0) | 0;b = a >>> 0 > 65535;c = b << 3;g = c | 4;d = c;b = b ? a >>> 16 | 0 : a;c = b >>> 0 > 255;e = c ? g : d;b = c ? b >>> 8 | 0 : b;c = b >>> 0 > 15;b = (c ? e | 2 : e) | (c ? b >>> 4 | 0 : b) >>> 0 > 3;c = b << 1;d = a >> c + -12;a = a << 12 - c;c = b << 16 >> 16;a = ((c | 0) > 6 ? d : a) << 16 >> 16;a = (o((o(o(a, 16816) + -827523072 >> 16, a) << 2 & -65536) + 1387593728 >> 16, a) << 2 & -65536) + 238157824 >> 16;b = 13 - b | 0;a = ((c | 0) < 13 ? a >> b : a << 0 - b) << 16 >> 12;break a; - }if ((c | 0) <= 4095) { - break c; - }d = (c | 0) < 8192;break b; - }d = 2; - }e = (c | 0) < 2048 ? 3 : d;d = 0;if ((b | 0) >= 1) { - c = 0;while (1) { - g = d;d = c << 1;f = h[(d | 2) + a >> 1] << e << 16 >> 16;i = o(f, f);f = h[a + d >> 1] << e << 16 >> 16;i = i + o(f, f) | 0;f = h[(d | 4) + a >> 1] << e << 16 >> 16;d = h[(d | 6) + a >> 1] << e << 16 >> 16;d = g + ((i + o(f, f) | 0) + o(d, d) >>> 6 | 0) | 0;c = c + 4 | 0;if ((c | 0) < (b | 0)) { - continue; - }break; - } - }a = (d | 0) / (b | 0) | 0;b = a >>> 0 > 65535;c = b << 3;g = c | 4;d = c;b = b ? a >>> 16 | 0 : a;c = b >>> 0 > 255;d = c ? g : d;b = c ? b >>> 8 | 0 : b;c = b >>> 0 > 15;b = (c ? d | 2 : d) | (c ? b >>> 4 | 0 : b) >>> 0 > 3;c = b << 1;d = a >> c + -12;a = a << 12 - c;c = b << 16 >> 16;a = ((c | 0) > 6 ? d : a) << 16 >> 16;a = (o((o(o(a, 16816) + -827523072 >> 16, a) << 2 & -65536) + 1387593728 >> 16, a) << 2 & -65536) + 238157824 >> 16;b = 13 - b | 0;a = ((c | 0) < 13 ? a >> b : a << 0 - b) << 16 >> 16 << (e ^ 3); - }return a << 16 >> 16; - }function tb(a, b, c) { - a = a | 0;b = b | 0;c = c | 0;var d = 0, - e = 0;if ((b | 0) >= 1) { - while (1) { - e = (d << 1) + a | 0;d = d + 1 | 0;h[e >> 1] = d << 11;if ((b | 0) != (d | 0)) { - continue; - }break; - } - }b = o(V(c, 6), 10);h[a >> 1] = (g[b + 8848 | 0] << 5) + k[a >> 1];h[a + 4 >> 1] = k[a + 4 >> 1] + (g[b + 8850 | 0] << 5);h[a + 6 >> 1] = k[a + 6 >> 1] + (g[b + 8851 | 0] << 5);h[a + 8 >> 1] = k[a + 8 >> 1] + (g[b + 8852 | 0] << 5);h[a + 10 >> 1] = k[a + 10 >> 1] + (g[b + 8853 | 0] << 5);h[a + 12 >> 1] = k[a + 12 >> 1] + (g[b + 8854 | 0] << 5);h[a + 14 >> 1] = k[a + 14 >> 1] + (g[b + 8855 | 0] << 5);h[a + 16 >> 1] = k[a + 16 >> 1] + (g[b + 8856 | 0] << 5);h[a + 18 >> 1] = k[a + 18 >> 1] + (g[b + 8857 | 0] << 5);h[a + 2 >> 1] = k[a + 2 >> 1] + (g[(b | 1) + 8848 | 0] << 5);b = o(V(c, 6), 5);h[a >> 1] = (g[b + 9488 | 0] << 4) + k[a >> 1];h[a + 2 >> 1] = k[a + 2 >> 1] + (g[b + 9489 | 0] << 4);h[a + 4 >> 1] = k[a + 4 >> 1] + (g[b + 9490 | 0] << 4);h[a + 6 >> 1] = k[a + 6 >> 1] + (g[b + 9491 | 0] << 4);h[a + 8 >> 1] = k[a + 8 >> 1] + (g[b + 9492 | 0] << 4);b = o(V(c, 6), 5);h[a >> 1] = (g[b + 9808 | 0] << 3) + k[a >> 1];h[a + 2 >> 1] = k[a + 2 >> 1] + (g[b + 9809 | 0] << 3);h[a + 4 >> 1] = k[a + 4 >> 1] + (g[b + 9810 | 0] << 3);h[a + 6 >> 1] = k[a + 6 >> 1] + (g[b + 9811 | 0] << 3);h[a + 8 >> 1] = k[a + 8 >> 1] + (g[b + 9812 | 0] << 3);b = o(V(c, 6), 5);h[a + 10 >> 1] = (g[b + 10128 | 0] << 4) + k[a + 10 >> 1];h[a + 12 >> 1] = k[a + 12 >> 1] + (g[b + 10129 | 0] << 4);h[a + 14 >> 1] = k[a + 14 >> 1] + (g[b + 10130 | 0] << 4);h[a + 16 >> 1] = k[a + 16 >> 1] + (g[b + 10131 | 0] << 4);h[a + 18 >> 1] = k[a + 18 >> 1] + (g[b + 10132 | 0] << 4);b = o(V(c, 6), 5);h[a + 10 >> 1] = (g[b + 10448 | 0] << 3) + k[a + 10 >> 1];h[a + 12 >> 1] = k[a + 12 >> 1] + (g[b + 10449 | 0] << 3);h[a + 14 >> 1] = k[a + 14 >> 1] + (g[b + 10450 | 0] << 3);h[a + 16 >> 1] = k[a + 16 >> 1] + (g[b + 10451 | 0] << 3);h[a + 18 >> 1] = k[a + 18 >> 1] + (g[b + 10452 | 0] << 3); - }function ob(a) { - a = a | 0;var b = 0, - c = 0, - d = 0, - e = 0, - f = 0, - g = 0;d = H - 16 | 0;H = d;b = T(168);if (b) { - i[b >> 2] = a;a = i[a >> 2];c = i[a >> 2];c = J[i[c + 20 >> 2]](c) | 0;i[b + 4 >> 2] = c;J[i[i[c >> 2] + 44 >> 2]](c, 106, b + 44 | 0) | 0;c = i[a + 4 >> 2];i[b + 12 >> 2] = c;i[b + 8 >> 2] = c << 1;e = i[a + 8 >> 2];i[b + 16 >> 2] = e;i[b + 24 >> 2] = c + e;i[b + 20 >> 2] = (c | 0) / (e | 0);c = i[a + 12 >> 2];i[b + 148 >> 2] = a + 24;i[b + 144 >> 2] = 1;i[b + 28 >> 2] = c;c = i[a + 56 >> 2];i[b + 156 >> 2] = c;i[b + 152 >> 2] = c;i[d + 12 >> 2] = 9;c = i[b + 4 >> 2];J[i[i[c >> 2] + 44 >> 2]](c, 4, d + 12 | 0) | 0;i[d + 12 >> 2] = 1;c = i[b + 4 >> 2];J[i[i[c >> 2] + 44 >> 2]](c, 105, d + 12 | 0) | 0;h[b + 36 >> 1] = k[a + 20 >> 1];h[b + 38 >> 1] = k[a + 16 >> 1];a = k[a + 18 >> 1];i[b + 32 >> 2] = 1;h[b + 40 >> 1] = a;i[b + 48 >> 2] = T(i[b + 24 >> 2] - i[b + 12 >> 2] << 1);i[b + 52 >> 2] = T(128);a = T(128);i[b + 64 >> 2] = 13328;i[b + 60 >> 2] = 13360;i[b + 56 >> 2] = a;c = i[b + 28 >> 2];a = c << 1;e = T(a);i[b + 68 >> 2] = e;i[b + 72 >> 2] = T(a);i[b + 76 >> 2] = T(a);a = i[b + 20 >> 2];i[b + 92 >> 2] = T(a << 2);a = T(a << 1);i[b + 100 >> 2] = 0;i[b + 96 >> 2] = a;a = c << 2;i[b + 80 >> 2] = T(a);i[b + 84 >> 2] = T(a);i[b + 88 >> 2] = T(a);if ((c | 0) >= 1) { - f = c + 1 | 0;a = 0;while (1) { - g = e + (a << 1) | 0;a = a + 1 | 0;h[g >> 1] = (o(a << 16 >> 16, 25736) | 0) / (f | 0);if ((a | 0) != (c | 0)) { - continue; - }break; - } - }i[b + 112 >> 2] = 0;i[b + 116 >> 2] = 2e4;i[b + 104 >> 2] = 1090519040;i[b + 108 >> 2] = 0;i[b + 160 >> 2] = 2;i[b + 136 >> 2] = 0;i[b + 140 >> 2] = 0;i[b + 120 >> 2] = 0;a = i[b + 4 >> 2];J[i[i[a >> 2] + 44 >> 2]](a, 25, b + 164 | 0) | 0;i[b + 164 >> 2] = i[b + 164 >> 2] << 1; - }H = d + 16 | 0;return b | 0; - }function Db(a) { - a = a | 0;var b = 0, - c = 0, - d = 0, - e = 0, - f = 0, - g = 0;c = i[a >> 2];b = T(224);if (b) { - d = T(32e3);i[b >> 2] = a;i[b + 64 >> 2] = d;a = i[c >> 2];i[b + 8 >> 2] = a;d = i[c + 4 >> 2];i[b + 12 >> 2] = d;i[b + 20 >> 2] = a + d;f = (a | 0) / (d | 0) | 0;i[b + 16 >> 2] = f;a = i[c + 8 >> 2];i[b + 24 >> 2] = a;h[b + 56 >> 1] = k[c + 20 >> 1];h[b + 58 >> 1] = k[c + 22 >> 1];i[b + 28 >> 2] = i[c + 12 >> 2];i[b + 32 >> 2] = i[c + 16 >> 2];e = k[c + 24 >> 1];i[b + 204 >> 2] = c + 28;h[b + 60 >> 1] = e;e = i[c + 92 >> 2];i[b + 208 >> 2] = e;i[b + 212 >> 2] = e;i[b + 200 >> 2] = 1;i[b + 36 >> 2] = 1024;i[b + 40 >> 2] = 1;i[b + 68 >> 2] = T(d << 1);d = T((i[c + 16 >> 2] + i[c >> 2] << 1) + 4 | 0);i[b + 72 >> 2] = d;e = i[c + 16 >> 2];i[b + 76 >> 2] = (d + (e << 1) | 0) + 4;d = T((e + i[c >> 2] << 1) + 4 | 0);i[b + 80 >> 2] = d;c = i[c + 16 >> 2];i[b + 92 >> 2] = 13328;i[b + 88 >> 2] = 13360;i[b + 84 >> 2] = (d + (c << 1) | 0) + 4;c = a << 1;d = T(c);i[b + 96 >> 2] = d;c = T(c);i[b + 4 >> 2] = 1;i[b + 100 >> 2] = c;if ((a | 0) >= 1) { - e = a + 1 | 0;c = 0;while (1) { - g = d + (c << 1) | 0;c = c + 1 | 0;h[g >> 1] = (o(c << 16 >> 16, 25736) | 0) / (e | 0);if ((a | 0) != (c | 0)) { - continue; - }break; - } - }a = a << 2;i[b + 104 >> 2] = T(a);i[b + 108 >> 2] = T(a);i[b + 112 >> 2] = T(a);i[b + 116 >> 2] = T(a);i[b + 120 >> 2] = T(a);a = f << 2;i[b + 132 >> 2] = T(a);i[b + 52 >> 2] = T(a);a = T(64);i[b + 140 >> 2] = a;Lb(a);i[b + 152 >> 2] = 0;i[b + 156 >> 2] = 0;i[b + 144 >> 2] = 1090519040;i[b + 160 >> 2] = 0;i[b + 164 >> 2] = 0;i[b + 168 >> 2] = 0;i[b + 172 >> 2] = 0;i[b + 176 >> 2] = 0;i[b + 180 >> 2] = 0;i[b + 196 >> 2] = 2;i[b + 216 >> 2] = 0;i[b + 220 >> 2] = 1;i[b + 188 >> 2] = 2;i[b + 192 >> 2] = 8e3; - }return b | 0; - }function ab(a, b, c, d) { - a = a | 0;b = b | 0;c = c | 0;d = d | 0;var e = 0, - f = 0, - g = 0, - h = 0, - k = 0, - l = 0, - m = 0, - n = 0, - p = 0, - q = 0, - r = 0, - s = 0, - t = 0, - u = 0, - v = 0;h = H - 128 | 0;g = h;H = g;i[d >> 2] = 0;a: { - if (b >>> 0 <= 79) { - ma(13984);break a; - }X(g + 8 | 0, a, 80);if (i[g + 8 >> 2] != 1701146707 | i[g + 12 >> 2] != 538976376) { - ma(13945);break a; - }e = eb(g + 8 | 0);X(g + 8 | 0, e, 80);S(e);n = 160;e = 10920;b: { - c: { - d: { - e: { - f = i[g + 48 >> 2];switch (f | 0) {case 0: - break b;case 1: - break d;default: - break e;} - }if ((f | 0) != 16777216) { - break c; - } - }n = 320;p = 1;e = 11588;break b; - }ma(13760); - }k = J[i[e + 32 >> 2]](e) | 0;q = n << 1;r = h - (q + 15 & -16) | 0;h = r;H = h;i[g + 4 >> 2] = 1;J[i[i[k >> 2] + 48 >> 2]](k, 0, g + 4 | 0) | 0;Fa(g + 88 | 0);e = i[3654];s = h - (e + 15 & -16) | 0;H = s;h = o(b, 10);i[c >> 2] = Pa(h);f: { - g: { - if ((b | 0) == 80) { - break g; - }l = e;e = j[a + 80 | 0] | j[a + 81 | 0] << 8;f = (e << 24 | e << 8) >>> 16 | 0;if ((l | 0) >= (f | 0)) { - a = a + 82 | 0;e = b + -82 | 0;b = h;while (1) { - if (e >>> 0 < f >>> 0) { - ma(13855);p = 0;break f; - }bb(k, g + 88 | 0, X(s, a, f), r, n, f);t = e - f | 0;u = m + n | 0;h: { - if (u >>> 0 <= b >>> 0) { - e = i[c >> 2];break h; - }while (1) { - b = b + h | 0;e = Pa(b);l = i[c >> 2];v = X(e, l, m);if (l) { - S(l); - }i[c >> 2] = v;if (u >>> 0 > b >>> 0) { - continue; - }break; - } - }X(e + m | 0, r, q);m = m + q | 0;if (!t) { - break g; - }e = t + -2 | 0;f = a + f | 0;a = f + 2 | 0;f = j[f | 0] | j[f + 1 | 0] << 8;f = (f << 24 | f << 8) >>> 16 | 0;if (i[3654] >= (f | 0)) { - continue; - }break; - } - }ma(13885);p = 0;break f; - }i[d >> 2] = m; - }if (i[g + 104 >> 2]) { - S(i[g + 88 >> 2]); - }J[i[i[k >> 2] + 36 >> 2]](k); - }H = g + 128 | 0;return p | 0; - }function X(a, b, c) { - var d = 0, - e = 0, - f = 0;if (c >>> 0 >= 512) { - C(a | 0, b | 0, c | 0) | 0;return a; - }e = a + c | 0;a: { - if (!((a ^ b) & 3)) { - b: { - if ((c | 0) < 1) { - c = a;break b; - }if (!(a & 3)) { - c = a;break b; - }c = a;while (1) { - g[c | 0] = j[b | 0];b = b + 1 | 0;c = c + 1 | 0;if (c >>> 0 >= e >>> 0) { - break b; - }if (c & 3) { - continue; - }break; - } - }d = e & -4;c: { - if (d >>> 0 < 64) { - break c; - }f = d + -64 | 0;if (c >>> 0 > f >>> 0) { - break c; - }while (1) { - i[c >> 2] = i[b >> 2];i[c + 4 >> 2] = i[b + 4 >> 2];i[c + 8 >> 2] = i[b + 8 >> 2];i[c + 12 >> 2] = i[b + 12 >> 2];i[c + 16 >> 2] = i[b + 16 >> 2];i[c + 20 >> 2] = i[b + 20 >> 2];i[c + 24 >> 2] = i[b + 24 >> 2];i[c + 28 >> 2] = i[b + 28 >> 2];i[c + 32 >> 2] = i[b + 32 >> 2];i[c + 36 >> 2] = i[b + 36 >> 2];i[c + 40 >> 2] = i[b + 40 >> 2];i[c + 44 >> 2] = i[b + 44 >> 2];i[c + 48 >> 2] = i[b + 48 >> 2];i[c + 52 >> 2] = i[b + 52 >> 2];i[c + 56 >> 2] = i[b + 56 >> 2];i[c + 60 >> 2] = i[b + 60 >> 2];b = b - -64 | 0;c = c - -64 | 0;if (c >>> 0 <= f >>> 0) { - continue; - }break; - } - }if (c >>> 0 >= d >>> 0) { - break a; - }while (1) { - i[c >> 2] = i[b >> 2];b = b + 4 | 0;c = c + 4 | 0;if (c >>> 0 < d >>> 0) { - continue; - }break; - }break a; - }if (e >>> 0 < 4) { - c = a;break a; - }d = e + -4 | 0;if (d >>> 0 < a >>> 0) { - c = a;break a; - }c = a;while (1) { - g[c | 0] = j[b | 0];g[c + 1 | 0] = j[b + 1 | 0];g[c + 2 | 0] = j[b + 2 | 0];g[c + 3 | 0] = j[b + 3 | 0];b = b + 4 | 0;c = c + 4 | 0;if (c >>> 0 <= d >>> 0) { - continue; - }break; - } - }if (c >>> 0 < e >>> 0) { - while (1) { - g[c | 0] = j[b | 0];b = b + 1 | 0;c = c + 1 | 0;if ((e | 0) != (c | 0)) { - continue; - }break; - } - }return a; - }function La(a, b, c, d, e, f, g) { - var j = 0, - l = 0, - m = 0, - n = 0, - p = 0, - q = 0, - r = 0, - s = 0, - t = 0, - u = 0, - v = 0;h[d >> 1] = 8192;m = (0 - g & 3) + g | 0;l = m + (f << 2) | 0;n = 0 - l | 0;if ((f | 0) > 0) { - while (1) { - g = j + 1 | 0;h[(g << 1) + d >> 1] = k[(j << 1) + b >> 1];j = g;if ((j | 0) != (f | 0)) { - continue; - }break; - }j = f; - }b = j + 1 | 0;if ((b | 0) < (e | 0)) { - U((b << 1) + d | 0, 0, (j ^ -1) + e << 1); - }g = l + (n & 3) | 0;j = 0;if ((f | 0) > 0) { - while (1) { - b = j << 2;i[b + g >> 2] = 0;i[b + m >> 2] = 0;j = j + 1 | 0;if ((j | 0) != (f | 0)) { - continue; - }break; - } - }a: { - if ((e | 0) < 1) { - break a; - }n = f + -1 | 0;b = n << 2;q = b + g | 0;j = n << 1;r = j + a | 0;s = b + m | 0;t = c + j | 0;l = 0;if ((f | 0) >= 2) { - while (1) { - f = (l << 1) + d | 0;p = k[f >> 1] + ((i[m >> 2] << 3) + 32768 >>> 16 | 0) | 0;b = (i[g >> 2] + (p << 16 >> 16 << 14) | 0) + 4096 >>> 13 | 0;h[f >> 1] = b;j = 0;f = 0 - p << 16 >> 16;p = 0 - (b << 16) >> 16;while (1) { - u = j << 2;b = j + 1 | 0;v = b << 2;j = j << 1;i[u + m >> 2] = i[v + m >> 2] + o(f, h[j + c >> 1]);i[g + u >> 2] = i[g + v >> 2] + o(p, h[a + j >> 1]);j = b;if ((n | 0) != (j | 0)) { - continue; - }break; - }i[s >> 2] = o(f, h[t >> 1]);i[q >> 2] = o(p, h[r >> 1]);l = l + 1 | 0;if ((l | 0) != (e | 0)) { - continue; - }break a; - } - }while (1) { - b = (l << 1) + d | 0;c = k[b >> 1] + ((i[m >> 2] << 3) + 32768 >>> 16 | 0) | 0;a = (i[g >> 2] + (c << 16 >> 16 << 14) | 0) + 4096 >>> 13 | 0;h[b >> 1] = a;i[s >> 2] = o(h[t >> 1], 0 - c << 16 >> 16);i[q >> 2] = o(h[r >> 1], 0 - (a << 16) >> 16);l = l + 1 | 0;if ((l | 0) != (e | 0)) { - continue; - }break; - } - } - }function Ga(a, b, c, d, e, f, g, j) { - var k = 0, - l = 0, - m = 0, - n = 0, - p = 0, - q = 0, - r = 0, - s = 0, - t = 0, - u = 0, - v = 0;a: { - if ((d | 0) < 1) { - break a; - }r = f + -1 | 0;s = (r << 2) + j | 0;if ((c | 0) >= 1) { - while (1) { - m = 0;l = 0;k = b;while (1) { - m = o(h[k >> 1], h[(l << 1) + a >> 1]) + m | 0;k = k + 2 | 0;l = l + 1 | 0;if ((l | 0) != (c | 0)) { - continue; - }break; - }v = c << 1;t = (m | 0) > 0;n = (i[(p << 2) + e >> 2] >> 1) + (t ? 0 - m | 0 : m) | 0;b: { - if ((n | 0) >= i[s >> 2] ? (p | 0) >= (f | 0) : 0) { - break b; - }m = r;l = m;k = f;c: { - if ((k | 0) < 2) { - break c; - }while (1) { - l = m;k = k + -2 << 2;m = i[k + j >> 2];if ((n | 0) >= (m | 0) ? (l | 0) <= (q | 0) : 0) { - break c; - }u = l << 2;i[u + j >> 2] = m;i[g + u >> 2] = i[g + k >> 2];m = l + -1 | 0;k = l;if ((k | 0) > 1) { - continue; - }break; - }l = 0; - }k = l << 2;i[k + j >> 2] = n;k = g + k | 0;i[k >> 2] = p;q = q + 1 | 0;if (t) { - break b; - }i[k >> 2] = d + p; - }b = b + v | 0;p = p + 1 | 0;if ((p | 0) != (d | 0)) { - continue; - }break; - }break a; - }while (1) { - a = i[(n << 2) + e >> 2] >> 1;if (!((a | 0) >= i[s >> 2] ? (n | 0) >= (f | 0) : 0)) { - m = r;l = m;k = f;d: { - if ((k | 0) < 2) { - break d; - }while (1) { - l = m;b = k + -2 << 2;c = i[b + j >> 2];if ((a | 0) >= (c | 0) ? (l | 0) <= (q | 0) : 0) { - break d; - }k = l << 2;i[k + j >> 2] = c;i[g + k >> 2] = i[b + g >> 2];m = l + -1 | 0;k = l;if ((k | 0) > 1) { - continue; - }break; - }l = 0; - }b = l << 2;i[b + j >> 2] = a;i[b + g >> 2] = d + n;q = q + 1 | 0; - }n = n + 1 | 0;if ((n | 0) != (d | 0)) { - continue; - }break; - } - } - }function Ub(a, b, c, d, e, f) { - var g = 0, - i = 0, - j = 0, - l = 0, - m = 0, - n = 0, - p = 0, - q = 0, - r = 0, - s = 0, - t = 0;j = (f & 1) + f | 0;f = j + 128 | 0;i = (f & 1) + f | 0;f = 0;while (1) { - h[((f ^ -1) - -64 << 1) + j >> 1] = k[(f << 1) + 12848 >> 1];f = f + 1 | 0;if ((f | 0) != 64) { - continue; - }break; - }f = 0;while (1) { - h[(f << 1) + i >> 1] = k[(62 - f << 1) + e >> 1];f = f + 1 | 0;if ((f | 0) != 63) { - continue; - }break; - }if ((d | 0) >= 1) { - f = 0;while (1) { - h[(f + 63 << 1) + i >> 1] = h[(f << 1) + a >> 1] >>> 1;f = f + 1 | 0;if ((f | 0) != (d | 0)) { - continue; - }break; - } - }f = 0;while (1) { - h[(f << 1) + e >> 1] = h[((f ^ -1) + d << 1) + a >> 1] >>> 1;f = f + 1 | 0;if ((f | 0) != 63) { - continue; - }break; - }if ((d | 0) > 0) { - m = i + 126 | 0;t = d + -1 >>> 1 | 0;e = 0;while (1) { - d = 0;a = 0;f = 0;while (1) { - g = f | 1;n = k[(g + e << 1) + i >> 1];p = h[(f << 1) + j >> 1];q = k[(e + f << 1) + i >> 1];r = k[(e - f << 1) + m >> 1];s = h[(g << 1) + j >> 1];g = k[(e - g << 1) + m >> 1];d = (d - o(p, q - r << 16 >> 16) | 0) + o(s, n - g << 16 >> 16) | 0;a = (o(p, q + r << 16 >> 16) + a | 0) + o(g + n << 16 >> 16, s) | 0;f = f + 2 | 0;if ((f | 0) < 32) { - continue; - }break; - }f = l << 1;g = a + 16384 >> 15;h[f + b >> 1] = (a | 0) > 1073725439 ? 32767 : (g | 0) > -32767 ? g : -32767;a = d + 16384 >> 15;h[c + f >> 1] = (d | 0) > 1073725439 ? 32767 : (a | 0) > -32767 ? a : -32767;e = e + 2 | 0;a = (l | 0) == (t | 0);l = l + 1 | 0;if (!a) { - continue; - }break; - } - } - }function Ba(a, b, c) { - var d = 0, - e = 0, - f = 0;f = H - 16 | 0;H = f;g[a | 0] = 1701146707;g[a + 1 | 0] = 6645104;g[a + 2 | 0] = 25957;g[a + 3 | 0] = 101;g[a + 4 | 0] = 538976376;g[a + 5 | 0] = 2105376;g[a + 6 | 0] = 8224;g[a + 7 | 0] = 32;d = j[13186] | j[13187] << 8 | (j[13188] << 16 | j[13189] << 24);e = j[13182] | j[13183] << 8 | (j[13184] << 16 | j[13185] << 24);g[a + 8 | 0] = e;g[a + 9 | 0] = e >>> 8;g[a + 10 | 0] = e >>> 16;g[a + 11 | 0] = e >>> 24;g[a + 12 | 0] = d;g[a + 13 | 0] = d >>> 8;g[a + 14 | 0] = d >>> 16;g[a + 15 | 0] = d >>> 24;d = j[13192] | j[13193] << 8 | (j[13194] << 16 | j[13195] << 24);e = j[13188] | j[13189] << 8 | (j[13190] << 16 | j[13191] << 24);g[a + 14 | 0] = e;g[a + 15 | 0] = e >>> 8;g[a + 16 | 0] = e >>> 16;g[a + 17 | 0] = e >>> 24;g[a + 18 | 0] = d;g[a + 19 | 0] = d >>> 8;g[a + 20 | 0] = d >>> 16;g[a + 21 | 0] = d >>> 24;g[a + 22 | 0] = 0;g[a + 23 | 0] = 0;g[a + 24 | 0] = 0;g[a + 25 | 0] = 0;g[a + 26 | 0] = 0;g[a + 27 | 0] = 0;i[a + 36 >> 2] = b;i[a + 28 >> 2] = 1;i[a + 32 >> 2] = 80;b = i[c + 12 >> 2];i[a + 40 >> 2] = b;i[a + 44 >> 2] = i[c + 16 >> 2];if ((b | 0) <= -1) { - i[f >> 2] = 13197;Y(i[3524], 13292, f); - }i[a + 52 >> 2] = -1;i[a + 48 >> 2] = 1;J[i[c + 4 >> 2]](i[c >> 2], 0, a + 56 | 0) | 0;i[a + 76 >> 2] = 0;i[a + 68 >> 2] = 0;i[a + 72 >> 2] = 0;i[a + 60 >> 2] = 0;i[a + 64 >> 2] = 0;H = f + 16 | 0; - }function Ha(a, b, c, d, e, f, g, j) { - var k = 0, - l = 0, - m = 0, - n = 0, - p = 0, - q = 0, - r = 0, - s = 0, - t = 0, - u = 0;a: { - if ((d | 0) < 1) { - break a; - }r = f + -1 | 0;s = (r << 2) + j | 0;if ((c | 0) >= 1) { - while (1) { - m = 0;l = 0;k = b;while (1) { - m = o(h[k >> 1], h[(l << 1) + a >> 1]) + m | 0;k = k + 2 | 0;l = l + 1 | 0;if ((l | 0) != (c | 0)) { - continue; - }break; - }u = c << 1;n = (i[(p << 2) + e >> 2] >> 1) - m | 0;if (!((n | 0) >= i[s >> 2] ? (p | 0) >= (f | 0) : 0)) { - m = r;l = m;k = f;b: { - if ((k | 0) < 2) { - break b; - }while (1) { - l = m;k = k + -2 << 2;m = i[k + j >> 2];if ((n | 0) >= (m | 0) ? (l | 0) <= (q | 0) : 0) { - break b; - }t = l << 2;i[t + j >> 2] = m;i[g + t >> 2] = i[g + k >> 2];m = l + -1 | 0;k = l;if ((k | 0) > 1) { - continue; - }break; - }l = 0; - }k = l << 2;i[k + j >> 2] = n;i[g + k >> 2] = p;q = q + 1 | 0; - }b = b + u | 0;p = p + 1 | 0;if ((p | 0) != (d | 0)) { - continue; - }break; - }break a; - }while (1) { - a = i[(n << 2) + e >> 2] >> 1;if (!((a | 0) >= i[s >> 2] ? (n | 0) >= (f | 0) : 0)) { - m = r;l = m;k = f;c: { - if ((k | 0) < 2) { - break c; - }while (1) { - l = m;b = k + -2 << 2;c = i[b + j >> 2];if ((a | 0) >= (c | 0) ? (l | 0) <= (q | 0) : 0) { - break c; - }k = l << 2;i[k + j >> 2] = c;i[g + k >> 2] = i[b + g >> 2];m = l + -1 | 0;k = l;if ((k | 0) > 1) { - continue; - }break; - }l = 0; - }b = l << 2;i[b + j >> 2] = a;i[b + g >> 2] = n;q = q + 1 | 0; - }n = n + 1 | 0;if ((n | 0) != (d | 0)) { - continue; - }break; - } - } - }function rb(a, b, c) { - a = a | 0;b = b | 0;c = c | 0;var d = 0, - e = 0;if ((b | 0) >= 1) { - while (1) { - e = (d << 1) + a | 0;d = d + 1 | 0;h[e >> 1] = d << 11;if ((b | 0) != (d | 0)) { - continue; - }break; - } - }b = o(V(c, 6), 10);h[a >> 1] = (g[b + 8848 | 0] << 5) + k[a >> 1];h[a + 4 >> 1] = k[a + 4 >> 1] + (g[b + 8850 | 0] << 5);h[a + 6 >> 1] = k[a + 6 >> 1] + (g[b + 8851 | 0] << 5);h[a + 8 >> 1] = k[a + 8 >> 1] + (g[b + 8852 | 0] << 5);h[a + 10 >> 1] = k[a + 10 >> 1] + (g[b + 8853 | 0] << 5);h[a + 12 >> 1] = k[a + 12 >> 1] + (g[b + 8854 | 0] << 5);h[a + 14 >> 1] = k[a + 14 >> 1] + (g[b + 8855 | 0] << 5);h[a + 16 >> 1] = k[a + 16 >> 1] + (g[b + 8856 | 0] << 5);h[a + 18 >> 1] = k[a + 18 >> 1] + (g[b + 8857 | 0] << 5);h[a + 2 >> 1] = k[a + 2 >> 1] + (g[(b | 1) + 8848 | 0] << 5);b = o(V(c, 6), 5);h[a >> 1] = (g[b + 9488 | 0] << 4) + k[a >> 1];h[a + 2 >> 1] = k[a + 2 >> 1] + (g[b + 9489 | 0] << 4);h[a + 4 >> 1] = k[a + 4 >> 1] + (g[b + 9490 | 0] << 4);h[a + 6 >> 1] = k[a + 6 >> 1] + (g[b + 9491 | 0] << 4);h[a + 8 >> 1] = k[a + 8 >> 1] + (g[b + 9492 | 0] << 4);b = o(V(c, 6), 5);h[a + 10 >> 1] = (g[b + 10128 | 0] << 4) + k[a + 10 >> 1];h[a + 12 >> 1] = k[a + 12 >> 1] + (g[b + 10129 | 0] << 4);h[a + 14 >> 1] = k[a + 14 >> 1] + (g[b + 10130 | 0] << 4);h[a + 16 >> 1] = k[a + 16 >> 1] + (g[b + 10131 | 0] << 4);h[a + 18 >> 1] = k[a + 18 >> 1] + (g[b + 10132 | 0] << 4); - }function Ra(a, b) { - var c = 0, - d = 0, - e = 0, - f = 0, - g = 0, - h = 0;a: { - if ((b | 0) <= 0) { - break a; - }c = 1;while (1) { - d = i[(f << 2) + a >> 2];e = d >> 31;d = e ^ d + e;c = (d | 0) > (c | 0) ? d : c;f = f + 1 | 0;if ((f | 0) != (b | 0)) { - continue; - }break; - }d = 0;f = 0;if ((c | 0) > 16383) { - while (1) { - f = f + 1 | 0;e = c >>> 0 > 32767;c = c >>> 1 | 0;if (e) { - continue; - }break; - } - }if ((b | 0) <= 0) { - break a; - }c = 0;while (1) { - h = c;e = d << 2;c = i[(e | 4) + a >> 2] >> f << 16 >> 16;g = o(c, c);c = i[a + e >> 2] >> f << 16 >> 16;g = g + o(c, c) | 0;c = i[(e | 8) + a >> 2] >> f << 16 >> 16;g = g + o(c, c) | 0;c = i[(e | 12) + a >> 2] >> f << 16 >> 16;c = h + (g + o(c, c) >>> 6 | 0) | 0;d = d + 4 | 0;if ((d | 0) < (b | 0)) { - continue; - }break; - }d = c; - }e = (d | 0) / (b | 0) | 0;b = e >>> 0 > 65535;a = b << 3;d = b ? e >>> 16 | 0 : e;b = d >>> 0 > 255;a = b ? a | 4 : a;h = a | 2;c = a;b = b ? d >>> 8 | 0 : d;a = b >>> 0 > 15;c = (a ? h : c) | (a ? b >>> 4 | 0 : b) >>> 0 > 3;a = c << 1;d = c << 16 >> 16;a = ((d | 0) > 6 ? e >> a + -12 : e << 12 - a) << 16 >> 16;b = (o((o(o(a, 16816) + -827523072 >> 16, a) << 2 & -65536) + 1387593728 >> 16, a) << 2 & -65536) + 238157824 >> 16;a = 13 - c | 0;return (((d | 0) < 13 ? b >> a : b << 0 - a) << 16 >> 16 << f + 3 << 2) + 32768 >> 16; - }function Pb(a, b, c, d, e, f, g, j, k, l, m, n, p, q, r, s, t, u, v, w) { - a = a | 0;b = b | 0;c = c | 0;d = d | 0;e = e | 0;f = f | 0;g = g | 0;j = j | 0;k = k | 0;l = l | 0;m = m | 0;n = n | 0;p = p | 0;q = q | 0;r = r | 0;s = s | 0;t = t | 0;u = u | 0;v = v | 0;w = w | 0;g = (l | 0) < 63 ? l : 63;l = 0;if (!((n | 0) < 1 | (j | 0) < 1)) { - l = n + -1 >>> 0 < j + -1 >>> 0 ? n : j;k = g << 23 >> 16;b = 0;while (1) { - i[(b << 2) + f >> 2] = o(h[(b - j << 1) + r >> 1], k);b = b + 1 | 0;if ((l | 0) != (b | 0)) { - continue; - }break; - } - }if ((l | 0) < (n | 0)) { - b = g << 25 >> 16;while (1) { - g = i[(l - j << 2) + f >> 2];i[(l << 2) + f >> 2] = o(b, g << 1 >> 16) + (o(b, g & 32767) >> 15);l = l + 1 | 0;if ((n | 0) != (l | 0)) { - continue; - }break; - } - }b = (q & 1) + q | 0;g = b + (n << 1) | 0;l = 0;if ((n | 0) > 0) { - while (1) { - h[b + (l << 1) >> 1] = i[(l << 2) + f >> 2] + 4096 >>> 13;l = l + 1 | 0;if ((n | 0) != (l | 0)) { - continue; - }break; - }ka(b, c, d, e, b, n, m, g);if ((n | 0) >= 1) { - l = 0;while (1) { - c = l << 1;d = c + a | 0;c = h[d >> 1] - h[b + c >> 1] | 0;c = (c | 0) > -32700 ? c : -32700;h[d >> 1] = (c | 0) < 32700 ? c : 32700;l = l + 1 | 0;if ((n | 0) != (l | 0)) { - continue; - }break; - } - }return j | 0; - }ka(b, c, d, e, b, n, m, g);return j | 0; - }function Ya(a, b, c) { - a = a | 0;b = b | 0;c = c | 0;var d = 0, - e = 0, - f = 0, - g = 0, - h = 0, - j = 0, - k = 0;e = H - 32 | 0;H = e;g = i[a + 28 >> 2];i[e + 16 >> 2] = g;d = i[a + 20 >> 2];i[e + 28 >> 2] = c;i[e + 24 >> 2] = b;b = d - g | 0;i[e + 20 >> 2] = b;g = b + c | 0;k = 2;b = e + 16 | 0;a: { - b: { - f = A(i[a + 60 >> 2], e + 16 | 0, 2, e + 12 | 0) | 0;d = 0;c: { - if (!f) { - break c; - }i[3790] = f;d = -1; - }d: { - if (!d) { - while (1) { - d = i[e + 12 >> 2];if ((d | 0) == (g | 0)) { - break d; - }if ((d | 0) <= -1) { - break b; - }h = i[b + 4 >> 2];f = d >>> 0 > h >>> 0;j = (f << 3) + b | 0;h = d - (f ? h : 0) | 0;i[j >> 2] = h + i[j >> 2];j = (f ? 12 : 4) + b | 0;i[j >> 2] = i[j >> 2] - h;g = g - d | 0;b = f ? b + 8 | 0 : b;k = k - f | 0;f = A(i[a + 60 >> 2], b | 0, k | 0, e + 12 | 0) | 0;d = 0;e: { - if (!f) { - break e; - }i[3790] = f;d = -1; - }if (!d) { - continue; - }break; - } - }i[e + 12 >> 2] = -1;if ((g | 0) != -1) { - break b; - } - }b = i[a + 44 >> 2];i[a + 28 >> 2] = b;i[a + 20 >> 2] = b;i[a + 16 >> 2] = b + i[a + 48 >> 2];a = c;break a; - }i[a + 28 >> 2] = 0;i[a + 16 >> 2] = 0;i[a + 20 >> 2] = 0;i[a >> 2] = i[a >> 2] | 32;a = 0;if ((k | 0) == 2) { - break a; - }a = c - i[b + 4 >> 2] | 0; - }H = e + 32 | 0;return a | 0; - }function ba(a) { - var b = 0, - c = 0, - d = 0, - e = 0, - f = 0, - g = 0, - h = 0, - i = 0, - j = 0, - k = 0;a: { - b: { - c: { - d: { - nc(+a);b = kc(1) | 0;d = kc(0) | 0;if ((b | 0) > 0 ? 1 : (b | 0) >= 0 ? d >>> 0 >= 0 : 0) { - f = b;if (b >>> 0 > 1048575) { - break d; - } - }if (!(b & 2147483647 | d)) { - return -1 / (a * a); - }if ((b | 0) > -1) { - break c; - }return (a - a) / 0; - }if (f >>> 0 > 2146435071) { - break a; - }b = 1072693248;g = -1023;if ((f | 0) != 1072693248) { - b = f;break b; - }if (d) { - break b; - }return 0; - }nc(+(a * 0x40000000000000));b = kc(1) | 0;d = kc(0) | 0;g = -1077; - }b = b + 614242 | 0;e = +((b >>> 20 | 0) + g | 0);lc(0, d | 0);lc(1, (b & 1048575) + 1072079006 | 0);a = +mc() + -1;c = a / (a + 2);h = e * .6931471803691238;i = a;j = e * 1.9082149292705877e-10;k = c;e = a * (a * .5);c = c * c;a = c * c;a = h + (i + (j + k * (e + (a * (a * (a * .15313837699209373 + .22222198432149784) + .3999999999940942) + c * (a * (a * (a * .14798198605116586 + .1818357216161805) + .2857142874366239) + .6666666666666735))) - e)); - }return a; - }function Tb(a, b, c, d, e, f) { - a = a | 0;b = b | 0;c = c | 0;d = d | 0;e = e | 0;f = f | 0;var h = 0, - j = 0, - k = 0, - l = 0, - m = 0, - n = 0;a: { - f = i[b + 4 >> 2];if ((f | 0) < 1) { - break a; - }c = 0;j = (0 - e & 3) + e | 0;e = j + (f << 2) | 0;k = (0 - e & 3) + e | 0;l = i[b + 8 >> 2];e = i[b >> 2];b: { - if (!i[b + 16 >> 2]) { - while (1) { - h = c << 2;i[h + k >> 2] = 0;i[h + j >> 2] = V(d, i[b + 12 >> 2]);c = c + 1 | 0;if ((f | 0) != (c | 0)) { - continue; - }break b; - } - }while (1) { - h = c << 2;i[h + k >> 2] = V(d, 1);i[h + j >> 2] = V(d, i[b + 12 >> 2]);c = c + 1 | 0;if ((f | 0) != (c | 0)) { - continue; - }break; - } - }if ((f | 0) < 1 | (e | 0) < 1) { - break a; - }b = 0;while (1) { - h = o(b, e);m = b << 2;n = m + j | 0;c = 0;d = 0;c: { - if (i[k + m >> 2]) { - while (1) { - i[(c + h << 2) + a >> 2] = 0 - (g[(o(e, i[n >> 2]) + c | 0) + l | 0] << 9);c = c + 1 | 0;if ((e | 0) != (c | 0)) { - continue; - }break c; - } - }while (1) { - i[(d + h << 2) + a >> 2] = g[(o(e, i[n >> 2]) + d | 0) + l | 0] << 9;d = d + 1 | 0;if ((e | 0) != (d | 0)) { - continue; - }break; - } - }b = b + 1 | 0;if ((f | 0) != (b | 0)) { - continue; - }break; - } - } - }function lb(a) { - a = a | 0;var b = 0, - c = 0, - d = 0, - e = 0;d = H - 16 | 0;H = d;b = T(100);if (b) { - i[b >> 2] = a;a = i[a >> 2];i[b + 88 >> 2] = 1;c = i[a >> 2];c = J[i[c + 32 >> 2]](c) | 0;i[b + 4 >> 2] = c;J[i[i[c >> 2] + 48 >> 2]](c, 106, b + 40 | 0) | 0;c = i[a + 4 >> 2];i[b + 12 >> 2] = c;i[b + 8 >> 2] = c << 1;e = i[a + 8 >> 2];i[b + 16 >> 2] = e;i[b + 20 >> 2] = (c | 0) / (e | 0);i[b + 24 >> 2] = i[a + 12 >> 2];c = i[b + 4 >> 2];J[i[i[c >> 2] + 48 >> 2]](c, 25, b + 32 | 0) | 0;i[b + 32 >> 2] = i[b + 32 >> 2] << 1;i[d + 12 >> 2] = 1;c = i[b + 4 >> 2];J[i[i[c >> 2] + 48 >> 2]](c, 105, d + 12 | 0) | 0;i[b + 92 >> 2] = a + 24;a = i[a + 56 >> 2];i[b + 28 >> 2] = 1;i[b + 96 >> 2] = a;i[b + 44 >> 2] = T(128);i[b + 48 >> 2] = T(128);i[b + 52 >> 2] = T(i[b + 16 >> 2] << 1);a = i[b + 24 >> 2];c = a << 1;i[b + 56 >> 2] = T(c);i[b + 60 >> 2] = T(c);c = i[b + 20 >> 2];i[b + 68 >> 2] = T(c << 2);i[b + 72 >> 2] = T(c << 1);a = T(a << 3);i[b + 76 >> 2] = 0;i[b + 64 >> 2] = a;i[b + 84 >> 2] = 1e3;i[b + 36 >> 2] = 0; - }H = d + 16 | 0;return b | 0; - }function qa(a, b, c) { - var d = 0;a: { - if ((a | 0) == (b | 0)) { - break a; - }if ((b - a | 0) - c >>> 0 <= 0 - (c << 1) >>> 0) { - X(a, b, c);return; - }d = (a ^ b) & 3;b: { - c: { - if (a >>> 0 < b >>> 0) { - if (d) { - break b; - }if (!(a & 3)) { - break c; - }while (1) { - if (!c) { - break a; - }g[a | 0] = j[b | 0];b = b + 1 | 0;c = c + -1 | 0;a = a + 1 | 0;if (a & 3) { - continue; - }break; - }break c; - }d: { - if (d) { - break d; - }if (a + c & 3) { - while (1) { - if (!c) { - break a; - }c = c + -1 | 0;d = c + a | 0;g[d | 0] = j[b + c | 0];if (d & 3) { - continue; - }break; - } - }if (c >>> 0 <= 3) { - break d; - }while (1) { - c = c + -4 | 0;i[c + a >> 2] = i[b + c >> 2];if (c >>> 0 > 3) { - continue; - }break; - } - }if (!c) { - break a; - }while (1) { - c = c + -1 | 0;g[c + a | 0] = j[b + c | 0];if (c) { - continue; - }break; - }break a; - }if (c >>> 0 <= 3) { - break b; - }while (1) { - i[a >> 2] = i[b >> 2];b = b + 4 | 0;a = a + 4 | 0;c = c + -4 | 0;if (c >>> 0 > 3) { - continue; - }break; - } - }if (!c) { - break a; - }while (1) { - g[a | 0] = j[b | 0];a = a + 1 | 0;b = b + 1 | 0;c = c + -1 | 0;if (c) { - continue; - }break; - } - } - }function Ea(a, b, c) { - var d = 0, - e = 0, - f = 0, - g = 0, - i = 0, - j = 0, - l = 0, - m = 0, - n = 0, - p = 0, - q = 0;i = k[b >> 1];if (i) { - if ((c | 0) > 0) { - while (1) { - d = 0;m = e + 1 | 0;f = 0 - (h[(m << 1) + b >> 1] << 13) | 0;if (e) { - while (1) { - f = f - o(h[(e - d << 1) + b >> 1], h[(d << 1) + a >> 1]) | 0;d = d + 1 | 0;if ((e | 0) != (d | 0)) { - continue; - }break; - } - }d = i << 16;n = d >> 16;f = ((n + 1 >> 1) + f | 0) / (d + 524288 >> 16) | 0;h[(e << 1) + a >> 1] = f;j = e >>> 1 | 0;if (j) { - p = f << 16 >> 16;d = 0;while (1) { - g = (d << 1) + a | 0;q = h[g >> 1];l = g;g = ((d ^ -1) + e << 1) + a | 0;h[l >> 1] = (o(h[g >> 1], p) + 4096 >>> 13 | 0) + q;h[g >> 1] = k[g >> 1] + (o(p, q) + 4096 >>> 13 | 0);d = d + 1 | 0;if ((j | 0) != (d | 0)) { - continue; - }break; - } - }a: { - if (!(e & 1)) { - d = f << 16 >> 16;break a; - }d = (j << 1) + a | 0;e = h[d >> 1];l = d;d = f << 16 >> 16;h[l >> 1] = e + (o(e, d) + 4096 >>> 13 | 0); - }i = i - (o(o(d, n) << 3 >> 16, d) >>> 13 | 0) | 0;e = m;if ((e | 0) != (c | 0)) { - continue; - }break; - } - }return; - }if ((c | 0) < 1) { - return; - }U(a, 0, c << 1); - }function U(a, b, c) { - var d = 0, - e = 0, - f = 0, - h = 0;a: { - if (!c) { - break a; - }d = a + c | 0;g[d + -1 | 0] = b;g[a | 0] = b;if (c >>> 0 < 3) { - break a; - }g[d + -2 | 0] = b;g[a + 1 | 0] = b;g[d + -3 | 0] = b;g[a + 2 | 0] = b;if (c >>> 0 < 7) { - break a; - }g[d + -4 | 0] = b;g[a + 3 | 0] = b;if (c >>> 0 < 9) { - break a; - }d = 0 - a & 3;e = d + a | 0;b = o(b & 255, 16843009);i[e >> 2] = b;c = c - d & -4;d = c + e | 0;i[d + -4 >> 2] = b;if (c >>> 0 < 9) { - break a; - }i[e + 8 >> 2] = b;i[e + 4 >> 2] = b;i[d + -8 >> 2] = b;i[d + -12 >> 2] = b;if (c >>> 0 < 25) { - break a; - }i[e + 24 >> 2] = b;i[e + 20 >> 2] = b;i[e + 16 >> 2] = b;i[e + 12 >> 2] = b;i[d + -16 >> 2] = b;i[d + -20 >> 2] = b;i[d + -24 >> 2] = b;i[d + -28 >> 2] = b;h = e & 4 | 24;c = c - h | 0;if (c >>> 0 < 32) { - break a; - }d = b;f = b;b = e + h | 0;while (1) { - i[b + 24 >> 2] = f;i[b + 28 >> 2] = d;i[b + 16 >> 2] = f;i[b + 20 >> 2] = d;i[b + 8 >> 2] = f;i[b + 12 >> 2] = d;i[b >> 2] = f;i[b + 4 >> 2] = d;b = b + 32 | 0;c = c + -32 | 0;if (c >>> 0 > 31) { - continue; - }break; - } - }return a; - }function ka(a, b, c, d, e, f, g, j) { - var k = 0, - l = 0, - m = 0, - n = 0, - p = 0, - q = 0, - r = 0, - s = 0, - t = 0, - u = 0;p = g << 2;k = (0 - j & 3) + j | 0;if ((g | 0) >= 1) { - U(k, 0, p); - }a: { - if ((f | 0) < 1) { - break a; - }n = g + -1 | 0;q = (n << 2) + k | 0;r = (n << 1) + b | 0;if ((g | 0) >= 2) { - while (1) { - j = 0;s = m << 1;l = h[s + a >> 1] + (i[k >> 2] + 4096 >> 13) | 0;l = (l | 0) > -32767 ? l : -32767;t = (l | 0) < 32767 ? l : 32767;u = 0 - (t << 16) >> 16;while (1) { - l = j + 1 | 0;i[(j << 2) + k >> 2] = i[(l << 2) + k >> 2] + o(h[(j << 1) + b >> 1], u);j = l;if ((n | 0) != (j | 0)) { - continue; - }break; - }i[q >> 2] = o(h[r >> 1], u);h[e + s >> 1] = t;m = m + 1 | 0;if ((m | 0) != (f | 0)) { - continue; - }break a; - } - }while (1) { - b = m << 1;j = h[b + a >> 1] + (i[k >> 2] + 4096 >> 13) | 0;j = (j | 0) > -32767 ? j : -32767;j = (j | 0) < 32767 ? j : 32767;i[q >> 2] = o(h[r >> 1], 0 - (j << 16) >> 16);h[b + e >> 1] = j;m = m + 1 | 0;if ((m | 0) != (f | 0)) { - continue; - }break; - } - }if ((g | 0) >= 1) { - U(k, 0, p); - }aa(e, c, d, e, f, g, k); - }function aa(a, b, c, d, e, f, g) { - var j = 0, - k = 0, - l = 0, - m = 0, - n = 0, - p = 0, - q = 0, - r = 0, - s = 0, - t = 0, - u = 0;a: { - if ((e | 0) < 1) { - break a; - }l = f + -1 | 0;n = (l << 2) + g | 0;j = l << 1;p = j + c | 0;q = b + j | 0;if ((f | 0) >= 2) { - while (1) { - f = 0;r = k << 1;m = h[r + a >> 1];j = m + (i[g >> 2] + 4096 >> 13) | 0;j = (j | 0) > -32767 ? j : -32767;s = (j | 0) < 32767 ? j : 32767;t = 0 - (s << 16) >> 16;while (1) { - u = (f << 2) + g | 0;j = f + 1 | 0;f = f << 1;i[u >> 2] = (i[(j << 2) + g >> 2] + o(h[f + b >> 1], m) | 0) + o(h[c + f >> 1], t);f = j;if ((l | 0) != (f | 0)) { - continue; - }break; - }i[n >> 2] = o(h[p >> 1], t) + o(h[q >> 1], m);h[d + r >> 1] = s;k = k + 1 | 0;if ((k | 0) != (e | 0)) { - continue; - }break a; - } - }while (1) { - b = k << 1;c = h[b + a >> 1];f = c + (i[g >> 2] + 4096 >> 13) | 0;f = (f | 0) > -32767 ? f : -32767;f = (f | 0) < 32767 ? f : 32767;i[n >> 2] = o(h[p >> 1], 0 - (f << 16) >> 16) + o(c, h[q >> 1]);h[b + d >> 1] = f;k = k + 1 | 0;if ((k | 0) != (e | 0)) { - continue; - }break; - } - } - }function Vb(a, b, c, d, e, f, g, j) { - var k = 0, - l = 0, - m = 0, - n = 0, - p = 0;j = (0 - j & 3) + j | 0;a: { - if ((g | 0) <= 0) { - aa(a, b, c, e, f, g, j);break a; - }k = a;l = b;a = g << 2;b = U(j, 0, a);aa(k, l, c, e, f, g, b);U(b, 0, a); - }b: { - if ((f | 0) < 1) { - break b; - }b = g + -1 | 0;l = j + (b << 2) | 0;m = (b << 1) + d | 0;c = 0;if ((g | 0) >= 2) { - while (1) { - n = (c << 1) + e | 0;k = h[n >> 1];a = k + (i[j >> 2] + 4096 >> 13) | 0;p = (a | 0) > -32767 ? a : -32767;g = 0;while (1) { - a = g + 1 | 0;i[j + (g << 2) >> 2] = i[j + (a << 2) >> 2] + o(h[(g << 1) + d >> 1], k);g = a;if ((a | 0) != (b | 0)) { - continue; - }break; - }i[l >> 2] = o(h[m >> 1], k);h[n >> 1] = (p | 0) < 32767 ? p : 32767;c = c + 1 | 0;if ((f | 0) != (c | 0)) { - continue; - }break b; - } - }while (1) { - a = i[j >> 2];b = (c << 1) + e | 0;d = h[b >> 1];i[l >> 2] = o(d, h[m >> 1]);a = d + (a + 4096 >> 13) | 0;a = (a | 0) > -32767 ? a : -32767;h[b >> 1] = (a | 0) < 32767 ? a : 32767;c = c + 1 | 0;if ((f | 0) != (c | 0)) { - continue; - }break; - } - } - }function Ab(a) { - a = a | 0;var b = 0, - c = 0, - d = 0, - e = 0, - f = 0, - g = 0;c = i[a >> 2];b = T(496);if (b) { - d = T(16e3);i[b + 112 >> 2] = 1;i[b >> 2] = a;i[b + 44 >> 2] = d;i[b + 4 >> 2] = 1;d = i[c >> 2];i[b + 12 >> 2] = d;e = i[c + 4 >> 2];i[b + 16 >> 2] = e;g = (d | 0) / (e | 0) | 0;i[b + 20 >> 2] = g;f = i[c + 8 >> 2];i[b + 24 >> 2] = f;i[b + 28 >> 2] = i[c + 12 >> 2];a = i[c + 16 >> 2];i[b + 116 >> 2] = c + 28;i[b + 32 >> 2] = a;c = i[c + 92 >> 2];i[b + 124 >> 2] = 1;i[b + 120 >> 2] = c;c = T(((d + e | 0) + (a << 1) << 1) + 24 | 0);i[b + 48 >> 2] = c;i[b + 52 >> 2] = ((c + (a << 2) | 0) + (e << 1) | 0) + 12;U(c, 0, a + d << 1);a = f << 1;i[b + 60 >> 2] = T(a);i[b + 56 >> 2] = T(a);i[b + 64 >> 2] = T(f << 2);a = T(g << 2);h[b + 98 >> 1] = 0;h[b + 100 >> 1] = 0;h[b + 102 >> 1] = 0;h[b + 104 >> 1] = 0;i[b + 92 >> 2] = 40;i[b + 76 >> 2] = a;h[b + 106 >> 1] = 0;i[b + 108 >> 2] = 1e3;i[b + 492 >> 2] = 1;i[b + 452 >> 2] = 33;i[b + 36 >> 2] = 8e3; - }return b | 0; - }function ya(a, b, c) { - a: { - b: { - if (b >>> 0 > 20) { - break b; - }c: { - switch (b + -9 | 0) {case 0: - b = i[c >> 2];i[c >> 2] = b + 4;i[a >> 2] = i[b >> 2];return;case 1: - b = i[c >> 2];i[c >> 2] = b + 4;b = i[b >> 2];i[a >> 2] = b;i[a + 4 >> 2] = b >> 31;return;case 2: - b = i[c >> 2];i[c >> 2] = b + 4;i[a >> 2] = i[b >> 2];i[a + 4 >> 2] = 0;return;case 4: - b = i[c >> 2];i[c >> 2] = b + 4;b = h[b >> 1];i[a >> 2] = b;i[a + 4 >> 2] = b >> 31;return;case 5: - b = i[c >> 2];i[c >> 2] = b + 4;i[a >> 2] = k[b >> 1];i[a + 4 >> 2] = 0;return;case 6: - b = i[c >> 2];i[c >> 2] = b + 4;b = g[b | 0];i[a >> 2] = b;i[a + 4 >> 2] = b >> 31;return;case 7: - b = i[c >> 2];i[c >> 2] = b + 4;i[a >> 2] = j[b | 0];i[a + 4 >> 2] = 0;return;case 3:case 8: - break a;case 9: - break c;default: - break b;} - }J[0](a, c); - }return; - }b = i[c >> 2] + 7 & -8;i[c >> 2] = b + 8;c = i[b + 4 >> 2];i[a >> 2] = i[b >> 2];i[a + 4 >> 2] = c; - }function _(a, b, c, d, e, f) { - var g = 0, - j = 0, - k = 0, - l = 0, - m = 0, - n = 0, - p = 0, - q = 0;a: { - if ((d | 0) < 1) { - break a; - }k = e + -1 | 0;l = (k << 2) + f | 0;m = (k << 1) + b | 0;if ((e | 0) >= 2) { - while (1) { - e = 0;n = j << 1;g = h[n + a >> 1] + (i[f >> 2] + 4096 >> 13) | 0;g = (g | 0) > -32767 ? g : -32767;p = (g | 0) < 32767 ? g : 32767;q = 0 - (p << 16) >> 16;while (1) { - g = e + 1 | 0;i[(e << 2) + f >> 2] = i[(g << 2) + f >> 2] + o(h[(e << 1) + b >> 1], q);e = g;if ((k | 0) != (e | 0)) { - continue; - }break; - }i[l >> 2] = o(h[m >> 1], q);h[c + n >> 1] = p;j = j + 1 | 0;if ((j | 0) != (d | 0)) { - continue; - }break a; - } - }while (1) { - b = j << 1;e = h[b + a >> 1] + (i[f >> 2] + 4096 >> 13) | 0;e = (e | 0) > -32767 ? e : -32767;e = (e | 0) < 32767 ? e : 32767;i[l >> 2] = o(h[m >> 1], 0 - (e << 16) >> 16);h[b + c >> 1] = e;j = j + 1 | 0;if ((j | 0) != (d | 0)) { - continue; - }break; - } - } - }function Da(a, b, c, d) { - var e = 0, - f = 0, - g = 0, - i = 0, - j = 0;g = 1;if ((d | 0) >= 1) { - while (1) { - f = h[(e << 1) + a >> 1];g = (o(f, f) >>> 8 | 0) + g | 0;e = e + 1 | 0;if ((e | 0) != (d | 0)) { - continue; - }break; - } - }i = 18;j = 8;e = d + g | 0;a: { - if ((e | 0) >= 1073741824) { - break a; - }while (1) { - b: { - j = j + -1 | 0;e = e << 1;if ((e | 0) > 1073741823) { - break b; - }if (j) { - continue; - } - }break; - }if ((e | 0) >= 1073741824) { - break a; - }while (1) { - i = i + -1 | 0;e = e << 1;if ((e | 0) > 1073741823) { - break a; - }if (i) { - continue; - }break; - } - }f = 0;if ((c | 0) > 0) { - while (1) { - g = 0;e = f;if ((e | 0) < (d | 0)) { - while (1) { - g = (o(h[(e - f << 1) + a >> 1], h[(e << 1) + a >> 1]) >> j) + g | 0;e = e + 1 | 0;if ((e | 0) != (d | 0)) { - continue; - }break; - } - }h[(f << 1) + b >> 1] = g >> i;f = f + 1 | 0;if ((f | 0) != (c | 0)) { - continue; - }break; - } - } - }function va(a, b, c, d, e, f) { - var g = 0, - j = 0, - k = 0, - l = 0, - m = 0, - n = 0, - p = 0, - q = 0;a: { - if ((d | 0) < 1) { - break a; - }k = e + -1 | 0;m = (k << 2) + f | 0;n = (k << 1) + b | 0;if ((e | 0) >= 2) { - while (1) { - p = g << 1;l = h[p + a >> 1];e = l + (i[f >> 2] + 4096 >> 13) | 0;e = (e | 0) > -32767 ? e : -32767;q = (e | 0) < 32767 ? e : 32767;e = 0;while (1) { - j = e + 1 | 0;i[(e << 2) + f >> 2] = i[(j << 2) + f >> 2] + o(h[(e << 1) + b >> 1], l);e = j;if ((k | 0) != (e | 0)) { - continue; - }break; - }i[m >> 2] = o(h[n >> 1], l);h[c + p >> 1] = q;g = g + 1 | 0;if ((g | 0) != (d | 0)) { - continue; - }break a; - } - }while (1) { - b = i[f >> 2];e = g << 1;j = h[e + a >> 1];i[m >> 2] = o(j, h[n >> 1]);b = j + (b + 4096 >> 13) | 0;b = (b | 0) > -32767 ? b : -32767;h[c + e >> 1] = (b | 0) < 32767 ? b : 32767;g = g + 1 | 0;if ((g | 0) != (d | 0)) { - continue; - }break; - } - } - }function W(a, b, c) { - var d = 0, - e = 0, - f = 0, - h = 0;e = H - 48 | 0;H = e;a: { - b: { - c: { - if ((i[a + 8 >> 2] + (i[a + 12 >> 2] + c >> 3) | 0) >= i[a + 24 >> 2]) { - i[e + 32 >> 2] = 5846;d = i[3524];Y(d, 5956, e + 32 | 0);if (!i[a + 16 >> 2]) { - break b; - }f = o(i[a + 24 >> 2], 3) + 15 >> 1;h = Oa(i[a >> 2], f);if (!h) { - break c; - }i[a >> 2] = h;i[a + 24 >> 2] = f; - }if (!c) { - break a; - }while (1) { - d = i[a >> 2] + i[a + 8 >> 2] | 0;c = c + -1 | 0;g[d | 0] = j[d | 0] | (b >>> c & 1) << 7 - i[a + 12 >> 2];d = i[a + 12 >> 2] + 1 | 0;i[a + 12 >> 2] = d;if ((d | 0) == 8) { - i[a + 12 >> 2] = 0;d = i[a + 8 >> 2] + 1 | 0;i[a + 8 >> 2] = d;g[d + i[a >> 2] | 0] = 0; - }i[a + 4 >> 2] = i[a + 4 >> 2] + 1;if (c) { - continue; - }break; - }break a; - }i[e + 16 >> 2] = 5876;Y(d, 5974, e + 16 | 0);break a; - }i[e >> 2] = 5919;Y(d, 5974, e); - }H = e + 48 | 0; - }function Aa(a, b, c, d) { - var e = 0, - f = 0;a: { - if ((c | 0) >= 4194305) { - if ((d | 0) < 1) { - break a; - }c = (c << 2) + 32768 | 0;f = ((c >> 17) + 2097152 | 0) / (c >> 16) << 16 >> 16;c = 0;while (1) { - e = c << 1;h[e + b >> 1] = o(f, h[a + e >> 1]) + 16384 >>> 15;c = c + 1 | 0;if ((d | 0) != (c | 0)) { - continue; - }break; - }break a; - }if ((c | 0) >= 4097) { - if ((d | 0) < 1) { - break a; - }f = 131072 / (c + 256 >>> 9 >>> 0) | 0;c = 0;while (1) { - e = c << 1;h[e + b >> 1] = o(f, k[a + e >> 1] << 18 >> 16) + 128 >>> 8;c = c + 1 | 0;if ((d | 0) != (c | 0)) { - continue; - }break; - }break a; - }if ((d | 0) < 1) { - break a; - }c = c - -64 >> 7;f = 131072 / (((c | 0) > 5 ? c : 5) >>> 0) | 0;c = 0;while (1) { - e = c << 1;h[e + b >> 1] = o(f, k[a + e >> 1] << 18 >> 16) + 32 >>> 6;c = c + 1 | 0;if ((d | 0) != (c | 0)) { - continue; - }break; - } - } - }function Xa(a, b, c) { - var d = 0, - e = 0, - f = 0;d = H - 208 | 0;H = d;i[d + 204 >> 2] = c;c = 0;U(d + 160 | 0, 0, 40);i[d + 200 >> 2] = i[d + 204 >> 2];a: { - if ((ra(0, b, d + 200 | 0, d + 80 | 0, d + 160 | 0) | 0) < 0) { - break a; - }c = i[a + 76 >> 2] >= 0 ? 1 : c;e = i[a >> 2];if (g[a + 74 | 0] <= 0) { - i[a >> 2] = e & -33; - }f = e & 32;b: { - if (i[a + 48 >> 2]) { - ra(a, b, d + 200 | 0, d + 80 | 0, d + 160 | 0);break b; - }i[a + 48 >> 2] = 80;i[a + 16 >> 2] = d + 80;i[a + 28 >> 2] = d;i[a + 20 >> 2] = d;e = i[a + 44 >> 2];i[a + 44 >> 2] = d;ra(a, b, d + 200 | 0, d + 80 | 0, d + 160 | 0);if (!e) { - break b; - }J[i[a + 36 >> 2]](a, 0, 0) | 0;i[a + 48 >> 2] = 0;i[a + 44 >> 2] = e;i[a + 28 >> 2] = 0;i[a + 16 >> 2] = 0;i[a + 20 >> 2] = 0; - }i[a >> 2] = i[a >> 2] | f;if (!c) { - break a; - } - }H = d + 208 | 0; - }function Ca(a, b, c, d) { - var e = 0, - f = 0, - g = 0, - j = 0, - k = 0;a: { - if (c) { - k = i[a + 96 >> 2];i[a + 96 >> 2] = 1;break a; - }e = i[a + 60 >> 2];ca(32440, e, e, i[a + 24 >> 2]);h[a + 80 >> 1] = o(h[a + 80 >> 1], 29491) >>> 15; - }i[a + 28 >> 2] = 1;e = i[a + 12 >> 2];if ((e | 0) >= 1) { - f = i[a + 84 >> 2];while (1) { - f = o(f, 1664525) + 1013904223 | 0;j = o(h[a + 80 >> 1], f >> 16);h[(e + g << 1) + b >> 1] = (j - (j >> 3) | 0) - -8192 >>> 14;g = g + 1 | 0;if ((e | 0) != (g | 0)) { - continue; - }break; - }i[a + 84 >> 2] = f; - }f = (e << 1) + b | 0;_(f, i[a + 60 >> 2], f, e, i[a + 24 >> 2], i[a + 64 >> 2]);ua(b, (i[a + 12 >> 2] << 1) + b | 0, b, i[a + 8 >> 2], i[a + 44 >> 2], i[a + 48 >> 2], d);if (c) { - i[a + 96 >> 2] = k; - } - }function sa(a, b, c, d, e) { - var f = 0, - g = 0, - j = 0, - l = 0, - m = 0, - n = 0, - p = 0, - q = 0, - r = 0, - s = 0;if ((c | 0) >= 1) { - d = o((d | 0) < 4 ? d : 4, 6);n = 0 - k[d + 2372 >> 1] << 16 >> 16;p = 0 - k[d + 2370 >> 1] << 16 >> 16;q = h[d + 2404 >> 1];r = h[d + 2402 >> 1];s = h[d + 2400 >> 1];g = i[e + 4 >> 2];d = i[e >> 2];while (1) { - l = m << 1;f = h[l + a >> 1];d = o(f, s) + d | 0;j = d - -8192 >> 14;h[b + l >> 1] = (d | 0) > 536862719 ? 32767 : (j | 0) > -32767 ? j : -32767;l = o(f, r) + g | 0;g = d << 1 >> 16;j = d & 32767;d = l + (o(g, p) + (o(j, p) >> 15) << 1) | 0;f = o(f, q) + (o(g, n) + (o(j, n) >> 15) << 1) | 0;g = f;m = m + 1 | 0;if ((m | 0) != (c | 0)) { - continue; - }break; - }i[e + 4 >> 2] = f;i[e >> 2] = d; - } - }function hc(a, b) { - var c = 0, - d = 0, - e = 0, - f = 0, - g = 0, - h = 0, - i = 0, - j = 0;c = b;if (!c) { - a = (a >>> 0) / 10 | 0;I = 0;return a; - }g = 61 - r(c) | 0;d = 0 - g | 0;f = g & 63;e = f & 31;if (32 <= f >>> 0) { - f = 0;e = c >>> e | 0; - } else { - f = c >>> e | 0;e = ((1 << e) - 1 & c) << 32 - e | a >>> e; - }d = d & 63;c = d & 31;if (32 <= d >>> 0) { - b = a << c;a = 0; - } else { - b = (1 << c) - 1 & a >>> 32 - c | b << c;a = a << c; - }if (g) { - c = 0;while (1) { - d = e << 1 | b >>> 31;h = d;f = f << 1 | e >>> 31;d = c - (f + (9 < d >>> 0) | 0) >> 31;i = d & 10;e = h - i | 0;f = f - (h >>> 0 < i >>> 0) | 0;b = b << 1 | a >>> 31;a = j | a << 1;h = d & 1;j = h;g = g + -1 | 0;if (g) { - continue; - }break; - } - }I = b << 1 | a >>> 31;return h | a << 1; - }function pb(a, b, c) { - a = a | 0;b = b | 0;c = c | 0;var d = 0, - e = 0, - f = 0;a: { - b: { - if ((b | 0) > 0) { - while (1) { - h[(d << 1) + a >> 1] = (o(d, 167772160) >>> 16 | 0) + 6144;d = d + 1 | 0;if ((d | 0) != (b | 0)) { - continue; - }break; - }d = V(c, 6);if ((b | 0) < 1) { - break b; - }e = o(b, d);d = 0;while (1) { - f = (d << 1) + a | 0;h[f >> 1] = k[f >> 1] + (g[(d + e | 0) + 4016 | 0] << 5);d = d + 1 | 0;if ((d | 0) != (b | 0)) { - continue; - }break; - }c = V(c, 6);if ((b | 0) < 1) { - break a; - }c = o(b, c);d = 0;while (1) { - e = (d << 1) + a | 0;h[e >> 1] = k[e >> 1] + (g[(c + d | 0) + 4528 | 0] << 4);d = d + 1 | 0;if ((d | 0) != (b | 0)) { - continue; - }break; - }break a; - }V(c, 6); - }V(c, 6); - } - }function ec(a, b) { - a: { - if (a) { - if (b >>> 0 <= 127) { - break a; - }b: { - if (!i[i[3736] >> 2]) { - if ((b & -128) == 57216) { - break a; - }break b; - }if (b >>> 0 <= 2047) { - g[a + 1 | 0] = b & 63 | 128;g[a | 0] = b >>> 6 | 192;return 2; - }if (!((b & -8192) != 57344 ? b >>> 0 >= 55296 : 0)) { - g[a + 2 | 0] = b & 63 | 128;g[a | 0] = b >>> 12 | 224;g[a + 1 | 0] = b >>> 6 & 63 | 128;return 3; - }if (b + -65536 >>> 0 <= 1048575) { - g[a + 3 | 0] = b & 63 | 128;g[a | 0] = b >>> 18 | 240;g[a + 2 | 0] = b >>> 6 & 63 | 128;g[a + 1 | 0] = b >>> 12 & 63 | 128;return 4; - } - }i[3790] = 25;a = -1; - } else { - a = 1; - }return a; - }g[a | 0] = b;return 1; - }function Hb(a, b, c) { - var d = 0, - e = 0, - f = 0;e = H - 48 | 0;H = e;a: { - if (i[a + 24 >> 2] >= (c | 0)) { - break a; - }i[e + 32 >> 2] = 5708;d = i[3524];Y(d, 5956, e + 32 | 0);if (i[a + 16 >> 2]) { - f = Oa(i[a >> 2], c);if (f) { - i[a >> 2] = f;i[a + 24 >> 2] = c;break a; - }c = i[a + 24 >> 2];i[e + 16 >> 2] = 5747;Y(d, 5974, e + 16 | 0);break a; - }i[e >> 2] = 5795;Y(d, 5974, e);c = i[a + 24 >> 2]; - }if ((c | 0) >= 1) { - d = 0;while (1) { - g[i[a >> 2] + d | 0] = j[b + d | 0];d = d + 1 | 0;if ((d | 0) != (c | 0)) { - continue; - }break; - } - }i[a + 20 >> 2] = 0;i[a + 8 >> 2] = 0;i[a + 12 >> 2] = 0;i[a + 4 >> 2] = c << 3;H = e + 48 | 0; - }function Ta(a, b) { - var c = 0;c = (b | 0) != 0;a: { - b: { - c: { - if (!b | !(a & 3)) { - break c; - }while (1) { - if (!j[a | 0]) { - break b; - }a = a + 1 | 0;b = b + -1 | 0;c = (b | 0) != 0;if (!b) { - break c; - }if (a & 3) { - continue; - }break; - } - }if (!c) { - break a; - } - }d: { - if (!j[a | 0] | b >>> 0 < 4) { - break d; - }while (1) { - c = i[a >> 2];if ((c ^ -1) & c + -16843009 & -2139062144) { - break d; - }a = a + 4 | 0;b = b + -4 | 0;if (b >>> 0 > 3) { - continue; - }break; - } - }if (!b) { - break a; - }while (1) { - if (!j[a | 0]) { - return a; - }a = a + 1 | 0;b = b + -1 | 0;if (b) { - continue; - }break; - } - }return 0; - }function ga(a, b, c) { - var d = 0, - e = 0, - f = 0, - g = 0, - i = 0, - j = 0;if (h[a >> 1] < (c | 0)) { - h[a >> 1] = c; - }g = b + -1 | 0;e = (g << 1) + a | 0;d = 25736 - c << 16 >> 16;if (h[e >> 1] > (d | 0)) { - h[e >> 1] = d; - }if ((b | 0) >= 3) { - d = k[a >> 1];e = k[a + 2 >> 1];b = 1;while (1) { - i = (b << 1) + a | 0;f = (d << 16 >> 16) + c | 0;d = e << 16 >> 16;if ((f | 0) > (d | 0)) { - h[i >> 1] = f;d = f << 16 >> 16;e = f; - }b = b + 1 | 0;f = h[(b << 1) + a >> 1];j = f - c | 0;if ((j | 0) < (d | 0)) { - e = (d >> 1) + (j >>> 1 | 0) | 0;h[i >> 1] = e; - }d = e;e = f;if ((b | 0) != (g | 0)) { - continue; - }break; - } - } - }function xa(a, b, c) { - var d = 0, - e = 0, - f = 0, - h = 0;d = i[c + 16 >> 2];a: { - if (!d) { - if (Ma(c)) { - break a; - }d = i[c + 16 >> 2]; - }f = i[c + 20 >> 2];if (d - f >>> 0 < b >>> 0) { - return J[i[c + 36 >> 2]](c, a, b) | 0; - }b: { - if (g[c + 75 | 0] < 0) { - break b; - }e = b;while (1) { - d = e;if (!d) { - break b; - }e = d + -1 | 0;if (j[e + a | 0] != 10) { - continue; - }break; - }e = J[i[c + 36 >> 2]](c, a, d) | 0;if (e >>> 0 < d >>> 0) { - break a; - }b = b - d | 0;a = a + d | 0;f = i[c + 20 >> 2];h = d; - }X(f, a, b);i[c + 20 >> 2] = i[c + 20 >> 2] + b;e = b + h | 0; - }return e; - }function cc(a, b) { - a: { - if ((b | 0) >= 1024) { - a = a * 8.98846567431158e+307;if ((b | 0) < 2047) { - b = b + -1023 | 0;break a; - }a = a * 8.98846567431158e+307;b = ((b | 0) < 3069 ? b : 3069) + -2046 | 0;break a; - }if ((b | 0) > -1023) { - break a; - }a = a * 2.2250738585072014e-308;if ((b | 0) > -2045) { - b = b + 1022 | 0;break a; - }a = a * 2.2250738585072014e-308;b = ((b | 0) > -3066 ? b : -3066) + 2044 | 0; - }lc(0, 0);lc(1, b + 1023 << 20);return a * +mc(); - }function db(a, b, c, d, e) { - a = a | 0;b = b | 0;c = c | 0;d = d | 0;e = e | 0;var f = 0;f = H - 96 | 0;H = f;i[f + 92 >> 2] = a;a: { - if (d) { - i[e + 36 >> 2] = J[i[2735]](10920);Ba(f + 8 | 0, 8e3, 10920);break a; - }i[e + 36 >> 2] = J[i[2902]](11588);Ba(f + 8 | 0, 16e3, 11588); - }a = i[e + 36 >> 2];J[i[i[a >> 2] + 44 >> 2]](a, 4, f + 92 | 0) | 0;Fa(e);a = X(T(80), f + 8 | 0, 80);i[f + 4 >> 2] = 80;d = a;a = i[f + 4 >> 2];X(b, d, (a | 0) > (c | 0) ? c : a);H = f + 96 | 0;return a | 0; - }function wa(a, b, c, d) { - var e = 0, - f = 0, - g = 0, - j = 0;g = 1;if ((d | 0) > 0) { - while (1) { - j = i[(f << 2) + a >> 2];e = j >> 31;e = e ^ e + j;g = (e | 0) < (g | 0) ? g : e;f = f + 1 | 0;if ((f | 0) != (d | 0)) { - continue; - }break; - } - }f = 0;e = 0;if ((g | 0) > (c | 0)) { - while (1) { - e = e + 1 | 0;g = g >> 1;if ((g | 0) > (c | 0)) { - continue; - }break; - } - }if ((d | 0) > 0) { - while (1) { - h[(f << 1) + b >> 1] = i[(f << 2) + a >> 2] >> e;f = f + 1 | 0;if ((f | 0) != (d | 0)) { - continue; - }break; - } - }return e; - }function Ob(a, b, c, d, e, f, g, j, k, l, m, n, p, q, r) { - a = a | 0;b = b | 0;c = c | 0;d = d | 0;e = e | 0;f = f | 0;g = g | 0;j = j | 0;k = k | 0;l = l | 0;m = m | 0;n = n | 0;p = p | 0;q = q | 0;r = r | 0;d = (e | 0) < 63 ? e : 63;if ((g | 0) >= 1) { - f = d << 23 >> 16;e = 0;while (1) { - l = o(h[(e - c << 1) + a >> 1], f);i[(e << 2) + b >> 2] = l;h[(e << 1) + a >> 1] = l + 4096 >>> 13;e = e + 1 | 0;if ((g | 0) != (e | 0)) { - continue; - }break; - } - }i[j >> 2] = c;h[k + 2 >> 1] = d;h[k >> 1] = 0;h[k + 4 >> 1] = 0; - }function Gb(a, b) { - var c = 0, - d = 0, - e = 0;c = i[a + 4 >> 2];d = i[a + 8 >> 2];e = i[a + 12 >> 2];a: { - if (!e) { - break a; - }W(a, 0, 1);if (!i[a + 12 >> 2]) { - break a; - }while (1) { - W(a, 1, 1);if (i[a + 12 >> 2]) { - continue; - }break; - } - }i[a + 8 >> 2] = d;i[a + 12 >> 2] = e;i[a + 4 >> 2] = c;c = c + 7 >> 3;d = (c | 0) < 200 ? c : 200;if ((d | 0) >= 1) { - c = 0;while (1) { - g[b + c | 0] = j[i[a >> 2] + c | 0];c = c + 1 | 0;if ((d | 0) != (c | 0)) { - continue; - }break; - } - }return d; - }function Eb(a, b, c) { - a = a | 0;b = b | 0;c = c | 0;var d = 0;d = H - 16 | 0;H = d;a: { - b: { - switch (b | 0) {case 0: - i[c >> 2] = i[a + 4 >> 2] << 1;a = 0;break a;case 1: - b = i[c >> 2];if (!b) { - i[c >> 2] = 4;a = 0;break a; - }a = i[((b << 2) + a | 0) + 24 >> 2];if (!a) { - i[c >> 2] = -1;a = 0;break a; - }i[c >> 2] = i[a + 52 >> 2];a = 0;break a;default: - break b;} - }i[d + 4 >> 2] = b;i[d >> 2] = 11821;Y(i[3524], 12120, d);a = -1; - }H = d + 16 | 0;return a | 0; - }function Zb(a) { - var b = 0, - c = 0, - d = 0;a: { - b: { - b = a;if (!(b & 3)) { - break b; - }if (!j[a | 0]) { - return 0; - }while (1) { - b = b + 1 | 0;if (!(b & 3)) { - break b; - }if (j[b | 0]) { - continue; - }break; - }break a; - }while (1) { - c = b;b = b + 4 | 0;d = i[c >> 2];if (!((d ^ -1) & d + -16843009 & -2139062144)) { - continue; - }break; - }if (!(d & 255)) { - return c - a | 0; - }while (1) { - d = j[c + 1 | 0];b = c + 1 | 0;c = b;if (d) { - continue; - }break; - } - }return b - a | 0; - }function Mb(a, b, c) { - a = a | 0;b = b | 0;c = c | 0;var d = 0;d = H - 16 | 0;H = d;a: { - b: { - switch (b | 0) {case 0: - i[c >> 2] = i[a >> 2];a = 0;break a;case 1: - b = i[c >> 2];if (!b) { - i[c >> 2] = 5;a = 0;break a; - }a = i[((b << 2) + a | 0) + 28 >> 2];if (!a) { - i[c >> 2] = -1;a = 0;break a; - }i[c >> 2] = i[a + 52 >> 2];a = 0;break a;default: - break b;} - }i[d + 4 >> 2] = b;i[d >> 2] = 5040;Y(i[3524], 5072, d);a = -1; - }H = d + 16 | 0;return a | 0; - }function V(a, b) { - var c = 0, - d = 0, - e = 0, - f = 0, - h = 0, - j = 0;c = i[a + 12 >> 2];d = i[a + 8 >> 2];if (((c + b | 0) + (d << 3) | 0) > i[a + 4 >> 2]) { - i[a + 20 >> 2] = 1;return 0; - }if (!(i[a + 20 >> 2] | !b)) { - j = i[a >> 2];while (1) { - f = g[d + j | 0];h = c + 1 | 0;i[a + 12 >> 2] = h;f = f >>> 7 - c & 1;e = e << 1;if ((h | 0) != 8) { - c = h; - } else { - i[a + 12 >> 2] = 0;d = d + 1 | 0;i[a + 8 >> 2] = d;c = 0; - }e = e | f;b = b + -1 | 0;if (b) { - continue; - }break; - } - }return e; - }function Lb(a) { - i[a + 8 >> 2] = 1065353216;i[a >> 2] = 1036831949;i[a + 4 >> 2] = 0;i[a + 52 >> 2] = 1059982050;i[a + 56 >> 2] = 1028443341;i[a + 36 >> 2] = 0;i[a + 40 >> 2] = 0;i[a + 60 >> 2] = 0;i[a + 44 >> 2] = 0;i[a + 48 >> 2] = 1096387994;i[a + 12 >> 2] = 1091252534;i[a + 16 >> 2] = 1091252534;i[a + 28 >> 2] = 1091252534;i[a + 32 >> 2] = 0;i[a + 20 >> 2] = 1091252534;i[a + 24 >> 2] = 1091252534; - }function Rb(a, b, c, d, e, f, g, j, k, l, m, n, o) { - a = a | 0;b = b | 0;c = c | 0;d = d | 0;e = e | 0;f = f | 0;g = g | 0;j = j | 0;k = k | 0;l = l | 0;m = m | 0;n = n | 0;o = o | 0;e = b;k = c;b = (m & 1) + m | 0;c = g << 1;Vb(a, e, k, d, b, g, f, c + b | 0);if ((g | 0) >= 1) { - m = 0;while (1) { - d = (m << 2) + j | 0;i[d >> 2] = i[d >> 2] + (h[b + (m << 1) >> 1] << 8);m = m + 1 | 0;if ((m | 0) != (g | 0)) { - continue; - }break; - } - }U(a, 0, c); - }function Ua(a, b, c) { - var d = 0, - e = 0, - f = 0;a: { - if ((b | 0) == 1 & a >>> 0 < 0 | b >>> 0 < 1) { - d = a;break a; - }while (1) { - d = hc(a, b);e = I;f = e;c = c + -1 | 0;g[c | 0] = a - gc(d, e) | 48;e = b >>> 0 > 9;a = d;b = f;if (e) { - continue; - }break; - } - }if (d) { - while (1) { - c = c + -1 | 0;a = (d >>> 0) / 10 | 0;g[c | 0] = d - o(a, 10) | 48;b = d >>> 0 > 9;d = a;if (b) { - continue; - }break; - } - }return c; - }function bb(a, b, c, d, e, f) { - var g = 0, - i = p(0), - j = 0;g = H;j = g;g = g - ((e << 2) + 15 & -16) | 0;H = g;Hb(b, c, f);if ((Nb(a, b, g) | 0) >= 0) { - if ((e | 0) >= 1) { - b = 0;while (1) { - a = (b << 1) + d | 0;i = m[g + (b << 2) >> 2];a: { - if (p(q(i)) < p(2147483648)) { - c = ~~i;break a; - }c = -2147483648; - }h[a >> 1] = c;b = b + 1 | 0;if ((e | 0) != (b | 0)) { - continue; - }break; - } - } - }H = j; - }function eb(a) { - var b = 0, - c = 0;b = H - 32 | 0;H = b;a: { - b: { - if (j[a | 0] != 83 | j[a + 1 | 0] != 112 | (j[a + 2 | 0] != 101 | j[a + 3 | 0] != 101)) { - break b; - }if (j[a + 4 | 0] != 120 | j[a + 5 | 0] != 32 | (j[a + 6 | 0] != 32 | j[a + 7 | 0] != 32)) { - break b; - }c = T(80);X(c, a, 80);break a; - }i[b + 16 >> 2] = 13233;Y(i[3524], 13305, b + 16 | 0); - }H = b + 32 | 0;return c; - }function fa(a, b, c, d, e, f) { - var g = 0, - i = 0;e = ((e << 14) + 16384 | 0) / (f << 16 >> 16) | 0;if ((d | 0) >= 1) { - e = e << 16;g = e >> 16;i = 1073741824 - e >> 16;e = 0;while (1) { - f = e << 1;h[f + c >> 1] = (o(h[b + f >> 1], g) - -8192 >>> 14) + (o(h[a + f >> 1], i) - -8192 >>> 14);e = e + 1 | 0;if ((e | 0) != (d | 0)) { - continue; - }break; - } - } - }function bc(a) { - var b = 0, - c = 0, - d = 0;b = H - 16 | 0;H = b;g[b + 15 | 0] = 10;c = i[a + 16 >> 2];a: { - if (!c) { - if (Ma(a)) { - break a; - }c = i[a + 16 >> 2]; - }d = i[a + 20 >> 2];if (!(g[a + 75 | 0] == 10 | d >>> 0 >= c >>> 0)) { - i[a + 20 >> 2] = d + 1;g[d | 0] = 10;break a; - }if ((J[i[a + 36 >> 2]](a, b + 15 | 0, 1) | 0) != 1) { - break a; - } - }H = b + 16 | 0; - }function _a(a, b, c, d) { - a = a | 0;b = b | 0;c = c | 0;d = d | 0;var e = 0;e = H - 16 | 0;H = e;a = B(i[a + 60 >> 2], b | 0, c | 0, d & 255, e + 8 | 0) | 0;b = 0;a: { - if (!a) { - break a; - }i[3790] = a;b = -1; - }b: { - if (!b) { - b = i[e + 12 >> 2];a = i[e + 8 >> 2];break b; - }i[e + 8 >> 2] = -1;i[e + 12 >> 2] = -1;b = -1;a = -1; - }H = e + 16 | 0;I = b;return a | 0; - }function Nb(a, b, c) { - var d = 0, - e = 0;d = H - 1296 | 0;H = d;J[i[i[a >> 2] + 48 >> 2]](a, 3, d + 1292 | 0) | 0;b = J[i[i[a >> 2] + 40 >> 2]](a, b, d) | 0;e = i[d + 1292 >> 2];if ((e | 0) >= 1) { - a = 0;while (1) { - m[(a << 2) + c >> 2] = h[(a << 1) + d >> 1];a = a + 1 | 0;if ((e | 0) != (a | 0)) { - continue; - }break; - } - }H = d + 1296 | 0;return b; - }function gb(a, b, c) { - var d = 0, - e = 0;d = b;b = V(a, 4);d = d + o(b, 20) | 0;e = i[d + 4 >> 2];if (e) { - return J[e | 0](a, c, i[d + 8 >> 2]) | 0; - }c = 1;a: { - if ((b | 0) < 2) { - break a; - }c = 4;if ((b | 0) < 8) { - break a; - }c = 8;if ((b | 0) < 10) { - break a; - }c = 16;if ((b | 0) < 12) { - break a; - }c = (b | 0) < 14 ? 32 : 64; - }oa(a, c);return 0; - }function Oa(a, b) { - var c = 0, - d = 0;if (!a) { - return na(b); - }if (b >>> 0 >= 4294967232) { - i[3790] = 48;return 0; - }c = dc(a + -8 | 0, b >>> 0 < 11 ? 16 : b + 11 & -8);if (c) { - return c + 8 | 0; - }c = na(b);if (!c) { - return 0; - }d = i[a + -4 >> 2];d = (d & 3 ? -4 : -8) + (d & -8) | 0;X(c, a, d >>> 0 < b >>> 0 ? d : b);S(a);return c; - }function Cb(a) { - a = a | 0;S(i[a + 64 >> 2]);S(i[a + 68 >> 2]);S(i[a + 72 >> 2]);S(i[a + 100 >> 2]);S(i[a + 80 >> 2]);S(i[a + 96 >> 2]);S(i[a + 104 >> 2]);S(i[a + 108 >> 2]);S(i[a + 112 >> 2]);S(i[a + 116 >> 2]);S(i[a + 120 >> 2]);S(i[a + 132 >> 2]);S(i[a + 52 >> 2]);S(i[a + 140 >> 2]);S(a); - }function nb(a) { - a = a | 0;var b = 0;b = i[a + 4 >> 2];J[i[i[b >> 2] + 24 >> 2]](b);S(i[a + 48 >> 2]);S(i[a + 52 >> 2]);S(i[a + 56 >> 2]);S(i[a + 68 >> 2]);S(i[a + 72 >> 2]);S(i[a + 76 >> 2]);S(i[a + 92 >> 2]);S(i[a + 96 >> 2]);S(i[a + 80 >> 2]);S(i[a + 84 >> 2]);S(i[a + 88 >> 2]);S(a); - }function Ib(a, b, c, d, e, f) { - a = a | 0;b = b | 0;c = c | 0;d = d | 0;e = e | 0;f = f | 0;if ((c | 0) >= 1) { - b = 0;while (1) { - d = o(i[f >> 2], 1664525) + 1013904223 | 0;i[f >> 2] = d;i[(b << 2) + a >> 2] = ((d >> 16) - (d >> 19) | 0) - -8192 & -16384;b = b + 1 | 0;if ((c | 0) != (b | 0)) { - continue; - }break; - } - } - }function vb(a, b) { - var c = 0, - d = 0, - e = 0, - f = 0;if ((b | 0) >= 1) { - while (1) { - e = (c << 2) + a | 0;d = i[e >> 2];f = (d | 0) < -262144e3;if (!((d | 0) <= 262144e3 ? !f : 0)) { - i[e >> 2] = f ? -262144e3 : (d | 0) > 262144e3 ? 262144e3 : 0; - }c = c + 1 | 0;if ((c | 0) != (b | 0)) { - continue; - }break; - } - } - }function cb(a, b, c) { - a = a | 0;b = b | 0;c = c | 0;var d = 0;g[i[c >> 2]] = 0;i[c + 20 >> 2] = 0;i[c + 12 >> 2] = 0;i[c + 4 >> 2] = 0;i[c + 8 >> 2] = 0;d = i[c + 36 >> 2];J[i[i[d >> 2] + 28 >> 2]](d, a, c) | 0;d = b;a = Gb(c, b + 2 | 0);b = a & 65535;h[d >> 1] = (b << 24 | b << 8) >>> 16;return a | 0; - }function ma(a) { - var b = 0, - c = 0;b = i[3652];b;c = a;a = Zb(a);a: { - if ((((ac(c, a, b) | 0) != (a | 0) ? -1 : 0) | 0) < 0) { - break a; - }b: { - if (j[b + 75 | 0] == 10) { - break b; - }a = i[b + 20 >> 2];if (a >>> 0 >= l[b + 16 >> 2]) { - break b; - }i[b + 20 >> 2] = a + 1;g[a | 0] = 10;break a; - }bc(b); - } - }function $(a, b, c) { - var d = 0;c = c >> 2;if (c) { - while (1) { - d = (((o(h[b + 2 >> 1], h[a + 2 >> 1]) + o(h[b >> 1], h[a >> 1]) | 0) + o(h[b + 4 >> 1], h[a + 4 >> 1]) | 0) + o(h[b + 6 >> 1], h[a + 6 >> 1]) >> 6) + d | 0;b = b + 8 | 0;a = a + 8 | 0;c = c + -1 | 0;if (c) { - continue; - }break; - } - }return d; - }function ea(a, b, c, d, e) { - var f = 0;f = H - 256 | 0;H = f;if (!(e & 73728 | (c | 0) <= (d | 0))) { - c = c - d | 0;d = c >>> 0 < 256;U(f, b & 255, d ? c : 256);if (!d) { - while (1) { - ja(a, f, 256);c = c + -256 | 0;if (c >>> 0 > 255) { - continue; - }break; - } - }ja(a, f, c); - }H = f + 256 | 0; - }function da(a, b, c, d) { - var e = 0, - f = 0, - g = 0, - h = 0;if ((d | 0) >= 1) { - g = c & 16383;h = c << 2 >> 16;c = 0;while (1) { - e = c << 2;f = i[e + a >> 2] << 9 >> 16;i[b + e >> 2] = o(f, h) + (o(f, g) >> 14) << 7;c = c + 1 | 0;if ((d | 0) != (c | 0)) { - continue; - }break; - } - } - }function Ma(a) { - var b = 0;b = j[a + 74 | 0];g[a + 74 | 0] = b + -1 | b;b = i[a >> 2];if (b & 8) { - i[a >> 2] = b | 32;return -1; - }i[a + 4 >> 2] = 0;i[a + 8 >> 2] = 0;b = i[a + 44 >> 2];i[a + 28 >> 2] = b;i[a + 20 >> 2] = b;i[a + 16 >> 2] = b + i[a + 48 >> 2];return 0; - }function ca(a, b, c, d) { - var e = 0, - f = 0, - g = 0;if ((d | 0) >= 1) { - e = a;while (1) { - g = f << 1;e = e << 16 >> 16;h[g + c >> 1] = o(e, h[b + g >> 1]) + 16384 >>> 15;e = o(a, e) + 16384 >>> 15 | 0;f = f + 1 | 0;if ((f | 0) != (d | 0)) { - continue; - }break; - } - } - }function kb(a) { - a = a | 0;var b = 0;b = i[a + 4 >> 2];J[i[i[b >> 2] + 36 >> 2]](b);S(i[a + 44 >> 2]);S(i[a + 48 >> 2]);S(i[a + 52 >> 2]);S(i[a + 56 >> 2]);S(i[a + 60 >> 2]);S(i[a + 68 >> 2]);S(i[a + 72 >> 2]);S(i[a + 64 >> 2]);S(a); - }function ia(a) { - var b = 0, - c = 0;b = i[3750];c = a + 3 & -4;a = b + c | 0;a: { - if (a >>> 0 <= b >>> 0 ? (c | 0) >= 1 : 0) { - break a; - }if (a >>> 0 > pc() << 16 >>> 0) { - if (!(D(a | 0) | 0)) { - break a; - } - }i[3750] = a;return b; - }i[3790] = 48;return -1; - }function za(a) { - var b = 0, - c = 0, - d = 0;if (g[i[a >> 2]] + -48 >>> 0 < 10) { - while (1) { - b = i[a >> 2];d = g[b | 0];i[a >> 2] = b + 1;c = (o(c, 10) + d | 0) + -48 | 0;if (g[b + 1 | 0] + -48 >>> 0 < 10) { - continue; - }break; - } - }return c; - }function gc(a, b) { - var c = 0, - d = 0, - e = 0;c = a >>> 16 | 0;e = o(c, 0);d = o(c, 10);c = o(a & 65535, 10);d = d + (c >>> 16 | 0) | 0;a = d & 65535;I = e + o(b, 10) + (d >>> 16) + (a >>> 16) | 0;return c & 65535 | a << 16; - }function pa(a, b, c) { - var d = 0;a: { - if ((c | 0) < 2) { - break a; - }c = c + -1 | 0;while (1) { - if (h[b >> 1] >= (a | 0)) { - break a; - }b = b + 2 | 0;d = d + 1 | 0;if ((c | 0) != (d | 0)) { - continue; - }break; - }d = c; - }return d; - }function oa(a, b) { - var c = 0;b = i[a + 12 >> 2] + b | 0;c = i[a + 8 >> 2];if (!(i[a + 20 >> 2] ? 0 : (b + (c << 3) | 0) <= i[a + 4 >> 2])) { - i[a + 20 >> 2] = 1;return; - }i[a + 12 >> 2] = b & 7;i[a + 8 >> 2] = (b >> 3) + c; - }function Fb(a) { - var b = 0, - c = 0;b = i[a + 12 >> 2];c = i[a + 8 >> 2];if ((b + (c << 3) | 0) >= i[a + 4 >> 2]) { - i[a + 20 >> 2] = 1;return 0; - }return i[a + 20 >> 2] ? 0 : g[i[a >> 2] + c | 0] >>> 7 - b & 1; - }function T(a) { - var b = 0, - c = 0;b = 0;a: { - if (!a) { - break a; - }c = a;b = a;if ((a | 1) >>> 0 < 65536) { - break a; - }b = c; - }c = b;a = na(b);if (!(!a | !(j[a + -4 | 0] & 3))) { - U(a, 0, c); - }return a; - }function Wa(a, b, c, d) { - if (a | b) { - while (1) { - c = c + -1 | 0;g[c | 0] = j[(a & 15) + 14592 | 0] | d;a = (b & 15) << 28 | a >>> 4;b = b >>> 4 | 0;if (a | b) { - continue; - }break; - } - }return c; - }function Jb(a) { - var b = 0, - c = 0;c = 12144;a: { - while (1) { - if (i[c >> 2] >= (a | 0)) { - break a; - }c = c + 4 | 0;b = b + 1 | 0;if ((b | 0) != 31) { - continue; - }break; - }b = 31; - }return b; - }function Fa(a) { - var b = 0;b = T(2e3);i[a >> 2] = b;if (b) { - i[a + 20 >> 2] = 0;i[a + 24 >> 2] = 2e3;i[a + 12 >> 2] = 0;i[a + 16 >> 2] = 1;i[a + 4 >> 2] = 0;i[a + 8 >> 2] = 0; - } - }function Pa(a) { - var b = 0;a = a ? a : 1;a: { - while (1) { - b = na(a);if (b) { - break a; - }b = i[3807];if (b) { - J[b | 0]();continue; - }break; - }E();x(); - }return b; - }function Va(a, b, c) { - if (a | b) { - while (1) { - c = c + -1 | 0;g[c | 0] = a & 7 | 48;a = (b & 7) << 29 | a >>> 3;b = b >>> 3 | 0;if (a | b) { - continue; - }break; - } - }return c; - }function zb(a) { - a = a | 0;S(i[a + 44 >> 2]);S(i[a + 48 >> 2]);S(i[a + 60 >> 2]);S(i[a + 56 >> 2]);S(i[a + 64 >> 2]);S(i[a + 76 >> 2]);S(a); - }function ac(a, b, c) { - a: { - if (i[c + 76 >> 2] <= -1) { - a = xa(a, b, c);break a; - }a = xa(a, b, c); - }if ((a | 0) == (b | 0)) { - return b; - }return a; - }function la(a, b) { - var c = 0;c = H - 16 | 0;H = c;i[c + 8 >> 2] = a;i[c + 4 >> 2] = b;i[c >> 2] = 12377;Y(i[3524], 12767, c);G(1);x(); - }function ic(a) { - var b = 0;b = a & 31;a = 0 - a & 31;return (-1 >>> b & -2) << b | (-1 << a & -2) >>> a; - } - - function Y(a, b, c) { - var d = 0;d = H - 16 | 0;H = d;i[d + 12 >> 2] = c;Xa(a, b, c);H = d + 16 | 0; - }function fb(a, b, c) { - a = a | 0;b = b | 0;c = c | 0;oa(a, V(a, 4) << 3 | 5);return 0; - }function _b(a, b, c, d) { - a = a | 0;b = b | 0;c = c | 0;d = d | 0;I = 0;return 0; - }function Qa(a, b) { - if (!a) { - return 0; - }return ec(a, b); - }function ja(a, b, c) { - if (!(j[a | 0] & 32)) { - xa(b, c, a); - } - }function Wb(a) { - a = a | 0;a = H - a & -16;H = a;return a | 0; - }function Za(a) { - a = a | 0;return F(i[a + 60 >> 2]) | 0; - }function $b(a) { - a = a | 0;return 0; - }function Yb() { - return H | 0; - }function Xb(a) { - a = a | 0;H = a; - }function Sa() {} - // EMSCRIPTEN_END_FUNCS - var J = jc([null, Mb, Db, Cb, Bb, Ab, zb, yb, xb, wb, sb, rb, Pb, Ob, Rb, Ib, Sb, Qb, fc, Tb, ub, tb, Eb, ob, nb, mb, lb, kb, jb, ib, hb, qb, pb, fb, Za, Ya, _a, $b, _b]);function pc() { - return f.byteLength / 65536 | 0; - }return { "i": J, "j": Sa, "k": db, "l": cb, "m": ab, "n": Yb, "o": Xb, "p": Wb, "q": na }; - }var K = new Uint8Array(sc.buffer);for (var L = new Uint8Array(123), M = 25; M >= 0; --M) { - L[48 + M] = 52 + M;L[65 + M] = M;L[97 + M] = 26 + M; - }L[43] = 62;L[47] = 63;function qc(zc, Ac, Bc) { - var N, - O, - M = 0, - P = Ac, - Q = Bc.length, - R = Ac + (Q * 3 >> 2) - (Bc[Q - 2] == "=") - (Bc[Q - 1] == "=");for (; M < Q; M += 4) { - N = L[Bc.charCodeAt(M + 1)];O = L[Bc.charCodeAt(M + 2)];zc[P++] = L[Bc.charCodeAt(M)] << 2 | N >> 4;if (P < R) zc[P++] = N << 4 | O >> 2;if (P < R) zc[P++] = O << 6 | L[Bc.charCodeAt(M + 3)]; - } - }qc(K, 1024, "BxERGxkWDAT9ABzcJ+jxA/cP+wof5Asf6wn19f755w7qHwTyE/QO+wT5BPsJAP4q0fABCAAJF8cAHPUG4TfTA/sEAv4E+f0G/gf9DAUINvYI+fjo5+Xy+wgFLBcF9/X18/f0+OP46gbxA/T/+/0i/x3wEfwMAgEE/vwC/wv9zBwe9+AZLOzoBAb/");qc(K, 1174, "5/YWHQ3z6vP8APzwCg/c6BwZ//1C3/XxBgADBP4FGOzRHRP+/P8A//4DAQj1BQXHHBwA8AT8DPr/Auw99xjq1h0GEQgEAr8PCAoFBgUDAv79BfcE+xcNF/3BA/v8+gD9F9zSCQUFCAQJ+wH9CgH6CvUY0R8W9A72Bgv5+QfhM/T6BwbvCfXsNO0D+vr4+xfXJQHrCvIIBwXx8Rcn5t8HAuDi6/gEDBEPDgvyCQ3gAvYf9vj4Bvz/CsAXBhQNBgjqECIHKs/kBRoE8SkiKSAhGBcOCCgiBOjX7fEN8yHKGBvUIRvx8RjtDtwO9xj0/CX7EN4FCiHxyvAMGQwBAgAD//z8CwLINhvsDfrS19/1+wcMDvL7CBQGAwT4+9YLCPIZ/gINC+on9wkF0/cH9wz5Iu+aBwLWEiP33gv7/gMWLszn96IIC/v7+wT53fk2BeADGPfqCEEl//Tp+vfkN98O/QISxCnvCPAR9QD1HeQlCcsh8vcH5/n1GuD4GOsW7RP2HfIAAAAAAAAAAPvMCikG4vwQIBbl6iD95P0D3QYRFxUIAgTT7w4X/OH1/Q4BE/UCPfgJ9Af2DP3oY9AXMtv76QAI8iPA+y7nDf/P7fEJIjIZC/r38Ozg3+DlCvgM8Tjy4CED9wFB9/f2/vrpCRED5A3gBP72BPBMDMwGDSH6BPL3/QHx8BwB8QsQCQTr29j6Fgzx6fLv8Pf29w3ZKQX3ENoZLtEEMfIR/gYSBfrf6iwy/gED+gcH/esm7iLy1zzzBhDoIxPz3BgD7/L2JCzU4/0DyvgMNxoE/vsC9RbpAhYB59lCzxX4/gryxBkGChvnEAX+9xrz7Dr+BzT3AgX88Rf/2hcIG/oA5fkn9vIaC9P0CfsiBN0KK+r1OPkUAQoB5gleC+Xy8wH1AA77+vb88fjXFfsB5PgW9yHp/Pz0JwT5A8RQCO8C+gz7AQkPGx8eGxc9LxoK+/j08wXuGfH88fUM/v7w/voYDAv8CQH3DtM5DBTdGgvAIPb2Kvz38CAYBwo09ccdAAgA+hHvyNgHFBIM+hAFB/8JAQodDBAN/hcHCf38+xLADTfnCfcYDucP9djiJQHtFvvhDf4AB/wQvQxC3Bj4EvHpEwDT+QQD8w0jBQ0hChsXAPn1K7Yk9AIF+AbfC/Dy+/n9Ed4b8Av3DyHhCPAH+vk/ye8L/xTSIuIGCRMc9wXo+On+H+3w+/HuABoSJfvx/hEF5RXfLAzl9xELGevh+Q0h+Of5B/YE+vcwrun4BgvpA/0x4xkfBA4QCfzuCuYDBdT3CdHJDwkcAQT9Lgb62uPh8foDAA76CMrOIfsB8iHQGvz7/fv9++TqTTf/AgoK9/K+zwvc+uwK9hAMBP/wLdTOH/4ZKhfg6gALFNjd2Nzg5uvzNOoG6OwR+/gk5/UV5gYi+AcU/QXn+BL79/wB9xQUJzDoCQW/Fh0EA9X1IPoJE+X20fIYCvnc+f/8+/sQNRnm4/z0LcbeIfsC/xvQH/EW+wQHB+f9C+oQ9Aj9B/UtDrftONIY7Bz0/v/c/d8T+gcC8QXh0wgjDRQA9zDz1f3zAvtIvOUCAf75BSQh2PT8+xcTAECvhY86AECvhJE7AEBDhOA7AEDHgUs+AEBSqIkZAAA4PZCFOD26PY+Euj3nPTKE5z0iP76BIj9SOFyPUjgAAHr+BAZ/7JtOm05/7AQG2PsBC9rlZXu1GiL8L/8v/yL8tRple9rlAQvY+wAAAAAAAODg4ADkvfsh1vrgEsf2yiPwG9cqE+3YJNMY6yj48u4cAQ7GNe6o2SfaFe4l7RTVJgoR0DbMxvMh1P/1IPT13hYOANIu293eBecs4isG/MEx4SvXK+ke1SnVGvIs3wHzG/MS2yXSt9Mi3BjnItz17BPnDO4h3LvFItMGCC7q8ugS/w3ULNnQ5g/gH9si3w/SH+ge3CXXH+kpzhb8MuoC6xzvHt4o+cTkHdoq5CrU9RUr8AjUItnJ1RX13Rop9wDeHfh5r3EH8Ooh2yHhJOX53BHeRsdB2/XQFdgR/yzfBvoh9wDsIutF3znjIeEjyQz/Md8b6iPO39ERzjYzXv/71CP8Ftgt2b7nGN8B5hTo6ecM9RXTLOfT7RHVafBSBesBKfAL3x7znfw52yHxLOclwTbcGOEfy8jaGtf8BCXfDeIYMTSicvvi8RcBJtg46QzcHe8o0TPb19kLzyIAOu75/CLwEeUjHgXCQQQwvEzVC/Um7hPxKenC2RfWCv4p6/PzGfcN0SrpwugY1DzrOu79zCDqFtwitTkQWu0DCi3jF9og+8LNJs0o7jXWDegg3g7sHsi15iXmIA875hHjHfkczDX04gUe+9D7IwIC1SgVEBBL59PgCtUS9ioJAP80/wfiJBPQ/DDkGeMg6gDhFuAR9iTA18IkzA8QOuLq4Ab5Cdok6BXsBfv5DvYC5RDsAOAaEwj11x8c5eAiKiLvFvYN4xL05ugLFgX7+za81TnnGAQEGvj07zYe0wEK8RLXC0S9JfDo8CbqBuMeQuUFB/ANAvT5/ewkBOQJAyAwGicDAAfr8wWu+UnsIvf7Af8K+/b/CQH3CgDyC//+/wsUYK/q9PfGCRjiGt0b9A3uOMUP+Rfx/wbnDursL/UQAibp7eL3KPUFBPoIGuv1fwQBBvcC+f79B/sK7QeWW/0J/BX4GrAIAf727+/lIEcG4wvpNtod6idX4fTsA/7+AhQA/90bCfr0A/T6DQEO6sXx7+cN+QcDAAH5Bv092+np4ybhGwH4AuUX5iTeBRjo+gcDxU7CLPABBgARCC0AkgYO/iCzyD79A/ME8Gbx3P8JjwYXAAkJBfj/8gX0ecvl+PcW8wMC/QH+uV8m7Q/w+0cKAuDz+w///vKrHh0GAwIAAAAAAAAAAAK/yPcSEhfy/gAM4xr0AQL0wFr6BAEF+5L94RbjCQAI2PsV+/sNCu4oASPsHuQL+hMHDhLACfoQM0QIEAz4APcU6hkH/PMp3V3uygv/AfcEvkLhFOoZ6QsKCRMPC/vh9unk+vr9/AUD5Bb11hnn8CkiL/oCKu3qBdkgBt0WEeII5vX1A/QhIdsV/wb8AwD7BQz0ORvD/RTvAgAEAP7fxlHpJ/b7Agb5BQT9/vPpuGsP+wD5/foF/A8vDOEZ8AgW58LI7g4cDAL1Sr4p7PkQ7BD4APAE7VwMxfLZMefwF+UT/d8TVeMG+fYQ+fQB+gIE/kAK5yn+4Q8AbjJFIxwT9gLVz8jx8AoDDP/4ARr0/wf15SkZAfXuFvn/0fgX/e/5EoM7+wMSAQIDG91ByzLSJevkBw7b+/sMBfhO7RX68Aj5BQIHAgr6DMQsC9zgHwAC/gIB/Qf2EesKBv4T/jvaqiYI1+LT3wcPHB35GNgHBwX+CRjp7gbjHgIcMfXSCivz9//9+fnv+mHf6wMFAQzV+BwH1fkR7BP/AvMJNiIJ5PX3727FLOYAA/TRSd7VJt8Q+9L8+v7nE+Mc8wUOG9jVBCDz/t38cNYJ9CXkEQ7tI9kXA/L/x/te9wPZBR724Crz8p/BHvcB+QwFFBH33OIZL/fxDOpi+M4P5RXw9QIM9gr9ISSgAO8f9wkD7A31CPwK9gkBcLrlBesCx/3jChPrFfa+/VvdHvQA+TvkGgIO7gEBCxEUysUbBB0gBRMM/AEH9gX+CgAX+xyYLgsQAx0B+PIBB85YwhoI7/IyACD0/eUS+PsIA+z1JfQJIS6b//wBBv8c1vEQBf/+yVUm9/wL/vf6A+z2s1kY/ZjH5uHs+vcOFOku8eEcAfH+Bv4fLbQX5ycM8uzjw7204Lm9RE0uIgXz0NK4r6zExtjkUl1ELR0D7dHk1d3i+PPZpaWFoAoK+u7JxKXI3OXw0LUoHPbkIwklEwHs4dfu5928sC0b/y8NAOPdx86xt9rtBSMO9ukQ+AXo2MLp5erw7tK4sysVIQGwurrAyMzZ3+Ha7e3xICH+B/Hx6Onf18joxwVZQCkbBffRxJ+fhOz31LcfHfxAMAfdxwD95tH9+ti0sdAMUTcKCejVt8e7EAXkyxIdFAD89QbzFwfv3dvb4rzBBhj38gMV8+XHz7Do1/vw+wEtGQz5A/H68PH4BvPWr7CpDgH2/dW70ujk4yQG1cj0DDZPKwk2FgII9NXSzNq7p/tLJiEF88vCqaePncne2z43IRAV/u/S49ra0NnW3LW4qNDiFQLxx8CerLQZAdKw9BL5AyIGJh8XBP8UDvHVsqXoDv02EADl5NTIraSn/SI4KSQWFPj53dbCzwMM9s6poL5cRiYJurnC1tnV9fnOscbO4SAf+vznB+/ausbl1a3kOyQUHwLlubCTnrXf4OH+IQ/6KyH7AOr25d7P9ezXpZyH2TkpCu3O2sXEuu7s+OH48QHy5uchFSARAe3t5sav3eotHgv1A+bQqb2txgP/5uwsChknBffd5doHCgT31quagTQsHArRw9jZ7//239a20BX8RjQK3MIG9/byyBcB5hfQ7wwI+Rcd3OT64+/7KBcKCtLzJAYE4uM+IOD/FvIB/OrTAjYE4sfF9Bv94Qj3BQryIEITCQLn2xfxEtrhBffrDwAWPh4P9PLSTRUhAyId7TICCwna9Ns+AfE2IAYC6BQj6wITGPM3BAkn7R7/60k2IQgSAw8G7dEG/dDOARoUCOnOQfLJ7+Hb5DX/78sBOQv45+LbQAXM0w8XHw8O5xgh/tTI7gbr1QT0EdsU9iIPAg83FfXh+i4ZEPfn+MIcERTg4xoeGe0C8O8azQIyKhO+Fx3+AxPt2yAPBh7eDQv7KB8K1gT3Gve6Ef7pFOrJM+jhFuoP8wP25PA4BMEL7vHu2t0Q+SL/68/RCdsHCEU3FAbf0/b3BvcMRw/91vnoIN3+1u/7AP7fyg303i8XEzcH+EofDhDp5hMM7s/k4ewC8uzRTigN6fUV+hIBLwUmIyAuFggNEPISMxMoJwvm/+8vAsvxH+omFfHwBd81D9pWC/3oMQ389e4cFPTl5iPn3f3swx4KyfTqzMryE+D0LQ/40PcL4Ajw3vMzEib+4O8W/u7kujsb5O327Pf3+OsV+CP+Lf33DAAeB9krG9qlHhoTyfw/Du8NCQ0CBwQGPUj/7x3/6u8I5Ns/LCkDAg4J+kv4+fTx9A0J/B7qvw8A0wT8AQUWCxdVbmtub3duIG5iX21vZGVfcXVlcnkgcmVxdWVzdDogAHdhcm5pbmc6ICVzICVkCgAAAIC/AACAvwAAgL8AAIC/AACAvwAAgL8AAIC/AACAvwAAgL8AAIC/AACAvwAAgEAAACBAAAAAQJqZmT8AAAA/AAAAAAAAAL8zMzO/zcxMv2ZmZr8AAIC/AAAgQQAA0EBmZqZAAACQQJqZeUAAAGBAAABAQAAAIEAzMxNAZmbmPwAAgD8AADBBzcwMQQAA8EAAANBAAACgQJqZeUCamXlAmpl5QAAAYEAAAEBAAACAPwAAMEEAADBBZmYeQQAACEEAAOBAAADAQAAAkEAAAIBAAACAQAAAgEAAAABAAAAwQQAAMEEAADBBAAAwQQAAGEEAAAhBAAAAQQAA4EAAAMBAAACgQAAAQEAAADBBAAAwQQAAMEEAADBBAAAwQQAAMEEAABhBAAAIQQAA4EAAAMBAAACgQAAAMEEAADBBAAAwQQAAMEEAADBBAAAwQQAAMEEAADBBzcwcQQAAGEEAAPBAAADgQAAAkEDNzGxAAABAQAAAIEAAAABAZmbmPwAAwD8AAIA/");qc(K, 5490, "gL8AAIC/AACAvwAAgL8AAIC/AACAvwAAgL8AAIC/AACAvwAAgL8AAIC/AACAvwAAgL8AAIC/AACAvwAAgL8AAIC/AACAvwAAgL8AAIC/AACAvwAAgL8AADBBAAAwQQAAGEEAAAhBAADwQAAAwEAAAKBAmpl5QAAAQEAAAABAAACAPwAAMEEAADBBAAAwQQAAMEEAADBBAAAYQTMzC0GamflAAADgQAAA0EAAAIBAAAAwQQAAMEEAADBBAAAwQQAAMEEAADBBAAAwQQAAMEHNzBxBAADwQAAAsEBQYWNrZXQgaXMgbGFyZ2VyIHRoYW4gYWxsb2NhdGVkIGJ1ZmZlcgBDb3VsZCBub3QgcmVzaXplIGlucHV0IGJ1ZmZlcjogdHJ1bmNhdGluZyBpbnB1dABEbyBub3Qgb3duIGlucHV0IGJ1ZmZlcjogdHJ1bmNhdGluZyBvdmVyc2l6ZSBpbnB1dABCdWZmZXIgdG9vIHNtYWxsIHRvIHBhY2sgYml0cwBDb3VsZCBub3QgcmVzaXplIGlucHV0IGJ1ZmZlcjogbm90IHBhY2tpbmcARG8gbm90IG93biBpbnB1dCBidWZmZXI6IG5vdCBwYWNraW5nAG5vdGlmaWNhdGlvbjogJXMKAHdhcm5pbmc6ICVzCg==");qc(K, 6e3, "FicOLAsj/hf8Bi7kDeXpDAQU+wkl7ukXAAn67AT/7/v8EQABCf4BAgL0COcnDwkQyfUJCwUK/sQIDfoL8BvR9AsBEPkJ/eMJ8hntIiQMKPb96PLb693+3AP6QxwG7/308PHv+cXc8wEHAQIKAgsNCgj+BwMFBAIC/fgE+wYH1g8j/tImHOz3AQf9AP4=");qc(K, 6150, "8eQ0IAX77+z2/wwgGS4kIQkO/QYB+AD2+/n5+fv7H+UY4PwK9RX9Exf3Fhj2//bz+fUq3x8T+AD28AHr7wr4DggEC/4F/t8L8CEL/An8CwIG+wj7C/z6GtzwAAT++AwG/yLS6gkJFQkFvvsaAgoNAhMJDK8DDQ0A8hbdBvn8BvoK+uEm3wD29QX0DO8FAPoN9woIGSEC9Aj6Cv4VBxErBQv59+zc7On8/P0b9/fP2dr19wYFFxkFAwMEAQL9/1cnEev37ffx8/Lv9fb1+Pr//f3/yt7l+PX8+wAABAgGCQcJBwYFBQUwChP2DP8J/QIF/QL+/gD+5gYJ+fD3AgcH+9ULFvX3IiXx8/oB/wEBwDg09eUFBAMBAgED//z89vn8/AL/+fn09vH3+/v18PMGEATz8Pb8AtHzGS8T8uz47wD98wEG7/IPAQoG6AD2E7v4DjER+yHjA/wAAvgF+gJ4yPTRF/cG+wEC+wH2BP//BP8A/R7MvR4WC//8AwAHAgAB9vz48wUBAf8FDff99sIWMPz6AgMFAQEEAQ0D7Ar3Df78Cews/xTgvRMAHAsIAvUP7csfAiIKBvzGCAoNDgEMAgAAgCX4LPca/RICBgv/CQEFAwABAQIMA/79BxkJEvrbA/jwA/b5Ed7UCxHx/fD/8wvSv/4IDQIEBAUPBQkG");qc(K, 6680, "9xP0DOQmHf8MAgUX9gME8RX8AwMGEff8+OwaBfYGAe0S8fQv+v759//v/v7yHvIC+fz/9AvnEP30C/kH7wET5B/59gf2AwwF8AYYKePKAAEH/wX6DQr8+Aj35cva/woTERAMDAAD+fwNDOHyBvsDBRErMhkKAfr++NsF1QVJPScM/cPgAioe/RHlCSIU//sCF/nSGjXRFP7fp83AGwsP3vvIGff/4wEoQ+nwECETBw5VFvb29Pn/NFkdC+zb0vER6OQYAgEAF5sXDv/p7gkF8yYB5OQEGzPmItgjLzYmyub6KucN4twSKfzfF+D5/DP9Ecw40ST+6yQKCN8fEwn72Ar36xMSsu77AObc0c3UEigb/h0x5gIgyh63NgP7JBY1Cv+sy+P7A9Q1zQQWR93/Ifvl+SQR6dkQ98nx7CfdBtnyEjDA7/EJJ1ElvCUv6/qYDQYJ/iMI6RIqLRUh+88J+tXIJwLw51cB/fcR5/X3/woC8vIE//Yc6SjgGvcaBOXpAyrEATH9GwrM2P4SLekR1AP9EdI02NEZSx/PNR7i4Nwm+vHwNuXQAybj4Ory/OnzINkJCNPzIvAxKCAfHBcXIC87vAg+LBny6L/wJEPn2usE3/4qBcEoCxrW6cNP4RfsCuA159wK5vsDALkF9tsB6BXK7wHj5/HlIEQt8Nvu+wEAs0f6A+xHvR3dCuITBBARBQDyEwIcGjsDAhgnN87T7u8h3Q7/AQhX3eMA5Q35F/Ml2DLdDhP58jE2+xb+4/jlJg0bMAzX6/EcB/Do7ewL7AkCDRfsCxvlR7sIAvoWDBAQCfD47wEZASjb30JeNQTq59fWGSPw8Tkf4+AVEMQtD/8HOebR4wsIDxOX+DYbCu8G9P/2BAAX9h8NCwoMwBf9+O0QNBjYEAooBQkA8/nr+Pr56zsQyxLEC9EO7hnz6ATZEOQ2Gr0eG+zMFPQ3DBLwJ/L65jioyQwZGtsGSwDerzbiAfkx6fIVCsLGx9HeD/wish8Z9Qcy9irBDtz8OTc5NSrW/w8oJQ8Z9QYBH/76//nAIhwe/wMVAKj0yBnkKAjk8gkMAvrvFjH65g4c7AT0MiMoDdrG4xEeFjwaytn0OuTBCuv49BrCBvb16vr5BAESAroLDgQNE+jeGEMRM+sNFzbiMAHzUBrw/g38BuId6EnGHuUU/uspLR7l/fvu7M/93Qoq7b3L9QkN8d/N4g8HGeIEHOreNuMn0hQQIvwvSwHUyegH/wnWMvjcKUQA/Pbp8c5AJPflDBna0dsgzzPcAvxF5hMHLUMuDcEuD9EE1w36BeslGsn5If/kCu/A8gDc7139974s6wP0Jvrz9BMNK9X29Ab7Cc8g+wIEBQ/wCusIwvhACE//vs/uBSj74tMB+hXgXe7i6yAV7hYIBdfKUBb2+fjpwEI48uLX0vLj2xvyKv734yIOIfIWBAoaGhwgF7jgAwDyI9ay4AYd7tP7B9/T/ereCPgEzef3O7IV++fQQvHv6M/zGenA+ijo7fU53/gBCszKHCcxIvXD19UKD/EzHg/NIN7+3g4SEAEB/f0BAe4GEDAM+9YHJDAH7PYHDAI2J9olNgT1+NL2BfbeLvQd2yck9Rg4EQ4UGQDn5Df5+xsDCeb4Buj24uHeEgQWFSj/49v461zjC/0LSRcWBwTU9/UV8wsJsv8vcvTb7fv16hMM4gcmLev49zfTOOsHES7HqfobHx8HyPQuFfv0JAMD6ysTDPkJ8gD336UHGgP1QFPh0hkCCQUCAv8U7wr75fgUCO0Q6/PhBQUqGAki7BzDFgvZQOz/4vfsGOfo4xbEBvsp96kOIg/HNEUP/Zo6EAMGPLXgGgfH5eDo6+PwPtIfHuXxBw8BBfExvtD8MtQHJRDuGebm8RMT5dEcOQXv4NdEFf5AOAjw8+b38AsG2RntFuEU0zfVCvAv2CjszQPv8vHoNezSLhu8IAPu+wnhEPf2/+kwXy8Z1+D9D+fJJCnlFAUNDuoFAukSLvER7t77+BvJSRAC/+8osiEAAhMENfDx8OT98zEI+eMb8yAUIMMQDiksKBgUBwQwxLMR+tBB8SDiufb9+gr++ePIQ+IH+1b69gAF4Twi2v0YCv4eFxjXDEbVD+8GDRDzCB7x+AUX3p788w3Q4UYMHxkY6Br5IfAIBfXy+L8NCv73AP28BSMHAOH/7/f3ENvu/0XQ5Bbr9QUxNxeq3BACDT/NHvUNGO76Du0BKQn7G9zU3tvr5h/ZDysF+B0U+OzM5P8NGt729xv4CBu+BAzqMQqzIO4D2gz9/wICAODg4ADhxvAW1+jVDsjqyR3zIdcv/Nn3HdcP9Cb48fQfAQLUKOq+1hvaHOkm6w7bHwAVzjTLueUh2//tGe375BYGQdRK39DfCdg58jrvBNMg4SbfJOkc2CfVHfQu3g3pHPAP5SLyrvEr4RngHesF+ybRwc0h0gwDL+Tv4wv2Dtgm/f7/APwFI9j3DdQF5f/5BvUH+AcT8g/8CfYK+Ar3/wEAAAIF7hbLMgHpMtwPA/MO9gYBBf0E/gXgGQX+//wBC+Ma+vEe7gAP7yjXAwn+/gP9//sCFfrw6xcCPA8Q8PcOCf8H9wABAQD/+hHkNtP/Af/6+gILGuP+LusiDOkg6RD2A0IT7BgHC/0A/f/O0gLu/QT//gP97SncCQvoFfAJ/ef9ChL3/vv/+wb8/QLmFe0j8QfzEe0n1TDhEPcH/vsD/AntG8k/3Qoa1P4JBAH6CPcF+P/98C3WBQ/wCg==");qc(K, 8758, "8BjJL9ob7Qf9ARAbFO0SBfkB+wL6COoA/f0I/wf4Af0FABHQOswd+f4D9gbmOuEB+gNd4ycDEQUG////Gw0KE/neDAr8CbQJCOT+9QL/AwGtJtkE8Pr++wX+HhMmIiggLis6KwXu59jfycwUIhzswZ+kPTUvMTVL8suzsQD9+xMWGvfLyUJaSFVESjT818bh7uEbIB4SGAMIBfT9GhxKP/7ZvbOWtjs7SUEsKEdIUlNiWFk8+uHR0PPZ9wcCT//ZxO9XUUEyLRPrvaWp184HEidKCuHkJxgNFwU4LR0K+/P13e749vjnubPrAhAyP1dXBeDYzbwADAY2IgX0IDREQEU7QS0O8OHYv70pMS8l9cy1rPw5MCoqIfXNvPoNAAj4GiDpywAkOExhaW9h/+TZ2NXK1NjuIxDs7eTWHS8mSi0D49DCsJjfODs7ChEuSFRldXt7avnfz826veXhRkPwwqvsUkdWUFVK7ca10+Pf7uctOfTW+wwcJDRAUVIN9+XkFgMCFhoG+tTNAg8KMCsxIu3CrKea6AgRPUQnGBcTEPsMDxsP+NTPxO7g5DQ2PvjQs7pCZVM/PSX0zrXAIRENGQ9NAdbjSEAuMR89LPjRytLiExT/8AAQ9O735uX26jUt9tG1rpeTCBkxTTJBcnV8dnNgWj3308HEtccICxQdAN3P1SgvIyg3Jui0mZDlAxciNEsI49UMPyYjHRgIGQsB8e7V+SUoFezI7e38/gsdMz/+1MK1px45M0ozMi5EQEE0PzdBKxL35t3JuwMGCBHxw6qfAVZdSk5D/9q+0DAnHRkR/w0NHScyM0VSYWL+3NLl8OLz/Pn8Gfv1+ufrIQwfHfjazMG8p9//Ckr+8TtbaWllV1Q++d/O3crRGRFSUfPIrRU6HyoZSEHovqXICf4VCkVLAugLFhkcJiIwIQfj5hEP/w4A/gD6170G/vcTAlVK6r2suc4DC/cCPt7M8S0CFxU0GN/3/wnU1/PvLBbv+vz/FiYaEAIyG93e99cGAPDeMwjy4c8P3y0xIfXbwsotC/u4C//09Rgb9dUuKyH09/8B/OnHuQsIEBH47OHXNTDwA0Ho+Ong2+DP9u8GJgX379IINAMGLSgn+freth8IAfArRPXt4QQGAPrv8Nrw4gIJ2fD/K/YwAwPw4f0+RCsNA/YIFMgMDP7uFvHY3AEHKQABLvrC/PT+9a3z/lsh9gAE9fBPICUOCTPr5MjeABUJ5gsc1srp/vEfHgjZvtncH+TY0iMoFhghMBfeDiggERv9GRrzw+8LBB88+ubXwA0Q5jYf9en39d65697dNzId6uXO2jkhKjkwGgsAz+Ea/PIFTiURAM/06RoOAgLV7/QK+PwIEgz6FPT68+ciDygxBwgNFBTt6v74AjPN+jXr6AQaEfzbGRHc8x8D+hsP9h8cGvb22BD5Dw0p9wD8Mvr5DiYWANACAfPtIP3EC+//6N7/I/vlHCwNGQ8q9Q8zI9wUCPz04xPRMfH8EOPZDuIEGff7zfL92OAmBff4/P/qR/0OGu7qGNfn6AYXE/Yn5uVBLQL55vgW9BAPEN37Iev4ABchIgYVJAb56gjb8h8mC/z92eD4IOn69BAU5PwXDcz/Fgbf2PoEwg0F5iMnCwI59Qns5N80+/r+FvLw0CMBxhQNIf+2OO7q4QwG8gT+99EK/R3v+z0OL/QCSNnvXEDLzfHi2tfj5BsJJAnd1lHrFBnw++/dFQ/kMAL+Ce0d2B7u7hLwxw/s9PHb8SHZFerzIwsN2sEdF+UgEgPmKiHAvu8QOAIkAx8V19kIxw4l/hPc7enj8AH9+PYfQL/m+B0VBBPZIfncODYwKB386Na+1cQT/iUp9tvEwBLqTUkoGQQT7b7+CwUVDhrnqvwSARrbCiX/GPTF9RT6IvDwKhPkzTUgBAo+FfTeGwTQ0M7PH/nr1uf81eo7AhsM9/rw+ODG8OP7KRfi39Lz9to0NAHv9woa5/oh7DU3GeD71hcVQgXkFAlLHfnW2Q8D6RUGCwHjDj8KNhrozc8H6c0PvgE8GQoA4vzxERM7KAT7IQbqxrr7F/o8LOPw0eM07TIcECMfJADrBhUbFioHvtj4BxMuAPw8JC354/rg2QIG9yEUzd4S+hMGCwXt4/4q9dPryTklAvK98OXaRTATAu8U7PDe7+fDCkktENjA7+PqOBHZCPUI5+7z7Qg2OSTv5vwG6ygq/BQfNQreyx/vIwAP+uzBtxYZHREI49m7Eg/x+wsvEPfS4BrAIvsm+S8UAred/dMURswP+vmuHxUvMyf9CQDX+fHKAgAb4QnT6tro6AjfFwUy3O/uzf4NEysM8fQ9JiYHDQAG/wM+CRsW3ybd9x7V9+D/BPwB+/X4Jh8L9tbr2wErD/Pd7e4PF+Y7Aes1CNfO8uQEFRnk2AXY1wQz3/j4ARHEDBnXESIrEy0H2xjxOP4j9jAE0f4F+8oF/d/2Hv7U6NoJ9yoEBsgs8AnY5hLsChzX6/wN7iDi/SUPFhwy2APjwAcz7fUR5djAGPT55QMlMP8C99reLgEb+hPzGgoiFBkoMvr5HgnoAOlHwxY63vwCz98ZHvj68E0CJvjd+uI4Th8h7A3ZFBYEFfgE+gqt1wnn1Q/59N7Z298THhDfKucZvCzx9fwXMg4E2dUU4jwJ7AcQE98lHRDdBybloAAAACgAAAAKAAAAEQAAAJAAAAAzc81MBwAAAAAAAADcKgAAFCsAAEwrAACEKwAAvCsAAPQrAAAsLAAAZCw=");qc(K, 10860, "BQAAAAEAAAAIAAAAAgAAAAMAAAADAAAABAAAAAQAAAAFAAAABQAAAAYAAAAHAAAAbmFycm93YmFuZAAAECoAAAEAAACcKgAAAAAAAAQAAAACAAAAAwAAAAQAAAAFAAAABgAAAAcAAAAIAAAACQAAAAAAAAAB");qc(K, 10988, "CgAAAAsAAAAMAAAADQAAAAAAAAAOAAAADwAAAAAAAAD//wAAKw==");qc(K, 11044, "CgAAAAsAAAAQAAAAEQAAAJwsAAASAAAAEwAAAKgsAADNTAAAdwAAAP////8AAAAAAQAAAAAAAAAKAAAACwAAABAAAAARAAAAvCwAABIAAAATAAAAyCwAAGZGAACgAAAA/////wAAAAABAAAAAAAAAAoAAAALAAAAEAAAABEAAADcLAAAEgAAABMAAADoLAAAmjkAANwAAAD/////AAAAAAMAAAAAAAAAFAAAABUAAAAQAAAAEQAAAPwsAAASAAAAEwAAAAgtAABmJgAALAEAAP////8AAAAAAwAAAAAAAAAUAAAAFQAAABAAAAARAAAA/CwAABIAAAATAAAAHC0AAJoZAABsAQAA/////wAAAAADAAAAAQAAABQAAAAVAAAAEAAAABEAAAD8LAAAEgAAABMAAAAILQAAzQwAAOwBAAAAAAAAAQ==");qc(K, 11380, "CgAAAAsAAAAMAAAADQAAAAAAAAASAAAAEwAAADAtAAAAQAAATwAAANAgAAAFAAAAAAAAAAoAAAAEAAAAcBcAAAQAAAAAAAAA0CAAAAUAAAAHAAAACgAAAAQAAAAABAAABQAAAAAAAADQIAAABQAAAAcAAAAIAAAABQAAAEAFAAAHAAAAAAAAALAJAAAHAAAABwAAAAUAAAAIAAAAkB8AAAYAAAAAAAAABQAAAAgAAACQGgAACAAAAAAAAAAUAAAAAgAAABAYAAAFAAAAAAAAAHgtAAAWAAAAFC4AAAEAAAAEAAAAFwAAABgAAAAZAAAAGgAAABsAAAAcAAAAHQAAAB4AAACoKgAAoAAAACgAAAAIAAAAM3PNTAcAM3MAAAAAUC4AAIguAADALgAA+C4=");qc(K, 11696, "AwAAAAEAAAAIAAAAAgAAAAMAAAAEAAAABQAAAAUAAAAGAAAABgAAAAcAAAAHAAAAAQAAAAEAAAABAAAAAQAAAAEAAAABAAAAAgAAAAIAAAADAAAAAwAAAAQAAABwFQAABQAAAHdpZGViYW5kIChzdWItYmFuZCBDRUxQKQBVbmtub3duIHdiX21vZGVfcXVlcnkgcmVxdWVzdDog");qc(K, 11864, "AQAAAAAAAAAfAAAAIA==");qc(K, 11904, "//8AACQ=");qc(K, 11920, "AQAAAAAAAAAfAAAAIA==");qc(K, 11948, "EgAAABMAAAAwLwAA//8AAHA=");qc(K, 11976, "AQAAAAAAAAAfAAAAIA==");qc(K, 12004, "EgAAABMAAABELwAA//8AAMA=");qc(K, 12032, "AQAAAAEAAAAfAAAAIA==");qc(K, 12060, "EgAAABMAAABELwAA//8AAGABAAAKAAAABAAAAFAhAAAFAAAAAAAAAAgAAAAFAAAAsAsAAAcAAAABAAAAd2FybmluZzogJXMgJWQK");qc(K, 12144, "1EkAAD5iAAC8ggAA+K0AAIHnAAARNAEA8pkBAIUhAgDu1QIAAcYDAHkFBQCZrgYAUOQIAB7VCwDivg8A8fMUAN3hGwBxGiUAsV8xAMuzQQBOblcAaFh0AHnSmgATBs4AhigSAWbTbAFmeuUBGgiGAqSuWwNV/XcEJlLyBV/F6QcxBysPoxd+H8woDDWASAAA6gN4Ct4TaBuUIwUuFDzsVDE4Gi1IQ2Fzc2VydGlvbiBmYWlsZWQ6IHN0LT53aW5kb3dTaXplLXN0LT5mcmFtZVNpemUgPT0gc3QtPnN1YmZyYW1lU2l6ZQBzcmMvbmJfY2VscC5jAGFzc2VydGlvbiBmYWlsZWQ6IFNVQk1PREUobHRwX3F1YW50KQBhc3NlcnRpb24gZmFpbGVkOiBTVUJNT0RFKGlubm92YXRpb25fcXVhbnQp");qc(K, 12480, "/3/7ehNtTVl+QxcvVB4IEuUJAwU=");qc(K, 12516, "JAAAAHAAAADAAAAAYAE=");qc(K, 12544, "SW52YWxpZCBtb2RlIGVuY291bnRlcmVkLiBUaGUgc3RyZWFtIGlzIGNvcnJ1cHRlZC4ATW9yZSB0aGFuIHR3byB3aWRlYmFuZCBsYXllcnMgZm91bmQuIFRoZSBzdHJlYW0gaXMgY29ycnVwdGVkLgBhc3NlcnRpb24gZmFpbGVkOiBTVUJNT0RFKGx0cF91bnF1YW50KQBhc3NlcnRpb24gZmFpbGVkOiBTVUJNT0RFKGlubm92YXRpb25fdW5xdWFudCkAVW5rbm93biBuYl9jdGwgcmVxdWVzdDogAEZhdGFsIChpbnRlcm5hbCkgZXJyb3IgaW4gJXMsIGxpbmUgJWQ6ICVzCgBub3RpZmljYXRpb246ICVzCgB3YXJuaW5nOiAlcyAlZAoAAAAAAAIA+f/5/xIADwDZ/+f/SwAjAH7/1//UACYAuf7v/+MB4P9P/XwAvAPl/uX6HwL0BjP8XfbFBjEO9fL35mMjyXXJdWMj9+b18jEOxQZd9jP89AYfAuX65f68A3wAT/3g/+MB7/+5/iYA1ADX/37/IwBLAOf/2f8PABIA+f/5/wIAJwAsADIAOQBAAEkAUwBeAGoAeACIAJoArwDGAOEA/wAgAUcBcgGkAdwBGwJjArQCEAN5A+8DdQQNBbkFfAZZB30ApADXABoBcgHkAXsCQANCBJQFTweUCY0MchCMFTwcSW52YWxpZCBtb2RlIGVuY291bnRlcmVkLiBUaGUgc3RyZWFtIGlzIGNvcnJ1cHRlZC4AVW5rbm93biBuYl9jdGwgcmVxdWVzdDogAG5vdGlmaWNhdGlvbjogJXMKAHdhcm5pbmc6ICVzICVkCgBzcGVleC0xLjJiZXRhMwBUaGlzIG1vZGUgaXMgbWVhbnQgdG8gYmUgdXNlZCBhbG9uZQBUaGlzIGRvZXNuJ3QgbG9vayBsaWtlIGEgU3BlZXggZmlsZQBTcGVleCBoZWFkZXIgdG9vIHNtYWxsAHdhcm5pbmc6ICVzCgBub3RpZmljYXRpb246ICVzCgAAAAAAAABA0T9HP2I+KD2cO8Y5rjdbNdcyKjA=");qc(K, 13360, "HgUhBSkFNQVIBV8FewWcBcMF7gUfBlUGjwbPBhMHXAeqB/wHVAiwCBAJdQneCUwKvgo0C64LLAyuDDQNvg1LDtwOcA8IEKMQQRHiEYYSLRPXE4MUMRXiFZUWSxcCGLsYdhkyGvAarxtwHDEd9B23HnsfQCAEIcohjyJUIxkk3iSjJWcmKifsJ64obiktKusqqCtjLBwt0y2ILjsv7C+bMEcx8TGYMjwz3TN7NBY1rjVCNtM2YDfqN3A48jhwOeo5YDrSOkA7qTsOPG48yjwhPXQ9wj0LPk8+jz7JPv8+Lz9bP4E/oz+/P9Y/6D/1P/0/AEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABA6T+mPzc/nD7WPeQ8yDuDOhU5fzfDNeIz3jG3L28tCCuFKOYlLyNhIH8djRqMF4MUdhFvDn8LyAigBlNQRUVYX0RFQ09ERV9FUlJPUjogb25seSBzdXBwb3J0IHNwZWV4IG5hcnJvd2JhbmQgYW5kIHdpZGViYW5kLiBUcnlpbmcgdG8gZGVjb2RlIGFzIG5hcnJvd2JhbmQARVJST1I6IFBhY2tldCB3YXMgaW5jb21wbGV0ZS4ARVJST1I6IHN0cmVhbSBjb3JydXB0ZWQ/ICBlbmNvZGVkX2ZyYW1lX3NpemUgKHBhY2tldCBzaXplKS4AU1BFRVhfREVDT0RFX0VSUk9SOiBpbnB1dCBub3QgYSBzcGVleC4AU1BFRVhfREVDT0RFX0VSUk9SOiBpbnB1dCB0b28gc2hvcnQgdG8gZGV0ZXJtaW5lIGNvbXByZXNzaW9uLg==");qc(K, 14054, "8D8AAAAAAAD4PwAAAAAAAAAABtDPQ+v9TD4=");qc(K, 14091, "QAO44j8gOQAALSsgICAwWDB4AChudWxsKQ==");qc(K, 14128, "EQAKABEREQAAAAAFAAAAAAAACQAAAAALAAAAAAAAAAARAA8KERERAwoHAAEACQsLAAAJBgsAAAsABhEAAAARERE=");qc(K, 14209, "CwAAAAAAAAAAEQAKChEREQAKAAACAAkLAAAACQALAAAL");qc(K, 14267, "DA==");qc(K, 14279, "DAAAAAAMAAAAAAkMAAAAAAAMAAAM");qc(K, 14325, "Dg==");qc(K, 14337, "DQAAAAQNAAAAAAkOAAAAAAAOAAAO");qc(K, 14383, "EA==");qc(K, 14395, "DwAAAAAPAAAAAAkQAAAAAAAQAAAQAAASAAAAEhIS");qc(K, 14450, "EgAAABISEgAAAAAAAAk=");qc(K, 14499, "Cw==");qc(K, 14511, "CgAAAAAKAAAAAAkLAAAAAAALAAAL");qc(K, 14557, "DA==");qc(K, 14569, "DAAAAAAMAAAAAAkMAAAAAAAMAAAMAAAwMTIzNDU2Nzg5QUJDREVGoDo=");qc(K, 14616, "yAAAAAAAAAAF");qc(K, 14636, "Ig==");qc(K, 14660, "IwAAACQAAAA4Ow==");qc(K, 14684, "Ag==");qc(K, 14699, "//////8=");qc(K, 14944, "ZDs=");qc(K, 15e3, "gEFQAAAAAAAF");qc(K, 15020, "JQ==");qc(K, 15044, "IwAAACYAAAB4PQAAAAQ=");qc(K, 15068, "AQ==");qc(K, 15083, "Cv////8=");return oc({ "Int8Array": Int8Array, "Int16Array": Int16Array, "Int32Array": Int32Array, "Uint8Array": Uint8Array, "Uint16Array": Uint16Array, "Uint32Array": Uint32Array, "Float32Array": Float32Array, "Float64Array": Float64Array, "NaN": NaN, "Infinity": Infinity, "Math": Math }, rc, sc.buffer); - } - - // EMSCRIPTEN_END_ASM - - - (asmLibraryArg, wasmMemory); - }, instantiate: function instantiate(binary, info) { - return { then: function then(ok) { - var module = new WebAssembly.Module(binary);ok({ "instance": new WebAssembly.Instance(module) }); - } }; - }, RuntimeError: Error };wasmBinary = [];if (typeof WebAssembly !== "object") { - abort("no native wasm support detected"); - }var wasmMemory;var wasmTable;var ABORT = false;var EXITSTATUS = 0;function assert(condition, text) { - if (!condition) { - abort("Assertion failed: " + text); - } - }function getCFunc(ident) { - var func = Module["_" + ident];assert(func, "Cannot call unknown function " + ident + ", make sure it is exported");return func; - }function ccall(ident, returnType, argTypes, args, opts) { - var toC = { "string": function string(str) { - var ret = 0;if (str !== null && str !== undefined && str !== 0) { - var len = (str.length << 2) + 1;ret = stackAlloc(len);stringToUTF8(str, ret, len); - }return ret; - }, "array": function array(arr) { - var ret = stackAlloc(arr.length);writeArrayToMemory(arr, ret);return ret; - } };function convertReturnValue(ret) { - if (returnType === "string") return UTF8ToString(ret);if (returnType === "boolean") return Boolean(ret);return ret; - }var func = getCFunc(ident);var cArgs = [];var stack = 0;if (args) { - for (var i = 0; i < args.length; i++) { - var converter = toC[argTypes[i]];if (converter) { - if (stack === 0) stack = stackSave();cArgs[i] = converter(args[i]); - } else { - cArgs[i] = args[i]; - } - } - }var ret = func.apply(null, cArgs);ret = convertReturnValue(ret);if (stack !== 0) stackRestore(stack);return ret; - }function cwrap(ident, returnType, argTypes, opts) { - argTypes = argTypes || [];var numericArgs = argTypes.every(function (type) { - return type === "number"; - });var numericRet = returnType !== "string";if (numericRet && numericArgs && !opts) { - return getCFunc(ident); - }return function () { - return ccall(ident, returnType, argTypes, arguments, opts); - }; - }var UTF8Decoder = typeof TextDecoder !== "undefined" ? new TextDecoder("utf8") : undefined;function UTF8ArrayToString(heap, idx, maxBytesToRead) { - var endIdx = idx + maxBytesToRead;var endPtr = idx;while (heap[endPtr] && !(endPtr >= endIdx)) { - ++endPtr; - }if (endPtr - idx > 16 && heap.subarray && UTF8Decoder) { - return UTF8Decoder.decode(heap.subarray(idx, endPtr)); - } else { - var str = "";while (idx < endPtr) { - var u0 = heap[idx++];if (!(u0 & 128)) { - str += String.fromCharCode(u0);continue; - }var u1 = heap[idx++] & 63;if ((u0 & 224) == 192) { - str += String.fromCharCode((u0 & 31) << 6 | u1);continue; - }var u2 = heap[idx++] & 63;if ((u0 & 240) == 224) { - u0 = (u0 & 15) << 12 | u1 << 6 | u2; - } else { - u0 = (u0 & 7) << 18 | u1 << 12 | u2 << 6 | heap[idx++] & 63; - }if (u0 < 65536) { - str += String.fromCharCode(u0); - } else { - var ch = u0 - 65536;str += String.fromCharCode(55296 | ch >> 10, 56320 | ch & 1023); - } - } - }return str; - }function UTF8ToString(ptr, maxBytesToRead) { - return ptr ? UTF8ArrayToString(HEAPU8, ptr, maxBytesToRead) : ""; - }function stringToUTF8Array(str, heap, outIdx, maxBytesToWrite) { - if (!(maxBytesToWrite > 0)) return 0;var startIdx = outIdx;var endIdx = outIdx + maxBytesToWrite - 1;for (var i = 0; i < str.length; ++i) { - var u = str.charCodeAt(i);if (u >= 55296 && u <= 57343) { - var u1 = str.charCodeAt(++i);u = 65536 + ((u & 1023) << 10) | u1 & 1023; - }if (u <= 127) { - if (outIdx >= endIdx) break;heap[outIdx++] = u; - } else if (u <= 2047) { - if (outIdx + 1 >= endIdx) break;heap[outIdx++] = 192 | u >> 6;heap[outIdx++] = 128 | u & 63; - } else if (u <= 65535) { - if (outIdx + 2 >= endIdx) break;heap[outIdx++] = 224 | u >> 12;heap[outIdx++] = 128 | u >> 6 & 63;heap[outIdx++] = 128 | u & 63; - } else { - if (outIdx + 3 >= endIdx) break;heap[outIdx++] = 240 | u >> 18;heap[outIdx++] = 128 | u >> 12 & 63;heap[outIdx++] = 128 | u >> 6 & 63;heap[outIdx++] = 128 | u & 63; - } - }heap[outIdx] = 0;return outIdx - startIdx; - }function stringToUTF8(str, outPtr, maxBytesToWrite) { - return stringToUTF8Array(str, HEAPU8, outPtr, maxBytesToWrite); - }function writeArrayToMemory(array, buffer) { - HEAP8.set(array, buffer); - }var WASM_PAGE_SIZE = 65536;var buffer, HEAP8, HEAPU8, HEAP16, HEAPU16, HEAP32, HEAPU32, HEAPF32, HEAPF64;function updateGlobalBufferAndViews(buf) { - buffer = buf;Module["HEAP8"] = HEAP8 = new Int8Array(buf);Module["HEAP16"] = HEAP16 = new Int16Array(buf);Module["HEAP32"] = HEAP32 = new Int32Array(buf);Module["HEAPU8"] = HEAPU8 = new Uint8Array(buf);Module["HEAPU16"] = HEAPU16 = new Uint16Array(buf);Module["HEAPU32"] = HEAPU32 = new Uint32Array(buf);Module["HEAPF32"] = HEAPF32 = new Float32Array(buf);Module["HEAPF64"] = HEAPF64 = new Float64Array(buf); - }var INITIAL_INITIAL_MEMORY = Module["INITIAL_MEMORY"] || 16777216;if (Module["wasmMemory"]) { - wasmMemory = Module["wasmMemory"]; - } else { - wasmMemory = new WebAssembly.Memory({ "initial": INITIAL_INITIAL_MEMORY / WASM_PAGE_SIZE, "maximum": INITIAL_INITIAL_MEMORY / WASM_PAGE_SIZE }); - }if (wasmMemory) { - buffer = wasmMemory.buffer; - }INITIAL_INITIAL_MEMORY = buffer.byteLength;updateGlobalBufferAndViews(buffer);var __ATPRERUN__ = [];var __ATINIT__ = [];var __ATMAIN__ = [];var __ATPOSTRUN__ = [];var runtimeInitialized = false;var runtimeExited = false;function preRun() { - if (Module["preRun"]) { - if (typeof Module["preRun"] == "function") Module["preRun"] = [Module["preRun"]];while (Module["preRun"].length) { - addOnPreRun(Module["preRun"].shift()); - } - }callRuntimeCallbacks(__ATPRERUN__); - }function initRuntime() { - runtimeInitialized = true;callRuntimeCallbacks(__ATINIT__); - }function preMain() { - callRuntimeCallbacks(__ATMAIN__); - }function exitRuntime() { - runtimeExited = true; - }function postRun() { - if (Module["postRun"]) { - if (typeof Module["postRun"] == "function") Module["postRun"] = [Module["postRun"]];while (Module["postRun"].length) { - addOnPostRun(Module["postRun"].shift()); - } - }callRuntimeCallbacks(__ATPOSTRUN__); - }function addOnPreRun(cb) { - __ATPRERUN__.unshift(cb); - }function addOnPostRun(cb) { - __ATPOSTRUN__.unshift(cb); - }var runDependencies = 0;var runDependencyWatcher = null;var dependenciesFulfilled = null;function addRunDependency(id) { - runDependencies++;if (Module["monitorRunDependencies"]) { - Module["monitorRunDependencies"](runDependencies); - } - }function removeRunDependency(id) { - runDependencies--;if (Module["monitorRunDependencies"]) { - Module["monitorRunDependencies"](runDependencies); - }if (runDependencies == 0) { - if (runDependencyWatcher !== null) { - clearInterval(runDependencyWatcher);runDependencyWatcher = null; - }if (dependenciesFulfilled) { - var callback = dependenciesFulfilled;dependenciesFulfilled = null;callback(); - } - } - }Module["preloadedImages"] = {};Module["preloadedAudios"] = {};function abort(what) { - if (Module["onAbort"]) { - Module["onAbort"](what); - }what += "";err(what);ABORT = true;EXITSTATUS = 1;what = "abort(" + what + "). Build with -s ASSERTIONS=1 for more info.";var e = new WebAssembly.RuntimeError(what);readyPromiseReject(e);throw e; - }function hasPrefix(str, prefix) { - return String.prototype.startsWith ? str.startsWith(prefix) : str.indexOf(prefix) === 0; - }var dataURIPrefix = "data:application/octet-stream;base64,";function isDataURI(filename) { - return hasPrefix(filename, dataURIPrefix); - }var fileURIPrefix = "file://";function isFileURI(filename) { - return hasPrefix(filename, fileURIPrefix); - }var wasmBinaryFile = "soundhound-speex.wasm";if (!isDataURI(wasmBinaryFile)) { - wasmBinaryFile = locateFile(wasmBinaryFile); - }function getBinary() { - try { - if (wasmBinary) { - return new Uint8Array(wasmBinary); - }var binary = tryParseAsDataURI(wasmBinaryFile);if (binary) { - return binary; - }if (readBinary) { - return readBinary(wasmBinaryFile); - } else { - throw "both async and sync fetching of the wasm failed"; - } - } catch (err) { - abort(err); - } - }function getBinaryPromise() { - if (!wasmBinary && (ENVIRONMENT_IS_WEB || ENVIRONMENT_IS_WORKER) && typeof fetch === "function" && !isFileURI(wasmBinaryFile)) { - return fetch(wasmBinaryFile, { credentials: "same-origin" }).then(function (response) { - if (!response["ok"]) { - throw "failed to load wasm binary file at '" + wasmBinaryFile + "'"; - }return response["arrayBuffer"](); - }).catch(function () { - return getBinary(); - }); - }return Promise.resolve().then(getBinary); - }function createWasm() { - var info = { "a": asmLibraryArg };function receiveInstance(instance, module) { - var exports = instance.exports;Module["asm"] = exports;wasmTable = Module["asm"]["i"];removeRunDependency("wasm-instantiate"); - }addRunDependency("wasm-instantiate");function receiveInstantiatedSource(output) { - receiveInstance(output["instance"]); - }function instantiateArrayBuffer(receiver) { - return getBinaryPromise().then(function (binary) { - return WebAssembly.instantiate(binary, info); - }).then(receiver, function (reason) { - err("failed to asynchronously prepare wasm: " + reason);abort(reason); - }); - }function instantiateAsync() { - if (!wasmBinary && typeof WebAssembly.instantiateStreaming === "function" && !isDataURI(wasmBinaryFile) && !isFileURI(wasmBinaryFile) && typeof fetch === "function") { - fetch(wasmBinaryFile, { credentials: "same-origin" }).then(function (response) { - var result = WebAssembly.instantiateStreaming(response, info);return result.then(receiveInstantiatedSource, function (reason) { - err("wasm streaming compile failed: " + reason);err("falling back to ArrayBuffer instantiation");return instantiateArrayBuffer(receiveInstantiatedSource); - }); - }); - } else { - return instantiateArrayBuffer(receiveInstantiatedSource); - } - }if (Module["instantiateWasm"]) { - try { - var exports = Module["instantiateWasm"](info, receiveInstance);return exports; - } catch (e) { - err("Module.instantiateWasm callback failed with error: " + e);return false; - } - }instantiateAsync();return {}; - }function callRuntimeCallbacks(callbacks) { - while (callbacks.length > 0) { - var callback = callbacks.shift();if (typeof callback == "function") { - callback(Module);continue; - }var func = callback.func;if (typeof func === "number") { - if (callback.arg === undefined) { - wasmTable.get(func)(); - } else { - wasmTable.get(func)(callback.arg); - } - } else { - func(callback.arg === undefined ? null : callback.arg); - } - } - }function _abort() { - abort(); - }function _emscripten_memcpy_big(dest, src, num) { - HEAPU8.copyWithin(dest, src, src + num); - }function abortOnCannotGrowMemory(requestedSize) { - abort("OOM"); - }function _emscripten_resize_heap(requestedSize) { - requestedSize = requestedSize >>> 0;abortOnCannotGrowMemory(requestedSize); - }function _exit(status) { - exit(status); - }var SYSCALLS = { mappings: {}, buffers: [null, [], []], printChar: function printChar(stream, curr) { - var buffer = SYSCALLS.buffers[stream];if (curr === 0 || curr === 10) { - (stream === 1 ? out : err)(UTF8ArrayToString(buffer, 0));buffer.length = 0; - } else { - buffer.push(curr); - } - }, varargs: undefined, get: function get() { - SYSCALLS.varargs += 4;var ret = HEAP32[SYSCALLS.varargs - 4 >> 2];return ret; - }, getStr: function getStr(ptr) { - var ret = UTF8ToString(ptr);return ret; - }, get64: function get64(low, high) { - return low; - } };function _fd_close(fd) { - return 0; - }function _fd_seek(fd, offset_low, offset_high, whence, newOffset) {}function _fd_write(fd, iov, iovcnt, pnum) { - var num = 0;for (var i = 0; i < iovcnt; i++) { - var ptr = HEAP32[iov + i * 8 >> 2];var len = HEAP32[iov + (i * 8 + 4) >> 2];for (var j = 0; j < len; j++) { - SYSCALLS.printChar(fd, HEAPU8[ptr + j]); - }num += len; - }HEAP32[pnum >> 2] = num;return 0; - }var ASSERTIONS = false;function intArrayToString(array) { - var ret = [];for (var i = 0; i < array.length; i++) { - var chr = array[i];if (chr > 255) { - if (ASSERTIONS) { - assert(false, "Character code " + chr + " (" + String.fromCharCode(chr) + ") at offset " + i + " not in 0x00-0xFF."); - }chr &= 255; - }ret.push(String.fromCharCode(chr)); - }return ret.join(""); - }var decodeBase64 = typeof atob === "function" ? atob : function (input) { - var keyStr = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";var output = "";var chr1, chr2, chr3;var enc1, enc2, enc3, enc4;var i = 0;input = input.replace(/[^A-Za-z0-9\+\/\=]/g, "");do { - enc1 = keyStr.indexOf(input.charAt(i++));enc2 = keyStr.indexOf(input.charAt(i++));enc3 = keyStr.indexOf(input.charAt(i++));enc4 = keyStr.indexOf(input.charAt(i++));chr1 = enc1 << 2 | enc2 >> 4;chr2 = (enc2 & 15) << 4 | enc3 >> 2;chr3 = (enc3 & 3) << 6 | enc4;output = output + String.fromCharCode(chr1);if (enc3 !== 64) { - output = output + String.fromCharCode(chr2); - }if (enc4 !== 64) { - output = output + String.fromCharCode(chr3); - } - } while (i < input.length);return output; - };function intArrayFromBase64(s) { - if (typeof ENVIRONMENT_IS_NODE === "boolean" && ENVIRONMENT_IS_NODE) { - var buf;try { - buf = Buffer.from(s, "base64"); - } catch (_) { - buf = new Buffer(s, "base64"); - }return new Uint8Array(buf["buffer"], buf["byteOffset"], buf["byteLength"]); - }try { - var decoded = decodeBase64(s);var bytes = new Uint8Array(decoded.length);for (var i = 0; i < decoded.length; ++i) { - bytes[i] = decoded.charCodeAt(i); - }return bytes; - } catch (_) { - throw new Error("Converting base64 string to bytes failed."); - } - }function tryParseAsDataURI(filename) { - if (!isDataURI(filename)) { - return; - }return intArrayFromBase64(filename.slice(dataURIPrefix.length)); - }__ATINIT__.push({ func: function func() { - ___wasm_call_ctors(); - } });var asmLibraryArg = { "f": _abort, "d": _emscripten_memcpy_big, "e": _emscripten_resize_heap, "h": _exit, "g": _fd_close, "c": _fd_seek, "b": _fd_write, "a": wasmMemory };var asm = createWasm();var ___wasm_call_ctors = Module["___wasm_call_ctors"] = function () { - return (___wasm_call_ctors = Module["___wasm_call_ctors"] = Module["asm"]["j"]).apply(null, arguments); - };var _SH_speex_init = Module["_SH_speex_init"] = function () { - return (_SH_speex_init = Module["_SH_speex_init"] = Module["asm"]["k"]).apply(null, arguments); - };var _SH_speex_encode_frame = Module["_SH_speex_encode_frame"] = function () { - return (_SH_speex_encode_frame = Module["_SH_speex_encode_frame"] = Module["asm"]["l"]).apply(null, arguments); - };var _SH_speex_speex_to_raw = Module["_SH_speex_speex_to_raw"] = function () { - return (_SH_speex_speex_to_raw = Module["_SH_speex_speex_to_raw"] = Module["asm"]["m"]).apply(null, arguments); - };var stackSave = Module["stackSave"] = function () { - return (stackSave = Module["stackSave"] = Module["asm"]["n"]).apply(null, arguments); - };var stackRestore = Module["stackRestore"] = function () { - return (stackRestore = Module["stackRestore"] = Module["asm"]["o"]).apply(null, arguments); - };var stackAlloc = Module["stackAlloc"] = function () { - return (stackAlloc = Module["stackAlloc"] = Module["asm"]["p"]).apply(null, arguments); - };var _malloc = Module["_malloc"] = function () { - return (_malloc = Module["_malloc"] = Module["asm"]["q"]).apply(null, arguments); - };Module["cwrap"] = cwrap;var calledRun;function ExitStatus(status) { - this.name = "ExitStatus";this.message = "Program terminated with exit(" + status + ")";this.status = status; - }dependenciesFulfilled = function runCaller() { - if (!calledRun) run();if (!calledRun) dependenciesFulfilled = runCaller; - };function run(args) { - args = args || arguments_;if (runDependencies > 0) { - return; - }preRun();if (runDependencies > 0) return;function doRun() { - if (calledRun) return;calledRun = true;Module["calledRun"] = true;if (ABORT) return;initRuntime();preMain();readyPromiseResolve(Module);if (Module["onRuntimeInitialized"]) Module["onRuntimeInitialized"]();postRun(); - }if (Module["setStatus"]) { - Module["setStatus"]("Running...");setTimeout(function () { - setTimeout(function () { - Module["setStatus"](""); - }, 1);doRun(); - }, 1); - } else { - doRun(); - } - }Module["run"] = run;function exit(status, implicit) { - if (implicit && noExitRuntime && status === 0) { - return; - }if (noExitRuntime) {} else { - EXITSTATUS = status;exitRuntime();if (Module["onExit"]) Module["onExit"](status);ABORT = true; - }quit_(status, new ExitStatus(status)); - }if (Module["preInit"]) { - if (typeof Module["preInit"] == "function") Module["preInit"] = [Module["preInit"]];while (Module["preInit"].length > 0) { - Module["preInit"].pop()(); - } - }noExitRuntime = true;run(); - - return Module.ready; - }; -}(); -if (true) module.exports = Module;else if (typeof define === 'function' && define['amd']) define([], function () { - return Module; -});else if (typeof exports === 'object') exports["Module"] = Module; - -/*** EXPORTS FROM exports-loader ***/ -module.exports = Module; -/* WEBPACK VAR INJECTION */}.call(exports, "/index.js", "/")) - -/***/ }), -/* 18 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; -/* WEBPACK VAR INJECTION */(function(__filename, __dirname) { - -var Module = function () { - var _scriptDir = typeof document !== 'undefined' && document.currentScript ? document.currentScript.src : undefined; - if (true) _scriptDir = _scriptDir || __filename; - return function (Module) { - Module = Module || {}; - - var Module = typeof Module !== "undefined" ? Module : {};var readyPromiseResolve, readyPromiseReject;Module["ready"] = new Promise(function (resolve, reject) { - readyPromiseResolve = resolve;readyPromiseReject = reject; - });var moduleOverrides = {};var key;for (key in Module) { - if (Module.hasOwnProperty(key)) { - moduleOverrides[key] = Module[key]; - } - }var arguments_ = [];var thisProgram = "./this.program";var quit_ = function quit_(status, toThrow) { - throw toThrow; - };var ENVIRONMENT_IS_WEB = false;var ENVIRONMENT_IS_WORKER = false;var ENVIRONMENT_IS_NODE = false;var ENVIRONMENT_IS_SHELL = false;ENVIRONMENT_IS_WEB = typeof window === "object";ENVIRONMENT_IS_WORKER = typeof importScripts === "function";ENVIRONMENT_IS_NODE = typeof process === "object" && typeof process.versions === "object" && typeof process.versions.node === "string";ENVIRONMENT_IS_SHELL = !ENVIRONMENT_IS_WEB && !ENVIRONMENT_IS_NODE && !ENVIRONMENT_IS_WORKER;var scriptDirectory = "";function locateFile(path) { - if (Module["locateFile"]) { - return Module["locateFile"](path, scriptDirectory); - }return scriptDirectory + path; - }var read_, readAsync, readBinary, setWindowTitle;var nodeFS;var nodePath;if (ENVIRONMENT_IS_NODE) { - if (ENVIRONMENT_IS_WORKER) { - scriptDirectory = __webpack_require__(3).dirname(scriptDirectory) + "/"; - } else { - scriptDirectory = __dirname + "/"; - }read_ = function shell_read(filename, binary) { - var ret = tryParseAsDataURI(filename);if (ret) { - return binary ? ret : ret.toString(); - }if (!nodeFS) nodeFS = __webpack_require__(7);if (!nodePath) nodePath = __webpack_require__(3);filename = nodePath["normalize"](filename);return nodeFS["readFileSync"](filename, binary ? null : "utf8"); - };readBinary = function readBinary(filename) { - var ret = read_(filename, true);if (!ret.buffer) { - ret = new Uint8Array(ret); - }assert(ret.buffer);return ret; - };if (process["argv"].length > 1) { - thisProgram = process["argv"][1].replace(/\\/g, "/"); - }arguments_ = process["argv"].slice(2);process["on"]("uncaughtException", function (ex) { - if (!(ex instanceof ExitStatus)) { - throw ex; - } - });process["on"]("unhandledRejection", abort);quit_ = function quit_(status) { - process["exit"](status); - };Module["inspect"] = function () { - return "[Emscripten Module object]"; - }; - } else if (ENVIRONMENT_IS_SHELL) { - if (typeof read != "undefined") { - read_ = function shell_read(f) { - var data = tryParseAsDataURI(f);if (data) { - return intArrayToString(data); - }return read(f); - }; - }readBinary = function readBinary(f) { - var data;data = tryParseAsDataURI(f);if (data) { - return data; - }if (typeof readbuffer === "function") { - return new Uint8Array(readbuffer(f)); - }data = read(f, "binary");assert(typeof data === "object");return data; - };if (typeof scriptArgs != "undefined") { - arguments_ = scriptArgs; - } else if (typeof arguments != "undefined") { - arguments_ = arguments; - }if (typeof quit === "function") { - quit_ = function quit_(status) { - quit(status); - }; - }if (typeof print !== "undefined") { - if (typeof console === "undefined") console = {};console.log = print;console.warn = console.error = typeof printErr !== "undefined" ? printErr : print; - } - } else if (ENVIRONMENT_IS_WEB || ENVIRONMENT_IS_WORKER) { - if (ENVIRONMENT_IS_WORKER) { - scriptDirectory = self.location.href; - } else if (document.currentScript) { - scriptDirectory = document.currentScript.src; - }if (_scriptDir) { - scriptDirectory = _scriptDir; - }if (scriptDirectory.indexOf("blob:") !== 0) { - scriptDirectory = scriptDirectory.substr(0, scriptDirectory.lastIndexOf("/") + 1); - } else { - scriptDirectory = ""; - }{ - read_ = function shell_read(url) { - try { - var xhr = new XMLHttpRequest();xhr.open("GET", url, false);xhr.send(null);return xhr.responseText; - } catch (err) { - var data = tryParseAsDataURI(url);if (data) { - return intArrayToString(data); - }throw err; - } - };if (ENVIRONMENT_IS_WORKER) { - readBinary = function readBinary(url) { - try { - var xhr = new XMLHttpRequest();xhr.open("GET", url, false);xhr.responseType = "arraybuffer";xhr.send(null);return new Uint8Array(xhr.response); - } catch (err) { - var data = tryParseAsDataURI(url);if (data) { - return data; - }throw err; - } - }; - }readAsync = function readAsync(url, onload, onerror) { - var xhr = new XMLHttpRequest();xhr.open("GET", url, true);xhr.responseType = "arraybuffer";xhr.onload = function xhr_onload() { - if (xhr.status == 200 || xhr.status == 0 && xhr.response) { - onload(xhr.response);return; - }var data = tryParseAsDataURI(url);if (data) { - onload(data.buffer);return; - }onerror(); - };xhr.onerror = onerror;xhr.send(null); - }; - }setWindowTitle = function setWindowTitle(title) { - document.title = title; - }; - } else {}var out = Module["print"] || console.log.bind(console);var err = Module["printErr"] || console.warn.bind(console);for (key in moduleOverrides) { - if (moduleOverrides.hasOwnProperty(key)) { - Module[key] = moduleOverrides[key]; - } - }moduleOverrides = null;if (Module["arguments"]) arguments_ = Module["arguments"];if (Module["thisProgram"]) thisProgram = Module["thisProgram"];if (Module["quit"]) quit_ = Module["quit"];var wasmBinary;if (Module["wasmBinary"]) wasmBinary = Module["wasmBinary"];var noExitRuntime;if (Module["noExitRuntime"]) noExitRuntime = Module["noExitRuntime"];var WebAssembly = { Memory: function Memory(opts) { - this.buffer = new ArrayBuffer(opts["initial"] * 65536); - }, Module: function Module(binary) {}, Instance: function Instance(module, info) { - this.exports = - // EMSCRIPTEN_START_ASM - function instantiate(rc, sc) { - function jc(tc) { - tc.set = function (M, uc) { - this[M] = uc; - };tc.get = function (M) { - return this[M]; - };return tc; - }var a = new ArrayBuffer(16);var b = new Int32Array(a);var c = new Float32Array(a);var d = new Float64Array(a);function kc(vc) { - return b[vc]; - }function lc(vc, wc) { - b[vc] = wc; - }function mc() { - return d[0]; - }function nc(wc) { - d[0] = wc; - }function oc(xc, yc) { - var e = yc.a;var f = e.buffer;var g = new xc.Int8Array(f);var h = new xc.Int16Array(f);var i = new xc.Int32Array(f);var j = new xc.Uint8Array(f);var k = new xc.Uint16Array(f);var l = new xc.Uint32Array(f);var m = new xc.Float32Array(f);var n = new xc.Float64Array(f);var o = xc.Math.imul;var p = xc.Math.fround;var q = xc.Math.abs;var r = xc.Math.clz32;var s = xc.Math.min;var t = xc.Math.max;var u = xc.Math.floor;var v = xc.Math.ceil;var w = xc.Math.sqrt;var x = yc.abort;var y = xc.NaN;var z = xc.Infinity;var A = yc.b;var B = yc.c;var C = yc.d;var D = yc.e;var E = yc.f;var F = yc.g;var G = yc.h;var H = 5259648;var I = 0; - // EMSCRIPTEN_START_FUNCS - function Bb(a, b, c) { - a = a | 0;b = b | 0;c = c | 0;var d = 0, - e = 0, - f = 0, - g = 0, - j = 0, - l = 0, - n = p(0), - r = p(0), - v = 0, - w = 0, - y = p(0), - z = 0, - A = 0, - B = 0, - C = p(0), - D = 0, - E = 0, - F = 0, - G = 0, - I = 0, - K = 0, - L = 0, - M = 0, - N = 0, - O = 0, - P = 0, - Q = 0, - R = 0, - S = 0, - T = 0, - V = 0, - Y = p(0), - $ = 0, - ba = 0, - ea = 0, - ia = 0, - ja = 0, - ka = 0, - ma = 0, - na = 0, - oa = 0, - ra = 0, - ua = 0, - wa = 0, - xa = 0, - ya = p(0);z = H - 48 | 0;H = z;D = i[a + 64 >> 2];F = i[a + 24 >> 2];l = i[a + 72 >> 2];qa(l, l + (i[a + 8 >> 2] << 1) | 0, (i[a + 32 >> 2] << 1) + 4 | 0);l = i[a + 80 >> 2];qa(l, l + (i[a + 8 >> 2] << 1) | 0, (i[a + 32 >> 2] << 1) + 4 | 0);K = D & 1;w = K + D | 0;d = F << 1;l = w + d | 0;N = l & 1;L = l + N | 0;l = d + L | 0;R = l & 1;G = l + R | 0;l = d + G | 0;S = l & 1;O = l + S | 0;l = d + O | 0;ka = l & 1;ma = l + ka | 0;l = d + ma | 0;na = l & 1;T = l + na | 0;l = d + T | 0;ea = l & 1;ra = l + ea | 0;l = d + ra | 0;ua = l & 1;V = l + ua | 0;l = d + V | 0;wa = l & 1;M = l + wa | 0;l = d + M | 0;if (i[a + 220 >> 2]) { - sa(b, b, i[a + 8 >> 2], (i[a + 216 >> 2] != 0) << 1, a + 124 | 0); - }I = l & 1;A = I + l | 0;B = i[a + 20 >> 2];l = A + (B << 1) | 0;xa = l & 1;P = l + xa | 0;ia = i[a + 24 >> 2];j = ia << 1;v = i[a + 8 >> 2];if ((B | 0) > (v | 0)) { - l = B - v | 0;f = (l | 0) > 1 ? l : 1;d = i[a + 88 >> 2];l = i[a + 68 >> 2];while (1) { - e = g << 1;h[e + A >> 1] = o(h[d + e >> 1], h[e + l >> 1]) >>> 14;g = g + 1 | 0;if ((g | 0) != (f | 0)) { - continue; - }break; - } - }if ((f | 0) < (B | 0)) { - e = v - B | 0;d = i[a + 88 >> 2];while (1) { - l = f << 1;h[l + A >> 1] = o(h[d + l >> 1], h[(e + f << 1) + b >> 1]) >>> 14;f = f + 1 | 0;if ((B | 0) != (f | 0)) { - continue; - }break; - } - }Q = (j + P | 0) + 2 | 0;f = 1;Da(A, P, ia + 1 | 0, B);l = h[P >> 1];l = (o(l, h[a + 60 >> 1]) >>> 15 | 0) + l | 0;h[P >> 1] = l;j = i[a + 24 >> 2];a: { - if ((j | 0) < 0) { - break a; - }e = i[a + 92 >> 2];h[P >> 1] = o(h[e >> 1], l << 16 >> 16) >>> 14;if (!j) { - break a; - }while (1) { - d = f << 1;l = d + P | 0;h[l >> 1] = o(h[d + e >> 1], h[l >> 1]) >>> 14;l = (f | 0) != (j | 0);f = f + 1 | 0;if (l) { - continue; - }break; - } - }Ea(w, P, j);l = ta(w, i[a + 24 >> 2], O, 6553, Q);g = i[a + 24 >> 2];if (!((l | 0) == (g | 0) | (g | 0) < 1)) { - d = i[a + 96 >> 2];f = 0;while (1) { - l = f << 1;h[l + O >> 1] = k[d + l >> 1];f = f + 1 | 0;if ((g | 0) != (f | 0)) { - continue; - }break; - } - }e = i[a + 8 >> 2];d = i[a + 20 >> 2];b: { - if (i[a + 4 >> 2]) { - if ((g | 0) < 1) { - break b; - }f = 0;while (1) { - l = f << 1;h[l + T >> 1] = k[l + O >> 1];f = f + 1 | 0;if ((g | 0) != (f | 0)) { - continue; - }break; - }break b; - }l = i[a + 16 >> 2];fa(i[a + 96 >> 2], O, T, g, l, l << 1);g = i[a + 24 >> 2]; - }w = d - e | 0;ga(T, g, 16);ha(T, V, i[a + 24 >> 2], Q);c: { - d: { - l = i[i[a + 204 >> 2] + (i[a + 208 >> 2] << 2) >> 2];if (!l | (i[l + 8 >> 2] < 3 ? i[a + 188 >> 2] >= 3 : 0) | (i[l + 4 >> 2] | i[l >> 2] != -1)) { - break d; - }if (i[a + 152 >> 2] | i[a + 160 >> 2]) { - break d; - }g = w << 1;l = 0;break c; - }ca(h[a + 56 >> 1], V, L, i[a + 24 >> 2]);ca(h[a + 58 >> 1], V, G, i[a + 24 >> 2]);g = w << 1;X(i[a + 84 >> 2], i[a + 68 >> 2], g);X(i[a + 84 >> 2] + g | 0, b, i[a + 8 >> 2] - w << 1);l = i[a + 84 >> 2];aa(l, L, G, l, i[a + 8 >> 2], i[a + 24 >> 2], i[a + 112 >> 2]);Ia(i[a + 84 >> 2], i[a + 28 >> 2], i[a + 32 >> 2], i[a + 8 >> 2], z + 16 | 0, z + 4 | 0, 6, Q);l = i[z + 16 >> 2];ba = h[z + 4 >> 1];v = o(ba, 27853) >> 15;e: { - if ((v | 0) >= h[z + 6 >> 1]) { - break e; - }d = i[z + 20 >> 2];e = (d << 1) - l | 0;j = e >> 31;f: { - if ((j ^ e + j) < 3) { - break f; - }e = o(d, 3) - l | 0;j = e >> 31;if ((j ^ e + j) < 4) { - break f; - }e = (d << 2) - l | 0;j = e >> 31;if ((j ^ e + j) < 5) { - break f; - }e = o(d, 5) - l | 0;j = e >> 31;if ((j ^ e + j) > 5) { - break e; - } - }l = d; - }g: { - if ((v | 0) >= h[z + 8 >> 1]) { - break g; - }d = i[z + 24 >> 2];e = (d << 1) - l | 0;j = e >> 31;h: { - if ((j ^ e + j) < 3) { - break h; - }e = o(d, 3) - l | 0;j = e >> 31;if ((j ^ e + j) < 4) { - break h; - }e = (d << 2) - l | 0;j = e >> 31;if ((j ^ e + j) < 5) { - break h; - }e = o(d, 5) - l | 0;j = e >> 31;if ((j ^ e + j) > 5) { - break g; - } - }l = d; - }i: { - if ((v | 0) >= h[z + 10 >> 1]) { - break i; - }d = i[z + 28 >> 2];e = (d << 1) - l | 0;j = e >> 31;j: { - if ((j ^ e + j) < 3) { - break j; - }e = o(d, 3) - l | 0;j = e >> 31;if ((j ^ e + j) < 4) { - break j; - }e = (d << 2) - l | 0;j = e >> 31;if ((j ^ e + j) < 5) { - break j; - }e = o(d, 5) - l | 0;j = e >> 31;if ((j ^ e + j) > 5) { - break i; - } - }l = d; - }k: { - if ((v | 0) >= h[z + 12 >> 1]) { - break k; - }d = i[z + 32 >> 2];e = (d << 1) - l | 0;j = e >> 31;l: { - if ((j ^ e + j) < 3) { - break l; - }e = o(d, 3) - l | 0;j = e >> 31;if ((j ^ e + j) < 4) { - break l; - }e = (d << 2) - l | 0;j = e >> 31;if ((j ^ e + j) < 5) { - break l; - }e = o(d, 5) - l | 0;j = e >> 31;if ((j ^ e + j) > 5) { - break k; - } - }l = d; - }if ((v | 0) >= h[z + 14 >> 1]) { - break c; - }d = i[z + 36 >> 2];e = (d << 1) - l | 0;j = e >> 31;m: { - if ((j ^ e + j) < 3) { - break m; - }e = o(d, 3) - l | 0;j = e >> 31;if ((j ^ e + j) < 4) { - break m; - }e = (d << 2) - l | 0;j = e >> 31;if ((j ^ e + j) < 5) { - break m; - }e = o(d, 5) - l | 0;j = e >> 31;if ((j ^ e + j) > 5) { - break c; - } - }l = d; - }X(i[a + 76 >> 2], i[a + 68 >> 2], g);X(i[a + 76 >> 2] + (w << 1) | 0, b, i[a + 8 >> 2] - w << 1);d = i[a + 76 >> 2];va(d, V, d, i[a + 8 >> 2], i[a + 24 >> 2], i[a + 116 >> 2]);v = Z(i[a + 76 >> 2], i[a + 8 >> 2]);n: { - if (!(i[a + 208 >> 2] == 1 | (l | 0) < 1)) { - w = o(o(ba, ba) << 17 >> 16, -26214) + 268435456 | 0;e = w >>> 0 > 65535;d = e << 3;j = e ? w >>> 16 | 0 : w;e = j >>> 0 > 255;d = e ? d | 4 : d;f = d | 2;g = d;e = e ? j >>> 8 | 0 : j;d = e >>> 0 > 15;g = (d ? f : g) | (d ? e >>> 4 | 0 : e) >>> 0 > 3;d = g << 1;j = g << 16 >> 16;d = ((j | 0) > 6 ? w >> d + -12 : w << 12 - d) << 16 >> 16;e = (o((o(o(d, 16816) + -827523072 >> 16, d) << 2 & -65536) + 1387593728 >> 16, d) << 2 & -65536) + 238157824 >> 16;d = 13 - g | 0;e = o(v, o(((j | 0) < 13 ? e >> d : e << 0 - d) << 16 >> 16, 72088) >> 16);break n; - }e = v << 14; - }o: { - p: { - q: { - r: { - s: { - v = i[a + 140 >> 2];if (!(!v | (i[a + 160 >> 2] ? 0 : !i[a + 152 >> 2]))) { - g = i[a + 24 >> 2];if ((g | 0) >= 1) { - j = i[a + 96 >> 2];f = 0;while (1) { - d = f << 1;d = h[d + j >> 1] - h[d + O >> 1] | 0;C = p(C + p(o(d, d) | 0));f = f + 1 | 0;if ((g | 0) != (f | 0)) { - continue; - }break; - } - }if (i[a + 172 >> 2]) { - n = m[a + 176 >> 2];t: { - if (p(m[a + 180 >> 2] * n) > p(0) ^ 1) { - break t; - }r = p(+n * -1e-5 / +p(m[a + 184 >> 2] + p(1)));r = +r > .05 ? p(.05000000074505806) : r;if (+r < -.05 ^ 1) { - break t; - }r = p(-.05000000074505806); - }m[a + 144 >> 2] = t(p(s(p(r + m[a + 144 >> 2]), p(10))), p(0)); - }ya = p(C * p(1.4901161193847656e-8));y = Kb(v, b, i[a + 8 >> 2], p(+(ba | 0) * .015625));m[a + 148 >> 2] = y;if (i[a + 152 >> 2]) { - i[z + 16 >> 2] = 8;n = m[a + 144 >> 2];r = p(u(n));u: { - if (p(q(r)) < p(2147483648)) { - d = ~~r;break u; - }d = -2147483648; - }if ((d | 0) != 10) { - g = 0;Y = p(n - p(d | 0));w = d + 1 | 0;v = w << 2;C = p(p(w | 0) - n);j = d << 2;n = p(p(Y * m[v + 5440 >> 2]) + p(C * m[j + 5440 >> 2]));r = p(100);v: { - if (!(y > n)) { - break v; - }n = p(y - n);r = p(100);if (n < p(100) ^ 1) { - break v; - }g = 8;r = n; - }n = p(p(Y * m[v + 5396 >> 2]) + p(C * m[j + 5396 >> 2]));w: { - if (!(y > n)) { - break w; - }n = p(y - n);if (n < r ^ 1) { - break w; - }g = 7;r = n; - }v = w << 2;j = d << 2;n = p(p(Y * m[v + 5352 >> 2]) + p(C * m[j + 5352 >> 2]));x: { - if (y > n ^ 1) { - break x; - }n = p(y - n);if (n < r ^ 1) { - break x; - }g = 6;r = n; - }n = p(p(Y * m[v + 5308 >> 2]) + p(C * m[j + 5308 >> 2]));y: { - if (y > n ^ 1) { - break y; - }n = p(y - n);if (n < r ^ 1) { - break y; - }g = 5;r = n; - }v = w << 2;j = d << 2;n = p(p(Y * m[v + 5264 >> 2]) + p(C * m[j + 5264 >> 2]));z: { - if (y > n ^ 1) { - break z; - }n = p(y - n);if (n < r ^ 1) { - break z; - }g = 4;r = n; - }n = p(p(Y * m[v + 5220 >> 2]) + p(C * m[j + 5220 >> 2]));A: { - if (y > n ^ 1) { - break A; - }n = p(y - n);if (n < r ^ 1) { - break A; - }g = 3;r = n; - }j = w << 2;d = d << 2;n = p(p(Y * m[j + 5176 >> 2]) + p(C * m[d + 5176 >> 2]));B: { - if (y > n ^ 1) { - break B; - }n = p(y - n);if (n < r ^ 1) { - break B; - }g = 2;r = n; - }C = p(p(Y * m[j + 5132 >> 2]) + p(C * m[d + 5132 >> 2]));if (y > C ^ 1) { - break r; - }break s; - }g = 0;n = m[1370];r = p(100);C: { - if (y > n ^ 1) { - break C; - }n = p(y - n);r = p(100);if (n < p(100) ^ 1) { - break C; - }g = 8;r = n; - }n = m[1359];D: { - if (!(y > n)) { - break D; - }n = p(y - n);if (n < r ^ 1) { - break D; - }g = 7;r = n; - }n = m[1348];E: { - if (y > n ^ 1) { - break E; - }n = p(y - n);if (n < r ^ 1) { - break E; - }g = 6;r = n; - }n = m[1337];F: { - if (y > n ^ 1) { - break F; - }n = p(y - n);if (n < r ^ 1) { - break F; - }g = 5;r = n; - }n = m[1326];G: { - if (y > n ^ 1) { - break G; - }n = p(y - n);if (n < r ^ 1) { - break G; - }g = 4;r = n; - }n = m[1315];H: { - if (y > n ^ 1) { - break H; - }n = p(y - n);if (n < r ^ 1) { - break H; - }g = 3;r = n; - }n = m[1304];I: { - if (y > n ^ 1) { - break I; - }n = p(y - n);if (n < r ^ 1) { - break I; - }g = 2;r = n; - }C = m[1293];if (!(y > C ^ 1)) { - break s; - }break r; - }if (!(y < p(2) ^ 1)) { - J: { - K: { - if (+ya > .05) { - break K; - }d = i[a + 168 >> 2];if (!d | (d | 0) > 20) { - break K; - }if (i[a + 164 >> 2]) { - break J; - } - }i[a + 168 >> 2] = 1;i[a + 208 >> 2] = 1;break o; - }i[a + 168 >> 2] = d + 1;i[a + 208 >> 2] = 0;break o; - }i[a + 168 >> 2] = 0;i[a + 208 >> 2] = i[a + 212 >> 2];break o; - }i[a + 148 >> 2] = -1082130432;break o; - }if (!(p(y - C) < r)) { - break r; - }i[z + 16 >> 2] = 1;f = a + 168 | 0;break q; - }i[z + 16 >> 2] = g;f = a + 168 | 0;if (g) { - break q; - }L: { - M: { - if (+ya > .05) { - break M; - }d = i[a + 168 >> 2];if (!d | (d | 0) > 20) { - break M; - }if (i[a + 164 >> 2]) { - break L; - } - }i[z + 16 >> 2] = 1;i[a + 168 >> 2] = 1;break p; - }i[z + 16 >> 2] = 0;i[a + 168 >> 2] = d + 1;break p; - }i[f >> 2] = 0; - }J[i[i[a >> 2] + 44 >> 2]](a, 6, z + 16 | 0) | 0;N: { - if (i[a + 156 >> 2] < 1) { - break N; - }J[i[i[a >> 2] + 44 >> 2]](a, 19, z + 4 | 0) | 0;d = i[a + 156 >> 2];if (i[z + 4 >> 2] <= (d | 0)) { - break N; - }i[z + 4 >> 2] = d;J[i[i[a >> 2] + 44 >> 2]](a, 18, z + 4 | 0) | 0; - }if (!i[a + 172 >> 2]) { - break o; - }J[i[i[a >> 2] + 44 >> 2]](a, 19, z + 4 | 0) | 0;d = i[z + 4 >> 2];m[a + 184 >> 2] = m[a + 184 >> 2] + p(1);d = d - i[a + 172 >> 2] | 0;m[a + 176 >> 2] = m[a + 176 >> 2] + p(d | 0);m[a + 180 >> 2] = +(d | 0) * .05 + +m[a + 180 >> 2] * .95; - }if (i[a + 200 >> 2]) { - W(c, 0, 1);W(c, i[a + 208 >> 2], 4); - }O: { - P: { - Q: { - g = i[i[a + 204 >> 2] + (i[a + 208 >> 2] << 2) >> 2];R: { - if (!g) { - g = i[a + 8 >> 2];if ((g | 0) >= 1) { - d = i[a + 76 >> 2];l = i[a + 84 >> 2];f = 0;while (1) { - c = f << 1;h[c + l >> 1] = 0;h[c + d >> 1] = 0;f = f + 1 | 0;if ((g | 0) != (f | 0)) { - continue; - }break; - } - }if (i[a + 24 >> 2] >= 1) { - c = i[a + 108 >> 2];f = 0;while (1) { - i[c + (f << 2) >> 2] = 0;f = f + 1 | 0;if ((f | 0) < i[a + 24 >> 2]) { - continue; - }break; - }g = i[a + 8 >> 2]; - }i[a + 40 >> 2] = 1;i[a + 4 >> 2] = 1;c = (g << 2) + b | 0;b = i[a + 20 >> 2];X(i[a + 68 >> 2], c - (b << 1) | 0, b - g << 1);if (i[a + 24 >> 2] < 1) { - g = 0;break R; - }b = i[a + 104 >> 2];g = 0;f = 0;while (1) { - i[b + (f << 2) >> 2] = 0;f = f + 1 | 0;if ((f | 0) < i[a + 24 >> 2]) { - continue; - }break; - }break R; - }v = i[a + 24 >> 2];if (!(!i[a + 4 >> 2] | (v | 0) < 1)) { - j = i[a + 96 >> 2];f = 0;while (1) { - d = f << 1;h[d + j >> 1] = k[d + O >> 1];f = f + 1 | 0;if ((v | 0) != (f | 0)) { - continue; - }break; - } - }J[i[g + 16 >> 2]](O, ma, v, c);d = i[i[a + 204 >> 2] + (i[a + 208 >> 2] << 2) >> 2];if (i[d >> 2] != -1) { - W(c, l - i[a + 28 >> 2] | 0, 7);d = i[i[a + 204 >> 2] + (i[a + 208 >> 2] << 2) >> 2]; - }if (i[d + 4 >> 2]) { - d = o(o(ba, 58982) >> 16, 15) + 32 >> 6;d = (d | 0) < 15 ? d : 15;d = (d | 0) > 0 ? d : 0;W(c, d, 4);ba = o(d << 22 >> 16, 2185) + 16384 >> 15; - }w = Jb(e);W(c, w, 5);f = i[a + 24 >> 2];if (!(!i[a + 4 >> 2] | (f | 0) < 1)) { - e = i[a + 100 >> 2];g = 0;while (1) { - d = g << 1;h[d + e >> 1] = k[d + ma >> 1];g = g + 1 | 0;if ((g | 0) != (f | 0)) { - continue; - }break; - } - }S: { - g = i[a + 16 >> 2];if ((g | 0) < 1) { - break S; - }v = Q & 1;$ = v + Q | 0;ja = i[a + 12 >> 2];E = ja << 1;d = $ + E | 0;Q = 0 - d & 3;P = d + Q | 0;e = ja << 2;d = P + e | 0;j = 0 - d & 3;oa = d + j | 0;d = oa + e | 0;A = d & 1;F = Q + (j + ((o(F, 18) + o(ja, 12) | 0) + (B + ia << 1) | 0) | 0) | 0;B = d + A | 0;j = B + E | 0;e = j & 1;ua = (D + (K + (N + ((S + ((((ua + (wa + (I + ((v + (A + (F + e | 0) | 0) | 0) + xa | 0) | 0) | 0) | 0) + ea | 0) + na | 0) + ka | 0) | 0) + R | 0) | 0) | 0) | 0) + 2 | 0;d = i[(w << 2) + 12144 >> 2];v = o(d << 1 >> 16, 28406) + (o(d & 32767, 28406) >>> 15 | 0) | 0;ka = v & 16383;wa = a + 36 | 0;na = v << 2 >> 16;R = e + j | 0;d = R + E | 0;F = (d & 1) + d | 0;d = F + E | 0;E = (0 - d & 3) + d | 0;N = E + (f << 2) | 0;xa = (0 - N & 3) + N | 0;ia = v - -8192 >> 14;Q = ia << 16 >> 17;D = 0;while (1) { - A = i[a + 76 >> 2];j = i[a + 84 >> 2];fa(i[a + 96 >> 2], O, T, f, D, g);fa(i[a + 100 >> 2], ma, ra, i[a + 24 >> 2], D, i[a + 16 >> 2]);ga(T, i[a + 24 >> 2], 16);ga(ra, i[a + 24 >> 2], 16);ha(T, V, i[a + 24 >> 2], N);ha(ra, M, i[a + 24 >> 2], N);f = 0;g = 8192;e = i[a + 24 >> 2];if ((e | 0) >= 1) { - while (1) { - d = f << 1;g = (h[(d | 2) + M >> 1] + g | 0) - h[d + M >> 1] | 0;f = f + 2 | 0;if ((f | 0) < (e | 0)) { - continue; - }break; - } - }K = D << 2;i[K + i[a + 132 >> 2] >> 2] = g;ca(h[a + 56 >> 1], V, L, i[a + 24 >> 2]);e = i[a + 24 >> 2];d = h[a + 58 >> 1];T: { - if ((d | 0) <= -1) { - if ((e | 0) < 1) { - break T; - }U(G, 0, e << 1);break T; - }ca(d, V, G, e); - }g = i[a + 20 >> 2] - i[a + 8 >> 2] | 0;if ((g | 0) != i[a + 12 >> 2]) { - break Q; - }ea = o(D, ja);I = ea << 1;w = I + j | 0;U: { - if (D) { - if ((g | 0) < 1) { - break U; - }j = o(g, D + -1 | 0);f = 0;while (1) { - e = f << 1;d = k[(f + j << 1) + b >> 1];h[e + w >> 1] = d;h[e + F >> 1] = d;f = f + 1 | 0;if ((g | 0) != (f | 0)) { - continue; - }break; - }break U; - }if ((g | 0) < 1) { - break U; - }d = i[a + 68 >> 2];f = 0;while (1) { - j = f << 1;e = k[j + d >> 1];h[j + w >> 1] = e;h[j + F >> 1] = e;f = f + 1 | 0;if ((g | 0) != (f | 0)) { - continue; - }break; - } - }va(F, M, F, g, i[a + 24 >> 2], i[a + 120 >> 2]);d = ja >> !i[a + 188 >> 2];La(M, L, G, R, d, i[a + 24 >> 2], N);j = i[a + 12 >> 2];if ((d | 0) < (j | 0)) { - e = d << 1;d = d + 1 | 0;U(e + ua | 0, 0, (((j | 0) > (d | 0) ? j : d) << 1) - e | 0); - }g = i[a + 24 >> 2];if ((g | 0) >= 1) { - e = i[a + 104 >> 2];f = 0;while (1) { - d = f << 2;i[d + E >> 2] = i[d + e >> 2] << 1;f = f + 1 | 0;g = i[a + 24 >> 2];if ((f | 0) < (g | 0)) { - continue; - }break; - } - }d = i[a + 12 >> 2];if ((d | 0) >= 1) { - U(B, 0, d << 1); - }_(B, M, B, d, g, E);g = i[a + 24 >> 2];if ((g | 0) >= 1) { - e = i[a + 108 >> 2];f = 0;while (1) { - d = f << 2;i[d + E >> 2] = i[d + e >> 2] << 1;f = f + 1 | 0;g = i[a + 24 >> 2];if ((f | 0) < (g | 0)) { - continue; - }break; - } - }aa(B, L, G, B, i[a + 12 >> 2], g, E);g = i[a + 24 >> 2];if ((g | 0) >= 1) { - e = i[a + 108 >> 2];f = 0;while (1) { - d = f << 2;i[d + E >> 2] = i[d + e >> 2];f = f + 1 | 0;g = i[a + 24 >> 2];if ((f | 0) < (g | 0)) { - continue; - }break; - } - }aa(w, L, G, w, i[a + 12 >> 2], g, E);if (!(i[a + 188 >> 2] | i[a + 24 >> 2] < 1)) { - e = i[a + 108 >> 2];f = 0;while (1) { - d = f << 2;i[d + e >> 2] = i[d + E >> 2];f = f + 1 | 0;if ((f | 0) < i[a + 24 >> 2]) { - continue; - }break; - } - }f = 0;j = i[a + 12 >> 2];if ((j | 0) >= 1) { - while (1) { - e = f << 1;d = h[e + w >> 1] - (h[e + B >> 1] + 1 >> 1) | 0;d = (d | 0) > -32767 ? d : -32767;h[e + $ >> 1] = (d | 0) < 32767 ? d : 32767;f = f + 1 | 0;if ((j | 0) != (f | 0)) { - continue; - }break; - } - }j = U(A + I | 0, 0, j << 1);A = i[i[a + 204 >> 2] + (i[a + 208 >> 2] << 2) >> 2];I = i[A + 24 >> 2];if (!I) { - break P; - }d = l;g = d;V: { - W: { - X: { - S = i[A >> 2];switch (S + 1 | 0) {case 1: - break V;case 0: - break W;default: - break X;} - }e = i[a + 32 >> 2] - S | 0;d = (S + i[a + 28 >> 2] | 0) + -1 | 0;l = (l | 0) < (d | 0) ? d : l;l = (l | 0) > (e | 0) ? e : l;g = S + l | 0;d = (l - S | 0) + 1 | 0;break V; - }g = i[a + 32 >> 2];d = i[a + 28 >> 2]; - }f = 0;d = J[I | 0]($, w, M, L, G, oa, i[A + 32 >> 2], d, (g | 0) > (ea | 0) ? i[a + 40 >> 2] ? ea : g : g, ba, i[a + 24 >> 2], i[a + 12 >> 2], c, N, j, R, i[a + 188 >> 2], 0, i[a + 196 >> 2], wa) | 0;i[K + i[a + 52 >> 2] >> 2] = d;A = U(P, 0, i[a + 12 >> 2] << 2);e = i[a + 12 >> 2];if ((e | 0) >= 1) { - while (1) { - d = F + (f << 1) | 0;h[d >> 1] = k[d >> 1] - (i[oa + (f << 2) >> 2] + 4096 >>> 13 | 0);f = f + 1 | 0;if ((e | 0) != (f | 0)) { - continue; - }break; - } - }d = ((Z(F, e) << 14) + Q | 0) / (ia | 0) | 0;e = (d | 0) < 32768 ? d : 32767;d = v;Y: { - Z: { - switch (i[i[i[a + 204 >> 2] + (i[a + 208 >> 2] << 2) >> 2] + 8 >> 2]) {case 3: - d = pa(e << 16 >> 16, 12272, 8);W(c, d, 3);d = h[(d << 1) + 12288 >> 1];d = (o(d, ka) >> 14) + o(d, na) | 0;break Y;case 0: - break Y;default: - break Z;} - }d = pa(e << 16 >> 16, 12304, 2);W(c, d, 1);d = h[(d << 1) + 12306 >> 1];d = (o(d, ka) >> 14) + o(d, na) | 0; - }Aa($, $, d, i[a + 12 >> 2]);g = i[i[a + 204 >> 2] + (i[a + 208 >> 2] << 2) >> 2];e = i[g + 36 >> 2];if (!e) { - break O; - }J[e | 0]($, M, L, G, i[g + 44 >> 2], i[a + 24 >> 2], i[a + 12 >> 2], A, R, c, N, i[a + 188 >> 2], i[g + 12 >> 2]);da(A, A, d, i[a + 12 >> 2]);f = 0;g = i[a + 12 >> 2];if ((g | 0) >= 1) { - while (1) { - e = f << 2;e = (i[e + oa >> 2] << 1) + i[e + A >> 2] | 0;h[j + (f << 1) >> 1] = (e | 0) > 536862719 ? 32767 : (e | 0) < -536862720 ? -32767 : e - -8192 >>> 14 | 0;f = f + 1 | 0;if ((g | 0) != (f | 0)) { - continue; - }break; - } - }_: { - if (i[i[i[a + 204 >> 2] + (i[a + 208 >> 2] << 2) >> 2] + 12 >> 2]) { - f = 0;e = g << 2;K = U(xa, 0, e);g = e + K | 0;I = i[a + 12 >> 2];if ((I | 0) >= 1) { - while (1) { - e = $ + (f << 1) | 0;h[e >> 1] = o(h[e >> 1], 18022) + 4096 >>> 13;f = f + 1 | 0;if ((I | 0) != (f | 0)) { - continue; - }break; - } - }f = 0;e = i[i[a + 204 >> 2] + (i[a + 208 >> 2] << 2) >> 2];J[i[e + 36 >> 2]]($, M, L, G, i[e + 44 >> 2], i[a + 24 >> 2], I, K, R, c, g, i[a + 188 >> 2], 0);da(K, K, o(d << 1 >> 16, 14895) + (o(d & 32767, 14895) >>> 15 | 0) | 0, i[a + 12 >> 2]);g = i[a + 12 >> 2];if ((g | 0) < 1) { - break _; - }while (1) { - e = f << 2;d = e + A | 0;i[d >> 2] = i[e + K >> 2] + i[d >> 2];f = f + 1 | 0;g = i[a + 12 >> 2];if ((f | 0) < (g | 0)) { - continue; - }break; - } - }f = 0;if ((g | 0) < 1) { - break _; - }while (1) { - d = f << 2;d = (i[d + oa >> 2] << 1) + i[d + A >> 2] | 0;h[j + (f << 1) >> 1] = (d | 0) > 536862719 ? 32767 : (d | 0) < -536862720 ? -32767 : d - -8192 >>> 14 | 0;f = f + 1 | 0;if ((g | 0) != (f | 0)) { - continue; - }break; - } - }e = M;d = w;if (i[a + 136 >> 2]) { - g = Ra(A, g);h[i[a + 136 >> 2] + (D << 1) >> 1] = g;g = i[a + 12 >> 2]; - }_(j, e, d, g, i[a + 24 >> 2], i[a + 104 >> 2]);if (i[a + 188 >> 2]) { - aa(w, L, G, w, i[a + 12 >> 2], i[a + 24 >> 2], i[a + 108 >> 2]); - }D = D + 1 | 0;g = i[a + 16 >> 2];if ((D | 0) >= (g | 0)) { - break S; - }f = i[a + 24 >> 2];ja = i[a + 12 >> 2];continue; - } - }e = i[a + 208 >> 2];$: { - if ((e | 0) < 1) { - break $; - }j = i[a + 24 >> 2];aa: { - if ((j | 0) < 1) { - break aa; - }d = i[a + 96 >> 2];f = 0;while (1) { - l = f << 1;h[l + d >> 1] = k[l + O >> 1];f = f + 1 | 0;if ((j | 0) != (f | 0)) { - continue; - }break; - }if ((j | 0) < 1) { - break aa; - }d = i[a + 100 >> 2];f = 0;while (1) { - l = f << 1;h[l + d >> 1] = k[l + ma >> 1];f = f + 1 | 0;if ((j | 0) != (f | 0)) { - continue; - }break; - } - }if ((e | 0) != 1) { - break $; - }if (i[a + 168 >> 2]) { - W(c, 15, 4);break $; - }W(c, 0, 4); - }i[a + 4 >> 2] = 0;c = i[a + 8 >> 2];d = (c << 2) + b | 0;b = i[a + 20 >> 2];X(i[a + 68 >> 2], d - (b << 1) | 0, b - c << 1);b = i[a + 208 >> 2];if (!(i[i[i[a + 204 >> 2] + (b << 2) >> 2] + 36 >> 2] != 14 ? b : 0)) { - g = 1;i[a + 40 >> 2] = 1;break R; - }i[a + 40 >> 2] = 0;g = 1; - }H = z + 48 | 0;return g | 0; - }la(12310, 708);x(); - }la(12391, 760);x(); - }la(12428, 842);x(); - }function na(a) { - a = a | 0;var b = 0, - c = 0, - d = 0, - e = 0, - f = 0, - g = 0, - h = 0, - k = 0, - m = 0, - n = 0, - o = 0;o = H - 16 | 0;H = o;a: { - b: { - c: { - d: { - e: { - f: { - g: { - h: { - i: { - j: { - k: { - if (a >>> 0 <= 244) { - f = i[3808];g = a >>> 0 < 11 ? 16 : a + 11 & -8;a = g >>> 3 | 0;b = f >>> a | 0;if (b & 3) { - c = a + ((b ^ -1) & 1) | 0;e = c << 3;b = i[e + 15280 >> 2];a = b + 8 | 0;d = i[b + 8 >> 2];e = e + 15272 | 0;l: { - if ((d | 0) == (e | 0)) { - i[3808] = ic(c) & f;break l; - }i[d + 12 >> 2] = e;i[e + 8 >> 2] = d; - }c = c << 3;i[b + 4 >> 2] = c | 3;b = b + c | 0;i[b + 4 >> 2] = i[b + 4 >> 2] | 1;break a; - }k = i[3810];if (g >>> 0 <= k >>> 0) { - break k; - }if (b) { - c = 2 << a;a = (0 - c | c) & b << a;a = (0 - a & a) + -1 | 0;b = a >>> 12 & 16;c = b;a = a >>> b | 0;b = a >>> 5 & 8;c = c | b;a = a >>> b | 0;b = a >>> 2 & 4;c = c | b;a = a >>> b | 0;b = a >>> 1 & 2;c = c | b;a = a >>> b | 0;b = a >>> 1 & 1;c = (c | b) + (a >>> b | 0) | 0;d = c << 3;b = i[d + 15280 >> 2];a = i[b + 8 >> 2];d = d + 15272 | 0;m: { - if ((a | 0) == (d | 0)) { - f = ic(c) & f;i[3808] = f;break m; - }i[a + 12 >> 2] = d;i[d + 8 >> 2] = a; - }a = b + 8 | 0;i[b + 4 >> 2] = g | 3;h = b + g | 0;c = c << 3;e = c - g | 0;i[h + 4 >> 2] = e | 1;i[b + c >> 2] = e;if (k) { - c = k >>> 3 | 0;b = (c << 3) + 15272 | 0;d = i[3813];c = 1 << c;n: { - if (!(c & f)) { - i[3808] = c | f;c = b;break n; - }c = i[b + 8 >> 2]; - }i[b + 8 >> 2] = d;i[c + 12 >> 2] = d;i[d + 12 >> 2] = b;i[d + 8 >> 2] = c; - }i[3813] = h;i[3810] = e;break a; - }n = i[3809];if (!n) { - break k; - }a = (n & 0 - n) + -1 | 0;b = a >>> 12 & 16;c = b;a = a >>> b | 0;b = a >>> 5 & 8;c = c | b;a = a >>> b | 0;b = a >>> 2 & 4;c = c | b;a = a >>> b | 0;b = a >>> 1 & 2;c = c | b;a = a >>> b | 0;b = a >>> 1 & 1;b = i[((c | b) + (a >>> b | 0) << 2) + 15536 >> 2];d = (i[b + 4 >> 2] & -8) - g | 0;c = b;while (1) { - o: { - a = i[c + 16 >> 2];if (!a) { - a = i[c + 20 >> 2];if (!a) { - break o; - } - }e = (i[a + 4 >> 2] & -8) - g | 0;c = e >>> 0 < d >>> 0;d = c ? e : d;b = c ? a : b;c = a;continue; - }break; - }m = i[b + 24 >> 2];e = i[b + 12 >> 2];if ((e | 0) != (b | 0)) { - a = i[b + 8 >> 2];i[a + 12 >> 2] = e;i[e + 8 >> 2] = a;break b; - }c = b + 20 | 0;a = i[c >> 2];if (!a) { - a = i[b + 16 >> 2];if (!a) { - break j; - }c = b + 16 | 0; - }while (1) { - h = c;e = a;c = a + 20 | 0;a = i[c >> 2];if (a) { - continue; - }c = e + 16 | 0;a = i[e + 16 >> 2];if (a) { - continue; - }break; - }i[h >> 2] = 0;break b; - }g = -1;if (a >>> 0 > 4294967231) { - break k; - }b = a + 11 | 0;g = b & -8;k = i[3809];if (!k) { - break k; - }c = 0 - g | 0;b = b >>> 8 | 0;f = 0;p: { - if (!b) { - break p; - }f = 31;if (g >>> 0 > 16777215) { - break p; - }d = b + 1048320 >>> 16 & 8;b = b << d;a = b + 520192 >>> 16 & 4;f = b << a;b = f + 245760 >>> 16 & 2;a = (f << b >>> 15 | 0) - (b | (a | d)) | 0;f = (a << 1 | g >>> a + 21 & 1) + 28 | 0; - }d = i[(f << 2) + 15536 >> 2];q: { - r: { - s: { - if (!d) { - a = 0;break s; - }b = g << ((f | 0) == 31 ? 0 : 25 - (f >>> 1 | 0) | 0);a = 0;while (1) { - t: { - h = (i[d + 4 >> 2] & -8) - g | 0;if (h >>> 0 >= c >>> 0) { - break t; - }e = d;c = h;if (c) { - break t; - }c = 0;a = d;break r; - }h = i[d + 20 >> 2];d = i[((b >>> 29 & 4) + d | 0) + 16 >> 2];a = h ? (h | 0) == (d | 0) ? a : h : a;b = b << ((d | 0) != 0);if (d) { - continue; - }break; - } - }if (!(a | e)) { - a = 2 << f;a = (0 - a | a) & k;if (!a) { - break k; - }a = (a & 0 - a) + -1 | 0;b = a >>> 12 & 16;d = b;a = a >>> b | 0;b = a >>> 5 & 8;d = d | b;a = a >>> b | 0;b = a >>> 2 & 4;d = d | b;a = a >>> b | 0;b = a >>> 1 & 2;d = d | b;a = a >>> b | 0;b = a >>> 1 & 1;a = i[((d | b) + (a >>> b | 0) << 2) + 15536 >> 2]; - }if (!a) { - break q; - } - }while (1) { - d = (i[a + 4 >> 2] & -8) - g | 0;b = d >>> 0 < c >>> 0;c = b ? d : c;e = b ? a : e;b = i[a + 16 >> 2];if (b) { - a = b; - } else { - a = i[a + 20 >> 2]; - }if (a) { - continue; - }break; - } - }if (!e | c >>> 0 >= i[3810] - g >>> 0) { - break k; - }h = i[e + 24 >> 2];b = i[e + 12 >> 2];if ((e | 0) != (b | 0)) { - a = i[e + 8 >> 2];i[a + 12 >> 2] = b;i[b + 8 >> 2] = a;break c; - }d = e + 20 | 0;a = i[d >> 2];if (!a) { - a = i[e + 16 >> 2];if (!a) { - break i; - }d = e + 16 | 0; - }while (1) { - f = d;b = a;d = a + 20 | 0;a = i[d >> 2];if (a) { - continue; - }d = b + 16 | 0;a = i[b + 16 >> 2];if (a) { - continue; - }break; - }i[f >> 2] = 0;break c; - }b = i[3810];if (b >>> 0 >= g >>> 0) { - a = i[3813];c = b - g | 0;u: { - if (c >>> 0 >= 16) { - i[3810] = c;d = a + g | 0;i[3813] = d;i[d + 4 >> 2] = c | 1;i[a + b >> 2] = c;i[a + 4 >> 2] = g | 3;break u; - }i[3813] = 0;i[3810] = 0;i[a + 4 >> 2] = b | 3;b = a + b | 0;i[b + 4 >> 2] = i[b + 4 >> 2] | 1; - }a = a + 8 | 0;break a; - }d = i[3811];if (d >>> 0 > g >>> 0) { - b = d - g | 0;i[3811] = b;a = i[3814];c = a + g | 0;i[3814] = c;i[c + 4 >> 2] = b | 1;i[a + 4 >> 2] = g | 3;a = a + 8 | 0;break a; - }a = 0;e = g + 47 | 0;c = e;if (i[3926]) { - b = i[3928]; - } else { - i[3929] = -1;i[3930] = -1;i[3927] = 4096;i[3928] = 4096;i[3926] = o + 12 & -16 ^ 1431655768;i[3931] = 0;i[3919] = 0;b = 4096; - }f = c + b | 0;h = 0 - b | 0;c = f & h;if (c >>> 0 <= g >>> 0) { - break a; - }b = i[3918];if (b) { - k = i[3916];m = k + c | 0;if (m >>> 0 <= k >>> 0 | m >>> 0 > b >>> 0) { - break a; - } - }if (j[15676] & 4) { - break f; - }v: { - w: { - b = i[3814];if (b) { - a = 15680;while (1) { - k = i[a >> 2];if (k + i[a + 4 >> 2] >>> 0 > b >>> 0 ? k >>> 0 <= b >>> 0 : 0) { - break w; - }a = i[a + 8 >> 2];if (a) { - continue; - }break; - } - }b = ia(0);if ((b | 0) == -1) { - break g; - }f = c;a = i[3927];d = a + -1 | 0;if (d & b) { - f = (c - b | 0) + (b + d & 0 - a) | 0; - }if (f >>> 0 <= g >>> 0 | f >>> 0 > 2147483646) { - break g; - }a = i[3918];if (a) { - d = i[3916];h = d + f | 0;if (h >>> 0 <= d >>> 0 | h >>> 0 > a >>> 0) { - break g; - } - }a = ia(f);if ((b | 0) != (a | 0)) { - break v; - }break e; - }f = h & f - d;if (f >>> 0 > 2147483646) { - break g; - }b = ia(f);if ((b | 0) == (i[a >> 2] + i[a + 4 >> 2] | 0)) { - break h; - }a = b; - }if (!((a | 0) == -1 | g + 48 >>> 0 <= f >>> 0)) { - b = i[3928];b = b + (e - f | 0) & 0 - b;if (b >>> 0 > 2147483646) { - b = a;break e; - }if ((ia(b) | 0) != -1) { - f = b + f | 0;b = a;break e; - }ia(0 - f | 0);break g; - }b = a;if ((a | 0) != -1) { - break e; - }break g; - }e = 0;break b; - }b = 0;break c; - }if ((b | 0) != -1) { - break e; - } - }i[3919] = i[3919] | 4; - }if (c >>> 0 > 2147483646) { - break d; - }b = ia(c);a = ia(0);if (b >>> 0 >= a >>> 0 | (b | 0) == -1 | (a | 0) == -1) { - break d; - }f = a - b | 0;if (f >>> 0 <= g + 40 >>> 0) { - break d; - } - }a = i[3916] + f | 0;i[3916] = a;if (a >>> 0 > l[3917]) { - i[3917] = a; - }x: { - y: { - z: { - c = i[3814];if (c) { - a = 15680;while (1) { - d = i[a >> 2];e = i[a + 4 >> 2];if ((d + e | 0) == (b | 0)) { - break z; - }a = i[a + 8 >> 2];if (a) { - continue; - }break; - }break y; - }a = i[3812];if (!(b >>> 0 >= a >>> 0 ? a : 0)) { - i[3812] = b; - }a = 0;i[3921] = f;i[3920] = b;i[3816] = -1;i[3817] = i[3926];i[3923] = 0;while (1) { - c = a << 3;d = c + 15272 | 0;i[c + 15280 >> 2] = d;i[c + 15284 >> 2] = d;a = a + 1 | 0;if ((a | 0) != 32) { - continue; - }break; - }a = f + -40 | 0;c = b + 8 & 7 ? -8 - b & 7 : 0;d = a - c | 0;i[3811] = d;c = b + c | 0;i[3814] = c;i[c + 4 >> 2] = d | 1;i[(a + b | 0) + 4 >> 2] = 40;i[3815] = i[3930];break x; - }if (j[a + 12 | 0] & 8 | b >>> 0 <= c >>> 0 | d >>> 0 > c >>> 0) { - break y; - }i[a + 4 >> 2] = e + f;a = c + 8 & 7 ? -8 - c & 7 : 0;b = a + c | 0;i[3814] = b;d = i[3811] + f | 0;a = d - a | 0;i[3811] = a;i[b + 4 >> 2] = a | 1;i[(c + d | 0) + 4 >> 2] = 40;i[3815] = i[3930];break x; - }e = i[3812];if (b >>> 0 < e >>> 0) { - i[3812] = b;e = 0; - }d = b + f | 0;a = 15680;A: { - B: { - C: { - D: { - E: { - F: { - while (1) { - if ((d | 0) != i[a >> 2]) { - a = i[a + 8 >> 2];if (a) { - continue; - }break F; - }break; - }if (!(j[a + 12 | 0] & 8)) { - break E; - } - }a = 15680;while (1) { - d = i[a >> 2];if (d >>> 0 <= c >>> 0) { - e = d + i[a + 4 >> 2] | 0;if (e >>> 0 > c >>> 0) { - break D; - } - }a = i[a + 8 >> 2];continue; - } - }i[a >> 2] = b;i[a + 4 >> 2] = i[a + 4 >> 2] + f;m = (b + 8 & 7 ? -8 - b & 7 : 0) + b | 0;i[m + 4 >> 2] = g | 3;b = d + (d + 8 & 7 ? -8 - d & 7 : 0) | 0;a = (b - m | 0) - g | 0;h = g + m | 0;if ((b | 0) == (c | 0)) { - i[3814] = h;a = i[3811] + a | 0;i[3811] = a;i[h + 4 >> 2] = a | 1;break B; - }if (i[3813] == (b | 0)) { - i[3813] = h;a = i[3810] + a | 0;i[3810] = a;i[h + 4 >> 2] = a | 1;i[a + h >> 2] = a;break B; - }c = i[b + 4 >> 2];if ((c & 3) == 1) { - n = c & -8;G: { - if (c >>> 0 <= 255) { - e = c >>> 3 | 0;c = i[b + 8 >> 2];d = i[b + 12 >> 2];if ((d | 0) == (c | 0)) { - i[3808] = i[3808] & ic(e);break G; - }i[c + 12 >> 2] = d;i[d + 8 >> 2] = c;break G; - }k = i[b + 24 >> 2];f = i[b + 12 >> 2];H: { - if ((f | 0) != (b | 0)) { - c = i[b + 8 >> 2];i[c + 12 >> 2] = f;i[f + 8 >> 2] = c;break H; - }I: { - d = b + 20 | 0;g = i[d >> 2];if (g) { - break I; - }d = b + 16 | 0;g = i[d >> 2];if (g) { - break I; - }f = 0;break H; - }while (1) { - c = d;f = g;d = g + 20 | 0;g = i[d >> 2];if (g) { - continue; - }d = f + 16 | 0;g = i[f + 16 >> 2];if (g) { - continue; - }break; - }i[c >> 2] = 0; - }if (!k) { - break G; - }c = i[b + 28 >> 2];d = (c << 2) + 15536 | 0;J: { - if (i[d >> 2] == (b | 0)) { - i[d >> 2] = f;if (f) { - break J; - }i[3809] = i[3809] & ic(c);break G; - }i[k + (i[k + 16 >> 2] == (b | 0) ? 16 : 20) >> 2] = f;if (!f) { - break G; - } - }i[f + 24 >> 2] = k;c = i[b + 16 >> 2];if (c) { - i[f + 16 >> 2] = c;i[c + 24 >> 2] = f; - }c = i[b + 20 >> 2];if (!c) { - break G; - }i[f + 20 >> 2] = c;i[c + 24 >> 2] = f; - }b = b + n | 0;a = a + n | 0; - }i[b + 4 >> 2] = i[b + 4 >> 2] & -2;i[h + 4 >> 2] = a | 1;i[a + h >> 2] = a;if (a >>> 0 <= 255) { - b = a >>> 3 | 0;a = (b << 3) + 15272 | 0;c = i[3808];b = 1 << b;K: { - if (!(c & b)) { - i[3808] = b | c;b = a;break K; - }b = i[a + 8 >> 2]; - }i[a + 8 >> 2] = h;i[b + 12 >> 2] = h;i[h + 12 >> 2] = a;i[h + 8 >> 2] = b;break B; - }c = h;d = a >>> 8 | 0;b = 0;L: { - if (!d) { - break L; - }b = 31;if (a >>> 0 > 16777215) { - break L; - }e = d + 1048320 >>> 16 & 8;d = d << e;b = d + 520192 >>> 16 & 4;g = d << b;d = g + 245760 >>> 16 & 2;b = (g << d >>> 15 | 0) - (d | (b | e)) | 0;b = (b << 1 | a >>> b + 21 & 1) + 28 | 0; - }i[c + 28 >> 2] = b;i[h + 16 >> 2] = 0;i[h + 20 >> 2] = 0;c = (b << 2) + 15536 | 0;d = i[3809];e = 1 << b;M: { - if (!(d & e)) { - i[3809] = d | e;i[c >> 2] = h;break M; - }d = a << ((b | 0) == 31 ? 0 : 25 - (b >>> 1 | 0) | 0);b = i[c >> 2];while (1) { - c = b;if ((i[b + 4 >> 2] & -8) == (a | 0)) { - break C; - }b = d >>> 29 | 0;d = d << 1;e = (b & 4) + c | 0;b = i[e + 16 >> 2];if (b) { - continue; - }break; - }i[e + 16 >> 2] = h; - }i[h + 24 >> 2] = c;i[h + 12 >> 2] = h;i[h + 8 >> 2] = h;break B; - }a = f + -40 | 0;d = b + 8 & 7 ? -8 - b & 7 : 0;h = a - d | 0;i[3811] = h;d = b + d | 0;i[3814] = d;i[d + 4 >> 2] = h | 1;i[(a + b | 0) + 4 >> 2] = 40;i[3815] = i[3930];a = (e + (e + -39 & 7 ? 39 - e & 7 : 0) | 0) + -47 | 0;d = a >>> 0 < c + 16 >>> 0 ? c : a;i[d + 4 >> 2] = 27;a = i[3923];i[d + 16 >> 2] = i[3922];i[d + 20 >> 2] = a;a = i[3921];i[d + 8 >> 2] = i[3920];i[d + 12 >> 2] = a;i[3922] = d + 8;i[3921] = f;i[3920] = b;i[3923] = 0;a = d + 24 | 0;while (1) { - i[a + 4 >> 2] = 7;b = a + 8 | 0;a = a + 4 | 0;if (e >>> 0 > b >>> 0) { - continue; - }break; - }if ((c | 0) == (d | 0)) { - break x; - }i[d + 4 >> 2] = i[d + 4 >> 2] & -2;e = d - c | 0;i[c + 4 >> 2] = e | 1;i[d >> 2] = e;if (e >>> 0 <= 255) { - b = e >>> 3 | 0;a = (b << 3) + 15272 | 0;d = i[3808];b = 1 << b;N: { - if (!(d & b)) { - i[3808] = b | d;b = a;break N; - }b = i[a + 8 >> 2]; - }i[a + 8 >> 2] = c;i[b + 12 >> 2] = c;i[c + 12 >> 2] = a;i[c + 8 >> 2] = b;break x; - }i[c + 16 >> 2] = 0;i[c + 20 >> 2] = 0;b = c;d = e >>> 8 | 0;a = 0;O: { - if (!d) { - break O; - }a = 31;if (e >>> 0 > 16777215) { - break O; - }f = d + 1048320 >>> 16 & 8;d = d << f;a = d + 520192 >>> 16 & 4;h = d << a;d = h + 245760 >>> 16 & 2;a = (h << d >>> 15 | 0) - (d | (a | f)) | 0;a = (a << 1 | e >>> a + 21 & 1) + 28 | 0; - }i[b + 28 >> 2] = a;b = (a << 2) + 15536 | 0;d = i[3809];f = 1 << a;P: { - if (!(d & f)) { - i[3809] = d | f;i[b >> 2] = c;i[c + 24 >> 2] = b;break P; - }a = e << ((a | 0) == 31 ? 0 : 25 - (a >>> 1 | 0) | 0);b = i[b >> 2];while (1) { - d = b;if ((e | 0) == (i[b + 4 >> 2] & -8)) { - break A; - }b = a >>> 29 | 0;a = a << 1;f = d + (b & 4) | 0;b = i[f + 16 >> 2];if (b) { - continue; - }break; - }i[f + 16 >> 2] = c;i[c + 24 >> 2] = d; - }i[c + 12 >> 2] = c;i[c + 8 >> 2] = c;break x; - }a = i[c + 8 >> 2];i[a + 12 >> 2] = h;i[c + 8 >> 2] = h;i[h + 24 >> 2] = 0;i[h + 12 >> 2] = c;i[h + 8 >> 2] = a; - }a = m + 8 | 0;break a; - }a = i[d + 8 >> 2];i[a + 12 >> 2] = c;i[d + 8 >> 2] = c;i[c + 24 >> 2] = 0;i[c + 12 >> 2] = d;i[c + 8 >> 2] = a; - }a = i[3811];if (a >>> 0 <= g >>> 0) { - break d; - }b = a - g | 0;i[3811] = b;a = i[3814];c = a + g | 0;i[3814] = c;i[c + 4 >> 2] = b | 1;i[a + 4 >> 2] = g | 3;a = a + 8 | 0;break a; - }i[3790] = 48;a = 0;break a; - }Q: { - if (!h) { - break Q; - }a = i[e + 28 >> 2];d = (a << 2) + 15536 | 0;R: { - if (i[d >> 2] == (e | 0)) { - i[d >> 2] = b;if (b) { - break R; - }k = ic(a) & k;i[3809] = k;break Q; - }i[h + (i[h + 16 >> 2] == (e | 0) ? 16 : 20) >> 2] = b;if (!b) { - break Q; - } - }i[b + 24 >> 2] = h;a = i[e + 16 >> 2];if (a) { - i[b + 16 >> 2] = a;i[a + 24 >> 2] = b; - }a = i[e + 20 >> 2];if (!a) { - break Q; - }i[b + 20 >> 2] = a;i[a + 24 >> 2] = b; - }S: { - if (c >>> 0 <= 15) { - a = c + g | 0;i[e + 4 >> 2] = a | 3;a = a + e | 0;i[a + 4 >> 2] = i[a + 4 >> 2] | 1;break S; - }i[e + 4 >> 2] = g | 3;d = e + g | 0;i[d + 4 >> 2] = c | 1;i[c + d >> 2] = c;if (c >>> 0 <= 255) { - b = c >>> 3 | 0;a = (b << 3) + 15272 | 0;c = i[3808];b = 1 << b;T: { - if (!(c & b)) { - i[3808] = b | c;b = a;break T; - }b = i[a + 8 >> 2]; - }i[a + 8 >> 2] = d;i[b + 12 >> 2] = d;i[d + 12 >> 2] = a;i[d + 8 >> 2] = b;break S; - }b = d;g = c >>> 8 | 0;a = 0;U: { - if (!g) { - break U; - }a = 31;if (c >>> 0 > 16777215) { - break U; - }f = g + 1048320 >>> 16 & 8;g = g << f;a = g + 520192 >>> 16 & 4;h = g << a;g = h + 245760 >>> 16 & 2;a = (h << g >>> 15 | 0) - (g | (a | f)) | 0;a = (a << 1 | c >>> a + 21 & 1) + 28 | 0; - }i[b + 28 >> 2] = a;i[d + 16 >> 2] = 0;i[d + 20 >> 2] = 0;b = (a << 2) + 15536 | 0;V: { - g = 1 << a;W: { - if (!(g & k)) { - i[3809] = g | k;i[b >> 2] = d;break W; - }a = c << ((a | 0) == 31 ? 0 : 25 - (a >>> 1 | 0) | 0);g = i[b >> 2];while (1) { - b = g;if ((i[b + 4 >> 2] & -8) == (c | 0)) { - break V; - }g = a >>> 29 | 0;a = a << 1;f = (g & 4) + b | 0;g = i[f + 16 >> 2];if (g) { - continue; - }break; - }i[f + 16 >> 2] = d; - }i[d + 24 >> 2] = b;i[d + 12 >> 2] = d;i[d + 8 >> 2] = d;break S; - }a = i[b + 8 >> 2];i[a + 12 >> 2] = d;i[b + 8 >> 2] = d;i[d + 24 >> 2] = 0;i[d + 12 >> 2] = b;i[d + 8 >> 2] = a; - }a = e + 8 | 0;break a; - }X: { - if (!m) { - break X; - }a = i[b + 28 >> 2];c = (a << 2) + 15536 | 0;Y: { - if (i[c >> 2] == (b | 0)) { - i[c >> 2] = e;if (e) { - break Y; - }i[3809] = ic(a) & n;break X; - }i[m + (i[m + 16 >> 2] == (b | 0) ? 16 : 20) >> 2] = e;if (!e) { - break X; - } - }i[e + 24 >> 2] = m;a = i[b + 16 >> 2];if (a) { - i[e + 16 >> 2] = a;i[a + 24 >> 2] = e; - }a = i[b + 20 >> 2];if (!a) { - break X; - }i[e + 20 >> 2] = a;i[a + 24 >> 2] = e; - }Z: { - if (d >>> 0 <= 15) { - a = d + g | 0;i[b + 4 >> 2] = a | 3;a = a + b | 0;i[a + 4 >> 2] = i[a + 4 >> 2] | 1;break Z; - }i[b + 4 >> 2] = g | 3;g = b + g | 0;i[g + 4 >> 2] = d | 1;i[d + g >> 2] = d;if (k) { - c = k >>> 3 | 0;a = (c << 3) + 15272 | 0;e = i[3813];c = 1 << c;_: { - if (!(c & f)) { - i[3808] = c | f;c = a;break _; - }c = i[a + 8 >> 2]; - }i[a + 8 >> 2] = e;i[c + 12 >> 2] = e;i[e + 12 >> 2] = a;i[e + 8 >> 2] = c; - }i[3813] = g;i[3810] = d; - }a = b + 8 | 0; - }H = o + 16 | 0;return a | 0; - }function yb(a, b, c) { - a = a | 0;b = b | 0;c = c | 0;var d = 0, - e = 0, - f = 0, - g = 0, - j = 0, - l = 0, - m = 0, - n = 0, - p = 0, - q = 0, - r = 0, - s = 0, - t = 0, - u = 0, - v = 0, - w = 0, - y = 0, - z = 0, - A = 0, - B = 0, - C = 0, - D = 0, - E = 0, - F = 0, - G = 0, - I = 0, - K = 0, - L = 0, - M = 0, - N = 0;r = H - 32 | 0;H = r;f = i[a + 44 >> 2];a: { - b: { - c: { - d: { - e: { - if (!b) { - if (i[a + 484 >> 2]) { - break e; - }b = i[a + 8 >> 2];if ((b | 0) <= 9) { - j = h[(b << 1) + 12480 >> 1] << 1; - }b = h[a + 102 >> 1];f = h[a + 98 >> 1];d = h[a + 100 >> 1];f: { - if ((f | 0) < (d | 0)) { - if ((d | 0) < (b | 0)) { - break f; - }d = (f | 0) < (b | 0) ? b : f;break f; - }if ((b | 0) < (d | 0)) { - break f; - }d = (b | 0) < (f | 0) ? b : f; - }b = h[a + 96 >> 1];if ((d | 0) < (b | 0)) { - h[a + 96 >> 1] = d;b = d; - }f = Z(i[a + 52 >> 2], i[a + 12 >> 2]);d = i[a + 48 >> 2];qa(d, d + (i[a + 12 >> 2] << 1) | 0, (i[a + 16 >> 2] + (i[a + 32 >> 2] << 1) << 1) + 24 | 0);e = o(i[a + 108 >> 2], 1664525) + 1013904223 | 0;i[a + 108 >> 2] = e;b = o(((b | 0) < 54 ? b : 54) << 25 >> 16, j) >> 16;n = i[a + 12 >> 2];if ((n | 0) >= 1) { - d = i[a + 28 >> 2];p = i[a + 32 >> 2];g = o(e >> 16, (i[a + 8 >> 2] << 16) + 65536 >> 16);g = i[a + 92 >> 2] + ((g - (g >> 3) << 2) + 32768 >> 30) | 0;p = (g | 0) > (p | 0) ? p : g;p = (p | 0) < (d | 0) ? d : p;j = o(f, o(2147418112 - (o(b, b) << 1 & -65536) >> 16, j) >> 16) << 1 >> 16;f = i[a + 52 >> 2];d = 0;while (1) { - e = o(e, 1664525) + 1013904223 | 0;g = o(j, e >> 16);h[f + (d << 1) >> 1] = ((g - (g >> 3) | 0) - -8192 >>> 14) + (o(b, h[f + (d - p << 1) >> 1]) >>> 15);d = d + 1 | 0;if ((n | 0) != (d | 0)) { - continue; - }break; - }i[a + 108 >> 2] = e; - }f = i[a + 60 >> 2];ca(32113, f, f, i[a + 24 >> 2]);_(i[a + 52 >> 2] - (i[a + 16 >> 2] << 1) | 0, i[a + 60 >> 2], c, i[a + 12 >> 2], i[a + 24 >> 2], i[a + 64 >> 2]);sa(c, c, i[a + 12 >> 2], 1, a + 68 | 0);d = 0;i[a + 4 >> 2] = 0;i[a + 8 >> 2] = i[a + 8 >> 2] + 1;c = i[a + 104 >> 2];i[a + 104 >> 2] = c + 1;h[((c << 1) + a | 0) + 98 >> 1] = b + 256 >>> 9;if ((c | 0) < 2) { - break c; - }i[a + 104 >> 2] = 0;break c; - }if (!i[a + 112 >> 2]) { - break d; - }if (((i[b + 20 >> 2] ? -1 : (i[b + 4 >> 2] - i[b + 12 >> 2] | 0) - (i[b + 8 >> 2] << 3) | 0) | 0) < 5) { - d = -1;break c; - }j = a + 128 | 0;while (1) { - g: { - if (!V(b, 1)) { - break g; - }oa(b, i[(V(b, 3) << 2) + 12512 >> 2] + -4 | 0);if (((i[b + 20 >> 2] ? -1 : (i[b + 4 >> 2] - i[b + 12 >> 2] | 0) - (i[b + 8 >> 2] << 3) | 0) | 0) < 5) { - d = -1;break c; - }if (!V(b, 1)) { - break g; - }oa(b, i[(V(b, 3) << 2) + 12512 >> 2] + -4 | 0);if (!V(b, 1)) { - break g; - }i[r + 16 >> 2] = 12595;Y(i[3524], 12810, r + 16 | 0);d = -2;break c; - }if (((i[b + 20 >> 2] ? -1 : (i[b + 4 >> 2] - i[b + 12 >> 2] | 0) - (i[b + 8 >> 2] << 3) | 0) | 0) < 4) { - d = -1;break c; - }d = -1;h: { - i: { - j: { - k: { - e = V(b, 4);switch (e + -13 | 0) {case 1: - break i;case 0: - break k;case 2: - break c;default: - break j;} - }d = J[i[a + 452 >> 2]](b, a, i[a + 456 >> 2]) | 0;if (!d) { - break h; - }break c; - }if ((e | 0) < 9) { - break e; - }i[r >> 2] = 12544;Y(i[3524], 12810, r);d = -2;break c; - }d = gb(b, j, a);if (d) { - break c; - } - }if (((i[b + 20 >> 2] ? -1 : (i[b + 4 >> 2] - i[b + 12 >> 2] | 0) - (i[b + 8 >> 2] << 3) | 0) | 0) >= 5) { - continue; - }break; - }d = -1;break c; - }i[a + 120 >> 2] = e; - }d = i[a + 48 >> 2];qa(d, d + (i[a + 12 >> 2] << 1) | 0, (i[a + 16 >> 2] + (i[a + 32 >> 2] << 1) << 1) + 24 | 0);s = f + (f & 1) | 0;f = i[a + 24 >> 2];j = s + (f << 1) | 0;d = i[i[a + 116 >> 2] + (i[a + 120 >> 2] << 2) >> 2];if (!d) { - ca(30474, i[a + 60 >> 2], s, f);f = Z(i[a + 52 >> 2], i[a + 12 >> 2]);d = 0;b = i[a + 12 >> 2];l: { - if ((b | 0) <= 0) { - g = i[a + 52 >> 2];break l; - }e = i[a + 108 >> 2];g = i[a + 52 >> 2];while (1) { - e = o(e, 1664525) + 1013904223 | 0;j = o(f, e >> 16);h[(d << 1) + g >> 1] = (j - (j >> 3) | 0) - -8192 >>> 14;d = d + 1 | 0;if ((b | 0) != (d | 0)) { - continue; - }break; - }i[a + 108 >> 2] = e; - }i[a + 4 >> 2] = 1;_(g, s, c, b, i[a + 24 >> 2], i[a + 64 >> 2]);d = 0;i[a + 8 >> 2] = 0;break c; - }J[i[d + 20 >> 2]](s, f, b);m: { - if (!i[a + 8 >> 2]) { - break m; - }f = i[a + 24 >> 2];if ((f | 0) < 1) { - break m; - }g = i[a + 56 >> 2];d = 0;e = 0;while (1) { - n = d << 1;q = h[n + g >> 1] - h[n + s >> 1] | 0;n = q >> 31;e = (n ^ n + q) + e | 0;d = d + 1 | 0;if ((f | 0) != (d | 0)) { - continue; - }break; - }if ((f | 0) < 1) { - break m; - }f = 19661 >>> (e >>> 15) | 0;n = i[a + 64 >> 2];d = 0;while (1) { - g = n + (d << 2) | 0;e = i[g >> 2];i[g >> 2] = o(f, e << 1 >> 16) + (o(f, e & 32767) >>> 15 | 0);d = d + 1 | 0;if ((d | 0) < i[a + 24 >> 2]) { - continue; - }break; - } - }n: { - if (i[a + 8 >> 2] ? 0 : !i[a + 4 >> 2]) { - break n; - }f = i[a + 24 >> 2];if ((f | 0) < 1) { - break n; - }e = i[a + 56 >> 2];d = 0;while (1) { - n = d << 1;h[n + e >> 1] = k[n + s >> 1];d = d + 1 | 0;if ((f | 0) != (d | 0)) { - continue; - }break; - } - }f = i[i[a + 116 >> 2] + (i[a + 120 >> 2] << 2) >> 2];if (i[f >> 2] != -1) { - p = i[a + 28 >> 2] + V(b, 7) | 0;f = i[i[a + 116 >> 2] + (i[a + 120 >> 2] << 2) >> 2]; - }if (i[f + 4 >> 2]) { - A = o(V(b, 4) << 22 >> 16, 2185) + 16384 >> 15; - }f = V(b, 5);v = j + (j & 1) | 0;d = v + (i[a + 24 >> 2] << 1) | 0;B = (0 - d & 3) + d | 0;d = i[a + 16 >> 2] << 2;j = B + d | 0;e = 0 - j & 3;n = i[(f << 2) + 12144 >> 2];g = o(n & 32767, 28406);f = i[a + 120 >> 2];if ((f | 0) == 1) { - i[a + 484 >> 2] = (V(b, 4) | 0) == 15;f = i[a + 120 >> 2]; - }if ((f | 0) >= 2) { - i[a + 484 >> 2] = 0; - }t = e + j | 0;q = t + d | 0;n = o(n << 1 >> 16, 28406) + (g >>> 15 | 0) | 0;o: { - if (i[a + 20 >> 2] <= 0) { - f = 40;break o; - }f = p << 16 >> 15;d = f >>> 0 > 65535;j = d << 3;g = j | 4;e = j;d = d ? f >>> 16 | 0 : f;j = d >>> 0 > 255;e = j ? g : e;d = j ? d >>> 8 | 0 : d;j = d >>> 0 > 15;d = (j ? e | 2 : e) | (j ? d >>> 4 | 0 : d) >>> 0 > 3;j = d << 1;g = n << 2;e = o(A, 24576) + -311296 | 0;e = e & 536870912 ? 0 : e >>> 14 | 0;e = e << 16 >> 16 < 64 ? e : 64;m = f >> j + -12;f = f << 12 - j;j = d << 16 >> 16;f = ((j | 0) > 6 ? m : f) << 16 >> 16;f = (o((o(o(f, 16816) + -827523072 >> 16, f) << 2 & -65536) + 1387593728 >> 16, f) << 2 & -65536) + 238157824 >> 16;d = 13 - d | 0;K = o((o(g + 32768 >> 16, e << 16 >> 16) << 10) + 32768 >>> 16 | 0, (j | 0) < 13 ? f >> d : f << 0 - d);L = o(e, 5046272) >> 16;M = o(e, -28508160) + 2147418112 >> 16;C = a + 108 | 0;D = n & 16383;E = g >> 16;N = q + (0 - q & 3) | 0;d = i[a + 16 >> 2];f = 40;while (1) { - w = i[a + 80 >> 2];l = o(d, z);F = l << 1;u = U(F + i[a + 52 >> 2] | 0, 0, d << 1);e = i[i[a + 116 >> 2] + (i[a + 120 >> 2] << 2) >> 2];m = i[e + 28 >> 2];if (!m) { - break b; - }d = f;j = p;g = j;p: { - q: { - r: { - f = i[e >> 2];switch (f + 1 | 0) {case 1: - break p;case 0: - break q;default: - break r;} - }j = i[a + 32 >> 2];g = f + p | 0;g = (g | 0) > (j | 0) ? j : g;j = i[a + 28 >> 2];f = (p - f | 0) + 1 | 0;j = (f | 0) < (j | 0) ? j : f;break p; - }g = i[a + 32 >> 2];j = i[a + 28 >> 2]; - }J[m | 0](u, t, j, g, A, i[e + 32 >> 2], i[a + 16 >> 2], r + 28 | 0, r + 22 | 0, b, q, i[a + 8 >> 2], l, h[a + 96 >> 1], 0);vb(t, i[a + 16 >> 2]);j = h[r + 24 >> 1];f = j >> 31;s: { - t: { - j = f ^ f + j;f = h[r + 22 >> 1];j = j + ((f | 0) > 0 ? f : 0 - (f >>> 1 | 0) | 0) | 0;f = h[r + 26 >> 1];j = j + ((f | 0) > 0 ? f : 0 - (f >>> 1 | 0) | 0) << 16 >> 16;e = G << 16 >> 16;u: { - if ((j | 0) <= (e | 0)) { - break u; - }f = i[r + 28 >> 2];l = (d << 1) - f | 0;g = l >> 31;if ((g ^ g + l) < 3) { - break u; - }l = o(d, 3) - f | 0;g = l >> 31;if ((g ^ g + l) < 4) { - break u; - }l = (d << 2) - f | 0;g = l >> 31;if ((g ^ g + l) > 4) { - break t; - } - }if (o(e, 19661) >> 15 < (j | 0)) { - f = i[r + 28 >> 2];l = d - (f << 1) | 0;g = l >> 31;if ((g ^ g + l) < 3) { - break t; - }l = d + o(f, -3) | 0;g = l >> 31;if ((g ^ g + l) < 4) { - break t; - }l = d - (f << 2) | 0;g = l >> 31;if ((g ^ g + l) < 5) { - break t; - } - }if (o(j, 21955) >> 15 <= (e | 0)) { - f = d;break s; - }f = i[r + 28 >> 2];l = (d << 1) - f | 0;g = l >> 31;if ((g ^ g + l) < 3) { - break t; - }l = o(d, 3) - f | 0;g = l >> 31;if ((g ^ g + l) < 4) { - break t; - }l = (d << 2) - f | 0;g = l >> 31;if ((g ^ g + l) <= 4) { - break t; - }f = d;break s; - }G = (j | 0) > (e | 0) ? j : G; - }l = U(B, 0, i[a + 16 >> 2] << 2);e = n;v: { - w: { - switch (i[i[i[a + 116 >> 2] + (i[a + 120 >> 2] << 2) >> 2] + 8 >> 2] + -1 | 0) {case 2: - d = h[(V(b, 3) << 1) + 12288 >> 1];e = (o(d, D) >> 14) + o(d, E) | 0;break v;case 0: - break w;default: - break v;} - }d = h[(V(b, 1) << 1) + 12306 >> 1];e = (o(d, D) >> 14) + o(d, E) | 0; - }d = i[i[a + 116 >> 2] + (i[a + 120 >> 2] << 2) >> 2];g = i[d + 40 >> 2];if (!g) { - break a; - }J[g | 0](l, i[d + 44 >> 2], i[a + 16 >> 2], b, q, C);da(l, l, e, i[a + 16 >> 2]);d = i[a + 16 >> 2];x: { - y: { - if (i[i[i[a + 116 >> 2] + (i[a + 120 >> 2] << 2) >> 2] + 12 >> 2]) { - g = 0;d = d << 2;m = U(N, 0, d);I = i[i[a + 116 >> 2] + (i[a + 120 >> 2] << 2) >> 2];J[i[I + 40 >> 2]](m, i[I + 44 >> 2], i[a + 16 >> 2], b, d + m | 0, C);da(m, m, o(e << 1 >> 16, 14895) + (o(e & 32767, 14895) >>> 15 | 0) | 0, i[a + 16 >> 2]);d = i[a + 16 >> 2];if ((d | 0) < 1) { - break y; - }while (1) { - d = g << 2;e = d + l | 0;i[e >> 2] = i[d + m >> 2] + i[e >> 2];g = g + 1 | 0;d = i[a + 16 >> 2];if ((g | 0) < (d | 0)) { - continue; - }break; - } - }if ((d | 0) < 1) { - break x; - }e = 0;g = (d | 0) > 0;while (1) { - m = e << 2;m = (i[m + t >> 2] << 1) + i[l + m >> 2] | 0;h[u + (e << 1) >> 1] = (m | 0) > 536862719 ? 32767 : (m | 0) < -536862720 ? -32767 : m - -8192 >>> 14 | 0;e = e + 1 | 0;if ((e | 0) != (d | 0)) { - continue; - }break; - } - }m = w ? w + F | 0 : 0;if (!m) { - break x; - }e = 0;if (!g) { - break x; - }while (1) { - h[m + (e << 1) >> 1] = i[l + (e << 2) >> 2] - -8192 >>> 14;e = e + 1 | 0;if ((e | 0) != (d | 0)) { - continue; - }break; - } - }y = j + y | 0;z: { - if (i[a + 120 >> 2] != 1) { - break z; - }u = U(u, 0, d << 1);e = i[a + 480 >> 2];d = i[a + 16 >> 2];if ((e | 0) < (d | 0)) { - while (1) { - if ((e | 0) >= 0) { - h[u + (e << 1) >> 1] = K; - }e = e + p | 0;if ((e | 0) < (d | 0)) { - continue; - }break; - }i[a + 480 >> 2] = e; - }i[a + 480 >> 2] = e - d;if ((d | 0) < 1) { - break z; - }j = i[a + 472 >> 2];g = 0;while (1) { - m = u + (g << 1) | 0;w = h[m >> 1];e = i[l + (g << 2) >> 2];h[m >> 1] = (o((e << 2) + 32768 >> 16, M) >>> 15) + (o(h[a + 468 >> 1], 19660) + (o(w, 45876) & -65536) >>> 16) - (o((j << 2) + 32768 >> 16, L) >>> 15);i[a + 472 >> 2] = e;h[a + 468 >> 1] = w;j = (o(h[a + 476 >> 1], 26214) + o(h[m >> 1], 6554) | 0) + 16384 >>> 15 | 0;h[a + 476 >> 1] = j;h[m >> 1] = k[m >> 1] - j;j = e;g = g + 1 | 0;if ((g | 0) != (d | 0)) { - continue; - }break; - } - }y = y << 16 >> 16;z = z + 1 | 0;if ((z | 0) < i[a + 20 >> 2]) { - continue; - }break; - }l = y + 2 >> 2; - }b = q + (q & 1) | 0;d = i[a + 24 >> 2];p = b + (d << 1) | 0;A: { - B: { - if (!i[a + 124 >> 2]) { - break B; - }j = h[i[i[a + 116 >> 2] + (i[a + 120 >> 2] << 2) >> 2] + 48 >> 1];if (i[a + 8 >> 2] | (j | 0) < 1) { - break B; - }e = i[a + 16 >> 2] << 1;Ja(i[a + 52 >> 2] - e | 0, c, e, f, j, p);d = i[a + 16 >> 2];j = d << 1;Ja(j + i[a + 52 >> 2] | 0, (d << 2) + c | 0, j, f, h[i[i[a + 116 >> 2] + (i[a + 120 >> 2] << 2) >> 2] + 48 >> 1], p);break A; - }X(c, i[a + 52 >> 2] - (i[a + 16 >> 2] << 1) | 0, i[a + 12 >> 2] << 1); - }C: { - if (!i[a + 8 >> 2]) { - break C; - }d = Z(i[a + 52 >> 2], i[a + 12 >> 2]);e = i[a + 12 >> 2];if ((e | 0) < 1) { - break C; - }d = (d << 16) + 65536 | 0;d = (n + (d >> 17) | 0) / (d >> 16) | 0;g = ((d | 0) < 32767 ? d : 32767) << 16 >> 16;q = i[a + 16 >> 2];j = i[a + 52 >> 2];d = 0;while (1) { - m = d << 1;t = m + j | 0;h[t >> 1] = o(g, h[t >> 1]) >>> 14;h[c + m >> 1] = k[j + (d - q << 1) >> 1];d = d + 1 | 0;if ((e | 0) != (d | 0)) { - continue; - }break; - } - }d = i[a + 20 >> 2];if ((d | 0) >= 1) { - j = i[a + 24 >> 2];g = 0;while (1) { - q = i[a + 16 >> 2];fa(i[a + 56 >> 2], s, b, j, g, d);ga(b, i[a + 24 >> 2], 16);ha(b, v, i[a + 24 >> 2], p);e = 8192;d = 0;j = i[a + 24 >> 2];if ((j | 0) >= 1) { - while (1) { - m = e;e = d << 1;e = (m + h[(e | 2) + v >> 1] | 0) - h[e + v >> 1] | 0;d = d + 2 | 0;if ((d | 0) < (j | 0)) { - continue; - }break; - } - }i[i[a + 76 >> 2] + (g << 2) >> 2] = e;d = (o(g, q) << 1) + c | 0;_(d, i[a + 60 >> 2], d, i[a + 16 >> 2], i[a + 24 >> 2], i[a + 64 >> 2]);j = i[a + 24 >> 2];if ((j | 0) >= 1) { - e = i[a + 60 >> 2];d = 0;while (1) { - q = d << 1;h[q + e >> 1] = k[q + v >> 1];d = d + 1 | 0;if ((j | 0) != (d | 0)) { - continue; - }break; - } - }g = g + 1 | 0;d = i[a + 20 >> 2];if ((g | 0) < (d | 0)) { - continue; - }break; - } - }if (i[a + 492 >> 2]) { - sa(c, c, i[a + 12 >> 2], i[a + 488 >> 2] ? 3 : 1, a + 68 | 0); - }b = (n - -8192 >>> 14 | 0) + 1 | 0;h[a + 84 >> 1] = b;c = o(h[a + 86 >> 1], 32440) >> 15;b = b << 16 >> 16;c = (c | 0) > (b | 0) ? c : b;h[a + 86 >> 1] = c;d = o(h[a + 88 >> 1], 66192) + 65536 >> 16;b = (d | 0) < (b | 0) ? d : b;h[a + 88 >> 1] = b;if ((b | 0) >= (c | 0)) { - h[a + 86 >> 1] = b + 1; - }b = i[a + 24 >> 2];if ((b | 0) >= 1) { - c = i[a + 56 >> 2];d = 0;while (1) { - j = d << 1;h[j + c >> 1] = k[j + s >> 1];d = d + 1 | 0;if ((b | 0) != (d | 0)) { - continue; - }break; - } - }h[a + 96 >> 1] = l;i[a + 92 >> 2] = f;i[a + 4 >> 2] = 0;i[a + 8 >> 2] = 0;b = i[a + 104 >> 2];i[a + 104 >> 2] = b + 1;h[((b << 1) + a | 0) + 98 >> 1] = l;if ((b | 0) >= 2) { - i[a + 104 >> 2] = 0; - }h[a + 40 >> 1] = n;d = 0; - }H = r + 32 | 0;return d | 0; - }la(12657, 1321);x(); - }la(12696, 1397);x(); - }function mb(a, b, c) { - a = a | 0;b = b | 0;c = c | 0;var d = 0, - e = 0, - f = 0, - g = 0, - j = 0, - l = 0, - n = 0, - r = 0, - v = 0, - w = 0, - x = 0, - y = p(0), - z = 0, - A = 0, - B = p(0), - C = 0, - D = 0, - E = 0, - F = 0, - G = 0, - I = p(0), - K = 0, - L = 0, - M = 0, - N = 0, - O = 0, - P = 0, - Q = 0, - R = 0, - S = 0, - T = 0, - V = p(0), - Y = 0, - $ = 0, - ea = 0;x = H - 16 | 0;H = x;z = i[i[a >> 2] >> 2];v = i[a + 12 >> 2];d = (v << 1) + b | 0;f = i[a + 44 >> 2];Ub(b, b, d, i[a + 8 >> 2], i[a + 52 >> 2], f);a: { - if (!(i[a + 108 >> 2] | i[a + 136 >> 2])) { - B = p(1);I = p(1);break a; - }B = p(p(Z(b, i[a + 12 >> 2]) | 0) + p(1));I = p(p(Z(d, i[a + 12 >> 2]) | 0) + p(1)); - }e = i[a + 20 >> 2];g = i[a + 4 >> 2];R = f + (f & 1) | 0;J[i[i[g >> 2] + 44 >> 2]](g, 104, R) | 0;f = i[a + 4 >> 2];J[i[i[f >> 2] + 28 >> 2]](f, b, c) | 0;f = d;j = i[a + 24 >> 2];G = i[a + 12 >> 2];d = j - G << 1;K = X(f - d | 0, i[a + 48 >> 2], d);d = i[a + 12 >> 2];X(i[a + 48 >> 2], (d << 1) + K | 0, i[a + 24 >> 2] - d << 1);f = i[a + 20 >> 2];d = i[a + 4 >> 2];e = (e << 1) + R | 0;S = (0 - e & 3) + e | 0;J[i[i[d >> 2] + 44 >> 2]](d, 100, S) | 0;d = i[a + 4 >> 2];e = (f << 2) + S | 0;T = (e & 1) + e | 0;J[i[i[d >> 2] + 44 >> 2]](d, 101, T) | 0;d = i[a + 4 >> 2];J[i[i[d >> 2] + 44 >> 2]](d, 9, x + 12 | 0) | 0;i[x + 12 >> 2] = !i[x + 12 >> 2];A = i[a + 28 >> 2];d = A << 1;f = (f << 1) + T | 0;w = (f & 1) + f | 0;f = d + w | 0;N = (f & 1) + f | 0;f = N + d | 0;C = (f & 1) + f | 0;f = C + d | 0;D = (f & 1) + f | 0;f = D + d | 0;E = (f & 1) + f | 0;f = E + d | 0;L = (f & 1) + f | 0;f = L + d | 0;O = (f & 1) + f | 0;f = O + d | 0;P = (f & 1) + f | 0;f = P + d | 0;f = (f & 1) + f | 0;d = (d + f | 0) + 2 | 0;g = (d & 1) + d | 0;d = i[a + 24 >> 2];n = d << 1;b: { - if (i[a + 16 >> 2] != 80) { - if ((d | 0) < 1) { - break b; - }r = i[a + 60 >> 2];e = 0;while (1) { - l = e << 1;h[l + g >> 1] = o(h[l + r >> 1], h[l + K >> 1]) >>> 14;e = e + 1 | 0;if ((d | 0) != (e | 0)) { - continue; - }break; - }break b; - }if ((d | 0) < 1) { - break b; - }l = i[a + 60 >> 2];e = 0;while (1) { - r = e << 1;h[r + g >> 1] = o(h[l + (e & -2) >> 1], h[r + K >> 1]) >>> 14;e = e + 1 | 0;if ((d | 0) != (e | 0)) { - continue; - }break; - } - }l = g + n | 0;e = 1;Da(g, f, A + 1 | 0, d);d = h[f >> 1];g = (o(d, h[a + 36 >> 1]) >>> 15 | 0) + d | 0;h[f >> 1] = g;d = i[a + 28 >> 2];c: { - if ((d | 0) < 0) { - break c; - }A = i[a + 64 >> 2];h[f >> 1] = o(h[A >> 1], g << 16 >> 16) >>> 14;if (!d) { - break c; - }while (1) { - g = e << 1;n = g + f | 0;h[n >> 1] = o(h[g + A >> 1], h[n >> 1]) >>> 14;g = (d | 0) != (e | 0);e = e + 1 | 0;if (g) { - continue; - }break; - } - }Ea(w, f, d);f = ta(w, i[a + 28 >> 2], E, 6553, l);d = i[a + 28 >> 2];d: { - if ((f | 0) == (d | 0)) { - break d; - }f = ta(w, d, E, 1638, l);d = i[a + 28 >> 2];if ((f | 0) == (d | 0) | (d | 0) < 1) { - break d; - }f = i[a + 68 >> 2];e = 0;while (1) { - g = e << 1;h[g + E >> 1] = k[f + g >> 1];e = e + 1 | 0;if ((d | 0) != (e | 0)) { - continue; - }break; - } - }e: { - if (i[x + 12 >> 2] | (i[a + 136 >> 2] ? 0 : !i[a + 108 >> 2])) { - break e; - }if (i[a + 120 >> 2]) { - V = m[a + 124 >> 2];f: { - if (p(m[a + 128 >> 2] * V) > p(0) ^ 1) { - break f; - }y = p(+V * -1e-5 / +p(m[a + 132 >> 2] + p(1)));y = +y > .1 ? p(.10000000149011612) : y;if (+y < -.1 ^ 1) { - break f; - }y = p(-.10000000149011612); - }m[a + 104 >> 2] = t(p(s(p(y + m[a + 104 >> 2]), p(10))), p(0)); - }d = i[a + 4 >> 2];J[i[i[d >> 2] + 44 >> 2]](d, 29, a + 140 | 0) | 0;Y = ba(+p(I / B));if (i[a + 108 >> 2]) { - e = i[z + 152 >> 2] + -1 | 0;i[x + 8 >> 2] = e;I = p(t(p(p(p(s(p(t(p(Y + Y), p(-4))), p(2))) + p(2)) + m[a + 140 >> 2]), p(-1)));m[a + 140 >> 2] = I;g: { - if (!e) { - break g; - }f = i[z + 148 >> 2];B = m[a + 104 >> 2];y = p(u(B));h: { - if (p(q(y)) < p(2147483648)) { - d = ~~y;break h; - }d = -2147483648; - }if ((d | 0) == 10) { - while (1) { - if (((o(i[i[i[a + 148 >> 2] + (e << 2) >> 2] + 52 >> 2], i[a + 164 >> 2]) | 0) / i[a + 8 >> 2] | 0) <= i[a + 116 >> 2] ? !(I >= m[(f + o(e, 44) | 0) + 40 >> 2] ^ 1) : 0) { - break g; - }e = e + -1 | 0;i[x + 8 >> 2] = e;if (e) { - continue; - }break g; - } - }y = p(B - p(d | 0));g = d + 1 | 0;B = p(p(g | 0) - B);while (1) { - w = f + o(e, 44) | 0;if (((o(i[i[i[a + 148 >> 2] + (e << 2) >> 2] + 52 >> 2], i[a + 164 >> 2]) | 0) / i[a + 8 >> 2] | 0) <= i[a + 116 >> 2] ? !(I >= p(p(y * m[w + (g << 2) >> 2]) + p(B * m[w + (d << 2) >> 2])) ^ 1) : 0) { - break g; - }e = e + -1 | 0;i[x + 8 >> 2] = e;if (e) { - continue; - }break; - } - }J[i[i[a >> 2] + 44 >> 2]](a, 10, x + 8 | 0) | 0;if (!i[a + 120 >> 2]) { - break e; - }J[i[i[a >> 2] + 44 >> 2]](a, 19, x + 4 | 0) | 0;d = i[x + 4 >> 2];m[a + 132 >> 2] = m[a + 132 >> 2] + p(1);d = d - i[a + 120 >> 2] | 0;m[a + 124 >> 2] = m[a + 124 >> 2] + p(d | 0);m[a + 128 >> 2] = +(d | 0) * .05 + +m[a + 128 >> 2] * .95;break e; - }i[a + 152 >> 2] = m[a + 140 >> 2] < p(2) ? 1 : i[a + 156 >> 2]; - }if (i[a + 144 >> 2]) { - W(c, 1, 1);W(c, i[x + 12 >> 2] ? 0 : i[a + 152 >> 2], 3); - }i: { - j: { - if (!i[x + 12 >> 2]) { - d = i[i[a + 148 >> 2] + (i[a + 152 >> 2] << 2) >> 2];if (d) { - break j; - } - }c = i[a + 12 >> 2];if ((c | 0) >= 1) { - U(((v + G | 0) - j << 1) + b | 0, 0, c << 1); - }d = i[a + 28 >> 2];if ((d | 0) >= 1) { - b = i[a + 88 >> 2];e = 0;while (1) { - i[b + (e << 2) >> 2] = 0;e = e + 1 | 0;d = i[a + 28 >> 2];if ((e | 0) < (d | 0)) { - continue; - }break; - } - }i[a + 32 >> 2] = 1;_(K, i[a + 76 >> 2], K, i[a + 12 >> 2], d, i[a + 80 >> 2]);a = !i[x + 12 >> 2];break i; - }J[i[d + 16 >> 2]](E, L, i[a + 28 >> 2], c);e = i[a + 28 >> 2];k: { - if (!i[a + 32 >> 2] | (e | 0) < 1) { - break k; - }b = i[a + 68 >> 2];d = 0;while (1) { - f = d << 1;h[f + b >> 1] = k[f + E >> 1];d = d + 1 | 0;if ((d | 0) != (e | 0)) { - continue; - }break; - }if ((e | 0) < 1) { - break k; - }b = i[a + 72 >> 2];d = 0;while (1) { - f = d << 1;h[f + b >> 1] = k[f + L >> 1];d = d + 1 | 0;if ((d | 0) != (e | 0)) { - continue; - }break; - } - }d = i[a + 20 >> 2];if ((d | 0) >= 1) { - w = l + (0 - l & 3) | 0;b = w + (e << 2) | 0;G = (b & 1) + b | 0;b = i[a + 16 >> 2];f = b << 1;g = G + f | 0;$ = (0 - g & 3) + g | 0;g = $ + (b << 2) | 0;z = (g & 1) + g | 0;l = f + z | 0;g = 0;while (1) { - fa(i[a + 68 >> 2], E, O, e, g, d);fa(i[a + 72 >> 2], L, P, i[a + 28 >> 2], g, i[a + 20 >> 2]);ga(O, i[a + 28 >> 2], 410);ga(P, i[a + 28 >> 2], 410);f = (l & 1) + l | 0;d = b << 1;e = f + d | 0;v = (e & 1) + e | 0;n = d;d = d + v | 0;A = (d & 1) + d | 0;l = n + A | 0;ha(O, N, i[a + 28 >> 2], l);ha(P, i[a + 76 >> 2], i[a + 28 >> 2], l);ca(h[a + 38 >> 1], N, C, i[a + 28 >> 2]);ca(h[a + 40 >> 1], N, D, i[a + 28 >> 2]);M = g << 2;Q = M + i[a + 92 >> 2] | 0;i[Q >> 2] = 8192;j = i[a + 76 >> 2];e = 0;n = 8192;d = 8192;r = i[a + 28 >> 2];if ((r | 0) >= 1) { - while (1) { - ea = n;n = e << 1;r = h[n + j >> 1];F = h[j + (n | 2) >> 1];n = ea + (r + F | 0) | 0;i[Q >> 2] = n;d = (d + F | 0) - r | 0;e = e + 2 | 0;r = i[a + 28 >> 2];if ((e | 0) < (r | 0)) { - continue; - }break; - } - }e = i[M + S >> 2];n = (o(b, g) << 1) + K | 0;va(n, j, f, i[a + 16 >> 2], r, i[a + 84 >> 2]);b = d + 82 | 0;b = (((e << 7) + (b << 16 >> 17) | 0) + 10496 | 0) / (b | 0) | 0;b = (b | 0) > -32767 ? b : -32767;j = (b | 0) < 32767 ? b : 32767;e = Z(f, i[a + 16 >> 2]);l: { - if (!i[i[i[a + 148 >> 2] + (i[a + 152 >> 2] << 2) >> 2] + 36 >> 2]) { - b = g << 1;d = (k[b + R >> 1] << 16) + 65536 | 0;d = pa((o(e, j) + (d >> 17) | 0) / (d >> 16) << 16 >> 16, 12976, 32);d = (d | 0) > 0 ? d : 0;W(c, (d | 0) < 31 ? d : 31, 5);d = i[a + 100 >> 2];if (!d) { - break l; - }h[b + d >> 1] = e;break l; - }M = g << 1;b = (k[M + T >> 1] << 16) + 65536 | 0;r = b >> 16;b = (o(j, (e << 16) + 65536 >> 16) + (b >> 17) | 0) / (r | 0) | 0;d = c;if (i[a + 16 >> 2] == 80) { - b = o(b << 16 >> 16, 23171) + 16384 >>> 15 | 0; - }b = pa(b << 16 >> 16, 13040, 16);W(d, b, 4);e = o(h[(b << 1) + 13040 >> 1], 28626) >>> 15 | 0;b = i[a + 16 >> 2];if ((b | 0) == 80) { - e = o(e << 16 >> 16, 23170) - -8192 >> 14; - }La(i[a + 76 >> 2], C, D, G, b, i[a + 28 >> 2], l);j = ((e << 16 >> 8) + (j >> 1) | 0) / (j | 0) | 0;b = i[a + 16 >> 2];if ((b | 0) >= 1) { - U(v, 0, b << 1); - }b = i[a + 28 >> 2];if ((b | 0) >= 1) { - d = i[a + 80 >> 2];e = 0;while (1) { - b = e << 2;i[b + w >> 2] = i[b + d >> 2];e = e + 1 | 0;b = i[a + 28 >> 2];if ((e | 0) < (b | 0)) { - continue; - }break; - } - }_(v, i[a + 76 >> 2], v, i[a + 16 >> 2], b, w);b = i[a + 28 >> 2];if ((b | 0) >= 1) { - d = i[a + 88 >> 2];e = 0;while (1) { - b = e << 2;i[b + w >> 2] = i[b + d >> 2];e = e + 1 | 0;b = i[a + 28 >> 2];if ((e | 0) < (b | 0)) { - continue; - }break; - } - }aa(v, C, D, v, i[a + 16 >> 2], b, w);b = i[a + 28 >> 2];if ((b | 0) >= 1) { - d = i[a + 88 >> 2];e = 0;while (1) { - b = e << 2;i[b + w >> 2] = i[b + d >> 2];e = e + 1 | 0;b = i[a + 28 >> 2];if ((e | 0) < (b | 0)) { - continue; - }break; - } - }aa(n, C, D, A, i[a + 16 >> 2], b, w);e = 0;b = i[a + 16 >> 2];if ((b | 0) >= 1) { - while (1) { - d = e << 1;h[d + z >> 1] = k[d + A >> 1] - k[d + v >> 1];e = e + 1 | 0;if ((b | 0) != (e | 0)) { - continue; - }break; - } - }r = o(r, j << 16 >> 16);d = r << 6;Aa(z, z, d, b);v = U($, 0, i[a + 16 >> 2] << 2);b = i[i[a + 148 >> 2] + (i[a + 152 >> 2] << 2) >> 2];J[i[b + 36 >> 2]](z, i[a + 76 >> 2], C, D, i[b + 44 >> 2], i[a + 28 >> 2], i[a + 16 >> 2], v, G, c, l, i[a + 160 >> 2], i[b + 12 >> 2]);da(v, v, d, i[a + 16 >> 2]);m: { - n: { - if (!i[i[i[a + 148 >> 2] + (i[a + 152 >> 2] << 2) >> 2] + 12 >> 2]) { - d = i[a + 16 >> 2];break n; - }e = 0;j = i[a + 16 >> 2] << 2;b = U((0 - l & 3) + l | 0, 0, j);Q = b + j | 0;j = i[a + 16 >> 2];if ((j | 0) >= 1) { - while (1) { - F = z + (e << 1) | 0;h[F >> 1] = o(h[F >> 1], 20480) + 4096 >>> 13;e = e + 1 | 0;if ((j | 0) != (e | 0)) { - continue; - }break; - } - }e = 0;F = i[i[a + 148 >> 2] + (i[a + 152 >> 2] << 2) >> 2];J[i[F + 36 >> 2]](z, i[a + 76 >> 2], C, D, i[F + 44 >> 2], i[a + 28 >> 2], j, b, G, c, Q, i[a + 160 >> 2], 0);da(b, b, o(r << 7 >> 16, 13107) + (o(d & 32704, 13107) + 16384 >>> 15 | 0) | 0, i[a + 16 >> 2]);d = i[a + 16 >> 2];if ((d | 0) < 1) { - break m; - }while (1) { - d = e << 2;j = d + v | 0;i[j >> 2] = i[b + d >> 2] + i[j >> 2];e = e + 1 | 0;d = i[a + 16 >> 2];if ((e | 0) < (d | 0)) { - continue; - }break; - } - }e = 0;if ((d | 0) < 1) { - break m; - }while (1) { - h[f + (e << 1) >> 1] = i[v + (e << 2) >> 2] - -8192 >>> 14;e = e + 1 | 0;if ((d | 0) != (e | 0)) { - continue; - }break; - } - }b = f;if (i[a + 100 >> 2]) { - d = Ra(v, d);h[M + i[a + 100 >> 2] >> 1] = o(d, 23171) >>> 15;d = i[a + 16 >> 2]; - }e = Z(b, d); - }h[i[a + 96 >> 2] + (g << 1) >> 1] = e;d = i[a + 80 >> 2];e = 0;b = i[a + 28 >> 2];if ((b | 0) >= 1) { - while (1) { - b = e << 2;i[b + w >> 2] = i[b + d >> 2];e = e + 1 | 0;b = i[a + 28 >> 2];if ((e | 0) < (b | 0)) { - continue; - }break; - } - }_(f, i[a + 76 >> 2], n, i[a + 16 >> 2], b, d);aa(n, C, D, A, i[a + 16 >> 2], i[a + 28 >> 2], i[a + 88 >> 2]);g = g + 1 | 0;d = i[a + 20 >> 2];if ((g | 0) < (d | 0)) { - e = i[a + 28 >> 2];b = i[a + 16 >> 2];continue; - }break; - }e = i[a + 28 >> 2]; - }o: { - if ((e | 0) < 1) { - break o; - }b = i[a + 68 >> 2];d = 0;while (1) { - c = d << 1;h[c + b >> 1] = k[c + E >> 1];d = d + 1 | 0;if ((d | 0) != (e | 0)) { - continue; - }break; - }if ((e | 0) < 1) { - break o; - }b = i[a + 72 >> 2];d = 0;while (1) { - c = d << 1;h[c + b >> 1] = k[c + L >> 1];d = d + 1 | 0;if ((d | 0) != (e | 0)) { - continue; - }break; - } - }i[a + 32 >> 2] = 0;a = 1; - }H = x + 16 | 0;return a | 0; - }function fc(a, b, c, d, e, f, j, l, m, n, p, q, r) { - a = a | 0;b = b | 0;c = c | 0;d = d | 0;e = e | 0;f = f | 0;j = j | 0;l = l | 0;m = m | 0;n = n | 0;p = p | 0;q = q | 0;r = r | 0;var s = 0, - t = 0, - u = 0, - v = 0, - w = 0, - x = 0, - y = 0, - z = 0, - A = 0, - B = 0, - C = 0, - D = 0, - E = 0, - F = 0, - G = 0, - I = 0, - J = 0, - K = 0, - L = 0, - M = 0, - N = 0, - O = 0, - P = 0, - Q = 0, - R = 0, - S = 0, - T = 0, - V = 0, - Y = 0, - Z = 0, - _ = 0, - $ = 0, - aa = 0, - ba = 0, - ca = 0, - da = 0, - ea = 0, - fa = 0, - ga = 0, - ha = 0, - ia = 0;R = H - 16 | 0;H = R;Y = (q | 0) < 10 ? q : 10;q = Y << 1;E = (q | 0) / 3 | 0;a: { - b: { - if (!(q + -3 >>> 0 > 2 ? (Y | 0) >= 3 : 0)) { - G = i[e + 16 >> 2];S = i[e + 8 >> 2];u = i[e + 4 >> 2];J = (p & 1) + p | 0;x = i[e >> 2];v = i[e + 12 >> 2];p = J + (x << v << 1) | 0;F = (0 - p & 3) + p | 0;N = 1 << v;q = N << 2;p = F + q | 0;B = j << 1;T = X((p & 1) + p | 0, a, B);p = B + T | 0;O = (0 - p & 3) + p | 0;p = O + (j << 2) | 0;I = (p & 1) + p | 0;c: { - if ((v | 0) == 31) { - break c; - }if ((x | 0) > 0) { - while (1) { - p = o(x, P);q = 0;while (1) { - h[I + (q << 1) >> 1] = g[S + (p + q | 0) | 0];q = q + 1 | 0;if ((x | 0) != (q | 0)) { - continue; - }break; - }t = 0;C = F + (P << 2) | 0;i[C >> 2] = 0;s = 1;v = J + (p << 1) | 0;y = 0;while (1) { - p = 0;q = 0;while (1) { - p = o(h[(y - q << 1) + m >> 1], h[I + (q << 1) >> 1]) + p | 0;q = q + 1 | 0;if ((s | 0) != (q | 0)) { - continue; - }break; - }h[v + (y << 1) >> 1] = p >>> 13;s = s + 1 | 0;p = p << 3 >> 16;t = o(p, p) + t | 0;y = y + 1 | 0;if ((x | 0) != (y | 0)) { - continue; - }break; - }i[C >> 2] = t;P = P + 1 | 0;if ((N | 0) != (P | 0)) { - continue; - }break; - }break c; - }U(F, 0, q); - }if ((u | 0) < 1) { - break b; - }p = 0;while (1) { - D = o(p, x);q = T + (D << 1) | 0;d: { - if (G) { - Ga(q, J, x, N, F, 1, R + 12 | 0, R + 8 | 0);break d; - }Ha(q, J, x, N, F, 1, R + 12 | 0, R + 8 | 0); - }W(n, i[R + 12 >> 2], G + i[e + 12 >> 2] | 0);s = i[R + 12 >> 2];t = (s | 0) < (N | 0);K = o(x, s - (t ? 0 : N) | 0);C = J + (K << 1) | 0;e: { - f: { - g: { - h: { - if (!t) { - q = 0;if ((x | 0) <= 0) { - break g; - }while (1) { - v = T + (q + D << 1) | 0;h[v >> 1] = k[C + (q << 1) >> 1] + k[v >> 1];q = q + 1 | 0;if ((x | 0) != (q | 0)) { - continue; - }break; - }break h; - }q = 0;if ((x | 0) < 1) { - break g; - }while (1) { - v = T + (q + D << 1) | 0;h[v >> 1] = k[v >> 1] - k[C + (q << 1) >> 1];q = q + 1 | 0;if ((x | 0) != (q | 0)) { - continue; - }break; - } - }i: { - if (!t) { - q = 0;if ((x | 0) <= 0) { - break g; - }while (1) { - i[O + (q + D << 2) >> 2] = 0 - (g[S + (q + K | 0) | 0] << 9);q = q + 1 | 0;if ((x | 0) != (q | 0)) { - continue; - }break; - }break i; - }q = 0;if ((x | 0) < 1) { - break g; - }while (1) { - i[O + (q + D << 2) >> 2] = g[S + (q + K | 0) | 0] << 9;q = q + 1 | 0;if ((x | 0) != (q | 0)) { - continue; - }break; - } - }if ((x | 0) > 0) { - break f; - } - }p = p + 1 | 0;break e; - }p = p + 1 | 0;q = o(x, p);w = j - q | 0;if ((w | 0) < 1) { - break e; - }z = T + (q << 1) | 0;t = 0;if ((s | 0) < (N | 0)) { - while (1) { - D = (x - t << 1) + m | 0;s = g[S + (t + K | 0) | 0] << 3;q = 0;while (1) { - C = q << 1;v = C + z | 0;h[v >> 1] = k[v >> 1] - (o(s, h[C + D >> 1]) + 32768 >>> 16 | 0);q = q + 1 | 0;if ((w | 0) != (q | 0)) { - continue; - }break; - }t = t + 1 | 0;if ((x | 0) != (t | 0)) { - continue; - }break e; - } - }while (1) { - D = (x - t << 1) + m | 0;s = g[S + (t + K | 0) | 0] << 3;q = 0;while (1) { - C = q << 1;v = C + z | 0;h[v >> 1] = k[v >> 1] - (32768 - o(s, h[C + D >> 1]) >>> 16 | 0);q = q + 1 | 0;if ((w | 0) != (q | 0)) { - continue; - }break; - }t = t + 1 | 0;if ((x | 0) != (t | 0)) { - continue; - }break; - } - }if ((p | 0) != (u | 0)) { - continue; - }break; - }break b; - }q = 0;t = (0 - p & 3) + p | 0;u = E << 2;p = t + u | 0;C = (0 - p & 3) + p | 0;p = C + u | 0;fa = (0 - p & 3) + p | 0;p = fa + u | 0;ba = (0 - p & 3) + p | 0;p = u + ba | 0;ga = (p & 1) + p | 0;A = i[e >> 2];y = i[e + 12 >> 2];p = ga + (A << y << 1) | 0;ca = (0 - p & 3) + p | 0;Q = 1 << y;D = Q << 2;p = ca + D | 0;J = (p & 1) + p | 0;V = j << 1;p = J + V | 0;da = (0 - p & 3) + p | 0;p = da + (j << 2) | 0;N = (0 - p & 3) + p | 0;L = i[e + 4 >> 2];p = N + (L << 2) | 0;w = (p & 1) + p | 0;z = w + (o(E, V) << 1) | 0;s = (E | 0) > 1 ? E : 1;S = 0 - V | 0;M = 0 - u | 0;T = i[e + 16 >> 2];ea = i[e + 8 >> 2];while (1) { - v = q << 2;p = q << 1;i[v + t >> 2] = w + (o(p, j) << 1);i[v + C >> 2] = w + (o(p | 1, j) << 1);q = q + 1 | 0;if ((s | 0) != (q | 0)) { - continue; - }break; - }q = 0;F = u + (z + (0 - z & 3) | 0) | 0;B = u + ((0 - F & 3) + F | 0) | 0;O = u + ((0 - B & 3) + B | 0) | 0;I = u + ((0 - O & 3) + O | 0) | 0;K = u + ((0 - I & 3) + I | 0) | 0;z = (0 - K & 3) + K | 0;G = z + u | 0;u = (0 - G & 3) + G | 0;w = u + (o(E, L) << 3) | 0;j: { - if ((Y | 0) <= 1) { - X(J, a, V);break j; - }s = (E | 0) > 1 ? E : 1;while (1) { - v = q << 2;p = q << 1;i[v + ba >> 2] = u + (o(p, L) << 2);i[v + fa >> 2] = u + (o(L, p | 1) << 2);q = q + 1 | 0;if ((s | 0) != (q | 0)) { - continue; - }break; - }v = X(J, a, V);if ((Y | 0) < 2) { - break j; - }p = (E | 0) > 1 ? E : 1;q = 0;while (1) { - X(i[(q << 2) + t >> 2], v, V);q = q + 1 | 0;if ((p | 0) != (q | 0)) { - continue; - }break; - } - }ha = (w & 1) + w | 0;k: { - if ((y | 0) == 31) { - break k; - }w = 0;if ((A | 0) > 0) { - while (1) { - p = o(w, A);q = 0;while (1) { - h[ha + (q << 1) >> 1] = g[ea + (p + q | 0) | 0];q = q + 1 | 0;if ((A | 0) != (q | 0)) { - continue; - }break; - }u = 0;D = ca + (w << 2) | 0;i[D >> 2] = 0;s = 1;v = (p << 1) + ga | 0;y = 0;while (1) { - p = 0;q = 0;while (1) { - p = o(h[(y - q << 1) + m >> 1], h[ha + (q << 1) >> 1]) + p | 0;q = q + 1 | 0;if ((s | 0) != (q | 0)) { - continue; - }break; - }h[v + (y << 1) >> 1] = p >>> 13;s = s + 1 | 0;p = p << 3 >> 16;u = o(p, p) + u | 0;y = y + 1 | 0;if ((A | 0) != (y | 0)) { - continue; - }break; - }i[D >> 2] = u;w = w + 1 | 0;if ((Q | 0) != (w | 0)) { - continue; - }break k; - } - }U(ca, 0, D); - }if ((Y | 0) >= 2) { - U(z, 0, ((E | 0) > 1 ? E : 1) << 2); - }l: { - if ((L | 0) < 1) { - break l; - }J = G + M | 0;_ = I + M | 0;$ = M + O | 0;ia = B + M | 0;x = F + M | 0;Z = (E | 0) > 1 ? E : 1;aa = M + K | 0;D = E + -1 | 0;O = aa + (D << 2) | 0;while (1) { - v = C;C = t;q = 0;p = (Y | 0) > 1;m: { - if (!p) { - break m; - }while (1) { - i[aa + (q << 2) >> 2] = 2147483647;q = q + 1 | 0;if ((Z | 0) != (q | 0)) { - continue; - }break; - }q = 0;if (!p) { - break m; - }while (1) { - p = q << 2;i[p + _ >> 2] = 0;i[p + $ >> 2] = 0;q = q + 1 | 0;if ((Z | 0) != (q | 0)) { - continue; - }break; - }y = (Y | 0) < 2;if (y) { - break m; - }I = o(A, P);M = 0;while (1) { - s = M << 2;t = i[s + C >> 2] + (I << 1) | 0;p = 0;q = 0;K = (A | 0) < 1;if (!K) { - while (1) { - B = p;p = h[t + (q << 1) >> 1];p = B + o(p, p) | 0;q = q + 1 | 0;if ((A | 0) != (q | 0)) { - continue; - }break; - } - }n: { - if (T) { - Ga(t, ga, A, Q, ca, E, x, ia);break n; - }Ha(t, ga, A, Q, ca, E, x, ia); - }G = p >>> 1 | 0;u = s + J | 0;t = 0;while (1) { - q = 0;w = t << 2;F = i[w + ia >> 2] + (G + i[u >> 2] | 0) | 0;o: { - if ((F | 0) >= i[O >> 2]) { - break o; - }while (1) { - z = aa + (q << 2) | 0;if ((F | 0) >= i[z >> 2]) { - q = q + 1 | 0;if ((Z | 0) != (q | 0)) { - continue; - }break o; - }break; - }s = D;p = s;if ((p | 0) > (q | 0)) { - while (1) { - B = p << 2;p = p + -1 | 0;s = p << 2;i[B + aa >> 2] = i[s + aa >> 2];i[B + $ >> 2] = i[s + $ >> 2];i[B + _ >> 2] = i[s + _ >> 2];if ((p | 0) > (q | 0)) { - continue; - }break; - }s = q; - }i[z >> 2] = F;p = s << 2;i[p + $ >> 2] = i[x + w >> 2];i[p + _ >> 2] = M; - }t = t + 1 | 0;if ((Z | 0) != (t | 0)) { - continue; - }break; - }if (P) { - M = M + 1 | 0;if ((M | 0) < (E | 0)) { - continue; - } - }break; - }if (y) { - break m; - }p = o(A, P + 1 | 0);F = j - p | 0;t = 0;while (1) { - if ((p | 0) < (j | 0)) { - q = t << 2;w = i[q + v >> 2];z = i[(i[q + _ >> 2] << 2) + C >> 2];q = p;while (1) { - s = q << 1;h[s + w >> 1] = k[s + z >> 1];q = q + 1 | 0;if ((q | 0) < (j | 0)) { - continue; - }break; - } - }p: { - if ((F | 0) < 1 | K) { - break p; - }q = t << 2;B = i[q + v >> 2] + (p << 1) | 0;q = i[q + $ >> 2];I = o(A, q - ((q | 0) < (Q | 0) ? 0 : Q) | 0);s = 0;if ((q | 0) < (Q | 0)) { - while (1) { - G = (A - s << 1) + m | 0;u = g[ea + (s + I | 0) | 0] << 3;q = 0;while (1) { - w = q << 1;z = w + B | 0;h[z >> 1] = k[z >> 1] - (o(u, h[w + G >> 1]) + 32768 >>> 16 | 0);q = q + 1 | 0;if ((F | 0) != (q | 0)) { - continue; - }break; - }s = s + 1 | 0;if ((A | 0) != (s | 0)) { - continue; - }break p; - } - }while (1) { - G = (A - s << 1) + m | 0;u = g[ea + (s + I | 0) | 0] << 3;q = 0;while (1) { - w = q << 1;z = w + B | 0;h[z >> 1] = k[z >> 1] - (32768 - o(u, h[w + G >> 1]) >>> 16 | 0);q = q + 1 | 0;if ((F | 0) != (q | 0)) { - continue; - }break; - }s = s + 1 | 0;if ((A | 0) != (s | 0)) { - continue; - }break; - } - }G = t << 2;u = G + _ | 0;w = G + ba | 0;z = i[w >> 2];q = 0;while (1) { - s = q << 2;i[s + z >> 2] = i[s + i[(i[u >> 2] << 2) + fa >> 2] >> 2];q = q + 1 | 0;if ((L | 0) != (q | 0)) { - continue; - }break; - }i[i[w >> 2] + (P << 2) >> 2] = i[G + $ >> 2];t = t + 1 | 0;if ((Z | 0) != (t | 0)) { - continue; - }break; - }t = 0;if (y) { - break m; - }while (1) { - p = t << 2;z = i[p + fa >> 2];s = i[p + ba >> 2];q = 0;while (1) { - p = q << 2;i[p + z >> 2] = i[p + s >> 2];q = q + 1 | 0;if ((L | 0) != (q | 0)) { - continue; - }break; - }t = t + 1 | 0;if ((Z | 0) != (t | 0)) { - continue; - }break; - }q = 0;if (y) { - break m; - }while (1) { - p = q << 2;i[p + J >> 2] = i[p + aa >> 2];q = q + 1 | 0;if ((Z | 0) != (q | 0)) { - continue; - }break; - } - }t = v;P = P + 1 | 0;if ((L | 0) != (P | 0)) { - continue; - }break; - }q = 0;if ((L | 0) <= 0) { - break l; - }while (1) { - m = q << 2;p = i[m + i[ba >> 2] >> 2];i[m + N >> 2] = p;W(n, p, i[e + 12 >> 2] + T | 0);q = q + 1 | 0;if ((L | 0) != (q | 0)) { - continue; - }break; - }if ((L | 0) < 1 | (A | 0) < 1) { - break l; - }u = 0;while (1) { - e = i[(u << 2) + N >> 2];n = (e | 0) < (Q | 0);m = o(A, e - (n ? 0 : Q) | 0);e = o(u, A);q = 0;p = 0;q: { - if (!n) { - while (1) { - i[da + (e + q << 2) >> 2] = 0 - (g[ea + (m + q | 0) | 0] << 9);q = q + 1 | 0;if ((A | 0) != (q | 0)) { - continue; - }break q; - } - }while (1) { - i[da + (e + p << 2) >> 2] = g[ea + (m + p | 0) | 0] << 9;p = p + 1 | 0;if ((A | 0) != (p | 0)) { - continue; - }break; - } - }u = u + 1 | 0;if ((L | 0) != (u | 0)) { - continue; - }break; - } - }r: { - if ((j | 0) >= 1) { - q = 0;while (1) { - m = q << 2;e = m + l | 0;i[e >> 2] = i[m + da >> 2] + i[e >> 2];q = q + 1 | 0;if ((q | 0) != (j | 0)) { - continue; - }break; - }if (!r) { - break a; - }y = V + ha | 0;l = S + y | 0;e = l;if ((j | 0) < 1) { - break r; - }q = 0;while (1) { - h[l + (q << 1) >> 1] = i[da + (q << 2) >> 2] + 32 >>> 6;q = q + 1 | 0;if ((q | 0) != (j | 0)) { - continue; - }break; - }ka(l, b, c, d, l, j, f, y);if ((j | 0) < 1) { - break a; - }q = 0;while (1) { - c = q << 1;b = c + a | 0;h[b >> 1] = k[b >> 1] - (h[c + l >> 1] + 2 >>> 2 | 0);q = q + 1 | 0;if ((q | 0) != (j | 0)) { - continue; - }break; - }break a; - }if (!r) { - break a; - }y = V + ha | 0;e = S + y | 0; - }ka(e, b, c, d, e, j, f, y);break a; - }n = 0 - B | 0;q = 0;if ((j | 0) > 0) { - while (1) { - m = q << 2;e = m + l | 0;i[e >> 2] = i[m + O >> 2] + i[e >> 2];q = q + 1 | 0;if ((q | 0) != (j | 0)) { - continue; - }break; - }if (!r) { - break a; - }e = B + I | 0;l = e + n | 0;q = 0;while (1) { - h[l + (q << 1) >> 1] = i[O + (q << 2) >> 2] + 32 >>> 6;q = q + 1 | 0;if ((q | 0) != (j | 0)) { - continue; - }break; - }ka(l, b, c, d, l, j, f, e);q = 0;while (1) { - c = q << 1;b = c + a | 0;h[b >> 1] = k[b >> 1] - (h[c + l >> 1] + 2 >>> 2 | 0);q = q + 1 | 0;if ((q | 0) != (j | 0)) { - continue; - }break; - }break a; - }if (!r) { - break a; - }e = B + I | 0;a = e + n | 0;ka(a, b, c, d, a, j, f, e); - }H = R + 16 | 0; - }function Sb(a, b, c, d, e, f, l, m, n, p, q, r, s, t, u, v, w, x, y, z) { - a = a | 0;b = b | 0;c = c | 0;d = d | 0;e = e | 0;f = f | 0;l = l | 0;m = m | 0;n = n | 0;p = p | 0;q = q | 0;r = r | 0;s = s | 0;t = t | 0;u = u | 0;v = v | 0;w = w | 0;x = x | 0;y = y | 0;z = z | 0;var A = 0, - B = 0, - C = 0, - D = 0, - E = 0, - F = 0, - G = 0, - I = 0, - J = 0, - K = 0, - L = 0, - M = 0, - N = 0, - O = 0, - P = 0, - Q = 0, - R = 0, - S = 0, - T = 0, - V = 0, - Y = 0, - Z = 0, - $ = 0, - ba = 0, - ca = 0, - da = 0, - ea = 0, - fa = 0, - ga = 0, - ha = 0, - ia = 0, - ja = 0, - ka = 0, - la = 0, - ma = 0, - na = 0, - oa = 0, - pa = 0, - qa = 0;B = H - 80 | 0;H = B;a: { - b: { - c: { - if ((n | 0) >= (m | 0)) { - p = (w | 0) < 10 ? w : 10;Q = (p | 0) > 1 ? p : 1;J = 0 - t & 3;A = i[l + 4 >> 2];F = i[l >> 2];if ((r | 0) <= 0) { - break b; - }w = 0;break c; - }W(s, 0, i[l + 8 >> 2]);W(s, 0, i[l + 4 >> 2]);U(f, 0, r << 2);break a; - }while (1) { - p = h[(w << 1) + a >> 1];G = p >> 31;if ((G ^ p + G) < 16384) { - w = w + 1 | 0;if ((w | 0) != (r | 0)) { - continue; - }break b; - }break; - }Z = 1; - }G = Q << 2;$ = t + J | 0;w = 0 - n | 0;d: { - if ((w | 0) >= (r | 0)) { - break d; - }while (1) { - p = h[(w << 1) + u >> 1];t = p >> 31;if ((t ^ p + t) < 16384) { - w = w + 1 | 0;if ((w | 0) != (r | 0)) { - continue; - }break d; - }break; - }Z = 1; - }t = G + $ | 0;p = (n - m | 0) + 1 | 0;da = (Q | 0) > (p | 0) ? p : Q;e: { - if ((m | 0) != (n | 0)) { - Ia(b, m, n, r, $, 0, da, t);break e; - }i[$ >> 2] = n; - }L = r << 1;R = r << 2;ea = t + (0 - t & 3) | 0;b = R + ea | 0;G = (b & 1) + b | 0;b = L + G | 0;fa = (b & 1) + b | 0;if ((da | 0) >= 1) { - na = 1 << A;ba = F + (x << 2 << A) | 0;b = L + fa | 0;F = (b & 1) + b | 0;b = F + o(r, 6) | 0;b = (b + L | 0) + (b & 1) | 0;ga = (0 - b & 3) + b | 0;ka = q << 2;K = b - L | 0;x = F + (L << 1) | 0;J = F + L | 0;b = (y | 0) > 2 ? y : 2;P = o((b | 0) < 30 ? b : 30, 655);b = r >> 2;la = r + -1 | 0;Q = !Z;oa = (A | 0) == 31;ha = -1;while (1) { - E = i[(ia << 2) + $ >> 2];pa = U(f, 0, R);N = i[z >> 2];i[B + 76 >> 2] = x;i[B + 72 >> 2] = J;i[B + 68 >> 2] = F;w = 0;n = Q;f: { - if ((r | 0) < 1) { - break f; - }while (1) { - n = w << 1;h[n + G >> 1] = k[a + n >> 1];w = w + 1 | 0;if ((w | 0) != (r | 0)) { - continue; - }break; - }t = 1 - E | 0;w = 0;while (1) { - y = (w << 1) + K | 0;p = t + w | 0;g: { - if ((p | 0) >= 0) { - p = p - E | 0;n = 0;if ((p | 0) > -1) { - break g; - } - }n = k[(p << 1) + u >> 1]; - }h[y >> 1] = n;w = w + 1 | 0;if ((w | 0) != (r | 0)) { - continue; - }break; - }w = 0;p = 0;n = 1;if (!Z) { - break f; - }while (1) { - n = (p << 1) + K | 0;h[n >> 1] = h[n >> 1] >>> 1;p = p + 1 | 0;if ((r | 0) != (p | 0)) { - continue; - }break; - }while (1) { - n = G + (w << 1) | 0;h[n >> 1] = h[n >> 1] >>> 1;w = w + 1 | 0;if ((w | 0) != (r | 0)) { - continue; - }break; - }n = 0; - }h: { - if ((q | 0) <= 0) { - _(K, c, K, r, q, ga);break h; - }p = U(ga, 0, ka);_(K, c, K, r, q, p);U(p, 0, ka); - }aa(K, d, e, K, r, q, ga);w = 0;i: { - j: { - k: { - if ((r | 0) <= 0) { - D = n ^ 1;y = E ^ -1;break k; - }while (1) { - p = w << 1;h[p + x >> 1] = k[p + K >> 1];w = w + 1 | 0;if ((w | 0) != (r | 0)) { - continue; - }break; - }D = n ^ 1;y = E ^ -1;if ((r | 0) > 1) { - break j; - } - }h[J >> 1] = o(h[v >> 1], h[u - (E << 1) >> 1] >> D) >>> 14;C = o(h[v >> 1], h[(y << 1) + u >> 1] >> D) >>> 14 | 0;h[F >> 1] = C;break i; - }t = h[u - (E << 1) >> 1] >> D;h[J >> 1] = o(t, h[v >> 1]) >>> 14;w = 0;while (1) { - n = w + 1 | 0;p = n << 1;h[p + J >> 1] = k[x + (w << 1) >> 1] + (o(t, h[p + v >> 1]) - -8192 >>> 14 | 0);w = n;if ((la | 0) != (w | 0)) { - continue; - }break; - }t = h[(y << 1) + u >> 1] >> D;C = o(t, h[v >> 1]) >>> 14 | 0;h[F >> 1] = C;w = 0;while (1) { - n = w + 1 | 0;p = n << 1;h[p + F >> 1] = k[J + (w << 1) >> 1] + (o(t, h[p + v >> 1]) - -8192 >>> 14 | 0);w = n;if ((la | 0) != (w | 0)) { - continue; - }break; - } - }S = 0;t = 0;D = 0;n = 0;y = 0;T = 0;A = 0;V = 0;Y = 0;I = 0;if (b) { - p = F;n = b;w = G;while (1) { - I = (((o(h[w + 2 >> 1], h[p + 2 >> 1]) + o(h[w >> 1], C << 16 >> 16) | 0) + o(h[w + 4 >> 1], h[p + 4 >> 1]) | 0) + o(h[w + 6 >> 1], h[p + 6 >> 1]) >> 6) + I | 0;n = n + -1 | 0;if (n) { - w = w + 8 | 0;p = p + 8 | 0;C = k[p >> 1];continue; - } else { - w = J;n = b;p = G;while (1) { - Y = (((o(h[p + 2 >> 1], h[w + 2 >> 1]) + o(h[p >> 1], h[w >> 1]) | 0) + o(h[p + 4 >> 1], h[w + 4 >> 1]) | 0) + o(h[p + 6 >> 1], h[w + 6 >> 1]) >> 6) + Y | 0;p = p + 8 | 0;w = w + 8 | 0;n = n + -1 | 0;if (n) { - continue; - }break; - }w = x;n = b;p = G;while (1) { - V = (((o(h[p + 2 >> 1], h[w + 2 >> 1]) + o(h[p >> 1], h[w >> 1]) | 0) + o(h[p + 4 >> 1], h[w + 4 >> 1]) | 0) + o(h[p + 6 >> 1], h[w + 6 >> 1]) >> 6) + V | 0;p = p + 8 | 0;w = w + 8 | 0;n = n + -1 | 0;if (n) { - continue; - }break; - }w = F;p = b;while (1) { - n = h[w + 2 >> 1];A = o(n, n);n = h[w >> 1];A = A + o(n, n) | 0;n = h[w + 4 >> 1];A = A + o(n, n) | 0;n = h[w + 6 >> 1];t = (A + o(n, n) >>> 6 | 0) + t | 0;w = w + 8 | 0;p = p + -1 | 0;if (p) { - continue; - }break; - }w = J;n = b;p = F;while (1) { - T = (((o(h[p + 2 >> 1], h[w + 2 >> 1]) + o(h[p >> 1], h[w >> 1]) | 0) + o(h[p + 4 >> 1], h[w + 4 >> 1]) | 0) + o(h[p + 6 >> 1], h[w + 6 >> 1]) >> 6) + T | 0;p = p + 8 | 0;w = w + 8 | 0;n = n + -1 | 0;if (n) { - continue; - }break; - }w = J;A = b;p = i[B + 72 >> 2];n = p;while (1) { - D = (((o(h[n + 2 >> 1], h[w + 2 >> 1]) + o(h[n >> 1], h[w >> 1]) | 0) + o(h[n + 4 >> 1], h[w + 4 >> 1]) | 0) + o(h[n + 6 >> 1], h[w + 6 >> 1]) >> 6) + D | 0;n = n + 8 | 0;w = w + 8 | 0;A = A + -1 | 0;if (A) { - continue; - }break; - }w = x;A = b;n = F;while (1) { - y = (((o(h[n + 2 >> 1], h[w + 2 >> 1]) + o(h[n >> 1], h[w >> 1]) | 0) + o(h[n + 4 >> 1], h[w + 4 >> 1]) | 0) + o(h[n + 6 >> 1], h[w + 6 >> 1]) >> 6) + y | 0;n = n + 8 | 0;w = w + 8 | 0;A = A + -1 | 0;if (A) { - continue; - }break; - }A = 0;w = x;n = b;while (1) { - A = (((o(h[p + 2 >> 1], h[w + 2 >> 1]) + o(h[p >> 1], h[w >> 1]) | 0) + o(h[p + 4 >> 1], h[w + 4 >> 1]) | 0) + o(h[p + 6 >> 1], h[w + 6 >> 1]) >> 6) + A | 0;p = p + 8 | 0;w = w + 8 | 0;n = n + -1 | 0;if (n) { - continue; - }break; - }n = 0;w = i[B + 76 >> 2];p = x;C = b;while (1) { - n = (((o(h[w + 2 >> 1], h[p + 2 >> 1]) + o(h[w >> 1], h[p >> 1]) | 0) + o(h[w + 4 >> 1], h[p + 4 >> 1]) | 0) + o(h[w + 6 >> 1], h[p + 6 >> 1]) >> 6) + n | 0;w = w + 8 | 0;p = p + 8 | 0;C = C + -1 | 0;if (C) { - continue; - }break; - } - }break; - } - }i[B + 52 >> 2] = y << 1;i[B + 48 >> 2] = T << 1;i[B + 44 >> 2] = A << 1;i[B + 40 >> 2] = I << 1;i[B + 36 >> 2] = Y << 1;i[B + 32 >> 2] = V << 1;i[B + 64 >> 2] = ((o(t & 32767, P) >>> 15 | 0) + t | 0) + o(t << 1 >> 16, P);i[B + 60 >> 2] = ((o(D & 32767, P) >>> 15 | 0) + D | 0) + o(D << 1 >> 16, P);i[B + 56 >> 2] = ((o(n & 32767, P) >>> 15 | 0) + n | 0) + o(n << 1 >> 16, P);wa(B + 32 | 0, B, 32767, 9);if (!oa) { - T = (N | 0) > 262144 ? 31 : 128;t = -2147483647;D = 0;V = h[B + 16 >> 1];Y = h[B + 14 >> 1];I = h[B + 12 >> 1];N = h[B + 10 >> 1];C = h[B + 8 >> 1];A = h[B + 6 >> 1];y = h[B + 4 >> 1];w = h[B + 2 >> 1];p = h[B >> 1];while (1) { - ca = (D << 2) + ba | 0;O = g[ca + 1 | 0] + 32 | 0;M = g[ca | 0] + 32 | 0;n = g[ca + 2 | 0] + 32 | 0;n = ((o(O, w) << 6) + (o(M, p) << 6) | 0) + (o(n, y) << 6) - (((((o(A, o(M, O) << 16 >> 16) + o(I, o(M, M) & 65535) | 0) + o(Y, o(O, O) & 65535) | 0) + o(V, o(n, n) & 65535) | 0) + o(C, o(n, O) << 16 >> 16) | 0) + o(N, o(n, M) << 16 >> 16)) | 0;M = (n | 0) > (t | 0);O = n;n = (T | 0) < g[ca + 3 | 0];t = M ? n ? t : O : t;S = M ? n ? S : D : S;D = D + 1 | 0;if ((na | 0) != (D | 0)) { - continue; - }break; - } - }p = S << 2;A = g[(p | 1) + ba | 0];n = g[(p | 2) + ba | 0];y = g[p + ba | 0];I = U(pa, 0, R);N = n + 32 | 0;C = E + 1 | 0;w = (C | 0) > (r | 0) ? r : C;if ((w | 0) > 0) { - t = N << 7;n = 0;while (1) { - p = I + (n << 2) | 0;i[p >> 2] = i[p >> 2] + o(t, h[(n - C << 1) + u >> 1]);n = n + 1 | 0;if ((w | 0) != (n | 0)) { - continue; - }break; - } - }C = C + E | 0;t = (C | 0) < (r | 0) ? C : r;if ((w | 0) < (t | 0)) { - p = N << 7;while (1) { - n = I + (w << 2) | 0;i[n >> 2] = i[n >> 2] + o(p, h[(w - C << 1) + u >> 1]);w = w + 1 | 0;if ((t | 0) != (w | 0)) { - continue; - }break; - } - }C = A + 32 | 0;w = (E | 0) > (r | 0) ? r : E;if ((w | 0) > 0) { - t = C << 7;n = 0;while (1) { - p = I + (n << 2) | 0;i[p >> 2] = i[p >> 2] + o(t, h[(n - E << 1) + u >> 1]);n = n + 1 | 0;if ((w | 0) != (n | 0)) { - continue; - }break; - } - }A = E << 1;t = (A | 0) < (r | 0) ? A : r;if ((w | 0) < (t | 0)) { - p = C << 7;while (1) { - n = I + (w << 2) | 0;i[n >> 2] = i[n >> 2] + o(p, h[(w - A << 1) + u >> 1]);w = w + 1 | 0;if ((t | 0) != (w | 0)) { - continue; - }break; - } - }A = y + 32 | 0;y = E + -1 | 0;w = (y | 0) > (r | 0) ? r : y;if ((w | 0) >= 1) { - t = A << 7;n = 0;while (1) { - p = I + (n << 2) | 0;i[p >> 2] = i[p >> 2] + o(t, h[(n - y << 1) + u >> 1]);n = n + 1 | 0;if ((w | 0) != (n | 0)) { - continue; - }break; - } - }y = y + E | 0;t = (y | 0) < (r | 0) ? y : r;if ((w | 0) < (t | 0)) { - p = A << 7;while (1) { - n = I + (w << 2) | 0;i[n >> 2] = i[n >> 2] + o(p, h[(w - y << 1) + u >> 1]);w = w + 1 | 0;if ((t | 0) != (w | 0)) { - continue; - }break; - } - }if ((r | 0) > 0) { - n = 0;while (1) { - t = n << 1;p = t + G | 0;h[p >> 1] = k[p >> 1] - (((o(C, h[t + J >> 1]) + o(A, h[t + x >> 1]) | 0) + o(N, h[t + F >> 1]) << 10) + 32768 >>> 16 | 0);n = n + 1 | 0;if ((r | 0) != (n | 0)) { - continue; - }break; - } - }n = 0;w = G;t = b;if (t) { - while (1) { - p = n;n = h[w + 2 >> 1];y = o(n, n);n = h[w >> 1];y = y + o(n, n) | 0;n = h[w + 4 >> 1];y = y + o(n, n) | 0;n = h[w + 6 >> 1];n = p + (y + o(n, n) >>> 6 | 0) | 0;w = w + 8 | 0;t = t + -1 | 0;if (t) { - continue; - }break; - } - }if (!((n | 0) >= (ha | 0) ? (ha | 0) >= 0 : 0)) { - X(ea, I, R);X(fa, G, L);ha = n;ma = S;qa = E; - }ia = ia + 1 | 0;if ((ia | 0) != (da | 0)) { - continue; - }break; - } - }W(s, qa - m | 0, i[l + 8 >> 2]);W(s, ma, i[l + 4 >> 2]);d = i[z >> 2];c = (d | 0) < 1024;b = j[i[l >> 2] + (ma << 2 | 3) | 0] << 24 >> 16;i[z >> 2] = o(b, c ? 0 : d << 3 >> 16) + (o(b, c ? 1024 : d & 8191) >> 13);X(f, ea, R);b = X(a, fa, L);if (!(!Z | (r | 0) < 1)) { - while (1) { - a = b + (ja << 1) | 0;h[a >> 1] = k[a >> 1] << 1;ja = ja + 1 | 0;if ((ja | 0) != (r | 0)) { - continue; - }break; - } - }m = E; - }H = B + 80 | 0;return m | 0; - }function ub(a, b, c, d) { - a = a | 0;b = b | 0;c = c | 0;d = d | 0;var e = 0, - f = 0, - i = 0, - j = 0, - l = 0, - m = 0, - n = 0, - p = 0, - q = 0, - r = 0, - s = 0, - t = 0, - u = 0, - v = 0, - w = 0, - x = 0, - y = 0, - z = 0;r = H - 32 | 0;H = r;a: { - b: { - if ((c | 0) < 1) { - break b; - }while (1) { - f = e << 1;h[f + b >> 1] = k[a + f >> 1];e = e + 1 | 0;if ((e | 0) != (c | 0)) { - continue; - }break; - }if ((c | 0) < 1) { - break b; - }f = h[b >> 1];n = r;l = c + -1 | 0;e = 25736;c: { - if (!l) { - break c; - }e = k[b + 2 >> 1]; - }e = e - f | 0;h[n >> 1] = 81920 / (((e << 16 >> 16 < (f | 0) ? e : f) << 16) + 19660800 >> 16);e = 1;if ((c | 0) != 1) { - while (1) { - n = e << 1;f = n + b | 0;q = k[f >> 1];m = q - k[f + -2 >> 1] << 16 >> 16;f = e + 1 | 0;e = ((e | 0) != (l | 0) ? k[(f << 1) + b >> 1] : 25736) - q | 0;h[n + r >> 1] = 81920 / (((e << 16 >> 16 < (m | 0) ? e : m) << 16) + 19660800 >> 16);e = f;if ((e | 0) != (c | 0)) { - continue; - }break; - } - }if ((c | 0) < 1) { - break b; - }e = 0;while (1) { - f = (e << 1) + b | 0;e = e + 1 | 0;h[f >> 1] = k[f >> 1] - (e << 11);if ((c | 0) != (e | 0)) { - continue; - }break; - }if ((c | 0) < 1) { - break b; - }q = 2147483647;m = 0;f = 8848;l = 0;while (1) { - n = 0;e = f;s = 0;while (1) { - p = n;n = k[(s << 1) + b >> 1] - (g[e | 0] << 5) << 16 >> 16;n = p + o(n, n) | 0;e = e + 1 | 0;s = s + 1 | 0;if ((s | 0) != (c | 0)) { - continue; - }break; - }e = (n | 0) < (q | 0);m = e ? l : m;q = e ? n : q;f = c + f | 0;l = l + 1 | 0;if ((l | 0) != 64) { - continue; - }break; - }f = o(c, m);e = 0;while (1) { - l = (e << 1) + b | 0;h[l >> 1] = k[l >> 1] - (g[(e + f | 0) + 8848 | 0] << 5);e = e + 1 | 0;if ((e | 0) != (c | 0)) { - continue; - }break; - }W(d, m, 6);e = 0;if ((c | 0) <= 0) { - break a; - }while (1) { - f = (e << 1) + b | 0;h[f >> 1] = k[f >> 1] << 1;e = e + 1 | 0;if ((e | 0) != (c | 0)) { - continue; - }break; - }break a; - }W(d, 0, 6); - }t = k[b >> 1];u = k[b + 8 >> 1];v = k[b + 6 >> 1];w = k[b + 4 >> 1];i = k[b + 2 >> 1];l = 2147483647;f = 0;e = 9488;n = h[r + 8 >> 1];q = h[r + 6 >> 1];s = h[r + 4 >> 1];y = h[r + 2 >> 1];z = h[r >> 1];m = 0;while (1) { - j = t - (g[e | 0] << 5) << 16 >> 16;j = o(j, j);p = (o(z, j & 32767) >> 15) + o(z, j << 1 >> 16) | 0;j = i - (g[e + 1 | 0] << 5) << 16 >> 16;j = o(j, j);p = (p + (o(y, j & 32767) >> 15) | 0) + o(y, j << 1 >> 16) | 0;j = w - (g[e + 2 | 0] << 5) << 16 >> 16;j = o(j, j);p = (p + (o(s, j & 32767) >> 15) | 0) + o(s, j << 1 >> 16) | 0;j = v - (g[e + 3 | 0] << 5) << 16 >> 16;j = o(j, j);p = (p + (o(q, j & 32767) >> 15) | 0) + o(q, j << 1 >> 16) | 0;j = u - (g[e + 4 | 0] << 5) << 16 >> 16;j = o(j, j);x = (p + (o(n, j & 32767) >> 15) | 0) + o(n, j << 1 >> 16) | 0;j = (x | 0) < (l | 0);l = j ? x : l;f = j ? m : f;e = e + 5 | 0;m = m + 1 | 0;if ((m | 0) != 64) { - continue; - }break; - }e = o(f, 5);h[b >> 1] = k[b >> 1] - (g[e + 9488 | 0] << 5);h[b + 2 >> 1] = k[b + 2 >> 1] - (g[e + 9489 | 0] << 5);h[b + 4 >> 1] = k[b + 4 >> 1] - (g[e + 9490 | 0] << 5);h[b + 6 >> 1] = k[b + 6 >> 1] - (g[e + 9491 | 0] << 5);h[b + 8 >> 1] = k[b + 8 >> 1] - (g[e + 9492 | 0] << 5);W(d, f, 6);j = k[b >> 1] << 1;h[b >> 1] = j;t = k[b + 2 >> 1] << 1;h[b + 2 >> 1] = t;u = k[b + 4 >> 1] << 1;h[b + 4 >> 1] = u;v = k[b + 6 >> 1] << 1;h[b + 6 >> 1] = v;w = k[b + 8 >> 1] << 1;h[b + 8 >> 1] = w;m = 2147483647;f = 0;e = 9808;l = 0;while (1) { - p = f;f = j - (g[e | 0] << 5) << 16 >> 16;f = o(f, f);i = (o(z, f & 32764) >> 15) + o(z, f << 1 >> 16) | 0;f = t - (g[e + 1 | 0] << 5) << 16 >> 16;f = o(f, f);i = (i + (o(y, f & 32764) >> 15) | 0) + o(y, f << 1 >> 16) | 0;f = u - (g[e + 2 | 0] << 5) << 16 >> 16;f = o(f, f);i = (i + (o(s, f & 32764) >> 15) | 0) + o(s, f << 1 >> 16) | 0;f = v - (g[e + 3 | 0] << 5) << 16 >> 16;f = o(f, f);i = (i + (o(q, f & 32764) >> 15) | 0) + o(q, f << 1 >> 16) | 0;f = w - (g[e + 4 | 0] << 5) << 16 >> 16;f = o(f, f);i = (i + (o(n, f & 32764) >> 15) | 0) + o(n, f << 1 >> 16) | 0;x = (i | 0) < (m | 0);f = x ? l : p;l = l + 1 | 0;if ((l | 0) != 64) { - m = x ? i : m;e = e + 5 | 0;continue; - }break; - }e = o(f, 5);h[b + 8 >> 1] = w - (g[e + 9812 | 0] << 5);h[b + 6 >> 1] = v - (g[e + 9811 | 0] << 5);h[b + 4 >> 1] = u - (g[e + 9810 | 0] << 5);h[b + 2 >> 1] = t - (g[e + 9809 | 0] << 5);h[b >> 1] = j - (g[e + 9808 | 0] << 5);W(d, f, 6);j = k[b + 10 >> 1];t = k[b + 18 >> 1];u = k[b + 16 >> 1];v = k[b + 14 >> 1];w = k[b + 12 >> 1];l = 2147483647;f = 0;e = 10128;n = h[r + 18 >> 1];q = h[r + 16 >> 1];s = h[r + 14 >> 1];y = h[r + 12 >> 1];z = h[r + 10 >> 1];m = 0;while (1) { - i = j - (g[e | 0] << 5) << 16 >> 16;i = o(i, i);p = (o(z, i & 32767) >> 15) + o(z, i << 1 >> 16) | 0;i = w - (g[e + 1 | 0] << 5) << 16 >> 16;i = o(i, i);p = (p + (o(y, i & 32767) >> 15) | 0) + o(y, i << 1 >> 16) | 0;i = v - (g[e + 2 | 0] << 5) << 16 >> 16;i = o(i, i);p = (p + (o(s, i & 32767) >> 15) | 0) + o(s, i << 1 >> 16) | 0;i = u - (g[e + 3 | 0] << 5) << 16 >> 16;i = o(i, i);p = (p + (o(q, i & 32767) >> 15) | 0) + o(q, i << 1 >> 16) | 0;i = t - (g[e + 4 | 0] << 5) << 16 >> 16;i = o(i, i);x = (p + (o(n, i & 32767) >> 15) | 0) + o(n, i << 1 >> 16) | 0;i = (x | 0) < (l | 0);l = i ? x : l;f = i ? m : f;e = e + 5 | 0;m = m + 1 | 0;if ((m | 0) != 64) { - continue; - }break; - }e = o(f, 5);h[b + 18 >> 1] = t - (g[e + 10132 | 0] << 5);h[b + 16 >> 1] = u - (g[e + 10131 | 0] << 5);h[b + 14 >> 1] = v - (g[e + 10130 | 0] << 5);h[b + 12 >> 1] = w - (g[e + 10129 | 0] << 5);h[b + 10 >> 1] = j - (g[e + 10128 | 0] << 5);W(d, f, 6);j = k[b + 10 >> 1] << 1;h[b + 10 >> 1] = j;t = k[b + 12 >> 1] << 1;h[b + 12 >> 1] = t;u = k[b + 14 >> 1] << 1;h[b + 14 >> 1] = u;v = k[b + 16 >> 1] << 1;h[b + 16 >> 1] = v;w = k[b + 18 >> 1] << 1;h[b + 18 >> 1] = w;m = 2147483647;f = 0;e = 10448;l = 0;while (1) { - p = f;f = j - (g[e | 0] << 5) << 16 >> 16;f = o(f, f);i = (o(z, f & 32764) >> 15) + o(z, f << 1 >> 16) | 0;f = t - (g[e + 1 | 0] << 5) << 16 >> 16;f = o(f, f);i = (i + (o(y, f & 32764) >> 15) | 0) + o(y, f << 1 >> 16) | 0;f = u - (g[e + 2 | 0] << 5) << 16 >> 16;f = o(f, f);i = (i + (o(s, f & 32764) >> 15) | 0) + o(s, f << 1 >> 16) | 0;f = v - (g[e + 3 | 0] << 5) << 16 >> 16;f = o(f, f);i = (i + (o(q, f & 32764) >> 15) | 0) + o(q, f << 1 >> 16) | 0;f = w - (g[e + 4 | 0] << 5) << 16 >> 16;f = o(f, f);i = (i + (o(n, f & 32764) >> 15) | 0) + o(n, f << 1 >> 16) | 0;x = (i | 0) < (m | 0);f = x ? l : p;l = l + 1 | 0;if ((l | 0) != 64) { - m = x ? i : m;e = e + 5 | 0;continue; - }break; - }e = o(f, 5);h[b + 18 >> 1] = w - (g[e + 10452 | 0] << 5);h[b + 16 >> 1] = v - (g[e + 10451 | 0] << 5);h[b + 14 >> 1] = u - (g[e + 10450 | 0] << 5);h[b + 12 >> 1] = t - (g[e + 10449 | 0] << 5);h[b + 10 >> 1] = j - (g[e + 10448 | 0] << 5);W(d, f, 6);e = 0;d: { - if ((c | 0) <= 0) { - break d; - }while (1) { - d = (e << 1) + b | 0;h[d >> 1] = h[d >> 1] + 2 >>> 2;e = e + 1 | 0;if ((e | 0) != (c | 0)) { - continue; - }break; - }e = 0;if ((c | 0) <= 0) { - break d; - }while (1) { - d = e << 1;f = d + b | 0;h[f >> 1] = k[a + d >> 1] - k[f >> 1];e = e + 1 | 0;if ((e | 0) != (c | 0)) { - continue; - }break; - } - }H = r + 32 | 0; - }function ra(a, b, c, d, e) { - var f = 0, - k = 0, - l = 0, - m = 0, - p = 0, - q = 0, - r = 0, - s = 0, - t = 0, - u = 0, - v = 0, - w = 0, - x = 0, - y = 0, - z = 0;f = H - 80 | 0;H = f;i[f + 76 >> 2] = b;z = f + 55 | 0;w = f + 56 | 0;b = 0;a: { - b: while (1) { - c: { - if ((t | 0) < 0) { - break c; - }if ((b | 0) > (2147483647 - t | 0)) { - i[3790] = 61;t = -1;break c; - }t = b + t | 0; - }d: { - e: { - f: { - p = i[f + 76 >> 2];b = p;l = j[b | 0];if (l) { - while (1) { - g: { - k = l & 255;h: { - if (!k) { - l = b;break h; - }if ((k | 0) != 37) { - break g; - }l = b;while (1) { - if (j[b + 1 | 0] != 37) { - break h; - }k = b + 2 | 0;i[f + 76 >> 2] = k;l = l + 1 | 0;m = j[b + 2 | 0];b = k;if ((m | 0) == 37) { - continue; - }break; - } - }b = l - p | 0;if (a) { - ja(a, p, b); - }if (b) { - continue b; - }u = -1;l = 1;k = f;b = i[f + 76 >> 2];if (!(j[b + 2 | 0] != 36 | g[i[f + 76 >> 2] + 1 | 0] + -48 >>> 0 >= 10)) { - u = g[b + 1 | 0] + -48 | 0;x = 1;l = 3; - }b = l + b | 0;i[k + 76 >> 2] = b;l = 0;v = g[b | 0];m = v + -32 | 0;i: { - if (m >>> 0 > 31) { - k = b;break i; - }k = b;m = 1 << m;if (!(m & 75913)) { - break i; - }while (1) { - k = b + 1 | 0;i[f + 76 >> 2] = k;l = l | m;v = g[b + 1 | 0];m = v + -32 | 0;if (m >>> 0 > 31) { - break i; - }b = k;m = 1 << m;if (m & 75913) { - continue; - }break; - } - }j: { - if ((v | 0) == 42) { - m = f;k: { - l: { - if (g[k + 1 | 0] + -48 >>> 0 >= 10) { - break l; - }b = i[f + 76 >> 2];if (j[b + 2 | 0] != 36) { - break l; - }i[((g[b + 1 | 0] << 2) + e | 0) + -192 >> 2] = 10;r = i[((g[b + 1 | 0] << 3) + d | 0) + -384 >> 2];x = 1;b = b + 3 | 0;break k; - }if (x) { - break f; - }x = 0;r = 0;if (a) { - b = i[c >> 2];i[c >> 2] = b + 4;r = i[b >> 2]; - }b = i[f + 76 >> 2] + 1 | 0; - }i[m + 76 >> 2] = b;if ((r | 0) > -1) { - break j; - }r = 0 - r | 0;l = l | 8192;break j; - }r = za(f + 76 | 0);if ((r | 0) < 0) { - break f; - }b = i[f + 76 >> 2]; - }q = -1;m: { - if (j[b | 0] != 46) { - break m; - }if (j[b + 1 | 0] == 42) { - n: { - if (g[b + 2 | 0] + -48 >>> 0 >= 10) { - break n; - }b = i[f + 76 >> 2];if (j[b + 3 | 0] != 36) { - break n; - }i[((g[b + 2 | 0] << 2) + e | 0) + -192 >> 2] = 10;q = i[((g[b + 2 | 0] << 3) + d | 0) + -384 >> 2];b = b + 4 | 0;i[f + 76 >> 2] = b;break m; - }if (x) { - break f; - }if (a) { - b = i[c >> 2];i[c >> 2] = b + 4;q = i[b >> 2]; - } else { - q = 0; - }b = i[f + 76 >> 2] + 2 | 0;i[f + 76 >> 2] = b;break m; - }i[f + 76 >> 2] = b + 1;q = za(f + 76 | 0);b = i[f + 76 >> 2]; - }k = 0;while (1) { - y = k;s = -1;if (g[b | 0] + -65 >>> 0 > 57) { - break a; - }v = b + 1 | 0;i[f + 76 >> 2] = v;k = g[b | 0];b = v;k = j[(k + o(y, 58) | 0) + 14063 | 0];if (k + -1 >>> 0 < 8) { - continue; - }break; - }if (!k) { - break a; - }o: { - p: { - q: { - if ((k | 0) == 19) { - if ((u | 0) <= -1) { - break q; - }break a; - }if ((u | 0) < 0) { - break p; - }i[(u << 2) + e >> 2] = k;b = (u << 3) + d | 0;k = i[b + 4 >> 2];i[f + 64 >> 2] = i[b >> 2];i[f + 68 >> 2] = k; - }b = 0;if (!a) { - continue b; - }break o; - }if (!a) { - break d; - }ya(f - -64 | 0, k, c);v = i[f + 76 >> 2]; - }m = l & -65537;l = l & 8192 ? m : l;s = 0;u = 14100;k = w;r: { - s: { - t: { - u: { - v: { - w: { - x: { - y: { - z: { - A: { - B: { - C: { - D: { - E: { - F: { - G: { - b = g[v + -1 | 0];b = y ? (b & 15) == 3 ? b & -33 : b : b;switch (b + -88 | 0) {case 11: - break r;case 9:case 13:case 14:case 15: - break s;case 27: - break x;case 12:case 17: - break A;case 23: - break B;case 0:case 32: - break C;case 24: - break D;case 22: - break E;case 29: - break F;case 1:case 2:case 3:case 4:case 5:case 6:case 7:case 8:case 10:case 16:case 18:case 19:case 20:case 21:case 25:case 26:case 28:case 30:case 31: - break e;default: - break G;} - }H: { - switch (b + -65 | 0) {case 0:case 4:case 5:case 6: - break s;case 2: - break v;case 1:case 3: - break e;default: - break H;} - }if ((b | 0) == 83) { - break w; - }break e; - }b = i[f + 64 >> 2];p = i[f + 68 >> 2];u = 14100;break z; - }b = 0;I: { - switch (y & 255) {case 0: - i[i[f + 64 >> 2] >> 2] = t;continue b;case 1: - i[i[f + 64 >> 2] >> 2] = t;continue b;case 2: - k = i[f + 64 >> 2];i[k >> 2] = t;i[k + 4 >> 2] = t >> 31;continue b;case 3: - h[i[f + 64 >> 2] >> 1] = t;continue b;case 4: - g[i[f + 64 >> 2]] = t;continue b;case 6: - i[i[f + 64 >> 2] >> 2] = t;continue b;case 7: - break I;default: - continue b;} - }k = i[f + 64 >> 2];i[k >> 2] = t;i[k + 4 >> 2] = t >> 31;continue b; - }q = q >>> 0 > 8 ? q : 8;l = l | 8;b = 120; - }p = Wa(i[f + 64 >> 2], i[f + 68 >> 2], w, b & 32);if (!(l & 8) | !(i[f + 64 >> 2] | i[f + 68 >> 2])) { - break y; - }u = (b >>> 4 | 0) + 14100 | 0;s = 2;break y; - }p = Va(i[f + 64 >> 2], i[f + 68 >> 2], w);if (!(l & 8)) { - break y; - }b = w - p | 0;q = (q | 0) > (b | 0) ? q : b + 1 | 0;break y; - }m = i[f + 68 >> 2];p = m;b = i[f + 64 >> 2];if ((m | 0) < -1 ? 1 : (m | 0) <= -1) { - p = 0 - (p + (0 < b >>> 0) | 0) | 0;b = 0 - b | 0;i[f + 64 >> 2] = b;i[f + 68 >> 2] = p;s = 1;u = 14100;break z; - }if (l & 2048) { - s = 1;u = 14101;break z; - }s = l & 1;u = s ? 14102 : 14100; - }p = Ua(b, p, w); - }l = (q | 0) > -1 ? l & -65537 : l;b = i[f + 64 >> 2];m = i[f + 68 >> 2];if (!(!!(b | m) | q)) { - q = 0;p = w;break e; - }b = !(b | m) + (w - p | 0) | 0;q = (q | 0) > (b | 0) ? q : b;break e; - }b = i[f + 64 >> 2];p = b ? b : 14110;b = Ta(p, q);k = b ? b : p + q | 0;l = m;q = b ? b - p | 0 : q;break e; - }k = i[f + 64 >> 2];if (q) { - break u; - }b = 0;ea(a, 32, r, 0, l);break t; - }i[f + 12 >> 2] = 0;i[f + 8 >> 2] = i[f + 64 >> 2];i[f + 64 >> 2] = f + 8;q = -1;k = f + 8 | 0; - }b = 0;J: { - while (1) { - p = i[k >> 2];if (!p) { - break J; - }p = Qa(f + 4 | 0, p);m = (p | 0) < 0;if (!(m | p >>> 0 > q - b >>> 0)) { - k = k + 4 | 0;b = b + p | 0;if (q >>> 0 > b >>> 0) { - continue; - }break J; - }break; - }s = -1;if (m) { - break a; - } - }ea(a, 32, r, b, l);if (!b) { - b = 0;break t; - }m = 0;k = i[f + 64 >> 2];while (1) { - p = i[k >> 2];if (!p) { - break t; - }p = Qa(f + 4 | 0, p);m = p + m | 0;if ((m | 0) > (b | 0)) { - break t; - }ja(a, f + 4 | 0, p);k = k + 4 | 0;if (m >>> 0 < b >>> 0) { - continue; - }break; - } - }ea(a, 32, r, b, l ^ 8192);b = (r | 0) > (b | 0) ? r : b;continue b; - }b = J[0](a, n[f + 64 >> 3], r, q, l, b) | 0;continue b; - }g[f + 55 | 0] = i[f + 64 >> 2];q = 1;p = z;l = m;break e; - }k = b + 1 | 0;i[f + 76 >> 2] = k;l = j[b + 1 | 0];b = k;continue; - } - }s = t;if (a) { - break a; - }if (!x) { - break d; - }b = 1;while (1) { - a = i[(b << 2) + e >> 2];if (a) { - ya((b << 3) + d | 0, a, c);s = 1;b = b + 1 | 0;if ((b | 0) != 10) { - continue; - }break a; - }break; - }s = 1;if (b >>> 0 >= 10) { - break a; - }while (1) { - if (i[(b << 2) + e >> 2]) { - break f; - }b = b + 1 | 0;if ((b | 0) != 10) { - continue; - }break; - }break a; - }s = -1;break a; - }m = k - p | 0;q = (q | 0) < (m | 0) ? m : q;k = q + s | 0;b = (r | 0) < (k | 0) ? k : r;ea(a, 32, b, k, l);ja(a, u, s);ea(a, 48, b, k, l ^ 65536);ea(a, 48, q, m, 0);ja(a, p, m);ea(a, 32, b, k, l ^ 8192);continue; - }break; - }s = 0; - }H = f + 80 | 0;return s; - }function jb(a, b, c) { - a = a | 0;b = b | 0;c = c | 0;var d = 0, - e = 0, - f = 0, - g = 0, - j = 0, - l = 0, - m = 0, - n = 0, - p = 0, - q = 0, - r = 0, - s = 0, - t = 0, - u = 0, - v = 0, - w = 0, - x = 0, - y = 0, - z = 0, - A = 0, - B = 0, - C = 0, - D = 0, - E = 0;r = H - 16 | 0;H = r;j = i[a + 40 >> 2];E = i[i[a >> 2] >> 2];e = i[a + 4 >> 2];C = (i[a + 12 >> 2] << 1) + c | 0;J[i[i[e >> 2] + 48 >> 2]](e, 104, C) | 0;e = i[a + 4 >> 2];e = J[i[i[e >> 2] + 40 >> 2]](e, b, c) | 0;f = i[a + 4 >> 2];J[i[i[f >> 2] + 48 >> 2]](f, 103, r + 12 | 0) | 0;a: { - if (e) { - break a; - }if (!b) { - Ca(a, c, i[r + 12 >> 2], j);e = 0;break a; - }b: { - if (!i[a + 88 >> 2]) { - d = i[a + 96 >> 2];break b; - }c: { - if (((i[b + 20 >> 2] ? -1 : (i[b + 4 >> 2] - i[b + 12 >> 2] | 0) - (i[b + 8 >> 2] << 3) | 0) | 0) >= 1) { - if (Fb(b)) { - break c; - } - }i[a + 96 >> 2] = 0;break b; - }V(b, 1);d = V(b, 3);i[a + 96 >> 2] = d;if (!d) { - d = 0;break b; - }if (i[i[a + 92 >> 2] + (d << 2) >> 2]) { - break b; - }i[r >> 2] = 13072;Y(i[3524], 13148, r);e = -2;break a; - }d: { - if (!i[i[a + 92 >> 2] + (d << 2) >> 2]) { - if (i[r + 12 >> 2]) { - break d; - }d = 0;b = i[a + 12 >> 2];if ((b | 0) > 0) { - while (1) { - h[(b + d << 1) + c >> 1] = 0;d = d + 1 | 0;if ((b | 0) != (d | 0)) { - continue; - }break; - } - }i[a + 28 >> 2] = 1;d = (b << 1) + c | 0;_(d, i[a + 60 >> 2], d, b, i[a + 24 >> 2], i[a + 64 >> 2]);ua(c, (i[a + 12 >> 2] << 1) + c | 0, c, i[a + 8 >> 2], i[a + 44 >> 2], i[a + 48 >> 2], j);e = 0;break a; - }d = i[a + 20 >> 2];e = i[a + 4 >> 2];A = j + (0 - j & 3) | 0;J[i[i[e >> 2] + 48 >> 2]](e, 100, A) | 0;e = i[a + 4 >> 2];j = (d << 2) + A | 0;B = (j & 1) + j | 0;J[i[i[e >> 2] + 48 >> 2]](e, 101, B) | 0;d = (d << 1) + B | 0;u = (d & 1) + d | 0;d = i[a + 24 >> 2];J[i[i[i[a + 92 >> 2] + (i[a + 96 >> 2] << 2) >> 2] + 20 >> 2]](u, d, b);d = d << 1;e = d + u | 0;x = (e & 1) + e | 0;j = x + d | 0;e = i[a + 24 >> 2];if (!(!i[a + 28 >> 2] | (e | 0) < 1)) { - f = i[a + 56 >> 2];d = 0;while (1) { - n = d << 1;h[n + f >> 1] = k[n + u >> 1];d = d + 1 | 0;if ((e | 0) != (d | 0)) { - continue; - }break; - } - }v = j + (j & 1) | 0;j = v + (e << 1) | 0;d = i[a + 20 >> 2];if ((d | 0) >= 1) { - D = a + 84 | 0;n = 0;while (1) { - g = (0 - j & 3) + j | 0;e = i[a + 16 >> 2];f = e << 2;j = g + f | 0;l = o(e, n);m = i[a + 12 >> 2];s = 0;e = i[a + 76 >> 2];if (e) { - s = e + (l << 2) | 0;U(s, 0, f);d = i[a + 20 >> 2]; - }fa(i[a + 56 >> 2], u, x, i[a + 24 >> 2], n, d);ga(x, i[a + 24 >> 2], 410);ha(x, v, i[a + 24 >> 2], j);f = 8192;p = n << 2;y = p + i[a + 68 >> 2] | 0;i[y >> 2] = 8192;d = 0;e = 8192;if (i[a + 24 >> 2] >= 1) { - while (1) { - q = f;f = d << 1;z = h[f + v >> 1];w = h[(f | 2) + v >> 1];f = q + (z + w | 0) | 0;i[y >> 2] = f;e = (e + w | 0) - z | 0;d = d + 2 | 0;if ((d | 0) < i[a + 24 >> 2]) { - continue; - }break; - } - }y = l << 1;z = (m << 1) + c | 0;d = i[p + A >> 2];f = U(g, 0, i[a + 16 >> 2] << 2);q = d << 7;d = e + 82 | 0;d = ((q + (d << 16 >> 17) | 0) + 10496 | 0) / (d | 0) | 0;d = (d | 0) > -32767 ? d : -32767;d = (d | 0) < 32767 ? d : 32767;e: { - if (!i[i[i[a + 92 >> 2] + (i[a + 96 >> 2] << 2) >> 2] + 40 >> 2]) { - g = (V(b, 5) << 16) + 16121856 | 0;m = g << 8 >> 16;e = 2147483647;f: { - if ((m | 0) > 21290) { - break f; - }e = 0;if (g >>> 8 << 16 >> 16 < -21290) { - break f; - }g = o(m, 23637) - -8192 | 0;e = g >>> 11 & 16376;e = (o((o((o(e, 1301) >>> 14 | 0) + 3726 | 0, e) << 2 & 536805376) + 744226816 >>> 16 | 0, e) << 2 & 2147418112) + 1073741824 >>> 16 | 0;g = g << 2;m = -2 - (g >> 27) | 0;e = g >> 16 < -4096 ? e >>> m | 0 : e << 0 - m; - }if (i[a + 16 >> 2] < 1) { - break e; - }d = ((d >> 1) + e | 0) / (d | 0) | 0;e = d << 6 & 32704;g = d << 7 >> 16;m = h[E + 22 >> 1] << 1;d = 0;while (1) { - p = d << 2;w = (d + l << 1) + C | 0;q = o(m, h[w >> 1]) >> 16;i[p + f >> 2] = (o(e, q) + 16384 >> 15) + o(g, q) << 14;q = f + (p | 4) | 0;p = o(m, h[w + 2 >> 1]) >> 16;i[q >> 2] = 0 - ((o(p, e) + 16384 >> 15) + o(g, p) << 14);d = d + 2 | 0;if ((d | 0) < i[a + 16 >> 2]) { - continue; - }break; - }break e; - }e = o(h[(V(b, 4) << 1) + 13040 >> 1], 28626) >>> 15 | 0;l = h[(n << 1) + B >> 1];g = i[a + 16 >> 2];if ((g | 0) == 80) { - e = o(e << 16 >> 16, 23170) - -8192 >> 14; - }m = i[i[a + 92 >> 2] + (i[a + 96 >> 2] << 2) >> 2];J[i[m + 40 >> 2]](f, i[m + 44 >> 2], g, b, j, D);l = ((o(l, e << 16 >> 16) << 3) + (d >> 1) | 0) / (d | 0) | 0;g = l << 11;da(f, f, g, i[a + 16 >> 2]);if (!i[i[i[a + 92 >> 2] + (i[a + 96 >> 2] << 2) >> 2] + 12 >> 2]) { - break e; - }d = 0;m = i[a + 16 >> 2] << 2;e = U((0 - j & 3) + j | 0, 0, m);p = i[i[a + 92 >> 2] + (i[a + 96 >> 2] << 2) >> 2];J[i[p + 40 >> 2]](e, i[p + 44 >> 2], i[a + 16 >> 2], b, e + m | 0, D);da(e, e, o(l << 12 >> 16, 13107) + (o(g & 30720, 13107) + 16384 >>> 15 | 0) | 0, i[a + 16 >> 2]);if (i[a + 16 >> 2] < 1) { - break e; - }while (1) { - l = d << 2;g = l + f | 0;i[g >> 2] = i[e + l >> 2] + i[g >> 2];d = d + 1 | 0;if ((d | 0) < i[a + 16 >> 2]) { - continue; - }break; - } - }l = y + z | 0;e = i[a + 16 >> 2];g: { - if (!i[a + 76 >> 2]) { - break g; - }d = 0;if ((e | 0) < 1) { - break g; - }while (1) { - g = d << 2;h[g + s >> 1] = i[f + g >> 2] - -8192 >>> 14;d = d + 1 | 0;if ((e | 0) != (d | 0)) { - continue; - }break; - } - }_(i[a + 52 >> 2], i[a + 60 >> 2], l, e, i[a + 24 >> 2], i[a + 64 >> 2]);e = i[a + 16 >> 2];if ((e | 0) >= 1) { - l = i[a + 52 >> 2];d = 0;while (1) { - h[l + (d << 1) >> 1] = i[f + (d << 2) >> 2] - -8192 >>> 14;d = d + 1 | 0;if ((e | 0) != (d | 0)) { - continue; - }break; - } - }f = i[a + 24 >> 2];if ((f | 0) >= 1) { - l = i[a + 60 >> 2];d = 0;while (1) { - s = d << 1;h[s + l >> 1] = k[v + s >> 1];d = d + 1 | 0;if ((f | 0) != (d | 0)) { - continue; - }break; - } - }d = Z(i[a + 52 >> 2], e);h[i[a + 72 >> 2] + (n << 1) >> 1] = d;e = o(d, d);d = i[a + 20 >> 2];t = ((e | 0) / (d | 0) | 0) + t | 0;n = n + 1 | 0;if ((n | 0) < (d | 0)) { - continue; - }break; - } - }e = 0;b = t >>> 0 > 65535;d = b << 3;q = d | 4;f = d;b = b ? t >>> 16 | 0 : t;d = b >>> 0 > 255;f = d ? q : f;b = d ? b >>> 8 | 0 : b;d = b >>> 0 > 15;b = (d ? f | 2 : f) | (d ? b >>> 4 | 0 : b) >>> 0 > 3;d = b << 1;f = b & 65535;d = (f >>> 0 > 6 ? t >> d + -12 : t << 12 - d) << 16 >> 16;d = (o((o(o(d, 16816) + -827523072 >> 16, d) << 2 & -65536) + 1387593728 >> 16, d) << 2 & -65536) + 238157824 >> 16;b = 13 - b | 0;h[a + 80 >> 1] = f >>> 0 < 13 ? d >> b : d << 0 - b;ua(c, (i[a + 12 >> 2] << 1) + c | 0, c, i[a + 8 >> 2], i[a + 44 >> 2], i[a + 48 >> 2], j);b = i[a + 24 >> 2];if ((b | 0) >= 1) { - c = i[a + 56 >> 2];d = 0;while (1) { - j = d << 1;h[j + c >> 1] = k[j + u >> 1];d = d + 1 | 0;if ((b | 0) != (d | 0)) { - continue; - }break; - } - }i[a + 28 >> 2] = 0;break a; - }Ca(a, c, 1, j);e = 0; - }H = r + 16 | 0;return e | 0; - }function ib(a, b, c) { - a = a | 0;b = b | 0;c = c | 0;var d = 0, - e = 0, - f = 0, - g = 0, - j = p(0), - l = p(0), - n = 0;e = H - 32 | 0;H = e;a: { - b: { - c: { - d: { - e: { - f: { - g: { - h: { - switch (b + -3 | 0) {case 98: - d = i[a + 20 >> 2];if ((d | 0) >= 1) { - break g; - }b = 0;break a;case 0: - i[c >> 2] = i[a + 8 >> 2];b = 0;break a;case 7: - b = i[c >> 2];i[a + 156 >> 2] = b;i[a + 152 >> 2] = b;b = 0;break a;case 5: - a = i[a + 4 >> 2];J[i[i[a >> 2] + 44 >> 2]](a, 8, c) | 0;b = 0;break a;case 31: - a = i[a + 4 >> 2];J[i[i[a >> 2] + 44 >> 2]](a, 34, c) | 0;b = 0;break a;case 32: - a = i[a + 4 >> 2];J[i[i[a >> 2] + 44 >> 2]](a, 35, c) | 0;b = 0;break a;case 6: - a = i[a + 4 >> 2];J[i[i[a >> 2] + 44 >> 2]](a, 9, c) | 0;b = 0;break a;case 3: - J[i[i[a >> 2] + 44 >> 2]](a, 4, c) | 0;b = 0;break a;case 9: - i[a + 108 >> 2] = i[c >> 2];a = i[a + 4 >> 2];J[i[i[a >> 2] + 44 >> 2]](a, 12, c) | 0;b = 0;break a;case 10: - i[c >> 2] = i[a + 108 >> 2];b = 0;break a;case 27: - i[a + 136 >> 2] = i[c >> 2];a = i[a + 4 >> 2];J[i[i[a >> 2] + 44 >> 2]](a, 30, c) | 0;b = 0;break a;case 28: - i[c >> 2] = i[a + 136 >> 2];b = 0;break a;case 11: - j = m[c >> 2];l = p(+j + .6);m[e + 24 >> 2] = l;m[a + 104 >> 2] = j;if (!(l > p(10) ^ 1)) { - i[e + 24 >> 2] = 1092616192; - }b = e;n = u(+m[c >> 2] + .5);i: { - if (q(n) < 2147483648) { - c = ~~n;break i; - }c = -2147483648; - }i[b + 28 >> 2] = (c | 0) < 10 ? c : 10;b = i[a + 4 >> 2];J[i[i[b >> 2] + 44 >> 2]](b, 14, e + 24 | 0) | 0;J[i[i[a >> 2] + 44 >> 2]](a, 4, e + 28 | 0) | 0;b = 0;break a;case 12: - i[c >> 2] = i[a + 104 >> 2];b = 0;break a;case 29: - d = i[c >> 2];i[a + 120 >> 2] = d;b = 0;i[a + 108 >> 2] = (d | 0) != 0;d = i[a + 4 >> 2];J[i[i[d >> 2] + 44 >> 2]](d, 12, a + 108 | 0) | 0;if (!i[a + 108 >> 2]) { - break a; - }i[e + 28 >> 2] = 10;c = i[c >> 2];while (1) { - j: { - J[i[i[a >> 2] + 44 >> 2]](a, 4, e + 28 | 0) | 0;J[i[i[a >> 2] + 44 >> 2]](a, 19, e + 24 | 0) | 0;b = i[e + 28 >> 2];if (i[e + 24 >> 2] <= (c | 0)) { - d = b;break j; - }d = b + -1 | 0;i[e + 28 >> 2] = d;if ((b | 0) > 0) { - continue; - } - }break; - }b = 0;m[e + 20 >> 2] = ((d | 0) > 0 ? d : 0) | 0;J[i[i[a >> 2] + 44 >> 2]](a, 14, e + 20 | 0) | 0;i[a + 124 >> 2] = 0;i[a + 128 >> 2] = 0;i[a + 132 >> 2] = 0;break a;case 30: - i[c >> 2] = i[a + 120 >> 2];b = 0;break a;case 1: - b = 0;c = i[c >> 2];c = (c | 0) > 0 ? c : 0;c = i[i[a >> 2] >> 2] + (((c | 0) < 10 ? c : 10) << 2) | 0;d = i[c + 104 >> 2];i[a + 156 >> 2] = d;i[a + 152 >> 2] = d;i[e + 28 >> 2] = i[c + 60 >> 2];a = i[a + 4 >> 2];J[i[i[a >> 2] + 44 >> 2]](a, 6, e + 28 | 0) | 0;break a;case 13: - b = i[a + 4 >> 2];J[i[i[b >> 2] + 44 >> 2]](b, 16, c) | 0;b = a;a = i[c >> 2];i[b + 160 >> 2] = (a | 0) > 1 ? a : 1;H = e + 32 | 0;return 0;case 14: - i[c >> 2] = i[a + 160 >> 2];b = 0;break a;case 15: - i[e + 28 >> 2] = 10;b = i[c >> 2];while (1) { - k: { - J[i[i[a >> 2] + 44 >> 2]](a, 4, e + 28 | 0) | 0;J[i[i[a >> 2] + 44 >> 2]](a, 19, e + 24 | 0) | 0;if (i[e + 24 >> 2] <= (b | 0)) { - break k; - }c = i[e + 28 >> 2];i[e + 28 >> 2] = c + -1;if ((c | 0) > 0) { - continue; - } - }break; - }b = 0;break a;case 16: - b = i[a + 4 >> 2];J[i[i[b >> 2] + 44 >> 2]](b, 19, c) | 0;b = i[a + 164 >> 2];d = i[i[a + 148 >> 2] + (i[a + 152 >> 2] << 2) >> 2];if (d) { - i[c >> 2] = i[c >> 2] + ((o(b, i[d + 52 >> 2]) | 0) / i[a + 8 >> 2] | 0);b = 0;break a; - }i[c >> 2] = i[c >> 2] + ((b << 2) / i[a + 8 >> 2] | 0);b = 0;break a;case 21: - b = i[c >> 2];i[a + 164 >> 2] = b;i[e + 28 >> 2] = b >> 1;a = i[a + 4 >> 2];J[i[i[a >> 2] + 44 >> 2]](a, 24, e + 28 | 0) | 0;b = 0;break a;case 22: - i[c >> 2] = i[a + 164 >> 2];b = 0;break a;case 23: - i[a + 32 >> 2] = 1;b = i[a + 28 >> 2];l: { - if ((b | 0) < 1) { - break l; - }d = b + 1 | 0;f = i[a + 68 >> 2];c = 0;while (1) { - g = f + (c << 1) | 0;c = c + 1 | 0;h[g >> 1] = (o(c << 16 >> 16, 25736) | 0) / (d | 0);if ((b | 0) != (c | 0)) { - continue; - }break; - }if ((b | 0) < 1) { - break l; - }d = i[a + 88 >> 2];f = i[a + 80 >> 2];g = i[a + 84 >> 2];c = 0;while (1) { - b = c << 2;i[b + g >> 2] = 0;i[b + f >> 2] = 0;i[b + d >> 2] = 0;c = c + 1 | 0;if ((c | 0) < i[a + 28 >> 2]) { - continue; - }break; - } - }c = i[a + 52 >> 2];d = i[a + 56 >> 2];b = 0;a = 0;while (1) { - f = a << 1;h[f + d >> 1] = 0;h[c + f >> 1] = 0;a = a + 1 | 0;if ((a | 0) != 64) { - continue; - }break; - }break a;case 33: - i[a + 144 >> 2] = i[c >> 2];a = i[a + 4 >> 2];J[i[i[a >> 2] + 44 >> 2]](a, 36, c) | 0;b = 0;break a;case 34: - i[c >> 2] = i[a + 144 >> 2];b = 0;break a;case 36: - a = i[a + 4 >> 2];J[i[i[a >> 2] + 44 >> 2]](a, 39, c) | 0;i[c >> 2] = (i[c >> 2] << 1) + 63;b = 0;break a;case 37: - a = i[a + 4 >> 2];J[i[i[a >> 2] + 44 >> 2]](a, 40, c) | 0;b = 0;break a;case 38: - a = i[a + 4 >> 2];J[i[i[a >> 2] + 44 >> 2]](a, 41, c) | 0;b = 0;break a;case 39: - d = i[c >> 2];i[a + 112 >> 2] = d;m: { - if ((d | 0) >= 42200) { - i[a + 116 >> 2] = 17600;b = -17600;break m; - }if ((d | 0) >= 27800) { - i[a + 116 >> 2] = 9600;b = -9600;break m; - }if ((d | 0) >= 20601) { - i[a + 116 >> 2] = 5600;b = -5600;break m; - }i[a + 116 >> 2] = 1800;b = -1800; - }c = e;if (i[a + 16 >> 2] == 80) { - i[a + 116 >> 2] = 1800;b = -1800; - }i[c + 28 >> 2] = b + d;a = i[a + 4 >> 2];J[i[i[a >> 2] + 44 >> 2]](a, 42, e + 28 | 0) | 0;b = 0;break a;case 40: - i[c >> 2] = i[a + 112 >> 2];b = 0;break a;case 41: - a = i[a + 4 >> 2];J[i[i[a >> 2] + 44 >> 2]](a, 44, c) | 0;b = 0;break a;case 42: - a = i[a + 4 >> 2];J[i[i[a >> 2] + 44 >> 2]](a, 45, c) | 0;b = 0;break a;case 103: - break c;case 102: - break d;case 101: - break e;case 26: - break f;case 97: - break h;default: - break b;} - }if (i[a + 20 >> 2] < 1) { - b = 0;break a; - }f = i[a + 92 >> 2];b = 0;while (1) { - g = d << 2;i[g + c >> 2] = i[f + g >> 2];d = d + 1 | 0;if ((d | 0) < i[a + 20 >> 2]) { - continue; - }break; - }break a; - }f = i[a + 96 >> 2];b = 0;a = 0;while (1) { - g = a << 1;h[g + c >> 1] = k[f + g >> 1];a = a + 1 | 0;if ((d | 0) != (a | 0)) { - continue; - }break; - }break a; - }i[c >> 2] = i[a + 140 >> 2];b = 0;break a; - }i[a + 100 >> 2] = c;b = 0;break a; - }a = i[a + 4 >> 2];J[i[i[a >> 2] + 44 >> 2]](a, 105, c) | 0;b = 0;break a; - }i[c >> 2] = i[a + 44 >> 2];b = 0;break a; - }i[e + 4 >> 2] = b;i[e >> 2] = 13123;Y(i[3524], 13166, e);b = -1; - }H = e + 32 | 0;return b | 0; - }function Ka(a, b, c) { - var d = 0, - e = 0, - f = 0, - g = 0, - j = 0, - l = 0, - m = 0, - n = 0, - p = 0, - q = 0, - r = 0, - s = 0, - t = 0, - u = 0, - v = 0, - w = 0, - x = 0, - y = 0, - z = 0, - A = 0, - B = 0, - C = 0, - D = 0, - E = 0, - F = 0, - G = 0, - I = 0, - J = 0, - K = 0, - L = 0, - M = 0;g = H - 112 | 0;H = g;j = a - (c << 1) | 0;G = $(a, j + -6 | 0, 80);i[g >> 2] = G;I = $(a, j + -4 | 0, 80);i[g + 4 >> 2] = I;J = $(a, j + -2 | 0, 80);i[g + 8 >> 2] = J;K = $(a, j, 80);i[g + 12 >> 2] = K;L = $(a, j + 2 | 0, 80);i[g + 16 >> 2] = L;M = $(a, j + 4 | 0, 80);i[g + 20 >> 2] = M;w = $(a, j + 6 | 0, 80);i[g + 24 >> 2] = w;B = w & 32767;C = w << 1 >> 16;j = i[g + 20 >> 2];x = j & 32767;d = i[g + 16 >> 2];s = d & 32767;e = i[g + 12 >> 2];p = e & 32767;l = i[g + 8 >> 2];t = l & 32767;m = i[g + 4 >> 2];y = m & 32767;f = i[g >> 2];D = f & 32767;z = j << 1 >> 16;u = d << 1 >> 16;q = e << 1 >> 16;v = l << 1 >> 16;A = m << 1 >> 16;E = f << 1 >> 16;while (1) { - f = o(F, 14);F = F + 1 | 0;r = o(F, 28) + g | 0;n = h[f + 2432 >> 1];l = h[f + 2434 >> 1];d = h[f + 2436 >> 1];j = h[f + 2438 >> 1];i[r + 24 >> 2] = (((((((o(n, p) >> 15) + o(q, n) | 0) + (o(l, s) >> 15) | 0) + o(l, u) | 0) + (o(d, x) >> 15) | 0) + o(d, z) | 0) + (o(j, B) >> 15) | 0) + o(j, C);e = h[f + 2440 >> 1];m = h[f + 2442 >> 1];f = h[f + 2444 >> 1];i[r >> 2] = ((((((o(j, E) + (o(j, D) >> 15) | 0) + (o(e, y) >> 15) | 0) + o(e, A) | 0) + (o(m, t) >> 15) | 0) + o(m, v) | 0) + (o(f, p) >> 15) | 0) + o(f, q);i[r + 20 >> 2] = ((((((((o(n, v) + (o(n, t) >> 15) | 0) + (o(l, p) >> 15) | 0) + o(l, q) | 0) + (o(d, s) >> 15) | 0) + o(d, u) | 0) + (o(j, x) >> 15) | 0) + o(j, z) | 0) + (o(e, B) >> 15) | 0) + o(e, C);i[r + 4 >> 2] = ((((((((o(d, E) + (o(d, D) >> 15) | 0) + (o(j, y) >> 15) | 0) + o(j, A) | 0) + (o(e, t) >> 15) | 0) + o(e, v) | 0) + (o(m, p) >> 15) | 0) + o(m, q) | 0) + (o(f, s) >> 15) | 0) + o(f, u);i[r + 16 >> 2] = ((((((((((o(n, A) + (o(n, y) >> 15) | 0) + (o(l, t) >> 15) | 0) + o(l, v) | 0) + (o(d, p) >> 15) | 0) + o(d, q) | 0) + (o(j, s) >> 15) | 0) + o(j, u) | 0) + (o(e, x) >> 15) | 0) + o(e, z) | 0) + (o(m, B) >> 15) | 0) + o(m, C);i[r + 8 >> 2] = ((((((((((o(l, E) + (o(l, D) >> 15) | 0) + (o(d, y) >> 15) | 0) + o(d, A) | 0) + (o(j, t) >> 15) | 0) + o(j, v) | 0) + (o(e, p) >> 15) | 0) + o(e, q) | 0) + (o(m, s) >> 15) | 0) + o(m, u) | 0) + (o(f, x) >> 15) | 0) + o(f, z);i[r + 12 >> 2] = ((((((((((((o(n, E) + (o(n, D) >> 15) | 0) + (o(l, y) >> 15) | 0) + o(l, A) | 0) + (o(d, t) >> 15) | 0) + o(d, v) | 0) + (o(j, p) >> 15) | 0) + o(j, q) | 0) + (o(e, s) >> 15) | 0) + o(e, u) | 0) + (o(m, x) >> 15) | 0) + o(m, z) | 0) + (o(f, B) >> 15) | 0) + o(f, C);if ((F | 0) != 3) { - continue; - }break; - }j = 0;e = (I | 0) > (G | 0);l = e ? I : G;d = (J | 0) > (l | 0);f = d ? 2 : e;d = d ? J : l;e = (K | 0) > (d | 0);f = e ? 3 : f;d = e ? K : d;e = (L | 0) > (d | 0);f = e ? 4 : f;d = e ? L : d;e = (M | 0) > (d | 0);f = e ? 5 : f;d = e ? M : d;e = (w | 0) > (d | 0);F = e ? 6 : f;l = i[g + 28 >> 2];e = e ? w : d;d = (l | 0) > (e | 0);m = i[g + 32 >> 2];l = d ? l : e;e = (m | 0) > (l | 0);p = i[g + 36 >> 2];m = e ? m : l;l = (p | 0) > (m | 0);q = i[g + 40 >> 2];p = l ? p : m;m = (q | 0) > (p | 0);f = i[g + 44 >> 2];q = m ? q : p;p = (f | 0) > (q | 0);n = i[g + 48 >> 2];f = p ? f : q;q = (n | 0) > (f | 0);s = i[g + 52 >> 2];n = q ? n : f;f = (s | 0) > (n | 0);t = i[g + 56 >> 2];s = f ? s : n;n = (t | 0) > (s | 0);u = i[g + 60 >> 2];t = n ? t : s;s = (u | 0) > (t | 0);v = i[g - -64 >> 2];u = s ? u : t;t = (v | 0) > (u | 0);r = i[g + 68 >> 2];v = t ? v : u;u = (r | 0) > (v | 0);x = i[g + 72 >> 2];r = u ? r : v;v = (x | 0) > (r | 0);y = i[g + 76 >> 2];x = v ? x : r;r = (y | 0) > (x | 0);z = i[g + 80 >> 2];y = r ? y : x;x = (z | 0) > (y | 0);A = i[g + 84 >> 2];z = x ? z : y;y = (A | 0) > (z | 0);w = i[g + 88 >> 2];A = y ? A : z;z = (w | 0) > (A | 0);B = i[g + 92 >> 2];w = z ? w : A;A = (B | 0) > (w | 0);C = i[g + 96 >> 2];B = A ? B : w;w = (C | 0) > (B | 0);D = i[g + 100 >> 2];C = w ? C : B;B = (D | 0) > (C | 0);E = i[g + 104 >> 2];D = B ? D : C;C = (E | 0) > (D | 0);E = i[g + 108 >> 2] > ((C ? E : D) | 0);D = E ? 6 : C ? 5 : B ? 4 : w ? 3 : A ? 2 : z ? 1 : y ? 0 : x ? 6 : r ? 5 : v ? 4 : u ? 3 : t ? 2 : s ? 1 : n ? 0 : f ? 6 : q ? 5 : p ? 4 : m ? 3 : l ? 2 : e ? 1 : d ? 0 : F;d = E ? 3 : C ? 3 : B ? 3 : w ? 3 : A ? 3 : z ? 3 : y ? 3 : x ? 2 : r ? 2 : v ? 2 : u ? 2 : t ? 2 : s ? 2 : n ? 2 : f | (q | (p | (m | (l | (d | e)))));a: { - if (!d) { - while (1) { - h[(j << 1) + b >> 1] = k[((D + (j - c | 0) << 1) + a | 0) + -6 >> 1];j = j + 1 | 0;if ((j | 0) != 80) { - continue; - }break a; - } - }e = (D - c | 0) + -6 | 0;c = o(d + -1 | 0, 14);d = h[c + 2444 >> 1];l = h[c + 2442 >> 1];m = h[c + 2440 >> 1];p = h[c + 2438 >> 1];q = h[c + 2436 >> 1];f = h[c + 2434 >> 1];n = h[c + 2432 >> 1];while (1) { - c = (j + e << 1) + a | 0;h[(j << 1) + b >> 1] = (o(d, h[c + 12 >> 1]) + (((((o(f, h[c + 2 >> 1]) + o(n, h[c >> 1]) | 0) + o(q, h[c + 4 >> 1]) | 0) + o(p, h[c + 6 >> 1]) | 0) + o(m, h[c + 8 >> 1]) | 0) + o(l, h[c + 10 >> 1]) | 0) | 0) + 16384 >>> 15;j = j + 1 | 0;if ((j | 0) != 80) { - continue; - }break; - } - }H = g + 112 | 0; - }function Ia(a, b, c, d, e, f, g, j) { - var l = 0, - m = 0, - n = 0, - p = 0, - q = 0, - r = 0, - s = 0, - t = 0, - u = 0, - v = 0, - w = 0, - x = 0, - y = 0, - z = 0, - A = 0, - B = 0, - C = 0, - D = 0;z = (j & 1) + j | 0;t = c - b | 0;w = t + 1 | 0;j = w << 1;n = z + j | 0;A = (n & 1) + n | 0;j = A + j | 0;r = (0 - j & 3) + j | 0;s = w << 2;j = r + s | 0;x = (0 - j & 3) + j | 0;j = x + (g << 2) | 0;B = (0 - j & 3) + j | 0;if ((g | 0) >= 1) { - while (1) { - j = l << 2;i[j + x >> 2] = -1;i[j + B >> 2] = 0;i[e + j >> 2] = b;l = l + 1 | 0;if ((l | 0) != (g | 0)) { - continue; - }break; - } - }p = 0 - c | 0;a: { - if ((p | 0) >= (d | 0)) { - break a; - }l = p;while (1) { - n = h[(l << 1) + a >> 1];j = n >> 31;if ((j ^ j + n) < 16384) { - l = l + 1 | 0;if ((l | 0) != (d | 0)) { - continue; - }break a; - }break; - }l = p;while (1) { - C = 1;j = (l << 1) + a | 0;h[j >> 1] = h[j >> 1] >>> 1;l = l + 1 | 0;if ((l | 0) != (d | 0)) { - continue; - }break; - } - }n = d >> 2;b: { - if (n) { - l = a - (b << 1) | 0;j = 0;m = n;while (1) { - q = j;j = h[l + 2 >> 1];u = o(j, j);j = h[l >> 1];u = u + o(j, j) | 0;j = h[l + 4 >> 1];u = u + o(j, j) | 0;j = h[l + 6 >> 1];j = q + (u + o(j, j) >>> 6 | 0) | 0;l = l + 8 | 0;m = m + -1 | 0;if (m) { - continue; - }break; - }i[r >> 2] = j;l = a;j = n;while (1) { - m = h[l + 2 >> 1];q = o(m, m);m = h[l >> 1];q = q + o(m, m) | 0;m = h[l + 4 >> 1];q = q + o(m, m) | 0;m = h[l + 6 >> 1];y = (q + o(m, m) >>> 6 | 0) + y | 0;l = l + 8 | 0;j = j + -1 | 0;if (j) { - continue; - }break; - }break b; - }i[r >> 2] = 0; - }if ((c | 0) > (b | 0)) { - j = i[r >> 2];l = b;while (1) { - q = j;j = l ^ -1;m = h[(j << 1) + a >> 1];j = h[(d + j << 1) + a >> 1];j = q + (o(m, m) >>> 6 | 0) - (o(j, j) >>> 6) | 0;j = (j | 0) > 0 ? j : 0;i[(r + (l - b << 2) | 0) + 4 >> 2] = j;l = l + 1 | 0;if ((l | 0) != (c | 0)) { - continue; - }break; - } - }D = wa(r, A, 32766, w);c: { - if ((t | 0) < 0) { - break c; - }if (n) { - q = (p << 1) + a | 0;while (1) { - l = q + (v << 1) | 0;m = 0;j = a;s = n;while (1) { - m = (((o(h[l + 2 >> 1], h[j + 2 >> 1]) + o(h[l >> 1], h[j >> 1]) | 0) + o(h[l + 4 >> 1], h[j + 4 >> 1]) | 0) + o(h[l + 6 >> 1], h[j + 6 >> 1]) >> 6) + m | 0;l = l + 8 | 0;j = j + 8 | 0;s = s + -1 | 0;if (s) { - continue; - }break; - }i[r + (t - v << 2) >> 2] = m;j = (v | 0) != (t | 0);v = v + 1 | 0;if (j) { - continue; - }break; - }break c; - }U(r, 0, s); - }w = wa(r, z, 180, w);if (!(C ^ 1 | (p | 0) >= (d | 0))) { - while (1) { - j = (p << 1) + a | 0;h[j >> 1] = k[j >> 1] << 1;p = p + 1 | 0;if ((p | 0) != (d | 0)) { - continue; - }break; - } - }d: { - if ((c | 0) < (b | 0)) { - break d; - }p = (c | 0) > (b | 0) ? c : b;c = g + -1 | 0;a = c << 2;s = a + e | 0;d = a + x | 0;j = a + B | 0;if ((g | 0) >= 2) { - l = b;while (1) { - a = l;l = a - b << 1;n = k[l + z >> 1];n = o(n, n) << 16 >> 16;l = h[l + A >> 1];m = (l << 16) + 65536 >> 16;e: { - if ((o(n, h[j >> 1]) | 0) <= (o(m, h[d >> 1]) | 0)) { - break e; - }i[d >> 2] = n;C = l + 1 | 0;i[j >> 2] = C;i[s >> 2] = a;l = 0;while (1) { - r = l << 2;q = r + B | 0;u = r + x | 0;if ((o(n, h[q >> 1]) | 0) <= (o(m, h[u >> 1]) | 0)) { - l = l + 1 | 0;if ((c | 0) != (l | 0)) { - continue; - }break e; - }break; - }m = c;if ((c | 0) > (l | 0)) { - while (1) { - v = m << 2;m = m + -1 | 0;t = m << 2;i[v + x >> 2] = i[t + x >> 2];i[v + B >> 2] = i[t + B >> 2];i[e + v >> 2] = i[e + t >> 2];if ((m | 0) > (l | 0)) { - continue; - }break; - } - }i[u >> 2] = n;i[q >> 2] = C;i[e + r >> 2] = a; - }l = a + 1 | 0;if ((a | 0) != (p | 0)) { - continue; - }break; - }break d; - }l = b;while (1) { - a = l - b << 1;c = k[a + z >> 1];c = o(c, c) << 16 >> 16;a = h[a + A >> 1];if ((o(c, h[j >> 1]) | 0) > (o(h[d >> 1], (a << 16) + 65536 >> 16) | 0)) { - i[d >> 2] = c;i[j >> 2] = a + 1;i[s >> 2] = l; - }a = (l | 0) != (p | 0);l = l + 1 | 0;if (a) { - continue; - }break; - } - }if (!(!f | (g | 0) < 1)) { - a = y >>> 0 > 65535;c = a << 3;j = c | 4;d = c;a = a ? y >>> 16 | 0 : y;c = a >>> 0 > 255;d = c ? j : d;a = c ? a >>> 8 | 0 : a;c = a >>> 0 > 15;a = (c ? d | 2 : d) | (c ? a >>> 4 | 0 : a) >>> 0 > 3;c = a << 1;d = a << 16 >> 16;c = ((d | 0) > 6 ? y >> c + -12 : y << 12 - c) << 16 >> 16;c = (o((o(o(c, 16816) + -827523072 >> 16, c) << 2 & -65536) + 1387593728 >> 16, c) << 2 & -65536) + 238157824 >> 16;a = 13 - a | 0;l = ((d | 0) < 13 ? c >> a : c << 0 - a) << 16 >> 16;j = 0;while (1) { - n = i[(j << 2) + e >> 2] - b << 1;a = h[n + A >> 1] << D;c = a >>> 0 > 65535;d = c << 3;p = d | 4;m = d;c = c ? a >>> 16 | 0 : a;d = c >>> 0 > 255;m = d ? p : m;c = d ? c >>> 8 | 0 : c;d = c >>> 0 > 15;c = (d ? m | 2 : m) | (d ? c >>> 4 | 0 : c) >>> 0 > 3;d = c << 1;m = a >> d + -12;a = a << 12 - d;d = c << 16 >> 16;a = ((d | 0) > 6 ? m : a) << 16 >> 16;a = (o((o(o(a, 16816) + -827523072 >> 16, a) << 2 & -65536) + 1387593728 >> 16, a) << 2 & -65536) + 238157824 >> 16;c = 13 - c | 0;a = (h[n + z >> 1] << w) / ((o(l, ((d | 0) < 13 ? a >> c : a << 0 - c) << 16 >> 16) >> 6) + 10 | 0) | 0;h[(j << 1) + f >> 1] = a & 32768 ? 0 : a;j = j + 1 | 0;if ((j | 0) != (g | 0)) { - continue; - }break; - } - } - }function ta(a, b, c, d, e) { - var f = 0, - g = 0, - j = 0, - l = 0, - m = 0, - n = 0, - p = 0, - q = 0, - r = 0, - s = 0, - t = 0, - u = 0, - v = 0, - w = 0, - x = 0, - y = 0, - z = 0, - A = 0, - B = 0, - C = 0, - D = 0;m = (0 - e & 3) + e | 0;q = (b | 0) / 2 | 0;p = q + 1 | 0;e = p << 2;j = m + e | 0;g = (0 - j & 3) + j | 0;i[g >> 2] = 8192;i[m >> 2] = 8192;t = e + g | 0;a: { - if ((b | 0) < 2) { - break a; - }e = m + 4 | 0;f = g + 4 | 0;b: { - if (!(f >>> 0 >= j >>> 0 | m >>> 0 >= t >>> 0)) { - j = m;l = g;while (1) { - r = h[((n ^ -1) + b << 1) + a >> 1];s = h[(n << 1) + a >> 1];i[f >> 2] = (r + s | 0) - i[l >> 2];i[e >> 2] = i[j >> 2] + (s - r | 0);e = e + 4 | 0;j = j + 4 | 0;f = f + 4 | 0;l = l + 4 | 0;n = n + 1 | 0;if ((q | 0) != (n | 0)) { - continue; - }break; - }break b; - }l = i[m >> 2];j = g;while (1) { - r = h[((n ^ -1) + b << 1) + a >> 1];s = h[(n << 1) + a >> 1];i[f >> 2] = (r + s | 0) - i[j >> 2];l = (s - r | 0) + l | 0;i[e >> 2] = l;e = e + 4 | 0;f = f + 4 | 0;j = j + 4 | 0;n = n + 1 | 0;if ((q | 0) != (n | 0)) { - continue; - }break; - } - }if ((b | 0) <= 1) { - break a; - }a = 0;e = m;f = g;while (1) { - i[f >> 2] = i[f >> 2] + 2 >> 2;i[e >> 2] = i[e >> 2] + 2 >> 2;e = e + 4 | 0;f = f + 4 | 0;a = a + 1 | 0;if ((q | 0) != (a | 0)) { - continue; - }break; - } - }a = q << 2;e = a + g | 0;i[e >> 2] = i[e >> 2] + 4 >> 3;a = a + m | 0;i[a >> 2] = i[a >> 2] + 4 >> 3;c: { - if ((b | 0) < -1) { - break c; - }x = t + (t & 1) | 0;a = x + (p << 1) | 0;z = (a & 1) + a | 0;e = 0;while (1) { - a = e << 1;f = e << 2;h[a + x >> 1] = i[f + g >> 2];h[a + z >> 1] = i[f + m >> 2];a = (e | 0) == (q | 0);e = e + 1 | 0;if (!a) { - continue; - }break; - }if ((b | 0) < 1) { - break c; - }g = 16384;C = q + -1 << 1;A = (b | 0) < 4;m = 0;while (1) { - s = w & 1 ? z : x;t = C + s | 0;r = h[t >> 1];u = (q << 1) + s | 0;p = h[u >> 1];a = g << 16 >> 16 < 16383 ? g : 16383;f = a << 16 >> 16 > -16383 ? a : -16383;n = f << 16 >> 16;j = p + (o(n, r) - -8192 >> 14) | 0;a = 16384;e = 2;if (!A) { - while (1) { - l = (o(n, f << 16 >> 16) >>> 13 | 0) - a | 0;j = (o(h[(q - e << 1) + s >> 1], l << 16 >> 16) - -8192 >> 14) + j | 0;v = (e | 0) != (q | 0);a = f;f = l;e = e + 1 | 0;if (v) { - continue; - }break; - } - }d: { - if (m << 16 >> 16 < -16384) { - break d; - }D = (w << 1) + c | 0;while (1) { - e = 2;a = g << 16 >> 16;a = o(1073741824 - (o(o(a, a) << 2 >> 16, 56e3) & -65536) >> 16, d);a = g - (j + 511 >>> 0 < 1023 ? (a << 1 >> 16) + 1 >>> 1 | 0 : a >>> 15 | 0) | 0;m = a << 16 >> 16;v = p << 16 >> 16;a = (m | 0) < 16383 ? a : 16383;f = a << 16 >> 16 > -16383 ? a : -16383;p = f << 16 >> 16;a = v + (o(p, r) - -8192 >> 14) | 0;n = 16384;if (!A) { - while (1) { - l = (o(p, f << 16 >> 16) >>> 13 | 0) - n | 0;a = (o(h[(q - e << 1) + s >> 1], l << 16 >> 16) - -8192 >> 14) + a | 0;y = (e | 0) != (q | 0);n = f;f = l;e = e + 1 | 0;if (y) { - continue; - }break; - } - }if (!((a ^ j) & 1879048192 ? 0 : j)) { - p = 0;e: { - if ((b | 0) <= 3) { - while (1) { - l = ((g << 16 >> 16 << 15) + 32768 >>> 16) + ((m << 16 >> 16 << 15) + 32768 >>> 16) | 0;a = l << 16 >> 16 < 16383 ? l : 16383;e = (o((a << 16 >> 16 > -16383 ? a : -16383) << 16 >> 16, r) - -8192 >> 14) + v | 0;a = !j | ((e ^ j) & 1879048192) != 0;j = a ? j : e;g = a ? g : l;m = a ? l : m;a = (p | 0) == 10;p = p + 1 | 0;if (!a) { - continue; - }break e; - } - }while (1) { - l = ((g << 16 >> 16 << 15) + 32768 >>> 16) + ((m << 16 >> 16 << 15) + 32768 >>> 16) | 0;a = l << 16 >> 16 < 16383 ? l : 16383;f = a << 16 >> 16 > -16383 ? a : -16383;u = f << 16 >> 16;a = (o(u, r) - -8192 >> 14) + v | 0;e = 2;n = 16384;while (1) { - t = (o(u, f << 16 >> 16) >>> 13 | 0) - n | 0;a = (o(h[(q - e << 1) + s >> 1], t << 16 >> 16) - -8192 >> 14) + a | 0;y = (e | 0) != (q | 0);n = f;f = t;e = e + 1 | 0;if (y) { - continue; - }break; - }e = !j | ((a ^ j) & 1879048192) != 0;g = e ? g : l;m = e ? l : m;j = e ? j : a;a = (p | 0) == 10;p = p + 1 | 0;if (!a) { - continue; - }break; - } - }B = B + 1 | 0;j = l << 16 >> 16 < 0;a = ((j ? l : 0 - l | 0) << 16) + 1073741824 >> 17;e = o((o((o(a, 1486) >> 13) + 2242 | 0, a) << 3 & -65536) + 1079312384 >> 16, a) << 3 >> 16;a = e << 13;f = a >>> 0 > 65535;g = f << 3;e = f ? e >>> 3 & 65535 : a;f = e >>> 0 > 255;g = f ? g | 4 : g;e = f ? e >>> 8 | 0 : e;f = e >>> 0 > 15;e = (f ? g | 2 : g) | (f ? e >>> 4 | 0 : e) >>> 0 > 3;f = e << 1;g = a >> f + -12;a = a << 12 - f;f = e << 16 >> 16;a = ((f | 0) > 6 ? g : a) << 16 >> 16;a = (o((o(o(a, 16816) + -827523072 >> 16, a) << 2 & -65536) + 1387593728 >> 16, a) << 2 & -65536) + 238157824 >> 16;e = 13 - e | 0;a = (f | 0) < 13 ? a >> e : a << 0 - e;h[D >> 1] = j ? 25736 - a | 0 : a;g = l;break d; - }if ((m | 0) < -16384) { - g = m; - } else { - r = h[t >> 1];p = k[u >> 1];g = m;j = a;continue; - }break; - } - }w = w + 1 | 0;if ((w | 0) != (b | 0)) { - continue; - }break; - } - }return B; - }function xb(a, b, c) { - a = a | 0;b = b | 0;c = c | 0;var d = 0, - e = 0, - f = 0, - g = 0, - j = 0;d = H - 32 | 0;H = d;a: { - b: { - switch (b + -3 | 0) {case 98: - if (i[a + 16 >> 2] < 1) { - break a; - }b = 0;while (1) { - f = i[a + 12 >> 2];h[(b << 1) + c >> 1] = Z(i[a + 76 >> 2] + (o(f, b) << 1) | 0, f);b = b + 1 | 0;if ((b | 0) < i[a + 16 >> 2]) { - continue; - }break; - }break a;case 0: - i[c >> 2] = i[a + 8 >> 2];break a;case 3:case 5: - b = i[c >> 2];i[a + 212 >> 2] = b;i[a + 208 >> 2] = b;break a;case 4:case 6: - i[c >> 2] = i[a + 208 >> 2];break a;case 9: - i[a + 152 >> 2] = i[c >> 2];break a;case 10: - i[c >> 2] = i[a + 152 >> 2];break a;case 27: - i[a + 160 >> 2] = i[c >> 2];break a;case 28: - i[c >> 2] = i[a + 160 >> 2];break a;case 31: - i[a + 164 >> 2] = i[c >> 2];break a;case 32: - i[c >> 2] = i[a + 164 >> 2];break a;case 29: - b = i[c >> 2];i[a + 172 >> 2] = b;i[a + 152 >> 2] = (b | 0) != 0;if (!b) { - break a; - }i[d + 28 >> 2] = 10;e = i[c >> 2];while (1) { - c: { - J[i[i[a >> 2] + 44 >> 2]](a, 4, d + 28 | 0) | 0;J[i[i[a >> 2] + 44 >> 2]](a, 19, d + 24 | 0) | 0;c = i[d + 28 >> 2];if (i[d + 24 >> 2] <= (e | 0)) { - b = c;break c; - }b = c + -1 | 0;i[d + 28 >> 2] = b;if ((c | 0) > 0) { - continue; - } - }break; - }e = 0;m[d + 20 >> 2] = ((b | 0) > 0 ? b : 0) | 0;J[i[i[a >> 2] + 44 >> 2]](a, 14, d + 20 | 0) | 0;i[a + 176 >> 2] = 0;i[a + 180 >> 2] = 0;i[a + 184 >> 2] = 0;break a;case 30: - i[c >> 2] = i[a + 172 >> 2];break a;case 11: - i[a + 144 >> 2] = i[c >> 2];break a;case 12: - i[c >> 2] = i[a + 144 >> 2];break a;case 1: - b = i[c >> 2];b = (b | 0) > 0 ? b : 0;b = i[(i[i[a >> 2] >> 2] + (((b | 0) < 10 ? b : 10) << 2) | 0) + 96 >> 2];i[a + 212 >> 2] = b;i[a + 208 >> 2] = b;break a;case 13: - b = a;a = i[c >> 2];i[b + 188 >> 2] = (a | 0) > 0 ? a : 0;break a;case 14: - i[c >> 2] = i[a + 188 >> 2];break a;case 15: - i[d + 28 >> 2] = 10;b = i[c >> 2];while (1) { - d: { - J[i[i[a >> 2] + 44 >> 2]](a, 4, d + 28 | 0) | 0;J[i[i[a >> 2] + 44 >> 2]](a, 19, d + 24 | 0) | 0;if (i[d + 24 >> 2] <= (b | 0)) { - break d; - }c = i[d + 28 >> 2];i[d + 28 >> 2] = c + -1;if ((c | 0) > 0) { - continue; - } - }break; - }break a;case 16: - b = i[a + 192 >> 2];e = i[i[a + 204 >> 2] + (i[a + 208 >> 2] << 2) >> 2];if (e) { - i[c >> 2] = (o(b, i[e + 52 >> 2]) | 0) / i[a + 8 >> 2];e = 0;break a; - }i[c >> 2] = (o(b, 5) | 0) / i[a + 8 >> 2];e = 0;break a;case 21: - i[a + 192 >> 2] = i[c >> 2];break a;case 22: - i[c >> 2] = i[a + 192 >> 2];break a;case 23: - i[a + 4 >> 2] = 1;i[a + 40 >> 2] = 1;b = i[a + 24 >> 2];e: { - if ((b | 0) < 1) { - break e; - }e = b + 1 | 0;f = i[a + 96 >> 2];c = 0;while (1) { - g = f + (c << 1) | 0;c = c + 1 | 0;h[g >> 1] = (o(c << 16 >> 16, 25736) | 0) / (e | 0);if ((b | 0) != (c | 0)) { - continue; - }break; - }if ((b | 0) < 1) { - break e; - }e = i[a + 108 >> 2];f = i[a + 112 >> 2];g = i[a + 104 >> 2];j = i[a + 116 >> 2];b = 0;while (1) { - c = b << 2;i[c + j >> 2] = 0;i[c + g >> 2] = 0;i[c + f >> 2] = 0;i[c + e >> 2] = 0;b = b + 1 | 0;if ((b | 0) < i[a + 24 >> 2]) { - continue; - }break; - } - }b = i[a + 8 >> 2];e = b + i[a + 32 >> 2] | 0;if ((e | 0) >= 0) { - f = i[a + 72 >> 2];g = i[a + 80 >> 2];c = 0;while (1) { - j = c << 1;h[j + g >> 1] = 0;h[f + j >> 1] = 0;j = (c | 0) == (e | 0);c = c + 1 | 0;if (!j) { - continue; - }break; - } - }e = 0;c = i[a + 20 >> 2];if ((c | 0) <= (b | 0)) { - break a; - }f = i[a + 68 >> 2];a = c - b | 0;U(f, 0, ((a | 0) > 1 ? a : 1) << 1);break a;case 33: - i[a + 200 >> 2] = i[c >> 2];break a;case 34: - i[c >> 2] = i[a + 200 >> 2];break a;case 36: - i[c >> 2] = i[a + 20 >> 2] - i[a + 8 >> 2];break a;case 37: - b = a;a = i[c >> 2];i[b + 196 >> 2] = (a | 0) < 100 ? a : 100;H = d + 32 | 0;return 0;case 38: - i[c >> 2] = i[a + 196 >> 2];break a;case 39: - i[a + 156 >> 2] = i[c >> 2];break a;case 40: - i[c >> 2] = i[a + 156 >> 2];break a;case 41: - i[a + 220 >> 2] = i[c >> 2];break a;case 42: - i[c >> 2] = i[a + 220 >> 2];break a;case 97: - if (i[a + 16 >> 2] < 1) { - break a; - }f = i[a + 132 >> 2];b = 0;while (1) { - g = b << 2;i[g + c >> 2] = i[f + g >> 2];b = b + 1 | 0;if ((b | 0) < i[a + 16 >> 2]) { - continue; - }break; - }break a;case 26: - i[c >> 2] = i[a + 148 >> 2];break a;case 101: - i[a + 136 >> 2] = c;break a;case 102: - i[a + 216 >> 2] = i[c >> 2];break a;case 103: - i[c >> 2] = i[a + 64 >> 2];break a;default: - break b;} - }i[d + 4 >> 2] = b;i[d >> 2] = 12742;Y(i[3524], 12828, d);e = -1; - }H = d + 32 | 0;return e | 0; - }function sb(a, b, c, d) { - a = a | 0;b = b | 0;c = c | 0;d = d | 0;var e = 0, - f = 0, - i = 0, - j = 0, - l = 0, - m = 0, - n = 0, - p = 0, - q = 0, - r = 0, - s = 0, - t = 0, - u = 0, - v = 0, - w = 0, - x = 0, - y = 0;q = H - 32 | 0;H = q;a: { - b: { - if ((c | 0) < 1) { - break b; - }while (1) { - j = e << 1;h[j + b >> 1] = k[a + j >> 1];e = e + 1 | 0;if ((e | 0) != (c | 0)) { - continue; - }break; - }if ((c | 0) < 1) { - break b; - }j = h[b >> 1];l = q;m = c + -1 | 0;e = 25736;c: { - if (!m) { - break c; - }e = k[b + 2 >> 1]; - }e = e - j | 0;h[l >> 1] = 81920 / (((e << 16 >> 16 < (j | 0) ? e : j) << 16) + 19660800 >> 16);e = 1;if ((c | 0) != 1) { - while (1) { - p = e << 1;j = p + b | 0;r = k[j >> 1];n = r - k[j + -2 >> 1] << 16 >> 16;j = e + 1 | 0;e = ((e | 0) != (m | 0) ? k[(j << 1) + b >> 1] : 25736) - r | 0;h[q + p >> 1] = 81920 / (((e << 16 >> 16 < (n | 0) ? e : n) << 16) + 19660800 >> 16);e = j;if ((e | 0) != (c | 0)) { - continue; - }break; - } - }if ((c | 0) < 1) { - break b; - }e = 0;while (1) { - j = (e << 1) + b | 0;e = e + 1 | 0;h[j >> 1] = k[j >> 1] - (e << 11);if ((c | 0) != (e | 0)) { - continue; - }break; - }if ((c | 0) < 1) { - break b; - }r = 2147483647;n = 0;j = 8848;while (1) { - m = 0;e = j;p = 0;while (1) { - l = m;m = k[(p << 1) + b >> 1] - (g[e | 0] << 5) << 16 >> 16;m = l + o(m, m) | 0;e = e + 1 | 0;p = p + 1 | 0;if ((p | 0) != (c | 0)) { - continue; - }break; - }e = (m | 0) < (r | 0);n = e ? s : n;r = e ? m : r;j = c + j | 0;s = s + 1 | 0;if ((s | 0) != 64) { - continue; - }break; - }j = o(c, n);e = 0;while (1) { - m = (e << 1) + b | 0;h[m >> 1] = k[m >> 1] - (g[(e + j | 0) + 8848 | 0] << 5);e = e + 1 | 0;if ((e | 0) != (c | 0)) { - continue; - }break; - }W(d, n, 6);e = 0;if ((c | 0) <= 0) { - break a; - }while (1) { - j = (e << 1) + b | 0;h[j >> 1] = k[j >> 1] << 1;e = e + 1 | 0;if ((e | 0) != (c | 0)) { - continue; - }break; - }break a; - }W(d, 0, 6); - }v = k[b >> 1];w = k[b + 8 >> 1];x = k[b + 6 >> 1];i = k[b + 4 >> 1];y = k[b + 2 >> 1];p = 2147483647;n = 0;e = 9488;j = h[q + 8 >> 1];r = h[q + 6 >> 1];s = h[q + 4 >> 1];t = h[q + 2 >> 1];u = h[q >> 1];m = 0;while (1) { - f = v - (g[e | 0] << 5) << 16 >> 16;f = o(f, f);l = (o(u, f & 32767) >> 15) + o(u, f << 1 >> 16) | 0;f = y - (g[e + 1 | 0] << 5) << 16 >> 16;f = o(f, f);l = (l + (o(t, f & 32767) >> 15) | 0) + o(t, f << 1 >> 16) | 0;f = i - (g[e + 2 | 0] << 5) << 16 >> 16;f = o(f, f);l = (l + (o(s, f & 32767) >> 15) | 0) + o(s, f << 1 >> 16) | 0;f = x - (g[e + 3 | 0] << 5) << 16 >> 16;f = o(f, f);l = (l + (o(r, f & 32767) >> 15) | 0) + o(r, f << 1 >> 16) | 0;f = w - (g[e + 4 | 0] << 5) << 16 >> 16;f = o(f, f);l = (l + (o(j, f & 32767) >> 15) | 0) + o(j, f << 1 >> 16) | 0;f = (l | 0) < (p | 0);p = f ? l : p;n = f ? m : n;e = e + 5 | 0;m = m + 1 | 0;if ((m | 0) != 64) { - continue; - }break; - }e = o(n, 5);h[b >> 1] = k[b >> 1] - (g[e + 9488 | 0] << 5);h[b + 2 >> 1] = k[b + 2 >> 1] - (g[e + 9489 | 0] << 5);h[b + 4 >> 1] = k[b + 4 >> 1] - (g[e + 9490 | 0] << 5);h[b + 6 >> 1] = k[b + 6 >> 1] - (g[e + 9491 | 0] << 5);h[b + 8 >> 1] = k[b + 8 >> 1] - (g[e + 9492 | 0] << 5);W(d, n, 6);y = k[b + 10 >> 1];j = k[b + 18 >> 1];r = k[b + 16 >> 1];s = k[b + 14 >> 1];t = k[b + 12 >> 1];p = 2147483647;n = 0;e = 10128;u = h[q + 18 >> 1];f = h[q + 16 >> 1];v = h[q + 14 >> 1];w = h[q + 12 >> 1];x = h[q + 10 >> 1];m = 0;while (1) { - i = y - (g[e | 0] << 5) << 16 >> 16;i = o(i, i);l = (o(x, i & 32767) >> 15) + o(x, i << 1 >> 16) | 0;i = t - (g[e + 1 | 0] << 5) << 16 >> 16;i = o(i, i);l = (l + (o(w, i & 32767) >> 15) | 0) + o(w, i << 1 >> 16) | 0;i = s - (g[e + 2 | 0] << 5) << 16 >> 16;i = o(i, i);l = (l + (o(v, i & 32767) >> 15) | 0) + o(v, i << 1 >> 16) | 0;i = r - (g[e + 3 | 0] << 5) << 16 >> 16;i = o(i, i);l = (l + (o(f, i & 32767) >> 15) | 0) + o(f, i << 1 >> 16) | 0;i = j - (g[e + 4 | 0] << 5) << 16 >> 16;i = o(i, i);l = (l + (o(u, i & 32767) >> 15) | 0) + o(u, i << 1 >> 16) | 0;i = (l | 0) < (p | 0);p = i ? l : p;n = i ? m : n;e = e + 5 | 0;m = m + 1 | 0;if ((m | 0) != 64) { - continue; - }break; - }e = o(n, 5);h[b + 18 >> 1] = j - (g[e + 10132 | 0] << 5);h[b + 16 >> 1] = r - (g[e + 10131 | 0] << 5);h[b + 14 >> 1] = s - (g[e + 10130 | 0] << 5);h[b + 12 >> 1] = t - (g[e + 10129 | 0] << 5);h[b + 10 >> 1] = k[b + 10 >> 1] - (g[e + 10128 | 0] << 5);W(d, n, 6);e = 0;d: { - if ((c | 0) <= 0) { - break d; - }while (1) { - d = (e << 1) + b | 0;h[d >> 1] = h[d >> 1] + 1 >>> 1;e = e + 1 | 0;if ((e | 0) != (c | 0)) { - continue; - }break; - }e = 0;if ((c | 0) <= 0) { - break d; - }while (1) { - d = e << 1;j = d + b | 0;h[j >> 1] = k[a + d >> 1] - k[j >> 1];e = e + 1 | 0;if ((e | 0) != (c | 0)) { - continue; - }break; - } - }H = q + 32 | 0; - }function Ja(a, b, c, d, e, f) { - var g = 0, - i = 0, - j = 0, - l = 0, - m = 0, - n = 0, - p = 0, - q = 0, - r = 0, - s = 0, - t = 0, - u = 0, - v = 0;r = (f & 1) + f | 0;Ka(a, r, d);f = 0;j = r + (c << 1) | 0;Ka(a, j, (d | 0) > 40 ? d << 1 : 0 - d | 0);t = 1;a: { - if ((c | 0) <= 0) { - break a; - }b: { - while (1) { - i = h[(f << 1) + a >> 1];g = i >> 31;if ((g ^ g + i) > 16383) { - break b; - }f = f + 1 | 0;if ((f | 0) != (c | 0)) { - continue; - }break; - }break a; - }f = 0;while (1) { - g = (f << 1) + a | 0;h[g >> 1] = h[g >> 1] >>> 1;f = f + 1 | 0;if ((f | 0) != (c | 0)) { - continue; - }break; - }f = c << 1;g = (f | 0) > 1 ? f : 1;t = 0;f = 0;while (1) { - i = r + (f << 1) | 0;h[i >> 1] = h[i >> 1] >>> 1;f = f + 1 | 0;if ((g | 0) != (f | 0)) { - continue; - }break; - } - }p = $(r, r, c);i = $(j, j, c);f = $(a, a, c) + 1 | 0;g = f >>> 0 > 65535;l = g << 3;q = l | 4;n = l;g = g ? f >>> 16 | 0 : f;l = g >>> 0 > 255;m = l ? q : n;g = l ? g >>> 8 | 0 : g;l = g >>> 0 > 15;g = (l ? m | 2 : m) | (l ? g >>> 4 | 0 : g) >>> 0 > 3;l = g << 1;i = i + 1e3 | 0;m = i >>> 0 > 65535;n = m << 3;s = n | 4;q = n;m = m ? i >>> 16 | 0 : i;n = m >>> 0 > 255;s = n ? s : q;m = n ? m >>> 8 | 0 : m;n = m >>> 0 > 15;m = (n ? s | 2 : s) | (n ? m >>> 4 | 0 : m) >>> 0 > 3;n = m << 1;q = f >> l + -12;f = f << 12 - l;l = g << 16 >> 16;f = ((l | 0) > 6 ? q : f) << 16 >> 16;f = (o((o(o(f, 16816) + -827523072 >> 16, f) << 2 & -65536) + 1387593728 >> 16, f) << 2 & -65536) + 238157824 >> 16;g = 13 - g | 0;l = ((l | 0) < 13 ? f >> g : f << 0 - g) << 16;g = l >> 16;s = (g + 32 >>> 6 | 0) + 1 | 0;f = i >> n + -12;n = i << 12 - n;i = m << 16 >> 16;f = ((i | 0) > 6 ? f : n) << 16 >> 16;f = (o((o(o(f, 16816) + -827523072 >> 16, f) << 2 & -65536) + 1387593728 >> 16, f) << 2 & -65536) + 238157824 >> 16;m = 13 - m | 0;f = (i | 0) < 13 ? f >> m : f << 0 - m;u = f << 16 >> 10 < (g | 0) ? s : f;i = $(r, a, c);f = $(j, a, c);n = (f | 0) > 0 ? f : 0;m = 16384;f = p + 1e3 | 0;j = f >>> 0 > 65535;p = j << 3;v = p | 4;q = p;j = j ? f >>> 16 | 0 : f;p = j >>> 0 > 255;q = p ? v : q;j = p ? j >>> 8 | 0 : j;p = j >>> 0 > 15;j = (p ? q | 2 : q) | (p ? j >>> 4 | 0 : j) >>> 0 > 3;p = j << 1;q = (i | 0) > 0 ? i : 0;i = j << 16 >> 16;f = ((i | 0) > 6 ? f >> p + -12 : f << 12 - p) << 16 >> 16;f = (o((o(o(f, 16816) + -827523072 >> 16, f) << 2 & -65536) + 1387593728 >> 16, f) << 2 & -65536) + 238157824 >> 16;j = 13 - j | 0;f = (i | 0) < 13 ? f >> j : f << 0 - j;i = (f << 16 >> 10 < (g | 0) ? s : f) << 16 >> 16;if ((q | 0) <= (o(i, g) | 0)) { - m = ((((l >> 17) + q | 0) / (g | 0) << 14) + (i >> 1) | 0) / (i | 0) << 16 >> 16; - }j = u << 16 >> 16;c: { - if ((n | 0) > (o(j, g) | 0)) { - f = j >> 1;g = 16384;break c; - }f = j >> 1;g = (f + ((n + (l >> 17) | 0) / (g | 0) << 14) | 0) / (j | 0) << 16 >> 16; - }l = l >> 8;n = (l + (i >> 1) | 0) / (i | 0) | 0;i = (f + l | 0) / (j | 0) | 0;d: { - if ((e | 0) < 1) { - f = 0;e = 0;break d; - }e = o(e & 65535, 13107) >>> 15 | 0;f = e + 2294 | 0;e = (o(e, 112720) & -65536) + 1073741824 >> 16; - }j = f << 14;g = 32767 - (o(g, o(e, g) << 1 >> 16) >>> 13 | 0) | 0;l = f << 16 >> 16;g = (g << 16 >> 16 < (l | 0) ? f : g) << 16;g = (j + (g >> 17) | 0) / (g >> 16) | 0;e = 32767 - (o(o(e, m) << 1 >> 16, m) >>> 13 | 0) | 0;e = (e << 16 >> 16 < (l | 0) ? f : e) << 16;e = o(n << 16 >> 14, (j + (e >> 17) | 0) / (e >> 16) << 16 >> 16) >> 16;e: { - if ((d | 0) > 40) { - f = o(e, 22938) >> 15;d = o(o(i << 16 >> 14, g << 16 >> 16) >> 16, 9830) >> 15;break e; - }f = o(e, 19661) >>> 15 | 0;d = o(o(i << 16 >> 14, g << 16 >> 16) >> 16, 19661) >>> 15 | 0; - }g = (c | 0) < 1;if (!g) { - e = d << 16 >> 16;i = f << 16 >> 16;f = 0;while (1) { - d = f << 1;h[d + b >> 1] = k[a + d >> 1] + ((o(e, h[r + (c + f << 1) >> 1]) + o(i, h[d + r >> 1]) << 8) + 32768 >>> 16 | 0);f = f + 1 | 0;if ((f | 0) != (c | 0)) { - continue; - }break; - } - }d = Z(b, c);e = Z(a, c);f: { - if (g) { - break f; - }f = (d | 0) > 1 ? d : 1;d = f & 65535;e = (e | 0) > 1 ? e : 1;d = (((((e & 65535) >>> 0 > d >>> 0 ? f : e) & 65535) << 14 | d >>> 1) >>> 0) / (d >>> 0) << 16 >> 16;f = 0;while (1) { - e = (f << 1) + b | 0;h[e >> 1] = o(d, h[e >> 1]) >>> 14;f = f + 1 | 0;if ((f | 0) != (c | 0)) { - continue; - }break; - }if ((c | 0) < 1 | t) { - break f; - }f = 0;while (1) { - d = (f << 1) + a | 0;h[d >> 1] = k[d >> 1] << 1;f = f + 1 | 0;if ((f | 0) != (c | 0)) { - continue; - }break; - }f = 0;if ((c | 0) <= 0) { - break f; - }while (1) { - d = (f << 1) + b | 0;a = h[d >> 1];a = (a | 0) > -16383 ? a : -16383;h[d >> 1] = ((a | 0) < 16383 ? a : 16383) << 1;f = f + 1 | 0;if ((f | 0) != (c | 0)) { - continue; - }break; - } - } - }function S(a) { - var b = 0, - c = 0, - d = 0, - e = 0, - f = 0, - g = 0, - h = 0;a: { - if (!a) { - break a; - }d = a + -8 | 0;c = i[a + -4 >> 2];a = c & -8;f = d + a | 0;b: { - if (c & 1) { - break b; - }if (!(c & 3)) { - break a; - }c = i[d >> 2];d = d - c | 0;if (d >>> 0 < l[3812]) { - break a; - }a = a + c | 0;if (i[3813] != (d | 0)) { - if (c >>> 0 <= 255) { - e = i[d + 8 >> 2];c = c >>> 3 | 0;b = i[d + 12 >> 2];if ((b | 0) == (e | 0)) { - i[3808] = i[3808] & ic(c);break b; - }i[e + 12 >> 2] = b;i[b + 8 >> 2] = e;break b; - }h = i[d + 24 >> 2];c = i[d + 12 >> 2];c: { - if ((d | 0) != (c | 0)) { - b = i[d + 8 >> 2];i[b + 12 >> 2] = c;i[c + 8 >> 2] = b;break c; - }d: { - e = d + 20 | 0;b = i[e >> 2];if (b) { - break d; - }e = d + 16 | 0;b = i[e >> 2];if (b) { - break d; - }c = 0;break c; - }while (1) { - g = e;c = b;e = c + 20 | 0;b = i[e >> 2];if (b) { - continue; - }e = c + 16 | 0;b = i[c + 16 >> 2];if (b) { - continue; - }break; - }i[g >> 2] = 0; - }if (!h) { - break b; - }e = i[d + 28 >> 2];b = (e << 2) + 15536 | 0;e: { - if (i[b >> 2] == (d | 0)) { - i[b >> 2] = c;if (c) { - break e; - }i[3809] = i[3809] & ic(e);break b; - }i[h + (i[h + 16 >> 2] == (d | 0) ? 16 : 20) >> 2] = c;if (!c) { - break b; - } - }i[c + 24 >> 2] = h;b = i[d + 16 >> 2];if (b) { - i[c + 16 >> 2] = b;i[b + 24 >> 2] = c; - }b = i[d + 20 >> 2];if (!b) { - break b; - }i[c + 20 >> 2] = b;i[b + 24 >> 2] = c;break b; - }c = i[f + 4 >> 2];if ((c & 3) != 3) { - break b; - }i[3810] = a;i[f + 4 >> 2] = c & -2;i[d + 4 >> 2] = a | 1;i[a + d >> 2] = a;return; - }if (f >>> 0 <= d >>> 0) { - break a; - }c = i[f + 4 >> 2];if (!(c & 1)) { - break a; - }f: { - if (!(c & 2)) { - if (i[3814] == (f | 0)) { - i[3814] = d;a = i[3811] + a | 0;i[3811] = a;i[d + 4 >> 2] = a | 1;if (i[3813] != (d | 0)) { - break a; - }i[3810] = 0;i[3813] = 0;return; - }if (i[3813] == (f | 0)) { - i[3813] = d;a = i[3810] + a | 0;i[3810] = a;i[d + 4 >> 2] = a | 1;i[a + d >> 2] = a;return; - }a = (c & -8) + a | 0;g: { - if (c >>> 0 <= 255) { - b = i[f + 8 >> 2];c = c >>> 3 | 0;e = i[f + 12 >> 2];if ((b | 0) == (e | 0)) { - i[3808] = i[3808] & ic(c);break g; - }i[b + 12 >> 2] = e;i[e + 8 >> 2] = b;break g; - }h = i[f + 24 >> 2];c = i[f + 12 >> 2];h: { - if ((f | 0) != (c | 0)) { - b = i[f + 8 >> 2];i[b + 12 >> 2] = c;i[c + 8 >> 2] = b;break h; - }i: { - e = f + 20 | 0;b = i[e >> 2];if (b) { - break i; - }e = f + 16 | 0;b = i[e >> 2];if (b) { - break i; - }c = 0;break h; - }while (1) { - g = e;c = b;e = c + 20 | 0;b = i[e >> 2];if (b) { - continue; - }e = c + 16 | 0;b = i[c + 16 >> 2];if (b) { - continue; - }break; - }i[g >> 2] = 0; - }if (!h) { - break g; - }e = i[f + 28 >> 2];b = (e << 2) + 15536 | 0;j: { - if (i[b >> 2] == (f | 0)) { - i[b >> 2] = c;if (c) { - break j; - }i[3809] = i[3809] & ic(e);break g; - }i[h + (i[h + 16 >> 2] == (f | 0) ? 16 : 20) >> 2] = c;if (!c) { - break g; - } - }i[c + 24 >> 2] = h;b = i[f + 16 >> 2];if (b) { - i[c + 16 >> 2] = b;i[b + 24 >> 2] = c; - }b = i[f + 20 >> 2];if (!b) { - break g; - }i[c + 20 >> 2] = b;i[b + 24 >> 2] = c; - }i[d + 4 >> 2] = a | 1;i[a + d >> 2] = a;if (i[3813] != (d | 0)) { - break f; - }i[3810] = a;return; - }i[f + 4 >> 2] = c & -2;i[d + 4 >> 2] = a | 1;i[a + d >> 2] = a; - }if (a >>> 0 <= 255) { - a = a >>> 3 | 0;c = (a << 3) + 15272 | 0;b = i[3808];a = 1 << a;k: { - if (!(b & a)) { - i[3808] = a | b;a = c;break k; - }a = i[c + 8 >> 2]; - }i[c + 8 >> 2] = d;i[a + 12 >> 2] = d;i[d + 12 >> 2] = c;i[d + 8 >> 2] = a;return; - }i[d + 16 >> 2] = 0;i[d + 20 >> 2] = 0;f = d;e = a >>> 8 | 0;b = 0;l: { - if (!e) { - break l; - }b = 31;if (a >>> 0 > 16777215) { - break l; - }c = e;e = e + 1048320 >>> 16 & 8;b = c << e;h = b + 520192 >>> 16 & 4;b = b << h;g = b + 245760 >>> 16 & 2;b = (b << g >>> 15 | 0) - (g | (e | h)) | 0;b = (b << 1 | a >>> b + 21 & 1) + 28 | 0; - }i[f + 28 >> 2] = b;g = (b << 2) + 15536 | 0;m: { - n: { - e = i[3809];c = 1 << b;o: { - if (!(e & c)) { - i[3809] = c | e;i[g >> 2] = d;i[d + 24 >> 2] = g;break o; - }e = a << ((b | 0) == 31 ? 0 : 25 - (b >>> 1 | 0) | 0);c = i[g >> 2];while (1) { - b = c;if ((i[c + 4 >> 2] & -8) == (a | 0)) { - break n; - }c = e >>> 29 | 0;e = e << 1;g = b + (c & 4) | 0;c = i[g + 16 >> 2];if (c) { - continue; - }break; - }i[g + 16 >> 2] = d;i[d + 24 >> 2] = b; - }i[d + 12 >> 2] = d;i[d + 8 >> 2] = d;break m; - }a = i[b + 8 >> 2];i[a + 12 >> 2] = d;i[b + 8 >> 2] = d;i[d + 24 >> 2] = 0;i[d + 12 >> 2] = b;i[d + 8 >> 2] = a; - }a = i[3816] + -1 | 0;i[3816] = a;if (a) { - break a; - }d = 15688;while (1) { - a = i[d >> 2];d = a + 8 | 0;if (a) { - continue; - }break; - }i[3816] = -1; - } - }function Na(a, b) { - var c = 0, - d = 0, - e = 0, - f = 0, - g = 0, - h = 0;f = a + b | 0;a: { - b: { - c = i[a + 4 >> 2];if (c & 1) { - break b; - }if (!(c & 3)) { - break a; - }c = i[a >> 2];b = c + b | 0;a = a - c | 0;if ((a | 0) != i[3813]) { - if (c >>> 0 <= 255) { - e = c >>> 3 | 0;c = i[a + 8 >> 2];d = i[a + 12 >> 2];if ((d | 0) == (c | 0)) { - i[3808] = i[3808] & ic(e);break b; - }i[c + 12 >> 2] = d;i[d + 8 >> 2] = c;break b; - }h = i[a + 24 >> 2];c = i[a + 12 >> 2];c: { - if ((c | 0) != (a | 0)) { - d = i[a + 8 >> 2];i[d + 12 >> 2] = c;i[c + 8 >> 2] = d;break c; - }d: { - d = a + 20 | 0;e = i[d >> 2];if (e) { - break d; - }d = a + 16 | 0;e = i[d >> 2];if (e) { - break d; - }c = 0;break c; - }while (1) { - g = d;c = e;d = c + 20 | 0;e = i[d >> 2];if (e) { - continue; - }d = c + 16 | 0;e = i[c + 16 >> 2];if (e) { - continue; - }break; - }i[g >> 2] = 0; - }if (!h) { - break b; - }d = i[a + 28 >> 2];e = (d << 2) + 15536 | 0;e: { - if (i[e >> 2] == (a | 0)) { - i[e >> 2] = c;if (c) { - break e; - }i[3809] = i[3809] & ic(d);break b; - }i[h + (i[h + 16 >> 2] == (a | 0) ? 16 : 20) >> 2] = c;if (!c) { - break b; - } - }i[c + 24 >> 2] = h;d = i[a + 16 >> 2];if (d) { - i[c + 16 >> 2] = d;i[d + 24 >> 2] = c; - }d = i[a + 20 >> 2];if (!d) { - break b; - }i[c + 20 >> 2] = d;i[d + 24 >> 2] = c;break b; - }c = i[f + 4 >> 2];if ((c & 3) != 3) { - break b; - }i[3810] = b;i[f + 4 >> 2] = c & -2;i[a + 4 >> 2] = b | 1;i[f >> 2] = b;return; - }c = i[f + 4 >> 2];f: { - if (!(c & 2)) { - if (i[3814] == (f | 0)) { - i[3814] = a;b = i[3811] + b | 0;i[3811] = b;i[a + 4 >> 2] = b | 1;if (i[3813] != (a | 0)) { - break a; - }i[3810] = 0;i[3813] = 0;return; - }if (i[3813] == (f | 0)) { - i[3813] = a;b = i[3810] + b | 0;i[3810] = b;i[a + 4 >> 2] = b | 1;i[a + b >> 2] = b;return; - }b = (c & -8) + b | 0;g: { - if (c >>> 0 <= 255) { - e = c >>> 3 | 0;c = i[f + 8 >> 2];d = i[f + 12 >> 2];if ((d | 0) == (c | 0)) { - i[3808] = i[3808] & ic(e);break g; - }i[c + 12 >> 2] = d;i[d + 8 >> 2] = c;break g; - }h = i[f + 24 >> 2];c = i[f + 12 >> 2];h: { - if ((f | 0) != (c | 0)) { - d = i[f + 8 >> 2];i[d + 12 >> 2] = c;i[c + 8 >> 2] = d;break h; - }i: { - d = f + 20 | 0;e = i[d >> 2];if (e) { - break i; - }d = f + 16 | 0;e = i[d >> 2];if (e) { - break i; - }c = 0;break h; - }while (1) { - g = d;c = e;d = c + 20 | 0;e = i[d >> 2];if (e) { - continue; - }d = c + 16 | 0;e = i[c + 16 >> 2];if (e) { - continue; - }break; - }i[g >> 2] = 0; - }if (!h) { - break g; - }d = i[f + 28 >> 2];e = (d << 2) + 15536 | 0;j: { - if (i[e >> 2] == (f | 0)) { - i[e >> 2] = c;if (c) { - break j; - }i[3809] = i[3809] & ic(d);break g; - }i[h + (i[h + 16 >> 2] == (f | 0) ? 16 : 20) >> 2] = c;if (!c) { - break g; - } - }i[c + 24 >> 2] = h;d = i[f + 16 >> 2];if (d) { - i[c + 16 >> 2] = d;i[d + 24 >> 2] = c; - }d = i[f + 20 >> 2];if (!d) { - break g; - }i[c + 20 >> 2] = d;i[d + 24 >> 2] = c; - }i[a + 4 >> 2] = b | 1;i[a + b >> 2] = b;if (i[3813] != (a | 0)) { - break f; - }i[3810] = b;return; - }i[f + 4 >> 2] = c & -2;i[a + 4 >> 2] = b | 1;i[a + b >> 2] = b; - }if (b >>> 0 <= 255) { - c = b >>> 3 | 0;b = (c << 3) + 15272 | 0;d = i[3808];c = 1 << c;k: { - if (!(d & c)) { - i[3808] = c | d;c = b;break k; - }c = i[b + 8 >> 2]; - }i[b + 8 >> 2] = a;i[c + 12 >> 2] = a;i[a + 12 >> 2] = b;i[a + 8 >> 2] = c;return; - }i[a + 16 >> 2] = 0;i[a + 20 >> 2] = 0;d = a;e = b >>> 8 | 0;c = 0;l: { - if (!e) { - break l; - }c = 31;if (b >>> 0 > 16777215) { - break l; - }g = e + 1048320 >>> 16 & 8;e = e << g;c = e + 520192 >>> 16 & 4;f = e << c;e = f + 245760 >>> 16 & 2;c = (f << e >>> 15 | 0) - (e | (c | g)) | 0;c = (c << 1 | b >>> c + 21 & 1) + 28 | 0; - }i[d + 28 >> 2] = c;e = (c << 2) + 15536 | 0;m: { - d = i[3809];g = 1 << c;n: { - if (!(d & g)) { - i[3809] = d | g;i[e >> 2] = a;break n; - }d = b << ((c | 0) == 31 ? 0 : 25 - (c >>> 1 | 0) | 0);c = i[e >> 2];while (1) { - e = c;if ((i[c + 4 >> 2] & -8) == (b | 0)) { - break m; - }c = d >>> 29 | 0;d = d << 1;g = e + (c & 4) | 0;c = i[g + 16 >> 2];if (c) { - continue; - }break; - }i[g + 16 >> 2] = a; - }i[a + 24 >> 2] = e;i[a + 12 >> 2] = a;i[a + 8 >> 2] = a;return; - }b = i[e + 8 >> 2];i[b + 12 >> 2] = a;i[e + 8 >> 2] = a;i[a + 24 >> 2] = 0;i[a + 12 >> 2] = e;i[a + 8 >> 2] = b; - } - }function hb(a, b, c) { - a = a | 0;b = b | 0;c = c | 0;var d = 0, - e = 0, - f = 0, - g = 0;d = H - 16 | 0;H = d;a: { - b: { - c: { - d: { - e: { - f: { - g: { - h: { - switch (b | 0) {case 101: - b = i[a + 20 >> 2];if ((b | 0) >= 1) { - break g; - }break a;case 26: - if (i[a + 24 >> 2] >= 1) { - b = i[a + 64 >> 2];c = 0;while (1) { - i[b + (c << 2) >> 2] = 0;c = c + 1 | 0;if ((c | 0) < i[a + 24 >> 2] << 1) { - continue; - }break; - } - }b = i[a + 44 >> 2];e = i[a + 48 >> 2];c = 0;while (1) { - f = c << 1;h[f + e >> 1] = 0;h[b + f >> 1] = 0;c = c + 1 | 0;if ((c | 0) != 64) { - continue; - }break; - }e = 0;h[a + 80 >> 1] = 0;break a;case 10: - i[a + 96 >> 2] = i[c >> 2];break a;case 8: - a = i[a + 4 >> 2];J[i[i[a >> 2] + 48 >> 2]](a, 8, c) | 0;break a;case 9: - a = i[a + 4 >> 2];J[i[i[a >> 2] + 48 >> 2]](a, 9, c) | 0;break a;case 3: - i[c >> 2] = i[a + 8 >> 2];break a;case 0: - b = i[a + 4 >> 2];J[i[i[b >> 2] + 48 >> 2]](b, 0, c) | 0;i[a + 36 >> 2] = i[c >> 2];break a;case 1: - i[c >> 2] = i[a + 36 >> 2];break a;case 4:case 6: - b = i[c >> 2];b = (b | 0) > 0 ? b : 0;b = i[i[a >> 2] >> 2] + (((b | 0) < 10 ? b : 10) << 2) | 0;i[a + 96 >> 2] = i[b + 104 >> 2];i[d + 12 >> 2] = i[b + 60 >> 2];a = i[a + 4 >> 2];J[i[i[a >> 2] + 48 >> 2]](a, 6, d + 12 | 0) | 0;break a;case 19: - b = i[a + 4 >> 2];J[i[i[b >> 2] + 48 >> 2]](b, 19, c) | 0;b = i[a + 32 >> 2];e = i[i[a + 92 >> 2] + (i[a + 96 >> 2] << 2) >> 2];if (e) { - i[c >> 2] = i[c >> 2] + ((o(b, i[e + 52 >> 2]) | 0) / i[a + 8 >> 2] | 0);e = 0;break a; - }i[c >> 2] = i[c >> 2] + ((b << 2) / i[a + 8 >> 2] | 0);e = 0;break a;case 24: - b = i[c >> 2];i[a + 32 >> 2] = b;i[d + 12 >> 2] = b >> 1;a = i[a + 4 >> 2];J[i[i[a >> 2] + 48 >> 2]](a, 24, d + 12 | 0) | 0;break a;case 25: - i[c >> 2] = i[a + 32 >> 2];break a;case 20: - a = i[a + 4 >> 2];J[i[i[a >> 2] + 48 >> 2]](a, 20, c) | 0;break a;case 22: - a = i[a + 4 >> 2];J[i[i[a >> 2] + 48 >> 2]](a, 22, c) | 0;break a;case 36: - i[a + 88 >> 2] = i[c >> 2];a = i[a + 4 >> 2];J[i[i[a >> 2] + 48 >> 2]](a, 36, c) | 0;break a;case 37: - i[c >> 2] = i[a + 88 >> 2];break a;case 39: - a = i[a + 4 >> 2];J[i[i[a >> 2] + 48 >> 2]](a, 39, c) | 0;i[c >> 2] = i[c >> 2] << 1;break a;case 44: - a = i[a + 4 >> 2];J[i[i[a >> 2] + 48 >> 2]](a, 44, c) | 0;break a;case 45: - a = i[a + 4 >> 2];J[i[i[a >> 2] + 48 >> 2]](a, 45, c) | 0;break a;case 47: - a = i[a + 4 >> 2];J[i[i[a >> 2] + 48 >> 2]](a, 47, c) | 0;break a;case 106: - break c;case 105: - break d;case 104: - break e;case 103: - break f;case 100: - break h;default: - break b;} - }if (i[a + 20 >> 2] < 1) { - break a; - }f = i[a + 68 >> 2];b = 0;while (1) { - g = b << 2;i[g + c >> 2] = i[f + g >> 2];b = b + 1 | 0;if ((b | 0) < i[a + 20 >> 2]) { - continue; - }break; - }break a; - }f = i[a + 72 >> 2];a = 0;while (1) { - g = a << 1;h[g + c >> 1] = k[f + g >> 1];a = a + 1 | 0;if ((b | 0) != (a | 0)) { - continue; - }break; - }break a; - }a = i[a + 4 >> 2];J[i[i[a >> 2] + 48 >> 2]](a, 103, c) | 0;break a; - }i[a + 76 >> 2] = c;break a; - }a = i[a + 4 >> 2];J[i[i[a >> 2] + 48 >> 2]](a, 105, c) | 0;break a; - }i[c >> 2] = i[a + 40 >> 2];break a; - }i[d + 4 >> 2] = b;i[d >> 2] = 13123;Y(i[3524], 13166, d);e = -1; - }H = d + 16 | 0;return e | 0; - }function $a(a) { - var b = 0, - c = 0, - d = 0, - e = 0, - f = 0, - g = 0, - h = 0, - i = 0, - j = 0, - k = 0, - l = 0, - m = 0, - o = 0, - p = 0;c = 1;a: { - b: { - nc(+a);e = kc(1) | 0;g = kc(0) | 0;b = e;c: { - if ((b | 0) == 1072693248 ? !g : 0) { - break c; - }e = b & 2147483647;if (e >>> 0 > 2146435072 | (e | 0) == 2146435072 & (g | 0) != 0) { - return a + .3; - }c = q(a);if (!((e ? (b & 1073741823) != 1072693248 : 0) | g)) { - if ((b | 0) > -1) { - break c; - }if (!(e + -1072693248 | 0)) { - a = c - c;return a / a; - }return c; - }if ((b | 0) <= -1) { - a = a - a;return a / a; - }d = c * 9007199254740992;h = e >>> 0 < 1048576;a = h ? d : c;nc(+d);b = kc(1) | 0;kc(0) | 0;b = h ? b : e;g = b & 1048575;e = g | 1072693248;m = (b >> 20) + (h ? -1076 : -1023) | 0;d: { - if (g >>> 0 < 235663) { - break d; - }if (g >>> 0 < 767610) { - j = 1;break d; - }e = e + -1048576 | 0;m = m + 1 | 0; - }h = j << 3;p = n[h + 14080 >> 3];nc(+a);kc(1) | 0;lc(0, kc(0) | 0);lc(1, e | 0);c = +mc();i = n[h + 14048 >> 3];d = c - i;a = 1 / (i + c);l = d * a;nc(+l);b = kc(1) | 0;kc(0) | 0;lc(0, 0);lc(1, b | 0);k = +mc();f = k * k;o = a;lc(0, 0);lc(1, ((e >> 1 | 536870912) + (j << 18) | 0) + 524288 | 0);a = +mc();i = o * (d - k * a - k * (c - (a - i)));a = l * l;a = (l + k) * i + a * a * (a * (a * (a * (a * (a * .20697501780033842 + .23066074577556175) + .272728123808534) + .33333332981837743) + .4285714285785502) + .5999999999999946);nc(+(f + 3 + a));b = kc(1) | 0;kc(0) | 0;lc(0, 0);lc(1, b | 0);c = +mc();d = k * c;a = i * c + l * (a - (c + -3 - f));nc(+(d + a));b = kc(1) | 0;kc(0) | 0;lc(0, 0);lc(1, b | 0);f = +mc();i = f * .9617967009544373;d = n[h + 14064 >> 3] + ((a - (f - d)) * .9617966939259756 + f * -7.028461650952758e-9);a = +(m | 0);nc(+(p + (i + d) + a));b = kc(1) | 0;kc(0) | 0;lc(0, 0);lc(1, b | 0);f = +mc();c = f * .2999999523162842;d = (d - (f - a - p - i)) * .3 + f * 4.768371580921027e-8;a = c + d;nc(+a);h = kc(1) | 0;g = kc(0) | 0;e: { - b = h;h = b;if ((b | 0) >= 1083179008) { - if (g | h + -1083179008) { - break b; - }if (d + 8.008566259537294e-17 > a - c ^ 1) { - break e; - }break b; - }if ((h & 2147482624) >>> 0 < 1083231232) { - break e; - }if (g | h + 1064252416) { - break a; - }if (d <= a - c ^ 1) { - break e; - }break a; - }j = 0;e = h & 2147483647;if (e >>> 0 >= 1071644673) { - g = h + (1048576 >>> (e >>> 20 | 0) + -1022 | 0) | 0;e = g >>> 20 & 2047;b = (g & 1048575 | 1048576) >>> 1043 - e | 0;j = (h | 0) < 0 ? 0 - b | 0 : b;lc(0, 0);lc(1, g & -1048576 >> e + -1023);c = c - +mc();nc(+(d + c));b = kc(1) | 0;kc(0) | 0; - }lc(0, 0);lc(1, b | 0);a = +mc();i = a * .6931471824645996;d = (d - (a - c)) * .6931471805599453 + a * -1.904654299957768e-9;f = i + d;a = f * f;a = f - a * (a * (a * (a * (a * 4.1381367970572385e-8 + -16533902205465252e-22) + 6613756321437934e-20) + -.0027777777777015593) + .16666666666666602);o = f * a / (a + -2);a = d - (f - i);a = f - (o - (a + f * a)) + 1;nc(+a);b = kc(1) | 0;g = kc(0) | 0;b = (j << 20) + b | 0;f: { - if ((b | 0) <= 1048575) { - a = cc(a, j);break f; - }lc(0, g | 0);lc(1, b | 0);a = +mc(); - }c = a * 1; - }return c; - }return z; - }return 0; - }function ha(a, b, c, d) { - var e = 0, - f = 0, - g = 0, - j = 0, - k = 0, - l = 0, - m = 0, - n = 0, - p = 0, - q = 0, - r = 0, - s = 0, - t = 0, - u = 0, - v = 0, - w = 0, - x = 0, - y = 0, - z = 0;q = (0 - d & 3) + d | 0;n = c >> 1;f = n + 1 | 0;j = f << 2;d = q + j | 0;d = (0 - d & 3) + d | 0;g = j;k = c + 3 | 0;l = o(k, f) << 2;f = l + d | 0;j = (0 - f & 3) + f | 0;f = g + j | 0;f = (0 - f & 3) + f | 0;l = f + l | 0;if ((c | 0) >= 0) { - p = (n | 0) > 0 ? n : 0;while (1) { - g = e << 2;r = o(e, k) << 2;i[g + q >> 2] = r + d;i[j + g >> 2] = f + r;g = (e | 0) != (p | 0);e = e + 1 | 0;if (g) { - continue; - }break; - } - }l = l + (l & 1) | 0;e = 0;if ((c | 0) > 0) { - while (1) { - f = e << 1;d = h[f + a >> 1];a: { - if ((d | 0) <= 12867) { - d = (o(d, d) << 3) + 32768 >> 16;d = (o(((o((o(d, -10) + 4096 >> 13) + 340 | 0, d) << 3) + 32768 & -65536) + -268435456 >> 16, d) + 4096 >>> 13 | 0) - -8192 | 0;break a; - }d = 25736 - d << 16 >> 16;d = (o(d, d) << 3) + 32768 >> 16;d = -8192 - (o(((o((o(d, -10) + 4096 >> 13) + 340 | 0, d) << 3) + 32768 & -65536) + -268435456 >> 16, d) + 4096 >>> 13 | 0) | 0; - }h[f + l >> 1] = d << 2;e = e + 1 | 0;if ((e | 0) != (c | 0)) { - continue; - }break; - } - }e = 0;if ((c | 0) >= 0) { - d = (n | 0) > 0 ? n : 0;while (1) { - f = e << 2;a = i[f + q >> 2];i[a + 4 >> 2] = 0;i[a + 8 >> 2] = 1048576;k = (e << 3) + 8 | 0;i[k + a >> 2] = 1048576;a = i[f + j >> 2];i[a + 4 >> 2] = 0;i[a + 8 >> 2] = 1048576;i[a + k >> 2] = 1048576;a = (d | 0) != (e | 0);e = e + 1 | 0;if (a) { - continue; - }break; - } - }d = i[q + 4 >> 2];e = h[l >> 1];a = i[i[q >> 2] + 8 >> 2];i[d + 12 >> 2] = 0 - (o(e, a << 2 >> 16) + (o(e, a & 16383) >> 14) | 0);e = h[l + 2 >> 1];a = i[i[j >> 2] + 8 >> 2];i[i[j + 4 >> 2] + 12 >> 2] = 0 - (o(e, a << 2 >> 16) + (o(e, a & 16383) >> 14) | 0);if ((c | 0) >= 4) { - x = (n | 0) > 2 ? n : 2;e = 3;k = 1;while (1) { - f = 2;a = k << 2;p = h[a + l >> 1];g = i[d + 8 >> 2];g = o(p, g << 2 >> 16) + (o(p, g & 16383) >> 14) | 0;s = a + j | 0;r = i[s >> 2];k = k + 1 | 0;m = k << 2;t = m + j | 0;y = i[t >> 2];u = l + (a | 2) | 0;v = h[u >> 1];w = q + m | 0;z = i[w >> 2];a = 1;while (1) { - m = a << 2;a = m + 8 | 0;i[a + z >> 2] = i[d + m >> 2] + (i[a + d >> 2] - g | 0);g = a + y | 0;m = i[m + r >> 2] + i[a + r >> 2] | 0;a = f;f = i[r + (a << 2) >> 2];i[g >> 2] = (m - (o(f & 16383, v) >> 14) | 0) - o(f << 2 >> 16, v);f = a + 1 | 0;m = f << 2;g = i[m + d >> 2];g = o(p, g << 2 >> 16) + (o(p, g & 16383) >> 14) | 0;if ((a | 0) != (e | 0)) { - continue; - }break; - }a = i[w >> 2];f = e + 2 | 0;p = f << 2;e = e << 2;i[a + p >> 2] = i[e + d >> 2] - g;g = i[s >> 2];d = i[g + m >> 2];g = i[e + g >> 2];e = h[u >> 1];i[p + i[t >> 2] >> 2] = (g - (o(e, d & 16383) >> 14) | 0) - o(e, d << 2 >> 16);d = a;e = f;if ((k | 0) != (x | 0)) { - continue; - }break; - } - }if ((c | 0) >= 1) { - a = n << 2;f = i[a + j >> 2];n = i[a + q >> 2];d = 0;e = 1;a = 0;while (1) { - j = d - a | 0;a = (e << 2) + 8 | 0;d = i[a + n >> 2];a = i[a + f >> 2];j = a + (d + j | 0) | 0;j = (j | 0) < -8388480 ? -32767 : j + 128 >> 8;h[((e << 1) + b | 0) + -2 >> 1] = (j | 0) < 32767 ? j : 32767;j = (c | 0) != (e | 0);e = e + 1 | 0;if (j) { - continue; - }break; - } - } - }function Kb(a, b, c, d) { - var e = p(0), - f = p(0), - g = 0, - j = p(0), - k = p(0), - l = p(0), - n = 0, - o = p(0), - r = p(0), - u = p(0), - v = p(0), - w = 0, - x = p(0), - y = 0, - z = 0, - A = p(0), - B = p(0), - C = p(0), - D = p(0), - E = p(0), - F = 0, - G = 0, - H = 0, - I = 0;g = c >> 1;if ((c | 0) >= 2) { - I = (g | 0) > 1 ? g : 1;while (1) { - e = f;f = p(h[(w << 1) + b >> 1]);f = p(e + p(f * f));w = w + 1 | 0;if ((I | 0) != (w | 0)) { - continue; - }break; - } - }if ((g | 0) < (c | 0)) { - while (1) { - j = p(h[(g << 1) + b >> 1]);x = p(x + p(j * j));g = g + 1 | 0;if ((g | 0) != (c | 0)) { - continue; - }break; - } - }l = m[a + 52 >> 2];u = m[a + 56 >> 2];k = p(l / u);m[a + 48 >> 2] = k;j = p(f + x);e = m[a >> 2];A = p(p(j * e) + p(p(p(1) - e) * m[a + 4 >> 2]));m[a + 4 >> 2] = A;B = m[a + 16 >> 2];r = p(ba(+p(j + p(6e3))));C = m[a + 12 >> 2];e = p(r - C);o = p(p(e * e) + p(0));e = p(r - B);o = p(o + p(e * e));D = m[a + 20 >> 2];e = p(r - D);o = p(o + p(e * e));E = m[a + 24 >> 2];e = p(r - E);o = p(o + p(e * e));e = p(r - m[a + 28 >> 2]);o = p(s(p(p(o + p(e * e)) / p(150)), p(1)));F = +d;y = F + -.4;v = p(y * 3 * q(y));G = +j;e = p($a(G));H = +u;if (!(j > p(6e3) ^ 1 | H < .06 ^ 1)) { - l = p(+e * .05);m[a + 52 >> 2] = l; - }a: { - b: { - z = +v;n = +o;c: { - if ((+k * 1.2 > +e ? !(z < .3 ^ 1 | n < .2 ^ 1) : 0) | (+k * 1.5 > +e ? !(z < .3 ^ 1 | n < .05 ^ 1) : 0)) { - break c; - }if (+k * 1.2 > +e ? !(z < .4 ^ 1 | n < .05 ^ 1) : 0) { - break c; - }if (v < p(0) ^ 1 | n < .05 ^ 1) { - break b; - } - }b = i[a + 60 >> 2];g = b + 1 | 0;i[a + 60 >> 2] = g;if ((b | 0) < 3) { - break a; - }u = p(H * .95 + .05);m[a + 56 >> 2] = u;v = p(k * p(3));l = p(+(v < e ? v : e) * .05 + +l * .95);m[a + 52 >> 2] = l;break a; - }g = 0;i[a + 60 >> 2] = 0; - }if (!(j > p(6e3) ^ 1 | k > e ^ 1)) { - m[a + 56 >> 2] = +u * .95 + .05;m[a + 52 >> 2] = +e * .05 + +l * .95; - }d: { - if (!(j < p(3e4) ^ 1)) { - e = j < p(1e4) ? p(5.600000381469727) : p(6.300000190734863);f = e;if (j < p(3e3) ^ 1) { - break d; - }f = p(+e + -.7);break d; - }l = p(j + p(1));e = p(s(p(t(p(ba(+p(l / p(A + p(1))))), p(-5))), p(2)));n = +e;k = e > p(0) ? p(n * .6 + 7) : p(7);e = e < p(0) ? p(n * .5 + +k) : k;k = p(ba(+p(l / p(m[a + 8 >> 2] + p(1)))));if (!(k > p(0) ^ 1)) { - e = p(+p(s(k, p(5))) * .5 + +e); - }f = +f * 1.6 < +x ? p(e + p(.5)) : e; - }m[a + 8 >> 2] = j;e = p(F * .4 + +m[a + 40 >> 2] * .6);m[a + 40 >> 2] = e;k = m[a + 44 >> 2];f = p((y + (+e + -.4)) * 2.2 + +f);if (!(k > f ^ 1)) { - f = p(+k * .5 + +f * .5); - }f = (g | 0) > 2 ? p(4) : p(s(p(t(f, p(4))), p(10)));if (g) { - f = p(+f - (ba(+(g | 0) + 3) + -1.0986122886681098)); - }f = p(t(f, p(0)));if (!(j < p(6e4) ^ 1)) { - e: { - if ((g | 0) < 3) { - break e; - }n = (ba(+(g | 0) + 3) + -1.0986122886681098) * .5;f = p(+f - n);if (j < p(1e4) ^ 1) { - break e; - }f = p(+f - n); - }f = p(ba(G / 6e4 + 1e-4) * .3 + +p(t(f, p(0)))); - }m[a + 36 >> 2] = d;m[a + 28 >> 2] = E;m[a + 24 >> 2] = D;m[a + 20 >> 2] = B;m[a + 16 >> 2] = C;m[a + 12 >> 2] = r;d = p(t(f, p(-1)));m[a + 44 >> 2] = d;return d; - }function qb(a, b, c, d) { - a = a | 0;b = b | 0;c = c | 0;d = d | 0;var e = 0, - f = 0, - i = 0, - j = 0, - l = 0, - m = 0, - n = 0, - p = 0, - q = 0, - r = 0;p = H - 32 | 0;H = p;a: { - b: { - c: { - if ((c | 0) < 1) { - break c; - }while (1) { - f = e << 1;h[f + b >> 1] = k[a + f >> 1];e = e + 1 | 0;if ((e | 0) != (c | 0)) { - continue; - }break; - }if ((c | 0) < 1) { - break c; - }f = h[b >> 1];j = p;i = c + -1 | 0;e = 25736;d: { - if (!i) { - break d; - }e = k[b + 2 >> 1]; - }e = e - f | 0;h[j >> 1] = 81920 / (((e << 16 >> 16 < (f | 0) ? e : f) << 16) + 19660800 >> 16);e = 1;if ((c | 0) != 1) { - while (1) { - m = e << 1;f = m + b | 0;l = k[f >> 1];j = l - k[f + -2 >> 1] << 16 >> 16;f = e + 1 | 0;e = ((e | 0) != (i | 0) ? k[(f << 1) + b >> 1] : 25736) - l | 0;h[m + p >> 1] = 81920 / (((e << 16 >> 16 < (j | 0) ? e : j) << 16) + 19660800 >> 16);e = f;if ((e | 0) != (c | 0)) { - continue; - }break; - } - }if ((c | 0) < 1) { - break c; - }e = 0;while (1) { - f = (e << 1) + b | 0;h[f >> 1] = k[f >> 1] - (o(e, 167772160) + 402653184 >>> 16 | 0);e = e + 1 | 0;if ((e | 0) != (c | 0)) { - continue; - }break; - }if ((c | 0) < 1) { - break c; - }m = 2147483647;l = 0;f = 4016;j = 0;while (1) { - i = 0;e = f;n = 0;while (1) { - r = i;i = k[(n << 1) + b >> 1] - (g[e | 0] << 5) << 16 >> 16;i = r + o(i, i) | 0;e = e + 1 | 0;n = n + 1 | 0;if ((n | 0) != (c | 0)) { - continue; - }break; - }e = (i | 0) < (m | 0);l = e ? j : l;m = e ? i : m;f = c + f | 0;j = j + 1 | 0;if ((j | 0) != 64) { - continue; - }break; - }f = o(c, l);e = 0;while (1) { - j = (e << 1) + b | 0;h[j >> 1] = k[j >> 1] - (g[(e + f | 0) + 4016 | 0] << 5);e = e + 1 | 0;if ((e | 0) != (c | 0)) { - continue; - }break; - }W(d, l, 6);if ((c | 0) < 1) { - break b; - }e = 0;while (1) { - f = (e << 1) + b | 0;h[f >> 1] = k[f >> 1] << 1;e = e + 1 | 0;if ((e | 0) != (c | 0)) { - continue; - }break; - }if ((c | 0) < 1) { - break b; - }f = 2147483647;m = 0;j = 4528;l = 0;while (1) { - i = 0;e = j;n = 0;while (1) { - r = i;i = n << 1;q = k[i + b >> 1] - (g[e | 0] << 5) << 16 >> 16;q = o(q, q);i = h[i + p >> 1];i = (r + (o(q & 32767, i) >> 15) | 0) + o(i, q << 1 >> 16) | 0;e = e + 1 | 0;n = n + 1 | 0;if ((n | 0) != (c | 0)) { - continue; - }break; - }e = (i | 0) < (f | 0);m = e ? l : m;f = e ? i : f;j = c + j | 0;l = l + 1 | 0;if ((l | 0) != 64) { - continue; - }break; - }f = o(c, m);e = 0;while (1) { - j = (e << 1) + b | 0;h[j >> 1] = k[j >> 1] - (g[(e + f | 0) + 4528 | 0] << 5);e = e + 1 | 0;if ((e | 0) != (c | 0)) { - continue; - }break; - }W(d, m, 6);e = 0;if ((c | 0) <= 0) { - break a; - }while (1) { - d = (e << 1) + b | 0;h[d >> 1] = h[d >> 1] + 1 >>> 1;e = e + 1 | 0;if ((e | 0) != (c | 0)) { - continue; - }break; - }e = 0;if ((c | 0) <= 0) { - break a; - }while (1) { - d = e << 1;f = d + b | 0;h[f >> 1] = k[a + d >> 1] - k[f >> 1];e = e + 1 | 0;if ((e | 0) != (c | 0)) { - continue; - }break; - }break a; - }W(d, 0, 6); - }W(d, 0, 6); - }H = p + 32 | 0; - }function wb(a, b, c) { - a = a | 0;b = b | 0;c = c | 0;var d = 0, - e = 0, - f = 0, - g = p(0), - j = 0;f = H - 16 | 0;H = f;a: { - b: { - switch (b | 0) {case 101: - if (i[a + 20 >> 2] < 1) { - break a; - }b = 0;while (1) { - d = i[a + 16 >> 2];h[(b << 1) + c >> 1] = Z(i[a + 52 >> 2] + (o(d, b) << 1) | 0, d);b = b + 1 | 0;if ((b | 0) < i[a + 20 >> 2]) { - continue; - }break; - }break a;case 26: - if (i[a + 24 >> 2] >= 1) { - b = i[a + 64 >> 2];c = 0;while (1) { - i[b + (c << 2) >> 2] = 0;c = c + 1 | 0;if ((c | 0) < i[a + 24 >> 2]) { - continue; - }break; - } - }b = i[a + 32 >> 2] + i[a + 12 >> 2] | 0;if ((b | 0) < 0) { - break a; - }U(i[a + 48 >> 2], 0, (b << 1) + 2 | 0);break a;case 6:case 8: - i[a + 120 >> 2] = i[c >> 2];break a;case 7:case 9: - i[c >> 2] = i[a + 120 >> 2];break a;case 0: - i[a + 124 >> 2] = i[c >> 2];break a;case 1: - i[c >> 2] = i[a + 124 >> 2];break a;case 3: - i[c >> 2] = i[a + 12 >> 2];break a;case 19: - b = i[a + 36 >> 2];e = i[i[a + 116 >> 2] + (i[a + 120 >> 2] << 2) >> 2];if (e) { - i[c >> 2] = (o(b, i[e + 52 >> 2]) | 0) / i[a + 12 >> 2];e = 0;break a; - }i[c >> 2] = (o(b, 5) | 0) / i[a + 12 >> 2];e = 0;break a;case 24: - i[a + 36 >> 2] = i[c >> 2];break a;case 25: - i[c >> 2] = i[a + 36 >> 2];break a;case 20: - b = i[c >> 2];a = o(b, 20) + a | 0;i[a + 132 >> 2] = i[c + 4 >> 2];c = i[c + 8 >> 2];i[a + 128 >> 2] = b;i[a + 136 >> 2] = c;break a;case 22: - i[a + 452 >> 2] = i[c + 4 >> 2];i[a + 456 >> 2] = i[c + 8 >> 2];i[a + 448 >> 2] = i[c >> 2];break a;case 36: - i[a + 112 >> 2] = i[c >> 2];break a;case 37: - i[c >> 2] = i[a + 112 >> 2];break a;case 39: - i[c >> 2] = i[a + 16 >> 2];break a;case 44: - i[a + 492 >> 2] = i[c >> 2];break a;case 45: - i[c >> 2] = i[a + 492 >> 2];break a;case 47: - b = h[a + 86 >> 1];d = h[a + 84 >> 1];a = h[a + 88 >> 1];g = p(s(p(ba(+((d | 0) / (a | 0) | 0)) / ba(+((b | 0) / (a | 0) | 0))), p(1)));g = p((g > p(0) ? g : p(0)) * p(100));c: { - if (p(q(g)) < p(2147483648)) { - a = ~~g;break c; - }a = -2147483648; - }i[c >> 2] = a;break a;case 100: - if (i[a + 20 >> 2] < 1) { - break a; - }d = i[a + 76 >> 2];b = 0;while (1) { - j = b << 2;i[j + c >> 2] = i[d + j >> 2];b = b + 1 | 0;if ((b | 0) < i[a + 20 >> 2]) { - continue; - }break; - }break a;case 103: - i[c >> 2] = i[a + 484 >> 2];break a;case 104: - i[a + 80 >> 2] = c;break a;case 105: - i[a + 488 >> 2] = i[c >> 2];break a;case 106: - i[c >> 2] = i[a + 44 >> 2];break a;default: - break b;} - }i[f + 4 >> 2] = b;i[f >> 2] = 12742;Y(i[3524], 12828, f);e = -1; - }H = f + 16 | 0;return e | 0; - }function dc(a, b) { - var c = 0, - d = 0, - e = 0, - f = 0, - g = 0, - h = 0, - j = 0, - k = 0, - l = 0;g = i[a + 4 >> 2];c = g & 3;d = g & -8;f = d + a | 0;a: { - if (!c) { - c = 0;if (b >>> 0 < 256) { - break a; - }if (d >>> 0 >= b + 4 >>> 0) { - c = a;if (d - b >>> 0 <= i[3928] << 1 >>> 0) { - break a; - } - }return 0; - }b: { - if (d >>> 0 >= b >>> 0) { - c = d - b | 0;if (c >>> 0 < 16) { - break b; - }i[a + 4 >> 2] = g & 1 | b | 2;b = a + b | 0;i[b + 4 >> 2] = c | 3;i[f + 4 >> 2] = i[f + 4 >> 2] | 1;Na(b, c);break b; - }c = 0;if (i[3814] == (f | 0)) { - d = d + i[3811] | 0;if (d >>> 0 <= b >>> 0) { - break a; - }i[a + 4 >> 2] = g & 1 | b | 2;c = a + b | 0;b = d - b | 0;i[c + 4 >> 2] = b | 1;i[3811] = b;i[3814] = c;break b; - }if (i[3813] == (f | 0)) { - d = d + i[3810] | 0;if (d >>> 0 < b >>> 0) { - break a; - }c = d - b | 0;c: { - if (c >>> 0 >= 16) { - i[a + 4 >> 2] = g & 1 | b | 2;b = a + b | 0;i[b + 4 >> 2] = c | 1;d = a + d | 0;i[d >> 2] = c;i[d + 4 >> 2] = i[d + 4 >> 2] & -2;break c; - }i[a + 4 >> 2] = d | g & 1 | 2;b = a + d | 0;i[b + 4 >> 2] = i[b + 4 >> 2] | 1;c = 0;b = 0; - }i[3813] = b;i[3810] = c;break b; - }e = i[f + 4 >> 2];if (e & 2) { - break a; - }h = d + (e & -8) | 0;if (h >>> 0 < b >>> 0) { - break a; - }k = h - b | 0;d: { - if (e >>> 0 <= 255) { - c = i[f + 8 >> 2];e = e >>> 3 | 0;d = i[f + 12 >> 2];if ((d | 0) == (c | 0)) { - i[3808] = i[3808] & ic(e);break d; - }i[c + 12 >> 2] = d;i[d + 8 >> 2] = c;break d; - }j = i[f + 24 >> 2];d = i[f + 12 >> 2];e: { - if ((f | 0) != (d | 0)) { - c = i[f + 8 >> 2];i[c + 12 >> 2] = d;i[d + 8 >> 2] = c;break e; - }f: { - c = f + 20 | 0;e = i[c >> 2];if (e) { - break f; - }c = f + 16 | 0;e = i[c >> 2];if (e) { - break f; - }d = 0;break e; - }while (1) { - l = c;d = e;c = d + 20 | 0;e = i[c >> 2];if (e) { - continue; - }c = d + 16 | 0;e = i[d + 16 >> 2];if (e) { - continue; - }break; - }i[l >> 2] = 0; - }if (!j) { - break d; - }c = i[f + 28 >> 2];e = (c << 2) + 15536 | 0;g: { - if (i[e >> 2] == (f | 0)) { - i[e >> 2] = d;if (d) { - break g; - }i[3809] = i[3809] & ic(c);break d; - }i[j + (i[j + 16 >> 2] == (f | 0) ? 16 : 20) >> 2] = d;if (!d) { - break d; - } - }i[d + 24 >> 2] = j;c = i[f + 16 >> 2];if (c) { - i[d + 16 >> 2] = c;i[c + 24 >> 2] = d; - }c = i[f + 20 >> 2];if (!c) { - break d; - }i[d + 20 >> 2] = c;i[c + 24 >> 2] = d; - }if (k >>> 0 <= 15) { - i[a + 4 >> 2] = g & 1 | h | 2;b = a + h | 0;i[b + 4 >> 2] = i[b + 4 >> 2] | 1;break b; - }i[a + 4 >> 2] = g & 1 | b | 2;b = a + b | 0;i[b + 4 >> 2] = k | 3;c = a + h | 0;i[c + 4 >> 2] = i[c + 4 >> 2] | 1;Na(b, k); - }c = a; - }return c; - }function Qb(a, b, c, d, e, f, j, k, l, m, n, p, q, r, s) { - a = a | 0;b = b | 0;c = c | 0;d = d | 0;e = e | 0;f = f | 0;j = j | 0;k = k | 0;l = l | 0;m = m | 0;n = n | 0;p = p | 0;q = q | 0;r = r | 0;s = s | 0;var t = 0;d = i[f + 4 >> 2];e = i[f >> 2];n = V(m, i[f + 8 >> 2]);e = e + o(4 << d, s) | 0;f = V(m, i[f + 4 >> 2]) << 2;s = g[e + f | 0];d = s + 32 | 0;t = g[e + (f | 2) | 0];m = t + 32 | 0;e = g[e + (f | 1) | 0] + 32 | 0;c = c + n | 0;a: { - if (!p | (c | 0) <= (q | 0)) { - break a; - }f = e >> 31;f = ((f + e ^ f) + ((s | 0) > -32 ? d : 0 - (d >>> 1 | 0) | 0) | 0) + ((t | 0) > -32 ? m : 0 - (m >>> 1 | 0) | 0) << 16 >> 16;n = r >> ((p | 0) > 3);n = (n | 0) < 62 ? n : 62;if ((f | 0) <= (n | 0)) { - break a; - }f = (n << 14) / (f | 0) << 16 >> 16;m = o(f, m) >>> 14 | 0;e = o(e, f) >>> 14 | 0;d = o(d, f) >>> 14 | 0; - }i[k >> 2] = c;h[l + 4 >> 1] = m;h[l + 2 >> 1] = e;h[l >> 1] = d;l = 0;b = U(b, 0, j << 2);k = m << 7;f = c + 1 | 0;m = (f | 0) < (j | 0) ? f : j;if ((m | 0) >= 1) { - n = (f | 0) > (j | 0) ? j : f;p = k << 16 >> 16;while (1) { - q = b + (l << 2) | 0;i[q >> 2] = i[q >> 2] + o(p, h[(l - f << 1) + a >> 1]);l = l + 1 | 0;if ((n | 0) != (l | 0)) { - continue; - }break; - } - }f = c + f | 0;l = (f | 0) < (j | 0) ? f : j;if ((m | 0) < (l | 0)) { - k = k << 16 >> 16;while (1) { - n = b + (m << 2) | 0;i[n >> 2] = i[n >> 2] + o(k, h[(m - f << 1) + a >> 1]);m = m + 1 | 0;if ((m | 0) < (l | 0)) { - continue; - }break; - } - }e = e << 7;m = (c | 0) < (j | 0) ? c : j;if ((m | 0) >= 1) { - f = (c | 0) > (j | 0) ? j : c;k = e << 16 >> 16;l = 0;while (1) { - n = b + (l << 2) | 0;i[n >> 2] = i[n >> 2] + o(k, h[(l - c << 1) + a >> 1]);l = l + 1 | 0;if ((f | 0) != (l | 0)) { - continue; - }break; - } - }f = c << 1;k = (f | 0) < (j | 0) ? f : j;if ((m | 0) < (k | 0)) { - e = e << 16 >> 16;while (1) { - l = b + (m << 2) | 0;i[l >> 2] = i[l >> 2] + o(e, h[(m - f << 1) + a >> 1]);m = m + 1 | 0;if ((m | 0) < (k | 0)) { - continue; - }break; - } - }e = d << 7;d = c + -1 | 0;m = (d | 0) < (j | 0) ? d : j;if ((m | 0) >= 1) { - f = (d | 0) > (j | 0) ? j : d;k = e << 16 >> 16;l = 0;while (1) { - n = b + (l << 2) | 0;i[n >> 2] = i[n >> 2] + o(k, h[(l - d << 1) + a >> 1]);l = l + 1 | 0;if ((f | 0) != (l | 0)) { - continue; - }break; - } - }c = c + d | 0;d = (c | 0) < (j | 0) ? c : j;if ((m | 0) < (d | 0)) { - e = e << 16 >> 16;while (1) { - f = b + (m << 2) | 0;i[f >> 2] = i[f >> 2] + o(e, h[(m - c << 1) + a >> 1]);m = m + 1 | 0;if ((m | 0) < (d | 0)) { - continue; - }break; - } - } - }function ua(a, b, c, d, e, f, g) { - var i = 0, - j = 0, - l = 0, - m = 0, - n = 0, - p = 0, - q = 0, - r = 0, - s = 0, - t = 0, - u = 0, - v = 0, - w = 0, - x = 0, - y = 0, - z = 0, - A = 0, - B = 0, - C = 0;n = (g & 1) + g | 0;i = d >> 1;j = n + (i + 32 << 1) | 0;if ((d | 0) >= 2) { - l = (i | 0) > 1 ? i : 1;g = 0;while (1) { - h[(g << 1) + n >> 1] = k[((g ^ -1) + i << 1) + a >> 1];g = g + 1 | 0;if ((l | 0) != (g | 0)) { - continue; - }break; - } - }g = 0;while (1) { - h[(g + i << 1) + n >> 1] = k[(g << 2 | 2) + e >> 1];g = g + 1 | 0;if ((g | 0) != 32) { - continue; - }break; - }j = j + (j & 1) | 0;if ((d | 0) >= 2) { - a = (i | 0) > 1 ? i : 1;g = 0;while (1) { - h[j + (g << 1) >> 1] = k[((g ^ -1) + i << 1) + b >> 1];g = g + 1 | 0;if ((a | 0) != (g | 0)) { - continue; - }break; - } - }g = 0;while (1) { - h[j + (g + i << 1) >> 1] = k[(g << 2 | 2) + f >> 1];g = g + 1 | 0;if ((g | 0) != 32) { - continue; - }break; - }if ((d | 0) >= 2) { - C = i + -2 | 0;while (1) { - d = 0;l = 0;q = 0;b = v + C << 1;a = k[b + n >> 1];b = k[b + j >> 1];g = 0;r = 0;while (1) { - m = g << 2;w = h[(m | 2) + 12848 >> 1];x = b << 16 >> 16;a = a << 16 >> 16;p = o(w, x + a | 0) + l | 0;b = (g + i | 0) + v << 1;l = b + -2 | 0;t = h[l + j >> 1];u = h[l + n >> 1];y = t + u | 0;z = h[(m | 6) + 12848 >> 1];l = p + o(y, z) | 0;p = h[m + 12848 >> 1];A = 0 - p << 16 >> 16;m = h[(m | 4) + 12848 >> 1];B = 0 - m << 16 >> 16;q = (((o(a, p) + q | 0) + o(A, x) | 0) + o(m, u) | 0) + o(t, B) | 0;a = h[b + n >> 1];b = h[b + j >> 1];d = (o(w, y) + d | 0) + o(a + b | 0, z) | 0;r = (((o(u, p) + r | 0) + o(t, A) | 0) + o(a, m) | 0) + o(b, B) | 0;g = g + 2 | 0;if ((g | 0) < 32) { - continue; - }break; - }a = s << 2;b = r + 16384 >> 15;h[a + c >> 1] = (r | 0) > 1073725439 ? 32767 : (b | 0) > -32767 ? b : -32767;b = d + 16384 >> 15;h[(a | 2) + c >> 1] = (d | 0) > 1073725439 ? 32767 : (b | 0) > -32767 ? b : -32767;b = q + 16384 >> 15;h[(a | 4) + c >> 1] = (q | 0) > 1073725439 ? 32767 : (b | 0) > -32767 ? b : -32767;b = (a | 6) + c | 0;a = l + 16384 >> 15;h[b >> 1] = (l | 0) > 1073725439 ? 32767 : (a | 0) > -32767 ? a : -32767;v = -2 - s | 0;s = s + 2 | 0;if ((s | 0) < (i | 0)) { - continue; - }break; - } - }g = 0;while (1) { - h[(g << 2 | 2) + e >> 1] = k[(g << 1) + n >> 1];g = g + 1 | 0;if ((g | 0) != 32) { - continue; - }break; - }g = 0;while (1) { - h[(g << 2 | 2) + f >> 1] = k[j + (g << 1) >> 1];g = g + 1 | 0;if ((g | 0) != 32) { - continue; - }break; - } - }function Z(a, b) { - var c = 0, - d = 0, - e = 0, - f = 0, - g = 0, - i = 0;c = 10;a: { - b: { - c: { - if ((b | 0) < 1) { - break c; - }while (1) { - f = h[(e << 1) + a >> 1];d = f >> 31;d = d ^ d + f;c = ((d | 0) > c << 16 >> 16 ? d : c) << 16 >> 16;e = e + 1 | 0;if ((e | 0) != (b | 0)) { - continue; - }break; - }if ((c | 0) >= 16384) { - c = 0;if ((b | 0) >= 1) { - e = 0;while (1) { - g = c;c = e << 1;d = h[(c | 2) + a >> 1] >> 1;f = o(d, d);d = h[a + c >> 1] >> 1;f = f + o(d, d) | 0;d = h[(c | 4) + a >> 1] >> 1;c = h[(c | 6) + a >> 1] >> 1;c = g + ((f + o(d, d) | 0) + o(c, c) >>> 6 | 0) | 0;e = e + 4 | 0;if ((e | 0) < (b | 0)) { - continue; - }break; - } - }a = (c | 0) / (b | 0) | 0;b = a >>> 0 > 65535;c = b << 3;g = c | 4;d = c;b = b ? a >>> 16 | 0 : a;c = b >>> 0 > 255;e = c ? g : d;b = c ? b >>> 8 | 0 : b;c = b >>> 0 > 15;b = (c ? e | 2 : e) | (c ? b >>> 4 | 0 : b) >>> 0 > 3;c = b << 1;d = a >> c + -12;a = a << 12 - c;c = b << 16 >> 16;a = ((c | 0) > 6 ? d : a) << 16 >> 16;a = (o((o(o(a, 16816) + -827523072 >> 16, a) << 2 & -65536) + 1387593728 >> 16, a) << 2 & -65536) + 238157824 >> 16;b = 13 - b | 0;a = ((c | 0) < 13 ? a >> b : a << 0 - b) << 16 >> 12;break a; - }if ((c | 0) <= 4095) { - break c; - }d = (c | 0) < 8192;break b; - }d = 2; - }e = (c | 0) < 2048 ? 3 : d;d = 0;if ((b | 0) >= 1) { - c = 0;while (1) { - g = d;d = c << 1;f = h[(d | 2) + a >> 1] << e << 16 >> 16;i = o(f, f);f = h[a + d >> 1] << e << 16 >> 16;i = i + o(f, f) | 0;f = h[(d | 4) + a >> 1] << e << 16 >> 16;d = h[(d | 6) + a >> 1] << e << 16 >> 16;d = g + ((i + o(f, f) | 0) + o(d, d) >>> 6 | 0) | 0;c = c + 4 | 0;if ((c | 0) < (b | 0)) { - continue; - }break; - } - }a = (d | 0) / (b | 0) | 0;b = a >>> 0 > 65535;c = b << 3;g = c | 4;d = c;b = b ? a >>> 16 | 0 : a;c = b >>> 0 > 255;d = c ? g : d;b = c ? b >>> 8 | 0 : b;c = b >>> 0 > 15;b = (c ? d | 2 : d) | (c ? b >>> 4 | 0 : b) >>> 0 > 3;c = b << 1;d = a >> c + -12;a = a << 12 - c;c = b << 16 >> 16;a = ((c | 0) > 6 ? d : a) << 16 >> 16;a = (o((o(o(a, 16816) + -827523072 >> 16, a) << 2 & -65536) + 1387593728 >> 16, a) << 2 & -65536) + 238157824 >> 16;b = 13 - b | 0;a = ((c | 0) < 13 ? a >> b : a << 0 - b) << 16 >> 16 << (e ^ 3); - }return a << 16 >> 16; - }function tb(a, b, c) { - a = a | 0;b = b | 0;c = c | 0;var d = 0, - e = 0;if ((b | 0) >= 1) { - while (1) { - e = (d << 1) + a | 0;d = d + 1 | 0;h[e >> 1] = d << 11;if ((b | 0) != (d | 0)) { - continue; - }break; - } - }b = o(V(c, 6), 10);h[a >> 1] = (g[b + 8848 | 0] << 5) + k[a >> 1];h[a + 4 >> 1] = k[a + 4 >> 1] + (g[b + 8850 | 0] << 5);h[a + 6 >> 1] = k[a + 6 >> 1] + (g[b + 8851 | 0] << 5);h[a + 8 >> 1] = k[a + 8 >> 1] + (g[b + 8852 | 0] << 5);h[a + 10 >> 1] = k[a + 10 >> 1] + (g[b + 8853 | 0] << 5);h[a + 12 >> 1] = k[a + 12 >> 1] + (g[b + 8854 | 0] << 5);h[a + 14 >> 1] = k[a + 14 >> 1] + (g[b + 8855 | 0] << 5);h[a + 16 >> 1] = k[a + 16 >> 1] + (g[b + 8856 | 0] << 5);h[a + 18 >> 1] = k[a + 18 >> 1] + (g[b + 8857 | 0] << 5);h[a + 2 >> 1] = k[a + 2 >> 1] + (g[(b | 1) + 8848 | 0] << 5);b = o(V(c, 6), 5);h[a >> 1] = (g[b + 9488 | 0] << 4) + k[a >> 1];h[a + 2 >> 1] = k[a + 2 >> 1] + (g[b + 9489 | 0] << 4);h[a + 4 >> 1] = k[a + 4 >> 1] + (g[b + 9490 | 0] << 4);h[a + 6 >> 1] = k[a + 6 >> 1] + (g[b + 9491 | 0] << 4);h[a + 8 >> 1] = k[a + 8 >> 1] + (g[b + 9492 | 0] << 4);b = o(V(c, 6), 5);h[a >> 1] = (g[b + 9808 | 0] << 3) + k[a >> 1];h[a + 2 >> 1] = k[a + 2 >> 1] + (g[b + 9809 | 0] << 3);h[a + 4 >> 1] = k[a + 4 >> 1] + (g[b + 9810 | 0] << 3);h[a + 6 >> 1] = k[a + 6 >> 1] + (g[b + 9811 | 0] << 3);h[a + 8 >> 1] = k[a + 8 >> 1] + (g[b + 9812 | 0] << 3);b = o(V(c, 6), 5);h[a + 10 >> 1] = (g[b + 10128 | 0] << 4) + k[a + 10 >> 1];h[a + 12 >> 1] = k[a + 12 >> 1] + (g[b + 10129 | 0] << 4);h[a + 14 >> 1] = k[a + 14 >> 1] + (g[b + 10130 | 0] << 4);h[a + 16 >> 1] = k[a + 16 >> 1] + (g[b + 10131 | 0] << 4);h[a + 18 >> 1] = k[a + 18 >> 1] + (g[b + 10132 | 0] << 4);b = o(V(c, 6), 5);h[a + 10 >> 1] = (g[b + 10448 | 0] << 3) + k[a + 10 >> 1];h[a + 12 >> 1] = k[a + 12 >> 1] + (g[b + 10449 | 0] << 3);h[a + 14 >> 1] = k[a + 14 >> 1] + (g[b + 10450 | 0] << 3);h[a + 16 >> 1] = k[a + 16 >> 1] + (g[b + 10451 | 0] << 3);h[a + 18 >> 1] = k[a + 18 >> 1] + (g[b + 10452 | 0] << 3); - }function ob(a) { - a = a | 0;var b = 0, - c = 0, - d = 0, - e = 0, - f = 0, - g = 0;d = H - 16 | 0;H = d;b = T(168);if (b) { - i[b >> 2] = a;a = i[a >> 2];c = i[a >> 2];c = J[i[c + 20 >> 2]](c) | 0;i[b + 4 >> 2] = c;J[i[i[c >> 2] + 44 >> 2]](c, 106, b + 44 | 0) | 0;c = i[a + 4 >> 2];i[b + 12 >> 2] = c;i[b + 8 >> 2] = c << 1;e = i[a + 8 >> 2];i[b + 16 >> 2] = e;i[b + 24 >> 2] = c + e;i[b + 20 >> 2] = (c | 0) / (e | 0);c = i[a + 12 >> 2];i[b + 148 >> 2] = a + 24;i[b + 144 >> 2] = 1;i[b + 28 >> 2] = c;c = i[a + 56 >> 2];i[b + 156 >> 2] = c;i[b + 152 >> 2] = c;i[d + 12 >> 2] = 9;c = i[b + 4 >> 2];J[i[i[c >> 2] + 44 >> 2]](c, 4, d + 12 | 0) | 0;i[d + 12 >> 2] = 1;c = i[b + 4 >> 2];J[i[i[c >> 2] + 44 >> 2]](c, 105, d + 12 | 0) | 0;h[b + 36 >> 1] = k[a + 20 >> 1];h[b + 38 >> 1] = k[a + 16 >> 1];a = k[a + 18 >> 1];i[b + 32 >> 2] = 1;h[b + 40 >> 1] = a;i[b + 48 >> 2] = T(i[b + 24 >> 2] - i[b + 12 >> 2] << 1);i[b + 52 >> 2] = T(128);a = T(128);i[b + 64 >> 2] = 13328;i[b + 60 >> 2] = 13360;i[b + 56 >> 2] = a;c = i[b + 28 >> 2];a = c << 1;e = T(a);i[b + 68 >> 2] = e;i[b + 72 >> 2] = T(a);i[b + 76 >> 2] = T(a);a = i[b + 20 >> 2];i[b + 92 >> 2] = T(a << 2);a = T(a << 1);i[b + 100 >> 2] = 0;i[b + 96 >> 2] = a;a = c << 2;i[b + 80 >> 2] = T(a);i[b + 84 >> 2] = T(a);i[b + 88 >> 2] = T(a);if ((c | 0) >= 1) { - f = c + 1 | 0;a = 0;while (1) { - g = e + (a << 1) | 0;a = a + 1 | 0;h[g >> 1] = (o(a << 16 >> 16, 25736) | 0) / (f | 0);if ((a | 0) != (c | 0)) { - continue; - }break; - } - }i[b + 112 >> 2] = 0;i[b + 116 >> 2] = 2e4;i[b + 104 >> 2] = 1090519040;i[b + 108 >> 2] = 0;i[b + 160 >> 2] = 2;i[b + 136 >> 2] = 0;i[b + 140 >> 2] = 0;i[b + 120 >> 2] = 0;a = i[b + 4 >> 2];J[i[i[a >> 2] + 44 >> 2]](a, 25, b + 164 | 0) | 0;i[b + 164 >> 2] = i[b + 164 >> 2] << 1; - }H = d + 16 | 0;return b | 0; - }function Db(a) { - a = a | 0;var b = 0, - c = 0, - d = 0, - e = 0, - f = 0, - g = 0;c = i[a >> 2];b = T(224);if (b) { - d = T(32e3);i[b >> 2] = a;i[b + 64 >> 2] = d;a = i[c >> 2];i[b + 8 >> 2] = a;d = i[c + 4 >> 2];i[b + 12 >> 2] = d;i[b + 20 >> 2] = a + d;f = (a | 0) / (d | 0) | 0;i[b + 16 >> 2] = f;a = i[c + 8 >> 2];i[b + 24 >> 2] = a;h[b + 56 >> 1] = k[c + 20 >> 1];h[b + 58 >> 1] = k[c + 22 >> 1];i[b + 28 >> 2] = i[c + 12 >> 2];i[b + 32 >> 2] = i[c + 16 >> 2];e = k[c + 24 >> 1];i[b + 204 >> 2] = c + 28;h[b + 60 >> 1] = e;e = i[c + 92 >> 2];i[b + 208 >> 2] = e;i[b + 212 >> 2] = e;i[b + 200 >> 2] = 1;i[b + 36 >> 2] = 1024;i[b + 40 >> 2] = 1;i[b + 68 >> 2] = T(d << 1);d = T((i[c + 16 >> 2] + i[c >> 2] << 1) + 4 | 0);i[b + 72 >> 2] = d;e = i[c + 16 >> 2];i[b + 76 >> 2] = (d + (e << 1) | 0) + 4;d = T((e + i[c >> 2] << 1) + 4 | 0);i[b + 80 >> 2] = d;c = i[c + 16 >> 2];i[b + 92 >> 2] = 13328;i[b + 88 >> 2] = 13360;i[b + 84 >> 2] = (d + (c << 1) | 0) + 4;c = a << 1;d = T(c);i[b + 96 >> 2] = d;c = T(c);i[b + 4 >> 2] = 1;i[b + 100 >> 2] = c;if ((a | 0) >= 1) { - e = a + 1 | 0;c = 0;while (1) { - g = d + (c << 1) | 0;c = c + 1 | 0;h[g >> 1] = (o(c << 16 >> 16, 25736) | 0) / (e | 0);if ((a | 0) != (c | 0)) { - continue; - }break; - } - }a = a << 2;i[b + 104 >> 2] = T(a);i[b + 108 >> 2] = T(a);i[b + 112 >> 2] = T(a);i[b + 116 >> 2] = T(a);i[b + 120 >> 2] = T(a);a = f << 2;i[b + 132 >> 2] = T(a);i[b + 52 >> 2] = T(a);a = T(64);i[b + 140 >> 2] = a;Lb(a);i[b + 152 >> 2] = 0;i[b + 156 >> 2] = 0;i[b + 144 >> 2] = 1090519040;i[b + 160 >> 2] = 0;i[b + 164 >> 2] = 0;i[b + 168 >> 2] = 0;i[b + 172 >> 2] = 0;i[b + 176 >> 2] = 0;i[b + 180 >> 2] = 0;i[b + 196 >> 2] = 2;i[b + 216 >> 2] = 0;i[b + 220 >> 2] = 1;i[b + 188 >> 2] = 2;i[b + 192 >> 2] = 8e3; - }return b | 0; - }function ab(a, b, c, d) { - a = a | 0;b = b | 0;c = c | 0;d = d | 0;var e = 0, - f = 0, - g = 0, - h = 0, - k = 0, - l = 0, - m = 0, - n = 0, - p = 0, - q = 0, - r = 0, - s = 0, - t = 0, - u = 0, - v = 0;h = H - 128 | 0;g = h;H = g;i[d >> 2] = 0;a: { - if (b >>> 0 <= 79) { - ma(13984);break a; - }X(g + 8 | 0, a, 80);if (i[g + 8 >> 2] != 1701146707 | i[g + 12 >> 2] != 538976376) { - ma(13945);break a; - }e = eb(g + 8 | 0);X(g + 8 | 0, e, 80);S(e);n = 160;e = 10920;b: { - c: { - d: { - e: { - f = i[g + 48 >> 2];switch (f | 0) {case 0: - break b;case 1: - break d;default: - break e;} - }if ((f | 0) != 16777216) { - break c; - } - }n = 320;p = 1;e = 11588;break b; - }ma(13760); - }k = J[i[e + 32 >> 2]](e) | 0;q = n << 1;r = h - (q + 15 & -16) | 0;h = r;H = h;i[g + 4 >> 2] = 1;J[i[i[k >> 2] + 48 >> 2]](k, 0, g + 4 | 0) | 0;Fa(g + 88 | 0);e = i[3654];s = h - (e + 15 & -16) | 0;H = s;h = o(b, 10);i[c >> 2] = Pa(h);f: { - g: { - if ((b | 0) == 80) { - break g; - }l = e;e = j[a + 80 | 0] | j[a + 81 | 0] << 8;f = (e << 24 | e << 8) >>> 16 | 0;if ((l | 0) >= (f | 0)) { - a = a + 82 | 0;e = b + -82 | 0;b = h;while (1) { - if (e >>> 0 < f >>> 0) { - ma(13855);p = 0;break f; - }bb(k, g + 88 | 0, X(s, a, f), r, n, f);t = e - f | 0;u = m + n | 0;h: { - if (u >>> 0 <= b >>> 0) { - e = i[c >> 2];break h; - }while (1) { - b = b + h | 0;e = Pa(b);l = i[c >> 2];v = X(e, l, m);if (l) { - S(l); - }i[c >> 2] = v;if (u >>> 0 > b >>> 0) { - continue; - }break; - } - }X(e + m | 0, r, q);m = m + q | 0;if (!t) { - break g; - }e = t + -2 | 0;f = a + f | 0;a = f + 2 | 0;f = j[f | 0] | j[f + 1 | 0] << 8;f = (f << 24 | f << 8) >>> 16 | 0;if (i[3654] >= (f | 0)) { - continue; - }break; - } - }ma(13885);p = 0;break f; - }i[d >> 2] = m; - }if (i[g + 104 >> 2]) { - S(i[g + 88 >> 2]); - }J[i[i[k >> 2] + 36 >> 2]](k); - }H = g + 128 | 0;return p | 0; - }function X(a, b, c) { - var d = 0, - e = 0, - f = 0;if (c >>> 0 >= 512) { - C(a | 0, b | 0, c | 0) | 0;return a; - }e = a + c | 0;a: { - if (!((a ^ b) & 3)) { - b: { - if ((c | 0) < 1) { - c = a;break b; - }if (!(a & 3)) { - c = a;break b; - }c = a;while (1) { - g[c | 0] = j[b | 0];b = b + 1 | 0;c = c + 1 | 0;if (c >>> 0 >= e >>> 0) { - break b; - }if (c & 3) { - continue; - }break; - } - }d = e & -4;c: { - if (d >>> 0 < 64) { - break c; - }f = d + -64 | 0;if (c >>> 0 > f >>> 0) { - break c; - }while (1) { - i[c >> 2] = i[b >> 2];i[c + 4 >> 2] = i[b + 4 >> 2];i[c + 8 >> 2] = i[b + 8 >> 2];i[c + 12 >> 2] = i[b + 12 >> 2];i[c + 16 >> 2] = i[b + 16 >> 2];i[c + 20 >> 2] = i[b + 20 >> 2];i[c + 24 >> 2] = i[b + 24 >> 2];i[c + 28 >> 2] = i[b + 28 >> 2];i[c + 32 >> 2] = i[b + 32 >> 2];i[c + 36 >> 2] = i[b + 36 >> 2];i[c + 40 >> 2] = i[b + 40 >> 2];i[c + 44 >> 2] = i[b + 44 >> 2];i[c + 48 >> 2] = i[b + 48 >> 2];i[c + 52 >> 2] = i[b + 52 >> 2];i[c + 56 >> 2] = i[b + 56 >> 2];i[c + 60 >> 2] = i[b + 60 >> 2];b = b - -64 | 0;c = c - -64 | 0;if (c >>> 0 <= f >>> 0) { - continue; - }break; - } - }if (c >>> 0 >= d >>> 0) { - break a; - }while (1) { - i[c >> 2] = i[b >> 2];b = b + 4 | 0;c = c + 4 | 0;if (c >>> 0 < d >>> 0) { - continue; - }break; - }break a; - }if (e >>> 0 < 4) { - c = a;break a; - }d = e + -4 | 0;if (d >>> 0 < a >>> 0) { - c = a;break a; - }c = a;while (1) { - g[c | 0] = j[b | 0];g[c + 1 | 0] = j[b + 1 | 0];g[c + 2 | 0] = j[b + 2 | 0];g[c + 3 | 0] = j[b + 3 | 0];b = b + 4 | 0;c = c + 4 | 0;if (c >>> 0 <= d >>> 0) { - continue; - }break; - } - }if (c >>> 0 < e >>> 0) { - while (1) { - g[c | 0] = j[b | 0];b = b + 1 | 0;c = c + 1 | 0;if ((e | 0) != (c | 0)) { - continue; - }break; - } - }return a; - }function La(a, b, c, d, e, f, g) { - var j = 0, - l = 0, - m = 0, - n = 0, - p = 0, - q = 0, - r = 0, - s = 0, - t = 0, - u = 0, - v = 0;h[d >> 1] = 8192;m = (0 - g & 3) + g | 0;l = m + (f << 2) | 0;n = 0 - l | 0;if ((f | 0) > 0) { - while (1) { - g = j + 1 | 0;h[(g << 1) + d >> 1] = k[(j << 1) + b >> 1];j = g;if ((j | 0) != (f | 0)) { - continue; - }break; - }j = f; - }b = j + 1 | 0;if ((b | 0) < (e | 0)) { - U((b << 1) + d | 0, 0, (j ^ -1) + e << 1); - }g = l + (n & 3) | 0;j = 0;if ((f | 0) > 0) { - while (1) { - b = j << 2;i[b + g >> 2] = 0;i[b + m >> 2] = 0;j = j + 1 | 0;if ((j | 0) != (f | 0)) { - continue; - }break; - } - }a: { - if ((e | 0) < 1) { - break a; - }n = f + -1 | 0;b = n << 2;q = b + g | 0;j = n << 1;r = j + a | 0;s = b + m | 0;t = c + j | 0;l = 0;if ((f | 0) >= 2) { - while (1) { - f = (l << 1) + d | 0;p = k[f >> 1] + ((i[m >> 2] << 3) + 32768 >>> 16 | 0) | 0;b = (i[g >> 2] + (p << 16 >> 16 << 14) | 0) + 4096 >>> 13 | 0;h[f >> 1] = b;j = 0;f = 0 - p << 16 >> 16;p = 0 - (b << 16) >> 16;while (1) { - u = j << 2;b = j + 1 | 0;v = b << 2;j = j << 1;i[u + m >> 2] = i[v + m >> 2] + o(f, h[j + c >> 1]);i[g + u >> 2] = i[g + v >> 2] + o(p, h[a + j >> 1]);j = b;if ((n | 0) != (j | 0)) { - continue; - }break; - }i[s >> 2] = o(f, h[t >> 1]);i[q >> 2] = o(p, h[r >> 1]);l = l + 1 | 0;if ((l | 0) != (e | 0)) { - continue; - }break a; - } - }while (1) { - b = (l << 1) + d | 0;c = k[b >> 1] + ((i[m >> 2] << 3) + 32768 >>> 16 | 0) | 0;a = (i[g >> 2] + (c << 16 >> 16 << 14) | 0) + 4096 >>> 13 | 0;h[b >> 1] = a;i[s >> 2] = o(h[t >> 1], 0 - c << 16 >> 16);i[q >> 2] = o(h[r >> 1], 0 - (a << 16) >> 16);l = l + 1 | 0;if ((l | 0) != (e | 0)) { - continue; - }break; - } - } - }function Ga(a, b, c, d, e, f, g, j) { - var k = 0, - l = 0, - m = 0, - n = 0, - p = 0, - q = 0, - r = 0, - s = 0, - t = 0, - u = 0, - v = 0;a: { - if ((d | 0) < 1) { - break a; - }r = f + -1 | 0;s = (r << 2) + j | 0;if ((c | 0) >= 1) { - while (1) { - m = 0;l = 0;k = b;while (1) { - m = o(h[k >> 1], h[(l << 1) + a >> 1]) + m | 0;k = k + 2 | 0;l = l + 1 | 0;if ((l | 0) != (c | 0)) { - continue; - }break; - }v = c << 1;t = (m | 0) > 0;n = (i[(p << 2) + e >> 2] >> 1) + (t ? 0 - m | 0 : m) | 0;b: { - if ((n | 0) >= i[s >> 2] ? (p | 0) >= (f | 0) : 0) { - break b; - }m = r;l = m;k = f;c: { - if ((k | 0) < 2) { - break c; - }while (1) { - l = m;k = k + -2 << 2;m = i[k + j >> 2];if ((n | 0) >= (m | 0) ? (l | 0) <= (q | 0) : 0) { - break c; - }u = l << 2;i[u + j >> 2] = m;i[g + u >> 2] = i[g + k >> 2];m = l + -1 | 0;k = l;if ((k | 0) > 1) { - continue; - }break; - }l = 0; - }k = l << 2;i[k + j >> 2] = n;k = g + k | 0;i[k >> 2] = p;q = q + 1 | 0;if (t) { - break b; - }i[k >> 2] = d + p; - }b = b + v | 0;p = p + 1 | 0;if ((p | 0) != (d | 0)) { - continue; - }break; - }break a; - }while (1) { - a = i[(n << 2) + e >> 2] >> 1;if (!((a | 0) >= i[s >> 2] ? (n | 0) >= (f | 0) : 0)) { - m = r;l = m;k = f;d: { - if ((k | 0) < 2) { - break d; - }while (1) { - l = m;b = k + -2 << 2;c = i[b + j >> 2];if ((a | 0) >= (c | 0) ? (l | 0) <= (q | 0) : 0) { - break d; - }k = l << 2;i[k + j >> 2] = c;i[g + k >> 2] = i[b + g >> 2];m = l + -1 | 0;k = l;if ((k | 0) > 1) { - continue; - }break; - }l = 0; - }b = l << 2;i[b + j >> 2] = a;i[b + g >> 2] = d + n;q = q + 1 | 0; - }n = n + 1 | 0;if ((n | 0) != (d | 0)) { - continue; - }break; - } - } - }function Ub(a, b, c, d, e, f) { - var g = 0, - i = 0, - j = 0, - l = 0, - m = 0, - n = 0, - p = 0, - q = 0, - r = 0, - s = 0, - t = 0;j = (f & 1) + f | 0;f = j + 128 | 0;i = (f & 1) + f | 0;f = 0;while (1) { - h[((f ^ -1) - -64 << 1) + j >> 1] = k[(f << 1) + 12848 >> 1];f = f + 1 | 0;if ((f | 0) != 64) { - continue; - }break; - }f = 0;while (1) { - h[(f << 1) + i >> 1] = k[(62 - f << 1) + e >> 1];f = f + 1 | 0;if ((f | 0) != 63) { - continue; - }break; - }if ((d | 0) >= 1) { - f = 0;while (1) { - h[(f + 63 << 1) + i >> 1] = h[(f << 1) + a >> 1] >>> 1;f = f + 1 | 0;if ((f | 0) != (d | 0)) { - continue; - }break; - } - }f = 0;while (1) { - h[(f << 1) + e >> 1] = h[((f ^ -1) + d << 1) + a >> 1] >>> 1;f = f + 1 | 0;if ((f | 0) != 63) { - continue; - }break; - }if ((d | 0) > 0) { - m = i + 126 | 0;t = d + -1 >>> 1 | 0;e = 0;while (1) { - d = 0;a = 0;f = 0;while (1) { - g = f | 1;n = k[(g + e << 1) + i >> 1];p = h[(f << 1) + j >> 1];q = k[(e + f << 1) + i >> 1];r = k[(e - f << 1) + m >> 1];s = h[(g << 1) + j >> 1];g = k[(e - g << 1) + m >> 1];d = (d - o(p, q - r << 16 >> 16) | 0) + o(s, n - g << 16 >> 16) | 0;a = (o(p, q + r << 16 >> 16) + a | 0) + o(g + n << 16 >> 16, s) | 0;f = f + 2 | 0;if ((f | 0) < 32) { - continue; - }break; - }f = l << 1;g = a + 16384 >> 15;h[f + b >> 1] = (a | 0) > 1073725439 ? 32767 : (g | 0) > -32767 ? g : -32767;a = d + 16384 >> 15;h[c + f >> 1] = (d | 0) > 1073725439 ? 32767 : (a | 0) > -32767 ? a : -32767;e = e + 2 | 0;a = (l | 0) == (t | 0);l = l + 1 | 0;if (!a) { - continue; - }break; - } - } - }function Ba(a, b, c) { - var d = 0, - e = 0, - f = 0;f = H - 16 | 0;H = f;g[a | 0] = 1701146707;g[a + 1 | 0] = 6645104;g[a + 2 | 0] = 25957;g[a + 3 | 0] = 101;g[a + 4 | 0] = 538976376;g[a + 5 | 0] = 2105376;g[a + 6 | 0] = 8224;g[a + 7 | 0] = 32;d = j[13186] | j[13187] << 8 | (j[13188] << 16 | j[13189] << 24);e = j[13182] | j[13183] << 8 | (j[13184] << 16 | j[13185] << 24);g[a + 8 | 0] = e;g[a + 9 | 0] = e >>> 8;g[a + 10 | 0] = e >>> 16;g[a + 11 | 0] = e >>> 24;g[a + 12 | 0] = d;g[a + 13 | 0] = d >>> 8;g[a + 14 | 0] = d >>> 16;g[a + 15 | 0] = d >>> 24;d = j[13192] | j[13193] << 8 | (j[13194] << 16 | j[13195] << 24);e = j[13188] | j[13189] << 8 | (j[13190] << 16 | j[13191] << 24);g[a + 14 | 0] = e;g[a + 15 | 0] = e >>> 8;g[a + 16 | 0] = e >>> 16;g[a + 17 | 0] = e >>> 24;g[a + 18 | 0] = d;g[a + 19 | 0] = d >>> 8;g[a + 20 | 0] = d >>> 16;g[a + 21 | 0] = d >>> 24;g[a + 22 | 0] = 0;g[a + 23 | 0] = 0;g[a + 24 | 0] = 0;g[a + 25 | 0] = 0;g[a + 26 | 0] = 0;g[a + 27 | 0] = 0;i[a + 36 >> 2] = b;i[a + 28 >> 2] = 1;i[a + 32 >> 2] = 80;b = i[c + 12 >> 2];i[a + 40 >> 2] = b;i[a + 44 >> 2] = i[c + 16 >> 2];if ((b | 0) <= -1) { - i[f >> 2] = 13197;Y(i[3524], 13292, f); - }i[a + 52 >> 2] = -1;i[a + 48 >> 2] = 1;J[i[c + 4 >> 2]](i[c >> 2], 0, a + 56 | 0) | 0;i[a + 76 >> 2] = 0;i[a + 68 >> 2] = 0;i[a + 72 >> 2] = 0;i[a + 60 >> 2] = 0;i[a + 64 >> 2] = 0;H = f + 16 | 0; - }function Ha(a, b, c, d, e, f, g, j) { - var k = 0, - l = 0, - m = 0, - n = 0, - p = 0, - q = 0, - r = 0, - s = 0, - t = 0, - u = 0;a: { - if ((d | 0) < 1) { - break a; - }r = f + -1 | 0;s = (r << 2) + j | 0;if ((c | 0) >= 1) { - while (1) { - m = 0;l = 0;k = b;while (1) { - m = o(h[k >> 1], h[(l << 1) + a >> 1]) + m | 0;k = k + 2 | 0;l = l + 1 | 0;if ((l | 0) != (c | 0)) { - continue; - }break; - }u = c << 1;n = (i[(p << 2) + e >> 2] >> 1) - m | 0;if (!((n | 0) >= i[s >> 2] ? (p | 0) >= (f | 0) : 0)) { - m = r;l = m;k = f;b: { - if ((k | 0) < 2) { - break b; - }while (1) { - l = m;k = k + -2 << 2;m = i[k + j >> 2];if ((n | 0) >= (m | 0) ? (l | 0) <= (q | 0) : 0) { - break b; - }t = l << 2;i[t + j >> 2] = m;i[g + t >> 2] = i[g + k >> 2];m = l + -1 | 0;k = l;if ((k | 0) > 1) { - continue; - }break; - }l = 0; - }k = l << 2;i[k + j >> 2] = n;i[g + k >> 2] = p;q = q + 1 | 0; - }b = b + u | 0;p = p + 1 | 0;if ((p | 0) != (d | 0)) { - continue; - }break; - }break a; - }while (1) { - a = i[(n << 2) + e >> 2] >> 1;if (!((a | 0) >= i[s >> 2] ? (n | 0) >= (f | 0) : 0)) { - m = r;l = m;k = f;c: { - if ((k | 0) < 2) { - break c; - }while (1) { - l = m;b = k + -2 << 2;c = i[b + j >> 2];if ((a | 0) >= (c | 0) ? (l | 0) <= (q | 0) : 0) { - break c; - }k = l << 2;i[k + j >> 2] = c;i[g + k >> 2] = i[b + g >> 2];m = l + -1 | 0;k = l;if ((k | 0) > 1) { - continue; - }break; - }l = 0; - }b = l << 2;i[b + j >> 2] = a;i[b + g >> 2] = n;q = q + 1 | 0; - }n = n + 1 | 0;if ((n | 0) != (d | 0)) { - continue; - }break; - } - } - }function rb(a, b, c) { - a = a | 0;b = b | 0;c = c | 0;var d = 0, - e = 0;if ((b | 0) >= 1) { - while (1) { - e = (d << 1) + a | 0;d = d + 1 | 0;h[e >> 1] = d << 11;if ((b | 0) != (d | 0)) { - continue; - }break; - } - }b = o(V(c, 6), 10);h[a >> 1] = (g[b + 8848 | 0] << 5) + k[a >> 1];h[a + 4 >> 1] = k[a + 4 >> 1] + (g[b + 8850 | 0] << 5);h[a + 6 >> 1] = k[a + 6 >> 1] + (g[b + 8851 | 0] << 5);h[a + 8 >> 1] = k[a + 8 >> 1] + (g[b + 8852 | 0] << 5);h[a + 10 >> 1] = k[a + 10 >> 1] + (g[b + 8853 | 0] << 5);h[a + 12 >> 1] = k[a + 12 >> 1] + (g[b + 8854 | 0] << 5);h[a + 14 >> 1] = k[a + 14 >> 1] + (g[b + 8855 | 0] << 5);h[a + 16 >> 1] = k[a + 16 >> 1] + (g[b + 8856 | 0] << 5);h[a + 18 >> 1] = k[a + 18 >> 1] + (g[b + 8857 | 0] << 5);h[a + 2 >> 1] = k[a + 2 >> 1] + (g[(b | 1) + 8848 | 0] << 5);b = o(V(c, 6), 5);h[a >> 1] = (g[b + 9488 | 0] << 4) + k[a >> 1];h[a + 2 >> 1] = k[a + 2 >> 1] + (g[b + 9489 | 0] << 4);h[a + 4 >> 1] = k[a + 4 >> 1] + (g[b + 9490 | 0] << 4);h[a + 6 >> 1] = k[a + 6 >> 1] + (g[b + 9491 | 0] << 4);h[a + 8 >> 1] = k[a + 8 >> 1] + (g[b + 9492 | 0] << 4);b = o(V(c, 6), 5);h[a + 10 >> 1] = (g[b + 10128 | 0] << 4) + k[a + 10 >> 1];h[a + 12 >> 1] = k[a + 12 >> 1] + (g[b + 10129 | 0] << 4);h[a + 14 >> 1] = k[a + 14 >> 1] + (g[b + 10130 | 0] << 4);h[a + 16 >> 1] = k[a + 16 >> 1] + (g[b + 10131 | 0] << 4);h[a + 18 >> 1] = k[a + 18 >> 1] + (g[b + 10132 | 0] << 4); - }function Ra(a, b) { - var c = 0, - d = 0, - e = 0, - f = 0, - g = 0, - h = 0;a: { - if ((b | 0) <= 0) { - break a; - }c = 1;while (1) { - d = i[(f << 2) + a >> 2];e = d >> 31;d = e ^ d + e;c = (d | 0) > (c | 0) ? d : c;f = f + 1 | 0;if ((f | 0) != (b | 0)) { - continue; - }break; - }d = 0;f = 0;if ((c | 0) > 16383) { - while (1) { - f = f + 1 | 0;e = c >>> 0 > 32767;c = c >>> 1 | 0;if (e) { - continue; - }break; - } - }if ((b | 0) <= 0) { - break a; - }c = 0;while (1) { - h = c;e = d << 2;c = i[(e | 4) + a >> 2] >> f << 16 >> 16;g = o(c, c);c = i[a + e >> 2] >> f << 16 >> 16;g = g + o(c, c) | 0;c = i[(e | 8) + a >> 2] >> f << 16 >> 16;g = g + o(c, c) | 0;c = i[(e | 12) + a >> 2] >> f << 16 >> 16;c = h + (g + o(c, c) >>> 6 | 0) | 0;d = d + 4 | 0;if ((d | 0) < (b | 0)) { - continue; - }break; - }d = c; - }e = (d | 0) / (b | 0) | 0;b = e >>> 0 > 65535;a = b << 3;d = b ? e >>> 16 | 0 : e;b = d >>> 0 > 255;a = b ? a | 4 : a;h = a | 2;c = a;b = b ? d >>> 8 | 0 : d;a = b >>> 0 > 15;c = (a ? h : c) | (a ? b >>> 4 | 0 : b) >>> 0 > 3;a = c << 1;d = c << 16 >> 16;a = ((d | 0) > 6 ? e >> a + -12 : e << 12 - a) << 16 >> 16;b = (o((o(o(a, 16816) + -827523072 >> 16, a) << 2 & -65536) + 1387593728 >> 16, a) << 2 & -65536) + 238157824 >> 16;a = 13 - c | 0;return (((d | 0) < 13 ? b >> a : b << 0 - a) << 16 >> 16 << f + 3 << 2) + 32768 >> 16; - }function Pb(a, b, c, d, e, f, g, j, k, l, m, n, p, q, r, s, t, u, v, w) { - a = a | 0;b = b | 0;c = c | 0;d = d | 0;e = e | 0;f = f | 0;g = g | 0;j = j | 0;k = k | 0;l = l | 0;m = m | 0;n = n | 0;p = p | 0;q = q | 0;r = r | 0;s = s | 0;t = t | 0;u = u | 0;v = v | 0;w = w | 0;g = (l | 0) < 63 ? l : 63;l = 0;if (!((n | 0) < 1 | (j | 0) < 1)) { - l = n + -1 >>> 0 < j + -1 >>> 0 ? n : j;k = g << 23 >> 16;b = 0;while (1) { - i[(b << 2) + f >> 2] = o(h[(b - j << 1) + r >> 1], k);b = b + 1 | 0;if ((l | 0) != (b | 0)) { - continue; - }break; - } - }if ((l | 0) < (n | 0)) { - b = g << 25 >> 16;while (1) { - g = i[(l - j << 2) + f >> 2];i[(l << 2) + f >> 2] = o(b, g << 1 >> 16) + (o(b, g & 32767) >> 15);l = l + 1 | 0;if ((n | 0) != (l | 0)) { - continue; - }break; - } - }b = (q & 1) + q | 0;g = b + (n << 1) | 0;l = 0;if ((n | 0) > 0) { - while (1) { - h[b + (l << 1) >> 1] = i[(l << 2) + f >> 2] + 4096 >>> 13;l = l + 1 | 0;if ((n | 0) != (l | 0)) { - continue; - }break; - }ka(b, c, d, e, b, n, m, g);if ((n | 0) >= 1) { - l = 0;while (1) { - c = l << 1;d = c + a | 0;c = h[d >> 1] - h[b + c >> 1] | 0;c = (c | 0) > -32700 ? c : -32700;h[d >> 1] = (c | 0) < 32700 ? c : 32700;l = l + 1 | 0;if ((n | 0) != (l | 0)) { - continue; - }break; - } - }return j | 0; - }ka(b, c, d, e, b, n, m, g);return j | 0; - }function Ya(a, b, c) { - a = a | 0;b = b | 0;c = c | 0;var d = 0, - e = 0, - f = 0, - g = 0, - h = 0, - j = 0, - k = 0;e = H - 32 | 0;H = e;g = i[a + 28 >> 2];i[e + 16 >> 2] = g;d = i[a + 20 >> 2];i[e + 28 >> 2] = c;i[e + 24 >> 2] = b;b = d - g | 0;i[e + 20 >> 2] = b;g = b + c | 0;k = 2;b = e + 16 | 0;a: { - b: { - f = A(i[a + 60 >> 2], e + 16 | 0, 2, e + 12 | 0) | 0;d = 0;c: { - if (!f) { - break c; - }i[3790] = f;d = -1; - }d: { - if (!d) { - while (1) { - d = i[e + 12 >> 2];if ((d | 0) == (g | 0)) { - break d; - }if ((d | 0) <= -1) { - break b; - }h = i[b + 4 >> 2];f = d >>> 0 > h >>> 0;j = (f << 3) + b | 0;h = d - (f ? h : 0) | 0;i[j >> 2] = h + i[j >> 2];j = (f ? 12 : 4) + b | 0;i[j >> 2] = i[j >> 2] - h;g = g - d | 0;b = f ? b + 8 | 0 : b;k = k - f | 0;f = A(i[a + 60 >> 2], b | 0, k | 0, e + 12 | 0) | 0;d = 0;e: { - if (!f) { - break e; - }i[3790] = f;d = -1; - }if (!d) { - continue; - }break; - } - }i[e + 12 >> 2] = -1;if ((g | 0) != -1) { - break b; - } - }b = i[a + 44 >> 2];i[a + 28 >> 2] = b;i[a + 20 >> 2] = b;i[a + 16 >> 2] = b + i[a + 48 >> 2];a = c;break a; - }i[a + 28 >> 2] = 0;i[a + 16 >> 2] = 0;i[a + 20 >> 2] = 0;i[a >> 2] = i[a >> 2] | 32;a = 0;if ((k | 0) == 2) { - break a; - }a = c - i[b + 4 >> 2] | 0; - }H = e + 32 | 0;return a | 0; - }function ba(a) { - var b = 0, - c = 0, - d = 0, - e = 0, - f = 0, - g = 0, - h = 0, - i = 0, - j = 0, - k = 0;a: { - b: { - c: { - d: { - nc(+a);b = kc(1) | 0;d = kc(0) | 0;if ((b | 0) > 0 ? 1 : (b | 0) >= 0 ? d >>> 0 >= 0 : 0) { - f = b;if (b >>> 0 > 1048575) { - break d; - } - }if (!(b & 2147483647 | d)) { - return -1 / (a * a); - }if ((b | 0) > -1) { - break c; - }return (a - a) / 0; - }if (f >>> 0 > 2146435071) { - break a; - }b = 1072693248;g = -1023;if ((f | 0) != 1072693248) { - b = f;break b; - }if (d) { - break b; - }return 0; - }nc(+(a * 0x40000000000000));b = kc(1) | 0;d = kc(0) | 0;g = -1077; - }b = b + 614242 | 0;e = +((b >>> 20 | 0) + g | 0);lc(0, d | 0);lc(1, (b & 1048575) + 1072079006 | 0);a = +mc() + -1;c = a / (a + 2);h = e * .6931471803691238;i = a;j = e * 1.9082149292705877e-10;k = c;e = a * (a * .5);c = c * c;a = c * c;a = h + (i + (j + k * (e + (a * (a * (a * .15313837699209373 + .22222198432149784) + .3999999999940942) + c * (a * (a * (a * .14798198605116586 + .1818357216161805) + .2857142874366239) + .6666666666666735))) - e)); - }return a; - }function Tb(a, b, c, d, e, f) { - a = a | 0;b = b | 0;c = c | 0;d = d | 0;e = e | 0;f = f | 0;var h = 0, - j = 0, - k = 0, - l = 0, - m = 0, - n = 0;a: { - f = i[b + 4 >> 2];if ((f | 0) < 1) { - break a; - }c = 0;j = (0 - e & 3) + e | 0;e = j + (f << 2) | 0;k = (0 - e & 3) + e | 0;l = i[b + 8 >> 2];e = i[b >> 2];b: { - if (!i[b + 16 >> 2]) { - while (1) { - h = c << 2;i[h + k >> 2] = 0;i[h + j >> 2] = V(d, i[b + 12 >> 2]);c = c + 1 | 0;if ((f | 0) != (c | 0)) { - continue; - }break b; - } - }while (1) { - h = c << 2;i[h + k >> 2] = V(d, 1);i[h + j >> 2] = V(d, i[b + 12 >> 2]);c = c + 1 | 0;if ((f | 0) != (c | 0)) { - continue; - }break; - } - }if ((f | 0) < 1 | (e | 0) < 1) { - break a; - }b = 0;while (1) { - h = o(b, e);m = b << 2;n = m + j | 0;c = 0;d = 0;c: { - if (i[k + m >> 2]) { - while (1) { - i[(c + h << 2) + a >> 2] = 0 - (g[(o(e, i[n >> 2]) + c | 0) + l | 0] << 9);c = c + 1 | 0;if ((e | 0) != (c | 0)) { - continue; - }break c; - } - }while (1) { - i[(d + h << 2) + a >> 2] = g[(o(e, i[n >> 2]) + d | 0) + l | 0] << 9;d = d + 1 | 0;if ((e | 0) != (d | 0)) { - continue; - }break; - } - }b = b + 1 | 0;if ((f | 0) != (b | 0)) { - continue; - }break; - } - } - }function lb(a) { - a = a | 0;var b = 0, - c = 0, - d = 0, - e = 0;d = H - 16 | 0;H = d;b = T(100);if (b) { - i[b >> 2] = a;a = i[a >> 2];i[b + 88 >> 2] = 1;c = i[a >> 2];c = J[i[c + 32 >> 2]](c) | 0;i[b + 4 >> 2] = c;J[i[i[c >> 2] + 48 >> 2]](c, 106, b + 40 | 0) | 0;c = i[a + 4 >> 2];i[b + 12 >> 2] = c;i[b + 8 >> 2] = c << 1;e = i[a + 8 >> 2];i[b + 16 >> 2] = e;i[b + 20 >> 2] = (c | 0) / (e | 0);i[b + 24 >> 2] = i[a + 12 >> 2];c = i[b + 4 >> 2];J[i[i[c >> 2] + 48 >> 2]](c, 25, b + 32 | 0) | 0;i[b + 32 >> 2] = i[b + 32 >> 2] << 1;i[d + 12 >> 2] = 1;c = i[b + 4 >> 2];J[i[i[c >> 2] + 48 >> 2]](c, 105, d + 12 | 0) | 0;i[b + 92 >> 2] = a + 24;a = i[a + 56 >> 2];i[b + 28 >> 2] = 1;i[b + 96 >> 2] = a;i[b + 44 >> 2] = T(128);i[b + 48 >> 2] = T(128);i[b + 52 >> 2] = T(i[b + 16 >> 2] << 1);a = i[b + 24 >> 2];c = a << 1;i[b + 56 >> 2] = T(c);i[b + 60 >> 2] = T(c);c = i[b + 20 >> 2];i[b + 68 >> 2] = T(c << 2);i[b + 72 >> 2] = T(c << 1);a = T(a << 3);i[b + 76 >> 2] = 0;i[b + 64 >> 2] = a;i[b + 84 >> 2] = 1e3;i[b + 36 >> 2] = 0; - }H = d + 16 | 0;return b | 0; - }function qa(a, b, c) { - var d = 0;a: { - if ((a | 0) == (b | 0)) { - break a; - }if ((b - a | 0) - c >>> 0 <= 0 - (c << 1) >>> 0) { - X(a, b, c);return; - }d = (a ^ b) & 3;b: { - c: { - if (a >>> 0 < b >>> 0) { - if (d) { - break b; - }if (!(a & 3)) { - break c; - }while (1) { - if (!c) { - break a; - }g[a | 0] = j[b | 0];b = b + 1 | 0;c = c + -1 | 0;a = a + 1 | 0;if (a & 3) { - continue; - }break; - }break c; - }d: { - if (d) { - break d; - }if (a + c & 3) { - while (1) { - if (!c) { - break a; - }c = c + -1 | 0;d = c + a | 0;g[d | 0] = j[b + c | 0];if (d & 3) { - continue; - }break; - } - }if (c >>> 0 <= 3) { - break d; - }while (1) { - c = c + -4 | 0;i[c + a >> 2] = i[b + c >> 2];if (c >>> 0 > 3) { - continue; - }break; - } - }if (!c) { - break a; - }while (1) { - c = c + -1 | 0;g[c + a | 0] = j[b + c | 0];if (c) { - continue; - }break; - }break a; - }if (c >>> 0 <= 3) { - break b; - }while (1) { - i[a >> 2] = i[b >> 2];b = b + 4 | 0;a = a + 4 | 0;c = c + -4 | 0;if (c >>> 0 > 3) { - continue; - }break; - } - }if (!c) { - break a; - }while (1) { - g[a | 0] = j[b | 0];a = a + 1 | 0;b = b + 1 | 0;c = c + -1 | 0;if (c) { - continue; - }break; - } - } - }function Ea(a, b, c) { - var d = 0, - e = 0, - f = 0, - g = 0, - i = 0, - j = 0, - l = 0, - m = 0, - n = 0, - p = 0, - q = 0;i = k[b >> 1];if (i) { - if ((c | 0) > 0) { - while (1) { - d = 0;m = e + 1 | 0;f = 0 - (h[(m << 1) + b >> 1] << 13) | 0;if (e) { - while (1) { - f = f - o(h[(e - d << 1) + b >> 1], h[(d << 1) + a >> 1]) | 0;d = d + 1 | 0;if ((e | 0) != (d | 0)) { - continue; - }break; - } - }d = i << 16;n = d >> 16;f = ((n + 1 >> 1) + f | 0) / (d + 524288 >> 16) | 0;h[(e << 1) + a >> 1] = f;j = e >>> 1 | 0;if (j) { - p = f << 16 >> 16;d = 0;while (1) { - g = (d << 1) + a | 0;q = h[g >> 1];l = g;g = ((d ^ -1) + e << 1) + a | 0;h[l >> 1] = (o(h[g >> 1], p) + 4096 >>> 13 | 0) + q;h[g >> 1] = k[g >> 1] + (o(p, q) + 4096 >>> 13 | 0);d = d + 1 | 0;if ((j | 0) != (d | 0)) { - continue; - }break; - } - }a: { - if (!(e & 1)) { - d = f << 16 >> 16;break a; - }d = (j << 1) + a | 0;e = h[d >> 1];l = d;d = f << 16 >> 16;h[l >> 1] = e + (o(e, d) + 4096 >>> 13 | 0); - }i = i - (o(o(d, n) << 3 >> 16, d) >>> 13 | 0) | 0;e = m;if ((e | 0) != (c | 0)) { - continue; - }break; - } - }return; - }if ((c | 0) < 1) { - return; - }U(a, 0, c << 1); - }function U(a, b, c) { - var d = 0, - e = 0, - f = 0, - h = 0;a: { - if (!c) { - break a; - }d = a + c | 0;g[d + -1 | 0] = b;g[a | 0] = b;if (c >>> 0 < 3) { - break a; - }g[d + -2 | 0] = b;g[a + 1 | 0] = b;g[d + -3 | 0] = b;g[a + 2 | 0] = b;if (c >>> 0 < 7) { - break a; - }g[d + -4 | 0] = b;g[a + 3 | 0] = b;if (c >>> 0 < 9) { - break a; - }d = 0 - a & 3;e = d + a | 0;b = o(b & 255, 16843009);i[e >> 2] = b;c = c - d & -4;d = c + e | 0;i[d + -4 >> 2] = b;if (c >>> 0 < 9) { - break a; - }i[e + 8 >> 2] = b;i[e + 4 >> 2] = b;i[d + -8 >> 2] = b;i[d + -12 >> 2] = b;if (c >>> 0 < 25) { - break a; - }i[e + 24 >> 2] = b;i[e + 20 >> 2] = b;i[e + 16 >> 2] = b;i[e + 12 >> 2] = b;i[d + -16 >> 2] = b;i[d + -20 >> 2] = b;i[d + -24 >> 2] = b;i[d + -28 >> 2] = b;h = e & 4 | 24;c = c - h | 0;if (c >>> 0 < 32) { - break a; - }d = b;f = b;b = e + h | 0;while (1) { - i[b + 24 >> 2] = f;i[b + 28 >> 2] = d;i[b + 16 >> 2] = f;i[b + 20 >> 2] = d;i[b + 8 >> 2] = f;i[b + 12 >> 2] = d;i[b >> 2] = f;i[b + 4 >> 2] = d;b = b + 32 | 0;c = c + -32 | 0;if (c >>> 0 > 31) { - continue; - }break; - } - }return a; - }function ka(a, b, c, d, e, f, g, j) { - var k = 0, - l = 0, - m = 0, - n = 0, - p = 0, - q = 0, - r = 0, - s = 0, - t = 0, - u = 0;p = g << 2;k = (0 - j & 3) + j | 0;if ((g | 0) >= 1) { - U(k, 0, p); - }a: { - if ((f | 0) < 1) { - break a; - }n = g + -1 | 0;q = (n << 2) + k | 0;r = (n << 1) + b | 0;if ((g | 0) >= 2) { - while (1) { - j = 0;s = m << 1;l = h[s + a >> 1] + (i[k >> 2] + 4096 >> 13) | 0;l = (l | 0) > -32767 ? l : -32767;t = (l | 0) < 32767 ? l : 32767;u = 0 - (t << 16) >> 16;while (1) { - l = j + 1 | 0;i[(j << 2) + k >> 2] = i[(l << 2) + k >> 2] + o(h[(j << 1) + b >> 1], u);j = l;if ((n | 0) != (j | 0)) { - continue; - }break; - }i[q >> 2] = o(h[r >> 1], u);h[e + s >> 1] = t;m = m + 1 | 0;if ((m | 0) != (f | 0)) { - continue; - }break a; - } - }while (1) { - b = m << 1;j = h[b + a >> 1] + (i[k >> 2] + 4096 >> 13) | 0;j = (j | 0) > -32767 ? j : -32767;j = (j | 0) < 32767 ? j : 32767;i[q >> 2] = o(h[r >> 1], 0 - (j << 16) >> 16);h[b + e >> 1] = j;m = m + 1 | 0;if ((m | 0) != (f | 0)) { - continue; - }break; - } - }if ((g | 0) >= 1) { - U(k, 0, p); - }aa(e, c, d, e, f, g, k); - }function aa(a, b, c, d, e, f, g) { - var j = 0, - k = 0, - l = 0, - m = 0, - n = 0, - p = 0, - q = 0, - r = 0, - s = 0, - t = 0, - u = 0;a: { - if ((e | 0) < 1) { - break a; - }l = f + -1 | 0;n = (l << 2) + g | 0;j = l << 1;p = j + c | 0;q = b + j | 0;if ((f | 0) >= 2) { - while (1) { - f = 0;r = k << 1;m = h[r + a >> 1];j = m + (i[g >> 2] + 4096 >> 13) | 0;j = (j | 0) > -32767 ? j : -32767;s = (j | 0) < 32767 ? j : 32767;t = 0 - (s << 16) >> 16;while (1) { - u = (f << 2) + g | 0;j = f + 1 | 0;f = f << 1;i[u >> 2] = (i[(j << 2) + g >> 2] + o(h[f + b >> 1], m) | 0) + o(h[c + f >> 1], t);f = j;if ((l | 0) != (f | 0)) { - continue; - }break; - }i[n >> 2] = o(h[p >> 1], t) + o(h[q >> 1], m);h[d + r >> 1] = s;k = k + 1 | 0;if ((k | 0) != (e | 0)) { - continue; - }break a; - } - }while (1) { - b = k << 1;c = h[b + a >> 1];f = c + (i[g >> 2] + 4096 >> 13) | 0;f = (f | 0) > -32767 ? f : -32767;f = (f | 0) < 32767 ? f : 32767;i[n >> 2] = o(h[p >> 1], 0 - (f << 16) >> 16) + o(c, h[q >> 1]);h[b + d >> 1] = f;k = k + 1 | 0;if ((k | 0) != (e | 0)) { - continue; - }break; - } - } - }function Vb(a, b, c, d, e, f, g, j) { - var k = 0, - l = 0, - m = 0, - n = 0, - p = 0;j = (0 - j & 3) + j | 0;a: { - if ((g | 0) <= 0) { - aa(a, b, c, e, f, g, j);break a; - }k = a;l = b;a = g << 2;b = U(j, 0, a);aa(k, l, c, e, f, g, b);U(b, 0, a); - }b: { - if ((f | 0) < 1) { - break b; - }b = g + -1 | 0;l = j + (b << 2) | 0;m = (b << 1) + d | 0;c = 0;if ((g | 0) >= 2) { - while (1) { - n = (c << 1) + e | 0;k = h[n >> 1];a = k + (i[j >> 2] + 4096 >> 13) | 0;p = (a | 0) > -32767 ? a : -32767;g = 0;while (1) { - a = g + 1 | 0;i[j + (g << 2) >> 2] = i[j + (a << 2) >> 2] + o(h[(g << 1) + d >> 1], k);g = a;if ((a | 0) != (b | 0)) { - continue; - }break; - }i[l >> 2] = o(h[m >> 1], k);h[n >> 1] = (p | 0) < 32767 ? p : 32767;c = c + 1 | 0;if ((f | 0) != (c | 0)) { - continue; - }break b; - } - }while (1) { - a = i[j >> 2];b = (c << 1) + e | 0;d = h[b >> 1];i[l >> 2] = o(d, h[m >> 1]);a = d + (a + 4096 >> 13) | 0;a = (a | 0) > -32767 ? a : -32767;h[b >> 1] = (a | 0) < 32767 ? a : 32767;c = c + 1 | 0;if ((f | 0) != (c | 0)) { - continue; - }break; - } - } - }function Ab(a) { - a = a | 0;var b = 0, - c = 0, - d = 0, - e = 0, - f = 0, - g = 0;c = i[a >> 2];b = T(496);if (b) { - d = T(16e3);i[b + 112 >> 2] = 1;i[b >> 2] = a;i[b + 44 >> 2] = d;i[b + 4 >> 2] = 1;d = i[c >> 2];i[b + 12 >> 2] = d;e = i[c + 4 >> 2];i[b + 16 >> 2] = e;g = (d | 0) / (e | 0) | 0;i[b + 20 >> 2] = g;f = i[c + 8 >> 2];i[b + 24 >> 2] = f;i[b + 28 >> 2] = i[c + 12 >> 2];a = i[c + 16 >> 2];i[b + 116 >> 2] = c + 28;i[b + 32 >> 2] = a;c = i[c + 92 >> 2];i[b + 124 >> 2] = 1;i[b + 120 >> 2] = c;c = T(((d + e | 0) + (a << 1) << 1) + 24 | 0);i[b + 48 >> 2] = c;i[b + 52 >> 2] = ((c + (a << 2) | 0) + (e << 1) | 0) + 12;U(c, 0, a + d << 1);a = f << 1;i[b + 60 >> 2] = T(a);i[b + 56 >> 2] = T(a);i[b + 64 >> 2] = T(f << 2);a = T(g << 2);h[b + 98 >> 1] = 0;h[b + 100 >> 1] = 0;h[b + 102 >> 1] = 0;h[b + 104 >> 1] = 0;i[b + 92 >> 2] = 40;i[b + 76 >> 2] = a;h[b + 106 >> 1] = 0;i[b + 108 >> 2] = 1e3;i[b + 492 >> 2] = 1;i[b + 452 >> 2] = 33;i[b + 36 >> 2] = 8e3; - }return b | 0; - }function ya(a, b, c) { - a: { - b: { - if (b >>> 0 > 20) { - break b; - }c: { - switch (b + -9 | 0) {case 0: - b = i[c >> 2];i[c >> 2] = b + 4;i[a >> 2] = i[b >> 2];return;case 1: - b = i[c >> 2];i[c >> 2] = b + 4;b = i[b >> 2];i[a >> 2] = b;i[a + 4 >> 2] = b >> 31;return;case 2: - b = i[c >> 2];i[c >> 2] = b + 4;i[a >> 2] = i[b >> 2];i[a + 4 >> 2] = 0;return;case 4: - b = i[c >> 2];i[c >> 2] = b + 4;b = h[b >> 1];i[a >> 2] = b;i[a + 4 >> 2] = b >> 31;return;case 5: - b = i[c >> 2];i[c >> 2] = b + 4;i[a >> 2] = k[b >> 1];i[a + 4 >> 2] = 0;return;case 6: - b = i[c >> 2];i[c >> 2] = b + 4;b = g[b | 0];i[a >> 2] = b;i[a + 4 >> 2] = b >> 31;return;case 7: - b = i[c >> 2];i[c >> 2] = b + 4;i[a >> 2] = j[b | 0];i[a + 4 >> 2] = 0;return;case 3:case 8: - break a;case 9: - break c;default: - break b;} - }J[0](a, c); - }return; - }b = i[c >> 2] + 7 & -8;i[c >> 2] = b + 8;c = i[b + 4 >> 2];i[a >> 2] = i[b >> 2];i[a + 4 >> 2] = c; - }function _(a, b, c, d, e, f) { - var g = 0, - j = 0, - k = 0, - l = 0, - m = 0, - n = 0, - p = 0, - q = 0;a: { - if ((d | 0) < 1) { - break a; - }k = e + -1 | 0;l = (k << 2) + f | 0;m = (k << 1) + b | 0;if ((e | 0) >= 2) { - while (1) { - e = 0;n = j << 1;g = h[n + a >> 1] + (i[f >> 2] + 4096 >> 13) | 0;g = (g | 0) > -32767 ? g : -32767;p = (g | 0) < 32767 ? g : 32767;q = 0 - (p << 16) >> 16;while (1) { - g = e + 1 | 0;i[(e << 2) + f >> 2] = i[(g << 2) + f >> 2] + o(h[(e << 1) + b >> 1], q);e = g;if ((k | 0) != (e | 0)) { - continue; - }break; - }i[l >> 2] = o(h[m >> 1], q);h[c + n >> 1] = p;j = j + 1 | 0;if ((j | 0) != (d | 0)) { - continue; - }break a; - } - }while (1) { - b = j << 1;e = h[b + a >> 1] + (i[f >> 2] + 4096 >> 13) | 0;e = (e | 0) > -32767 ? e : -32767;e = (e | 0) < 32767 ? e : 32767;i[l >> 2] = o(h[m >> 1], 0 - (e << 16) >> 16);h[b + c >> 1] = e;j = j + 1 | 0;if ((j | 0) != (d | 0)) { - continue; - }break; - } - } - }function Da(a, b, c, d) { - var e = 0, - f = 0, - g = 0, - i = 0, - j = 0;g = 1;if ((d | 0) >= 1) { - while (1) { - f = h[(e << 1) + a >> 1];g = (o(f, f) >>> 8 | 0) + g | 0;e = e + 1 | 0;if ((e | 0) != (d | 0)) { - continue; - }break; - } - }i = 18;j = 8;e = d + g | 0;a: { - if ((e | 0) >= 1073741824) { - break a; - }while (1) { - b: { - j = j + -1 | 0;e = e << 1;if ((e | 0) > 1073741823) { - break b; - }if (j) { - continue; - } - }break; - }if ((e | 0) >= 1073741824) { - break a; - }while (1) { - i = i + -1 | 0;e = e << 1;if ((e | 0) > 1073741823) { - break a; - }if (i) { - continue; - }break; - } - }f = 0;if ((c | 0) > 0) { - while (1) { - g = 0;e = f;if ((e | 0) < (d | 0)) { - while (1) { - g = (o(h[(e - f << 1) + a >> 1], h[(e << 1) + a >> 1]) >> j) + g | 0;e = e + 1 | 0;if ((e | 0) != (d | 0)) { - continue; - }break; - } - }h[(f << 1) + b >> 1] = g >> i;f = f + 1 | 0;if ((f | 0) != (c | 0)) { - continue; - }break; - } - } - }function va(a, b, c, d, e, f) { - var g = 0, - j = 0, - k = 0, - l = 0, - m = 0, - n = 0, - p = 0, - q = 0;a: { - if ((d | 0) < 1) { - break a; - }k = e + -1 | 0;m = (k << 2) + f | 0;n = (k << 1) + b | 0;if ((e | 0) >= 2) { - while (1) { - p = g << 1;l = h[p + a >> 1];e = l + (i[f >> 2] + 4096 >> 13) | 0;e = (e | 0) > -32767 ? e : -32767;q = (e | 0) < 32767 ? e : 32767;e = 0;while (1) { - j = e + 1 | 0;i[(e << 2) + f >> 2] = i[(j << 2) + f >> 2] + o(h[(e << 1) + b >> 1], l);e = j;if ((k | 0) != (e | 0)) { - continue; - }break; - }i[m >> 2] = o(h[n >> 1], l);h[c + p >> 1] = q;g = g + 1 | 0;if ((g | 0) != (d | 0)) { - continue; - }break a; - } - }while (1) { - b = i[f >> 2];e = g << 1;j = h[e + a >> 1];i[m >> 2] = o(j, h[n >> 1]);b = j + (b + 4096 >> 13) | 0;b = (b | 0) > -32767 ? b : -32767;h[c + e >> 1] = (b | 0) < 32767 ? b : 32767;g = g + 1 | 0;if ((g | 0) != (d | 0)) { - continue; - }break; - } - } - }function W(a, b, c) { - var d = 0, - e = 0, - f = 0, - h = 0;e = H - 48 | 0;H = e;a: { - b: { - c: { - if ((i[a + 8 >> 2] + (i[a + 12 >> 2] + c >> 3) | 0) >= i[a + 24 >> 2]) { - i[e + 32 >> 2] = 5846;d = i[3524];Y(d, 5956, e + 32 | 0);if (!i[a + 16 >> 2]) { - break b; - }f = o(i[a + 24 >> 2], 3) + 15 >> 1;h = Oa(i[a >> 2], f);if (!h) { - break c; - }i[a >> 2] = h;i[a + 24 >> 2] = f; - }if (!c) { - break a; - }while (1) { - d = i[a >> 2] + i[a + 8 >> 2] | 0;c = c + -1 | 0;g[d | 0] = j[d | 0] | (b >>> c & 1) << 7 - i[a + 12 >> 2];d = i[a + 12 >> 2] + 1 | 0;i[a + 12 >> 2] = d;if ((d | 0) == 8) { - i[a + 12 >> 2] = 0;d = i[a + 8 >> 2] + 1 | 0;i[a + 8 >> 2] = d;g[d + i[a >> 2] | 0] = 0; - }i[a + 4 >> 2] = i[a + 4 >> 2] + 1;if (c) { - continue; - }break; - }break a; - }i[e + 16 >> 2] = 5876;Y(d, 5974, e + 16 | 0);break a; - }i[e >> 2] = 5919;Y(d, 5974, e); - }H = e + 48 | 0; - }function Aa(a, b, c, d) { - var e = 0, - f = 0;a: { - if ((c | 0) >= 4194305) { - if ((d | 0) < 1) { - break a; - }c = (c << 2) + 32768 | 0;f = ((c >> 17) + 2097152 | 0) / (c >> 16) << 16 >> 16;c = 0;while (1) { - e = c << 1;h[e + b >> 1] = o(f, h[a + e >> 1]) + 16384 >>> 15;c = c + 1 | 0;if ((d | 0) != (c | 0)) { - continue; - }break; - }break a; - }if ((c | 0) >= 4097) { - if ((d | 0) < 1) { - break a; - }f = 131072 / (c + 256 >>> 9 >>> 0) | 0;c = 0;while (1) { - e = c << 1;h[e + b >> 1] = o(f, k[a + e >> 1] << 18 >> 16) + 128 >>> 8;c = c + 1 | 0;if ((d | 0) != (c | 0)) { - continue; - }break; - }break a; - }if ((d | 0) < 1) { - break a; - }c = c - -64 >> 7;f = 131072 / (((c | 0) > 5 ? c : 5) >>> 0) | 0;c = 0;while (1) { - e = c << 1;h[e + b >> 1] = o(f, k[a + e >> 1] << 18 >> 16) + 32 >>> 6;c = c + 1 | 0;if ((d | 0) != (c | 0)) { - continue; - }break; - } - } - }function Xa(a, b, c) { - var d = 0, - e = 0, - f = 0;d = H - 208 | 0;H = d;i[d + 204 >> 2] = c;c = 0;U(d + 160 | 0, 0, 40);i[d + 200 >> 2] = i[d + 204 >> 2];a: { - if ((ra(0, b, d + 200 | 0, d + 80 | 0, d + 160 | 0) | 0) < 0) { - break a; - }c = i[a + 76 >> 2] >= 0 ? 1 : c;e = i[a >> 2];if (g[a + 74 | 0] <= 0) { - i[a >> 2] = e & -33; - }f = e & 32;b: { - if (i[a + 48 >> 2]) { - ra(a, b, d + 200 | 0, d + 80 | 0, d + 160 | 0);break b; - }i[a + 48 >> 2] = 80;i[a + 16 >> 2] = d + 80;i[a + 28 >> 2] = d;i[a + 20 >> 2] = d;e = i[a + 44 >> 2];i[a + 44 >> 2] = d;ra(a, b, d + 200 | 0, d + 80 | 0, d + 160 | 0);if (!e) { - break b; - }J[i[a + 36 >> 2]](a, 0, 0) | 0;i[a + 48 >> 2] = 0;i[a + 44 >> 2] = e;i[a + 28 >> 2] = 0;i[a + 16 >> 2] = 0;i[a + 20 >> 2] = 0; - }i[a >> 2] = i[a >> 2] | f;if (!c) { - break a; - } - }H = d + 208 | 0; - }function Ca(a, b, c, d) { - var e = 0, - f = 0, - g = 0, - j = 0, - k = 0;a: { - if (c) { - k = i[a + 96 >> 2];i[a + 96 >> 2] = 1;break a; - }e = i[a + 60 >> 2];ca(32440, e, e, i[a + 24 >> 2]);h[a + 80 >> 1] = o(h[a + 80 >> 1], 29491) >>> 15; - }i[a + 28 >> 2] = 1;e = i[a + 12 >> 2];if ((e | 0) >= 1) { - f = i[a + 84 >> 2];while (1) { - f = o(f, 1664525) + 1013904223 | 0;j = o(h[a + 80 >> 1], f >> 16);h[(e + g << 1) + b >> 1] = (j - (j >> 3) | 0) - -8192 >>> 14;g = g + 1 | 0;if ((e | 0) != (g | 0)) { - continue; - }break; - }i[a + 84 >> 2] = f; - }f = (e << 1) + b | 0;_(f, i[a + 60 >> 2], f, e, i[a + 24 >> 2], i[a + 64 >> 2]);ua(b, (i[a + 12 >> 2] << 1) + b | 0, b, i[a + 8 >> 2], i[a + 44 >> 2], i[a + 48 >> 2], d);if (c) { - i[a + 96 >> 2] = k; - } - }function sa(a, b, c, d, e) { - var f = 0, - g = 0, - j = 0, - l = 0, - m = 0, - n = 0, - p = 0, - q = 0, - r = 0, - s = 0;if ((c | 0) >= 1) { - d = o((d | 0) < 4 ? d : 4, 6);n = 0 - k[d + 2372 >> 1] << 16 >> 16;p = 0 - k[d + 2370 >> 1] << 16 >> 16;q = h[d + 2404 >> 1];r = h[d + 2402 >> 1];s = h[d + 2400 >> 1];g = i[e + 4 >> 2];d = i[e >> 2];while (1) { - l = m << 1;f = h[l + a >> 1];d = o(f, s) + d | 0;j = d - -8192 >> 14;h[b + l >> 1] = (d | 0) > 536862719 ? 32767 : (j | 0) > -32767 ? j : -32767;l = o(f, r) + g | 0;g = d << 1 >> 16;j = d & 32767;d = l + (o(g, p) + (o(j, p) >> 15) << 1) | 0;f = o(f, q) + (o(g, n) + (o(j, n) >> 15) << 1) | 0;g = f;m = m + 1 | 0;if ((m | 0) != (c | 0)) { - continue; - }break; - }i[e + 4 >> 2] = f;i[e >> 2] = d; - } - }function hc(a, b) { - var c = 0, - d = 0, - e = 0, - f = 0, - g = 0, - h = 0, - i = 0, - j = 0;c = b;if (!c) { - a = (a >>> 0) / 10 | 0;I = 0;return a; - }g = 61 - r(c) | 0;d = 0 - g | 0;f = g & 63;e = f & 31;if (32 <= f >>> 0) { - f = 0;e = c >>> e | 0; - } else { - f = c >>> e | 0;e = ((1 << e) - 1 & c) << 32 - e | a >>> e; - }d = d & 63;c = d & 31;if (32 <= d >>> 0) { - b = a << c;a = 0; - } else { - b = (1 << c) - 1 & a >>> 32 - c | b << c;a = a << c; - }if (g) { - c = 0;while (1) { - d = e << 1 | b >>> 31;h = d;f = f << 1 | e >>> 31;d = c - (f + (9 < d >>> 0) | 0) >> 31;i = d & 10;e = h - i | 0;f = f - (h >>> 0 < i >>> 0) | 0;b = b << 1 | a >>> 31;a = j | a << 1;h = d & 1;j = h;g = g + -1 | 0;if (g) { - continue; - }break; - } - }I = b << 1 | a >>> 31;return h | a << 1; - }function pb(a, b, c) { - a = a | 0;b = b | 0;c = c | 0;var d = 0, - e = 0, - f = 0;a: { - b: { - if ((b | 0) > 0) { - while (1) { - h[(d << 1) + a >> 1] = (o(d, 167772160) >>> 16 | 0) + 6144;d = d + 1 | 0;if ((d | 0) != (b | 0)) { - continue; - }break; - }d = V(c, 6);if ((b | 0) < 1) { - break b; - }e = o(b, d);d = 0;while (1) { - f = (d << 1) + a | 0;h[f >> 1] = k[f >> 1] + (g[(d + e | 0) + 4016 | 0] << 5);d = d + 1 | 0;if ((d | 0) != (b | 0)) { - continue; - }break; - }c = V(c, 6);if ((b | 0) < 1) { - break a; - }c = o(b, c);d = 0;while (1) { - e = (d << 1) + a | 0;h[e >> 1] = k[e >> 1] + (g[(c + d | 0) + 4528 | 0] << 4);d = d + 1 | 0;if ((d | 0) != (b | 0)) { - continue; - }break; - }break a; - }V(c, 6); - }V(c, 6); - } - }function ec(a, b) { - a: { - if (a) { - if (b >>> 0 <= 127) { - break a; - }b: { - if (!i[i[3736] >> 2]) { - if ((b & -128) == 57216) { - break a; - }break b; - }if (b >>> 0 <= 2047) { - g[a + 1 | 0] = b & 63 | 128;g[a | 0] = b >>> 6 | 192;return 2; - }if (!((b & -8192) != 57344 ? b >>> 0 >= 55296 : 0)) { - g[a + 2 | 0] = b & 63 | 128;g[a | 0] = b >>> 12 | 224;g[a + 1 | 0] = b >>> 6 & 63 | 128;return 3; - }if (b + -65536 >>> 0 <= 1048575) { - g[a + 3 | 0] = b & 63 | 128;g[a | 0] = b >>> 18 | 240;g[a + 2 | 0] = b >>> 6 & 63 | 128;g[a + 1 | 0] = b >>> 12 & 63 | 128;return 4; - } - }i[3790] = 25;a = -1; - } else { - a = 1; - }return a; - }g[a | 0] = b;return 1; - }function Hb(a, b, c) { - var d = 0, - e = 0, - f = 0;e = H - 48 | 0;H = e;a: { - if (i[a + 24 >> 2] >= (c | 0)) { - break a; - }i[e + 32 >> 2] = 5708;d = i[3524];Y(d, 5956, e + 32 | 0);if (i[a + 16 >> 2]) { - f = Oa(i[a >> 2], c);if (f) { - i[a >> 2] = f;i[a + 24 >> 2] = c;break a; - }c = i[a + 24 >> 2];i[e + 16 >> 2] = 5747;Y(d, 5974, e + 16 | 0);break a; - }i[e >> 2] = 5795;Y(d, 5974, e);c = i[a + 24 >> 2]; - }if ((c | 0) >= 1) { - d = 0;while (1) { - g[i[a >> 2] + d | 0] = j[b + d | 0];d = d + 1 | 0;if ((d | 0) != (c | 0)) { - continue; - }break; - } - }i[a + 20 >> 2] = 0;i[a + 8 >> 2] = 0;i[a + 12 >> 2] = 0;i[a + 4 >> 2] = c << 3;H = e + 48 | 0; - }function Ta(a, b) { - var c = 0;c = (b | 0) != 0;a: { - b: { - c: { - if (!b | !(a & 3)) { - break c; - }while (1) { - if (!j[a | 0]) { - break b; - }a = a + 1 | 0;b = b + -1 | 0;c = (b | 0) != 0;if (!b) { - break c; - }if (a & 3) { - continue; - }break; - } - }if (!c) { - break a; - } - }d: { - if (!j[a | 0] | b >>> 0 < 4) { - break d; - }while (1) { - c = i[a >> 2];if ((c ^ -1) & c + -16843009 & -2139062144) { - break d; - }a = a + 4 | 0;b = b + -4 | 0;if (b >>> 0 > 3) { - continue; - }break; - } - }if (!b) { - break a; - }while (1) { - if (!j[a | 0]) { - return a; - }a = a + 1 | 0;b = b + -1 | 0;if (b) { - continue; - }break; - } - }return 0; - }function ga(a, b, c) { - var d = 0, - e = 0, - f = 0, - g = 0, - i = 0, - j = 0;if (h[a >> 1] < (c | 0)) { - h[a >> 1] = c; - }g = b + -1 | 0;e = (g << 1) + a | 0;d = 25736 - c << 16 >> 16;if (h[e >> 1] > (d | 0)) { - h[e >> 1] = d; - }if ((b | 0) >= 3) { - d = k[a >> 1];e = k[a + 2 >> 1];b = 1;while (1) { - i = (b << 1) + a | 0;f = (d << 16 >> 16) + c | 0;d = e << 16 >> 16;if ((f | 0) > (d | 0)) { - h[i >> 1] = f;d = f << 16 >> 16;e = f; - }b = b + 1 | 0;f = h[(b << 1) + a >> 1];j = f - c | 0;if ((j | 0) < (d | 0)) { - e = (d >> 1) + (j >>> 1 | 0) | 0;h[i >> 1] = e; - }d = e;e = f;if ((b | 0) != (g | 0)) { - continue; - }break; - } - } - }function xa(a, b, c) { - var d = 0, - e = 0, - f = 0, - h = 0;d = i[c + 16 >> 2];a: { - if (!d) { - if (Ma(c)) { - break a; - }d = i[c + 16 >> 2]; - }f = i[c + 20 >> 2];if (d - f >>> 0 < b >>> 0) { - return J[i[c + 36 >> 2]](c, a, b) | 0; - }b: { - if (g[c + 75 | 0] < 0) { - break b; - }e = b;while (1) { - d = e;if (!d) { - break b; - }e = d + -1 | 0;if (j[e + a | 0] != 10) { - continue; - }break; - }e = J[i[c + 36 >> 2]](c, a, d) | 0;if (e >>> 0 < d >>> 0) { - break a; - }b = b - d | 0;a = a + d | 0;f = i[c + 20 >> 2];h = d; - }X(f, a, b);i[c + 20 >> 2] = i[c + 20 >> 2] + b;e = b + h | 0; - }return e; - }function cc(a, b) { - a: { - if ((b | 0) >= 1024) { - a = a * 8.98846567431158e+307;if ((b | 0) < 2047) { - b = b + -1023 | 0;break a; - }a = a * 8.98846567431158e+307;b = ((b | 0) < 3069 ? b : 3069) + -2046 | 0;break a; - }if ((b | 0) > -1023) { - break a; - }a = a * 2.2250738585072014e-308;if ((b | 0) > -2045) { - b = b + 1022 | 0;break a; - }a = a * 2.2250738585072014e-308;b = ((b | 0) > -3066 ? b : -3066) + 2044 | 0; - }lc(0, 0);lc(1, b + 1023 << 20);return a * +mc(); - }function db(a, b, c, d, e) { - a = a | 0;b = b | 0;c = c | 0;d = d | 0;e = e | 0;var f = 0;f = H - 96 | 0;H = f;i[f + 92 >> 2] = a;a: { - if (d) { - i[e + 36 >> 2] = J[i[2735]](10920);Ba(f + 8 | 0, 8e3, 10920);break a; - }i[e + 36 >> 2] = J[i[2902]](11588);Ba(f + 8 | 0, 16e3, 11588); - }a = i[e + 36 >> 2];J[i[i[a >> 2] + 44 >> 2]](a, 4, f + 92 | 0) | 0;Fa(e);a = X(T(80), f + 8 | 0, 80);i[f + 4 >> 2] = 80;d = a;a = i[f + 4 >> 2];X(b, d, (a | 0) > (c | 0) ? c : a);H = f + 96 | 0;return a | 0; - }function wa(a, b, c, d) { - var e = 0, - f = 0, - g = 0, - j = 0;g = 1;if ((d | 0) > 0) { - while (1) { - j = i[(f << 2) + a >> 2];e = j >> 31;e = e ^ e + j;g = (e | 0) < (g | 0) ? g : e;f = f + 1 | 0;if ((f | 0) != (d | 0)) { - continue; - }break; - } - }f = 0;e = 0;if ((g | 0) > (c | 0)) { - while (1) { - e = e + 1 | 0;g = g >> 1;if ((g | 0) > (c | 0)) { - continue; - }break; - } - }if ((d | 0) > 0) { - while (1) { - h[(f << 1) + b >> 1] = i[(f << 2) + a >> 2] >> e;f = f + 1 | 0;if ((f | 0) != (d | 0)) { - continue; - }break; - } - }return e; - }function Ob(a, b, c, d, e, f, g, j, k, l, m, n, p, q, r) { - a = a | 0;b = b | 0;c = c | 0;d = d | 0;e = e | 0;f = f | 0;g = g | 0;j = j | 0;k = k | 0;l = l | 0;m = m | 0;n = n | 0;p = p | 0;q = q | 0;r = r | 0;d = (e | 0) < 63 ? e : 63;if ((g | 0) >= 1) { - f = d << 23 >> 16;e = 0;while (1) { - l = o(h[(e - c << 1) + a >> 1], f);i[(e << 2) + b >> 2] = l;h[(e << 1) + a >> 1] = l + 4096 >>> 13;e = e + 1 | 0;if ((g | 0) != (e | 0)) { - continue; - }break; - } - }i[j >> 2] = c;h[k + 2 >> 1] = d;h[k >> 1] = 0;h[k + 4 >> 1] = 0; - }function Gb(a, b) { - var c = 0, - d = 0, - e = 0;c = i[a + 4 >> 2];d = i[a + 8 >> 2];e = i[a + 12 >> 2];a: { - if (!e) { - break a; - }W(a, 0, 1);if (!i[a + 12 >> 2]) { - break a; - }while (1) { - W(a, 1, 1);if (i[a + 12 >> 2]) { - continue; - }break; - } - }i[a + 8 >> 2] = d;i[a + 12 >> 2] = e;i[a + 4 >> 2] = c;c = c + 7 >> 3;d = (c | 0) < 200 ? c : 200;if ((d | 0) >= 1) { - c = 0;while (1) { - g[b + c | 0] = j[i[a >> 2] + c | 0];c = c + 1 | 0;if ((d | 0) != (c | 0)) { - continue; - }break; - } - }return d; - }function Eb(a, b, c) { - a = a | 0;b = b | 0;c = c | 0;var d = 0;d = H - 16 | 0;H = d;a: { - b: { - switch (b | 0) {case 0: - i[c >> 2] = i[a + 4 >> 2] << 1;a = 0;break a;case 1: - b = i[c >> 2];if (!b) { - i[c >> 2] = 4;a = 0;break a; - }a = i[((b << 2) + a | 0) + 24 >> 2];if (!a) { - i[c >> 2] = -1;a = 0;break a; - }i[c >> 2] = i[a + 52 >> 2];a = 0;break a;default: - break b;} - }i[d + 4 >> 2] = b;i[d >> 2] = 11821;Y(i[3524], 12120, d);a = -1; - }H = d + 16 | 0;return a | 0; - }function Zb(a) { - var b = 0, - c = 0, - d = 0;a: { - b: { - b = a;if (!(b & 3)) { - break b; - }if (!j[a | 0]) { - return 0; - }while (1) { - b = b + 1 | 0;if (!(b & 3)) { - break b; - }if (j[b | 0]) { - continue; - }break; - }break a; - }while (1) { - c = b;b = b + 4 | 0;d = i[c >> 2];if (!((d ^ -1) & d + -16843009 & -2139062144)) { - continue; - }break; - }if (!(d & 255)) { - return c - a | 0; - }while (1) { - d = j[c + 1 | 0];b = c + 1 | 0;c = b;if (d) { - continue; - }break; - } - }return b - a | 0; - }function Mb(a, b, c) { - a = a | 0;b = b | 0;c = c | 0;var d = 0;d = H - 16 | 0;H = d;a: { - b: { - switch (b | 0) {case 0: - i[c >> 2] = i[a >> 2];a = 0;break a;case 1: - b = i[c >> 2];if (!b) { - i[c >> 2] = 5;a = 0;break a; - }a = i[((b << 2) + a | 0) + 28 >> 2];if (!a) { - i[c >> 2] = -1;a = 0;break a; - }i[c >> 2] = i[a + 52 >> 2];a = 0;break a;default: - break b;} - }i[d + 4 >> 2] = b;i[d >> 2] = 5040;Y(i[3524], 5072, d);a = -1; - }H = d + 16 | 0;return a | 0; - }function V(a, b) { - var c = 0, - d = 0, - e = 0, - f = 0, - h = 0, - j = 0;c = i[a + 12 >> 2];d = i[a + 8 >> 2];if (((c + b | 0) + (d << 3) | 0) > i[a + 4 >> 2]) { - i[a + 20 >> 2] = 1;return 0; - }if (!(i[a + 20 >> 2] | !b)) { - j = i[a >> 2];while (1) { - f = g[d + j | 0];h = c + 1 | 0;i[a + 12 >> 2] = h;f = f >>> 7 - c & 1;e = e << 1;if ((h | 0) != 8) { - c = h; - } else { - i[a + 12 >> 2] = 0;d = d + 1 | 0;i[a + 8 >> 2] = d;c = 0; - }e = e | f;b = b + -1 | 0;if (b) { - continue; - }break; - } - }return e; - }function Lb(a) { - i[a + 8 >> 2] = 1065353216;i[a >> 2] = 1036831949;i[a + 4 >> 2] = 0;i[a + 52 >> 2] = 1059982050;i[a + 56 >> 2] = 1028443341;i[a + 36 >> 2] = 0;i[a + 40 >> 2] = 0;i[a + 60 >> 2] = 0;i[a + 44 >> 2] = 0;i[a + 48 >> 2] = 1096387994;i[a + 12 >> 2] = 1091252534;i[a + 16 >> 2] = 1091252534;i[a + 28 >> 2] = 1091252534;i[a + 32 >> 2] = 0;i[a + 20 >> 2] = 1091252534;i[a + 24 >> 2] = 1091252534; - }function Rb(a, b, c, d, e, f, g, j, k, l, m, n, o) { - a = a | 0;b = b | 0;c = c | 0;d = d | 0;e = e | 0;f = f | 0;g = g | 0;j = j | 0;k = k | 0;l = l | 0;m = m | 0;n = n | 0;o = o | 0;e = b;k = c;b = (m & 1) + m | 0;c = g << 1;Vb(a, e, k, d, b, g, f, c + b | 0);if ((g | 0) >= 1) { - m = 0;while (1) { - d = (m << 2) + j | 0;i[d >> 2] = i[d >> 2] + (h[b + (m << 1) >> 1] << 8);m = m + 1 | 0;if ((m | 0) != (g | 0)) { - continue; - }break; - } - }U(a, 0, c); - }function Ua(a, b, c) { - var d = 0, - e = 0, - f = 0;a: { - if ((b | 0) == 1 & a >>> 0 < 0 | b >>> 0 < 1) { - d = a;break a; - }while (1) { - d = hc(a, b);e = I;f = e;c = c + -1 | 0;g[c | 0] = a - gc(d, e) | 48;e = b >>> 0 > 9;a = d;b = f;if (e) { - continue; - }break; - } - }if (d) { - while (1) { - c = c + -1 | 0;a = (d >>> 0) / 10 | 0;g[c | 0] = d - o(a, 10) | 48;b = d >>> 0 > 9;d = a;if (b) { - continue; - }break; - } - }return c; - }function bb(a, b, c, d, e, f) { - var g = 0, - i = p(0), - j = 0;g = H;j = g;g = g - ((e << 2) + 15 & -16) | 0;H = g;Hb(b, c, f);if ((Nb(a, b, g) | 0) >= 0) { - if ((e | 0) >= 1) { - b = 0;while (1) { - a = (b << 1) + d | 0;i = m[g + (b << 2) >> 2];a: { - if (p(q(i)) < p(2147483648)) { - c = ~~i;break a; - }c = -2147483648; - }h[a >> 1] = c;b = b + 1 | 0;if ((e | 0) != (b | 0)) { - continue; - }break; - } - } - }H = j; - }function eb(a) { - var b = 0, - c = 0;b = H - 32 | 0;H = b;a: { - b: { - if (j[a | 0] != 83 | j[a + 1 | 0] != 112 | (j[a + 2 | 0] != 101 | j[a + 3 | 0] != 101)) { - break b; - }if (j[a + 4 | 0] != 120 | j[a + 5 | 0] != 32 | (j[a + 6 | 0] != 32 | j[a + 7 | 0] != 32)) { - break b; - }c = T(80);X(c, a, 80);break a; - }i[b + 16 >> 2] = 13233;Y(i[3524], 13305, b + 16 | 0); - }H = b + 32 | 0;return c; - }function fa(a, b, c, d, e, f) { - var g = 0, - i = 0;e = ((e << 14) + 16384 | 0) / (f << 16 >> 16) | 0;if ((d | 0) >= 1) { - e = e << 16;g = e >> 16;i = 1073741824 - e >> 16;e = 0;while (1) { - f = e << 1;h[f + c >> 1] = (o(h[b + f >> 1], g) - -8192 >>> 14) + (o(h[a + f >> 1], i) - -8192 >>> 14);e = e + 1 | 0;if ((e | 0) != (d | 0)) { - continue; - }break; - } - } - }function bc(a) { - var b = 0, - c = 0, - d = 0;b = H - 16 | 0;H = b;g[b + 15 | 0] = 10;c = i[a + 16 >> 2];a: { - if (!c) { - if (Ma(a)) { - break a; - }c = i[a + 16 >> 2]; - }d = i[a + 20 >> 2];if (!(g[a + 75 | 0] == 10 | d >>> 0 >= c >>> 0)) { - i[a + 20 >> 2] = d + 1;g[d | 0] = 10;break a; - }if ((J[i[a + 36 >> 2]](a, b + 15 | 0, 1) | 0) != 1) { - break a; - } - }H = b + 16 | 0; - }function _a(a, b, c, d) { - a = a | 0;b = b | 0;c = c | 0;d = d | 0;var e = 0;e = H - 16 | 0;H = e;a = B(i[a + 60 >> 2], b | 0, c | 0, d & 255, e + 8 | 0) | 0;b = 0;a: { - if (!a) { - break a; - }i[3790] = a;b = -1; - }b: { - if (!b) { - b = i[e + 12 >> 2];a = i[e + 8 >> 2];break b; - }i[e + 8 >> 2] = -1;i[e + 12 >> 2] = -1;b = -1;a = -1; - }H = e + 16 | 0;I = b;return a | 0; - }function Nb(a, b, c) { - var d = 0, - e = 0;d = H - 1296 | 0;H = d;J[i[i[a >> 2] + 48 >> 2]](a, 3, d + 1292 | 0) | 0;b = J[i[i[a >> 2] + 40 >> 2]](a, b, d) | 0;e = i[d + 1292 >> 2];if ((e | 0) >= 1) { - a = 0;while (1) { - m[(a << 2) + c >> 2] = h[(a << 1) + d >> 1];a = a + 1 | 0;if ((e | 0) != (a | 0)) { - continue; - }break; - } - }H = d + 1296 | 0;return b; - }function gb(a, b, c) { - var d = 0, - e = 0;d = b;b = V(a, 4);d = d + o(b, 20) | 0;e = i[d + 4 >> 2];if (e) { - return J[e | 0](a, c, i[d + 8 >> 2]) | 0; - }c = 1;a: { - if ((b | 0) < 2) { - break a; - }c = 4;if ((b | 0) < 8) { - break a; - }c = 8;if ((b | 0) < 10) { - break a; - }c = 16;if ((b | 0) < 12) { - break a; - }c = (b | 0) < 14 ? 32 : 64; - }oa(a, c);return 0; - }function Oa(a, b) { - var c = 0, - d = 0;if (!a) { - return na(b); - }if (b >>> 0 >= 4294967232) { - i[3790] = 48;return 0; - }c = dc(a + -8 | 0, b >>> 0 < 11 ? 16 : b + 11 & -8);if (c) { - return c + 8 | 0; - }c = na(b);if (!c) { - return 0; - }d = i[a + -4 >> 2];d = (d & 3 ? -4 : -8) + (d & -8) | 0;X(c, a, d >>> 0 < b >>> 0 ? d : b);S(a);return c; - }function Cb(a) { - a = a | 0;S(i[a + 64 >> 2]);S(i[a + 68 >> 2]);S(i[a + 72 >> 2]);S(i[a + 100 >> 2]);S(i[a + 80 >> 2]);S(i[a + 96 >> 2]);S(i[a + 104 >> 2]);S(i[a + 108 >> 2]);S(i[a + 112 >> 2]);S(i[a + 116 >> 2]);S(i[a + 120 >> 2]);S(i[a + 132 >> 2]);S(i[a + 52 >> 2]);S(i[a + 140 >> 2]);S(a); - }function nb(a) { - a = a | 0;var b = 0;b = i[a + 4 >> 2];J[i[i[b >> 2] + 24 >> 2]](b);S(i[a + 48 >> 2]);S(i[a + 52 >> 2]);S(i[a + 56 >> 2]);S(i[a + 68 >> 2]);S(i[a + 72 >> 2]);S(i[a + 76 >> 2]);S(i[a + 92 >> 2]);S(i[a + 96 >> 2]);S(i[a + 80 >> 2]);S(i[a + 84 >> 2]);S(i[a + 88 >> 2]);S(a); - }function Ib(a, b, c, d, e, f) { - a = a | 0;b = b | 0;c = c | 0;d = d | 0;e = e | 0;f = f | 0;if ((c | 0) >= 1) { - b = 0;while (1) { - d = o(i[f >> 2], 1664525) + 1013904223 | 0;i[f >> 2] = d;i[(b << 2) + a >> 2] = ((d >> 16) - (d >> 19) | 0) - -8192 & -16384;b = b + 1 | 0;if ((c | 0) != (b | 0)) { - continue; - }break; - } - } - }function vb(a, b) { - var c = 0, - d = 0, - e = 0, - f = 0;if ((b | 0) >= 1) { - while (1) { - e = (c << 2) + a | 0;d = i[e >> 2];f = (d | 0) < -262144e3;if (!((d | 0) <= 262144e3 ? !f : 0)) { - i[e >> 2] = f ? -262144e3 : (d | 0) > 262144e3 ? 262144e3 : 0; - }c = c + 1 | 0;if ((c | 0) != (b | 0)) { - continue; - }break; - } - } - }function cb(a, b, c) { - a = a | 0;b = b | 0;c = c | 0;var d = 0;g[i[c >> 2]] = 0;i[c + 20 >> 2] = 0;i[c + 12 >> 2] = 0;i[c + 4 >> 2] = 0;i[c + 8 >> 2] = 0;d = i[c + 36 >> 2];J[i[i[d >> 2] + 28 >> 2]](d, a, c) | 0;d = b;a = Gb(c, b + 2 | 0);b = a & 65535;h[d >> 1] = (b << 24 | b << 8) >>> 16;return a | 0; - }function ma(a) { - var b = 0, - c = 0;b = i[3652];b;c = a;a = Zb(a);a: { - if ((((ac(c, a, b) | 0) != (a | 0) ? -1 : 0) | 0) < 0) { - break a; - }b: { - if (j[b + 75 | 0] == 10) { - break b; - }a = i[b + 20 >> 2];if (a >>> 0 >= l[b + 16 >> 2]) { - break b; - }i[b + 20 >> 2] = a + 1;g[a | 0] = 10;break a; - }bc(b); - } - }function $(a, b, c) { - var d = 0;c = c >> 2;if (c) { - while (1) { - d = (((o(h[b + 2 >> 1], h[a + 2 >> 1]) + o(h[b >> 1], h[a >> 1]) | 0) + o(h[b + 4 >> 1], h[a + 4 >> 1]) | 0) + o(h[b + 6 >> 1], h[a + 6 >> 1]) >> 6) + d | 0;b = b + 8 | 0;a = a + 8 | 0;c = c + -1 | 0;if (c) { - continue; - }break; - } - }return d; - }function ea(a, b, c, d, e) { - var f = 0;f = H - 256 | 0;H = f;if (!(e & 73728 | (c | 0) <= (d | 0))) { - c = c - d | 0;d = c >>> 0 < 256;U(f, b & 255, d ? c : 256);if (!d) { - while (1) { - ja(a, f, 256);c = c + -256 | 0;if (c >>> 0 > 255) { - continue; - }break; - } - }ja(a, f, c); - }H = f + 256 | 0; - }function da(a, b, c, d) { - var e = 0, - f = 0, - g = 0, - h = 0;if ((d | 0) >= 1) { - g = c & 16383;h = c << 2 >> 16;c = 0;while (1) { - e = c << 2;f = i[e + a >> 2] << 9 >> 16;i[b + e >> 2] = o(f, h) + (o(f, g) >> 14) << 7;c = c + 1 | 0;if ((d | 0) != (c | 0)) { - continue; - }break; - } - } - }function Ma(a) { - var b = 0;b = j[a + 74 | 0];g[a + 74 | 0] = b + -1 | b;b = i[a >> 2];if (b & 8) { - i[a >> 2] = b | 32;return -1; - }i[a + 4 >> 2] = 0;i[a + 8 >> 2] = 0;b = i[a + 44 >> 2];i[a + 28 >> 2] = b;i[a + 20 >> 2] = b;i[a + 16 >> 2] = b + i[a + 48 >> 2];return 0; - }function ca(a, b, c, d) { - var e = 0, - f = 0, - g = 0;if ((d | 0) >= 1) { - e = a;while (1) { - g = f << 1;e = e << 16 >> 16;h[g + c >> 1] = o(e, h[b + g >> 1]) + 16384 >>> 15;e = o(a, e) + 16384 >>> 15 | 0;f = f + 1 | 0;if ((f | 0) != (d | 0)) { - continue; - }break; - } - } - }function kb(a) { - a = a | 0;var b = 0;b = i[a + 4 >> 2];J[i[i[b >> 2] + 36 >> 2]](b);S(i[a + 44 >> 2]);S(i[a + 48 >> 2]);S(i[a + 52 >> 2]);S(i[a + 56 >> 2]);S(i[a + 60 >> 2]);S(i[a + 68 >> 2]);S(i[a + 72 >> 2]);S(i[a + 64 >> 2]);S(a); - }function ia(a) { - var b = 0, - c = 0;b = i[3750];c = a + 3 & -4;a = b + c | 0;a: { - if (a >>> 0 <= b >>> 0 ? (c | 0) >= 1 : 0) { - break a; - }if (a >>> 0 > pc() << 16 >>> 0) { - if (!(D(a | 0) | 0)) { - break a; - } - }i[3750] = a;return b; - }i[3790] = 48;return -1; - }function za(a) { - var b = 0, - c = 0, - d = 0;if (g[i[a >> 2]] + -48 >>> 0 < 10) { - while (1) { - b = i[a >> 2];d = g[b | 0];i[a >> 2] = b + 1;c = (o(c, 10) + d | 0) + -48 | 0;if (g[b + 1 | 0] + -48 >>> 0 < 10) { - continue; - }break; - } - }return c; - }function gc(a, b) { - var c = 0, - d = 0, - e = 0;c = a >>> 16 | 0;e = o(c, 0);d = o(c, 10);c = o(a & 65535, 10);d = d + (c >>> 16 | 0) | 0;a = d & 65535;I = e + o(b, 10) + (d >>> 16) + (a >>> 16) | 0;return c & 65535 | a << 16; - }function pa(a, b, c) { - var d = 0;a: { - if ((c | 0) < 2) { - break a; - }c = c + -1 | 0;while (1) { - if (h[b >> 1] >= (a | 0)) { - break a; - }b = b + 2 | 0;d = d + 1 | 0;if ((c | 0) != (d | 0)) { - continue; - }break; - }d = c; - }return d; - }function oa(a, b) { - var c = 0;b = i[a + 12 >> 2] + b | 0;c = i[a + 8 >> 2];if (!(i[a + 20 >> 2] ? 0 : (b + (c << 3) | 0) <= i[a + 4 >> 2])) { - i[a + 20 >> 2] = 1;return; - }i[a + 12 >> 2] = b & 7;i[a + 8 >> 2] = (b >> 3) + c; - }function Fb(a) { - var b = 0, - c = 0;b = i[a + 12 >> 2];c = i[a + 8 >> 2];if ((b + (c << 3) | 0) >= i[a + 4 >> 2]) { - i[a + 20 >> 2] = 1;return 0; - }return i[a + 20 >> 2] ? 0 : g[i[a >> 2] + c | 0] >>> 7 - b & 1; - }function T(a) { - var b = 0, - c = 0;b = 0;a: { - if (!a) { - break a; - }c = a;b = a;if ((a | 1) >>> 0 < 65536) { - break a; - }b = c; - }c = b;a = na(b);if (!(!a | !(j[a + -4 | 0] & 3))) { - U(a, 0, c); - }return a; - }function Wa(a, b, c, d) { - if (a | b) { - while (1) { - c = c + -1 | 0;g[c | 0] = j[(a & 15) + 14592 | 0] | d;a = (b & 15) << 28 | a >>> 4;b = b >>> 4 | 0;if (a | b) { - continue; - }break; - } - }return c; - }function Jb(a) { - var b = 0, - c = 0;c = 12144;a: { - while (1) { - if (i[c >> 2] >= (a | 0)) { - break a; - }c = c + 4 | 0;b = b + 1 | 0;if ((b | 0) != 31) { - continue; - }break; - }b = 31; - }return b; - }function Fa(a) { - var b = 0;b = T(2e3);i[a >> 2] = b;if (b) { - i[a + 20 >> 2] = 0;i[a + 24 >> 2] = 2e3;i[a + 12 >> 2] = 0;i[a + 16 >> 2] = 1;i[a + 4 >> 2] = 0;i[a + 8 >> 2] = 0; - } - }function Pa(a) { - var b = 0;a = a ? a : 1;a: { - while (1) { - b = na(a);if (b) { - break a; - }b = i[3807];if (b) { - J[b | 0]();continue; - }break; - }E();x(); - }return b; - }function Va(a, b, c) { - if (a | b) { - while (1) { - c = c + -1 | 0;g[c | 0] = a & 7 | 48;a = (b & 7) << 29 | a >>> 3;b = b >>> 3 | 0;if (a | b) { - continue; - }break; - } - }return c; - }function zb(a) { - a = a | 0;S(i[a + 44 >> 2]);S(i[a + 48 >> 2]);S(i[a + 60 >> 2]);S(i[a + 56 >> 2]);S(i[a + 64 >> 2]);S(i[a + 76 >> 2]);S(a); - }function ac(a, b, c) { - a: { - if (i[c + 76 >> 2] <= -1) { - a = xa(a, b, c);break a; - }a = xa(a, b, c); - }if ((a | 0) == (b | 0)) { - return b; - }return a; - }function la(a, b) { - var c = 0;c = H - 16 | 0;H = c;i[c + 8 >> 2] = a;i[c + 4 >> 2] = b;i[c >> 2] = 12377;Y(i[3524], 12767, c);G(1);x(); - }function ic(a) { - var b = 0;b = a & 31;a = 0 - a & 31;return (-1 >>> b & -2) << b | (-1 << a & -2) >>> a; - } - - function Y(a, b, c) { - var d = 0;d = H - 16 | 0;H = d;i[d + 12 >> 2] = c;Xa(a, b, c);H = d + 16 | 0; - }function fb(a, b, c) { - a = a | 0;b = b | 0;c = c | 0;oa(a, V(a, 4) << 3 | 5);return 0; - }function _b(a, b, c, d) { - a = a | 0;b = b | 0;c = c | 0;d = d | 0;I = 0;return 0; - }function Qa(a, b) { - if (!a) { - return 0; - }return ec(a, b); - }function ja(a, b, c) { - if (!(j[a | 0] & 32)) { - xa(b, c, a); - } - }function Wb(a) { - a = a | 0;a = H - a & -16;H = a;return a | 0; - }function Za(a) { - a = a | 0;return F(i[a + 60 >> 2]) | 0; - }function $b(a) { - a = a | 0;return 0; - }function Yb() { - return H | 0; - }function Xb(a) { - a = a | 0;H = a; - }function Sa() {} - // EMSCRIPTEN_END_FUNCS - var J = jc([null, Mb, Db, Cb, Bb, Ab, zb, yb, xb, wb, sb, rb, Pb, Ob, Rb, Ib, Sb, Qb, fc, Tb, ub, tb, Eb, ob, nb, mb, lb, kb, jb, ib, hb, qb, pb, fb, Za, Ya, _a, $b, _b]);function pc() { - return f.byteLength / 65536 | 0; - }return { "i": J, "j": Sa, "k": db, "l": cb, "m": ab, "n": Yb, "o": Xb, "p": Wb, "q": na }; - }var K = new Uint8Array(sc.buffer);for (var L = new Uint8Array(123), M = 25; M >= 0; --M) { - L[48 + M] = 52 + M;L[65 + M] = M;L[97 + M] = 26 + M; - }L[43] = 62;L[47] = 63;function qc(zc, Ac, Bc) { - var N, - O, - M = 0, - P = Ac, - Q = Bc.length, - R = Ac + (Q * 3 >> 2) - (Bc[Q - 2] == "=") - (Bc[Q - 1] == "=");for (; M < Q; M += 4) { - N = L[Bc.charCodeAt(M + 1)];O = L[Bc.charCodeAt(M + 2)];zc[P++] = L[Bc.charCodeAt(M)] << 2 | N >> 4;if (P < R) zc[P++] = N << 4 | O >> 2;if (P < R) zc[P++] = O << 6 | L[Bc.charCodeAt(M + 3)]; - } - }qc(K, 1024, "BxERGxkWDAT9ABzcJ+jxA/cP+wof5Asf6wn19f755w7qHwTyE/QO+wT5BPsJAP4q0fABCAAJF8cAHPUG4TfTA/sEAv4E+f0G/gf9DAUINvYI+fjo5+Xy+wgFLBcF9/X18/f0+OP46gbxA/T/+/0i/x3wEfwMAgEE/vwC/wv9zBwe9+AZLOzoBAb/");qc(K, 1174, "5/YWHQ3z6vP8APzwCg/c6BwZ//1C3/XxBgADBP4FGOzRHRP+/P8A//4DAQj1BQXHHBwA8AT8DPr/Auw99xjq1h0GEQgEAr8PCAoFBgUDAv79BfcE+xcNF/3BA/v8+gD9F9zSCQUFCAQJ+wH9CgH6CvUY0R8W9A72Bgv5+QfhM/T6BwbvCfXsNO0D+vr4+xfXJQHrCvIIBwXx8Rcn5t8HAuDi6/gEDBEPDgvyCQ3gAvYf9vj4Bvz/CsAXBhQNBgjqECIHKs/kBRoE8SkiKSAhGBcOCCgiBOjX7fEN8yHKGBvUIRvx8RjtDtwO9xj0/CX7EN4FCiHxyvAMGQwBAgAD//z8CwLINhvsDfrS19/1+wcMDvL7CBQGAwT4+9YLCPIZ/gINC+on9wkF0/cH9wz5Iu+aBwLWEiP33gv7/gMWLszn96IIC/v7+wT53fk2BeADGPfqCEEl//Tp+vfkN98O/QISxCnvCPAR9QD1HeQlCcsh8vcH5/n1GuD4GOsW7RP2HfIAAAAAAAAAAPvMCikG4vwQIBbl6iD95P0D3QYRFxUIAgTT7w4X/OH1/Q4BE/UCPfgJ9Af2DP3oY9AXMtv76QAI8iPA+y7nDf/P7fEJIjIZC/r38Ozg3+DlCvgM8Tjy4CED9wFB9/f2/vrpCRED5A3gBP72BPBMDMwGDSH6BPL3/QHx8BwB8QsQCQTr29j6Fgzx6fLv8Pf29w3ZKQX3ENoZLtEEMfIR/gYSBfrf6iwy/gED+gcH/esm7iLy1zzzBhDoIxPz3BgD7/L2JCzU4/0DyvgMNxoE/vsC9RbpAhYB59lCzxX4/gryxBkGChvnEAX+9xrz7Dr+BzT3AgX88Rf/2hcIG/oA5fkn9vIaC9P0CfsiBN0KK+r1OPkUAQoB5gleC+Xy8wH1AA77+vb88fjXFfsB5PgW9yHp/Pz0JwT5A8RQCO8C+gz7AQkPGx8eGxc9LxoK+/j08wXuGfH88fUM/v7w/voYDAv8CQH3DtM5DBTdGgvAIPb2Kvz38CAYBwo09ccdAAgA+hHvyNgHFBIM+hAFB/8JAQodDBAN/hcHCf38+xLADTfnCfcYDucP9djiJQHtFvvhDf4AB/wQvQxC3Bj4EvHpEwDT+QQD8w0jBQ0hChsXAPn1K7Yk9AIF+AbfC/Dy+/n9Ed4b8Av3DyHhCPAH+vk/ye8L/xTSIuIGCRMc9wXo+On+H+3w+/HuABoSJfvx/hEF5RXfLAzl9xELGevh+Q0h+Of5B/YE+vcwrun4BgvpA/0x4xkfBA4QCfzuCuYDBdT3CdHJDwkcAQT9Lgb62uPh8foDAA76CMrOIfsB8iHQGvz7/fv9++TqTTf/AgoK9/K+zwvc+uwK9hAMBP/wLdTOH/4ZKhfg6gALFNjd2Nzg5uvzNOoG6OwR+/gk5/UV5gYi+AcU/QXn+BL79/wB9xQUJzDoCQW/Fh0EA9X1IPoJE+X20fIYCvnc+f/8+/sQNRnm4/z0LcbeIfsC/xvQH/EW+wQHB+f9C+oQ9Aj9B/UtDrftONIY7Bz0/v/c/d8T+gcC8QXh0wgjDRQA9zDz1f3zAvtIvOUCAf75BSQh2PT8+xcTAECvhY86AECvhJE7AEBDhOA7AEDHgUs+AEBSqIkZAAA4PZCFOD26PY+Euj3nPTKE5z0iP76BIj9SOFyPUjgAAHr+BAZ/7JtOm05/7AQG2PsBC9rlZXu1GiL8L/8v/yL8tRple9rlAQvY+wAAAAAAAODg4ADkvfsh1vrgEsf2yiPwG9cqE+3YJNMY6yj48u4cAQ7GNe6o2SfaFe4l7RTVJgoR0DbMxvMh1P/1IPT13hYOANIu293eBecs4isG/MEx4SvXK+ke1SnVGvIs3wHzG/MS2yXSt9Mi3BjnItz17BPnDO4h3LvFItMGCC7q8ugS/w3ULNnQ5g/gH9si3w/SH+ge3CXXH+kpzhb8MuoC6xzvHt4o+cTkHdoq5CrU9RUr8AjUItnJ1RX13Rop9wDeHfh5r3EH8Ooh2yHhJOX53BHeRsdB2/XQFdgR/yzfBvoh9wDsIutF3znjIeEjyQz/Md8b6iPO39ERzjYzXv/71CP8Ftgt2b7nGN8B5hTo6ecM9RXTLOfT7RHVafBSBesBKfAL3x7znfw52yHxLOclwTbcGOEfy8jaGtf8BCXfDeIYMTSicvvi8RcBJtg46QzcHe8o0TPb19kLzyIAOu75/CLwEeUjHgXCQQQwvEzVC/Um7hPxKenC2RfWCv4p6/PzGfcN0SrpwugY1DzrOu79zCDqFtwitTkQWu0DCi3jF9og+8LNJs0o7jXWDegg3g7sHsi15iXmIA875hHjHfkczDX04gUe+9D7IwIC1SgVEBBL59PgCtUS9ioJAP80/wfiJBPQ/DDkGeMg6gDhFuAR9iTA18IkzA8QOuLq4Ab5Cdok6BXsBfv5DvYC5RDsAOAaEwj11x8c5eAiKiLvFvYN4xL05ugLFgX7+za81TnnGAQEGvj07zYe0wEK8RLXC0S9JfDo8CbqBuMeQuUFB/ANAvT5/ewkBOQJAyAwGicDAAfr8wWu+UnsIvf7Af8K+/b/CQH3CgDyC//+/wsUYK/q9PfGCRjiGt0b9A3uOMUP+Rfx/wbnDursL/UQAibp7eL3KPUFBPoIGuv1fwQBBvcC+f79B/sK7QeWW/0J/BX4GrAIAf727+/lIEcG4wvpNtod6idX4fTsA/7+AhQA/90bCfr0A/T6DQEO6sXx7+cN+QcDAAH5Bv092+np4ybhGwH4AuUX5iTeBRjo+gcDxU7CLPABBgARCC0AkgYO/iCzyD79A/ME8Gbx3P8JjwYXAAkJBfj/8gX0ecvl+PcW8wMC/QH+uV8m7Q/w+0cKAuDz+w///vKrHh0GAwIAAAAAAAAAAAK/yPcSEhfy/gAM4xr0AQL0wFr6BAEF+5L94RbjCQAI2PsV+/sNCu4oASPsHuQL+hMHDhLACfoQM0QIEAz4APcU6hkH/PMp3V3uygv/AfcEvkLhFOoZ6QsKCRMPC/vh9unk+vr9/AUD5Bb11hnn8CkiL/oCKu3qBdkgBt0WEeII5vX1A/QhIdsV/wb8AwD7BQz0ORvD/RTvAgAEAP7fxlHpJ/b7Agb5BQT9/vPpuGsP+wD5/foF/A8vDOEZ8AgW58LI7g4cDAL1Sr4p7PkQ7BD4APAE7VwMxfLZMefwF+UT/d8TVeMG+fYQ+fQB+gIE/kAK5yn+4Q8AbjJFIxwT9gLVz8jx8AoDDP/4ARr0/wf15SkZAfXuFvn/0fgX/e/5EoM7+wMSAQIDG91ByzLSJevkBw7b+/sMBfhO7RX68Aj5BQIHAgr6DMQsC9zgHwAC/gIB/Qf2EesKBv4T/jvaqiYI1+LT3wcPHB35GNgHBwX+CRjp7gbjHgIcMfXSCivz9//9+fnv+mHf6wMFAQzV+BwH1fkR7BP/AvMJNiIJ5PX3727FLOYAA/TRSd7VJt8Q+9L8+v7nE+Mc8wUOG9jVBCDz/t38cNYJ9CXkEQ7tI9kXA/L/x/te9wPZBR724Crz8p/BHvcB+QwFFBH33OIZL/fxDOpi+M4P5RXw9QIM9gr9ISSgAO8f9wkD7A31CPwK9gkBcLrlBesCx/3jChPrFfa+/VvdHvQA+TvkGgIO7gEBCxEUysUbBB0gBRMM/AEH9gX+CgAX+xyYLgsQAx0B+PIBB85YwhoI7/IyACD0/eUS+PsIA+z1JfQJIS6b//wBBv8c1vEQBf/+yVUm9/wL/vf6A+z2s1kY/ZjH5uHs+vcOFOku8eEcAfH+Bv4fLbQX5ycM8uzjw7204Lm9RE0uIgXz0NK4r6zExtjkUl1ELR0D7dHk1d3i+PPZpaWFoAoK+u7JxKXI3OXw0LUoHPbkIwklEwHs4dfu5928sC0b/y8NAOPdx86xt9rtBSMO9ukQ+AXo2MLp5erw7tK4sysVIQGwurrAyMzZ3+Ha7e3xICH+B/Hx6Onf18joxwVZQCkbBffRxJ+fhOz31LcfHfxAMAfdxwD95tH9+ti0sdAMUTcKCejVt8e7EAXkyxIdFAD89QbzFwfv3dvb4rzBBhj38gMV8+XHz7Do1/vw+wEtGQz5A/H68PH4BvPWr7CpDgH2/dW70ujk4yQG1cj0DDZPKwk2FgII9NXSzNq7p/tLJiEF88vCqaePncne2z43IRAV/u/S49ra0NnW3LW4qNDiFQLxx8CerLQZAdKw9BL5AyIGJh8XBP8UDvHVsqXoDv02EADl5NTIraSn/SI4KSQWFPj53dbCzwMM9s6poL5cRiYJurnC1tnV9fnOscbO4SAf+vznB+/ausbl1a3kOyQUHwLlubCTnrXf4OH+IQ/6KyH7AOr25d7P9ezXpZyH2TkpCu3O2sXEuu7s+OH48QHy5uchFSARAe3t5sav3eotHgv1A+bQqb2txgP/5uwsChknBffd5doHCgT31quagTQsHArRw9jZ7//239a20BX8RjQK3MIG9/byyBcB5hfQ7wwI+Rcd3OT64+/7KBcKCtLzJAYE4uM+IOD/FvIB/OrTAjYE4sfF9Bv94Qj3BQryIEITCQLn2xfxEtrhBffrDwAWPh4P9PLSTRUhAyId7TICCwna9Ns+AfE2IAYC6BQj6wITGPM3BAkn7R7/60k2IQgSAw8G7dEG/dDOARoUCOnOQfLJ7+Hb5DX/78sBOQv45+LbQAXM0w8XHw8O5xgh/tTI7gbr1QT0EdsU9iIPAg83FfXh+i4ZEPfn+MIcERTg4xoeGe0C8O8azQIyKhO+Fx3+AxPt2yAPBh7eDQv7KB8K1gT3Gve6Ef7pFOrJM+jhFuoP8wP25PA4BMEL7vHu2t0Q+SL/68/RCdsHCEU3FAbf0/b3BvcMRw/91vnoIN3+1u/7AP7fyg303i8XEzcH+EofDhDp5hMM7s/k4ewC8uzRTigN6fUV+hIBLwUmIyAuFggNEPISMxMoJwvm/+8vAsvxH+omFfHwBd81D9pWC/3oMQ389e4cFPTl5iPn3f3swx4KyfTqzMryE+D0LQ/40PcL4Ajw3vMzEib+4O8W/u7kujsb5O327Pf3+OsV+CP+Lf33DAAeB9krG9qlHhoTyfw/Du8NCQ0CBwQGPUj/7x3/6u8I5Ns/LCkDAg4J+kv4+fTx9A0J/B7qvw8A0wT8AQUWCxdVbmtub3duIG5iX21vZGVfcXVlcnkgcmVxdWVzdDogAHdhcm5pbmc6ICVzICVkCgAAAIC/AACAvwAAgL8AAIC/AACAvwAAgL8AAIC/AACAvwAAgL8AAIC/AACAvwAAgEAAACBAAAAAQJqZmT8AAAA/AAAAAAAAAL8zMzO/zcxMv2ZmZr8AAIC/AAAgQQAA0EBmZqZAAACQQJqZeUAAAGBAAABAQAAAIEAzMxNAZmbmPwAAgD8AADBBzcwMQQAA8EAAANBAAACgQJqZeUCamXlAmpl5QAAAYEAAAEBAAACAPwAAMEEAADBBZmYeQQAACEEAAOBAAADAQAAAkEAAAIBAAACAQAAAgEAAAABAAAAwQQAAMEEAADBBAAAwQQAAGEEAAAhBAAAAQQAA4EAAAMBAAACgQAAAQEAAADBBAAAwQQAAMEEAADBBAAAwQQAAMEEAABhBAAAIQQAA4EAAAMBAAACgQAAAMEEAADBBAAAwQQAAMEEAADBBAAAwQQAAMEEAADBBzcwcQQAAGEEAAPBAAADgQAAAkEDNzGxAAABAQAAAIEAAAABAZmbmPwAAwD8AAIA/");qc(K, 5490, "gL8AAIC/AACAvwAAgL8AAIC/AACAvwAAgL8AAIC/AACAvwAAgL8AAIC/AACAvwAAgL8AAIC/AACAvwAAgL8AAIC/AACAvwAAgL8AAIC/AACAvwAAgL8AADBBAAAwQQAAGEEAAAhBAADwQAAAwEAAAKBAmpl5QAAAQEAAAABAAACAPwAAMEEAADBBAAAwQQAAMEEAADBBAAAYQTMzC0GamflAAADgQAAA0EAAAIBAAAAwQQAAMEEAADBBAAAwQQAAMEEAADBBAAAwQQAAMEHNzBxBAADwQAAAsEBQYWNrZXQgaXMgbGFyZ2VyIHRoYW4gYWxsb2NhdGVkIGJ1ZmZlcgBDb3VsZCBub3QgcmVzaXplIGlucHV0IGJ1ZmZlcjogdHJ1bmNhdGluZyBpbnB1dABEbyBub3Qgb3duIGlucHV0IGJ1ZmZlcjogdHJ1bmNhdGluZyBvdmVyc2l6ZSBpbnB1dABCdWZmZXIgdG9vIHNtYWxsIHRvIHBhY2sgYml0cwBDb3VsZCBub3QgcmVzaXplIGlucHV0IGJ1ZmZlcjogbm90IHBhY2tpbmcARG8gbm90IG93biBpbnB1dCBidWZmZXI6IG5vdCBwYWNraW5nAG5vdGlmaWNhdGlvbjogJXMKAHdhcm5pbmc6ICVzCg==");qc(K, 6e3, "FicOLAsj/hf8Bi7kDeXpDAQU+wkl7ukXAAn67AT/7/v8EQABCf4BAgL0COcnDwkQyfUJCwUK/sQIDfoL8BvR9AsBEPkJ/eMJ8hntIiQMKPb96PLb693+3AP6QxwG7/308PHv+cXc8wEHAQIKAgsNCgj+BwMFBAIC/fgE+wYH1g8j/tImHOz3AQf9AP4=");qc(K, 6150, "8eQ0IAX77+z2/wwgGS4kIQkO/QYB+AD2+/n5+fv7H+UY4PwK9RX9Exf3Fhj2//bz+fUq3x8T+AD28AHr7wr4DggEC/4F/t8L8CEL/An8CwIG+wj7C/z6GtzwAAT++AwG/yLS6gkJFQkFvvsaAgoNAhMJDK8DDQ0A8hbdBvn8BvoK+uEm3wD29QX0DO8FAPoN9woIGSEC9Aj6Cv4VBxErBQv59+zc7On8/P0b9/fP2dr19wYFFxkFAwMEAQL9/1cnEev37ffx8/Lv9fb1+Pr//f3/yt7l+PX8+wAABAgGCQcJBwYFBQUwChP2DP8J/QIF/QL+/gD+5gYJ+fD3AgcH+9ULFvX3IiXx8/oB/wEBwDg09eUFBAMBAgED//z89vn8/AL/+fn09vH3+/v18PMGEATz8Pb8AtHzGS8T8uz47wD98wEG7/IPAQoG6AD2E7v4DjER+yHjA/wAAvgF+gJ4yPTRF/cG+wEC+wH2BP//BP8A/R7MvR4WC//8AwAHAgAB9vz48wUBAf8FDff99sIWMPz6AgMFAQEEAQ0D7Ar3Df78Cews/xTgvRMAHAsIAvUP7csfAiIKBvzGCAoNDgEMAgAAgCX4LPca/RICBgv/CQEFAwABAQIMA/79BxkJEvrbA/jwA/b5Ed7UCxHx/fD/8wvSv/4IDQIEBAUPBQkG");qc(K, 6680, "9xP0DOQmHf8MAgUX9gME8RX8AwMGEff8+OwaBfYGAe0S8fQv+v759//v/v7yHvIC+fz/9AvnEP30C/kH7wET5B/59gf2AwwF8AYYKePKAAEH/wX6DQr8+Aj35cva/woTERAMDAAD+fwNDOHyBvsDBRErMhkKAfr++NsF1QVJPScM/cPgAioe/RHlCSIU//sCF/nSGjXRFP7fp83AGwsP3vvIGff/4wEoQ+nwECETBw5VFvb29Pn/NFkdC+zb0vER6OQYAgEAF5sXDv/p7gkF8yYB5OQEGzPmItgjLzYmyub6KucN4twSKfzfF+D5/DP9Ecw40ST+6yQKCN8fEwn72Ar36xMSsu77AObc0c3UEigb/h0x5gIgyh63NgP7JBY1Cv+sy+P7A9Q1zQQWR93/Ifvl+SQR6dkQ98nx7CfdBtnyEjDA7/EJJ1ElvCUv6/qYDQYJ/iMI6RIqLRUh+88J+tXIJwLw51cB/fcR5/X3/woC8vIE//Yc6SjgGvcaBOXpAyrEATH9GwrM2P4SLekR1AP9EdI02NEZSx/PNR7i4Nwm+vHwNuXQAybj4Ory/OnzINkJCNPzIvAxKCAfHBcXIC87vAg+LBny6L/wJEPn2usE3/4qBcEoCxrW6cNP4RfsCuA159wK5vsDALkF9tsB6BXK7wHj5/HlIEQt8Nvu+wEAs0f6A+xHvR3dCuITBBARBQDyEwIcGjsDAhgnN87T7u8h3Q7/AQhX3eMA5Q35F/Ml2DLdDhP58jE2+xb+4/jlJg0bMAzX6/EcB/Do7ewL7AkCDRfsCxvlR7sIAvoWDBAQCfD47wEZASjb30JeNQTq59fWGSPw8Tkf4+AVEMQtD/8HOebR4wsIDxOX+DYbCu8G9P/2BAAX9h8NCwoMwBf9+O0QNBjYEAooBQkA8/nr+Pr56zsQyxLEC9EO7hnz6ATZEOQ2Gr0eG+zMFPQ3DBLwJ/L65jioyQwZGtsGSwDerzbiAfkx6fIVCsLGx9HeD/wish8Z9Qcy9irBDtz8OTc5NSrW/w8oJQ8Z9QYBH/76//nAIhwe/wMVAKj0yBnkKAjk8gkMAvrvFjH65g4c7AT0MiMoDdrG4xEeFjwaytn0OuTBCuv49BrCBvb16vr5BAESAroLDgQNE+jeGEMRM+sNFzbiMAHzUBrw/g38BuId6EnGHuUU/uspLR7l/fvu7M/93Qoq7b3L9QkN8d/N4g8HGeIEHOreNuMn0hQQIvwvSwHUyegH/wnWMvjcKUQA/Pbp8c5AJPflDBna0dsgzzPcAvxF5hMHLUMuDcEuD9EE1w36BeslGsn5If/kCu/A8gDc7139974s6wP0Jvrz9BMNK9X29Ab7Cc8g+wIEBQ/wCusIwvhACE//vs/uBSj74tMB+hXgXe7i6yAV7hYIBdfKUBb2+fjpwEI48uLX0vLj2xvyKv734yIOIfIWBAoaGhwgF7jgAwDyI9ay4AYd7tP7B9/T/ereCPgEzef3O7IV++fQQvHv6M/zGenA+ijo7fU53/gBCszKHCcxIvXD19UKD/EzHg/NIN7+3g4SEAEB/f0BAe4GEDAM+9YHJDAH7PYHDAI2J9olNgT1+NL2BfbeLvQd2yck9Rg4EQ4UGQDn5Df5+xsDCeb4Buj24uHeEgQWFSj/49v461zjC/0LSRcWBwTU9/UV8wsJsv8vcvTb7fv16hMM4gcmLev49zfTOOsHES7HqfobHx8HyPQuFfv0JAMD6ysTDPkJ8gD336UHGgP1QFPh0hkCCQUCAv8U7wr75fgUCO0Q6/PhBQUqGAki7BzDFgvZQOz/4vfsGOfo4xbEBvsp96kOIg/HNEUP/Zo6EAMGPLXgGgfH5eDo6+PwPtIfHuXxBw8BBfExvtD8MtQHJRDuGebm8RMT5dEcOQXv4NdEFf5AOAjw8+b38AsG2RntFuEU0zfVCvAv2CjszQPv8vHoNezSLhu8IAPu+wnhEPf2/+kwXy8Z1+D9D+fJJCnlFAUNDuoFAukSLvER7t77+BvJSRAC/+8osiEAAhMENfDx8OT98zEI+eMb8yAUIMMQDiksKBgUBwQwxLMR+tBB8SDiufb9+gr++ePIQ+IH+1b69gAF4Twi2v0YCv4eFxjXDEbVD+8GDRDzCB7x+AUX3p788w3Q4UYMHxkY6Br5IfAIBfXy+L8NCv73AP28BSMHAOH/7/f3ENvu/0XQ5Bbr9QUxNxeq3BACDT/NHvUNGO76Du0BKQn7G9zU3tvr5h/ZDysF+B0U+OzM5P8NGt729xv4CBu+BAzqMQqzIO4D2gz9/wICAODg4ADhxvAW1+jVDsjqyR3zIdcv/Nn3HdcP9Cb48fQfAQLUKOq+1hvaHOkm6w7bHwAVzjTLueUh2//tGe375BYGQdRK39DfCdg58jrvBNMg4SbfJOkc2CfVHfQu3g3pHPAP5SLyrvEr4RngHesF+ybRwc0h0gwDL+Tv4wv2Dtgm/f7/APwFI9j3DdQF5f/5BvUH+AcT8g/8CfYK+Ar3/wEAAAIF7hbLMgHpMtwPA/MO9gYBBf0E/gXgGQX+//wBC+Ma+vEe7gAP7yjXAwn+/gP9//sCFfrw6xcCPA8Q8PcOCf8H9wABAQD/+hHkNtP/Af/6+gILGuP+LusiDOkg6RD2A0IT7BgHC/0A/f/O0gLu/QT//gP97SncCQvoFfAJ/ef9ChL3/vv/+wb8/QLmFe0j8QfzEe0n1TDhEPcH/vsD/AntG8k/3Qoa1P4JBAH6CPcF+P/98C3WBQ/wCg==");qc(K, 8758, "8BjJL9ob7Qf9ARAbFO0SBfkB+wL6COoA/f0I/wf4Af0FABHQOswd+f4D9gbmOuEB+gNd4ycDEQUG////Gw0KE/neDAr8CbQJCOT+9QL/AwGtJtkE8Pr++wX+HhMmIiggLis6KwXu59jfycwUIhzswZ+kPTUvMTVL8suzsQD9+xMWGvfLyUJaSFVESjT818bh7uEbIB4SGAMIBfT9GhxKP/7ZvbOWtjs7SUEsKEdIUlNiWFk8+uHR0PPZ9wcCT//ZxO9XUUEyLRPrvaWp184HEidKCuHkJxgNFwU4LR0K+/P13e749vjnubPrAhAyP1dXBeDYzbwADAY2IgX0IDREQEU7QS0O8OHYv70pMS8l9cy1rPw5MCoqIfXNvPoNAAj4GiDpywAkOExhaW9h/+TZ2NXK1NjuIxDs7eTWHS8mSi0D49DCsJjfODs7ChEuSFRldXt7avnfz826veXhRkPwwqvsUkdWUFVK7ca10+Pf7uctOfTW+wwcJDRAUVIN9+XkFgMCFhoG+tTNAg8KMCsxIu3CrKea6AgRPUQnGBcTEPsMDxsP+NTPxO7g5DQ2PvjQs7pCZVM/PSX0zrXAIRENGQ9NAdbjSEAuMR89LPjRytLiExT/8AAQ9O735uX26jUt9tG1rpeTCBkxTTJBcnV8dnNgWj3308HEtccICxQdAN3P1SgvIyg3Jui0mZDlAxciNEsI49UMPyYjHRgIGQsB8e7V+SUoFezI7e38/gsdMz/+1MK1px45M0ozMi5EQEE0PzdBKxL35t3JuwMGCBHxw6qfAVZdSk5D/9q+0DAnHRkR/w0NHScyM0VSYWL+3NLl8OLz/Pn8Gfv1+ufrIQwfHfjazMG8p9//Ckr+8TtbaWllV1Q++d/O3crRGRFSUfPIrRU6HyoZSEHovqXICf4VCkVLAugLFhkcJiIwIQfj5hEP/w4A/gD6170G/vcTAlVK6r2suc4DC/cCPt7M8S0CFxU0GN/3/wnU1/PvLBbv+vz/FiYaEAIyG93e99cGAPDeMwjy4c8P3y0xIfXbwsotC/u4C//09Rgb9dUuKyH09/8B/OnHuQsIEBH47OHXNTDwA0Ho+Ong2+DP9u8GJgX379IINAMGLSgn+freth8IAfArRPXt4QQGAPrv8Nrw4gIJ2fD/K/YwAwPw4f0+RCsNA/YIFMgMDP7uFvHY3AEHKQABLvrC/PT+9a3z/lsh9gAE9fBPICUOCTPr5MjeABUJ5gsc1srp/vEfHgjZvtncH+TY0iMoFhghMBfeDiggERv9GRrzw+8LBB88+ubXwA0Q5jYf9en39d65697dNzId6uXO2jkhKjkwGgsAz+Ea/PIFTiURAM/06RoOAgLV7/QK+PwIEgz6FPT68+ciDygxBwgNFBTt6v74AjPN+jXr6AQaEfzbGRHc8x8D+hsP9h8cGvb22BD5Dw0p9wD8Mvr5DiYWANACAfPtIP3EC+//6N7/I/vlHCwNGQ8q9Q8zI9wUCPz04xPRMfH8EOPZDuIEGff7zfL92OAmBff4/P/qR/0OGu7qGNfn6AYXE/Yn5uVBLQL55vgW9BAPEN37Iev4ABchIgYVJAb56gjb8h8mC/z92eD4IOn69BAU5PwXDcz/Fgbf2PoEwg0F5iMnCwI59Qns5N80+/r+FvLw0CMBxhQNIf+2OO7q4QwG8gT+99EK/R3v+z0OL/QCSNnvXEDLzfHi2tfj5BsJJAnd1lHrFBnw++/dFQ/kMAL+Ce0d2B7u7hLwxw/s9PHb8SHZFerzIwsN2sEdF+UgEgPmKiHAvu8QOAIkAx8V19kIxw4l/hPc7enj8AH9+PYfQL/m+B0VBBPZIfncODYwKB386Na+1cQT/iUp9tvEwBLqTUkoGQQT7b7+CwUVDhrnqvwSARrbCiX/GPTF9RT6IvDwKhPkzTUgBAo+FfTeGwTQ0M7PH/nr1uf81eo7AhsM9/rw+ODG8OP7KRfi39Lz9to0NAHv9woa5/oh7DU3GeD71hcVQgXkFAlLHfnW2Q8D6RUGCwHjDj8KNhrozc8H6c0PvgE8GQoA4vzxERM7KAT7IQbqxrr7F/o8LOPw0eM07TIcECMfJADrBhUbFioHvtj4BxMuAPw8JC354/rg2QIG9yEUzd4S+hMGCwXt4/4q9dPryTklAvK98OXaRTATAu8U7PDe7+fDCkktENjA7+PqOBHZCPUI5+7z7Qg2OSTv5vwG6ygq/BQfNQreyx/vIwAP+uzBtxYZHREI49m7Eg/x+wsvEPfS4BrAIvsm+S8UAred/dMURswP+vmuHxUvMyf9CQDX+fHKAgAb4QnT6tro6AjfFwUy3O/uzf4NEysM8fQ9JiYHDQAG/wM+CRsW3ybd9x7V9+D/BPwB+/X4Jh8L9tbr2wErD/Pd7e4PF+Y7Aes1CNfO8uQEFRnk2AXY1wQz3/j4ARHEDBnXESIrEy0H2xjxOP4j9jAE0f4F+8oF/d/2Hv7U6NoJ9yoEBsgs8AnY5hLsChzX6/wN7iDi/SUPFhwy2APjwAcz7fUR5djAGPT55QMlMP8C99reLgEb+hPzGgoiFBkoMvr5HgnoAOlHwxY63vwCz98ZHvj68E0CJvjd+uI4Th8h7A3ZFBYEFfgE+gqt1wnn1Q/59N7Z298THhDfKucZvCzx9fwXMg4E2dUU4jwJ7AcQE98lHRDdBybloAAAACgAAAAKAAAAEQAAAJAAAAAzc81MBwAAAAAAAADcKgAAFCsAAEwrAACEKwAAvCsAAPQrAAAsLAAAZCw=");qc(K, 10860, "BQAAAAEAAAAIAAAAAgAAAAMAAAADAAAABAAAAAQAAAAFAAAABQAAAAYAAAAHAAAAbmFycm93YmFuZAAAECoAAAEAAACcKgAAAAAAAAQAAAACAAAAAwAAAAQAAAAFAAAABgAAAAcAAAAIAAAACQAAAAAAAAAB");qc(K, 10988, "CgAAAAsAAAAMAAAADQAAAAAAAAAOAAAADwAAAAAAAAD//wAAKw==");qc(K, 11044, "CgAAAAsAAAAQAAAAEQAAAJwsAAASAAAAEwAAAKgsAADNTAAAdwAAAP////8AAAAAAQAAAAAAAAAKAAAACwAAABAAAAARAAAAvCwAABIAAAATAAAAyCwAAGZGAACgAAAA/////wAAAAABAAAAAAAAAAoAAAALAAAAEAAAABEAAADcLAAAEgAAABMAAADoLAAAmjkAANwAAAD/////AAAAAAMAAAAAAAAAFAAAABUAAAAQAAAAEQAAAPwsAAASAAAAEwAAAAgtAABmJgAALAEAAP////8AAAAAAwAAAAAAAAAUAAAAFQAAABAAAAARAAAA/CwAABIAAAATAAAAHC0AAJoZAABsAQAA/////wAAAAADAAAAAQAAABQAAAAVAAAAEAAAABEAAAD8LAAAEgAAABMAAAAILQAAzQwAAOwBAAAAAAAAAQ==");qc(K, 11380, "CgAAAAsAAAAMAAAADQAAAAAAAAASAAAAEwAAADAtAAAAQAAATwAAANAgAAAFAAAAAAAAAAoAAAAEAAAAcBcAAAQAAAAAAAAA0CAAAAUAAAAHAAAACgAAAAQAAAAABAAABQAAAAAAAADQIAAABQAAAAcAAAAIAAAABQAAAEAFAAAHAAAAAAAAALAJAAAHAAAABwAAAAUAAAAIAAAAkB8AAAYAAAAAAAAABQAAAAgAAACQGgAACAAAAAAAAAAUAAAAAgAAABAYAAAFAAAAAAAAAHgtAAAWAAAAFC4AAAEAAAAEAAAAFwAAABgAAAAZAAAAGgAAABsAAAAcAAAAHQAAAB4AAACoKgAAoAAAACgAAAAIAAAAM3PNTAcAM3MAAAAAUC4AAIguAADALgAA+C4=");qc(K, 11696, "AwAAAAEAAAAIAAAAAgAAAAMAAAAEAAAABQAAAAUAAAAGAAAABgAAAAcAAAAHAAAAAQAAAAEAAAABAAAAAQAAAAEAAAABAAAAAgAAAAIAAAADAAAAAwAAAAQAAABwFQAABQAAAHdpZGViYW5kIChzdWItYmFuZCBDRUxQKQBVbmtub3duIHdiX21vZGVfcXVlcnkgcmVxdWVzdDog");qc(K, 11864, "AQAAAAAAAAAfAAAAIA==");qc(K, 11904, "//8AACQ=");qc(K, 11920, "AQAAAAAAAAAfAAAAIA==");qc(K, 11948, "EgAAABMAAAAwLwAA//8AAHA=");qc(K, 11976, "AQAAAAAAAAAfAAAAIA==");qc(K, 12004, "EgAAABMAAABELwAA//8AAMA=");qc(K, 12032, "AQAAAAEAAAAfAAAAIA==");qc(K, 12060, "EgAAABMAAABELwAA//8AAGABAAAKAAAABAAAAFAhAAAFAAAAAAAAAAgAAAAFAAAAsAsAAAcAAAABAAAAd2FybmluZzogJXMgJWQK");qc(K, 12144, "1EkAAD5iAAC8ggAA+K0AAIHnAAARNAEA8pkBAIUhAgDu1QIAAcYDAHkFBQCZrgYAUOQIAB7VCwDivg8A8fMUAN3hGwBxGiUAsV8xAMuzQQBOblcAaFh0AHnSmgATBs4AhigSAWbTbAFmeuUBGgiGAqSuWwNV/XcEJlLyBV/F6QcxBysPoxd+H8woDDWASAAA6gN4Ct4TaBuUIwUuFDzsVDE4Gi1IQ2Fzc2VydGlvbiBmYWlsZWQ6IHN0LT53aW5kb3dTaXplLXN0LT5mcmFtZVNpemUgPT0gc3QtPnN1YmZyYW1lU2l6ZQBzcmMvbmJfY2VscC5jAGFzc2VydGlvbiBmYWlsZWQ6IFNVQk1PREUobHRwX3F1YW50KQBhc3NlcnRpb24gZmFpbGVkOiBTVUJNT0RFKGlubm92YXRpb25fcXVhbnQp");qc(K, 12480, "/3/7ehNtTVl+QxcvVB4IEuUJAwU=");qc(K, 12516, "JAAAAHAAAADAAAAAYAE=");qc(K, 12544, "SW52YWxpZCBtb2RlIGVuY291bnRlcmVkLiBUaGUgc3RyZWFtIGlzIGNvcnJ1cHRlZC4ATW9yZSB0aGFuIHR3byB3aWRlYmFuZCBsYXllcnMgZm91bmQuIFRoZSBzdHJlYW0gaXMgY29ycnVwdGVkLgBhc3NlcnRpb24gZmFpbGVkOiBTVUJNT0RFKGx0cF91bnF1YW50KQBhc3NlcnRpb24gZmFpbGVkOiBTVUJNT0RFKGlubm92YXRpb25fdW5xdWFudCkAVW5rbm93biBuYl9jdGwgcmVxdWVzdDogAEZhdGFsIChpbnRlcm5hbCkgZXJyb3IgaW4gJXMsIGxpbmUgJWQ6ICVzCgBub3RpZmljYXRpb246ICVzCgB3YXJuaW5nOiAlcyAlZAoAAAAAAAIA+f/5/xIADwDZ/+f/SwAjAH7/1//UACYAuf7v/+MB4P9P/XwAvAPl/uX6HwL0BjP8XfbFBjEO9fL35mMjyXXJdWMj9+b18jEOxQZd9jP89AYfAuX65f68A3wAT/3g/+MB7/+5/iYA1ADX/37/IwBLAOf/2f8PABIA+f/5/wIAJwAsADIAOQBAAEkAUwBeAGoAeACIAJoArwDGAOEA/wAgAUcBcgGkAdwBGwJjArQCEAN5A+8DdQQNBbkFfAZZB30ApADXABoBcgHkAXsCQANCBJQFTweUCY0MchCMFTwcSW52YWxpZCBtb2RlIGVuY291bnRlcmVkLiBUaGUgc3RyZWFtIGlzIGNvcnJ1cHRlZC4AVW5rbm93biBuYl9jdGwgcmVxdWVzdDogAG5vdGlmaWNhdGlvbjogJXMKAHdhcm5pbmc6ICVzICVkCgBzcGVleC0xLjJiZXRhMwBUaGlzIG1vZGUgaXMgbWVhbnQgdG8gYmUgdXNlZCBhbG9uZQBUaGlzIGRvZXNuJ3QgbG9vayBsaWtlIGEgU3BlZXggZmlsZQBTcGVleCBoZWFkZXIgdG9vIHNtYWxsAHdhcm5pbmc6ICVzCgBub3RpZmljYXRpb246ICVzCgAAAAAAAABA0T9HP2I+KD2cO8Y5rjdbNdcyKjA=");qc(K, 13360, "HgUhBSkFNQVIBV8FewWcBcMF7gUfBlUGjwbPBhMHXAeqB/wHVAiwCBAJdQneCUwKvgo0C64LLAyuDDQNvg1LDtwOcA8IEKMQQRHiEYYSLRPXE4MUMRXiFZUWSxcCGLsYdhkyGvAarxtwHDEd9B23HnsfQCAEIcohjyJUIxkk3iSjJWcmKifsJ64obiktKusqqCtjLBwt0y2ILjsv7C+bMEcx8TGYMjwz3TN7NBY1rjVCNtM2YDfqN3A48jhwOeo5YDrSOkA7qTsOPG48yjwhPXQ9wj0LPk8+jz7JPv8+Lz9bP4E/oz+/P9Y/6D/1P/0/AEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABA6T+mPzc/nD7WPeQ8yDuDOhU5fzfDNeIz3jG3L28tCCuFKOYlLyNhIH8djRqMF4MUdhFvDn8LyAigBlNQRUVYX0RFQ09ERV9FUlJPUjogb25seSBzdXBwb3J0IHNwZWV4IG5hcnJvd2JhbmQgYW5kIHdpZGViYW5kLiBUcnlpbmcgdG8gZGVjb2RlIGFzIG5hcnJvd2JhbmQARVJST1I6IFBhY2tldCB3YXMgaW5jb21wbGV0ZS4ARVJST1I6IHN0cmVhbSBjb3JydXB0ZWQ/ICBlbmNvZGVkX2ZyYW1lX3NpemUgKHBhY2tldCBzaXplKS4AU1BFRVhfREVDT0RFX0VSUk9SOiBpbnB1dCBub3QgYSBzcGVleC4AU1BFRVhfREVDT0RFX0VSUk9SOiBpbnB1dCB0b28gc2hvcnQgdG8gZGV0ZXJtaW5lIGNvbXByZXNzaW9uLg==");qc(K, 14054, "8D8AAAAAAAD4PwAAAAAAAAAABtDPQ+v9TD4=");qc(K, 14091, "QAO44j8gOQAALSsgICAwWDB4AChudWxsKQ==");qc(K, 14128, "EQAKABEREQAAAAAFAAAAAAAACQAAAAALAAAAAAAAAAARAA8KERERAwoHAAEACQsLAAAJBgsAAAsABhEAAAARERE=");qc(K, 14209, "CwAAAAAAAAAAEQAKChEREQAKAAACAAkLAAAACQALAAAL");qc(K, 14267, "DA==");qc(K, 14279, "DAAAAAAMAAAAAAkMAAAAAAAMAAAM");qc(K, 14325, "Dg==");qc(K, 14337, "DQAAAAQNAAAAAAkOAAAAAAAOAAAO");qc(K, 14383, "EA==");qc(K, 14395, "DwAAAAAPAAAAAAkQAAAAAAAQAAAQAAASAAAAEhIS");qc(K, 14450, "EgAAABISEgAAAAAAAAk=");qc(K, 14499, "Cw==");qc(K, 14511, "CgAAAAAKAAAAAAkLAAAAAAALAAAL");qc(K, 14557, "DA==");qc(K, 14569, "DAAAAAAMAAAAAAkMAAAAAAAMAAAMAAAwMTIzNDU2Nzg5QUJDREVGoDo=");qc(K, 14616, "yAAAAAAAAAAF");qc(K, 14636, "Ig==");qc(K, 14660, "IwAAACQAAAA4Ow==");qc(K, 14684, "Ag==");qc(K, 14699, "//////8=");qc(K, 14944, "ZDs=");qc(K, 15e3, "gEFQAAAAAAAF");qc(K, 15020, "JQ==");qc(K, 15044, "IwAAACYAAAB4PQAAAAQ=");qc(K, 15068, "AQ==");qc(K, 15083, "Cv////8=");return oc({ "Int8Array": Int8Array, "Int16Array": Int16Array, "Int32Array": Int32Array, "Uint8Array": Uint8Array, "Uint16Array": Uint16Array, "Uint32Array": Uint32Array, "Float32Array": Float32Array, "Float64Array": Float64Array, "NaN": NaN, "Infinity": Infinity, "Math": Math }, rc, sc.buffer); - } - - // EMSCRIPTEN_END_ASM - - - (asmLibraryArg, wasmMemory); - }, instantiate: function instantiate(binary, info) { - return { then: function then(ok) { - var module = new WebAssembly.Module(binary);ok({ "instance": new WebAssembly.Instance(module) }); - } }; - }, RuntimeError: Error };wasmBinary = [];if (typeof WebAssembly !== "object") { - abort("no native wasm support detected"); - }var wasmMemory;var wasmTable;var ABORT = false;var EXITSTATUS = 0;function assert(condition, text) { - if (!condition) { - abort("Assertion failed: " + text); - } - }function getCFunc(ident) { - var func = Module["_" + ident];assert(func, "Cannot call unknown function " + ident + ", make sure it is exported");return func; - }function ccall(ident, returnType, argTypes, args, opts) { - var toC = { "string": function string(str) { - var ret = 0;if (str !== null && str !== undefined && str !== 0) { - var len = (str.length << 2) + 1;ret = stackAlloc(len);stringToUTF8(str, ret, len); - }return ret; - }, "array": function array(arr) { - var ret = stackAlloc(arr.length);writeArrayToMemory(arr, ret);return ret; - } };function convertReturnValue(ret) { - if (returnType === "string") return UTF8ToString(ret);if (returnType === "boolean") return Boolean(ret);return ret; - }var func = getCFunc(ident);var cArgs = [];var stack = 0;if (args) { - for (var i = 0; i < args.length; i++) { - var converter = toC[argTypes[i]];if (converter) { - if (stack === 0) stack = stackSave();cArgs[i] = converter(args[i]); - } else { - cArgs[i] = args[i]; - } - } - }var ret = func.apply(null, cArgs);ret = convertReturnValue(ret);if (stack !== 0) stackRestore(stack);return ret; - }function cwrap(ident, returnType, argTypes, opts) { - argTypes = argTypes || [];var numericArgs = argTypes.every(function (type) { - return type === "number"; - });var numericRet = returnType !== "string";if (numericRet && numericArgs && !opts) { - return getCFunc(ident); - }return function () { - return ccall(ident, returnType, argTypes, arguments, opts); - }; - }var UTF8Decoder = typeof TextDecoder !== "undefined" ? new TextDecoder("utf8") : undefined;function UTF8ArrayToString(heap, idx, maxBytesToRead) { - var endIdx = idx + maxBytesToRead;var endPtr = idx;while (heap[endPtr] && !(endPtr >= endIdx)) { - ++endPtr; - }if (endPtr - idx > 16 && heap.subarray && UTF8Decoder) { - return UTF8Decoder.decode(heap.subarray(idx, endPtr)); - } else { - var str = "";while (idx < endPtr) { - var u0 = heap[idx++];if (!(u0 & 128)) { - str += String.fromCharCode(u0);continue; - }var u1 = heap[idx++] & 63;if ((u0 & 224) == 192) { - str += String.fromCharCode((u0 & 31) << 6 | u1);continue; - }var u2 = heap[idx++] & 63;if ((u0 & 240) == 224) { - u0 = (u0 & 15) << 12 | u1 << 6 | u2; - } else { - u0 = (u0 & 7) << 18 | u1 << 12 | u2 << 6 | heap[idx++] & 63; - }if (u0 < 65536) { - str += String.fromCharCode(u0); - } else { - var ch = u0 - 65536;str += String.fromCharCode(55296 | ch >> 10, 56320 | ch & 1023); - } - } - }return str; - }function UTF8ToString(ptr, maxBytesToRead) { - return ptr ? UTF8ArrayToString(HEAPU8, ptr, maxBytesToRead) : ""; - }function stringToUTF8Array(str, heap, outIdx, maxBytesToWrite) { - if (!(maxBytesToWrite > 0)) return 0;var startIdx = outIdx;var endIdx = outIdx + maxBytesToWrite - 1;for (var i = 0; i < str.length; ++i) { - var u = str.charCodeAt(i);if (u >= 55296 && u <= 57343) { - var u1 = str.charCodeAt(++i);u = 65536 + ((u & 1023) << 10) | u1 & 1023; - }if (u <= 127) { - if (outIdx >= endIdx) break;heap[outIdx++] = u; - } else if (u <= 2047) { - if (outIdx + 1 >= endIdx) break;heap[outIdx++] = 192 | u >> 6;heap[outIdx++] = 128 | u & 63; - } else if (u <= 65535) { - if (outIdx + 2 >= endIdx) break;heap[outIdx++] = 224 | u >> 12;heap[outIdx++] = 128 | u >> 6 & 63;heap[outIdx++] = 128 | u & 63; - } else { - if (outIdx + 3 >= endIdx) break;heap[outIdx++] = 240 | u >> 18;heap[outIdx++] = 128 | u >> 12 & 63;heap[outIdx++] = 128 | u >> 6 & 63;heap[outIdx++] = 128 | u & 63; - } - }heap[outIdx] = 0;return outIdx - startIdx; - }function stringToUTF8(str, outPtr, maxBytesToWrite) { - return stringToUTF8Array(str, HEAPU8, outPtr, maxBytesToWrite); - }function writeArrayToMemory(array, buffer) { - HEAP8.set(array, buffer); - }var WASM_PAGE_SIZE = 65536;var buffer, HEAP8, HEAPU8, HEAP16, HEAPU16, HEAP32, HEAPU32, HEAPF32, HEAPF64;function updateGlobalBufferAndViews(buf) { - buffer = buf;Module["HEAP8"] = HEAP8 = new Int8Array(buf);Module["HEAP16"] = HEAP16 = new Int16Array(buf);Module["HEAP32"] = HEAP32 = new Int32Array(buf);Module["HEAPU8"] = HEAPU8 = new Uint8Array(buf);Module["HEAPU16"] = HEAPU16 = new Uint16Array(buf);Module["HEAPU32"] = HEAPU32 = new Uint32Array(buf);Module["HEAPF32"] = HEAPF32 = new Float32Array(buf);Module["HEAPF64"] = HEAPF64 = new Float64Array(buf); - }var INITIAL_INITIAL_MEMORY = Module["INITIAL_MEMORY"] || 16777216;if (Module["wasmMemory"]) { - wasmMemory = Module["wasmMemory"]; - } else { - wasmMemory = new WebAssembly.Memory({ "initial": INITIAL_INITIAL_MEMORY / WASM_PAGE_SIZE, "maximum": INITIAL_INITIAL_MEMORY / WASM_PAGE_SIZE }); - }if (wasmMemory) { - buffer = wasmMemory.buffer; - }INITIAL_INITIAL_MEMORY = buffer.byteLength;updateGlobalBufferAndViews(buffer);var __ATPRERUN__ = [];var __ATINIT__ = [];var __ATMAIN__ = [];var __ATPOSTRUN__ = [];var runtimeInitialized = false;var runtimeExited = false;function preRun() { - if (Module["preRun"]) { - if (typeof Module["preRun"] == "function") Module["preRun"] = [Module["preRun"]];while (Module["preRun"].length) { - addOnPreRun(Module["preRun"].shift()); - } - }callRuntimeCallbacks(__ATPRERUN__); - }function initRuntime() { - runtimeInitialized = true;callRuntimeCallbacks(__ATINIT__); - }function preMain() { - callRuntimeCallbacks(__ATMAIN__); - }function exitRuntime() { - runtimeExited = true; - }function postRun() { - if (Module["postRun"]) { - if (typeof Module["postRun"] == "function") Module["postRun"] = [Module["postRun"]];while (Module["postRun"].length) { - addOnPostRun(Module["postRun"].shift()); - } - }callRuntimeCallbacks(__ATPOSTRUN__); - }function addOnPreRun(cb) { - __ATPRERUN__.unshift(cb); - }function addOnPostRun(cb) { - __ATPOSTRUN__.unshift(cb); - }var runDependencies = 0;var runDependencyWatcher = null;var dependenciesFulfilled = null;function addRunDependency(id) { - runDependencies++;if (Module["monitorRunDependencies"]) { - Module["monitorRunDependencies"](runDependencies); - } - }function removeRunDependency(id) { - runDependencies--;if (Module["monitorRunDependencies"]) { - Module["monitorRunDependencies"](runDependencies); - }if (runDependencies == 0) { - if (runDependencyWatcher !== null) { - clearInterval(runDependencyWatcher);runDependencyWatcher = null; - }if (dependenciesFulfilled) { - var callback = dependenciesFulfilled;dependenciesFulfilled = null;callback(); - } - } - }Module["preloadedImages"] = {};Module["preloadedAudios"] = {};function abort(what) { - if (Module["onAbort"]) { - Module["onAbort"](what); - }what += "";err(what);ABORT = true;EXITSTATUS = 1;what = "abort(" + what + "). Build with -s ASSERTIONS=1 for more info.";var e = new WebAssembly.RuntimeError(what);readyPromiseReject(e);throw e; - }function hasPrefix(str, prefix) { - return String.prototype.startsWith ? str.startsWith(prefix) : str.indexOf(prefix) === 0; - }var dataURIPrefix = "data:application/octet-stream;base64,";function isDataURI(filename) { - return hasPrefix(filename, dataURIPrefix); - }var fileURIPrefix = "file://";function isFileURI(filename) { - return hasPrefix(filename, fileURIPrefix); - }var wasmBinaryFile = "soundhound-speex.wasm";if (!isDataURI(wasmBinaryFile)) { - wasmBinaryFile = locateFile(wasmBinaryFile); - }function getBinary() { - try { - if (wasmBinary) { - return new Uint8Array(wasmBinary); - }var binary = tryParseAsDataURI(wasmBinaryFile);if (binary) { - return binary; - }if (readBinary) { - return readBinary(wasmBinaryFile); - } else { - throw "both async and sync fetching of the wasm failed"; - } - } catch (err) { - abort(err); - } - }function getBinaryPromise() { - if (!wasmBinary && (ENVIRONMENT_IS_WEB || ENVIRONMENT_IS_WORKER) && typeof fetch === "function" && !isFileURI(wasmBinaryFile)) { - return fetch(wasmBinaryFile, { credentials: "same-origin" }).then(function (response) { - if (!response["ok"]) { - throw "failed to load wasm binary file at '" + wasmBinaryFile + "'"; - }return response["arrayBuffer"](); - }).catch(function () { - return getBinary(); - }); - }return Promise.resolve().then(getBinary); - }function createWasm() { - var info = { "a": asmLibraryArg };function receiveInstance(instance, module) { - var exports = instance.exports;Module["asm"] = exports;wasmTable = Module["asm"]["i"];removeRunDependency("wasm-instantiate"); - }addRunDependency("wasm-instantiate");function receiveInstantiatedSource(output) { - receiveInstance(output["instance"]); - }function instantiateArrayBuffer(receiver) { - return getBinaryPromise().then(function (binary) { - return WebAssembly.instantiate(binary, info); - }).then(receiver, function (reason) { - err("failed to asynchronously prepare wasm: " + reason);abort(reason); - }); - }function instantiateAsync() { - if (!wasmBinary && typeof WebAssembly.instantiateStreaming === "function" && !isDataURI(wasmBinaryFile) && !isFileURI(wasmBinaryFile) && typeof fetch === "function") { - fetch(wasmBinaryFile, { credentials: "same-origin" }).then(function (response) { - var result = WebAssembly.instantiateStreaming(response, info);return result.then(receiveInstantiatedSource, function (reason) { - err("wasm streaming compile failed: " + reason);err("falling back to ArrayBuffer instantiation");return instantiateArrayBuffer(receiveInstantiatedSource); - }); - }); - } else { - return instantiateArrayBuffer(receiveInstantiatedSource); - } - }if (Module["instantiateWasm"]) { - try { - var exports = Module["instantiateWasm"](info, receiveInstance);return exports; - } catch (e) { - err("Module.instantiateWasm callback failed with error: " + e);return false; - } - }instantiateAsync();return {}; - }function callRuntimeCallbacks(callbacks) { - while (callbacks.length > 0) { - var callback = callbacks.shift();if (typeof callback == "function") { - callback(Module);continue; - }var func = callback.func;if (typeof func === "number") { - if (callback.arg === undefined) { - wasmTable.get(func)(); - } else { - wasmTable.get(func)(callback.arg); - } - } else { - func(callback.arg === undefined ? null : callback.arg); - } - } - }function _abort() { - abort(); - }function _emscripten_memcpy_big(dest, src, num) { - HEAPU8.copyWithin(dest, src, src + num); - }function abortOnCannotGrowMemory(requestedSize) { - abort("OOM"); - }function _emscripten_resize_heap(requestedSize) { - requestedSize = requestedSize >>> 0;abortOnCannotGrowMemory(requestedSize); - }function _exit(status) { - exit(status); - }var SYSCALLS = { mappings: {}, buffers: [null, [], []], printChar: function printChar(stream, curr) { - var buffer = SYSCALLS.buffers[stream];if (curr === 0 || curr === 10) { - (stream === 1 ? out : err)(UTF8ArrayToString(buffer, 0));buffer.length = 0; - } else { - buffer.push(curr); - } - }, varargs: undefined, get: function get() { - SYSCALLS.varargs += 4;var ret = HEAP32[SYSCALLS.varargs - 4 >> 2];return ret; - }, getStr: function getStr(ptr) { - var ret = UTF8ToString(ptr);return ret; - }, get64: function get64(low, high) { - return low; - } };function _fd_close(fd) { - return 0; - }function _fd_seek(fd, offset_low, offset_high, whence, newOffset) {}function _fd_write(fd, iov, iovcnt, pnum) { - var num = 0;for (var i = 0; i < iovcnt; i++) { - var ptr = HEAP32[iov + i * 8 >> 2];var len = HEAP32[iov + (i * 8 + 4) >> 2];for (var j = 0; j < len; j++) { - SYSCALLS.printChar(fd, HEAPU8[ptr + j]); - }num += len; - }HEAP32[pnum >> 2] = num;return 0; - }var ASSERTIONS = false;function intArrayToString(array) { - var ret = [];for (var i = 0; i < array.length; i++) { - var chr = array[i];if (chr > 255) { - if (ASSERTIONS) { - assert(false, "Character code " + chr + " (" + String.fromCharCode(chr) + ") at offset " + i + " not in 0x00-0xFF."); - }chr &= 255; - }ret.push(String.fromCharCode(chr)); - }return ret.join(""); - }var decodeBase64 = typeof atob === "function" ? atob : function (input) { - var keyStr = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";var output = "";var chr1, chr2, chr3;var enc1, enc2, enc3, enc4;var i = 0;input = input.replace(/[^A-Za-z0-9\+\/\=]/g, "");do { - enc1 = keyStr.indexOf(input.charAt(i++));enc2 = keyStr.indexOf(input.charAt(i++));enc3 = keyStr.indexOf(input.charAt(i++));enc4 = keyStr.indexOf(input.charAt(i++));chr1 = enc1 << 2 | enc2 >> 4;chr2 = (enc2 & 15) << 4 | enc3 >> 2;chr3 = (enc3 & 3) << 6 | enc4;output = output + String.fromCharCode(chr1);if (enc3 !== 64) { - output = output + String.fromCharCode(chr2); - }if (enc4 !== 64) { - output = output + String.fromCharCode(chr3); - } - } while (i < input.length);return output; - };function intArrayFromBase64(s) { - if (typeof ENVIRONMENT_IS_NODE === "boolean" && ENVIRONMENT_IS_NODE) { - var buf;try { - buf = Buffer.from(s, "base64"); - } catch (_) { - buf = new Buffer(s, "base64"); - }return new Uint8Array(buf["buffer"], buf["byteOffset"], buf["byteLength"]); - }try { - var decoded = decodeBase64(s);var bytes = new Uint8Array(decoded.length);for (var i = 0; i < decoded.length; ++i) { - bytes[i] = decoded.charCodeAt(i); - }return bytes; - } catch (_) { - throw new Error("Converting base64 string to bytes failed."); - } - }function tryParseAsDataURI(filename) { - if (!isDataURI(filename)) { - return; - }return intArrayFromBase64(filename.slice(dataURIPrefix.length)); - }__ATINIT__.push({ func: function func() { - ___wasm_call_ctors(); - } });var asmLibraryArg = { "f": _abort, "d": _emscripten_memcpy_big, "e": _emscripten_resize_heap, "h": _exit, "g": _fd_close, "c": _fd_seek, "b": _fd_write, "a": wasmMemory };var asm = createWasm();var ___wasm_call_ctors = Module["___wasm_call_ctors"] = function () { - return (___wasm_call_ctors = Module["___wasm_call_ctors"] = Module["asm"]["j"]).apply(null, arguments); - };var _SH_speex_init = Module["_SH_speex_init"] = function () { - return (_SH_speex_init = Module["_SH_speex_init"] = Module["asm"]["k"]).apply(null, arguments); - };var _SH_speex_encode_frame = Module["_SH_speex_encode_frame"] = function () { - return (_SH_speex_encode_frame = Module["_SH_speex_encode_frame"] = Module["asm"]["l"]).apply(null, arguments); - };var _SH_speex_speex_to_raw = Module["_SH_speex_speex_to_raw"] = function () { - return (_SH_speex_speex_to_raw = Module["_SH_speex_speex_to_raw"] = Module["asm"]["m"]).apply(null, arguments); - };var stackSave = Module["stackSave"] = function () { - return (stackSave = Module["stackSave"] = Module["asm"]["n"]).apply(null, arguments); - };var stackRestore = Module["stackRestore"] = function () { - return (stackRestore = Module["stackRestore"] = Module["asm"]["o"]).apply(null, arguments); - };var stackAlloc = Module["stackAlloc"] = function () { - return (stackAlloc = Module["stackAlloc"] = Module["asm"]["p"]).apply(null, arguments); - };var _malloc = Module["_malloc"] = function () { - return (_malloc = Module["_malloc"] = Module["asm"]["q"]).apply(null, arguments); - };Module["cwrap"] = cwrap;var calledRun;function ExitStatus(status) { - this.name = "ExitStatus";this.message = "Program terminated with exit(" + status + ")";this.status = status; - }dependenciesFulfilled = function runCaller() { - if (!calledRun) run();if (!calledRun) dependenciesFulfilled = runCaller; - };function run(args) { - args = args || arguments_;if (runDependencies > 0) { - return; - }preRun();if (runDependencies > 0) return;function doRun() { - if (calledRun) return;calledRun = true;Module["calledRun"] = true;if (ABORT) return;initRuntime();preMain();readyPromiseResolve(Module);if (Module["onRuntimeInitialized"]) Module["onRuntimeInitialized"]();postRun(); - }if (Module["setStatus"]) { - Module["setStatus"]("Running...");setTimeout(function () { - setTimeout(function () { - Module["setStatus"](""); - }, 1);doRun(); - }, 1); - } else { - doRun(); - } - }Module["run"] = run;function exit(status, implicit) { - if (implicit && noExitRuntime && status === 0) { - return; - }if (noExitRuntime) {} else { - EXITSTATUS = status;exitRuntime();if (Module["onExit"]) Module["onExit"](status);ABORT = true; - }quit_(status, new ExitStatus(status)); - }if (Module["preInit"]) { - if (typeof Module["preInit"] == "function") Module["preInit"] = [Module["preInit"]];while (Module["preInit"].length > 0) { - Module["preInit"].pop()(); - } - }noExitRuntime = true;run(); - - return Module.ready; - }; -}(); -if (true) module.exports = Module;else if (typeof define === 'function' && define['amd']) define([], function () { - return Module; -});else if (typeof exports === 'object') exports["Module"] = Module; -/* WEBPACK VAR INJECTION */}.call(exports, "/index.js", "/")) - -/***/ }), -/* 19 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - - -var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); - -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - -var pako = __webpack_require__(9); -var JSONbig = __webpack_require__(2); - -var config = __webpack_require__(1); -var utils = __webpack_require__(0); -var speex = __webpack_require__(8); -var HoundWebsocket = __webpack_require__(20); -var Processor = __webpack_require__(24); -var Response = __webpack_require__(6); - -var state = { - READY: "ready", - STREAMING: "streaming", - DONE: "done", - ERROR: "error" -}; - -var VoiceRequest = function () { - function VoiceRequest(opts) { - var _this = this; - - _classCallCheck(this, VoiceRequest); - - this.state = state.READY; - - if (opts["clientId"]) { - this.clientId = opts["clientId"]; - } else { - throw new Error("VoiceRequest requires Houndify Client ID 'clientId'."); - } - - if (opts["clientKey"]) { - this.clientKey = opts["clientKey"]; - } else if (opts["authURL"]) { - this.authURL = opts["authURL"]; - } else { - throw new Error("VoiceRequest requires either 'clientKey' or 'authURL' for authentication."); - } - - this.onResponse = utils.wrapListener(opts["onResponse"], "onResponse"); - this.onError = utils.wrapListener(opts["onError"], "onError"); - this.onTranscriptionUpdate = utils.wrapListener(opts["onTranscriptionUpdate"], "onTranscriptionUpdate"); - this.onAbort = utils.wrapListener(opts["onAbort"], "onAbort"); - - this.requestInfo = utils.cloneObject(opts["requestInfo"]); - this.conversationState = opts["conversationState"]; - - this.convertAudioToSpeex = opts["convertAudioToSpeex"] || opts["convertAudioToSpeex"] === undefined ? true : false; - this.sampleRate = opts["sampleRate"] || 16000; - this.enableVAD = opts["enableVAD"] || opts["enableVAD"] === undefined ? true : false; - - this.endpoint = opts["endpoint"] || config.VOICE_ENDPOINT_WS; - this.proxy = utils.cloneObject(opts["proxy"] || {}); - - // Set up houndify connection - this.connection = new HoundWebsocket(this); - this.connection.on("message", function (messageBody) { - //new message from houndify (partial transcript (with VAD flag) or final result) - try { - var message = new Response(messageBody); - } catch (e) { - utils.log("voice_request: unable to parse messageBody", messageBody); - _onError.call(_this, { type: "UNEXPECTED_MESSAGE", exception: messageBody }); - } - // Typo in spelling of the word partial in backend! PartialTranscript = ParialTranscript, Do not change this. - if ("Format" in message && (message.Format == 'SoundHoundVoiceSearchParialTranscript' || message.Format == 'HoundVoiceQueryPartialTranscript')) { - _onTranscript.call(_this, message); - } else if ("Format" in message && (message.Format == 'SoundHoundVoiceSearchResult' || message.Format == 'HoundQueryResult')) { - _onResponse.call(_this, message, messageBody); - } else { - utils.log("voice_request: unexpected message", message); - _onError.call(_this, { type: "UNEXPECTED_MESSAGE", exception: message }); - - _this.connection.done(); - _this.end(); - } - }).on("error", function (err) { - _onError.call(_this, err); - }); - - _startStreaming.apply(this); - } - - _createClass(VoiceRequest, [{ - key: 'write', - value: function write(audioData) { - if (this.state !== state.STREAMING) return; - - if (this.convertAudioToSpeex) { - if (this.processor) { - this.processor.process(audioData); - } else { - this.processorBuffer.push(audioData); - } - } else { - this.connection.send(audioData); - } - } - }, { - key: 'end', - value: function end() { - if (this.state !== state.STREAMING) return; - - this.state = state.DONE; - this.searchInfo["recordingEndTime"] = new Date(); - - if (this.convertAudioToSpeex && !this.processor) { - this.processorBuffer.push("endOfAudio"); - } else { - this.connection.endOfAudio(); - } - } - }, { - key: 'abort', - value: function abort() { - if (!this.connection.isActive()) return; - this.state = state.DONE; - - this.searchInfo["endTime"] = new Date(); - - this.connection.close(); - - this.onAbort(this.searchInfo); - } - }, { - key: 'isStreaming', - value: function isStreaming() { - return this.state === state.STREAMING; - } - }]); - - return VoiceRequest; -}(); - -function _startStreaming() { - var _this2 = this; - - if (this.state !== state.READY) return; - this.state = state.STREAMING; - - utils.log("voice_request: initialized"); - - this.requestInfo["ClientID"] = this.clientId; - this.requestInfo["ObjectByteCountPrefix"] = true; //always true for websocket voice search - this.requestInfo["PartialTranscriptsDesired"] = true; //always true for websocket voice search - this.requestInfo["SDK"] = "web"; - this.requestInfo["SDKVersion"] = config.version; - - if (this.conversationState && this.conversationState) { - this.requestInfo["ConversationState"] = this.conversationState; - this.requestInfo["ConversationStateTime"] = this.conversationState.ConversationStateTime; - } - - //Set up search info json - this.searchInfo = { - type: "voice", - startTime: new Date(), - endTime: -1, - vadEnabled: this.enableVAD, - requestInfo: this.requestInfo, - partialTranscriptLatencies: [], - getTotalDuration: function getTotalDuration() { - return this["endTime"] - this["startTime"]; - } - }; - - this.connection.connect(this.requestInfo); - - //Sending request info - var compressedRequestInfo = pako.gzip(JSONbig.stringify(this.requestInfo)); - this.connection.send(compressedRequestInfo); - - if (this.convertAudioToSpeex) { - this.processorBuffer = []; - speex.onReady().then(function (speexInstance) { - _this2.processor = new Processor(_this2.sampleRate, speexInstance); - _this2.processor.on('frame', function (frame) { - _this2.connection.send(frame); - }).on("error", function (err) { - _onError.call(_this2, err); - }); - _this2.connection.send(_this2.sampleRate < 16000 ? speexInstance.headerNB : speexInstance.headerWB); - while (_this2.processorBuffer.length > 0) { - var bufferItem = _this2.processorBuffer.shift(); - if (bufferItem === "endOfAudio") { - _this2.connection.endOfAudio(); - } else { - _this2.processor.process(bufferItem); - } - } - }).catch(function (err) { - _onError.call(_this2, err); - }); - } -} - -function _onError(error) { - this.state = state.ERROR; - - this.searchInfo["error"] = error; - this.searchInfo["endTime"] = new Date(); - - try { - this.connection && this.connection.close(); - } catch (err) { - this.onError(err, this.searchInfo); - } - - this.onError(error, this.searchInfo); -} - -function _onTranscript(message) { - utils.log("voice_request: partial transcript", message); - this.onTranscriptionUpdate(message); - - //calculate transcript latency - this.searchInfo["partialTranscriptLatencies"].push(new Date() - this.searchInfo["startTime"] - message["DurationMS"]); - - //Server-side VAD - if (message.SafeToStopAudio && this.enableVAD) { - utils.log("voice_request: safe to stop audio"); - this.end(); - } - - if (message.Done) { - utils.log("voice_request: done with transcripts. waiting for final response..."); - this.connection.done(); - } -} - -function _onResponse(message, messageBody) { - utils.log("voice_request: final result", message); - - this.connection.done(); - this.end(); - - if (message.Status == 'Error') { - return _onError.call(this, { type: "SERVER", exception: message }); - } - - this.searchInfo["contentBody"] = messageBody; - this.searchInfo["endTime"] = new Date(); - - this.onResponse(message, this.searchInfo); -} - -module.exports = VoiceRequest; - -/***/ }), -/* 20 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - - -var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); - -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - -function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } - -function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } - -var pako = __webpack_require__(9); -var WebSocket = __webpack_require__(21); -var HttpsProxyAgent = __webpack_require__(22); -var url = __webpack_require__(23); - -var config = __webpack_require__(1); -var StateEventDispatcher = __webpack_require__(4); -var utils = __webpack_require__(0); - -var state = { - CLOSED: "closed", - CLOSING: "closing", - CONNECTING: "connecting", - CHECKING_VERSION: "version", - STREAMING: "streaming", - AUTHENTICATING: "authenticating", - DONE: "done" -}; - -function isInBrowser() { - if (typeof window === "undefined") { - return false; - } else { - return true; - } -} - -function isBrowserWebSocketSupported() { - if (window && typeof window.WebSocket !== "undefined") return true; - return false; -} - -// states: closed, connecting, version, authentication, ready - -var HoundWebsocket = function (_StateEventDispatcher) { - _inherits(HoundWebsocket, _StateEventDispatcher); - - function HoundWebsocket(voiceRequest) { - _classCallCheck(this, HoundWebsocket); - - var _this = _possibleConstructorReturn(this, (HoundWebsocket.__proto__ || Object.getPrototypeOf(HoundWebsocket)).call(this, state.CLOSED)); - - _this.voiceRequest = voiceRequest; - _this.websocket = null; - _this.buffer = []; - _this.numBlobsInProgress = 0; - _this.proxy = voiceRequest.proxy; - return _this; - } - - _createClass(HoundWebsocket, [{ - key: "connect", - value: function connect(requestInfo) { - var _this2 = this; - - this.setState(state.CONNECTING); - - this.close(); - - this.buffer = []; - this.endOfAudioSent = false; - if (this.proxy && this.proxy.url) { - // If you are running this in the browser, and the browser supports websocket, - // use the browser implementation. - if (isInBrowser() && isBrowserWebSocketSupported()) { - this.websocket = new window.WebSocket(this.voiceRequest.endpoint, { - agent: new HttpsProxyAgent(url.parse(this.proxy.url)) - }); - } - // otherwise use the nodejs websocket implementation. - else { - this.websocket = new WebSocket(this.voiceRequest.endpoint, { - agent: new HttpsProxyAgent(url.parse(this.proxy.url)) - }); - } - } else { - // same cases as above, except `this.proxy` is not defined. - if (isInBrowser() && isBrowserWebSocketSupported()) { - this.websocket = new window.WebSocket(this.voiceRequest.endpoint); - } else { - this.websocket = new WebSocket(this.voiceRequest.endpoint); - } - } - - var websocket = this.websocket; - - websocket.onopen = function (evt) { - try { - websocket.send(JSON.stringify({ version: "1.0" })); - - utils.log("hound_websocket: connected, sending version 1.0..."); - _this2.setState(state.CHECKING_VERSION); - } catch (err) { - _this2.fire("error", err); - } - }; - - websocket.onclose = function (evt) { - try { - utils.log("hound_websocket: disconnected"); - - if (_this2.isState(state.STREAMING) && _this2.numBlobsInProgress) { - var _checkIfDone = function _checkIfDone() { - if (self.numBlobsInProgress != 0) return; - if (self.isState(state.STREAMING)) { - self.fire("error", { - type: "CONNECTION", - exception: "Connection terminated." - }); - self.setState(state.CLOSED); - } - - self.off("message", _checkIfDone); - }; - - var self = _this2; - - - self.on("message", _checkIfDone); - } else if (_this2.isState(state.CHECKING_VERSION)) { - _this2.fire("error", { - type: "PROTOCOL", - exception: "Version error." - }); - } else if (_this2.isState(state.AUTHENTICATING)) { - _this2.fire("error", { - type: "AUTHENTICATION", - exception: "Signed token rejected." - }); - } else if (_this2.isState(state.STREAMING)) { - _this2.fire("error", { - type: "CONNECTION", - exception: "Connection terminated." - }); - } - - _this2.setState(state.CLOSED); - } catch (err) { - _this2.fire("error", err); - } - }; - - websocket.onerror = function (err) { - try { - if (_this2.isState(state.CLOSING)) { - _this2.setState(state.CLOSED); - } else { - utils.log("hound_websocket: websocket error", err); - _this2.fire("error", { type: "CONNECTION", exception: err }); - } - } catch (err) { - _this2.fire("error", err); - } - }; - - websocket.onmessage = function (evt) { - try { - if (_this2.isState(state.CHECKING_VERSION)) { - var msgObject = JSON.parse(evt.data); - utils.log("hound_websocket: accepted message", evt.data); - - if (msgObject["status"] !== "ok") { - _this2.fire("error", { - type: "PROTOCOL", - exception: "Version error." - }); - _this2.close(); - return; - } - - if (!msgObject.hasOwnProperty("nonce")) { - _this2.fire("error", { - type: "PROTOCOL", - exception: "Missing nonce." - }); - _this2.close(); - return; - } - - //Sign nonce and send it to backend for authentication - utils.signToken(msgObject["nonce"], _this2.voiceRequest, function (err, signature) { - if (err) { - _this2.fire("error", { - type: "AUTHENTICATION", - exception: err - }); - _this2.close(); - return; - } - - var signedTokenMessage = { - access_id: _this2.voiceRequest.clientId, - signature: signature - }; - - if (requestInfo["InputLanguageEnglishName"]) signedTokenMessage["language_english_name"] = requestInfo["InputLanguageEnglishName"]; - if (requestInfo["InputLanguageIETFTag"]) signedTokenMessage["language_ietf_tag"] = requestInfo["InputLanguageIETFTag"]; - - websocket.send(JSON.stringify(signedTokenMessage)); - utils.log("hound_websocket: sending message", signedTokenMessage); - }); - - utils.log("hound_websocket: version ok, authenticating..."); - _this2.setState(state.AUTHENTICATING); - } else if (_this2.isState(state.AUTHENTICATING)) { - var msgObject = JSON.parse(evt.data); - utils.log("hound_websocket: accepted message", evt.data); - - if (msgObject["status"] !== "ok") { - _this2.fire("error", { - type: "AUTHENTICATION", - exception: "Signed token rejected." - }); - _this2.close(); - return; - } - - utils.log("hound_websocket: authentication ok, sending buffer..."); - for (var bufIdx in _this2.buffer) { - websocket.send(_this2.buffer[bufIdx]); - } - - utils.log("hound_websocket: buffer sent, streaming..."); - _this2.setState(state.STREAMING); - } else { - try { - if (utils.isString(evt.data)) { - var msgObject = JSON.parse(evt.data); - _this2.fire("error", { - type: "BAD_REQUEST", - exception: msgObject - }); - _this2.close(); - } else if (utils.isBlob(evt.data)) { - new Response(evt.data).arrayBuffer().then(function (result) { - var uncompressed = pako.ungzip(result, { - to: "string" - }); - _this2.fire("message", uncompressed); - _this2.numBlobsInProgress -= 1; - }); - - _this2.numBlobsInProgress += 1; - } else { - var uncompressed = pako.ungzip(evt.data.toString("binary"), { to: "string" }); - _this2.fire("message", uncompressed); - } - } catch (e) { - utils.log("hound_websocket", e); - _this2.fire("error", { - type: "UNEXPECTED_MESSAGE", - exception: evt.data - }); - _this2.close(); - } - } - } catch (err) { - _this2.fire("error", err); - } - }; - } - }, { - key: "send", - value: function send(data) { - if (this.isState(state.CLOSED)) { - utils.log("hound_websocket: can't send data, connection closed."); - } else if (!this.isState(state.STREAMING)) { - this.buffer.push(data); - } else if (this.isState(state.STREAMING)) { - this.websocket.send(data); - } - } - }, { - key: "endOfAudio", - value: function endOfAudio() { - if (!this.endOfAudioSent) { - utils.log("hound_websocket: sending endOfAudio"); - this.send(JSON.stringify({ endOfAudio: true })); - this.endOfAudioSent = true; - } - } - }, { - key: "done", - value: function done() { - utils.log("hound_websocket: done"); - //websocket is expected to close now - this.setState(state.DONE); - } - }, { - key: "close", - value: function close() { - if (this.isState(state.CLOSED)) return; - if (this.websocket) { - utils.log("hound_websocket: close"); - //todo: check if we can use same state for DONE and CLOSING - this.setState(state.CLOSING); - this.websocket.onopen = null; - this.websocket.onmessage = null; - this.websocket.close(); - } - } - }, { - key: "isActive", - value: function isActive() { - return !(this.isState(state.CLOSING) || this.isState(state.CLOSED)); - } - }]); - - return HoundWebsocket; -}(StateEventDispatcher); - -module.exports = HoundWebsocket; - -/***/ }), -/* 21 */ -/***/ (function(module, exports) { - -module.exports = __WEBPACK_EXTERNAL_MODULE_21__; - -/***/ }), -/* 22 */ -/***/ (function(module, exports) { - -module.exports = __WEBPACK_EXTERNAL_MODULE_22__; - -/***/ }), -/* 23 */ -/***/ (function(module, exports) { - -module.exports = __WEBPACK_EXTERNAL_MODULE_23__; - -/***/ }), -/* 24 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - - -var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); - -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - -function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } - -function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } - -var config = __webpack_require__(1); -var StateEventDispatcher = __webpack_require__(4); -var xaudio = __webpack_require__(25); - -var Processor = function (_StateEventDispatcher) { - _inherits(Processor, _StateEventDispatcher); - - function Processor(sampleRate, speexInstance) { - _classCallCheck(this, Processor); - - var _this = _possibleConstructorReturn(this, (Processor.__proto__ || Object.getPrototypeOf(Processor)).call(this, "ready")); - - _this.speexInstance = speexInstance; - - _this.framePtr = 0; - _this.sampleRate = sampleRate || 16000; - _this.framesize = _this.sampleRate < 16000 ? _this.speexInstance.frameSizeNB : _this.speexInstance.frameSizeWB; - - // Allocate the memory buffers for the incoming frames and the output bytes - _this.frameHeapPtr = _this.sampleRate < 16000 ? _this.speexInstance.frameBufferNB : _this.speexInstance.frameBufferWB; - _this.outBytesHeapPtr = _this.speexInstance.outBytesBuffer; - return _this; - } - - _createClass(Processor, [{ - key: 'process', - value: function process(buffer) { - try { - var isNarrowband = this.sampleRate < 16000; - var resampleControl = new xaudio.Resampler(this.sampleRate, isNarrowband ? 8000 : 16000, 1, buffer.length, true); - - var resampleLength = resampleControl.resampler(buffer); - var result = resampleControl.outputBuffer; - - for (var i = 0; i < resampleLength; i++) { - // wait until we have FRAMESIZE samples and the process (encode) the data - if (this.framePtr == this.framesize) { - //reset framePtr - this.framePtr = 0; - - // Encode FRAMESIZE samples into a single Speex frame and then send it in a Websocket message. - var nbytes = this.speexInstance.encodeFrame(this.frameHeapPtr.byteOffset, this.outBytesHeapPtr.byteOffset, isNarrowband); - var sliceStart = this.outBytesHeapPtr.byteOffset; - var sliceEnd = this.outBytesHeapPtr.byteOffset + nbytes + 2; - var newBuffer = this.outBytesHeapPtr.buffer.slice(sliceStart, sliceEnd); - var frame = new Uint8Array(newBuffer); - - this.fire("frame", frame); - } - - var isFloat32 = buffer.BYTES_PER_ELEMENT === 4; - this.frameHeapPtr[this.framePtr++] = isFloat32 ? result[i] * 0x8000 : result[i]; // convert Float32 to Int16 - } - } catch (err) { - this.fire("error", err); - } - } - }]); - - return Processor; -}(StateEventDispatcher); - -module.exports = Processor; - -/***/ }), -/* 25 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - - -//JavaScript Audio Resampler (c) 2011 - Grant Galitz -function Resampler(fromSampleRate, toSampleRate, channels, outputBufferSize, noReturn) { - this.fromSampleRate = fromSampleRate; - this.toSampleRate = toSampleRate; - this.channels = channels | 0; - this.outputBufferSize = outputBufferSize; - this.noReturn = !!noReturn; - this.initialize(); -} -Resampler.prototype.initialize = function () { - //Perform some checks: - if (this.fromSampleRate > 0 && this.toSampleRate > 0 && this.channels > 0) { - if (this.fromSampleRate == this.toSampleRate) { - //Setup a resampler bypass: - this.resampler = this.bypassResampler; //Resampler just returns what was passed through. - this.ratioWeight = 1; - } else { - //Setup the interpolation resampler: - this.compileInterpolationFunction(); - this.resampler = this.interpolate; //Resampler is a custom quality interpolation algorithm. - this.ratioWeight = this.fromSampleRate / this.toSampleRate; - this.tailExists = false; - this.lastWeight = 0; - this.initializeBuffers(); - } - } else { - throw new Error("Invalid settings specified for the resampler."); - } -}; -Resampler.prototype.compileInterpolationFunction = function () { - var toCompile = "var bufferLength = Math.min(buffer.length, this.outputBufferSize);\ - if ((bufferLength % " + this.channels + ") == 0) {\ - if (bufferLength > 0) {\ - var ratioWeight = this.ratioWeight;\ - var weight = 0;"; - for (var channel = 0; channel < this.channels; ++channel) { - toCompile += "var output" + channel + " = 0;"; - } - toCompile += "var actualPosition = 0;\ - var amountToNext = 0;\ - var alreadyProcessedTail = !this.tailExists;\ - this.tailExists = false;\ - var outputBuffer = this.outputBuffer;\ - var outputOffset = 0;\ - var currentPosition = 0;\ - do {\ - if (alreadyProcessedTail) {\ - weight = ratioWeight;"; - for (channel = 0; channel < this.channels; ++channel) { - toCompile += "output" + channel + " = 0;"; - } - toCompile += "}\ - else {\ - weight = this.lastWeight;"; - for (channel = 0; channel < this.channels; ++channel) { - toCompile += "output" + channel + " = this.lastOutput[" + channel + "];"; - } - toCompile += "alreadyProcessedTail = true;\ - }\ - while (weight > 0 && actualPosition < bufferLength) {\ - amountToNext = 1 + actualPosition - currentPosition;\ - if (weight >= amountToNext) {"; - for (channel = 0; channel < this.channels; ++channel) { - toCompile += "output" + channel + " += buffer[actualPosition++] * amountToNext;"; - } - toCompile += "currentPosition = actualPosition;\ - weight -= amountToNext;\ - }\ - else {"; - for (channel = 0; channel < this.channels; ++channel) { - toCompile += "output" + channel + " += buffer[actualPosition" + (channel > 0 ? " + " + channel : "") + "] * weight;"; - } - toCompile += "currentPosition += weight;\ - weight = 0;\ - break;\ - }\ - }\ - if (weight == 0) {"; - for (channel = 0; channel < this.channels; ++channel) { - toCompile += "outputBuffer[outputOffset++] = output" + channel + " / ratioWeight;"; - } - toCompile += "}\ - else {\ - this.lastWeight = weight;"; - for (channel = 0; channel < this.channels; ++channel) { - toCompile += "this.lastOutput[" + channel + "] = output" + channel + ";"; - } - toCompile += "this.tailExists = true;\ - break;\ - }\ - } while (actualPosition < bufferLength);\ - return this.bufferSlice(outputOffset);\ - }\ - else {\ - return (this.noReturn) ? 0 : [];\ - }\ - }\ - else {\ - throw(new Error(\"Buffer was of incorrect sample length.\"));\ - }"; - this.interpolate = Function("buffer", toCompile); -}; -Resampler.prototype.bypassResampler = function (buffer) { - if (this.noReturn) { - //Set the buffer passed as our own, as we don't need to resample it: - this.outputBuffer = buffer; - return buffer.length; - } else { - //Just return the buffer passsed: - return buffer; - } -}; -Resampler.prototype.bufferSlice = function (sliceAmount) { - if (this.noReturn) { - //If we're going to access the properties directly from this object: - return sliceAmount; - } else { - //Typed array and normal array buffer section referencing: - try { - return this.outputBuffer.subarray(0, sliceAmount); - } catch (error) { - try { - //Regular array pass: - this.outputBuffer.length = sliceAmount; - return this.outputBuffer; - } catch (error) { - //Nightly Firefox 4 used to have the subarray function named as slice: - return this.outputBuffer.slice(0, sliceAmount); - } - } - } -}; -Resampler.prototype.initializeBuffers = function (generateTailCache) { - //Initialize the internal buffer: - try { - this.outputBuffer = new Float32Array(this.outputBufferSize); - this.lastOutput = new Float32Array(this.channels); - } catch (error) { - this.outputBuffer = []; - this.lastOutput = []; - } -}; /*Initialize here first: - Example: - Stereo audio with a sample rate of 70 khz, a minimum buffer of 15000 samples total, a maximum buffer of 25000 samples total and a neutral amplitude value of -1. - var parentObj = this; - this.audioHandle = new XAudioServer(2, 70000, 15000, 25000, function (sampleCount) { - return parentObj.audioUnderRun(sampleCount); - }, -1); - - The callback is passed the number of samples requested, while it can return any number of samples it wants back. - */ -function XAudioServer(channels, sampleRate, minBufferSize, maxBufferSize, underRunCallback, defaultValue) { - this.audioChannels = channels == 2 ? 2 : 1; - webAudioMono = this.audioChannels == 1; - XAudioJSSampleRate = sampleRate > 0 && sampleRate <= 0xFFFFFF ? sampleRate : 44100; - webAudioMinBufferSize = minBufferSize >= samplesPerCallback << 1 && minBufferSize < maxBufferSize ? minBufferSize & (webAudioMono ? 0xFFFFFFFF : 0xFFFFFFFE) : samplesPerCallback << 1; - webAudioMaxBufferSize = Math.floor(maxBufferSize) > webAudioMinBufferSize + this.audioChannels ? maxBufferSize & (webAudioMono ? 0xFFFFFFFF : 0xFFFFFFFE) : minBufferSize << 1; - this.underRunCallback = typeof underRunCallback == "function" ? underRunCallback : function () {}; - defaultNeutralValue = defaultValue >= -1 && defaultValue <= 1 && defaultValue != 0 ? defaultValue : 0; - this.audioType = -1; - this.mozAudioTail = []; - this.audioHandleMoz = null; - this.audioHandleFlash = null; - this.flashInitialized = false; - this.mozAudioFound = false; - this.initializeAudio(); -} -XAudioServer.prototype.MOZWriteAudio = function (buffer) { - //mozAudio: - this.MOZWriteAudioNoCallback(buffer); - this.MOZExecuteCallback(); -}; -XAudioServer.prototype.MOZWriteAudioNoCallback = function (buffer) { - //mozAudio: - this.writeMozAudio(buffer); -}; -XAudioServer.prototype.callbackBasedWriteAudio = function (buffer) { - //Callback-centered audio APIs: - this.callbackBasedWriteAudioNoCallback(buffer); - this.callbackBasedExecuteCallback(); -}; -XAudioServer.prototype.callbackBasedWriteAudioNoCallback = function (buffer) { - //Callback-centered audio APIs: - if (!buffer) { - return; - } - - var length = buffer.length; - for (var bufferCounter = 0; bufferCounter < length && audioBufferSize < webAudioMaxBufferSize;) { - audioContextSampleBuffer[audioBufferSize++] = buffer[bufferCounter++]; - } -}; -/*Pass your samples into here! -Pack your samples as a one-dimenional array -With the channel samplea packed uniformly. -examples: - mono - [left, left, left, left] - stereo - [left, right, left, right, left, right, left, right] -*/ -XAudioServer.prototype.writeAudio = function (buffer) { - if (this.audioType == 0) { - this.MOZWriteAudio(buffer); - } else if (this.audioType == 1) { - this.callbackBasedWriteAudio(buffer); - } else if (this.audioType == 2) { - if (this.checkFlashInit() || launchedContext) { - this.callbackBasedWriteAudio(buffer); - } else if (this.mozAudioFound) { - this.MOZWriteAudio(buffer); - } - } -}; -/*Pass your samples into here if you don't want automatic callback calling: -Pack your samples as a one-dimenional array -With the channel samplea packed uniformly. -examples: - mono - [left, left, left, left] - stereo - [left, right, left, right, left, right, left, right] -Useful in preventing infinite recursion issues with calling writeAudio inside your callback. -*/ -XAudioServer.prototype.writeAudioNoCallback = function (buffer) { - if (this.audioType == 0) { - this.MOZWriteAudioNoCallback(buffer); - } else if (this.audioType == 1) { - this.callbackBasedWriteAudioNoCallback(buffer); - } else if (this.audioType == 2) { - if (this.checkFlashInit() || launchedContext) { - this.callbackBasedWriteAudioNoCallback(buffer); - } else if (this.mozAudioFound) { - this.MOZWriteAudioNoCallback(buffer); - } - } -}; -//Developer can use this to see how many samples to write (example: minimum buffer allotment minus remaining samples left returned from this function to make sure maximum buffering is done...) -//If -1 is returned, then that means metric could not be done. -XAudioServer.prototype.remainingBuffer = function () { - if (this.audioType == 0) { - //mozAudio: - return this.samplesAlreadyWritten - this.audioHandleMoz.mozCurrentSampleOffset(); - } else if (this.audioType == 1) { - //WebKit Audio: - return (resampledSamplesLeft() * resampleControl.ratioWeight >> this.audioChannels - 1 << this.audioChannels - 1) + audioBufferSize; - } else if (this.audioType == 2) { - if (this.checkFlashInit() || launchedContext) { - //Webkit Audio / Flash Plugin Audio: - return (resampledSamplesLeft() * resampleControl.ratioWeight >> this.audioChannels - 1 << this.audioChannels - 1) + audioBufferSize; - } else if (this.mozAudioFound) { - //mozAudio: - return this.samplesAlreadyWritten - this.audioHandleMoz.mozCurrentSampleOffset(); - } - } - //Default return: - return 0; -}; -XAudioServer.prototype.MOZExecuteCallback = function () { - //mozAudio: - var samplesRequested = webAudioMinBufferSize - this.remainingBuffer(); - if (samplesRequested > 0) { - this.writeMozAudio(this.underRunCallback(samplesRequested)); - } -}; -XAudioServer.prototype.callbackBasedExecuteCallback = function () { - //WebKit /Flash Audio: - var samplesRequested = webAudioMinBufferSize - this.remainingBuffer(); - if (samplesRequested > 0) { - this.callbackBasedWriteAudioNoCallback(this.underRunCallback(samplesRequested)); - } -}; -//If you just want your callback called for any possible refill (Execution of callback is still conditional): -XAudioServer.prototype.executeCallback = function () { - if (this.audioType == 0) { - this.MOZExecuteCallback(); - } else if (this.audioType == 1) { - this.callbackBasedExecuteCallback(); - } else if (this.audioType == 2) { - if (this.checkFlashInit() || launchedContext) { - this.callbackBasedExecuteCallback(); - } else if (this.mozAudioFound) { - this.MOZExecuteCallback(); - } - } -}; -//DO NOT CALL THIS, the lib calls this internally! -XAudioServer.prototype.initializeAudio = function () { - try { - this.preInitializeMozAudio(); - if (navigator.platform == "Linux i686") { - //Block out mozaudio usage for Linux Firefox due to moz bugs: - throw new Error(""); - } - this.initializeMozAudio(); - } catch (error) { - try { - this.initializeWebAudio(); - } catch (error) { - try { - this.initializeFlashAudio(); - } catch (error) { - throw new Error("Browser does not support real time audio output."); - } - } - } -}; -XAudioServer.prototype.preInitializeMozAudio = function () { - //mozAudio - Synchronous Audio API - this.audioHandleMoz = new Audio(); - this.audioHandleMoz.mozSetup(this.audioChannels, XAudioJSSampleRate); - this.samplesAlreadyWritten = 0; - var emptySampleFrame = this.audioChannels == 2 ? [0, 0] : [0]; - var prebufferAmount = 0; - if (navigator.platform != "MacIntel" && navigator.platform != "MacPPC") { - //Mac OS X doesn't experience this moz-bug! - while (this.audioHandleMoz.mozCurrentSampleOffset() == 0) { - //Mozilla Audio Bugginess Workaround (Firefox freaks out if we don't give it a prebuffer under certain OSes): - prebufferAmount += this.audioHandleMoz.mozWriteAudio(emptySampleFrame); - } - var samplesToDoubleBuffer = prebufferAmount / this.audioChannels; - //Double the prebuffering for windows: - for (var index = 0; index < samplesToDoubleBuffer; index++) { - this.samplesAlreadyWritten += this.audioHandleMoz.mozWriteAudio(emptySampleFrame); - } - } - this.samplesAlreadyWritten += prebufferAmount; - webAudioMinBufferSize += this.samplesAlreadyWritten; - this.mozAudioFound = true; -}; -XAudioServer.prototype.initializeMozAudio = function () { - //Fill in our own buffering up to the minimum specified: - this.writeMozAudio(getFloat32(webAudioMinBufferSize)); - this.audioType = 0; -}; -XAudioServer.prototype.initializeWebAudio = function () { - if (launchedContext) { - resetCallbackAPIAudioBuffer(webAudioActualSampleRate, samplesPerCallback); - this.audioType = 1; - } else { - throw new Error(""); - } -}; -XAudioServer.prototype.initializeFlashAudio = function () { - var existingFlashload = document.getElementById("XAudioJS"); - if (existingFlashload == null) { - var thisObj = this; - var mainContainerNode = document.createElement("div"); - mainContainerNode.setAttribute("style", "position: fixed; bottom: 0px; right: 0px; margin: 0px; padding: 0px; border: none; width: 8px; height: 8px; overflow: hidden; z-index: -1000; "); - var containerNode = document.createElement("div"); - containerNode.setAttribute("style", "position: static; border: none; width: 0px; height: 0px; visibility: hidden; margin: 8px; padding: 0px;"); - containerNode.setAttribute("id", "XAudioJS"); - mainContainerNode.appendChild(containerNode); - document.getElementsByTagName("body")[0].appendChild(mainContainerNode); - swfobject.embedSWF("XAudioJS.swf", "XAudioJS", "8", "8", "9.0.0", "", {}, { "allowscriptaccess": "always" }, { "style": "position: static; visibility: hidden; margin: 8px; padding: 0px; border: none" }, function (event) { - if (event.success) { - thisObj.audioHandleFlash = event.ref; - } else { - thisObj.audioType = 1; - } - }); - } else { - this.audioHandleFlash = existingFlashload; - } - this.audioType = 2; -}; -//Moz Audio Buffer Writing Handler: -XAudioServer.prototype.writeMozAudio = function (buffer) { - if (!buffer) { - return; - } - - var length = this.mozAudioTail.length; - if (length > 0) { - var samplesAccepted = this.audioHandleMoz.mozWriteAudio(this.mozAudioTail); - this.samplesAlreadyWritten += samplesAccepted; - this.mozAudioTail.splice(0, samplesAccepted); - } - - length = Math.min(buffer.length, webAudioMaxBufferSize - this.samplesAlreadyWritten + this.audioHandleMoz.mozCurrentSampleOffset()); - var samplesAccepted = this.audioHandleMoz.mozWriteAudio(buffer); - this.samplesAlreadyWritten += samplesAccepted; - for (var index = 0; length > samplesAccepted; --length) { - //Moz Audio wants us saving the tail: - this.mozAudioTail.push(buffer[index++]); - } -}; -//Checks to see if the NPAPI Adobe Flash bridge is ready yet: -XAudioServer.prototype.checkFlashInit = function () { - if (!this.flashInitialized && this.audioHandleFlash && this.audioHandleFlash.initialize) { - this.flashInitialized = true; - this.audioHandleFlash.initialize(this.audioChannels, defaultNeutralValue); - resetCallbackAPIAudioBuffer(44100, samplesPerCallback); - } - return this.flashInitialized; -}; -/////////END LIB -function getFloat32(size) { - try { - var newBuffer = new Float32Array(size); - } catch (error) { - var newBuffer = new Array(size); - } - for (var audioSampleIndice = 0; audioSampleIndice < size; ++audioSampleIndice) { - //Create a gradual neutral position shift here to make sure we don't cause annoying clicking noises - //when the developer set neutral position is not 0. - newBuffer[audioSampleIndice] = defaultNeutralValue * (audioSampleIndice / size); - } - return newBuffer; -} -function getFloat32Flat(size) { - try { - var newBuffer = new Float32Array(size); - } catch (error) { - var newBuffer = new Array(size); - var audioSampleIndice = 0; - do { - newBuffer[audioSampleIndice] = 0; - } while (++audioSampleIndice < size); - } - return newBuffer; -} -//Flash NPAPI Event Handler: -var samplesPerCallback = 2048; //Has to be between 2048 and 4096 (If over, then samples are ignored, if under then silence is added). -var outputConvert = null; -function audioOutputFlashEvent() { - //The callback that flash calls... - resampleRefill(); - return outputConvert(); -} -function generateFlashStereoString() { - //Convert the arrays to one long string for speed. - var copyBinaryStringLeft = ""; - var copyBinaryStringRight = ""; - for (var index = 0; index < samplesPerCallback && resampleBufferStart != resampleBufferEnd; ++index) { - //Sanitize the buffer: - copyBinaryStringLeft += String.fromCharCode((Math.min(Math.max(resampled[resampleBufferStart++] + 1, 0), 2) * 0x3FFF | 0) + 0x3000); - copyBinaryStringRight += String.fromCharCode((Math.min(Math.max(resampled[resampleBufferStart++] + 1, 0), 2) * 0x3FFF | 0) + 0x3000); - if (resampleBufferStart == resampleBufferSize) { - resampleBufferStart = 0; - } - } - return copyBinaryStringLeft + copyBinaryStringRight; -} -function generateFlashMonoString() { - //Convert the array to one long string for speed. - var copyBinaryString = ""; - for (var index = 0; index < samplesPerCallback && resampleBufferStart != resampleBufferEnd; ++index) { - //Sanitize the buffer: - copyBinaryString += String.fromCharCode((Math.min(Math.max(resampled[resampleBufferStart++] + 1, 0), 2) * 0x3FFF | 0) + 0x3000); - if (resampleBufferStart == resampleBufferSize) { - resampleBufferStart = 0; - } - } - return copyBinaryString; -} -//Audio API Event Handler: -var audioContextHandle = null; -var audioNode = null; -var audioSource = null; -var launchedContext = false; -var audioContextSampleBuffer = []; -var resampled = []; -var webAudioMinBufferSize = 15000; -var webAudioMaxBufferSize = 25000; -var webAudioActualSampleRate = 44100; -var XAudioJSSampleRate = 0; -var webAudioMono = false; -var defaultNeutralValue = 0; -var resampleControl = null; -var audioBufferSize = 0; -var resampleBufferStart = 0; -var resampleBufferEnd = 0; -var resampleBufferSize = 2; -function audioOutputEvent(event) { - //Web Audio API callback... - var index = 0; - var buffer1 = event.outputBuffer.getChannelData(0); - var buffer2 = event.outputBuffer.getChannelData(1); - resampleRefill(); - if (!webAudioMono) { - //STEREO: - while (index < samplesPerCallback && resampleBufferStart != resampleBufferEnd) { - buffer1[index] = resampled[resampleBufferStart++]; - buffer2[index++] = resampled[resampleBufferStart++]; - if (resampleBufferStart == resampleBufferSize) { - resampleBufferStart = 0; - } - } - } else { - //MONO: - while (index < samplesPerCallback && resampleBufferStart != resampleBufferEnd) { - buffer2[index] = buffer1[index] = resampled[resampleBufferStart++]; - ++index; - if (resampleBufferStart == resampleBufferSize) { - resampleBufferStart = 0; - } - } - } - //Pad with silence if we're underrunning: - while (index < samplesPerCallback) { - buffer2[index] = buffer1[index] = defaultNeutralValue; - ++index; - } -} -function resampleRefill() { - if (audioBufferSize > 0) { - //Resample a chunk of audio: - var resampleLength = resampleControl.resampler(getBufferSamples()); - var resampledResult = resampleControl.outputBuffer; - for (var index2 = 0; index2 < resampleLength; ++index2) { - resampled[resampleBufferEnd++] = resampledResult[index2]; - if (resampleBufferEnd == resampleBufferSize) { - resampleBufferEnd = 0; - } - if (resampleBufferStart == resampleBufferEnd) { - ++resampleBufferStart; - if (resampleBufferStart == resampleBufferSize) { - resampleBufferStart = 0; - } - } - } - audioBufferSize = 0; - } -} -function resampledSamplesLeft() { - return (resampleBufferStart <= resampleBufferEnd ? 0 : resampleBufferSize) + resampleBufferEnd - resampleBufferStart; -} -function getBufferSamples() { - //Typed array and normal array buffer section referencing: - try { - return audioContextSampleBuffer.subarray(0, audioBufferSize); - } catch (error) { - try { - //Regular array pass: - audioContextSampleBuffer.length = audioBufferSize; - return audioContextSampleBuffer; - } catch (error) { - //Nightly Firefox 4 used to have the subarray function named as slice: - return audioContextSampleBuffer.slice(0, audioBufferSize); - } - } -} -//Initialize WebKit Audio /Flash Audio Buffer: -function resetCallbackAPIAudioBuffer(APISampleRate, bufferAlloc) { - audioContextSampleBuffer = getFloat32(webAudioMaxBufferSize); - audioBufferSize = webAudioMaxBufferSize; - resampleBufferStart = 0; - resampleBufferEnd = 0; - resampleBufferSize = Math.max(webAudioMaxBufferSize * Math.ceil(XAudioJSSampleRate / APISampleRate), samplesPerCallback) << 1; - if (webAudioMono) { - //MONO Handling: - resampled = getFloat32Flat(resampleBufferSize); - resampleControl = new Resampler(XAudioJSSampleRate, APISampleRate, 1, resampleBufferSize, true); - outputConvert = generateFlashMonoString; - } else { - //STEREO Handling: - resampleBufferSize <<= 1; - resampled = getFloat32Flat(resampleBufferSize); - resampleControl = new Resampler(XAudioJSSampleRate, APISampleRate, 2, resampleBufferSize, true); - outputConvert = generateFlashStereoString; - } -} -//Initialize WebKit Audio: -(function () { - if (!launchedContext) { - try { - audioContextHandle = new AudioContext(); //Create a system audio context. - } catch (error) { - try { - audioContextHandle = new webkitAudioContext(); //Create a system audio context. - } catch (error) { - return; - } - } - try { - audioSource = audioContextHandle.createBufferSource(); //We need to create a false input to get the chain started. - audioSource.loop = false; //Keep this alive forever (Event handler will know when to ouput.) - XAudioJSSampleRate = webAudioActualSampleRate = audioContextHandle.sampleRate; - audioSource.buffer = audioContextHandle.createBuffer(1, 1, webAudioActualSampleRate); //Create a zero'd input buffer for the input to be valid. - audioNode = audioContextHandle.createJavaScriptNode(samplesPerCallback, 1, 2); //Create 2 outputs and ignore the input buffer (Just copy buffer 1 over if mono) - audioNode.onaudioprocess = audioOutputEvent; //Connect the audio processing event to a handling function so we can manipulate output - audioSource.connect(audioNode); //Send and chain the input to the audio manipulation. - audioNode.connect(audioContextHandle.destination); //Send and chain the output of the audio manipulation to the system audio output. - audioSource.noteOn(0); //Start the loop! - } catch (error) { - return; - } - launchedContext = true; - } -})(); - -/*** EXPORTS FROM exports-loader ***/ -exports["Resampler"] = (Resampler); - -/***/ }), -/* 26 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - - -var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); - -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - -function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } - -function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } - -var config = __webpack_require__(1); -var StateEventDispatcher = __webpack_require__(4); -var utils = __webpack_require__(0); - -var state = { - READY: "ready", - RECORDING: "recording" -}; - -var error_messages = { - WEB_AUDIO_API: "Web Audio API is not supported by your browser.", - WEB_AUDIO_RECORDING: "HTML5 audio recording is not supported by your browser.", - PERMISSION_DENIED: "Permission to access microphone denied." -}; - -var AudioRecorder = function (_StateEventDispatcher) { - _inherits(AudioRecorder, _StateEventDispatcher); - - function AudioRecorder(opts) { - _classCallCheck(this, AudioRecorder); - - var _this = _possibleConstructorReturn(this, (AudioRecorder.__proto__ || Object.getPrototypeOf(AudioRecorder)).call(this, state.READY)); - - try { - try { - _this.audioCtx = config.audioCtx || new AudioContext(); - } catch (e) { - _this.audioCtx = config.audioCtx || new webkitAudioContext(); - } - config.audioCtx = _this.audioCtx; - } catch (e) { - utils.log(e); - return _possibleConstructorReturn(_this); - } - - _this.source = null; // media stream source - _this.stream = null; // media stream - _this.bufferSize = opts && opts["bufferSize"] || 4096; - _this.sampleRate = _this.audioCtx.sampleRate; - - _this.constraints = opts && opts.constraints || { - audio: { - channelCount: 1 - }, - video: false - }; - - //audio processing - _this.scriptNode = _this.audioCtx.createScriptProcessor(_this.bufferSize, 1, 1); - _this.scriptNode.onaudioprocess = function (e) { - var buffer = e.inputBuffer.getChannelData(0); - _this.fire("data", buffer.slice()); - }; - return _this; - } - - _createClass(AudioRecorder, [{ - key: "start", - value: function start() { - var _this2 = this; - - setTimeout(function () { - if (!_this2.isState(state.READY)) return; - - if (!_this2.audioCtx) { - _this2.fire("error", error_messages.WEB_AUDIO_API); - utils.log("audio_recorder: web audio api not supported"); - return; - } - - // Fixed for Chrome on 20190222 by Haochuan: - // If an AudioContext is created prior to the document receiving a user gesture, - // it will be created in the "suspended" state, - // and you will need to call resume() after a user gesture is received. - if (_this2.audioCtx.state === "suspended") { - _this2.audioCtx.resume(); - } - - var onSuccess = function onSuccess(ms) { - utils.log("audio_recorder: acquired access to html5 audio recording"); - - //create media source and connect to scriptNode (start processing) - _this2.stream = ms; - _this2.source = _this2.audioCtx.createMediaStreamSource(_this2.stream); - _this2.source.connect(_this2.scriptNode); - _this2.scriptNode.connect(_this2.audioCtx.destination); - - _this2.setStateSilent(state.RECORDING); - utils.log("audio_recorder: recording audio"); - - _this2.fire("start"); - }; - - var onError = function onError(e) { - _this2.fire("error", error_messages.PERMISSION_DENIED); - utils.log("audio_recorder: error " + e.name); - return; - }; - - if (_this2.stream) { - onSuccess(_this2.stream); - return; - } - - var constraints = _this2.constraints; - - // initializing stream, getting access to user media - if (navigator.mediaDevices && navigator.mediaDevices.getUserMedia) { - navigator.mediaDevices.getUserMedia(constraints).then(onSuccess).catch(onError); - } else { - navigator.getUserMedia = navigator.getUserMedia || navigator.webkitGetUserMedia || navigator.mozGetUserMedia; - - if (!navigator.getUserMedia) { - // Not supported in Safari - _this2.fire("error", error_messages.WEB_AUDIO_RECORDING); - utils.log("audio_recorder: html5 audio recording not supported"); - return; - } - - navigator.getUserMedia(constraints, onSuccess, onError); - } - }, 0); - } - }, { - key: "stop", - value: function stop(keepStream) { - if (!this.isState(state.RECORDING)) return; - - if (!keepStream) { - //stop media stream - var msTrack = this.stream.getTracks()[0]; - msTrack.stop(); - this.stream = null; - } - - if (this.source) { - //stop media stream source and disconnect scriptNode (stop processing) - this.source.disconnect(this.scriptNode); - this.scriptNode.disconnect(this.audioCtx.destination); - this.source = null; - } - - this.setStateSilent(state.READY); - utils.log("audio_recorder: stopped"); - - this.fire("end"); - } - }, { - key: "pause", - value: function pause() { - this.stop(true); - } - }, { - key: "isRecording", - value: function isRecording() { - return this.isState(state.RECORDING); - } - }]); - - return AudioRecorder; -}(StateEventDispatcher); - -module.exports = AudioRecorder; - -/***/ }) -/******/ ]); -}); -}).call(this,require('_process'),typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {},require("buffer").Buffer) -},{"_process":197,"buffer":89,"create-hmac":96,"fs":82,"https-proxy-agent":151,"json-bigint":159,"node-fetch":167,"pako":169,"path":190,"url":260,"uuid":265,"ws":275}],148:[function(require,module,exports){ -(function (Buffer){ -const Houndify = require("../index"); -const { Writer } = require("wav"); - -let clientId; -let clientKey; - -/** - * We use this function to provide the router to the host app, while also initialzing the clientId and clientKey. - * @param {string} _clientId The user's houndify client ID - * @param {string} _clientKey The user's houndify client Key. - * - * @return {Router} Express Router - */ -const createReactNativeProxy = (express, _clientId, _clientKey) => { - clientId = _clientId; - clientKey = _clientKey; - const router = express.Router(); - initRoutes(router); - return router; -}; - -const initRoutes = (router) => { - /** - * Route all websocket request, which are for audio, to this handler. - * */ - - router.ws("/", (ws, res) => { - let conversationState = {}; - let requestInfo = undefined; - - // We want to track when the websocket closes so we don't try to send requests. - let closed = false; - const safeSend = message => { - if (!closed) { - ws.send(message); - } - }; - - /** - * Eventually voice request will be the houndify request object. - * We'll use it to pipe chunks to the server. - * We predeclare it because it can't be sent until we get config information from the client. - * But the WAV writer starts writing a header before we get audio data. - * So we buffer the header and push it as soon as we configure. - */ - let wavBuffer = undefined; - let voiceRequest = { - write: data => { - wavBuffer = data; - } - }; - - /** - * Send a houndify voice request with the streamed voice data. - * We put this in a function because we're waiting for the client to - * send over CONFIG information. When that's recieved, this will be called. - */ - - const sendRequest = () => { - if (requestInfo === undefined) { - safeSend(errorObject("requestInfo has not been configured.")); - safeSend(doneCommandObject()); - } - - voiceRequest = new Houndify.VoiceRequest({ - clientId, - clientKey, - sampleRate: 16000, - convertAudioToSpeex: false, - - /** - * Allows the client to send custom requestInfo and conversationState. - */ - requestInfo, - conversationState, - - // Forward these events straight to the client. - onTranscriptionUpdate: transcript => - safeSend(transcriptionObject(transcript)), - onResponse: (response, info) => safeSend(responseObject(response)), - onError: (error, info) => { - safeSend(errorObject(error)); - console.dir(error); - } - }); - - // Push any wav data that was buffered before sending request. - outputWriteStream.push(wavBuffer); - }; - - /** - * This writes the incoming PCM data to WAV. - */ - const outputWriteStream = new Writer({ channels: 1, sampleRate: 16000 }); - /** - * Take each chunk of converted WAV data and send it to houndify. - */ - outputWriteStream.on("data", data => voiceRequest.write(data)); - - /** - * Handle socket events. - */ - ws.on("message", msg => handleMessage(msg)); - ws.on("close", () => { - voiceRequest.end(); - closed = true; - }); - - /** - * Handles incoming messages from the client. - * The can be data chunks or commands, both packed using JSON. - * @param {string} msg This is a stringified object with 'type' and 'data' properties. - */ - const handleMessage = msg => { - const message = JSON.parse(msg); - switch (message.type) { - case "DATA": - /** - * Push a new chunk of base64 PCM data to the writer for WAV conversion. - */ - const outputBuffer = Buffer.from(message.data, "base64"); - /** - * We also calculate the volume on server, cause it may be useful. - * We do this by converting the chunk to a float array and calculating an RMS across the chunk. - */ - const volume = calculateRMSFromPCMBuffer(outputBuffer); - /** - * Send volume and push PCM - */ - safeSend(volumeObject(volume)); - outputWriteStream.push(Buffer.from(message.data, "base64")); - break; - case "COMMAND": - if (message.data === "DONE") { - voiceRequest.end(); - } - break; - case "CONFIG": - /** - * If it was sent, set needed CONFIG info and start a Houndify Request. - */ - requestInfo = message.data.requestInfo || requestInfo; - conversationState = - message.data.conversationState || conversationState; - sendRequest(); - } - }; - }); -}; - -/** - * A set of functions to help create socket responses. - */ - -/** - * Create a response with the to-date transcription from houndify. - * @param {{PartialTranscript}} transcript - * @returns {string} - */ -const transcriptionObject = transcript => - JSON.stringify({ - type: "TRANSCRIPTION", - data: transcript.PartialTranscript - }); - -/** - * The response object from houndify. - * @param {*} response - * @returns {string} - */ -const responseObject = response => - JSON.stringify({ type: "RESPONSE", data: response }); - -/** - * Create a response instructing the client to stop recording and close the socket. - * @returns {string} - */ -const doneCommandObject = () => - JSON.stringify({ type: "COMMAND", data: "DONE" }); - -/** - * Create a response with a new chunk for the client. - * @param {float} volume - */ -const volumeObject = volume => JSON.stringify({ type: "VOLUME", data: volume }); -/** - * Send houndify error message to client. - * @param {*} error - */ -const errorObject = error => JSON.stringify({ type: "ERROR", data: error }); - -/** - * Other Utilities - */ - -/** - * This lets us get the average volume for a chunk of audio. - * @param {Int16Buffer} buffer - */ -const calculateRMSFromPCMBuffer = buffer => { - const len = buffer.length; - let rms = 0; - for (let i = 0; i < len; i++) { - rms += ((buffer[i] - 128) / 128.0) ^ 2; - } - rms /= len; - rms = Math.sqrt(rms); - return rms; -}; - -module.exports = createReactNativeProxy; - -}).call(this,require("buffer").Buffer) -},{"../index":149,"buffer":89,"wav":271}],149:[function(require,module,exports){ - -module.exports = require("./dist/houndify-node"); - -module.exports["HoundifyExpress"] = require("./dist/houndify-express"); -},{"./dist/houndify-express":146,"./dist/houndify-node":147}],150:[function(require,module,exports){ -var http = require('http') -var url = require('url') - -var https = module.exports - -for (var key in http) { - if (http.hasOwnProperty(key)) https[key] = http[key] -} - -https.request = function (params, cb) { - params = validateParams(params) - return http.request.call(this, params, cb) -} - -https.get = function (params, cb) { - params = validateParams(params) - return http.get.call(this, params, cb) -} - -function validateParams (params) { - if (typeof params === 'string') { - params = url.parse(params) - } - if (!params.protocol) { - params.protocol = 'https:' - } - if (params.protocol !== 'https:') { - throw new Error('Protocol "' + params.protocol + '" not supported. Expected "https:"') - } - return params -} - -},{"http":241,"url":260}],151:[function(require,module,exports){ -(function (Buffer){ -/** - * Module dependencies. - */ - -var net = require('net'); -var tls = require('tls'); -var url = require('url'); -var assert = require('assert'); -var Agent = require('agent-base'); -var inherits = require('util').inherits; -var debug = require('debug')('https-proxy-agent'); - -/** - * Module exports. - */ - -module.exports = HttpsProxyAgent; - -/** - * The `HttpsProxyAgent` implements an HTTP Agent subclass that connects to the - * specified "HTTP(s) proxy server" in order to proxy HTTPS requests. - * - * @api public - */ - -function HttpsProxyAgent(opts) { - if (!(this instanceof HttpsProxyAgent)) return new HttpsProxyAgent(opts); - if ('string' == typeof opts) opts = url.parse(opts); - if (!opts) - throw new Error( - 'an HTTP(S) proxy server `host` and `port` must be specified!' - ); - debug('creating new HttpsProxyAgent instance: %o', opts); - Agent.call(this, opts); - - var proxy = Object.assign({}, opts); - - // if `true`, then connect to the proxy server over TLS. defaults to `false`. - this.secureProxy = proxy.protocol - ? /^https:?$/i.test(proxy.protocol) - : false; - - // prefer `hostname` over `host`, and set the `port` if needed - proxy.host = proxy.hostname || proxy.host; - proxy.port = +proxy.port || (this.secureProxy ? 443 : 80); - - // ALPN is supported by Node.js >= v5. - // attempt to negotiate http/1.1 for proxy servers that support http/2 - if (this.secureProxy && !('ALPNProtocols' in proxy)) { - proxy.ALPNProtocols = ['http 1.1']; - } - - if (proxy.host && proxy.path) { - // if both a `host` and `path` are specified then it's most likely the - // result of a `url.parse()` call... we need to remove the `path` portion so - // that `net.connect()` doesn't attempt to open that as a unix socket file. - delete proxy.path; - delete proxy.pathname; - } - - this.proxy = proxy; - this.defaultPort = 443; -} -inherits(HttpsProxyAgent, Agent); - -/** - * Called when the node-core HTTP client library is creating a new HTTP request. - * - * @api public - */ - -HttpsProxyAgent.prototype.callback = function connect(req, opts, fn) { - var proxy = this.proxy; - - // create a socket connection to the proxy server - var socket; - if (this.secureProxy) { - socket = tls.connect(proxy); - } else { - socket = net.connect(proxy); - } - - // we need to buffer any HTTP traffic that happens with the proxy before we get - // the CONNECT response, so that if the response is anything other than an "200" - // response code, then we can re-play the "data" events on the socket once the - // HTTP parser is hooked up... - var buffers = []; - var buffersLength = 0; - - function read() { - var b = socket.read(); - if (b) ondata(b); - else socket.once('readable', read); - } - - function cleanup() { - socket.removeListener('end', onend); - socket.removeListener('error', onerror); - socket.removeListener('close', onclose); - socket.removeListener('readable', read); - } - - function onclose(err) { - debug('onclose had error %o', err); - } - - function onend() { - debug('onend'); - } - - function onerror(err) { - cleanup(); - fn(err); - } - - function ondata(b) { - buffers.push(b); - buffersLength += b.length; - var buffered = Buffer.concat(buffers, buffersLength); - var str = buffered.toString('ascii'); - - if (!~str.indexOf('\r\n\r\n')) { - // keep buffering - debug('have not received end of HTTP headers yet...'); - read(); - return; - } - - var firstLine = str.substring(0, str.indexOf('\r\n')); - var statusCode = +firstLine.split(' ')[1]; - debug('got proxy server response: %o', firstLine); - - if (200 == statusCode) { - // 200 Connected status code! - var sock = socket; - - // nullify the buffered data since we won't be needing it - buffers = buffered = null; - - if (opts.secureEndpoint) { - // since the proxy is connecting to an SSL server, we have - // to upgrade this socket connection to an SSL connection - debug( - 'upgrading proxy-connected socket to TLS connection: %o', - opts.host - ); - opts.socket = socket; - opts.servername = opts.servername || opts.host; - opts.host = null; - opts.hostname = null; - opts.port = null; - sock = tls.connect(opts); - } - - cleanup(); - req.once('socket', resume); - fn(null, sock); - } else { - // some other status code that's not 200... need to re-play the HTTP header - // "data" events onto the socket once the HTTP machinery is attached so - // that the node core `http` can parse and handle the error status code - cleanup(); - - // the original socket is closed, and a new closed socket is - // returned instead, so that the proxy doesn't get the HTTP request - // written to it (which may contain `Authorization` headers or other - // sensitive data). - // - // See: https://hackerone.com/reports/541502 - socket.destroy(); - socket = new net.Socket(); - socket.readable = true; - - - // save a reference to the concat'd Buffer for the `onsocket` callback - buffers = buffered; - - // need to wait for the "socket" event to re-play the "data" events - req.once('socket', onsocket); - - fn(null, socket); - } - } - - function onsocket(socket) { - debug('replaying proxy buffer for failed request'); - assert(socket.listenerCount('data') > 0); - - // replay the "buffers" Buffer onto the `socket`, since at this point - // the HTTP module machinery has been hooked up for the user - socket.push(buffers); - - // nullify the cached Buffer instance - buffers = null; - } - - socket.on('error', onerror); - socket.on('close', onclose); - socket.on('end', onend); - - read(); - - var hostname = opts.host + ':' + opts.port; - var msg = 'CONNECT ' + hostname + ' HTTP/1.1\r\n'; - - var headers = Object.assign({}, proxy.headers); - if (proxy.auth) { - headers['Proxy-Authorization'] = - 'Basic ' + Buffer.from(proxy.auth).toString('base64'); - } - - // the Host header should only include the port - // number when it is a non-standard port - var host = opts.host; - if (!isDefaultPort(opts.port, opts.secureEndpoint)) { - host += ':' + opts.port; - } - headers['Host'] = host; - - headers['Connection'] = 'close'; - Object.keys(headers).forEach(function(name) { - msg += name + ': ' + headers[name] + '\r\n'; - }); - - socket.write(msg + '\r\n'); -}; - -/** - * Resumes a socket. - * - * @param {(net.Socket|tls.Socket)} socket The socket to resume - * @api public - */ - -function resume(socket) { - socket.resume(); -} - -function isDefaultPort(port, secure) { - return Boolean((!secure && port === 80) || (secure && port === 443)); -} - -}).call(this,require("buffer").Buffer) -},{"agent-base":1,"assert":17,"buffer":89,"debug":152,"net":82,"tls":82,"url":260,"util":264}],152:[function(require,module,exports){ -(function (process){ -"use strict"; - -function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } - -/* eslint-env browser */ - -/** - * This is the web browser implementation of `debug()`. - */ -exports.log = log; -exports.formatArgs = formatArgs; -exports.save = save; -exports.load = load; -exports.useColors = useColors; -exports.storage = localstorage(); -/** - * Colors. - */ - -exports.colors = ['#0000CC', '#0000FF', '#0033CC', '#0033FF', '#0066CC', '#0066FF', '#0099CC', '#0099FF', '#00CC00', '#00CC33', '#00CC66', '#00CC99', '#00CCCC', '#00CCFF', '#3300CC', '#3300FF', '#3333CC', '#3333FF', '#3366CC', '#3366FF', '#3399CC', '#3399FF', '#33CC00', '#33CC33', '#33CC66', '#33CC99', '#33CCCC', '#33CCFF', '#6600CC', '#6600FF', '#6633CC', '#6633FF', '#66CC00', '#66CC33', '#9900CC', '#9900FF', '#9933CC', '#9933FF', '#99CC00', '#99CC33', '#CC0000', '#CC0033', '#CC0066', '#CC0099', '#CC00CC', '#CC00FF', '#CC3300', '#CC3333', '#CC3366', '#CC3399', '#CC33CC', '#CC33FF', '#CC6600', '#CC6633', '#CC9900', '#CC9933', '#CCCC00', '#CCCC33', '#FF0000', '#FF0033', '#FF0066', '#FF0099', '#FF00CC', '#FF00FF', '#FF3300', '#FF3333', '#FF3366', '#FF3399', '#FF33CC', '#FF33FF', '#FF6600', '#FF6633', '#FF9900', '#FF9933', '#FFCC00', '#FFCC33']; -/** - * Currently only WebKit-based Web Inspectors, Firefox >= v31, - * and the Firebug extension (any Firefox version) are known - * to support "%c" CSS customizations. - * - * TODO: add a `localStorage` variable to explicitly enable/disable colors - */ -// eslint-disable-next-line complexity - -function useColors() { - // NB: In an Electron preload script, document will be defined but not fully - // initialized. Since we know we're in Chrome, we'll just detect this case - // explicitly - if (typeof window !== 'undefined' && window.process && (window.process.type === 'renderer' || window.process.__nwjs)) { - return true; - } // Internet Explorer and Edge do not support colors. - - - if (typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/)) { - return false; - } // Is webkit? http://stackoverflow.com/a/16459606/376773 - // document is undefined in react-native: https://github.com/facebook/react-native/pull/1632 - - - return typeof document !== 'undefined' && document.documentElement && document.documentElement.style && document.documentElement.style.WebkitAppearance || // Is firebug? http://stackoverflow.com/a/398120/376773 - typeof window !== 'undefined' && window.console && (window.console.firebug || window.console.exception && window.console.table) || // Is firefox >= v31? - // https://developer.mozilla.org/en-US/docs/Tools/Web_Console#Styling_messages - typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/) && parseInt(RegExp.$1, 10) >= 31 || // Double check webkit in userAgent just in case we are in a worker - typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/); -} -/** - * Colorize log arguments if enabled. - * - * @api public - */ - - -function formatArgs(args) { - args[0] = (this.useColors ? '%c' : '') + this.namespace + (this.useColors ? ' %c' : ' ') + args[0] + (this.useColors ? '%c ' : ' ') + '+' + module.exports.humanize(this.diff); - - if (!this.useColors) { - return; - } - - var c = 'color: ' + this.color; - args.splice(1, 0, c, 'color: inherit'); // The final "%c" is somewhat tricky, because there could be other - // arguments passed either before or after the %c, so we need to - // figure out the correct index to insert the CSS into - - var index = 0; - var lastC = 0; - args[0].replace(/%[a-zA-Z%]/g, function (match) { - if (match === '%%') { - return; - } - - index++; - - if (match === '%c') { - // We only are interested in the *last* %c - // (the user may have provided their own) - lastC = index; - } - }); - args.splice(lastC, 0, c); -} -/** - * Invokes `console.log()` when available. - * No-op when `console.log` is not a "function". - * - * @api public - */ - - -function log() { - var _console; - - // This hackery is required for IE8/9, where - // the `console.log` function doesn't have 'apply' - return (typeof console === "undefined" ? "undefined" : _typeof(console)) === 'object' && console.log && (_console = console).log.apply(_console, arguments); -} -/** - * Save `namespaces`. - * - * @param {String} namespaces - * @api private - */ - - -function save(namespaces) { - try { - if (namespaces) { - exports.storage.setItem('debug', namespaces); - } else { - exports.storage.removeItem('debug'); - } - } catch (error) {// Swallow - // XXX (@Qix-) should we be logging these? - } -} -/** - * Load `namespaces`. - * - * @return {String} returns the previously persisted debug modes - * @api private - */ - - -function load() { - var r; - - try { - r = exports.storage.getItem('debug'); - } catch (error) {} // Swallow - // XXX (@Qix-) should we be logging these? - // If debug isn't set in LS, and we're in Electron, try to load $DEBUG - - - if (!r && typeof process !== 'undefined' && 'env' in process) { - r = process.env.DEBUG; - } - - return r; -} -/** - * Localstorage attempts to return the localstorage. - * - * This is necessary because safari throws - * when a user disables cookies/localstorage - * and you attempt to access it. - * - * @return {LocalStorage} - * @api private - */ - - -function localstorage() { - try { - // TVMLKit (Apple TV JS Runtime) does not have a window object, just localStorage in the global context - // The Browser also has localStorage in the global context. - return localStorage; - } catch (error) {// Swallow - // XXX (@Qix-) should we be logging these? - } -} - -module.exports = require('./common')(exports); -var formatters = module.exports.formatters; -/** - * Map %j to `JSON.stringify()`, since no Web Inspectors do that by default. - */ - -formatters.j = function (v) { - try { - return JSON.stringify(v); - } catch (error) { - return '[UnexpectedJSONParseError]: ' + error.message; - } -}; - - -}).call(this,require('_process')) -},{"./common":153,"_process":197}],153:[function(require,module,exports){ -"use strict"; - -/** - * This is the common logic for both the Node.js and web browser - * implementations of `debug()`. - */ -function setup(env) { - createDebug.debug = createDebug; - createDebug.default = createDebug; - createDebug.coerce = coerce; - createDebug.disable = disable; - createDebug.enable = enable; - createDebug.enabled = enabled; - createDebug.humanize = require('ms'); - Object.keys(env).forEach(function (key) { - createDebug[key] = env[key]; - }); - /** - * Active `debug` instances. - */ - - createDebug.instances = []; - /** - * The currently active debug mode names, and names to skip. - */ - - createDebug.names = []; - createDebug.skips = []; - /** - * Map of special "%n" handling functions, for the debug "format" argument. - * - * Valid key names are a single, lower or upper-case letter, i.e. "n" and "N". - */ - - createDebug.formatters = {}; - /** - * Selects a color for a debug namespace - * @param {String} namespace The namespace string for the for the debug instance to be colored - * @return {Number|String} An ANSI color code for the given namespace - * @api private - */ - - function selectColor(namespace) { - var hash = 0; - - for (var i = 0; i < namespace.length; i++) { - hash = (hash << 5) - hash + namespace.charCodeAt(i); - hash |= 0; // Convert to 32bit integer - } - - return createDebug.colors[Math.abs(hash) % createDebug.colors.length]; - } - - createDebug.selectColor = selectColor; - /** - * Create a debugger with the given `namespace`. - * - * @param {String} namespace - * @return {Function} - * @api public - */ - - function createDebug(namespace) { - var prevTime; - - function debug() { - // Disabled? - if (!debug.enabled) { - return; - } - - for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { - args[_key] = arguments[_key]; - } - - var self = debug; // Set `diff` timestamp - - var curr = Number(new Date()); - var ms = curr - (prevTime || curr); - self.diff = ms; - self.prev = prevTime; - self.curr = curr; - prevTime = curr; - args[0] = createDebug.coerce(args[0]); - - if (typeof args[0] !== 'string') { - // Anything else let's inspect with %O - args.unshift('%O'); - } // Apply any `formatters` transformations - - - var index = 0; - args[0] = args[0].replace(/%([a-zA-Z%])/g, function (match, format) { - // If we encounter an escaped % then don't increase the array index - if (match === '%%') { - return match; - } - - index++; - var formatter = createDebug.formatters[format]; - - if (typeof formatter === 'function') { - var val = args[index]; - match = formatter.call(self, val); // Now we need to remove `args[index]` since it's inlined in the `format` - - args.splice(index, 1); - index--; - } - - return match; - }); // Apply env-specific formatting (colors, etc.) - - createDebug.formatArgs.call(self, args); - var logFn = self.log || createDebug.log; - logFn.apply(self, args); - } - - debug.namespace = namespace; - debug.enabled = createDebug.enabled(namespace); - debug.useColors = createDebug.useColors(); - debug.color = selectColor(namespace); - debug.destroy = destroy; - debug.extend = extend; // Debug.formatArgs = formatArgs; - // debug.rawLog = rawLog; - // env-specific initialization logic for debug instances - - if (typeof createDebug.init === 'function') { - createDebug.init(debug); - } - - createDebug.instances.push(debug); - return debug; - } - - function destroy() { - var index = createDebug.instances.indexOf(this); - - if (index !== -1) { - createDebug.instances.splice(index, 1); - return true; - } - - return false; - } - - function extend(namespace, delimiter) { - return createDebug(this.namespace + (typeof delimiter === 'undefined' ? ':' : delimiter) + namespace); - } - /** - * Enables a debug mode by namespaces. This can include modes - * separated by a colon and wildcards. - * - * @param {String} namespaces - * @api public - */ - - - function enable(namespaces) { - createDebug.save(namespaces); - createDebug.names = []; - createDebug.skips = []; - var i; - var split = (typeof namespaces === 'string' ? namespaces : '').split(/[\s,]+/); - var len = split.length; - - for (i = 0; i < len; i++) { - if (!split[i]) { - // ignore empty strings - continue; - } - - namespaces = split[i].replace(/\*/g, '.*?'); - - if (namespaces[0] === '-') { - createDebug.skips.push(new RegExp('^' + namespaces.substr(1) + '$')); - } else { - createDebug.names.push(new RegExp('^' + namespaces + '$')); - } - } - - for (i = 0; i < createDebug.instances.length; i++) { - var instance = createDebug.instances[i]; - instance.enabled = createDebug.enabled(instance.namespace); - } - } - /** - * Disable debug output. - * - * @api public - */ - - - function disable() { - createDebug.enable(''); - } - /** - * Returns true if the given mode name is enabled, false otherwise. - * - * @param {String} name - * @return {Boolean} - * @api public - */ - - - function enabled(name) { - if (name[name.length - 1] === '*') { - return true; - } - - var i; - var len; - - for (i = 0, len = createDebug.skips.length; i < len; i++) { - if (createDebug.skips[i].test(name)) { - return false; - } - } - - for (i = 0, len = createDebug.names.length; i < len; i++) { - if (createDebug.names[i].test(name)) { - return true; - } - } - - return false; - } - /** - * Coerce `val`. - * - * @param {Mixed} val - * @return {Mixed} - * @api private - */ - - - function coerce(val) { - if (val instanceof Error) { - return val.stack || val.message; - } - - return val; - } - - createDebug.enable(createDebug.load()); - return createDebug; -} - -module.exports = setup; - - -},{"ms":154}],154:[function(require,module,exports){ -/** - * Helpers. - */ - -var s = 1000; -var m = s * 60; -var h = m * 60; -var d = h * 24; -var w = d * 7; -var y = d * 365.25; - -/** - * Parse or format the given `val`. - * - * Options: - * - * - `long` verbose formatting [false] - * - * @param {String|Number} val - * @param {Object} [options] - * @throws {Error} throw an error if val is not a non-empty string or a number - * @return {String|Number} - * @api public - */ - -module.exports = function (val, options) { - options = options || {}; - var type = typeof val; - if (type === 'string' && val.length > 0) { - return parse(val); - } else if (type === 'number' && isFinite(val)) { - return options.long ? fmtLong(val) : fmtShort(val); - } - throw new Error( - 'val is not a non-empty string or a valid number. val=' + - JSON.stringify(val) - ); -}; - -/** - * Parse the given `str` and return milliseconds. - * - * @param {String} str - * @return {Number} - * @api private - */ - -function parse(str) { - str = String(str); - if (str.length > 100) { - return; - } - var match = /^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec( - str - ); - if (!match) { - return; - } - var n = parseFloat(match[1]); - var type = (match[2] || 'ms').toLowerCase(); - switch (type) { - case 'years': - case 'year': - case 'yrs': - case 'yr': - case 'y': - return n * y; - case 'weeks': - case 'week': - case 'w': - return n * w; - case 'days': - case 'day': - case 'd': - return n * d; - case 'hours': - case 'hour': - case 'hrs': - case 'hr': - case 'h': - return n * h; - case 'minutes': - case 'minute': - case 'mins': - case 'min': - case 'm': - return n * m; - case 'seconds': - case 'second': - case 'secs': - case 'sec': - case 's': - return n * s; - case 'milliseconds': - case 'millisecond': - case 'msecs': - case 'msec': - case 'ms': - return n; - default: - return undefined; - } -} - -/** - * Short format for `ms`. - * - * @param {Number} ms - * @return {String} - * @api private - */ - -function fmtShort(ms) { - var msAbs = Math.abs(ms); - if (msAbs >= d) { - return Math.round(ms / d) + 'd'; - } - if (msAbs >= h) { - return Math.round(ms / h) + 'h'; - } - if (msAbs >= m) { - return Math.round(ms / m) + 'm'; - } - if (msAbs >= s) { - return Math.round(ms / s) + 's'; - } - return ms + 'ms'; -} - -/** - * Long format for `ms`. - * - * @param {Number} ms - * @return {String} - * @api private - */ - -function fmtLong(ms) { - var msAbs = Math.abs(ms); - if (msAbs >= d) { - return plural(ms, msAbs, d, 'day'); - } - if (msAbs >= h) { - return plural(ms, msAbs, h, 'hour'); - } - if (msAbs >= m) { - return plural(ms, msAbs, m, 'minute'); - } - if (msAbs >= s) { - return plural(ms, msAbs, s, 'second'); - } - return ms + ' ms'; -} - -/** - * Pluralization helper. - */ - -function plural(ms, msAbs, n, name) { - var isPlural = msAbs >= n * 1.5; - return Math.round(ms / n) + ' ' + name + (isPlural ? 's' : ''); -} - -},{}],155:[function(require,module,exports){ -exports.read = function (buffer, offset, isLE, mLen, nBytes) { - var e, m - var eLen = (nBytes * 8) - mLen - 1 - var eMax = (1 << eLen) - 1 - var eBias = eMax >> 1 - var nBits = -7 - var i = isLE ? (nBytes - 1) : 0 - var d = isLE ? -1 : 1 - var s = buffer[offset + i] - - i += d - - e = s & ((1 << (-nBits)) - 1) - s >>= (-nBits) - nBits += eLen - for (; nBits > 0; e = (e * 256) + buffer[offset + i], i += d, nBits -= 8) {} - - m = e & ((1 << (-nBits)) - 1) - e >>= (-nBits) - nBits += mLen - for (; nBits > 0; m = (m * 256) + buffer[offset + i], i += d, nBits -= 8) {} - - if (e === 0) { - e = 1 - eBias - } else if (e === eMax) { - return m ? NaN : ((s ? -1 : 1) * Infinity) - } else { - m = m + Math.pow(2, mLen) - e = e - eBias - } - return (s ? -1 : 1) * m * Math.pow(2, e - mLen) -} - -exports.write = function (buffer, value, offset, isLE, mLen, nBytes) { - var e, m, c - var eLen = (nBytes * 8) - mLen - 1 - var eMax = (1 << eLen) - 1 - var eBias = eMax >> 1 - var rt = (mLen === 23 ? Math.pow(2, -24) - Math.pow(2, -77) : 0) - var i = isLE ? 0 : (nBytes - 1) - var d = isLE ? 1 : -1 - var s = value < 0 || (value === 0 && 1 / value < 0) ? 1 : 0 - - value = Math.abs(value) - - if (isNaN(value) || value === Infinity) { - m = isNaN(value) ? 1 : 0 - e = eMax - } else { - e = Math.floor(Math.log(value) / Math.LN2) - if (value * (c = Math.pow(2, -e)) < 1) { - e-- - c *= 2 - } - if (e + eBias >= 1) { - value += rt / c - } else { - value += rt * Math.pow(2, 1 - eBias) - } - if (value * c >= 2) { - e++ - c /= 2 - } - - if (e + eBias >= eMax) { - m = 0 - e = eMax - } else if (e + eBias >= 1) { - m = ((value * c) - 1) * Math.pow(2, mLen) - e = e + eBias - } else { - m = value * Math.pow(2, eBias - 1) * Math.pow(2, mLen) - e = 0 - } - } - - for (; mLen >= 8; buffer[offset + i] = m & 0xff, i += d, m /= 256, mLen -= 8) {} - - e = (e << mLen) | m - eLen += mLen - for (; eLen > 0; buffer[offset + i] = e & 0xff, i += d, e /= 256, eLen -= 8) {} - - buffer[offset + i - d] |= s * 128 -} - -},{}],156:[function(require,module,exports){ -arguments[4][18][0].apply(exports,arguments) -},{"dup":18}],157:[function(require,module,exports){ -/*! - * Determine if an object is a Buffer - * - * @author Feross Aboukhadijeh - * @license MIT - */ - -// The _isBuffer check is for Safari 5-7 support, because it's missing -// Object.prototype.constructor. Remove this eventually -module.exports = function (obj) { - return obj != null && (isBuffer(obj) || isSlowBuffer(obj) || !!obj._isBuffer) -} - -function isBuffer (obj) { - return !!obj.constructor && typeof obj.constructor.isBuffer === 'function' && obj.constructor.isBuffer(obj) -} - -// For Node v0.10 support. Remove this eventually. -function isSlowBuffer (obj) { - return typeof obj.readFloatLE === 'function' && typeof obj.slice === 'function' && isBuffer(obj.slice(0, 0)) -} - -},{}],158:[function(require,module,exports){ -module.exports = Array.isArray || function (arr) { - return Object.prototype.toString.call(arr) == '[object Array]'; -}; - -},{}],159:[function(require,module,exports){ -var json_stringify = require('./lib/stringify.js').stringify; -var json_parse = require('./lib/parse.js'); - -module.exports = function(options) { - return { - parse: json_parse(options), - stringify: json_stringify - } -}; -//create the default method members with no options applied for backwards compatibility -module.exports.parse = json_parse(); -module.exports.stringify = json_stringify; - -},{"./lib/parse.js":160,"./lib/stringify.js":161}],160:[function(require,module,exports){ -var BigNumber = null; - -// regexpxs extracted from -// (c) BSD-3-Clause -// https://github.com/fastify/secure-json-parse/graphs/contributors and https://github.com/hapijs/bourne/graphs/contributors - -const suspectProtoRx = /(?:_|\\u005[Ff])(?:_|\\u005[Ff])(?:p|\\u0070)(?:r|\\u0072)(?:o|\\u006[Ff])(?:t|\\u0074)(?:o|\\u006[Ff])(?:_|\\u005[Ff])(?:_|\\u005[Ff])/; -const suspectConstructorRx = /(?:c|\\u0063)(?:o|\\u006[Ff])(?:n|\\u006[Ee])(?:s|\\u0073)(?:t|\\u0074)(?:r|\\u0072)(?:u|\\u0075)(?:c|\\u0063)(?:t|\\u0074)(?:o|\\u006[Ff])(?:r|\\u0072)/; - -/* - json_parse.js - 2012-06-20 - - Public Domain. - - NO WARRANTY EXPRESSED OR IMPLIED. USE AT YOUR OWN RISK. - - This file creates a json_parse function. - During create you can (optionally) specify some behavioural switches - - require('json-bigint')(options) - - The optional options parameter holds switches that drive certain - aspects of the parsing process: - * options.strict = true will warn about duplicate-key usage in the json. - The default (strict = false) will silently ignore those and overwrite - values for keys that are in duplicate use. - - The resulting function follows this signature: - json_parse(text, reviver) - This method parses a JSON text to produce an object or array. - It can throw a SyntaxError exception. - - The optional reviver parameter is a function that can filter and - transform the results. It receives each of the keys and values, - and its return value is used instead of the original value. - If it returns what it received, then the structure is not modified. - If it returns undefined then the member is deleted. - - Example: - - // Parse the text. Values that look like ISO date strings will - // be converted to Date objects. - - myData = json_parse(text, function (key, value) { - var a; - if (typeof value === 'string') { - a = -/^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2}):(\d{2}(?:\.\d*)?)Z$/.exec(value); - if (a) { - return new Date(Date.UTC(+a[1], +a[2] - 1, +a[3], +a[4], - +a[5], +a[6])); - } - } - return value; - }); - - This is a reference implementation. You are free to copy, modify, or - redistribute. - - This code should be minified before deployment. - See http://javascript.crockford.com/jsmin.html - - USE YOUR OWN COPY. IT IS EXTREMELY UNWISE TO LOAD CODE FROM SERVERS YOU DO - NOT CONTROL. -*/ - -/*members "", "\"", "\/", "\\", at, b, call, charAt, f, fromCharCode, - hasOwnProperty, message, n, name, prototype, push, r, t, text -*/ - -var json_parse = function (options) { - 'use strict'; - - // This is a function that can parse a JSON text, producing a JavaScript - // data structure. It is a simple, recursive descent parser. It does not use - // eval or regular expressions, so it can be used as a model for implementing - // a JSON parser in other languages. - - // We are defining the function inside of another function to avoid creating - // global variables. - - // Default options one can override by passing options to the parse() - var _options = { - strict: false, // not being strict means do not generate syntax errors for "duplicate key" - storeAsString: false, // toggles whether the values should be stored as BigNumber (default) or a string - alwaysParseAsBig: false, // toggles whether all numbers should be Big - useNativeBigInt: false, // toggles whether to use native BigInt instead of bignumber.js - protoAction: 'error', - constructorAction: 'error', - }; - - // If there are options, then use them to override the default _options - if (options !== undefined && options !== null) { - if (options.strict === true) { - _options.strict = true; - } - if (options.storeAsString === true) { - _options.storeAsString = true; - } - _options.alwaysParseAsBig = - options.alwaysParseAsBig === true ? options.alwaysParseAsBig : false; - _options.useNativeBigInt = - options.useNativeBigInt === true ? options.useNativeBigInt : false; - - if (typeof options.constructorAction !== 'undefined') { - if ( - options.constructorAction === 'error' || - options.constructorAction === 'ignore' || - options.constructorAction === 'preserve' - ) { - _options.constructorAction = options.constructorAction; - } else { - throw new Error( - `Incorrect value for constructorAction option, must be "error", "ignore" or undefined but passed ${options.constructorAction}` - ); - } - } - - if (typeof options.protoAction !== 'undefined') { - if ( - options.protoAction === 'error' || - options.protoAction === 'ignore' || - options.protoAction === 'preserve' - ) { - _options.protoAction = options.protoAction; - } else { - throw new Error( - `Incorrect value for protoAction option, must be "error", "ignore" or undefined but passed ${options.protoAction}` - ); - } - } - } - - var at, // The index of the current character - ch, // The current character - escapee = { - '"': '"', - '\\': '\\', - '/': '/', - b: '\b', - f: '\f', - n: '\n', - r: '\r', - t: '\t', - }, - text, - error = function (m) { - // Call error when something is wrong. - - throw { - name: 'SyntaxError', - message: m, - at: at, - text: text, - }; - }, - next = function (c) { - // If a c parameter is provided, verify that it matches the current character. - - if (c && c !== ch) { - error("Expected '" + c + "' instead of '" + ch + "'"); - } - - // Get the next character. When there are no more characters, - // return the empty string. - - ch = text.charAt(at); - at += 1; - return ch; - }, - number = function () { - // Parse a number value. - - var number, - string = ''; - - if (ch === '-') { - string = '-'; - next('-'); - } - while (ch >= '0' && ch <= '9') { - string += ch; - next(); - } - if (ch === '.') { - string += '.'; - while (next() && ch >= '0' && ch <= '9') { - string += ch; - } - } - if (ch === 'e' || ch === 'E') { - string += ch; - next(); - if (ch === '-' || ch === '+') { - string += ch; - next(); - } - while (ch >= '0' && ch <= '9') { - string += ch; - next(); - } - } - number = +string; - if (!isFinite(number)) { - error('Bad number'); - } else { - if (BigNumber == null) BigNumber = require('bignumber.js'); - //if (number > 9007199254740992 || number < -9007199254740992) - // Bignumber has stricter check: everything with length > 15 digits disallowed - if (string.length > 15) - return _options.storeAsString - ? string - : _options.useNativeBigInt - ? BigInt(string) - : new BigNumber(string); - else - return !_options.alwaysParseAsBig - ? number - : _options.useNativeBigInt - ? BigInt(number) - : new BigNumber(number); - } - }, - string = function () { - // Parse a string value. - - var hex, - i, - string = '', - uffff; - - // When parsing for string values, we must look for " and \ characters. - - if (ch === '"') { - var startAt = at; - while (next()) { - if (ch === '"') { - if (at - 1 > startAt) string += text.substring(startAt, at - 1); - next(); - return string; - } - if (ch === '\\') { - if (at - 1 > startAt) string += text.substring(startAt, at - 1); - next(); - if (ch === 'u') { - uffff = 0; - for (i = 0; i < 4; i += 1) { - hex = parseInt(next(), 16); - if (!isFinite(hex)) { - break; - } - uffff = uffff * 16 + hex; - } - string += String.fromCharCode(uffff); - } else if (typeof escapee[ch] === 'string') { - string += escapee[ch]; - } else { - break; - } - startAt = at; - } - } - } - error('Bad string'); - }, - white = function () { - // Skip whitespace. - - while (ch && ch <= ' ') { - next(); - } - }, - word = function () { - // true, false, or null. - - switch (ch) { - case 't': - next('t'); - next('r'); - next('u'); - next('e'); - return true; - case 'f': - next('f'); - next('a'); - next('l'); - next('s'); - next('e'); - return false; - case 'n': - next('n'); - next('u'); - next('l'); - next('l'); - return null; - } - error("Unexpected '" + ch + "'"); - }, - value, // Place holder for the value function. - array = function () { - // Parse an array value. - - var array = []; - - if (ch === '[') { - next('['); - white(); - if (ch === ']') { - next(']'); - return array; // empty array - } - while (ch) { - array.push(value()); - white(); - if (ch === ']') { - next(']'); - return array; - } - next(','); - white(); - } - } - error('Bad array'); - }, - object = function () { - // Parse an object value. - - var key, - object = Object.create(null); - - if (ch === '{') { - next('{'); - white(); - if (ch === '}') { - next('}'); - return object; // empty object - } - while (ch) { - key = string(); - white(); - next(':'); - if ( - _options.strict === true && - Object.hasOwnProperty.call(object, key) - ) { - error('Duplicate key "' + key + '"'); - } - - if (suspectProtoRx.test(key) === true) { - if (_options.protoAction === 'error') { - error('Object contains forbidden prototype property'); - } else if (_options.protoAction === 'ignore') { - value(); - } else { - object[key] = value(); - } - } else if (suspectConstructorRx.test(key) === true) { - if (_options.constructorAction === 'error') { - error('Object contains forbidden constructor property'); - } else if (_options.constructorAction === 'ignore') { - value(); - } else { - object[key] = value(); - } - } else { - object[key] = value(); - } - - white(); - if (ch === '}') { - next('}'); - return object; - } - next(','); - white(); - } - } - error('Bad object'); - }; - - value = function () { - // Parse a JSON value. It could be an object, an array, a string, a number, - // or a word. - - white(); - switch (ch) { - case '{': - return object(); - case '[': - return array(); - case '"': - return string(); - case '-': - return number(); - default: - return ch >= '0' && ch <= '9' ? number() : word(); - } - }; - - // Return the json_parse function. It will have access to all of the above - // functions and variables. - - return function (source, reviver) { - var result; - - text = source + ''; - at = 0; - ch = ' '; - result = value(); - white(); - if (ch) { - error('Syntax error'); - } - - // If there is a reviver function, we recursively walk the new structure, - // passing each name/value pair to the reviver function for possible - // transformation, starting with a temporary root object that holds the result - // in an empty key. If there is not a reviver function, we simply return the - // result. - - return typeof reviver === 'function' - ? (function walk(holder, key) { - var k, - v, - value = holder[key]; - if (value && typeof value === 'object') { - Object.keys(value).forEach(function (k) { - v = walk(value, k); - if (v !== undefined) { - value[k] = v; - } else { - delete value[k]; - } - }); - } - return reviver.call(holder, key, value); - })({ '': result }, '') - : result; - }; -}; - -module.exports = json_parse; - -},{"bignumber.js":51}],161:[function(require,module,exports){ -var BigNumber = require('bignumber.js'); - -/* - json2.js - 2013-05-26 - - Public Domain. - - NO WARRANTY EXPRESSED OR IMPLIED. USE AT YOUR OWN RISK. - - See http://www.JSON.org/js.html - - - This code should be minified before deployment. - See http://javascript.crockford.com/jsmin.html - - USE YOUR OWN COPY. IT IS EXTREMELY UNWISE TO LOAD CODE FROM SERVERS YOU DO - NOT CONTROL. - - - This file creates a global JSON object containing two methods: stringify - and parse. - - JSON.stringify(value, replacer, space) - value any JavaScript value, usually an object or array. - - replacer an optional parameter that determines how object - values are stringified for objects. It can be a - function or an array of strings. - - space an optional parameter that specifies the indentation - of nested structures. If it is omitted, the text will - be packed without extra whitespace. If it is a number, - it will specify the number of spaces to indent at each - level. If it is a string (such as '\t' or ' '), - it contains the characters used to indent at each level. - - This method produces a JSON text from a JavaScript value. - - When an object value is found, if the object contains a toJSON - method, its toJSON method will be called and the result will be - stringified. A toJSON method does not serialize: it returns the - value represented by the name/value pair that should be serialized, - or undefined if nothing should be serialized. The toJSON method - will be passed the key associated with the value, and this will be - bound to the value - - For example, this would serialize Dates as ISO strings. - - Date.prototype.toJSON = function (key) { - function f(n) { - // Format integers to have at least two digits. - return n < 10 ? '0' + n : n; - } - - return this.getUTCFullYear() + '-' + - f(this.getUTCMonth() + 1) + '-' + - f(this.getUTCDate()) + 'T' + - f(this.getUTCHours()) + ':' + - f(this.getUTCMinutes()) + ':' + - f(this.getUTCSeconds()) + 'Z'; - }; - - You can provide an optional replacer method. It will be passed the - key and value of each member, with this bound to the containing - object. The value that is returned from your method will be - serialized. If your method returns undefined, then the member will - be excluded from the serialization. - - If the replacer parameter is an array of strings, then it will be - used to select the members to be serialized. It filters the results - such that only members with keys listed in the replacer array are - stringified. - - Values that do not have JSON representations, such as undefined or - functions, will not be serialized. Such values in objects will be - dropped; in arrays they will be replaced with null. You can use - a replacer function to replace those with JSON values. - JSON.stringify(undefined) returns undefined. - - The optional space parameter produces a stringification of the - value that is filled with line breaks and indentation to make it - easier to read. - - If the space parameter is a non-empty string, then that string will - be used for indentation. If the space parameter is a number, then - the indentation will be that many spaces. - - Example: - - text = JSON.stringify(['e', {pluribus: 'unum'}]); - // text is '["e",{"pluribus":"unum"}]' - - - text = JSON.stringify(['e', {pluribus: 'unum'}], null, '\t'); - // text is '[\n\t"e",\n\t{\n\t\t"pluribus": "unum"\n\t}\n]' - - text = JSON.stringify([new Date()], function (key, value) { - return this[key] instanceof Date ? - 'Date(' + this[key] + ')' : value; - }); - // text is '["Date(---current time---)"]' - - - JSON.parse(text, reviver) - This method parses a JSON text to produce an object or array. - It can throw a SyntaxError exception. - - The optional reviver parameter is a function that can filter and - transform the results. It receives each of the keys and values, - and its return value is used instead of the original value. - If it returns what it received, then the structure is not modified. - If it returns undefined then the member is deleted. - - Example: - - // Parse the text. Values that look like ISO date strings will - // be converted to Date objects. - - myData = JSON.parse(text, function (key, value) { - var a; - if (typeof value === 'string') { - a = -/^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2}):(\d{2}(?:\.\d*)?)Z$/.exec(value); - if (a) { - return new Date(Date.UTC(+a[1], +a[2] - 1, +a[3], +a[4], - +a[5], +a[6])); - } - } - return value; - }); - - myData = JSON.parse('["Date(09/09/2001)"]', function (key, value) { - var d; - if (typeof value === 'string' && - value.slice(0, 5) === 'Date(' && - value.slice(-1) === ')') { - d = new Date(value.slice(5, -1)); - if (d) { - return d; - } - } - return value; - }); - - - This is a reference implementation. You are free to copy, modify, or - redistribute. -*/ - -/*jslint evil: true, regexp: true */ - -/*members "", "\b", "\t", "\n", "\f", "\r", "\"", JSON, "\\", apply, - call, charCodeAt, getUTCDate, getUTCFullYear, getUTCHours, - getUTCMinutes, getUTCMonth, getUTCSeconds, hasOwnProperty, join, - lastIndex, length, parse, prototype, push, replace, slice, stringify, - test, toJSON, toString, valueOf -*/ - - -// Create a JSON object only if one does not already exist. We create the -// methods in a closure to avoid creating global variables. - -var JSON = module.exports; - -(function () { - 'use strict'; - - function f(n) { - // Format integers to have at least two digits. - return n < 10 ? '0' + n : n; - } - - var cx = /[\u0000\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g, - escapable = /[\\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g, - gap, - indent, - meta = { // table of character substitutions - '\b': '\\b', - '\t': '\\t', - '\n': '\\n', - '\f': '\\f', - '\r': '\\r', - '"' : '\\"', - '\\': '\\\\' - }, - rep; - - - function quote(string) { - -// If the string contains no control characters, no quote characters, and no -// backslash characters, then we can safely slap some quotes around it. -// Otherwise we must also replace the offending characters with safe escape -// sequences. - - escapable.lastIndex = 0; - return escapable.test(string) ? '"' + string.replace(escapable, function (a) { - var c = meta[a]; - return typeof c === 'string' - ? c - : '\\u' + ('0000' + a.charCodeAt(0).toString(16)).slice(-4); - }) + '"' : '"' + string + '"'; - } - - - function str(key, holder) { - -// Produce a string from holder[key]. - - var i, // The loop counter. - k, // The member key. - v, // The member value. - length, - mind = gap, - partial, - value = holder[key], - isBigNumber = value != null && (value instanceof BigNumber || BigNumber.isBigNumber(value)); - -// If the value has a toJSON method, call it to obtain a replacement value. - - if (value && typeof value === 'object' && - typeof value.toJSON === 'function') { - value = value.toJSON(key); - } - -// If we were called with a replacer function, then call the replacer to -// obtain a replacement value. - - if (typeof rep === 'function') { - value = rep.call(holder, key, value); - } - -// What happens next depends on the value's type. - - switch (typeof value) { - case 'string': - if (isBigNumber) { - return value; - } else { - return quote(value); - } - - case 'number': - -// JSON numbers must be finite. Encode non-finite numbers as null. - - return isFinite(value) ? String(value) : 'null'; - - case 'boolean': - case 'null': - case 'bigint': - -// If the value is a boolean or null, convert it to a string. Note: -// typeof null does not produce 'null'. The case is included here in -// the remote chance that this gets fixed someday. - - return String(value); - -// If the type is 'object', we might be dealing with an object or an array or -// null. - - case 'object': - -// Due to a specification blunder in ECMAScript, typeof null is 'object', -// so watch out for that case. - - if (!value) { - return 'null'; - } - -// Make an array to hold the partial results of stringifying this object value. - - gap += indent; - partial = []; - -// Is the value an array? - - if (Object.prototype.toString.apply(value) === '[object Array]') { - -// The value is an array. Stringify every element. Use null as a placeholder -// for non-JSON values. - - length = value.length; - for (i = 0; i < length; i += 1) { - partial[i] = str(i, value) || 'null'; - } - -// Join all of the elements together, separated with commas, and wrap them in -// brackets. - - v = partial.length === 0 - ? '[]' - : gap - ? '[\n' + gap + partial.join(',\n' + gap) + '\n' + mind + ']' - : '[' + partial.join(',') + ']'; - gap = mind; - return v; - } - -// If the replacer is an array, use it to select the members to be stringified. - - if (rep && typeof rep === 'object') { - length = rep.length; - for (i = 0; i < length; i += 1) { - if (typeof rep[i] === 'string') { - k = rep[i]; - v = str(k, value); - if (v) { - partial.push(quote(k) + (gap ? ': ' : ':') + v); - } - } - } - } else { - -// Otherwise, iterate through all of the keys in the object. - - Object.keys(value).forEach(function(k) { - var v = str(k, value); - if (v) { - partial.push(quote(k) + (gap ? ': ' : ':') + v); - } - }); - } - -// Join all of the member texts together, separated with commas, -// and wrap them in braces. - - v = partial.length === 0 - ? '{}' - : gap - ? '{\n' + gap + partial.join(',\n' + gap) + '\n' + mind + '}' - : '{' + partial.join(',') + '}'; - gap = mind; - return v; - } - } - -// If the JSON object does not yet have a stringify method, give it one. - - if (typeof JSON.stringify !== 'function') { - JSON.stringify = function (value, replacer, space) { - -// The stringify method takes a value and an optional replacer, and an optional -// space parameter, and returns a JSON text. The replacer can be a function -// that can replace values, or an array of strings that will select the keys. -// A default replacer method can be provided. Use of the space parameter can -// produce text that is more easily readable. - - var i; - gap = ''; - indent = ''; - -// If the space parameter is a number, make an indent string containing that -// many spaces. - - if (typeof space === 'number') { - for (i = 0; i < space; i += 1) { - indent += ' '; - } - -// If the space parameter is a string, it will be used as the indent string. - - } else if (typeof space === 'string') { - indent = space; - } - -// If there is a replacer, it must be a function or an array. -// Otherwise, throw an error. - - rep = replacer; - if (replacer && typeof replacer !== 'function' && - (typeof replacer !== 'object' || - typeof replacer.length !== 'number')) { - throw new Error('JSON.stringify'); - } - -// Make a fake root object containing our value under the key of ''. -// Return the result of stringifying the value. - - return str('', {'': value}); - }; - } -}()); - -},{"bignumber.js":51}],162:[function(require,module,exports){ -'use strict' -var inherits = require('inherits') -var HashBase = require('hash-base') -var Buffer = require('safe-buffer').Buffer - -var ARRAY16 = new Array(16) - -function MD5 () { - HashBase.call(this, 64) - - // state - this._a = 0x67452301 - this._b = 0xefcdab89 - this._c = 0x98badcfe - this._d = 0x10325476 -} - -inherits(MD5, HashBase) - -MD5.prototype._update = function () { - var M = ARRAY16 - for (var i = 0; i < 16; ++i) M[i] = this._block.readInt32LE(i * 4) - - var a = this._a - var b = this._b - var c = this._c - var d = this._d - - a = fnF(a, b, c, d, M[0], 0xd76aa478, 7) - d = fnF(d, a, b, c, M[1], 0xe8c7b756, 12) - c = fnF(c, d, a, b, M[2], 0x242070db, 17) - b = fnF(b, c, d, a, M[3], 0xc1bdceee, 22) - a = fnF(a, b, c, d, M[4], 0xf57c0faf, 7) - d = fnF(d, a, b, c, M[5], 0x4787c62a, 12) - c = fnF(c, d, a, b, M[6], 0xa8304613, 17) - b = fnF(b, c, d, a, M[7], 0xfd469501, 22) - a = fnF(a, b, c, d, M[8], 0x698098d8, 7) - d = fnF(d, a, b, c, M[9], 0x8b44f7af, 12) - c = fnF(c, d, a, b, M[10], 0xffff5bb1, 17) - b = fnF(b, c, d, a, M[11], 0x895cd7be, 22) - a = fnF(a, b, c, d, M[12], 0x6b901122, 7) - d = fnF(d, a, b, c, M[13], 0xfd987193, 12) - c = fnF(c, d, a, b, M[14], 0xa679438e, 17) - b = fnF(b, c, d, a, M[15], 0x49b40821, 22) - - a = fnG(a, b, c, d, M[1], 0xf61e2562, 5) - d = fnG(d, a, b, c, M[6], 0xc040b340, 9) - c = fnG(c, d, a, b, M[11], 0x265e5a51, 14) - b = fnG(b, c, d, a, M[0], 0xe9b6c7aa, 20) - a = fnG(a, b, c, d, M[5], 0xd62f105d, 5) - d = fnG(d, a, b, c, M[10], 0x02441453, 9) - c = fnG(c, d, a, b, M[15], 0xd8a1e681, 14) - b = fnG(b, c, d, a, M[4], 0xe7d3fbc8, 20) - a = fnG(a, b, c, d, M[9], 0x21e1cde6, 5) - d = fnG(d, a, b, c, M[14], 0xc33707d6, 9) - c = fnG(c, d, a, b, M[3], 0xf4d50d87, 14) - b = fnG(b, c, d, a, M[8], 0x455a14ed, 20) - a = fnG(a, b, c, d, M[13], 0xa9e3e905, 5) - d = fnG(d, a, b, c, M[2], 0xfcefa3f8, 9) - c = fnG(c, d, a, b, M[7], 0x676f02d9, 14) - b = fnG(b, c, d, a, M[12], 0x8d2a4c8a, 20) - - a = fnH(a, b, c, d, M[5], 0xfffa3942, 4) - d = fnH(d, a, b, c, M[8], 0x8771f681, 11) - c = fnH(c, d, a, b, M[11], 0x6d9d6122, 16) - b = fnH(b, c, d, a, M[14], 0xfde5380c, 23) - a = fnH(a, b, c, d, M[1], 0xa4beea44, 4) - d = fnH(d, a, b, c, M[4], 0x4bdecfa9, 11) - c = fnH(c, d, a, b, M[7], 0xf6bb4b60, 16) - b = fnH(b, c, d, a, M[10], 0xbebfbc70, 23) - a = fnH(a, b, c, d, M[13], 0x289b7ec6, 4) - d = fnH(d, a, b, c, M[0], 0xeaa127fa, 11) - c = fnH(c, d, a, b, M[3], 0xd4ef3085, 16) - b = fnH(b, c, d, a, M[6], 0x04881d05, 23) - a = fnH(a, b, c, d, M[9], 0xd9d4d039, 4) - d = fnH(d, a, b, c, M[12], 0xe6db99e5, 11) - c = fnH(c, d, a, b, M[15], 0x1fa27cf8, 16) - b = fnH(b, c, d, a, M[2], 0xc4ac5665, 23) - - a = fnI(a, b, c, d, M[0], 0xf4292244, 6) - d = fnI(d, a, b, c, M[7], 0x432aff97, 10) - c = fnI(c, d, a, b, M[14], 0xab9423a7, 15) - b = fnI(b, c, d, a, M[5], 0xfc93a039, 21) - a = fnI(a, b, c, d, M[12], 0x655b59c3, 6) - d = fnI(d, a, b, c, M[3], 0x8f0ccc92, 10) - c = fnI(c, d, a, b, M[10], 0xffeff47d, 15) - b = fnI(b, c, d, a, M[1], 0x85845dd1, 21) - a = fnI(a, b, c, d, M[8], 0x6fa87e4f, 6) - d = fnI(d, a, b, c, M[15], 0xfe2ce6e0, 10) - c = fnI(c, d, a, b, M[6], 0xa3014314, 15) - b = fnI(b, c, d, a, M[13], 0x4e0811a1, 21) - a = fnI(a, b, c, d, M[4], 0xf7537e82, 6) - d = fnI(d, a, b, c, M[11], 0xbd3af235, 10) - c = fnI(c, d, a, b, M[2], 0x2ad7d2bb, 15) - b = fnI(b, c, d, a, M[9], 0xeb86d391, 21) - - this._a = (this._a + a) | 0 - this._b = (this._b + b) | 0 - this._c = (this._c + c) | 0 - this._d = (this._d + d) | 0 -} - -MD5.prototype._digest = function () { - // create padding and handle blocks - this._block[this._blockOffset++] = 0x80 - if (this._blockOffset > 56) { - this._block.fill(0, this._blockOffset, 64) - this._update() - this._blockOffset = 0 - } - - this._block.fill(0, this._blockOffset, 56) - this._block.writeUInt32LE(this._length[0], 56) - this._block.writeUInt32LE(this._length[1], 60) - this._update() - - // produce result - var buffer = Buffer.allocUnsafe(16) - buffer.writeInt32LE(this._a, 0) - buffer.writeInt32LE(this._b, 4) - buffer.writeInt32LE(this._c, 8) - buffer.writeInt32LE(this._d, 12) - return buffer -} - -function rotl (x, n) { - return (x << n) | (x >>> (32 - n)) -} - -function fnF (a, b, c, d, m, k, s) { - return (rotl((a + ((b & c) | ((~b) & d)) + m + k) | 0, s) + b) | 0 -} - -function fnG (a, b, c, d, m, k, s) { - return (rotl((a + ((b & d) | (c & (~d))) + m + k) | 0, s) + b) | 0 -} - -function fnH (a, b, c, d, m, k, s) { - return (rotl((a + (b ^ c ^ d) + m + k) | 0, s) + b) | 0 -} - -function fnI (a, b, c, d, m, k, s) { - return (rotl((a + ((c ^ (b | (~d)))) + m + k) | 0, s) + b) | 0 -} - -module.exports = MD5 - -},{"hash-base":132,"inherits":156,"safe-buffer":216}],163:[function(require,module,exports){ -var bn = require('bn.js'); -var brorand = require('brorand'); - -function MillerRabin(rand) { - this.rand = rand || new brorand.Rand(); -} -module.exports = MillerRabin; - -MillerRabin.create = function create(rand) { - return new MillerRabin(rand); -}; - -MillerRabin.prototype._randbelow = function _randbelow(n) { - var len = n.bitLength(); - var min_bytes = Math.ceil(len / 8); - - // Generage random bytes until a number less than n is found. - // This ensures that 0..n-1 have an equal probability of being selected. - do - var a = new bn(this.rand.generate(min_bytes)); - while (a.cmp(n) >= 0); - - return a; -}; - -MillerRabin.prototype._randrange = function _randrange(start, stop) { - // Generate a random number greater than or equal to start and less than stop. - var size = stop.sub(start); - return start.add(this._randbelow(size)); -}; - -MillerRabin.prototype.test = function test(n, k, cb) { - var len = n.bitLength(); - var red = bn.mont(n); - var rone = new bn(1).toRed(red); - - if (!k) - k = Math.max(1, (len / 48) | 0); - - // Find d and s, (n - 1) = (2 ^ s) * d; - var n1 = n.subn(1); - for (var s = 0; !n1.testn(s); s++) {} - var d = n.shrn(s); - - var rn1 = n1.toRed(red); - - var prime = true; - for (; k > 0; k--) { - var a = this._randrange(new bn(2), n1); - if (cb) - cb(a); - - var x = a.toRed(red).redPow(d); - if (x.cmp(rone) === 0 || x.cmp(rn1) === 0) - continue; - - for (var i = 1; i < s; i++) { - x = x.redSqr(); - - if (x.cmp(rone) === 0) - return false; - if (x.cmp(rn1) === 0) - break; - } - - if (i === s) - return false; - } - - return prime; -}; - -MillerRabin.prototype.getDivisor = function getDivisor(n, k) { - var len = n.bitLength(); - var red = bn.mont(n); - var rone = new bn(1).toRed(red); - - if (!k) - k = Math.max(1, (len / 48) | 0); - - // Find d and s, (n - 1) = (2 ^ s) * d; - var n1 = n.subn(1); - for (var s = 0; !n1.testn(s); s++) {} - var d = n.shrn(s); - - var rn1 = n1.toRed(red); - - for (; k > 0; k--) { - var a = this._randrange(new bn(2), n1); - - var g = n.gcd(a); - if (g.cmpn(1) !== 0) - return g; - - var x = a.toRed(red).redPow(d); - if (x.cmp(rone) === 0 || x.cmp(rn1) === 0) - continue; - - for (var i = 1; i < s; i++) { - x = x.redSqr(); - - if (x.cmp(rone) === 0) - return x.fromRed().subn(1).gcd(n); - if (x.cmp(rn1) === 0) - break; - } - - if (i === s) { - x = x.redSqr(); - return x.fromRed().subn(1).gcd(n); - } - } - - return false; -}; - -},{"bn.js":52,"brorand":53}],164:[function(require,module,exports){ -module.exports = assert; - -function assert(val, msg) { - if (!val) - throw new Error(msg || 'Assertion failed'); -} - -assert.equal = function assertEqual(l, r, msg) { - if (l != r) - throw new Error(msg || ('Assertion failed: ' + l + ' != ' + r)); -}; - -},{}],165:[function(require,module,exports){ -'use strict'; - -var utils = exports; - -function toArray(msg, enc) { - if (Array.isArray(msg)) - return msg.slice(); - if (!msg) - return []; - var res = []; - if (typeof msg !== 'string') { - for (var i = 0; i < msg.length; i++) - res[i] = msg[i] | 0; - return res; - } - if (enc === 'hex') { - msg = msg.replace(/[^a-z0-9]+/ig, ''); - if (msg.length % 2 !== 0) - msg = '0' + msg; - for (var i = 0; i < msg.length; i += 2) - res.push(parseInt(msg[i] + msg[i + 1], 16)); - } else { - for (var i = 0; i < msg.length; i++) { - var c = msg.charCodeAt(i); - var hi = c >> 8; - var lo = c & 0xff; - if (hi) - res.push(hi, lo); - else - res.push(lo); - } - } - return res; -} -utils.toArray = toArray; - -function zero2(word) { - if (word.length === 1) - return '0' + word; - else - return word; -} -utils.zero2 = zero2; - -function toHex(msg) { - var res = ''; - for (var i = 0; i < msg.length; i++) - res += zero2(msg[i].toString(16)); - return res; -} -utils.toHex = toHex; - -utils.encode = function encode(arr, enc) { - if (enc === 'hex') - return toHex(arr); - else - return arr; -}; - -},{}],166:[function(require,module,exports){ -/** - * Helpers. - */ - -var s = 1000; -var m = s * 60; -var h = m * 60; -var d = h * 24; -var y = d * 365.25; - -/** - * Parse or format the given `val`. - * - * Options: - * - * - `long` verbose formatting [false] - * - * @param {String|Number} val - * @param {Object} [options] - * @throws {Error} throw an error if val is not a non-empty string or a number - * @return {String|Number} - * @api public - */ - -module.exports = function(val, options) { - options = options || {}; - var type = typeof val; - if (type === 'string' && val.length > 0) { - return parse(val); - } else if (type === 'number' && isNaN(val) === false) { - return options.long ? fmtLong(val) : fmtShort(val); - } - throw new Error( - 'val is not a non-empty string or a valid number. val=' + - JSON.stringify(val) - ); -}; - -/** - * Parse the given `str` and return milliseconds. - * - * @param {String} str - * @return {Number} - * @api private - */ - -function parse(str) { - str = String(str); - if (str.length > 100) { - return; - } - var match = /^((?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|years?|yrs?|y)?$/i.exec( - str - ); - if (!match) { - return; - } - var n = parseFloat(match[1]); - var type = (match[2] || 'ms').toLowerCase(); - switch (type) { - case 'years': - case 'year': - case 'yrs': - case 'yr': - case 'y': - return n * y; - case 'days': - case 'day': - case 'd': - return n * d; - case 'hours': - case 'hour': - case 'hrs': - case 'hr': - case 'h': - return n * h; - case 'minutes': - case 'minute': - case 'mins': - case 'min': - case 'm': - return n * m; - case 'seconds': - case 'second': - case 'secs': - case 'sec': - case 's': - return n * s; - case 'milliseconds': - case 'millisecond': - case 'msecs': - case 'msec': - case 'ms': - return n; - default: - return undefined; - } -} - -/** - * Short format for `ms`. - * - * @param {Number} ms - * @return {String} - * @api private - */ - -function fmtShort(ms) { - if (ms >= d) { - return Math.round(ms / d) + 'd'; - } - if (ms >= h) { - return Math.round(ms / h) + 'h'; - } - if (ms >= m) { - return Math.round(ms / m) + 'm'; - } - if (ms >= s) { - return Math.round(ms / s) + 's'; - } - return ms + 'ms'; -} - -/** - * Long format for `ms`. - * - * @param {Number} ms - * @return {String} - * @api private - */ - -function fmtLong(ms) { - return plural(ms, d, 'day') || - plural(ms, h, 'hour') || - plural(ms, m, 'minute') || - plural(ms, s, 'second') || - ms + ' ms'; -} - -/** - * Pluralization helper. - */ - -function plural(ms, n, name) { - if (ms < n) { - return; - } - if (ms < n * 1.5) { - return Math.floor(ms / n) + ' ' + name; - } - return Math.ceil(ms / n) + ' ' + name + 's'; -} - -},{}],167:[function(require,module,exports){ -(function (global){ -"use strict"; - -// ref: https://github.com/tc39/proposal-global -var getGlobal = function () { - // the only reliable means to get the global object is - // `Function('return this')()` - // However, this causes CSP violations in Chrome apps. - if (typeof self !== 'undefined') { return self; } - if (typeof window !== 'undefined') { return window; } - if (typeof global !== 'undefined') { return global; } - throw new Error('unable to locate global object'); -} - -var global = getGlobal(); - -module.exports = exports = global.fetch; - -// Needed for TypeScript and Webpack. -if (global.fetch) { - exports.default = global.fetch.bind(global); -} - -exports.Headers = global.Headers; -exports.Request = global.Request; -exports.Response = global.Response; -}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) -},{}],168:[function(require,module,exports){ -/* -object-assign -(c) Sindre Sorhus -@license MIT -*/ - -'use strict'; -/* eslint-disable no-unused-vars */ -var getOwnPropertySymbols = Object.getOwnPropertySymbols; -var hasOwnProperty = Object.prototype.hasOwnProperty; -var propIsEnumerable = Object.prototype.propertyIsEnumerable; - -function toObject(val) { - if (val === null || val === undefined) { - throw new TypeError('Object.assign cannot be called with null or undefined'); - } - - return Object(val); -} - -function shouldUseNative() { - try { - if (!Object.assign) { - return false; - } - - // Detect buggy property enumeration order in older V8 versions. - - // https://bugs.chromium.org/p/v8/issues/detail?id=4118 - var test1 = new String('abc'); // eslint-disable-line no-new-wrappers - test1[5] = 'de'; - if (Object.getOwnPropertyNames(test1)[0] === '5') { - return false; - } - - // https://bugs.chromium.org/p/v8/issues/detail?id=3056 - var test2 = {}; - for (var i = 0; i < 10; i++) { - test2['_' + String.fromCharCode(i)] = i; - } - var order2 = Object.getOwnPropertyNames(test2).map(function (n) { - return test2[n]; - }); - if (order2.join('') !== '0123456789') { - return false; - } - - // https://bugs.chromium.org/p/v8/issues/detail?id=3056 - var test3 = {}; - 'abcdefghijklmnopqrst'.split('').forEach(function (letter) { - test3[letter] = letter; - }); - if (Object.keys(Object.assign({}, test3)).join('') !== - 'abcdefghijklmnopqrst') { - return false; - } - - return true; - } catch (err) { - // We don't expect any of the above to throw, but better to be safe. - return false; - } -} - -module.exports = shouldUseNative() ? Object.assign : function (target, source) { - var from; - var to = toObject(target); - var symbols; - - for (var s = 1; s < arguments.length; s++) { - from = Object(arguments[s]); - - for (var key in from) { - if (hasOwnProperty.call(from, key)) { - to[key] = from[key]; - } - } - - if (getOwnPropertySymbols) { - symbols = getOwnPropertySymbols(from); - for (var i = 0; i < symbols.length; i++) { - if (propIsEnumerable.call(from, symbols[i])) { - to[symbols[i]] = from[symbols[i]]; - } - } - } - } - - return to; -}; - -},{}],169:[function(require,module,exports){ -// Top level file is just a mixin of submodules & constants -'use strict'; - -var assign = require('./lib/utils/common').assign; - -var deflate = require('./lib/deflate'); -var inflate = require('./lib/inflate'); -var constants = require('./lib/zlib/constants'); - -var pako = {}; - -assign(pako, deflate, inflate, constants); - -module.exports = pako; - -},{"./lib/deflate":170,"./lib/inflate":171,"./lib/utils/common":172,"./lib/zlib/constants":175}],170:[function(require,module,exports){ -'use strict'; - - -var zlib_deflate = require('./zlib/deflate'); -var utils = require('./utils/common'); -var strings = require('./utils/strings'); -var msg = require('./zlib/messages'); -var ZStream = require('./zlib/zstream'); - -var toString = Object.prototype.toString; - -/* Public constants ==========================================================*/ -/* ===========================================================================*/ - -var Z_NO_FLUSH = 0; -var Z_FINISH = 4; - -var Z_OK = 0; -var Z_STREAM_END = 1; -var Z_SYNC_FLUSH = 2; - -var Z_DEFAULT_COMPRESSION = -1; - -var Z_DEFAULT_STRATEGY = 0; - -var Z_DEFLATED = 8; - -/* ===========================================================================*/ - - -/** - * class Deflate - * - * Generic JS-style wrapper for zlib calls. If you don't need - * streaming behaviour - use more simple functions: [[deflate]], - * [[deflateRaw]] and [[gzip]]. - **/ - -/* internal - * Deflate.chunks -> Array - * - * Chunks of output data, if [[Deflate#onData]] not overridden. - **/ - -/** - * Deflate.result -> Uint8Array|Array - * - * Compressed result, generated by default [[Deflate#onData]] - * and [[Deflate#onEnd]] handlers. Filled after you push last chunk - * (call [[Deflate#push]] with `Z_FINISH` / `true` param) or if you - * push a chunk with explicit flush (call [[Deflate#push]] with - * `Z_SYNC_FLUSH` param). - **/ - -/** - * Deflate.err -> Number - * - * Error code after deflate finished. 0 (Z_OK) on success. - * You will not need it in real life, because deflate errors - * are possible only on wrong options or bad `onData` / `onEnd` - * custom handlers. - **/ - -/** - * Deflate.msg -> String - * - * Error message, if [[Deflate.err]] != 0 - **/ - - -/** - * new Deflate(options) - * - options (Object): zlib deflate options. - * - * Creates new deflator instance with specified params. Throws exception - * on bad params. Supported options: - * - * - `level` - * - `windowBits` - * - `memLevel` - * - `strategy` - * - `dictionary` - * - * [http://zlib.net/manual.html#Advanced](http://zlib.net/manual.html#Advanced) - * for more information on these. - * - * Additional options, for internal needs: - * - * - `chunkSize` - size of generated data chunks (16K by default) - * - `raw` (Boolean) - do raw deflate - * - `gzip` (Boolean) - create gzip wrapper - * - `to` (String) - if equal to 'string', then result will be "binary string" - * (each char code [0..255]) - * - `header` (Object) - custom header for gzip - * - `text` (Boolean) - true if compressed data believed to be text - * - `time` (Number) - modification time, unix timestamp - * - `os` (Number) - operation system code - * - `extra` (Array) - array of bytes with extra data (max 65536) - * - `name` (String) - file name (binary string) - * - `comment` (String) - comment (binary string) - * - `hcrc` (Boolean) - true if header crc should be added - * - * ##### Example: - * - * ```javascript - * var pako = require('pako') - * , chunk1 = Uint8Array([1,2,3,4,5,6,7,8,9]) - * , chunk2 = Uint8Array([10,11,12,13,14,15,16,17,18,19]); - * - * var deflate = new pako.Deflate({ level: 3}); - * - * deflate.push(chunk1, false); - * deflate.push(chunk2, true); // true -> last chunk - * - * if (deflate.err) { throw new Error(deflate.err); } - * - * console.log(deflate.result); - * ``` - **/ -function Deflate(options) { - if (!(this instanceof Deflate)) return new Deflate(options); - - this.options = utils.assign({ - level: Z_DEFAULT_COMPRESSION, - method: Z_DEFLATED, - chunkSize: 16384, - windowBits: 15, - memLevel: 8, - strategy: Z_DEFAULT_STRATEGY, - to: '' - }, options || {}); - - var opt = this.options; - - if (opt.raw && (opt.windowBits > 0)) { - opt.windowBits = -opt.windowBits; - } - - else if (opt.gzip && (opt.windowBits > 0) && (opt.windowBits < 16)) { - opt.windowBits += 16; - } - - this.err = 0; // error code, if happens (0 = Z_OK) - this.msg = ''; // error message - this.ended = false; // used to avoid multiple onEnd() calls - this.chunks = []; // chunks of compressed data - - this.strm = new ZStream(); - this.strm.avail_out = 0; - - var status = zlib_deflate.deflateInit2( - this.strm, - opt.level, - opt.method, - opt.windowBits, - opt.memLevel, - opt.strategy - ); - - if (status !== Z_OK) { - throw new Error(msg[status]); - } - - if (opt.header) { - zlib_deflate.deflateSetHeader(this.strm, opt.header); - } - - if (opt.dictionary) { - var dict; - // Convert data if needed - if (typeof opt.dictionary === 'string') { - // If we need to compress text, change encoding to utf8. - dict = strings.string2buf(opt.dictionary); - } else if (toString.call(opt.dictionary) === '[object ArrayBuffer]') { - dict = new Uint8Array(opt.dictionary); - } else { - dict = opt.dictionary; - } - - status = zlib_deflate.deflateSetDictionary(this.strm, dict); - - if (status !== Z_OK) { - throw new Error(msg[status]); - } - - this._dict_set = true; - } -} - -/** - * Deflate#push(data[, mode]) -> Boolean - * - data (Uint8Array|Array|ArrayBuffer|String): input data. Strings will be - * converted to utf8 byte sequence. - * - mode (Number|Boolean): 0..6 for corresponding Z_NO_FLUSH..Z_TREE modes. - * See constants. Skipped or `false` means Z_NO_FLUSH, `true` means Z_FINISH. - * - * Sends input data to deflate pipe, generating [[Deflate#onData]] calls with - * new compressed chunks. Returns `true` on success. The last data block must have - * mode Z_FINISH (or `true`). That will flush internal pending buffers and call - * [[Deflate#onEnd]]. For interim explicit flushes (without ending the stream) you - * can use mode Z_SYNC_FLUSH, keeping the compression context. - * - * On fail call [[Deflate#onEnd]] with error code and return false. - * - * We strongly recommend to use `Uint8Array` on input for best speed (output - * array format is detected automatically). Also, don't skip last param and always - * use the same type in your code (boolean or number). That will improve JS speed. - * - * For regular `Array`-s make sure all elements are [0..255]. - * - * ##### Example - * - * ```javascript - * push(chunk, false); // push one of data chunks - * ... - * push(chunk, true); // push last chunk - * ``` - **/ -Deflate.prototype.push = function (data, mode) { - var strm = this.strm; - var chunkSize = this.options.chunkSize; - var status, _mode; - - if (this.ended) { return false; } - - _mode = (mode === ~~mode) ? mode : ((mode === true) ? Z_FINISH : Z_NO_FLUSH); - - // Convert data if needed - if (typeof data === 'string') { - // If we need to compress text, change encoding to utf8. - strm.input = strings.string2buf(data); - } else if (toString.call(data) === '[object ArrayBuffer]') { - strm.input = new Uint8Array(data); - } else { - strm.input = data; - } - - strm.next_in = 0; - strm.avail_in = strm.input.length; - - do { - if (strm.avail_out === 0) { - strm.output = new utils.Buf8(chunkSize); - strm.next_out = 0; - strm.avail_out = chunkSize; - } - status = zlib_deflate.deflate(strm, _mode); /* no bad return value */ - - if (status !== Z_STREAM_END && status !== Z_OK) { - this.onEnd(status); - this.ended = true; - return false; - } - if (strm.avail_out === 0 || (strm.avail_in === 0 && (_mode === Z_FINISH || _mode === Z_SYNC_FLUSH))) { - if (this.options.to === 'string') { - this.onData(strings.buf2binstring(utils.shrinkBuf(strm.output, strm.next_out))); - } else { - this.onData(utils.shrinkBuf(strm.output, strm.next_out)); - } - } - } while ((strm.avail_in > 0 || strm.avail_out === 0) && status !== Z_STREAM_END); - - // Finalize on the last chunk. - if (_mode === Z_FINISH) { - status = zlib_deflate.deflateEnd(this.strm); - this.onEnd(status); - this.ended = true; - return status === Z_OK; - } - - // callback interim results if Z_SYNC_FLUSH. - if (_mode === Z_SYNC_FLUSH) { - this.onEnd(Z_OK); - strm.avail_out = 0; - return true; - } - - return true; -}; - - -/** - * Deflate#onData(chunk) -> Void - * - chunk (Uint8Array|Array|String): output data. Type of array depends - * on js engine support. When string output requested, each chunk - * will be string. - * - * By default, stores data blocks in `chunks[]` property and glue - * those in `onEnd`. Override this handler, if you need another behaviour. - **/ -Deflate.prototype.onData = function (chunk) { - this.chunks.push(chunk); -}; - - -/** - * Deflate#onEnd(status) -> Void - * - status (Number): deflate status. 0 (Z_OK) on success, - * other if not. - * - * Called once after you tell deflate that the input stream is - * complete (Z_FINISH) or should be flushed (Z_SYNC_FLUSH) - * or if an error happened. By default - join collected chunks, - * free memory and fill `results` / `err` properties. - **/ -Deflate.prototype.onEnd = function (status) { - // On success - join - if (status === Z_OK) { - if (this.options.to === 'string') { - this.result = this.chunks.join(''); - } else { - this.result = utils.flattenChunks(this.chunks); - } - } - this.chunks = []; - this.err = status; - this.msg = this.strm.msg; -}; - - -/** - * deflate(data[, options]) -> Uint8Array|Array|String - * - data (Uint8Array|Array|String): input data to compress. - * - options (Object): zlib deflate options. - * - * Compress `data` with deflate algorithm and `options`. - * - * Supported options are: - * - * - level - * - windowBits - * - memLevel - * - strategy - * - dictionary - * - * [http://zlib.net/manual.html#Advanced](http://zlib.net/manual.html#Advanced) - * for more information on these. - * - * Sugar (options): - * - * - `raw` (Boolean) - say that we work with raw stream, if you don't wish to specify - * negative windowBits implicitly. - * - `to` (String) - if equal to 'string', then result will be "binary string" - * (each char code [0..255]) - * - * ##### Example: - * - * ```javascript - * var pako = require('pako') - * , data = Uint8Array([1,2,3,4,5,6,7,8,9]); - * - * console.log(pako.deflate(data)); - * ``` - **/ -function deflate(input, options) { - var deflator = new Deflate(options); - - deflator.push(input, true); - - // That will never happens, if you don't cheat with options :) - if (deflator.err) { throw deflator.msg || msg[deflator.err]; } - - return deflator.result; -} - - -/** - * deflateRaw(data[, options]) -> Uint8Array|Array|String - * - data (Uint8Array|Array|String): input data to compress. - * - options (Object): zlib deflate options. - * - * The same as [[deflate]], but creates raw data, without wrapper - * (header and adler32 crc). - **/ -function deflateRaw(input, options) { - options = options || {}; - options.raw = true; - return deflate(input, options); -} - - -/** - * gzip(data[, options]) -> Uint8Array|Array|String - * - data (Uint8Array|Array|String): input data to compress. - * - options (Object): zlib deflate options. - * - * The same as [[deflate]], but create gzip wrapper instead of - * deflate one. - **/ -function gzip(input, options) { - options = options || {}; - options.gzip = true; - return deflate(input, options); -} - - -exports.Deflate = Deflate; -exports.deflate = deflate; -exports.deflateRaw = deflateRaw; -exports.gzip = gzip; - -},{"./utils/common":172,"./utils/strings":173,"./zlib/deflate":177,"./zlib/messages":182,"./zlib/zstream":184}],171:[function(require,module,exports){ -'use strict'; - - -var zlib_inflate = require('./zlib/inflate'); -var utils = require('./utils/common'); -var strings = require('./utils/strings'); -var c = require('./zlib/constants'); -var msg = require('./zlib/messages'); -var ZStream = require('./zlib/zstream'); -var GZheader = require('./zlib/gzheader'); - -var toString = Object.prototype.toString; - -/** - * class Inflate - * - * Generic JS-style wrapper for zlib calls. If you don't need - * streaming behaviour - use more simple functions: [[inflate]] - * and [[inflateRaw]]. - **/ - -/* internal - * inflate.chunks -> Array - * - * Chunks of output data, if [[Inflate#onData]] not overridden. - **/ - -/** - * Inflate.result -> Uint8Array|Array|String - * - * Uncompressed result, generated by default [[Inflate#onData]] - * and [[Inflate#onEnd]] handlers. Filled after you push last chunk - * (call [[Inflate#push]] with `Z_FINISH` / `true` param) or if you - * push a chunk with explicit flush (call [[Inflate#push]] with - * `Z_SYNC_FLUSH` param). - **/ - -/** - * Inflate.err -> Number - * - * Error code after inflate finished. 0 (Z_OK) on success. - * Should be checked if broken data possible. - **/ - -/** - * Inflate.msg -> String - * - * Error message, if [[Inflate.err]] != 0 - **/ - - -/** - * new Inflate(options) - * - options (Object): zlib inflate options. - * - * Creates new inflator instance with specified params. Throws exception - * on bad params. Supported options: - * - * - `windowBits` - * - `dictionary` - * - * [http://zlib.net/manual.html#Advanced](http://zlib.net/manual.html#Advanced) - * for more information on these. - * - * Additional options, for internal needs: - * - * - `chunkSize` - size of generated data chunks (16K by default) - * - `raw` (Boolean) - do raw inflate - * - `to` (String) - if equal to 'string', then result will be converted - * from utf8 to utf16 (javascript) string. When string output requested, - * chunk length can differ from `chunkSize`, depending on content. - * - * By default, when no options set, autodetect deflate/gzip data format via - * wrapper header. - * - * ##### Example: - * - * ```javascript - * var pako = require('pako') - * , chunk1 = Uint8Array([1,2,3,4,5,6,7,8,9]) - * , chunk2 = Uint8Array([10,11,12,13,14,15,16,17,18,19]); - * - * var inflate = new pako.Inflate({ level: 3}); - * - * inflate.push(chunk1, false); - * inflate.push(chunk2, true); // true -> last chunk - * - * if (inflate.err) { throw new Error(inflate.err); } - * - * console.log(inflate.result); - * ``` - **/ -function Inflate(options) { - if (!(this instanceof Inflate)) return new Inflate(options); - - this.options = utils.assign({ - chunkSize: 16384, - windowBits: 0, - to: '' - }, options || {}); - - var opt = this.options; - - // Force window size for `raw` data, if not set directly, - // because we have no header for autodetect. - if (opt.raw && (opt.windowBits >= 0) && (opt.windowBits < 16)) { - opt.windowBits = -opt.windowBits; - if (opt.windowBits === 0) { opt.windowBits = -15; } - } - - // If `windowBits` not defined (and mode not raw) - set autodetect flag for gzip/deflate - if ((opt.windowBits >= 0) && (opt.windowBits < 16) && - !(options && options.windowBits)) { - opt.windowBits += 32; - } - - // Gzip header has no info about windows size, we can do autodetect only - // for deflate. So, if window size not set, force it to max when gzip possible - if ((opt.windowBits > 15) && (opt.windowBits < 48)) { - // bit 3 (16) -> gzipped data - // bit 4 (32) -> autodetect gzip/deflate - if ((opt.windowBits & 15) === 0) { - opt.windowBits |= 15; - } - } - - this.err = 0; // error code, if happens (0 = Z_OK) - this.msg = ''; // error message - this.ended = false; // used to avoid multiple onEnd() calls - this.chunks = []; // chunks of compressed data - - this.strm = new ZStream(); - this.strm.avail_out = 0; - - var status = zlib_inflate.inflateInit2( - this.strm, - opt.windowBits - ); - - if (status !== c.Z_OK) { - throw new Error(msg[status]); - } - - this.header = new GZheader(); - - zlib_inflate.inflateGetHeader(this.strm, this.header); - - // Setup dictionary - if (opt.dictionary) { - // Convert data if needed - if (typeof opt.dictionary === 'string') { - opt.dictionary = strings.string2buf(opt.dictionary); - } else if (toString.call(opt.dictionary) === '[object ArrayBuffer]') { - opt.dictionary = new Uint8Array(opt.dictionary); - } - if (opt.raw) { //In raw mode we need to set the dictionary early - status = zlib_inflate.inflateSetDictionary(this.strm, opt.dictionary); - if (status !== c.Z_OK) { - throw new Error(msg[status]); - } - } - } -} - -/** - * Inflate#push(data[, mode]) -> Boolean - * - data (Uint8Array|Array|ArrayBuffer|String): input data - * - mode (Number|Boolean): 0..6 for corresponding Z_NO_FLUSH..Z_TREE modes. - * See constants. Skipped or `false` means Z_NO_FLUSH, `true` means Z_FINISH. - * - * Sends input data to inflate pipe, generating [[Inflate#onData]] calls with - * new output chunks. Returns `true` on success. The last data block must have - * mode Z_FINISH (or `true`). That will flush internal pending buffers and call - * [[Inflate#onEnd]]. For interim explicit flushes (without ending the stream) you - * can use mode Z_SYNC_FLUSH, keeping the decompression context. - * - * On fail call [[Inflate#onEnd]] with error code and return false. - * - * We strongly recommend to use `Uint8Array` on input for best speed (output - * format is detected automatically). Also, don't skip last param and always - * use the same type in your code (boolean or number). That will improve JS speed. - * - * For regular `Array`-s make sure all elements are [0..255]. - * - * ##### Example - * - * ```javascript - * push(chunk, false); // push one of data chunks - * ... - * push(chunk, true); // push last chunk - * ``` - **/ -Inflate.prototype.push = function (data, mode) { - var strm = this.strm; - var chunkSize = this.options.chunkSize; - var dictionary = this.options.dictionary; - var status, _mode; - var next_out_utf8, tail, utf8str; - - // Flag to properly process Z_BUF_ERROR on testing inflate call - // when we check that all output data was flushed. - var allowBufError = false; - - if (this.ended) { return false; } - _mode = (mode === ~~mode) ? mode : ((mode === true) ? c.Z_FINISH : c.Z_NO_FLUSH); - - // Convert data if needed - if (typeof data === 'string') { - // Only binary strings can be decompressed on practice - strm.input = strings.binstring2buf(data); - } else if (toString.call(data) === '[object ArrayBuffer]') { - strm.input = new Uint8Array(data); - } else { - strm.input = data; - } - - strm.next_in = 0; - strm.avail_in = strm.input.length; - - do { - if (strm.avail_out === 0) { - strm.output = new utils.Buf8(chunkSize); - strm.next_out = 0; - strm.avail_out = chunkSize; - } - - status = zlib_inflate.inflate(strm, c.Z_NO_FLUSH); /* no bad return value */ - - if (status === c.Z_NEED_DICT && dictionary) { - status = zlib_inflate.inflateSetDictionary(this.strm, dictionary); - } - - if (status === c.Z_BUF_ERROR && allowBufError === true) { - status = c.Z_OK; - allowBufError = false; - } - - if (status !== c.Z_STREAM_END && status !== c.Z_OK) { - this.onEnd(status); - this.ended = true; - return false; - } - - if (strm.next_out) { - if (strm.avail_out === 0 || status === c.Z_STREAM_END || (strm.avail_in === 0 && (_mode === c.Z_FINISH || _mode === c.Z_SYNC_FLUSH))) { - - if (this.options.to === 'string') { - - next_out_utf8 = strings.utf8border(strm.output, strm.next_out); - - tail = strm.next_out - next_out_utf8; - utf8str = strings.buf2string(strm.output, next_out_utf8); - - // move tail - strm.next_out = tail; - strm.avail_out = chunkSize - tail; - if (tail) { utils.arraySet(strm.output, strm.output, next_out_utf8, tail, 0); } - - this.onData(utf8str); - - } else { - this.onData(utils.shrinkBuf(strm.output, strm.next_out)); - } - } - } - - // When no more input data, we should check that internal inflate buffers - // are flushed. The only way to do it when avail_out = 0 - run one more - // inflate pass. But if output data not exists, inflate return Z_BUF_ERROR. - // Here we set flag to process this error properly. - // - // NOTE. Deflate does not return error in this case and does not needs such - // logic. - if (strm.avail_in === 0 && strm.avail_out === 0) { - allowBufError = true; - } - - } while ((strm.avail_in > 0 || strm.avail_out === 0) && status !== c.Z_STREAM_END); - - if (status === c.Z_STREAM_END) { - _mode = c.Z_FINISH; - } - - // Finalize on the last chunk. - if (_mode === c.Z_FINISH) { - status = zlib_inflate.inflateEnd(this.strm); - this.onEnd(status); - this.ended = true; - return status === c.Z_OK; - } - - // callback interim results if Z_SYNC_FLUSH. - if (_mode === c.Z_SYNC_FLUSH) { - this.onEnd(c.Z_OK); - strm.avail_out = 0; - return true; - } - - return true; -}; - - -/** - * Inflate#onData(chunk) -> Void - * - chunk (Uint8Array|Array|String): output data. Type of array depends - * on js engine support. When string output requested, each chunk - * will be string. - * - * By default, stores data blocks in `chunks[]` property and glue - * those in `onEnd`. Override this handler, if you need another behaviour. - **/ -Inflate.prototype.onData = function (chunk) { - this.chunks.push(chunk); -}; - - -/** - * Inflate#onEnd(status) -> Void - * - status (Number): inflate status. 0 (Z_OK) on success, - * other if not. - * - * Called either after you tell inflate that the input stream is - * complete (Z_FINISH) or should be flushed (Z_SYNC_FLUSH) - * or if an error happened. By default - join collected chunks, - * free memory and fill `results` / `err` properties. - **/ -Inflate.prototype.onEnd = function (status) { - // On success - join - if (status === c.Z_OK) { - if (this.options.to === 'string') { - // Glue & convert here, until we teach pako to send - // utf8 aligned strings to onData - this.result = this.chunks.join(''); - } else { - this.result = utils.flattenChunks(this.chunks); - } - } - this.chunks = []; - this.err = status; - this.msg = this.strm.msg; -}; - - -/** - * inflate(data[, options]) -> Uint8Array|Array|String - * - data (Uint8Array|Array|String): input data to decompress. - * - options (Object): zlib inflate options. - * - * Decompress `data` with inflate/ungzip and `options`. Autodetect - * format via wrapper header by default. That's why we don't provide - * separate `ungzip` method. - * - * Supported options are: - * - * - windowBits - * - * [http://zlib.net/manual.html#Advanced](http://zlib.net/manual.html#Advanced) - * for more information. - * - * Sugar (options): - * - * - `raw` (Boolean) - say that we work with raw stream, if you don't wish to specify - * negative windowBits implicitly. - * - `to` (String) - if equal to 'string', then result will be converted - * from utf8 to utf16 (javascript) string. When string output requested, - * chunk length can differ from `chunkSize`, depending on content. - * - * - * ##### Example: - * - * ```javascript - * var pako = require('pako') - * , input = pako.deflate([1,2,3,4,5,6,7,8,9]) - * , output; - * - * try { - * output = pako.inflate(input); - * } catch (err) - * console.log(err); - * } - * ``` - **/ -function inflate(input, options) { - var inflator = new Inflate(options); - - inflator.push(input, true); - - // That will never happens, if you don't cheat with options :) - if (inflator.err) { throw inflator.msg || msg[inflator.err]; } - - return inflator.result; -} - - -/** - * inflateRaw(data[, options]) -> Uint8Array|Array|String - * - data (Uint8Array|Array|String): input data to decompress. - * - options (Object): zlib inflate options. - * - * The same as [[inflate]], but creates raw data, without wrapper - * (header and adler32 crc). - **/ -function inflateRaw(input, options) { - options = options || {}; - options.raw = true; - return inflate(input, options); -} - - -/** - * ungzip(data[, options]) -> Uint8Array|Array|String - * - data (Uint8Array|Array|String): input data to decompress. - * - options (Object): zlib inflate options. - * - * Just shortcut to [[inflate]], because it autodetects format - * by header.content. Done for convenience. - **/ - - -exports.Inflate = Inflate; -exports.inflate = inflate; -exports.inflateRaw = inflateRaw; -exports.ungzip = inflate; - -},{"./utils/common":172,"./utils/strings":173,"./zlib/constants":175,"./zlib/gzheader":178,"./zlib/inflate":180,"./zlib/messages":182,"./zlib/zstream":184}],172:[function(require,module,exports){ -'use strict'; - - -var TYPED_OK = (typeof Uint8Array !== 'undefined') && - (typeof Uint16Array !== 'undefined') && - (typeof Int32Array !== 'undefined'); - -function _has(obj, key) { - return Object.prototype.hasOwnProperty.call(obj, key); -} - -exports.assign = function (obj /*from1, from2, from3, ...*/) { - var sources = Array.prototype.slice.call(arguments, 1); - while (sources.length) { - var source = sources.shift(); - if (!source) { continue; } - - if (typeof source !== 'object') { - throw new TypeError(source + 'must be non-object'); - } - - for (var p in source) { - if (_has(source, p)) { - obj[p] = source[p]; - } - } - } - - return obj; -}; - - -// reduce buffer size, avoiding mem copy -exports.shrinkBuf = function (buf, size) { - if (buf.length === size) { return buf; } - if (buf.subarray) { return buf.subarray(0, size); } - buf.length = size; - return buf; -}; - - -var fnTyped = { - arraySet: function (dest, src, src_offs, len, dest_offs) { - if (src.subarray && dest.subarray) { - dest.set(src.subarray(src_offs, src_offs + len), dest_offs); - return; - } - // Fallback to ordinary array - for (var i = 0; i < len; i++) { - dest[dest_offs + i] = src[src_offs + i]; - } - }, - // Join array of chunks to single array. - flattenChunks: function (chunks) { - var i, l, len, pos, chunk, result; - - // calculate data length - len = 0; - for (i = 0, l = chunks.length; i < l; i++) { - len += chunks[i].length; - } - - // join chunks - result = new Uint8Array(len); - pos = 0; - for (i = 0, l = chunks.length; i < l; i++) { - chunk = chunks[i]; - result.set(chunk, pos); - pos += chunk.length; - } - - return result; - } -}; - -var fnUntyped = { - arraySet: function (dest, src, src_offs, len, dest_offs) { - for (var i = 0; i < len; i++) { - dest[dest_offs + i] = src[src_offs + i]; - } - }, - // Join array of chunks to single array. - flattenChunks: function (chunks) { - return [].concat.apply([], chunks); - } -}; - - -// Enable/Disable typed arrays use, for testing -// -exports.setTyped = function (on) { - if (on) { - exports.Buf8 = Uint8Array; - exports.Buf16 = Uint16Array; - exports.Buf32 = Int32Array; - exports.assign(exports, fnTyped); - } else { - exports.Buf8 = Array; - exports.Buf16 = Array; - exports.Buf32 = Array; - exports.assign(exports, fnUntyped); - } -}; - -exports.setTyped(TYPED_OK); - -},{}],173:[function(require,module,exports){ -// String encode/decode helpers -'use strict'; - - -var utils = require('./common'); - - -// Quick check if we can use fast array to bin string conversion -// -// - apply(Array) can fail on Android 2.2 -// - apply(Uint8Array) can fail on iOS 5.1 Safari -// -var STR_APPLY_OK = true; -var STR_APPLY_UIA_OK = true; - -try { String.fromCharCode.apply(null, [ 0 ]); } catch (__) { STR_APPLY_OK = false; } -try { String.fromCharCode.apply(null, new Uint8Array(1)); } catch (__) { STR_APPLY_UIA_OK = false; } - - -// Table with utf8 lengths (calculated by first byte of sequence) -// Note, that 5 & 6-byte values and some 4-byte values can not be represented in JS, -// because max possible codepoint is 0x10ffff -var _utf8len = new utils.Buf8(256); -for (var q = 0; q < 256; q++) { - _utf8len[q] = (q >= 252 ? 6 : q >= 248 ? 5 : q >= 240 ? 4 : q >= 224 ? 3 : q >= 192 ? 2 : 1); -} -_utf8len[254] = _utf8len[254] = 1; // Invalid sequence start - - -// convert string to array (typed, when possible) -exports.string2buf = function (str) { - var buf, c, c2, m_pos, i, str_len = str.length, buf_len = 0; - - // count binary size - for (m_pos = 0; m_pos < str_len; m_pos++) { - c = str.charCodeAt(m_pos); - if ((c & 0xfc00) === 0xd800 && (m_pos + 1 < str_len)) { - c2 = str.charCodeAt(m_pos + 1); - if ((c2 & 0xfc00) === 0xdc00) { - c = 0x10000 + ((c - 0xd800) << 10) + (c2 - 0xdc00); - m_pos++; - } - } - buf_len += c < 0x80 ? 1 : c < 0x800 ? 2 : c < 0x10000 ? 3 : 4; - } - - // allocate buffer - buf = new utils.Buf8(buf_len); - - // convert - for (i = 0, m_pos = 0; i < buf_len; m_pos++) { - c = str.charCodeAt(m_pos); - if ((c & 0xfc00) === 0xd800 && (m_pos + 1 < str_len)) { - c2 = str.charCodeAt(m_pos + 1); - if ((c2 & 0xfc00) === 0xdc00) { - c = 0x10000 + ((c - 0xd800) << 10) + (c2 - 0xdc00); - m_pos++; - } - } - if (c < 0x80) { - /* one byte */ - buf[i++] = c; - } else if (c < 0x800) { - /* two bytes */ - buf[i++] = 0xC0 | (c >>> 6); - buf[i++] = 0x80 | (c & 0x3f); - } else if (c < 0x10000) { - /* three bytes */ - buf[i++] = 0xE0 | (c >>> 12); - buf[i++] = 0x80 | (c >>> 6 & 0x3f); - buf[i++] = 0x80 | (c & 0x3f); - } else { - /* four bytes */ - buf[i++] = 0xf0 | (c >>> 18); - buf[i++] = 0x80 | (c >>> 12 & 0x3f); - buf[i++] = 0x80 | (c >>> 6 & 0x3f); - buf[i++] = 0x80 | (c & 0x3f); - } - } - - return buf; -}; - -// Helper (used in 2 places) -function buf2binstring(buf, len) { - // On Chrome, the arguments in a function call that are allowed is `65534`. - // If the length of the buffer is smaller than that, we can use this optimization, - // otherwise we will take a slower path. - if (len < 65534) { - if ((buf.subarray && STR_APPLY_UIA_OK) || (!buf.subarray && STR_APPLY_OK)) { - return String.fromCharCode.apply(null, utils.shrinkBuf(buf, len)); - } - } - - var result = ''; - for (var i = 0; i < len; i++) { - result += String.fromCharCode(buf[i]); - } - return result; -} - - -// Convert byte array to binary string -exports.buf2binstring = function (buf) { - return buf2binstring(buf, buf.length); -}; - - -// Convert binary string (typed, when possible) -exports.binstring2buf = function (str) { - var buf = new utils.Buf8(str.length); - for (var i = 0, len = buf.length; i < len; i++) { - buf[i] = str.charCodeAt(i); - } - return buf; -}; - - -// convert array to string -exports.buf2string = function (buf, max) { - var i, out, c, c_len; - var len = max || buf.length; - - // Reserve max possible length (2 words per char) - // NB: by unknown reasons, Array is significantly faster for - // String.fromCharCode.apply than Uint16Array. - var utf16buf = new Array(len * 2); - - for (out = 0, i = 0; i < len;) { - c = buf[i++]; - // quick process ascii - if (c < 0x80) { utf16buf[out++] = c; continue; } - - c_len = _utf8len[c]; - // skip 5 & 6 byte codes - if (c_len > 4) { utf16buf[out++] = 0xfffd; i += c_len - 1; continue; } - - // apply mask on first byte - c &= c_len === 2 ? 0x1f : c_len === 3 ? 0x0f : 0x07; - // join the rest - while (c_len > 1 && i < len) { - c = (c << 6) | (buf[i++] & 0x3f); - c_len--; - } - - // terminated by end of string? - if (c_len > 1) { utf16buf[out++] = 0xfffd; continue; } - - if (c < 0x10000) { - utf16buf[out++] = c; - } else { - c -= 0x10000; - utf16buf[out++] = 0xd800 | ((c >> 10) & 0x3ff); - utf16buf[out++] = 0xdc00 | (c & 0x3ff); - } - } - - return buf2binstring(utf16buf, out); -}; - - -// Calculate max possible position in utf8 buffer, -// that will not break sequence. If that's not possible -// - (very small limits) return max size as is. -// -// buf[] - utf8 bytes array -// max - length limit (mandatory); -exports.utf8border = function (buf, max) { - var pos; - - max = max || buf.length; - if (max > buf.length) { max = buf.length; } - - // go back from last position, until start of sequence found - pos = max - 1; - while (pos >= 0 && (buf[pos] & 0xC0) === 0x80) { pos--; } - - // Very small and broken sequence, - // return max, because we should return something anyway. - if (pos < 0) { return max; } - - // If we came to start of buffer - that means buffer is too small, - // return max too. - if (pos === 0) { return max; } - - return (pos + _utf8len[buf[pos]] > max) ? pos : max; -}; - -},{"./common":172}],174:[function(require,module,exports){ -'use strict'; - -// Note: adler32 takes 12% for level 0 and 2% for level 6. -// It isn't worth it to make additional optimizations as in original. -// Small size is preferable. - -// (C) 1995-2013 Jean-loup Gailly and Mark Adler -// (C) 2014-2017 Vitaly Puzrin and Andrey Tupitsin -// -// This software is provided 'as-is', without any express or implied -// warranty. In no event will the authors be held liable for any damages -// arising from the use of this software. -// -// Permission is granted to anyone to use this software for any purpose, -// including commercial applications, and to alter it and redistribute it -// freely, subject to the following restrictions: -// -// 1. The origin of this software must not be misrepresented; you must not -// claim that you wrote the original software. If you use this software -// in a product, an acknowledgment in the product documentation would be -// appreciated but is not required. -// 2. Altered source versions must be plainly marked as such, and must not be -// misrepresented as being the original software. -// 3. This notice may not be removed or altered from any source distribution. - -function adler32(adler, buf, len, pos) { - var s1 = (adler & 0xffff) |0, - s2 = ((adler >>> 16) & 0xffff) |0, - n = 0; - - while (len !== 0) { - // Set limit ~ twice less than 5552, to keep - // s2 in 31-bits, because we force signed ints. - // in other case %= will fail. - n = len > 2000 ? 2000 : len; - len -= n; - - do { - s1 = (s1 + buf[pos++]) |0; - s2 = (s2 + s1) |0; - } while (--n); - - s1 %= 65521; - s2 %= 65521; - } - - return (s1 | (s2 << 16)) |0; -} - - -module.exports = adler32; - -},{}],175:[function(require,module,exports){ -'use strict'; - -// (C) 1995-2013 Jean-loup Gailly and Mark Adler -// (C) 2014-2017 Vitaly Puzrin and Andrey Tupitsin -// -// This software is provided 'as-is', without any express or implied -// warranty. In no event will the authors be held liable for any damages -// arising from the use of this software. -// -// Permission is granted to anyone to use this software for any purpose, -// including commercial applications, and to alter it and redistribute it -// freely, subject to the following restrictions: -// -// 1. The origin of this software must not be misrepresented; you must not -// claim that you wrote the original software. If you use this software -// in a product, an acknowledgment in the product documentation would be -// appreciated but is not required. -// 2. Altered source versions must be plainly marked as such, and must not be -// misrepresented as being the original software. -// 3. This notice may not be removed or altered from any source distribution. - -module.exports = { - - /* Allowed flush values; see deflate() and inflate() below for details */ - Z_NO_FLUSH: 0, - Z_PARTIAL_FLUSH: 1, - Z_SYNC_FLUSH: 2, - Z_FULL_FLUSH: 3, - Z_FINISH: 4, - Z_BLOCK: 5, - Z_TREES: 6, - - /* Return codes for the compression/decompression functions. Negative values - * are errors, positive values are used for special but normal events. - */ - Z_OK: 0, - Z_STREAM_END: 1, - Z_NEED_DICT: 2, - Z_ERRNO: -1, - Z_STREAM_ERROR: -2, - Z_DATA_ERROR: -3, - //Z_MEM_ERROR: -4, - Z_BUF_ERROR: -5, - //Z_VERSION_ERROR: -6, - - /* compression levels */ - Z_NO_COMPRESSION: 0, - Z_BEST_SPEED: 1, - Z_BEST_COMPRESSION: 9, - Z_DEFAULT_COMPRESSION: -1, - - - Z_FILTERED: 1, - Z_HUFFMAN_ONLY: 2, - Z_RLE: 3, - Z_FIXED: 4, - Z_DEFAULT_STRATEGY: 0, - - /* Possible values of the data_type field (though see inflate()) */ - Z_BINARY: 0, - Z_TEXT: 1, - //Z_ASCII: 1, // = Z_TEXT (deprecated) - Z_UNKNOWN: 2, - - /* The deflate compression method */ - Z_DEFLATED: 8 - //Z_NULL: null // Use -1 or null inline, depending on var type -}; - -},{}],176:[function(require,module,exports){ -'use strict'; - -// Note: we can't get significant speed boost here. -// So write code to minimize size - no pregenerated tables -// and array tools dependencies. - -// (C) 1995-2013 Jean-loup Gailly and Mark Adler -// (C) 2014-2017 Vitaly Puzrin and Andrey Tupitsin -// -// This software is provided 'as-is', without any express or implied -// warranty. In no event will the authors be held liable for any damages -// arising from the use of this software. -// -// Permission is granted to anyone to use this software for any purpose, -// including commercial applications, and to alter it and redistribute it -// freely, subject to the following restrictions: -// -// 1. The origin of this software must not be misrepresented; you must not -// claim that you wrote the original software. If you use this software -// in a product, an acknowledgment in the product documentation would be -// appreciated but is not required. -// 2. Altered source versions must be plainly marked as such, and must not be -// misrepresented as being the original software. -// 3. This notice may not be removed or altered from any source distribution. - -// Use ordinary array, since untyped makes no boost here -function makeTable() { - var c, table = []; - - for (var n = 0; n < 256; n++) { - c = n; - for (var k = 0; k < 8; k++) { - c = ((c & 1) ? (0xEDB88320 ^ (c >>> 1)) : (c >>> 1)); - } - table[n] = c; - } - - return table; -} - -// Create table on load. Just 255 signed longs. Not a problem. -var crcTable = makeTable(); - - -function crc32(crc, buf, len, pos) { - var t = crcTable, - end = pos + len; - - crc ^= -1; - - for (var i = pos; i < end; i++) { - crc = (crc >>> 8) ^ t[(crc ^ buf[i]) & 0xFF]; - } - - return (crc ^ (-1)); // >>> 0; -} - - -module.exports = crc32; - -},{}],177:[function(require,module,exports){ -'use strict'; - -// (C) 1995-2013 Jean-loup Gailly and Mark Adler -// (C) 2014-2017 Vitaly Puzrin and Andrey Tupitsin -// -// This software is provided 'as-is', without any express or implied -// warranty. In no event will the authors be held liable for any damages -// arising from the use of this software. -// -// Permission is granted to anyone to use this software for any purpose, -// including commercial applications, and to alter it and redistribute it -// freely, subject to the following restrictions: -// -// 1. The origin of this software must not be misrepresented; you must not -// claim that you wrote the original software. If you use this software -// in a product, an acknowledgment in the product documentation would be -// appreciated but is not required. -// 2. Altered source versions must be plainly marked as such, and must not be -// misrepresented as being the original software. -// 3. This notice may not be removed or altered from any source distribution. - -var utils = require('../utils/common'); -var trees = require('./trees'); -var adler32 = require('./adler32'); -var crc32 = require('./crc32'); -var msg = require('./messages'); - -/* Public constants ==========================================================*/ -/* ===========================================================================*/ - - -/* Allowed flush values; see deflate() and inflate() below for details */ -var Z_NO_FLUSH = 0; -var Z_PARTIAL_FLUSH = 1; -//var Z_SYNC_FLUSH = 2; -var Z_FULL_FLUSH = 3; -var Z_FINISH = 4; -var Z_BLOCK = 5; -//var Z_TREES = 6; - - -/* Return codes for the compression/decompression functions. Negative values - * are errors, positive values are used for special but normal events. - */ -var Z_OK = 0; -var Z_STREAM_END = 1; -//var Z_NEED_DICT = 2; -//var Z_ERRNO = -1; -var Z_STREAM_ERROR = -2; -var Z_DATA_ERROR = -3; -//var Z_MEM_ERROR = -4; -var Z_BUF_ERROR = -5; -//var Z_VERSION_ERROR = -6; - - -/* compression levels */ -//var Z_NO_COMPRESSION = 0; -//var Z_BEST_SPEED = 1; -//var Z_BEST_COMPRESSION = 9; -var Z_DEFAULT_COMPRESSION = -1; - - -var Z_FILTERED = 1; -var Z_HUFFMAN_ONLY = 2; -var Z_RLE = 3; -var Z_FIXED = 4; -var Z_DEFAULT_STRATEGY = 0; - -/* Possible values of the data_type field (though see inflate()) */ -//var Z_BINARY = 0; -//var Z_TEXT = 1; -//var Z_ASCII = 1; // = Z_TEXT -var Z_UNKNOWN = 2; - - -/* The deflate compression method */ -var Z_DEFLATED = 8; - -/*============================================================================*/ - - -var MAX_MEM_LEVEL = 9; -/* Maximum value for memLevel in deflateInit2 */ -var MAX_WBITS = 15; -/* 32K LZ77 window */ -var DEF_MEM_LEVEL = 8; - - -var LENGTH_CODES = 29; -/* number of length codes, not counting the special END_BLOCK code */ -var LITERALS = 256; -/* number of literal bytes 0..255 */ -var L_CODES = LITERALS + 1 + LENGTH_CODES; -/* number of Literal or Length codes, including the END_BLOCK code */ -var D_CODES = 30; -/* number of distance codes */ -var BL_CODES = 19; -/* number of codes used to transfer the bit lengths */ -var HEAP_SIZE = 2 * L_CODES + 1; -/* maximum heap size */ -var MAX_BITS = 15; -/* All codes must not exceed MAX_BITS bits */ - -var MIN_MATCH = 3; -var MAX_MATCH = 258; -var MIN_LOOKAHEAD = (MAX_MATCH + MIN_MATCH + 1); - -var PRESET_DICT = 0x20; - -var INIT_STATE = 42; -var EXTRA_STATE = 69; -var NAME_STATE = 73; -var COMMENT_STATE = 91; -var HCRC_STATE = 103; -var BUSY_STATE = 113; -var FINISH_STATE = 666; - -var BS_NEED_MORE = 1; /* block not completed, need more input or more output */ -var BS_BLOCK_DONE = 2; /* block flush performed */ -var BS_FINISH_STARTED = 3; /* finish started, need only more output at next deflate */ -var BS_FINISH_DONE = 4; /* finish done, accept no more input or output */ - -var OS_CODE = 0x03; // Unix :) . Don't detect, use this default. - -function err(strm, errorCode) { - strm.msg = msg[errorCode]; - return errorCode; -} - -function rank(f) { - return ((f) << 1) - ((f) > 4 ? 9 : 0); -} - -function zero(buf) { var len = buf.length; while (--len >= 0) { buf[len] = 0; } } - - -/* ========================================================================= - * Flush as much pending output as possible. All deflate() output goes - * through this function so some applications may wish to modify it - * to avoid allocating a large strm->output buffer and copying into it. - * (See also read_buf()). - */ -function flush_pending(strm) { - var s = strm.state; - - //_tr_flush_bits(s); - var len = s.pending; - if (len > strm.avail_out) { - len = strm.avail_out; - } - if (len === 0) { return; } - - utils.arraySet(strm.output, s.pending_buf, s.pending_out, len, strm.next_out); - strm.next_out += len; - s.pending_out += len; - strm.total_out += len; - strm.avail_out -= len; - s.pending -= len; - if (s.pending === 0) { - s.pending_out = 0; - } -} - - -function flush_block_only(s, last) { - trees._tr_flush_block(s, (s.block_start >= 0 ? s.block_start : -1), s.strstart - s.block_start, last); - s.block_start = s.strstart; - flush_pending(s.strm); -} - - -function put_byte(s, b) { - s.pending_buf[s.pending++] = b; -} - - -/* ========================================================================= - * Put a short in the pending buffer. The 16-bit value is put in MSB order. - * IN assertion: the stream state is correct and there is enough room in - * pending_buf. - */ -function putShortMSB(s, b) { -// put_byte(s, (Byte)(b >> 8)); -// put_byte(s, (Byte)(b & 0xff)); - s.pending_buf[s.pending++] = (b >>> 8) & 0xff; - s.pending_buf[s.pending++] = b & 0xff; -} - - -/* =========================================================================== - * Read a new buffer from the current input stream, update the adler32 - * and total number of bytes read. All deflate() input goes through - * this function so some applications may wish to modify it to avoid - * allocating a large strm->input buffer and copying from it. - * (See also flush_pending()). - */ -function read_buf(strm, buf, start, size) { - var len = strm.avail_in; - - if (len > size) { len = size; } - if (len === 0) { return 0; } - - strm.avail_in -= len; - - // zmemcpy(buf, strm->next_in, len); - utils.arraySet(buf, strm.input, strm.next_in, len, start); - if (strm.state.wrap === 1) { - strm.adler = adler32(strm.adler, buf, len, start); - } - - else if (strm.state.wrap === 2) { - strm.adler = crc32(strm.adler, buf, len, start); - } - - strm.next_in += len; - strm.total_in += len; - - return len; -} - - -/* =========================================================================== - * Set match_start to the longest match starting at the given string and - * return its length. Matches shorter or equal to prev_length are discarded, - * in which case the result is equal to prev_length and match_start is - * garbage. - * IN assertions: cur_match is the head of the hash chain for the current - * string (strstart) and its distance is <= MAX_DIST, and prev_length >= 1 - * OUT assertion: the match length is not greater than s->lookahead. - */ -function longest_match(s, cur_match) { - var chain_length = s.max_chain_length; /* max hash chain length */ - var scan = s.strstart; /* current string */ - var match; /* matched string */ - var len; /* length of current match */ - var best_len = s.prev_length; /* best match length so far */ - var nice_match = s.nice_match; /* stop if match long enough */ - var limit = (s.strstart > (s.w_size - MIN_LOOKAHEAD)) ? - s.strstart - (s.w_size - MIN_LOOKAHEAD) : 0/*NIL*/; - - var _win = s.window; // shortcut - - var wmask = s.w_mask; - var prev = s.prev; - - /* Stop when cur_match becomes <= limit. To simplify the code, - * we prevent matches with the string of window index 0. - */ - - var strend = s.strstart + MAX_MATCH; - var scan_end1 = _win[scan + best_len - 1]; - var scan_end = _win[scan + best_len]; - - /* The code is optimized for HASH_BITS >= 8 and MAX_MATCH-2 multiple of 16. - * It is easy to get rid of this optimization if necessary. - */ - // Assert(s->hash_bits >= 8 && MAX_MATCH == 258, "Code too clever"); - - /* Do not waste too much time if we already have a good match: */ - if (s.prev_length >= s.good_match) { - chain_length >>= 2; - } - /* Do not look for matches beyond the end of the input. This is necessary - * to make deflate deterministic. - */ - if (nice_match > s.lookahead) { nice_match = s.lookahead; } - - // Assert((ulg)s->strstart <= s->window_size-MIN_LOOKAHEAD, "need lookahead"); - - do { - // Assert(cur_match < s->strstart, "no future"); - match = cur_match; - - /* Skip to next match if the match length cannot increase - * or if the match length is less than 2. Note that the checks below - * for insufficient lookahead only occur occasionally for performance - * reasons. Therefore uninitialized memory will be accessed, and - * conditional jumps will be made that depend on those values. - * However the length of the match is limited to the lookahead, so - * the output of deflate is not affected by the uninitialized values. - */ - - if (_win[match + best_len] !== scan_end || - _win[match + best_len - 1] !== scan_end1 || - _win[match] !== _win[scan] || - _win[++match] !== _win[scan + 1]) { - continue; - } - - /* The check at best_len-1 can be removed because it will be made - * again later. (This heuristic is not always a win.) - * It is not necessary to compare scan[2] and match[2] since they - * are always equal when the other bytes match, given that - * the hash keys are equal and that HASH_BITS >= 8. - */ - scan += 2; - match++; - // Assert(*scan == *match, "match[2]?"); - - /* We check for insufficient lookahead only every 8th comparison; - * the 256th check will be made at strstart+258. - */ - do { - /*jshint noempty:false*/ - } while (_win[++scan] === _win[++match] && _win[++scan] === _win[++match] && - _win[++scan] === _win[++match] && _win[++scan] === _win[++match] && - _win[++scan] === _win[++match] && _win[++scan] === _win[++match] && - _win[++scan] === _win[++match] && _win[++scan] === _win[++match] && - scan < strend); - - // Assert(scan <= s->window+(unsigned)(s->window_size-1), "wild scan"); - - len = MAX_MATCH - (strend - scan); - scan = strend - MAX_MATCH; - - if (len > best_len) { - s.match_start = cur_match; - best_len = len; - if (len >= nice_match) { - break; - } - scan_end1 = _win[scan + best_len - 1]; - scan_end = _win[scan + best_len]; - } - } while ((cur_match = prev[cur_match & wmask]) > limit && --chain_length !== 0); - - if (best_len <= s.lookahead) { - return best_len; - } - return s.lookahead; -} - - -/* =========================================================================== - * Fill the window when the lookahead becomes insufficient. - * Updates strstart and lookahead. - * - * IN assertion: lookahead < MIN_LOOKAHEAD - * OUT assertions: strstart <= window_size-MIN_LOOKAHEAD - * At least one byte has been read, or avail_in == 0; reads are - * performed for at least two bytes (required for the zip translate_eol - * option -- not supported here). - */ -function fill_window(s) { - var _w_size = s.w_size; - var p, n, m, more, str; - - //Assert(s->lookahead < MIN_LOOKAHEAD, "already enough lookahead"); - - do { - more = s.window_size - s.lookahead - s.strstart; - - // JS ints have 32 bit, block below not needed - /* Deal with !@#$% 64K limit: */ - //if (sizeof(int) <= 2) { - // if (more == 0 && s->strstart == 0 && s->lookahead == 0) { - // more = wsize; - // - // } else if (more == (unsigned)(-1)) { - // /* Very unlikely, but possible on 16 bit machine if - // * strstart == 0 && lookahead == 1 (input done a byte at time) - // */ - // more--; - // } - //} - - - /* If the window is almost full and there is insufficient lookahead, - * move the upper half to the lower one to make room in the upper half. - */ - if (s.strstart >= _w_size + (_w_size - MIN_LOOKAHEAD)) { - - utils.arraySet(s.window, s.window, _w_size, _w_size, 0); - s.match_start -= _w_size; - s.strstart -= _w_size; - /* we now have strstart >= MAX_DIST */ - s.block_start -= _w_size; - - /* Slide the hash table (could be avoided with 32 bit values - at the expense of memory usage). We slide even when level == 0 - to keep the hash table consistent if we switch back to level > 0 - later. (Using level 0 permanently is not an optimal usage of - zlib, so we don't care about this pathological case.) - */ - - n = s.hash_size; - p = n; - do { - m = s.head[--p]; - s.head[p] = (m >= _w_size ? m - _w_size : 0); - } while (--n); - - n = _w_size; - p = n; - do { - m = s.prev[--p]; - s.prev[p] = (m >= _w_size ? m - _w_size : 0); - /* If n is not on any hash chain, prev[n] is garbage but - * its value will never be used. - */ - } while (--n); - - more += _w_size; - } - if (s.strm.avail_in === 0) { - break; - } - - /* If there was no sliding: - * strstart <= WSIZE+MAX_DIST-1 && lookahead <= MIN_LOOKAHEAD - 1 && - * more == window_size - lookahead - strstart - * => more >= window_size - (MIN_LOOKAHEAD-1 + WSIZE + MAX_DIST-1) - * => more >= window_size - 2*WSIZE + 2 - * In the BIG_MEM or MMAP case (not yet supported), - * window_size == input_size + MIN_LOOKAHEAD && - * strstart + s->lookahead <= input_size => more >= MIN_LOOKAHEAD. - * Otherwise, window_size == 2*WSIZE so more >= 2. - * If there was sliding, more >= WSIZE. So in all cases, more >= 2. - */ - //Assert(more >= 2, "more < 2"); - n = read_buf(s.strm, s.window, s.strstart + s.lookahead, more); - s.lookahead += n; - - /* Initialize the hash value now that we have some input: */ - if (s.lookahead + s.insert >= MIN_MATCH) { - str = s.strstart - s.insert; - s.ins_h = s.window[str]; - - /* UPDATE_HASH(s, s->ins_h, s->window[str + 1]); */ - s.ins_h = ((s.ins_h << s.hash_shift) ^ s.window[str + 1]) & s.hash_mask; -//#if MIN_MATCH != 3 -// Call update_hash() MIN_MATCH-3 more times -//#endif - while (s.insert) { - /* UPDATE_HASH(s, s->ins_h, s->window[str + MIN_MATCH-1]); */ - s.ins_h = ((s.ins_h << s.hash_shift) ^ s.window[str + MIN_MATCH - 1]) & s.hash_mask; - - s.prev[str & s.w_mask] = s.head[s.ins_h]; - s.head[s.ins_h] = str; - str++; - s.insert--; - if (s.lookahead + s.insert < MIN_MATCH) { - break; - } - } - } - /* If the whole input has less than MIN_MATCH bytes, ins_h is garbage, - * but this is not important since only literal bytes will be emitted. - */ - - } while (s.lookahead < MIN_LOOKAHEAD && s.strm.avail_in !== 0); - - /* If the WIN_INIT bytes after the end of the current data have never been - * written, then zero those bytes in order to avoid memory check reports of - * the use of uninitialized (or uninitialised as Julian writes) bytes by - * the longest match routines. Update the high water mark for the next - * time through here. WIN_INIT is set to MAX_MATCH since the longest match - * routines allow scanning to strstart + MAX_MATCH, ignoring lookahead. - */ -// if (s.high_water < s.window_size) { -// var curr = s.strstart + s.lookahead; -// var init = 0; -// -// if (s.high_water < curr) { -// /* Previous high water mark below current data -- zero WIN_INIT -// * bytes or up to end of window, whichever is less. -// */ -// init = s.window_size - curr; -// if (init > WIN_INIT) -// init = WIN_INIT; -// zmemzero(s->window + curr, (unsigned)init); -// s->high_water = curr + init; -// } -// else if (s->high_water < (ulg)curr + WIN_INIT) { -// /* High water mark at or above current data, but below current data -// * plus WIN_INIT -- zero out to current data plus WIN_INIT, or up -// * to end of window, whichever is less. -// */ -// init = (ulg)curr + WIN_INIT - s->high_water; -// if (init > s->window_size - s->high_water) -// init = s->window_size - s->high_water; -// zmemzero(s->window + s->high_water, (unsigned)init); -// s->high_water += init; -// } -// } -// -// Assert((ulg)s->strstart <= s->window_size - MIN_LOOKAHEAD, -// "not enough room for search"); -} - -/* =========================================================================== - * Copy without compression as much as possible from the input stream, return - * the current block state. - * This function does not insert new strings in the dictionary since - * uncompressible data is probably not useful. This function is used - * only for the level=0 compression option. - * NOTE: this function should be optimized to avoid extra copying from - * window to pending_buf. - */ -function deflate_stored(s, flush) { - /* Stored blocks are limited to 0xffff bytes, pending_buf is limited - * to pending_buf_size, and each stored block has a 5 byte header: - */ - var max_block_size = 0xffff; - - if (max_block_size > s.pending_buf_size - 5) { - max_block_size = s.pending_buf_size - 5; - } - - /* Copy as much as possible from input to output: */ - for (;;) { - /* Fill the window as much as possible: */ - if (s.lookahead <= 1) { - - //Assert(s->strstart < s->w_size+MAX_DIST(s) || - // s->block_start >= (long)s->w_size, "slide too late"); -// if (!(s.strstart < s.w_size + (s.w_size - MIN_LOOKAHEAD) || -// s.block_start >= s.w_size)) { -// throw new Error("slide too late"); -// } - - fill_window(s); - if (s.lookahead === 0 && flush === Z_NO_FLUSH) { - return BS_NEED_MORE; - } - - if (s.lookahead === 0) { - break; - } - /* flush the current block */ - } - //Assert(s->block_start >= 0L, "block gone"); -// if (s.block_start < 0) throw new Error("block gone"); - - s.strstart += s.lookahead; - s.lookahead = 0; - - /* Emit a stored block if pending_buf will be full: */ - var max_start = s.block_start + max_block_size; - - if (s.strstart === 0 || s.strstart >= max_start) { - /* strstart == 0 is possible when wraparound on 16-bit machine */ - s.lookahead = s.strstart - max_start; - s.strstart = max_start; - /*** FLUSH_BLOCK(s, 0); ***/ - flush_block_only(s, false); - if (s.strm.avail_out === 0) { - return BS_NEED_MORE; - } - /***/ - - - } - /* Flush if we may have to slide, otherwise block_start may become - * negative and the data will be gone: - */ - if (s.strstart - s.block_start >= (s.w_size - MIN_LOOKAHEAD)) { - /*** FLUSH_BLOCK(s, 0); ***/ - flush_block_only(s, false); - if (s.strm.avail_out === 0) { - return BS_NEED_MORE; - } - /***/ - } - } - - s.insert = 0; - - if (flush === Z_FINISH) { - /*** FLUSH_BLOCK(s, 1); ***/ - flush_block_only(s, true); - if (s.strm.avail_out === 0) { - return BS_FINISH_STARTED; - } - /***/ - return BS_FINISH_DONE; - } - - if (s.strstart > s.block_start) { - /*** FLUSH_BLOCK(s, 0); ***/ - flush_block_only(s, false); - if (s.strm.avail_out === 0) { - return BS_NEED_MORE; - } - /***/ - } - - return BS_NEED_MORE; -} - -/* =========================================================================== - * Compress as much as possible from the input stream, return the current - * block state. - * This function does not perform lazy evaluation of matches and inserts - * new strings in the dictionary only for unmatched strings or for short - * matches. It is used only for the fast compression options. - */ -function deflate_fast(s, flush) { - var hash_head; /* head of the hash chain */ - var bflush; /* set if current block must be flushed */ - - for (;;) { - /* Make sure that we always have enough lookahead, except - * at the end of the input file. We need MAX_MATCH bytes - * for the next match, plus MIN_MATCH bytes to insert the - * string following the next match. - */ - if (s.lookahead < MIN_LOOKAHEAD) { - fill_window(s); - if (s.lookahead < MIN_LOOKAHEAD && flush === Z_NO_FLUSH) { - return BS_NEED_MORE; - } - if (s.lookahead === 0) { - break; /* flush the current block */ - } - } - - /* Insert the string window[strstart .. strstart+2] in the - * dictionary, and set hash_head to the head of the hash chain: - */ - hash_head = 0/*NIL*/; - if (s.lookahead >= MIN_MATCH) { - /*** INSERT_STRING(s, s.strstart, hash_head); ***/ - s.ins_h = ((s.ins_h << s.hash_shift) ^ s.window[s.strstart + MIN_MATCH - 1]) & s.hash_mask; - hash_head = s.prev[s.strstart & s.w_mask] = s.head[s.ins_h]; - s.head[s.ins_h] = s.strstart; - /***/ - } - - /* Find the longest match, discarding those <= prev_length. - * At this point we have always match_length < MIN_MATCH - */ - if (hash_head !== 0/*NIL*/ && ((s.strstart - hash_head) <= (s.w_size - MIN_LOOKAHEAD))) { - /* To simplify the code, we prevent matches with the string - * of window index 0 (in particular we have to avoid a match - * of the string with itself at the start of the input file). - */ - s.match_length = longest_match(s, hash_head); - /* longest_match() sets match_start */ - } - if (s.match_length >= MIN_MATCH) { - // check_match(s, s.strstart, s.match_start, s.match_length); // for debug only - - /*** _tr_tally_dist(s, s.strstart - s.match_start, - s.match_length - MIN_MATCH, bflush); ***/ - bflush = trees._tr_tally(s, s.strstart - s.match_start, s.match_length - MIN_MATCH); - - s.lookahead -= s.match_length; - - /* Insert new strings in the hash table only if the match length - * is not too large. This saves time but degrades compression. - */ - if (s.match_length <= s.max_lazy_match/*max_insert_length*/ && s.lookahead >= MIN_MATCH) { - s.match_length--; /* string at strstart already in table */ - do { - s.strstart++; - /*** INSERT_STRING(s, s.strstart, hash_head); ***/ - s.ins_h = ((s.ins_h << s.hash_shift) ^ s.window[s.strstart + MIN_MATCH - 1]) & s.hash_mask; - hash_head = s.prev[s.strstart & s.w_mask] = s.head[s.ins_h]; - s.head[s.ins_h] = s.strstart; - /***/ - /* strstart never exceeds WSIZE-MAX_MATCH, so there are - * always MIN_MATCH bytes ahead. - */ - } while (--s.match_length !== 0); - s.strstart++; - } else - { - s.strstart += s.match_length; - s.match_length = 0; - s.ins_h = s.window[s.strstart]; - /* UPDATE_HASH(s, s.ins_h, s.window[s.strstart+1]); */ - s.ins_h = ((s.ins_h << s.hash_shift) ^ s.window[s.strstart + 1]) & s.hash_mask; - -//#if MIN_MATCH != 3 -// Call UPDATE_HASH() MIN_MATCH-3 more times -//#endif - /* If lookahead < MIN_MATCH, ins_h is garbage, but it does not - * matter since it will be recomputed at next deflate call. - */ - } - } else { - /* No match, output a literal byte */ - //Tracevv((stderr,"%c", s.window[s.strstart])); - /*** _tr_tally_lit(s, s.window[s.strstart], bflush); ***/ - bflush = trees._tr_tally(s, 0, s.window[s.strstart]); - - s.lookahead--; - s.strstart++; - } - if (bflush) { - /*** FLUSH_BLOCK(s, 0); ***/ - flush_block_only(s, false); - if (s.strm.avail_out === 0) { - return BS_NEED_MORE; - } - /***/ - } - } - s.insert = ((s.strstart < (MIN_MATCH - 1)) ? s.strstart : MIN_MATCH - 1); - if (flush === Z_FINISH) { - /*** FLUSH_BLOCK(s, 1); ***/ - flush_block_only(s, true); - if (s.strm.avail_out === 0) { - return BS_FINISH_STARTED; - } - /***/ - return BS_FINISH_DONE; - } - if (s.last_lit) { - /*** FLUSH_BLOCK(s, 0); ***/ - flush_block_only(s, false); - if (s.strm.avail_out === 0) { - return BS_NEED_MORE; - } - /***/ - } - return BS_BLOCK_DONE; -} - -/* =========================================================================== - * Same as above, but achieves better compression. We use a lazy - * evaluation for matches: a match is finally adopted only if there is - * no better match at the next window position. - */ -function deflate_slow(s, flush) { - var hash_head; /* head of hash chain */ - var bflush; /* set if current block must be flushed */ - - var max_insert; - - /* Process the input block. */ - for (;;) { - /* Make sure that we always have enough lookahead, except - * at the end of the input file. We need MAX_MATCH bytes - * for the next match, plus MIN_MATCH bytes to insert the - * string following the next match. - */ - if (s.lookahead < MIN_LOOKAHEAD) { - fill_window(s); - if (s.lookahead < MIN_LOOKAHEAD && flush === Z_NO_FLUSH) { - return BS_NEED_MORE; - } - if (s.lookahead === 0) { break; } /* flush the current block */ - } - - /* Insert the string window[strstart .. strstart+2] in the - * dictionary, and set hash_head to the head of the hash chain: - */ - hash_head = 0/*NIL*/; - if (s.lookahead >= MIN_MATCH) { - /*** INSERT_STRING(s, s.strstart, hash_head); ***/ - s.ins_h = ((s.ins_h << s.hash_shift) ^ s.window[s.strstart + MIN_MATCH - 1]) & s.hash_mask; - hash_head = s.prev[s.strstart & s.w_mask] = s.head[s.ins_h]; - s.head[s.ins_h] = s.strstart; - /***/ - } - - /* Find the longest match, discarding those <= prev_length. - */ - s.prev_length = s.match_length; - s.prev_match = s.match_start; - s.match_length = MIN_MATCH - 1; - - if (hash_head !== 0/*NIL*/ && s.prev_length < s.max_lazy_match && - s.strstart - hash_head <= (s.w_size - MIN_LOOKAHEAD)/*MAX_DIST(s)*/) { - /* To simplify the code, we prevent matches with the string - * of window index 0 (in particular we have to avoid a match - * of the string with itself at the start of the input file). - */ - s.match_length = longest_match(s, hash_head); - /* longest_match() sets match_start */ - - if (s.match_length <= 5 && - (s.strategy === Z_FILTERED || (s.match_length === MIN_MATCH && s.strstart - s.match_start > 4096/*TOO_FAR*/))) { - - /* If prev_match is also MIN_MATCH, match_start is garbage - * but we will ignore the current match anyway. - */ - s.match_length = MIN_MATCH - 1; - } - } - /* If there was a match at the previous step and the current - * match is not better, output the previous match: - */ - if (s.prev_length >= MIN_MATCH && s.match_length <= s.prev_length) { - max_insert = s.strstart + s.lookahead - MIN_MATCH; - /* Do not insert strings in hash table beyond this. */ - - //check_match(s, s.strstart-1, s.prev_match, s.prev_length); - - /***_tr_tally_dist(s, s.strstart - 1 - s.prev_match, - s.prev_length - MIN_MATCH, bflush);***/ - bflush = trees._tr_tally(s, s.strstart - 1 - s.prev_match, s.prev_length - MIN_MATCH); - /* Insert in hash table all strings up to the end of the match. - * strstart-1 and strstart are already inserted. If there is not - * enough lookahead, the last two strings are not inserted in - * the hash table. - */ - s.lookahead -= s.prev_length - 1; - s.prev_length -= 2; - do { - if (++s.strstart <= max_insert) { - /*** INSERT_STRING(s, s.strstart, hash_head); ***/ - s.ins_h = ((s.ins_h << s.hash_shift) ^ s.window[s.strstart + MIN_MATCH - 1]) & s.hash_mask; - hash_head = s.prev[s.strstart & s.w_mask] = s.head[s.ins_h]; - s.head[s.ins_h] = s.strstart; - /***/ - } - } while (--s.prev_length !== 0); - s.match_available = 0; - s.match_length = MIN_MATCH - 1; - s.strstart++; - - if (bflush) { - /*** FLUSH_BLOCK(s, 0); ***/ - flush_block_only(s, false); - if (s.strm.avail_out === 0) { - return BS_NEED_MORE; - } - /***/ - } - - } else if (s.match_available) { - /* If there was no match at the previous position, output a - * single literal. If there was a match but the current match - * is longer, truncate the previous match to a single literal. - */ - //Tracevv((stderr,"%c", s->window[s->strstart-1])); - /*** _tr_tally_lit(s, s.window[s.strstart-1], bflush); ***/ - bflush = trees._tr_tally(s, 0, s.window[s.strstart - 1]); - - if (bflush) { - /*** FLUSH_BLOCK_ONLY(s, 0) ***/ - flush_block_only(s, false); - /***/ - } - s.strstart++; - s.lookahead--; - if (s.strm.avail_out === 0) { - return BS_NEED_MORE; - } - } else { - /* There is no previous match to compare with, wait for - * the next step to decide. - */ - s.match_available = 1; - s.strstart++; - s.lookahead--; - } - } - //Assert (flush != Z_NO_FLUSH, "no flush?"); - if (s.match_available) { - //Tracevv((stderr,"%c", s->window[s->strstart-1])); - /*** _tr_tally_lit(s, s.window[s.strstart-1], bflush); ***/ - bflush = trees._tr_tally(s, 0, s.window[s.strstart - 1]); - - s.match_available = 0; - } - s.insert = s.strstart < MIN_MATCH - 1 ? s.strstart : MIN_MATCH - 1; - if (flush === Z_FINISH) { - /*** FLUSH_BLOCK(s, 1); ***/ - flush_block_only(s, true); - if (s.strm.avail_out === 0) { - return BS_FINISH_STARTED; - } - /***/ - return BS_FINISH_DONE; - } - if (s.last_lit) { - /*** FLUSH_BLOCK(s, 0); ***/ - flush_block_only(s, false); - if (s.strm.avail_out === 0) { - return BS_NEED_MORE; - } - /***/ - } - - return BS_BLOCK_DONE; -} - - -/* =========================================================================== - * For Z_RLE, simply look for runs of bytes, generate matches only of distance - * one. Do not maintain a hash table. (It will be regenerated if this run of - * deflate switches away from Z_RLE.) - */ -function deflate_rle(s, flush) { - var bflush; /* set if current block must be flushed */ - var prev; /* byte at distance one to match */ - var scan, strend; /* scan goes up to strend for length of run */ - - var _win = s.window; - - for (;;) { - /* Make sure that we always have enough lookahead, except - * at the end of the input file. We need MAX_MATCH bytes - * for the longest run, plus one for the unrolled loop. - */ - if (s.lookahead <= MAX_MATCH) { - fill_window(s); - if (s.lookahead <= MAX_MATCH && flush === Z_NO_FLUSH) { - return BS_NEED_MORE; - } - if (s.lookahead === 0) { break; } /* flush the current block */ - } - - /* See how many times the previous byte repeats */ - s.match_length = 0; - if (s.lookahead >= MIN_MATCH && s.strstart > 0) { - scan = s.strstart - 1; - prev = _win[scan]; - if (prev === _win[++scan] && prev === _win[++scan] && prev === _win[++scan]) { - strend = s.strstart + MAX_MATCH; - do { - /*jshint noempty:false*/ - } while (prev === _win[++scan] && prev === _win[++scan] && - prev === _win[++scan] && prev === _win[++scan] && - prev === _win[++scan] && prev === _win[++scan] && - prev === _win[++scan] && prev === _win[++scan] && - scan < strend); - s.match_length = MAX_MATCH - (strend - scan); - if (s.match_length > s.lookahead) { - s.match_length = s.lookahead; - } - } - //Assert(scan <= s->window+(uInt)(s->window_size-1), "wild scan"); - } - - /* Emit match if have run of MIN_MATCH or longer, else emit literal */ - if (s.match_length >= MIN_MATCH) { - //check_match(s, s.strstart, s.strstart - 1, s.match_length); - - /*** _tr_tally_dist(s, 1, s.match_length - MIN_MATCH, bflush); ***/ - bflush = trees._tr_tally(s, 1, s.match_length - MIN_MATCH); - - s.lookahead -= s.match_length; - s.strstart += s.match_length; - s.match_length = 0; - } else { - /* No match, output a literal byte */ - //Tracevv((stderr,"%c", s->window[s->strstart])); - /*** _tr_tally_lit(s, s.window[s.strstart], bflush); ***/ - bflush = trees._tr_tally(s, 0, s.window[s.strstart]); - - s.lookahead--; - s.strstart++; - } - if (bflush) { - /*** FLUSH_BLOCK(s, 0); ***/ - flush_block_only(s, false); - if (s.strm.avail_out === 0) { - return BS_NEED_MORE; - } - /***/ - } - } - s.insert = 0; - if (flush === Z_FINISH) { - /*** FLUSH_BLOCK(s, 1); ***/ - flush_block_only(s, true); - if (s.strm.avail_out === 0) { - return BS_FINISH_STARTED; - } - /***/ - return BS_FINISH_DONE; - } - if (s.last_lit) { - /*** FLUSH_BLOCK(s, 0); ***/ - flush_block_only(s, false); - if (s.strm.avail_out === 0) { - return BS_NEED_MORE; - } - /***/ - } - return BS_BLOCK_DONE; -} - -/* =========================================================================== - * For Z_HUFFMAN_ONLY, do not look for matches. Do not maintain a hash table. - * (It will be regenerated if this run of deflate switches away from Huffman.) - */ -function deflate_huff(s, flush) { - var bflush; /* set if current block must be flushed */ - - for (;;) { - /* Make sure that we have a literal to write. */ - if (s.lookahead === 0) { - fill_window(s); - if (s.lookahead === 0) { - if (flush === Z_NO_FLUSH) { - return BS_NEED_MORE; - } - break; /* flush the current block */ - } - } - - /* Output a literal byte */ - s.match_length = 0; - //Tracevv((stderr,"%c", s->window[s->strstart])); - /*** _tr_tally_lit(s, s.window[s.strstart], bflush); ***/ - bflush = trees._tr_tally(s, 0, s.window[s.strstart]); - s.lookahead--; - s.strstart++; - if (bflush) { - /*** FLUSH_BLOCK(s, 0); ***/ - flush_block_only(s, false); - if (s.strm.avail_out === 0) { - return BS_NEED_MORE; - } - /***/ - } - } - s.insert = 0; - if (flush === Z_FINISH) { - /*** FLUSH_BLOCK(s, 1); ***/ - flush_block_only(s, true); - if (s.strm.avail_out === 0) { - return BS_FINISH_STARTED; - } - /***/ - return BS_FINISH_DONE; - } - if (s.last_lit) { - /*** FLUSH_BLOCK(s, 0); ***/ - flush_block_only(s, false); - if (s.strm.avail_out === 0) { - return BS_NEED_MORE; - } - /***/ - } - return BS_BLOCK_DONE; -} - -/* Values for max_lazy_match, good_match and max_chain_length, depending on - * the desired pack level (0..9). The values given below have been tuned to - * exclude worst case performance for pathological files. Better values may be - * found for specific files. - */ -function Config(good_length, max_lazy, nice_length, max_chain, func) { - this.good_length = good_length; - this.max_lazy = max_lazy; - this.nice_length = nice_length; - this.max_chain = max_chain; - this.func = func; -} - -var configuration_table; - -configuration_table = [ - /* good lazy nice chain */ - new Config(0, 0, 0, 0, deflate_stored), /* 0 store only */ - new Config(4, 4, 8, 4, deflate_fast), /* 1 max speed, no lazy matches */ - new Config(4, 5, 16, 8, deflate_fast), /* 2 */ - new Config(4, 6, 32, 32, deflate_fast), /* 3 */ - - new Config(4, 4, 16, 16, deflate_slow), /* 4 lazy matches */ - new Config(8, 16, 32, 32, deflate_slow), /* 5 */ - new Config(8, 16, 128, 128, deflate_slow), /* 6 */ - new Config(8, 32, 128, 256, deflate_slow), /* 7 */ - new Config(32, 128, 258, 1024, deflate_slow), /* 8 */ - new Config(32, 258, 258, 4096, deflate_slow) /* 9 max compression */ -]; - - -/* =========================================================================== - * Initialize the "longest match" routines for a new zlib stream - */ -function lm_init(s) { - s.window_size = 2 * s.w_size; - - /*** CLEAR_HASH(s); ***/ - zero(s.head); // Fill with NIL (= 0); - - /* Set the default configuration parameters: - */ - s.max_lazy_match = configuration_table[s.level].max_lazy; - s.good_match = configuration_table[s.level].good_length; - s.nice_match = configuration_table[s.level].nice_length; - s.max_chain_length = configuration_table[s.level].max_chain; - - s.strstart = 0; - s.block_start = 0; - s.lookahead = 0; - s.insert = 0; - s.match_length = s.prev_length = MIN_MATCH - 1; - s.match_available = 0; - s.ins_h = 0; -} - - -function DeflateState() { - this.strm = null; /* pointer back to this zlib stream */ - this.status = 0; /* as the name implies */ - this.pending_buf = null; /* output still pending */ - this.pending_buf_size = 0; /* size of pending_buf */ - this.pending_out = 0; /* next pending byte to output to the stream */ - this.pending = 0; /* nb of bytes in the pending buffer */ - this.wrap = 0; /* bit 0 true for zlib, bit 1 true for gzip */ - this.gzhead = null; /* gzip header information to write */ - this.gzindex = 0; /* where in extra, name, or comment */ - this.method = Z_DEFLATED; /* can only be DEFLATED */ - this.last_flush = -1; /* value of flush param for previous deflate call */ - - this.w_size = 0; /* LZ77 window size (32K by default) */ - this.w_bits = 0; /* log2(w_size) (8..16) */ - this.w_mask = 0; /* w_size - 1 */ - - this.window = null; - /* Sliding window. Input bytes are read into the second half of the window, - * and move to the first half later to keep a dictionary of at least wSize - * bytes. With this organization, matches are limited to a distance of - * wSize-MAX_MATCH bytes, but this ensures that IO is always - * performed with a length multiple of the block size. - */ - - this.window_size = 0; - /* Actual size of window: 2*wSize, except when the user input buffer - * is directly used as sliding window. - */ - - this.prev = null; - /* Link to older string with same hash index. To limit the size of this - * array to 64K, this link is maintained only for the last 32K strings. - * An index in this array is thus a window index modulo 32K. - */ - - this.head = null; /* Heads of the hash chains or NIL. */ - - this.ins_h = 0; /* hash index of string to be inserted */ - this.hash_size = 0; /* number of elements in hash table */ - this.hash_bits = 0; /* log2(hash_size) */ - this.hash_mask = 0; /* hash_size-1 */ - - this.hash_shift = 0; - /* Number of bits by which ins_h must be shifted at each input - * step. It must be such that after MIN_MATCH steps, the oldest - * byte no longer takes part in the hash key, that is: - * hash_shift * MIN_MATCH >= hash_bits - */ - - this.block_start = 0; - /* Window position at the beginning of the current output block. Gets - * negative when the window is moved backwards. - */ - - this.match_length = 0; /* length of best match */ - this.prev_match = 0; /* previous match */ - this.match_available = 0; /* set if previous match exists */ - this.strstart = 0; /* start of string to insert */ - this.match_start = 0; /* start of matching string */ - this.lookahead = 0; /* number of valid bytes ahead in window */ - - this.prev_length = 0; - /* Length of the best match at previous step. Matches not greater than this - * are discarded. This is used in the lazy match evaluation. - */ - - this.max_chain_length = 0; - /* To speed up deflation, hash chains are never searched beyond this - * length. A higher limit improves compression ratio but degrades the - * speed. - */ - - this.max_lazy_match = 0; - /* Attempt to find a better match only when the current match is strictly - * smaller than this value. This mechanism is used only for compression - * levels >= 4. - */ - // That's alias to max_lazy_match, don't use directly - //this.max_insert_length = 0; - /* Insert new strings in the hash table only if the match length is not - * greater than this length. This saves time but degrades compression. - * max_insert_length is used only for compression levels <= 3. - */ - - this.level = 0; /* compression level (1..9) */ - this.strategy = 0; /* favor or force Huffman coding*/ - - this.good_match = 0; - /* Use a faster search when the previous match is longer than this */ - - this.nice_match = 0; /* Stop searching when current match exceeds this */ - - /* used by trees.c: */ - - /* Didn't use ct_data typedef below to suppress compiler warning */ - - // struct ct_data_s dyn_ltree[HEAP_SIZE]; /* literal and length tree */ - // struct ct_data_s dyn_dtree[2*D_CODES+1]; /* distance tree */ - // struct ct_data_s bl_tree[2*BL_CODES+1]; /* Huffman tree for bit lengths */ - - // Use flat array of DOUBLE size, with interleaved fata, - // because JS does not support effective - this.dyn_ltree = new utils.Buf16(HEAP_SIZE * 2); - this.dyn_dtree = new utils.Buf16((2 * D_CODES + 1) * 2); - this.bl_tree = new utils.Buf16((2 * BL_CODES + 1) * 2); - zero(this.dyn_ltree); - zero(this.dyn_dtree); - zero(this.bl_tree); - - this.l_desc = null; /* desc. for literal tree */ - this.d_desc = null; /* desc. for distance tree */ - this.bl_desc = null; /* desc. for bit length tree */ - - //ush bl_count[MAX_BITS+1]; - this.bl_count = new utils.Buf16(MAX_BITS + 1); - /* number of codes at each bit length for an optimal tree */ - - //int heap[2*L_CODES+1]; /* heap used to build the Huffman trees */ - this.heap = new utils.Buf16(2 * L_CODES + 1); /* heap used to build the Huffman trees */ - zero(this.heap); - - this.heap_len = 0; /* number of elements in the heap */ - this.heap_max = 0; /* element of largest frequency */ - /* The sons of heap[n] are heap[2*n] and heap[2*n+1]. heap[0] is not used. - * The same heap array is used to build all trees. - */ - - this.depth = new utils.Buf16(2 * L_CODES + 1); //uch depth[2*L_CODES+1]; - zero(this.depth); - /* Depth of each subtree used as tie breaker for trees of equal frequency - */ - - this.l_buf = 0; /* buffer index for literals or lengths */ - - this.lit_bufsize = 0; - /* Size of match buffer for literals/lengths. There are 4 reasons for - * limiting lit_bufsize to 64K: - * - frequencies can be kept in 16 bit counters - * - if compression is not successful for the first block, all input - * data is still in the window so we can still emit a stored block even - * when input comes from standard input. (This can also be done for - * all blocks if lit_bufsize is not greater than 32K.) - * - if compression is not successful for a file smaller than 64K, we can - * even emit a stored file instead of a stored block (saving 5 bytes). - * This is applicable only for zip (not gzip or zlib). - * - creating new Huffman trees less frequently may not provide fast - * adaptation to changes in the input data statistics. (Take for - * example a binary file with poorly compressible code followed by - * a highly compressible string table.) Smaller buffer sizes give - * fast adaptation but have of course the overhead of transmitting - * trees more frequently. - * - I can't count above 4 - */ - - this.last_lit = 0; /* running index in l_buf */ - - this.d_buf = 0; - /* Buffer index for distances. To simplify the code, d_buf and l_buf have - * the same number of elements. To use different lengths, an extra flag - * array would be necessary. - */ - - this.opt_len = 0; /* bit length of current block with optimal trees */ - this.static_len = 0; /* bit length of current block with static trees */ - this.matches = 0; /* number of string matches in current block */ - this.insert = 0; /* bytes at end of window left to insert */ - - - this.bi_buf = 0; - /* Output buffer. bits are inserted starting at the bottom (least - * significant bits). - */ - this.bi_valid = 0; - /* Number of valid bits in bi_buf. All bits above the last valid bit - * are always zero. - */ - - // Used for window memory init. We safely ignore it for JS. That makes - // sense only for pointers and memory check tools. - //this.high_water = 0; - /* High water mark offset in window for initialized bytes -- bytes above - * this are set to zero in order to avoid memory check warnings when - * longest match routines access bytes past the input. This is then - * updated to the new high water mark. - */ -} - - -function deflateResetKeep(strm) { - var s; - - if (!strm || !strm.state) { - return err(strm, Z_STREAM_ERROR); - } - - strm.total_in = strm.total_out = 0; - strm.data_type = Z_UNKNOWN; - - s = strm.state; - s.pending = 0; - s.pending_out = 0; - - if (s.wrap < 0) { - s.wrap = -s.wrap; - /* was made negative by deflate(..., Z_FINISH); */ - } - s.status = (s.wrap ? INIT_STATE : BUSY_STATE); - strm.adler = (s.wrap === 2) ? - 0 // crc32(0, Z_NULL, 0) - : - 1; // adler32(0, Z_NULL, 0) - s.last_flush = Z_NO_FLUSH; - trees._tr_init(s); - return Z_OK; -} - - -function deflateReset(strm) { - var ret = deflateResetKeep(strm); - if (ret === Z_OK) { - lm_init(strm.state); - } - return ret; -} - - -function deflateSetHeader(strm, head) { - if (!strm || !strm.state) { return Z_STREAM_ERROR; } - if (strm.state.wrap !== 2) { return Z_STREAM_ERROR; } - strm.state.gzhead = head; - return Z_OK; -} - - -function deflateInit2(strm, level, method, windowBits, memLevel, strategy) { - if (!strm) { // === Z_NULL - return Z_STREAM_ERROR; - } - var wrap = 1; - - if (level === Z_DEFAULT_COMPRESSION) { - level = 6; - } - - if (windowBits < 0) { /* suppress zlib wrapper */ - wrap = 0; - windowBits = -windowBits; - } - - else if (windowBits > 15) { - wrap = 2; /* write gzip wrapper instead */ - windowBits -= 16; - } - - - if (memLevel < 1 || memLevel > MAX_MEM_LEVEL || method !== Z_DEFLATED || - windowBits < 8 || windowBits > 15 || level < 0 || level > 9 || - strategy < 0 || strategy > Z_FIXED) { - return err(strm, Z_STREAM_ERROR); - } - - - if (windowBits === 8) { - windowBits = 9; - } - /* until 256-byte window bug fixed */ - - var s = new DeflateState(); - - strm.state = s; - s.strm = strm; - - s.wrap = wrap; - s.gzhead = null; - s.w_bits = windowBits; - s.w_size = 1 << s.w_bits; - s.w_mask = s.w_size - 1; - - s.hash_bits = memLevel + 7; - s.hash_size = 1 << s.hash_bits; - s.hash_mask = s.hash_size - 1; - s.hash_shift = ~~((s.hash_bits + MIN_MATCH - 1) / MIN_MATCH); - - s.window = new utils.Buf8(s.w_size * 2); - s.head = new utils.Buf16(s.hash_size); - s.prev = new utils.Buf16(s.w_size); - - // Don't need mem init magic for JS. - //s.high_water = 0; /* nothing written to s->window yet */ - - s.lit_bufsize = 1 << (memLevel + 6); /* 16K elements by default */ - - s.pending_buf_size = s.lit_bufsize * 4; - - //overlay = (ushf *) ZALLOC(strm, s->lit_bufsize, sizeof(ush)+2); - //s->pending_buf = (uchf *) overlay; - s.pending_buf = new utils.Buf8(s.pending_buf_size); - - // It is offset from `s.pending_buf` (size is `s.lit_bufsize * 2`) - //s->d_buf = overlay + s->lit_bufsize/sizeof(ush); - s.d_buf = 1 * s.lit_bufsize; - - //s->l_buf = s->pending_buf + (1+sizeof(ush))*s->lit_bufsize; - s.l_buf = (1 + 2) * s.lit_bufsize; - - s.level = level; - s.strategy = strategy; - s.method = method; - - return deflateReset(strm); -} - -function deflateInit(strm, level) { - return deflateInit2(strm, level, Z_DEFLATED, MAX_WBITS, DEF_MEM_LEVEL, Z_DEFAULT_STRATEGY); -} - - -function deflate(strm, flush) { - var old_flush, s; - var beg, val; // for gzip header write only - - if (!strm || !strm.state || - flush > Z_BLOCK || flush < 0) { - return strm ? err(strm, Z_STREAM_ERROR) : Z_STREAM_ERROR; - } - - s = strm.state; - - if (!strm.output || - (!strm.input && strm.avail_in !== 0) || - (s.status === FINISH_STATE && flush !== Z_FINISH)) { - return err(strm, (strm.avail_out === 0) ? Z_BUF_ERROR : Z_STREAM_ERROR); - } - - s.strm = strm; /* just in case */ - old_flush = s.last_flush; - s.last_flush = flush; - - /* Write the header */ - if (s.status === INIT_STATE) { - - if (s.wrap === 2) { // GZIP header - strm.adler = 0; //crc32(0L, Z_NULL, 0); - put_byte(s, 31); - put_byte(s, 139); - put_byte(s, 8); - if (!s.gzhead) { // s->gzhead == Z_NULL - put_byte(s, 0); - put_byte(s, 0); - put_byte(s, 0); - put_byte(s, 0); - put_byte(s, 0); - put_byte(s, s.level === 9 ? 2 : - (s.strategy >= Z_HUFFMAN_ONLY || s.level < 2 ? - 4 : 0)); - put_byte(s, OS_CODE); - s.status = BUSY_STATE; - } - else { - put_byte(s, (s.gzhead.text ? 1 : 0) + - (s.gzhead.hcrc ? 2 : 0) + - (!s.gzhead.extra ? 0 : 4) + - (!s.gzhead.name ? 0 : 8) + - (!s.gzhead.comment ? 0 : 16) - ); - put_byte(s, s.gzhead.time & 0xff); - put_byte(s, (s.gzhead.time >> 8) & 0xff); - put_byte(s, (s.gzhead.time >> 16) & 0xff); - put_byte(s, (s.gzhead.time >> 24) & 0xff); - put_byte(s, s.level === 9 ? 2 : - (s.strategy >= Z_HUFFMAN_ONLY || s.level < 2 ? - 4 : 0)); - put_byte(s, s.gzhead.os & 0xff); - if (s.gzhead.extra && s.gzhead.extra.length) { - put_byte(s, s.gzhead.extra.length & 0xff); - put_byte(s, (s.gzhead.extra.length >> 8) & 0xff); - } - if (s.gzhead.hcrc) { - strm.adler = crc32(strm.adler, s.pending_buf, s.pending, 0); - } - s.gzindex = 0; - s.status = EXTRA_STATE; - } - } - else // DEFLATE header - { - var header = (Z_DEFLATED + ((s.w_bits - 8) << 4)) << 8; - var level_flags = -1; - - if (s.strategy >= Z_HUFFMAN_ONLY || s.level < 2) { - level_flags = 0; - } else if (s.level < 6) { - level_flags = 1; - } else if (s.level === 6) { - level_flags = 2; - } else { - level_flags = 3; - } - header |= (level_flags << 6); - if (s.strstart !== 0) { header |= PRESET_DICT; } - header += 31 - (header % 31); - - s.status = BUSY_STATE; - putShortMSB(s, header); - - /* Save the adler32 of the preset dictionary: */ - if (s.strstart !== 0) { - putShortMSB(s, strm.adler >>> 16); - putShortMSB(s, strm.adler & 0xffff); - } - strm.adler = 1; // adler32(0L, Z_NULL, 0); - } - } - -//#ifdef GZIP - if (s.status === EXTRA_STATE) { - if (s.gzhead.extra/* != Z_NULL*/) { - beg = s.pending; /* start of bytes to update crc */ - - while (s.gzindex < (s.gzhead.extra.length & 0xffff)) { - if (s.pending === s.pending_buf_size) { - if (s.gzhead.hcrc && s.pending > beg) { - strm.adler = crc32(strm.adler, s.pending_buf, s.pending - beg, beg); - } - flush_pending(strm); - beg = s.pending; - if (s.pending === s.pending_buf_size) { - break; - } - } - put_byte(s, s.gzhead.extra[s.gzindex] & 0xff); - s.gzindex++; - } - if (s.gzhead.hcrc && s.pending > beg) { - strm.adler = crc32(strm.adler, s.pending_buf, s.pending - beg, beg); - } - if (s.gzindex === s.gzhead.extra.length) { - s.gzindex = 0; - s.status = NAME_STATE; - } - } - else { - s.status = NAME_STATE; - } - } - if (s.status === NAME_STATE) { - if (s.gzhead.name/* != Z_NULL*/) { - beg = s.pending; /* start of bytes to update crc */ - //int val; - - do { - if (s.pending === s.pending_buf_size) { - if (s.gzhead.hcrc && s.pending > beg) { - strm.adler = crc32(strm.adler, s.pending_buf, s.pending - beg, beg); - } - flush_pending(strm); - beg = s.pending; - if (s.pending === s.pending_buf_size) { - val = 1; - break; - } - } - // JS specific: little magic to add zero terminator to end of string - if (s.gzindex < s.gzhead.name.length) { - val = s.gzhead.name.charCodeAt(s.gzindex++) & 0xff; - } else { - val = 0; - } - put_byte(s, val); - } while (val !== 0); - - if (s.gzhead.hcrc && s.pending > beg) { - strm.adler = crc32(strm.adler, s.pending_buf, s.pending - beg, beg); - } - if (val === 0) { - s.gzindex = 0; - s.status = COMMENT_STATE; - } - } - else { - s.status = COMMENT_STATE; - } - } - if (s.status === COMMENT_STATE) { - if (s.gzhead.comment/* != Z_NULL*/) { - beg = s.pending; /* start of bytes to update crc */ - //int val; - - do { - if (s.pending === s.pending_buf_size) { - if (s.gzhead.hcrc && s.pending > beg) { - strm.adler = crc32(strm.adler, s.pending_buf, s.pending - beg, beg); - } - flush_pending(strm); - beg = s.pending; - if (s.pending === s.pending_buf_size) { - val = 1; - break; - } - } - // JS specific: little magic to add zero terminator to end of string - if (s.gzindex < s.gzhead.comment.length) { - val = s.gzhead.comment.charCodeAt(s.gzindex++) & 0xff; - } else { - val = 0; - } - put_byte(s, val); - } while (val !== 0); - - if (s.gzhead.hcrc && s.pending > beg) { - strm.adler = crc32(strm.adler, s.pending_buf, s.pending - beg, beg); - } - if (val === 0) { - s.status = HCRC_STATE; - } - } - else { - s.status = HCRC_STATE; - } - } - if (s.status === HCRC_STATE) { - if (s.gzhead.hcrc) { - if (s.pending + 2 > s.pending_buf_size) { - flush_pending(strm); - } - if (s.pending + 2 <= s.pending_buf_size) { - put_byte(s, strm.adler & 0xff); - put_byte(s, (strm.adler >> 8) & 0xff); - strm.adler = 0; //crc32(0L, Z_NULL, 0); - s.status = BUSY_STATE; - } - } - else { - s.status = BUSY_STATE; - } - } -//#endif - - /* Flush as much pending output as possible */ - if (s.pending !== 0) { - flush_pending(strm); - if (strm.avail_out === 0) { - /* Since avail_out is 0, deflate will be called again with - * more output space, but possibly with both pending and - * avail_in equal to zero. There won't be anything to do, - * but this is not an error situation so make sure we - * return OK instead of BUF_ERROR at next call of deflate: - */ - s.last_flush = -1; - return Z_OK; - } - - /* Make sure there is something to do and avoid duplicate consecutive - * flushes. For repeated and useless calls with Z_FINISH, we keep - * returning Z_STREAM_END instead of Z_BUF_ERROR. - */ - } else if (strm.avail_in === 0 && rank(flush) <= rank(old_flush) && - flush !== Z_FINISH) { - return err(strm, Z_BUF_ERROR); - } - - /* User must not provide more input after the first FINISH: */ - if (s.status === FINISH_STATE && strm.avail_in !== 0) { - return err(strm, Z_BUF_ERROR); - } - - /* Start a new block or continue the current one. - */ - if (strm.avail_in !== 0 || s.lookahead !== 0 || - (flush !== Z_NO_FLUSH && s.status !== FINISH_STATE)) { - var bstate = (s.strategy === Z_HUFFMAN_ONLY) ? deflate_huff(s, flush) : - (s.strategy === Z_RLE ? deflate_rle(s, flush) : - configuration_table[s.level].func(s, flush)); - - if (bstate === BS_FINISH_STARTED || bstate === BS_FINISH_DONE) { - s.status = FINISH_STATE; - } - if (bstate === BS_NEED_MORE || bstate === BS_FINISH_STARTED) { - if (strm.avail_out === 0) { - s.last_flush = -1; - /* avoid BUF_ERROR next call, see above */ - } - return Z_OK; - /* If flush != Z_NO_FLUSH && avail_out == 0, the next call - * of deflate should use the same flush parameter to make sure - * that the flush is complete. So we don't have to output an - * empty block here, this will be done at next call. This also - * ensures that for a very small output buffer, we emit at most - * one empty block. - */ - } - if (bstate === BS_BLOCK_DONE) { - if (flush === Z_PARTIAL_FLUSH) { - trees._tr_align(s); - } - else if (flush !== Z_BLOCK) { /* FULL_FLUSH or SYNC_FLUSH */ - - trees._tr_stored_block(s, 0, 0, false); - /* For a full flush, this empty block will be recognized - * as a special marker by inflate_sync(). - */ - if (flush === Z_FULL_FLUSH) { - /*** CLEAR_HASH(s); ***/ /* forget history */ - zero(s.head); // Fill with NIL (= 0); - - if (s.lookahead === 0) { - s.strstart = 0; - s.block_start = 0; - s.insert = 0; - } - } - } - flush_pending(strm); - if (strm.avail_out === 0) { - s.last_flush = -1; /* avoid BUF_ERROR at next call, see above */ - return Z_OK; - } - } - } - //Assert(strm->avail_out > 0, "bug2"); - //if (strm.avail_out <= 0) { throw new Error("bug2");} - - if (flush !== Z_FINISH) { return Z_OK; } - if (s.wrap <= 0) { return Z_STREAM_END; } - - /* Write the trailer */ - if (s.wrap === 2) { - put_byte(s, strm.adler & 0xff); - put_byte(s, (strm.adler >> 8) & 0xff); - put_byte(s, (strm.adler >> 16) & 0xff); - put_byte(s, (strm.adler >> 24) & 0xff); - put_byte(s, strm.total_in & 0xff); - put_byte(s, (strm.total_in >> 8) & 0xff); - put_byte(s, (strm.total_in >> 16) & 0xff); - put_byte(s, (strm.total_in >> 24) & 0xff); - } - else - { - putShortMSB(s, strm.adler >>> 16); - putShortMSB(s, strm.adler & 0xffff); - } - - flush_pending(strm); - /* If avail_out is zero, the application will call deflate again - * to flush the rest. - */ - if (s.wrap > 0) { s.wrap = -s.wrap; } - /* write the trailer only once! */ - return s.pending !== 0 ? Z_OK : Z_STREAM_END; -} - -function deflateEnd(strm) { - var status; - - if (!strm/*== Z_NULL*/ || !strm.state/*== Z_NULL*/) { - return Z_STREAM_ERROR; - } - - status = strm.state.status; - if (status !== INIT_STATE && - status !== EXTRA_STATE && - status !== NAME_STATE && - status !== COMMENT_STATE && - status !== HCRC_STATE && - status !== BUSY_STATE && - status !== FINISH_STATE - ) { - return err(strm, Z_STREAM_ERROR); - } - - strm.state = null; - - return status === BUSY_STATE ? err(strm, Z_DATA_ERROR) : Z_OK; -} - - -/* ========================================================================= - * Initializes the compression dictionary from the given byte - * sequence without producing any compressed output. - */ -function deflateSetDictionary(strm, dictionary) { - var dictLength = dictionary.length; - - var s; - var str, n; - var wrap; - var avail; - var next; - var input; - var tmpDict; - - if (!strm/*== Z_NULL*/ || !strm.state/*== Z_NULL*/) { - return Z_STREAM_ERROR; - } - - s = strm.state; - wrap = s.wrap; - - if (wrap === 2 || (wrap === 1 && s.status !== INIT_STATE) || s.lookahead) { - return Z_STREAM_ERROR; - } - - /* when using zlib wrappers, compute Adler-32 for provided dictionary */ - if (wrap === 1) { - /* adler32(strm->adler, dictionary, dictLength); */ - strm.adler = adler32(strm.adler, dictionary, dictLength, 0); - } - - s.wrap = 0; /* avoid computing Adler-32 in read_buf */ - - /* if dictionary would fill window, just replace the history */ - if (dictLength >= s.w_size) { - if (wrap === 0) { /* already empty otherwise */ - /*** CLEAR_HASH(s); ***/ - zero(s.head); // Fill with NIL (= 0); - s.strstart = 0; - s.block_start = 0; - s.insert = 0; - } - /* use the tail */ - // dictionary = dictionary.slice(dictLength - s.w_size); - tmpDict = new utils.Buf8(s.w_size); - utils.arraySet(tmpDict, dictionary, dictLength - s.w_size, s.w_size, 0); - dictionary = tmpDict; - dictLength = s.w_size; - } - /* insert dictionary into window and hash */ - avail = strm.avail_in; - next = strm.next_in; - input = strm.input; - strm.avail_in = dictLength; - strm.next_in = 0; - strm.input = dictionary; - fill_window(s); - while (s.lookahead >= MIN_MATCH) { - str = s.strstart; - n = s.lookahead - (MIN_MATCH - 1); - do { - /* UPDATE_HASH(s, s->ins_h, s->window[str + MIN_MATCH-1]); */ - s.ins_h = ((s.ins_h << s.hash_shift) ^ s.window[str + MIN_MATCH - 1]) & s.hash_mask; - - s.prev[str & s.w_mask] = s.head[s.ins_h]; - - s.head[s.ins_h] = str; - str++; - } while (--n); - s.strstart = str; - s.lookahead = MIN_MATCH - 1; - fill_window(s); - } - s.strstart += s.lookahead; - s.block_start = s.strstart; - s.insert = s.lookahead; - s.lookahead = 0; - s.match_length = s.prev_length = MIN_MATCH - 1; - s.match_available = 0; - strm.next_in = next; - strm.input = input; - strm.avail_in = avail; - s.wrap = wrap; - return Z_OK; -} - - -exports.deflateInit = deflateInit; -exports.deflateInit2 = deflateInit2; -exports.deflateReset = deflateReset; -exports.deflateResetKeep = deflateResetKeep; -exports.deflateSetHeader = deflateSetHeader; -exports.deflate = deflate; -exports.deflateEnd = deflateEnd; -exports.deflateSetDictionary = deflateSetDictionary; -exports.deflateInfo = 'pako deflate (from Nodeca project)'; - -/* Not implemented -exports.deflateBound = deflateBound; -exports.deflateCopy = deflateCopy; -exports.deflateParams = deflateParams; -exports.deflatePending = deflatePending; -exports.deflatePrime = deflatePrime; -exports.deflateTune = deflateTune; -*/ - -},{"../utils/common":172,"./adler32":174,"./crc32":176,"./messages":182,"./trees":183}],178:[function(require,module,exports){ -'use strict'; - -// (C) 1995-2013 Jean-loup Gailly and Mark Adler -// (C) 2014-2017 Vitaly Puzrin and Andrey Tupitsin -// -// This software is provided 'as-is', without any express or implied -// warranty. In no event will the authors be held liable for any damages -// arising from the use of this software. -// -// Permission is granted to anyone to use this software for any purpose, -// including commercial applications, and to alter it and redistribute it -// freely, subject to the following restrictions: -// -// 1. The origin of this software must not be misrepresented; you must not -// claim that you wrote the original software. If you use this software -// in a product, an acknowledgment in the product documentation would be -// appreciated but is not required. -// 2. Altered source versions must be plainly marked as such, and must not be -// misrepresented as being the original software. -// 3. This notice may not be removed or altered from any source distribution. - -function GZheader() { - /* true if compressed data believed to be text */ - this.text = 0; - /* modification time */ - this.time = 0; - /* extra flags (not used when writing a gzip file) */ - this.xflags = 0; - /* operating system */ - this.os = 0; - /* pointer to extra field or Z_NULL if none */ - this.extra = null; - /* extra field length (valid if extra != Z_NULL) */ - this.extra_len = 0; // Actually, we don't need it in JS, - // but leave for few code modifications - - // - // Setup limits is not necessary because in js we should not preallocate memory - // for inflate use constant limit in 65536 bytes - // - - /* space at extra (only when reading header) */ - // this.extra_max = 0; - /* pointer to zero-terminated file name or Z_NULL */ - this.name = ''; - /* space at name (only when reading header) */ - // this.name_max = 0; - /* pointer to zero-terminated comment or Z_NULL */ - this.comment = ''; - /* space at comment (only when reading header) */ - // this.comm_max = 0; - /* true if there was or will be a header crc */ - this.hcrc = 0; - /* true when done reading gzip header (not used when writing a gzip file) */ - this.done = false; -} - -module.exports = GZheader; - -},{}],179:[function(require,module,exports){ -'use strict'; - -// (C) 1995-2013 Jean-loup Gailly and Mark Adler -// (C) 2014-2017 Vitaly Puzrin and Andrey Tupitsin -// -// This software is provided 'as-is', without any express or implied -// warranty. In no event will the authors be held liable for any damages -// arising from the use of this software. -// -// Permission is granted to anyone to use this software for any purpose, -// including commercial applications, and to alter it and redistribute it -// freely, subject to the following restrictions: -// -// 1. The origin of this software must not be misrepresented; you must not -// claim that you wrote the original software. If you use this software -// in a product, an acknowledgment in the product documentation would be -// appreciated but is not required. -// 2. Altered source versions must be plainly marked as such, and must not be -// misrepresented as being the original software. -// 3. This notice may not be removed or altered from any source distribution. - -// See state defs from inflate.js -var BAD = 30; /* got a data error -- remain here until reset */ -var TYPE = 12; /* i: waiting for type bits, including last-flag bit */ - -/* - Decode literal, length, and distance codes and write out the resulting - literal and match bytes until either not enough input or output is - available, an end-of-block is encountered, or a data error is encountered. - When large enough input and output buffers are supplied to inflate(), for - example, a 16K input buffer and a 64K output buffer, more than 95% of the - inflate execution time is spent in this routine. - - Entry assumptions: - - state.mode === LEN - strm.avail_in >= 6 - strm.avail_out >= 258 - start >= strm.avail_out - state.bits < 8 - - On return, state.mode is one of: - - LEN -- ran out of enough output space or enough available input - TYPE -- reached end of block code, inflate() to interpret next block - BAD -- error in block data - - Notes: - - - The maximum input bits used by a length/distance pair is 15 bits for the - length code, 5 bits for the length extra, 15 bits for the distance code, - and 13 bits for the distance extra. This totals 48 bits, or six bytes. - Therefore if strm.avail_in >= 6, then there is enough input to avoid - checking for available input while decoding. - - - The maximum bytes that a single length/distance pair can output is 258 - bytes, which is the maximum length that can be coded. inflate_fast() - requires strm.avail_out >= 258 for each loop to avoid checking for - output space. - */ -module.exports = function inflate_fast(strm, start) { - var state; - var _in; /* local strm.input */ - var last; /* have enough input while in < last */ - var _out; /* local strm.output */ - var beg; /* inflate()'s initial strm.output */ - var end; /* while out < end, enough space available */ -//#ifdef INFLATE_STRICT - var dmax; /* maximum distance from zlib header */ -//#endif - var wsize; /* window size or zero if not using window */ - var whave; /* valid bytes in the window */ - var wnext; /* window write index */ - // Use `s_window` instead `window`, avoid conflict with instrumentation tools - var s_window; /* allocated sliding window, if wsize != 0 */ - var hold; /* local strm.hold */ - var bits; /* local strm.bits */ - var lcode; /* local strm.lencode */ - var dcode; /* local strm.distcode */ - var lmask; /* mask for first level of length codes */ - var dmask; /* mask for first level of distance codes */ - var here; /* retrieved table entry */ - var op; /* code bits, operation, extra bits, or */ - /* window position, window bytes to copy */ - var len; /* match length, unused bytes */ - var dist; /* match distance */ - var from; /* where to copy match from */ - var from_source; - - - var input, output; // JS specific, because we have no pointers - - /* copy state to local variables */ - state = strm.state; - //here = state.here; - _in = strm.next_in; - input = strm.input; - last = _in + (strm.avail_in - 5); - _out = strm.next_out; - output = strm.output; - beg = _out - (start - strm.avail_out); - end = _out + (strm.avail_out - 257); -//#ifdef INFLATE_STRICT - dmax = state.dmax; -//#endif - wsize = state.wsize; - whave = state.whave; - wnext = state.wnext; - s_window = state.window; - hold = state.hold; - bits = state.bits; - lcode = state.lencode; - dcode = state.distcode; - lmask = (1 << state.lenbits) - 1; - dmask = (1 << state.distbits) - 1; - - - /* decode literals and length/distances until end-of-block or not enough - input data or output space */ - - top: - do { - if (bits < 15) { - hold += input[_in++] << bits; - bits += 8; - hold += input[_in++] << bits; - bits += 8; - } - - here = lcode[hold & lmask]; - - dolen: - for (;;) { // Goto emulation - op = here >>> 24/*here.bits*/; - hold >>>= op; - bits -= op; - op = (here >>> 16) & 0xff/*here.op*/; - if (op === 0) { /* literal */ - //Tracevv((stderr, here.val >= 0x20 && here.val < 0x7f ? - // "inflate: literal '%c'\n" : - // "inflate: literal 0x%02x\n", here.val)); - output[_out++] = here & 0xffff/*here.val*/; - } - else if (op & 16) { /* length base */ - len = here & 0xffff/*here.val*/; - op &= 15; /* number of extra bits */ - if (op) { - if (bits < op) { - hold += input[_in++] << bits; - bits += 8; - } - len += hold & ((1 << op) - 1); - hold >>>= op; - bits -= op; - } - //Tracevv((stderr, "inflate: length %u\n", len)); - if (bits < 15) { - hold += input[_in++] << bits; - bits += 8; - hold += input[_in++] << bits; - bits += 8; - } - here = dcode[hold & dmask]; - - dodist: - for (;;) { // goto emulation - op = here >>> 24/*here.bits*/; - hold >>>= op; - bits -= op; - op = (here >>> 16) & 0xff/*here.op*/; - - if (op & 16) { /* distance base */ - dist = here & 0xffff/*here.val*/; - op &= 15; /* number of extra bits */ - if (bits < op) { - hold += input[_in++] << bits; - bits += 8; - if (bits < op) { - hold += input[_in++] << bits; - bits += 8; - } - } - dist += hold & ((1 << op) - 1); -//#ifdef INFLATE_STRICT - if (dist > dmax) { - strm.msg = 'invalid distance too far back'; - state.mode = BAD; - break top; - } -//#endif - hold >>>= op; - bits -= op; - //Tracevv((stderr, "inflate: distance %u\n", dist)); - op = _out - beg; /* max distance in output */ - if (dist > op) { /* see if copy from window */ - op = dist - op; /* distance back in window */ - if (op > whave) { - if (state.sane) { - strm.msg = 'invalid distance too far back'; - state.mode = BAD; - break top; - } - -// (!) This block is disabled in zlib defaults, -// don't enable it for binary compatibility -//#ifdef INFLATE_ALLOW_INVALID_DISTANCE_TOOFAR_ARRR -// if (len <= op - whave) { -// do { -// output[_out++] = 0; -// } while (--len); -// continue top; -// } -// len -= op - whave; -// do { -// output[_out++] = 0; -// } while (--op > whave); -// if (op === 0) { -// from = _out - dist; -// do { -// output[_out++] = output[from++]; -// } while (--len); -// continue top; -// } -//#endif - } - from = 0; // window index - from_source = s_window; - if (wnext === 0) { /* very common case */ - from += wsize - op; - if (op < len) { /* some from window */ - len -= op; - do { - output[_out++] = s_window[from++]; - } while (--op); - from = _out - dist; /* rest from output */ - from_source = output; - } - } - else if (wnext < op) { /* wrap around window */ - from += wsize + wnext - op; - op -= wnext; - if (op < len) { /* some from end of window */ - len -= op; - do { - output[_out++] = s_window[from++]; - } while (--op); - from = 0; - if (wnext < len) { /* some from start of window */ - op = wnext; - len -= op; - do { - output[_out++] = s_window[from++]; - } while (--op); - from = _out - dist; /* rest from output */ - from_source = output; - } - } - } - else { /* contiguous in window */ - from += wnext - op; - if (op < len) { /* some from window */ - len -= op; - do { - output[_out++] = s_window[from++]; - } while (--op); - from = _out - dist; /* rest from output */ - from_source = output; - } - } - while (len > 2) { - output[_out++] = from_source[from++]; - output[_out++] = from_source[from++]; - output[_out++] = from_source[from++]; - len -= 3; - } - if (len) { - output[_out++] = from_source[from++]; - if (len > 1) { - output[_out++] = from_source[from++]; - } - } - } - else { - from = _out - dist; /* copy direct from output */ - do { /* minimum length is three */ - output[_out++] = output[from++]; - output[_out++] = output[from++]; - output[_out++] = output[from++]; - len -= 3; - } while (len > 2); - if (len) { - output[_out++] = output[from++]; - if (len > 1) { - output[_out++] = output[from++]; - } - } - } - } - else if ((op & 64) === 0) { /* 2nd level distance code */ - here = dcode[(here & 0xffff)/*here.val*/ + (hold & ((1 << op) - 1))]; - continue dodist; - } - else { - strm.msg = 'invalid distance code'; - state.mode = BAD; - break top; - } - - break; // need to emulate goto via "continue" - } - } - else if ((op & 64) === 0) { /* 2nd level length code */ - here = lcode[(here & 0xffff)/*here.val*/ + (hold & ((1 << op) - 1))]; - continue dolen; - } - else if (op & 32) { /* end-of-block */ - //Tracevv((stderr, "inflate: end of block\n")); - state.mode = TYPE; - break top; - } - else { - strm.msg = 'invalid literal/length code'; - state.mode = BAD; - break top; - } - - break; // need to emulate goto via "continue" - } - } while (_in < last && _out < end); - - /* return unused bytes (on entry, bits < 8, so in won't go too far back) */ - len = bits >> 3; - _in -= len; - bits -= len << 3; - hold &= (1 << bits) - 1; - - /* update state and return */ - strm.next_in = _in; - strm.next_out = _out; - strm.avail_in = (_in < last ? 5 + (last - _in) : 5 - (_in - last)); - strm.avail_out = (_out < end ? 257 + (end - _out) : 257 - (_out - end)); - state.hold = hold; - state.bits = bits; - return; -}; - -},{}],180:[function(require,module,exports){ -'use strict'; - -// (C) 1995-2013 Jean-loup Gailly and Mark Adler -// (C) 2014-2017 Vitaly Puzrin and Andrey Tupitsin -// -// This software is provided 'as-is', without any express or implied -// warranty. In no event will the authors be held liable for any damages -// arising from the use of this software. -// -// Permission is granted to anyone to use this software for any purpose, -// including commercial applications, and to alter it and redistribute it -// freely, subject to the following restrictions: -// -// 1. The origin of this software must not be misrepresented; you must not -// claim that you wrote the original software. If you use this software -// in a product, an acknowledgment in the product documentation would be -// appreciated but is not required. -// 2. Altered source versions must be plainly marked as such, and must not be -// misrepresented as being the original software. -// 3. This notice may not be removed or altered from any source distribution. - -var utils = require('../utils/common'); -var adler32 = require('./adler32'); -var crc32 = require('./crc32'); -var inflate_fast = require('./inffast'); -var inflate_table = require('./inftrees'); - -var CODES = 0; -var LENS = 1; -var DISTS = 2; - -/* Public constants ==========================================================*/ -/* ===========================================================================*/ - - -/* Allowed flush values; see deflate() and inflate() below for details */ -//var Z_NO_FLUSH = 0; -//var Z_PARTIAL_FLUSH = 1; -//var Z_SYNC_FLUSH = 2; -//var Z_FULL_FLUSH = 3; -var Z_FINISH = 4; -var Z_BLOCK = 5; -var Z_TREES = 6; - - -/* Return codes for the compression/decompression functions. Negative values - * are errors, positive values are used for special but normal events. - */ -var Z_OK = 0; -var Z_STREAM_END = 1; -var Z_NEED_DICT = 2; -//var Z_ERRNO = -1; -var Z_STREAM_ERROR = -2; -var Z_DATA_ERROR = -3; -var Z_MEM_ERROR = -4; -var Z_BUF_ERROR = -5; -//var Z_VERSION_ERROR = -6; - -/* The deflate compression method */ -var Z_DEFLATED = 8; - - -/* STATES ====================================================================*/ -/* ===========================================================================*/ - - -var HEAD = 1; /* i: waiting for magic header */ -var FLAGS = 2; /* i: waiting for method and flags (gzip) */ -var TIME = 3; /* i: waiting for modification time (gzip) */ -var OS = 4; /* i: waiting for extra flags and operating system (gzip) */ -var EXLEN = 5; /* i: waiting for extra length (gzip) */ -var EXTRA = 6; /* i: waiting for extra bytes (gzip) */ -var NAME = 7; /* i: waiting for end of file name (gzip) */ -var COMMENT = 8; /* i: waiting for end of comment (gzip) */ -var HCRC = 9; /* i: waiting for header crc (gzip) */ -var DICTID = 10; /* i: waiting for dictionary check value */ -var DICT = 11; /* waiting for inflateSetDictionary() call */ -var TYPE = 12; /* i: waiting for type bits, including last-flag bit */ -var TYPEDO = 13; /* i: same, but skip check to exit inflate on new block */ -var STORED = 14; /* i: waiting for stored size (length and complement) */ -var COPY_ = 15; /* i/o: same as COPY below, but only first time in */ -var COPY = 16; /* i/o: waiting for input or output to copy stored block */ -var TABLE = 17; /* i: waiting for dynamic block table lengths */ -var LENLENS = 18; /* i: waiting for code length code lengths */ -var CODELENS = 19; /* i: waiting for length/lit and distance code lengths */ -var LEN_ = 20; /* i: same as LEN below, but only first time in */ -var LEN = 21; /* i: waiting for length/lit/eob code */ -var LENEXT = 22; /* i: waiting for length extra bits */ -var DIST = 23; /* i: waiting for distance code */ -var DISTEXT = 24; /* i: waiting for distance extra bits */ -var MATCH = 25; /* o: waiting for output space to copy string */ -var LIT = 26; /* o: waiting for output space to write literal */ -var CHECK = 27; /* i: waiting for 32-bit check value */ -var LENGTH = 28; /* i: waiting for 32-bit length (gzip) */ -var DONE = 29; /* finished check, done -- remain here until reset */ -var BAD = 30; /* got a data error -- remain here until reset */ -var MEM = 31; /* got an inflate() memory error -- remain here until reset */ -var SYNC = 32; /* looking for synchronization bytes to restart inflate() */ - -/* ===========================================================================*/ - - - -var ENOUGH_LENS = 852; -var ENOUGH_DISTS = 592; -//var ENOUGH = (ENOUGH_LENS+ENOUGH_DISTS); - -var MAX_WBITS = 15; -/* 32K LZ77 window */ -var DEF_WBITS = MAX_WBITS; - - -function zswap32(q) { - return (((q >>> 24) & 0xff) + - ((q >>> 8) & 0xff00) + - ((q & 0xff00) << 8) + - ((q & 0xff) << 24)); -} - - -function InflateState() { - this.mode = 0; /* current inflate mode */ - this.last = false; /* true if processing last block */ - this.wrap = 0; /* bit 0 true for zlib, bit 1 true for gzip */ - this.havedict = false; /* true if dictionary provided */ - this.flags = 0; /* gzip header method and flags (0 if zlib) */ - this.dmax = 0; /* zlib header max distance (INFLATE_STRICT) */ - this.check = 0; /* protected copy of check value */ - this.total = 0; /* protected copy of output count */ - // TODO: may be {} - this.head = null; /* where to save gzip header information */ - - /* sliding window */ - this.wbits = 0; /* log base 2 of requested window size */ - this.wsize = 0; /* window size or zero if not using window */ - this.whave = 0; /* valid bytes in the window */ - this.wnext = 0; /* window write index */ - this.window = null; /* allocated sliding window, if needed */ - - /* bit accumulator */ - this.hold = 0; /* input bit accumulator */ - this.bits = 0; /* number of bits in "in" */ - - /* for string and stored block copying */ - this.length = 0; /* literal or length of data to copy */ - this.offset = 0; /* distance back to copy string from */ - - /* for table and code decoding */ - this.extra = 0; /* extra bits needed */ - - /* fixed and dynamic code tables */ - this.lencode = null; /* starting table for length/literal codes */ - this.distcode = null; /* starting table for distance codes */ - this.lenbits = 0; /* index bits for lencode */ - this.distbits = 0; /* index bits for distcode */ - - /* dynamic table building */ - this.ncode = 0; /* number of code length code lengths */ - this.nlen = 0; /* number of length code lengths */ - this.ndist = 0; /* number of distance code lengths */ - this.have = 0; /* number of code lengths in lens[] */ - this.next = null; /* next available space in codes[] */ - - this.lens = new utils.Buf16(320); /* temporary storage for code lengths */ - this.work = new utils.Buf16(288); /* work area for code table building */ - - /* - because we don't have pointers in js, we use lencode and distcode directly - as buffers so we don't need codes - */ - //this.codes = new utils.Buf32(ENOUGH); /* space for code tables */ - this.lendyn = null; /* dynamic table for length/literal codes (JS specific) */ - this.distdyn = null; /* dynamic table for distance codes (JS specific) */ - this.sane = 0; /* if false, allow invalid distance too far */ - this.back = 0; /* bits back of last unprocessed length/lit */ - this.was = 0; /* initial length of match */ -} - -function inflateResetKeep(strm) { - var state; - - if (!strm || !strm.state) { return Z_STREAM_ERROR; } - state = strm.state; - strm.total_in = strm.total_out = state.total = 0; - strm.msg = ''; /*Z_NULL*/ - if (state.wrap) { /* to support ill-conceived Java test suite */ - strm.adler = state.wrap & 1; - } - state.mode = HEAD; - state.last = 0; - state.havedict = 0; - state.dmax = 32768; - state.head = null/*Z_NULL*/; - state.hold = 0; - state.bits = 0; - //state.lencode = state.distcode = state.next = state.codes; - state.lencode = state.lendyn = new utils.Buf32(ENOUGH_LENS); - state.distcode = state.distdyn = new utils.Buf32(ENOUGH_DISTS); - - state.sane = 1; - state.back = -1; - //Tracev((stderr, "inflate: reset\n")); - return Z_OK; -} - -function inflateReset(strm) { - var state; - - if (!strm || !strm.state) { return Z_STREAM_ERROR; } - state = strm.state; - state.wsize = 0; - state.whave = 0; - state.wnext = 0; - return inflateResetKeep(strm); - -} - -function inflateReset2(strm, windowBits) { - var wrap; - var state; - - /* get the state */ - if (!strm || !strm.state) { return Z_STREAM_ERROR; } - state = strm.state; - - /* extract wrap request from windowBits parameter */ - if (windowBits < 0) { - wrap = 0; - windowBits = -windowBits; - } - else { - wrap = (windowBits >> 4) + 1; - if (windowBits < 48) { - windowBits &= 15; - } - } - - /* set number of window bits, free window if different */ - if (windowBits && (windowBits < 8 || windowBits > 15)) { - return Z_STREAM_ERROR; - } - if (state.window !== null && state.wbits !== windowBits) { - state.window = null; - } - - /* update state and reset the rest of it */ - state.wrap = wrap; - state.wbits = windowBits; - return inflateReset(strm); -} - -function inflateInit2(strm, windowBits) { - var ret; - var state; - - if (!strm) { return Z_STREAM_ERROR; } - //strm.msg = Z_NULL; /* in case we return an error */ - - state = new InflateState(); - - //if (state === Z_NULL) return Z_MEM_ERROR; - //Tracev((stderr, "inflate: allocated\n")); - strm.state = state; - state.window = null/*Z_NULL*/; - ret = inflateReset2(strm, windowBits); - if (ret !== Z_OK) { - strm.state = null/*Z_NULL*/; - } - return ret; -} - -function inflateInit(strm) { - return inflateInit2(strm, DEF_WBITS); -} - - -/* - Return state with length and distance decoding tables and index sizes set to - fixed code decoding. Normally this returns fixed tables from inffixed.h. - If BUILDFIXED is defined, then instead this routine builds the tables the - first time it's called, and returns those tables the first time and - thereafter. This reduces the size of the code by about 2K bytes, in - exchange for a little execution time. However, BUILDFIXED should not be - used for threaded applications, since the rewriting of the tables and virgin - may not be thread-safe. - */ -var virgin = true; - -var lenfix, distfix; // We have no pointers in JS, so keep tables separate - -function fixedtables(state) { - /* build fixed huffman tables if first call (may not be thread safe) */ - if (virgin) { - var sym; - - lenfix = new utils.Buf32(512); - distfix = new utils.Buf32(32); - - /* literal/length table */ - sym = 0; - while (sym < 144) { state.lens[sym++] = 8; } - while (sym < 256) { state.lens[sym++] = 9; } - while (sym < 280) { state.lens[sym++] = 7; } - while (sym < 288) { state.lens[sym++] = 8; } - - inflate_table(LENS, state.lens, 0, 288, lenfix, 0, state.work, { bits: 9 }); - - /* distance table */ - sym = 0; - while (sym < 32) { state.lens[sym++] = 5; } - - inflate_table(DISTS, state.lens, 0, 32, distfix, 0, state.work, { bits: 5 }); - - /* do this just once */ - virgin = false; - } - - state.lencode = lenfix; - state.lenbits = 9; - state.distcode = distfix; - state.distbits = 5; -} - - -/* - Update the window with the last wsize (normally 32K) bytes written before - returning. If window does not exist yet, create it. This is only called - when a window is already in use, or when output has been written during this - inflate call, but the end of the deflate stream has not been reached yet. - It is also called to create a window for dictionary data when a dictionary - is loaded. - - Providing output buffers larger than 32K to inflate() should provide a speed - advantage, since only the last 32K of output is copied to the sliding window - upon return from inflate(), and since all distances after the first 32K of - output will fall in the output data, making match copies simpler and faster. - The advantage may be dependent on the size of the processor's data caches. - */ -function updatewindow(strm, src, end, copy) { - var dist; - var state = strm.state; - - /* if it hasn't been done already, allocate space for the window */ - if (state.window === null) { - state.wsize = 1 << state.wbits; - state.wnext = 0; - state.whave = 0; - - state.window = new utils.Buf8(state.wsize); - } - - /* copy state->wsize or less output bytes into the circular window */ - if (copy >= state.wsize) { - utils.arraySet(state.window, src, end - state.wsize, state.wsize, 0); - state.wnext = 0; - state.whave = state.wsize; - } - else { - dist = state.wsize - state.wnext; - if (dist > copy) { - dist = copy; - } - //zmemcpy(state->window + state->wnext, end - copy, dist); - utils.arraySet(state.window, src, end - copy, dist, state.wnext); - copy -= dist; - if (copy) { - //zmemcpy(state->window, end - copy, copy); - utils.arraySet(state.window, src, end - copy, copy, 0); - state.wnext = copy; - state.whave = state.wsize; - } - else { - state.wnext += dist; - if (state.wnext === state.wsize) { state.wnext = 0; } - if (state.whave < state.wsize) { state.whave += dist; } - } - } - return 0; -} - -function inflate(strm, flush) { - var state; - var input, output; // input/output buffers - var next; /* next input INDEX */ - var put; /* next output INDEX */ - var have, left; /* available input and output */ - var hold; /* bit buffer */ - var bits; /* bits in bit buffer */ - var _in, _out; /* save starting available input and output */ - var copy; /* number of stored or match bytes to copy */ - var from; /* where to copy match bytes from */ - var from_source; - var here = 0; /* current decoding table entry */ - var here_bits, here_op, here_val; // paked "here" denormalized (JS specific) - //var last; /* parent table entry */ - var last_bits, last_op, last_val; // paked "last" denormalized (JS specific) - var len; /* length to copy for repeats, bits to drop */ - var ret; /* return code */ - var hbuf = new utils.Buf8(4); /* buffer for gzip header crc calculation */ - var opts; - - var n; // temporary var for NEED_BITS - - var order = /* permutation of code lengths */ - [ 16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15 ]; - - - if (!strm || !strm.state || !strm.output || - (!strm.input && strm.avail_in !== 0)) { - return Z_STREAM_ERROR; - } - - state = strm.state; - if (state.mode === TYPE) { state.mode = TYPEDO; } /* skip check */ - - - //--- LOAD() --- - put = strm.next_out; - output = strm.output; - left = strm.avail_out; - next = strm.next_in; - input = strm.input; - have = strm.avail_in; - hold = state.hold; - bits = state.bits; - //--- - - _in = have; - _out = left; - ret = Z_OK; - - inf_leave: // goto emulation - for (;;) { - switch (state.mode) { - case HEAD: - if (state.wrap === 0) { - state.mode = TYPEDO; - break; - } - //=== NEEDBITS(16); - while (bits < 16) { - if (have === 0) { break inf_leave; } - have--; - hold += input[next++] << bits; - bits += 8; - } - //===// - if ((state.wrap & 2) && hold === 0x8b1f) { /* gzip header */ - state.check = 0/*crc32(0L, Z_NULL, 0)*/; - //=== CRC2(state.check, hold); - hbuf[0] = hold & 0xff; - hbuf[1] = (hold >>> 8) & 0xff; - state.check = crc32(state.check, hbuf, 2, 0); - //===// - - //=== INITBITS(); - hold = 0; - bits = 0; - //===// - state.mode = FLAGS; - break; - } - state.flags = 0; /* expect zlib header */ - if (state.head) { - state.head.done = false; - } - if (!(state.wrap & 1) || /* check if zlib header allowed */ - (((hold & 0xff)/*BITS(8)*/ << 8) + (hold >> 8)) % 31) { - strm.msg = 'incorrect header check'; - state.mode = BAD; - break; - } - if ((hold & 0x0f)/*BITS(4)*/ !== Z_DEFLATED) { - strm.msg = 'unknown compression method'; - state.mode = BAD; - break; - } - //--- DROPBITS(4) ---// - hold >>>= 4; - bits -= 4; - //---// - len = (hold & 0x0f)/*BITS(4)*/ + 8; - if (state.wbits === 0) { - state.wbits = len; - } - else if (len > state.wbits) { - strm.msg = 'invalid window size'; - state.mode = BAD; - break; - } - state.dmax = 1 << len; - //Tracev((stderr, "inflate: zlib header ok\n")); - strm.adler = state.check = 1/*adler32(0L, Z_NULL, 0)*/; - state.mode = hold & 0x200 ? DICTID : TYPE; - //=== INITBITS(); - hold = 0; - bits = 0; - //===// - break; - case FLAGS: - //=== NEEDBITS(16); */ - while (bits < 16) { - if (have === 0) { break inf_leave; } - have--; - hold += input[next++] << bits; - bits += 8; - } - //===// - state.flags = hold; - if ((state.flags & 0xff) !== Z_DEFLATED) { - strm.msg = 'unknown compression method'; - state.mode = BAD; - break; - } - if (state.flags & 0xe000) { - strm.msg = 'unknown header flags set'; - state.mode = BAD; - break; - } - if (state.head) { - state.head.text = ((hold >> 8) & 1); - } - if (state.flags & 0x0200) { - //=== CRC2(state.check, hold); - hbuf[0] = hold & 0xff; - hbuf[1] = (hold >>> 8) & 0xff; - state.check = crc32(state.check, hbuf, 2, 0); - //===// - } - //=== INITBITS(); - hold = 0; - bits = 0; - //===// - state.mode = TIME; - /* falls through */ - case TIME: - //=== NEEDBITS(32); */ - while (bits < 32) { - if (have === 0) { break inf_leave; } - have--; - hold += input[next++] << bits; - bits += 8; - } - //===// - if (state.head) { - state.head.time = hold; - } - if (state.flags & 0x0200) { - //=== CRC4(state.check, hold) - hbuf[0] = hold & 0xff; - hbuf[1] = (hold >>> 8) & 0xff; - hbuf[2] = (hold >>> 16) & 0xff; - hbuf[3] = (hold >>> 24) & 0xff; - state.check = crc32(state.check, hbuf, 4, 0); - //=== - } - //=== INITBITS(); - hold = 0; - bits = 0; - //===// - state.mode = OS; - /* falls through */ - case OS: - //=== NEEDBITS(16); */ - while (bits < 16) { - if (have === 0) { break inf_leave; } - have--; - hold += input[next++] << bits; - bits += 8; - } - //===// - if (state.head) { - state.head.xflags = (hold & 0xff); - state.head.os = (hold >> 8); - } - if (state.flags & 0x0200) { - //=== CRC2(state.check, hold); - hbuf[0] = hold & 0xff; - hbuf[1] = (hold >>> 8) & 0xff; - state.check = crc32(state.check, hbuf, 2, 0); - //===// - } - //=== INITBITS(); - hold = 0; - bits = 0; - //===// - state.mode = EXLEN; - /* falls through */ - case EXLEN: - if (state.flags & 0x0400) { - //=== NEEDBITS(16); */ - while (bits < 16) { - if (have === 0) { break inf_leave; } - have--; - hold += input[next++] << bits; - bits += 8; - } - //===// - state.length = hold; - if (state.head) { - state.head.extra_len = hold; - } - if (state.flags & 0x0200) { - //=== CRC2(state.check, hold); - hbuf[0] = hold & 0xff; - hbuf[1] = (hold >>> 8) & 0xff; - state.check = crc32(state.check, hbuf, 2, 0); - //===// - } - //=== INITBITS(); - hold = 0; - bits = 0; - //===// - } - else if (state.head) { - state.head.extra = null/*Z_NULL*/; - } - state.mode = EXTRA; - /* falls through */ - case EXTRA: - if (state.flags & 0x0400) { - copy = state.length; - if (copy > have) { copy = have; } - if (copy) { - if (state.head) { - len = state.head.extra_len - state.length; - if (!state.head.extra) { - // Use untyped array for more convenient processing later - state.head.extra = new Array(state.head.extra_len); - } - utils.arraySet( - state.head.extra, - input, - next, - // extra field is limited to 65536 bytes - // - no need for additional size check - copy, - /*len + copy > state.head.extra_max - len ? state.head.extra_max : copy,*/ - len - ); - //zmemcpy(state.head.extra + len, next, - // len + copy > state.head.extra_max ? - // state.head.extra_max - len : copy); - } - if (state.flags & 0x0200) { - state.check = crc32(state.check, input, copy, next); - } - have -= copy; - next += copy; - state.length -= copy; - } - if (state.length) { break inf_leave; } - } - state.length = 0; - state.mode = NAME; - /* falls through */ - case NAME: - if (state.flags & 0x0800) { - if (have === 0) { break inf_leave; } - copy = 0; - do { - // TODO: 2 or 1 bytes? - len = input[next + copy++]; - /* use constant limit because in js we should not preallocate memory */ - if (state.head && len && - (state.length < 65536 /*state.head.name_max*/)) { - state.head.name += String.fromCharCode(len); - } - } while (len && copy < have); - - if (state.flags & 0x0200) { - state.check = crc32(state.check, input, copy, next); - } - have -= copy; - next += copy; - if (len) { break inf_leave; } - } - else if (state.head) { - state.head.name = null; - } - state.length = 0; - state.mode = COMMENT; - /* falls through */ - case COMMENT: - if (state.flags & 0x1000) { - if (have === 0) { break inf_leave; } - copy = 0; - do { - len = input[next + copy++]; - /* use constant limit because in js we should not preallocate memory */ - if (state.head && len && - (state.length < 65536 /*state.head.comm_max*/)) { - state.head.comment += String.fromCharCode(len); - } - } while (len && copy < have); - if (state.flags & 0x0200) { - state.check = crc32(state.check, input, copy, next); - } - have -= copy; - next += copy; - if (len) { break inf_leave; } - } - else if (state.head) { - state.head.comment = null; - } - state.mode = HCRC; - /* falls through */ - case HCRC: - if (state.flags & 0x0200) { - //=== NEEDBITS(16); */ - while (bits < 16) { - if (have === 0) { break inf_leave; } - have--; - hold += input[next++] << bits; - bits += 8; - } - //===// - if (hold !== (state.check & 0xffff)) { - strm.msg = 'header crc mismatch'; - state.mode = BAD; - break; - } - //=== INITBITS(); - hold = 0; - bits = 0; - //===// - } - if (state.head) { - state.head.hcrc = ((state.flags >> 9) & 1); - state.head.done = true; - } - strm.adler = state.check = 0; - state.mode = TYPE; - break; - case DICTID: - //=== NEEDBITS(32); */ - while (bits < 32) { - if (have === 0) { break inf_leave; } - have--; - hold += input[next++] << bits; - bits += 8; - } - //===// - strm.adler = state.check = zswap32(hold); - //=== INITBITS(); - hold = 0; - bits = 0; - //===// - state.mode = DICT; - /* falls through */ - case DICT: - if (state.havedict === 0) { - //--- RESTORE() --- - strm.next_out = put; - strm.avail_out = left; - strm.next_in = next; - strm.avail_in = have; - state.hold = hold; - state.bits = bits; - //--- - return Z_NEED_DICT; - } - strm.adler = state.check = 1/*adler32(0L, Z_NULL, 0)*/; - state.mode = TYPE; - /* falls through */ - case TYPE: - if (flush === Z_BLOCK || flush === Z_TREES) { break inf_leave; } - /* falls through */ - case TYPEDO: - if (state.last) { - //--- BYTEBITS() ---// - hold >>>= bits & 7; - bits -= bits & 7; - //---// - state.mode = CHECK; - break; - } - //=== NEEDBITS(3); */ - while (bits < 3) { - if (have === 0) { break inf_leave; } - have--; - hold += input[next++] << bits; - bits += 8; - } - //===// - state.last = (hold & 0x01)/*BITS(1)*/; - //--- DROPBITS(1) ---// - hold >>>= 1; - bits -= 1; - //---// - - switch ((hold & 0x03)/*BITS(2)*/) { - case 0: /* stored block */ - //Tracev((stderr, "inflate: stored block%s\n", - // state.last ? " (last)" : "")); - state.mode = STORED; - break; - case 1: /* fixed block */ - fixedtables(state); - //Tracev((stderr, "inflate: fixed codes block%s\n", - // state.last ? " (last)" : "")); - state.mode = LEN_; /* decode codes */ - if (flush === Z_TREES) { - //--- DROPBITS(2) ---// - hold >>>= 2; - bits -= 2; - //---// - break inf_leave; - } - break; - case 2: /* dynamic block */ - //Tracev((stderr, "inflate: dynamic codes block%s\n", - // state.last ? " (last)" : "")); - state.mode = TABLE; - break; - case 3: - strm.msg = 'invalid block type'; - state.mode = BAD; - } - //--- DROPBITS(2) ---// - hold >>>= 2; - bits -= 2; - //---// - break; - case STORED: - //--- BYTEBITS() ---// /* go to byte boundary */ - hold >>>= bits & 7; - bits -= bits & 7; - //---// - //=== NEEDBITS(32); */ - while (bits < 32) { - if (have === 0) { break inf_leave; } - have--; - hold += input[next++] << bits; - bits += 8; - } - //===// - if ((hold & 0xffff) !== ((hold >>> 16) ^ 0xffff)) { - strm.msg = 'invalid stored block lengths'; - state.mode = BAD; - break; - } - state.length = hold & 0xffff; - //Tracev((stderr, "inflate: stored length %u\n", - // state.length)); - //=== INITBITS(); - hold = 0; - bits = 0; - //===// - state.mode = COPY_; - if (flush === Z_TREES) { break inf_leave; } - /* falls through */ - case COPY_: - state.mode = COPY; - /* falls through */ - case COPY: - copy = state.length; - if (copy) { - if (copy > have) { copy = have; } - if (copy > left) { copy = left; } - if (copy === 0) { break inf_leave; } - //--- zmemcpy(put, next, copy); --- - utils.arraySet(output, input, next, copy, put); - //---// - have -= copy; - next += copy; - left -= copy; - put += copy; - state.length -= copy; - break; - } - //Tracev((stderr, "inflate: stored end\n")); - state.mode = TYPE; - break; - case TABLE: - //=== NEEDBITS(14); */ - while (bits < 14) { - if (have === 0) { break inf_leave; } - have--; - hold += input[next++] << bits; - bits += 8; - } - //===// - state.nlen = (hold & 0x1f)/*BITS(5)*/ + 257; - //--- DROPBITS(5) ---// - hold >>>= 5; - bits -= 5; - //---// - state.ndist = (hold & 0x1f)/*BITS(5)*/ + 1; - //--- DROPBITS(5) ---// - hold >>>= 5; - bits -= 5; - //---// - state.ncode = (hold & 0x0f)/*BITS(4)*/ + 4; - //--- DROPBITS(4) ---// - hold >>>= 4; - bits -= 4; - //---// -//#ifndef PKZIP_BUG_WORKAROUND - if (state.nlen > 286 || state.ndist > 30) { - strm.msg = 'too many length or distance symbols'; - state.mode = BAD; - break; - } -//#endif - //Tracev((stderr, "inflate: table sizes ok\n")); - state.have = 0; - state.mode = LENLENS; - /* falls through */ - case LENLENS: - while (state.have < state.ncode) { - //=== NEEDBITS(3); - while (bits < 3) { - if (have === 0) { break inf_leave; } - have--; - hold += input[next++] << bits; - bits += 8; - } - //===// - state.lens[order[state.have++]] = (hold & 0x07);//BITS(3); - //--- DROPBITS(3) ---// - hold >>>= 3; - bits -= 3; - //---// - } - while (state.have < 19) { - state.lens[order[state.have++]] = 0; - } - // We have separate tables & no pointers. 2 commented lines below not needed. - //state.next = state.codes; - //state.lencode = state.next; - // Switch to use dynamic table - state.lencode = state.lendyn; - state.lenbits = 7; - - opts = { bits: state.lenbits }; - ret = inflate_table(CODES, state.lens, 0, 19, state.lencode, 0, state.work, opts); - state.lenbits = opts.bits; - - if (ret) { - strm.msg = 'invalid code lengths set'; - state.mode = BAD; - break; - } - //Tracev((stderr, "inflate: code lengths ok\n")); - state.have = 0; - state.mode = CODELENS; - /* falls through */ - case CODELENS: - while (state.have < state.nlen + state.ndist) { - for (;;) { - here = state.lencode[hold & ((1 << state.lenbits) - 1)];/*BITS(state.lenbits)*/ - here_bits = here >>> 24; - here_op = (here >>> 16) & 0xff; - here_val = here & 0xffff; - - if ((here_bits) <= bits) { break; } - //--- PULLBYTE() ---// - if (have === 0) { break inf_leave; } - have--; - hold += input[next++] << bits; - bits += 8; - //---// - } - if (here_val < 16) { - //--- DROPBITS(here.bits) ---// - hold >>>= here_bits; - bits -= here_bits; - //---// - state.lens[state.have++] = here_val; - } - else { - if (here_val === 16) { - //=== NEEDBITS(here.bits + 2); - n = here_bits + 2; - while (bits < n) { - if (have === 0) { break inf_leave; } - have--; - hold += input[next++] << bits; - bits += 8; - } - //===// - //--- DROPBITS(here.bits) ---// - hold >>>= here_bits; - bits -= here_bits; - //---// - if (state.have === 0) { - strm.msg = 'invalid bit length repeat'; - state.mode = BAD; - break; - } - len = state.lens[state.have - 1]; - copy = 3 + (hold & 0x03);//BITS(2); - //--- DROPBITS(2) ---// - hold >>>= 2; - bits -= 2; - //---// - } - else if (here_val === 17) { - //=== NEEDBITS(here.bits + 3); - n = here_bits + 3; - while (bits < n) { - if (have === 0) { break inf_leave; } - have--; - hold += input[next++] << bits; - bits += 8; - } - //===// - //--- DROPBITS(here.bits) ---// - hold >>>= here_bits; - bits -= here_bits; - //---// - len = 0; - copy = 3 + (hold & 0x07);//BITS(3); - //--- DROPBITS(3) ---// - hold >>>= 3; - bits -= 3; - //---// - } - else { - //=== NEEDBITS(here.bits + 7); - n = here_bits + 7; - while (bits < n) { - if (have === 0) { break inf_leave; } - have--; - hold += input[next++] << bits; - bits += 8; - } - //===// - //--- DROPBITS(here.bits) ---// - hold >>>= here_bits; - bits -= here_bits; - //---// - len = 0; - copy = 11 + (hold & 0x7f);//BITS(7); - //--- DROPBITS(7) ---// - hold >>>= 7; - bits -= 7; - //---// - } - if (state.have + copy > state.nlen + state.ndist) { - strm.msg = 'invalid bit length repeat'; - state.mode = BAD; - break; - } - while (copy--) { - state.lens[state.have++] = len; - } - } - } - - /* handle error breaks in while */ - if (state.mode === BAD) { break; } - - /* check for end-of-block code (better have one) */ - if (state.lens[256] === 0) { - strm.msg = 'invalid code -- missing end-of-block'; - state.mode = BAD; - break; - } - - /* build code tables -- note: do not change the lenbits or distbits - values here (9 and 6) without reading the comments in inftrees.h - concerning the ENOUGH constants, which depend on those values */ - state.lenbits = 9; - - opts = { bits: state.lenbits }; - ret = inflate_table(LENS, state.lens, 0, state.nlen, state.lencode, 0, state.work, opts); - // We have separate tables & no pointers. 2 commented lines below not needed. - // state.next_index = opts.table_index; - state.lenbits = opts.bits; - // state.lencode = state.next; - - if (ret) { - strm.msg = 'invalid literal/lengths set'; - state.mode = BAD; - break; - } - - state.distbits = 6; - //state.distcode.copy(state.codes); - // Switch to use dynamic table - state.distcode = state.distdyn; - opts = { bits: state.distbits }; - ret = inflate_table(DISTS, state.lens, state.nlen, state.ndist, state.distcode, 0, state.work, opts); - // We have separate tables & no pointers. 2 commented lines below not needed. - // state.next_index = opts.table_index; - state.distbits = opts.bits; - // state.distcode = state.next; - - if (ret) { - strm.msg = 'invalid distances set'; - state.mode = BAD; - break; - } - //Tracev((stderr, 'inflate: codes ok\n')); - state.mode = LEN_; - if (flush === Z_TREES) { break inf_leave; } - /* falls through */ - case LEN_: - state.mode = LEN; - /* falls through */ - case LEN: - if (have >= 6 && left >= 258) { - //--- RESTORE() --- - strm.next_out = put; - strm.avail_out = left; - strm.next_in = next; - strm.avail_in = have; - state.hold = hold; - state.bits = bits; - //--- - inflate_fast(strm, _out); - //--- LOAD() --- - put = strm.next_out; - output = strm.output; - left = strm.avail_out; - next = strm.next_in; - input = strm.input; - have = strm.avail_in; - hold = state.hold; - bits = state.bits; - //--- - - if (state.mode === TYPE) { - state.back = -1; - } - break; - } - state.back = 0; - for (;;) { - here = state.lencode[hold & ((1 << state.lenbits) - 1)]; /*BITS(state.lenbits)*/ - here_bits = here >>> 24; - here_op = (here >>> 16) & 0xff; - here_val = here & 0xffff; - - if (here_bits <= bits) { break; } - //--- PULLBYTE() ---// - if (have === 0) { break inf_leave; } - have--; - hold += input[next++] << bits; - bits += 8; - //---// - } - if (here_op && (here_op & 0xf0) === 0) { - last_bits = here_bits; - last_op = here_op; - last_val = here_val; - for (;;) { - here = state.lencode[last_val + - ((hold & ((1 << (last_bits + last_op)) - 1))/*BITS(last.bits + last.op)*/ >> last_bits)]; - here_bits = here >>> 24; - here_op = (here >>> 16) & 0xff; - here_val = here & 0xffff; - - if ((last_bits + here_bits) <= bits) { break; } - //--- PULLBYTE() ---// - if (have === 0) { break inf_leave; } - have--; - hold += input[next++] << bits; - bits += 8; - //---// - } - //--- DROPBITS(last.bits) ---// - hold >>>= last_bits; - bits -= last_bits; - //---// - state.back += last_bits; - } - //--- DROPBITS(here.bits) ---// - hold >>>= here_bits; - bits -= here_bits; - //---// - state.back += here_bits; - state.length = here_val; - if (here_op === 0) { - //Tracevv((stderr, here.val >= 0x20 && here.val < 0x7f ? - // "inflate: literal '%c'\n" : - // "inflate: literal 0x%02x\n", here.val)); - state.mode = LIT; - break; - } - if (here_op & 32) { - //Tracevv((stderr, "inflate: end of block\n")); - state.back = -1; - state.mode = TYPE; - break; - } - if (here_op & 64) { - strm.msg = 'invalid literal/length code'; - state.mode = BAD; - break; - } - state.extra = here_op & 15; - state.mode = LENEXT; - /* falls through */ - case LENEXT: - if (state.extra) { - //=== NEEDBITS(state.extra); - n = state.extra; - while (bits < n) { - if (have === 0) { break inf_leave; } - have--; - hold += input[next++] << bits; - bits += 8; - } - //===// - state.length += hold & ((1 << state.extra) - 1)/*BITS(state.extra)*/; - //--- DROPBITS(state.extra) ---// - hold >>>= state.extra; - bits -= state.extra; - //---// - state.back += state.extra; - } - //Tracevv((stderr, "inflate: length %u\n", state.length)); - state.was = state.length; - state.mode = DIST; - /* falls through */ - case DIST: - for (;;) { - here = state.distcode[hold & ((1 << state.distbits) - 1)];/*BITS(state.distbits)*/ - here_bits = here >>> 24; - here_op = (here >>> 16) & 0xff; - here_val = here & 0xffff; - - if ((here_bits) <= bits) { break; } - //--- PULLBYTE() ---// - if (have === 0) { break inf_leave; } - have--; - hold += input[next++] << bits; - bits += 8; - //---// - } - if ((here_op & 0xf0) === 0) { - last_bits = here_bits; - last_op = here_op; - last_val = here_val; - for (;;) { - here = state.distcode[last_val + - ((hold & ((1 << (last_bits + last_op)) - 1))/*BITS(last.bits + last.op)*/ >> last_bits)]; - here_bits = here >>> 24; - here_op = (here >>> 16) & 0xff; - here_val = here & 0xffff; - - if ((last_bits + here_bits) <= bits) { break; } - //--- PULLBYTE() ---// - if (have === 0) { break inf_leave; } - have--; - hold += input[next++] << bits; - bits += 8; - //---// - } - //--- DROPBITS(last.bits) ---// - hold >>>= last_bits; - bits -= last_bits; - //---// - state.back += last_bits; - } - //--- DROPBITS(here.bits) ---// - hold >>>= here_bits; - bits -= here_bits; - //---// - state.back += here_bits; - if (here_op & 64) { - strm.msg = 'invalid distance code'; - state.mode = BAD; - break; - } - state.offset = here_val; - state.extra = (here_op) & 15; - state.mode = DISTEXT; - /* falls through */ - case DISTEXT: - if (state.extra) { - //=== NEEDBITS(state.extra); - n = state.extra; - while (bits < n) { - if (have === 0) { break inf_leave; } - have--; - hold += input[next++] << bits; - bits += 8; - } - //===// - state.offset += hold & ((1 << state.extra) - 1)/*BITS(state.extra)*/; - //--- DROPBITS(state.extra) ---// - hold >>>= state.extra; - bits -= state.extra; - //---// - state.back += state.extra; - } -//#ifdef INFLATE_STRICT - if (state.offset > state.dmax) { - strm.msg = 'invalid distance too far back'; - state.mode = BAD; - break; - } -//#endif - //Tracevv((stderr, "inflate: distance %u\n", state.offset)); - state.mode = MATCH; - /* falls through */ - case MATCH: - if (left === 0) { break inf_leave; } - copy = _out - left; - if (state.offset > copy) { /* copy from window */ - copy = state.offset - copy; - if (copy > state.whave) { - if (state.sane) { - strm.msg = 'invalid distance too far back'; - state.mode = BAD; - break; - } -// (!) This block is disabled in zlib defaults, -// don't enable it for binary compatibility -//#ifdef INFLATE_ALLOW_INVALID_DISTANCE_TOOFAR_ARRR -// Trace((stderr, "inflate.c too far\n")); -// copy -= state.whave; -// if (copy > state.length) { copy = state.length; } -// if (copy > left) { copy = left; } -// left -= copy; -// state.length -= copy; -// do { -// output[put++] = 0; -// } while (--copy); -// if (state.length === 0) { state.mode = LEN; } -// break; -//#endif - } - if (copy > state.wnext) { - copy -= state.wnext; - from = state.wsize - copy; - } - else { - from = state.wnext - copy; - } - if (copy > state.length) { copy = state.length; } - from_source = state.window; - } - else { /* copy from output */ - from_source = output; - from = put - state.offset; - copy = state.length; - } - if (copy > left) { copy = left; } - left -= copy; - state.length -= copy; - do { - output[put++] = from_source[from++]; - } while (--copy); - if (state.length === 0) { state.mode = LEN; } - break; - case LIT: - if (left === 0) { break inf_leave; } - output[put++] = state.length; - left--; - state.mode = LEN; - break; - case CHECK: - if (state.wrap) { - //=== NEEDBITS(32); - while (bits < 32) { - if (have === 0) { break inf_leave; } - have--; - // Use '|' instead of '+' to make sure that result is signed - hold |= input[next++] << bits; - bits += 8; - } - //===// - _out -= left; - strm.total_out += _out; - state.total += _out; - if (_out) { - strm.adler = state.check = - /*UPDATE(state.check, put - _out, _out);*/ - (state.flags ? crc32(state.check, output, _out, put - _out) : adler32(state.check, output, _out, put - _out)); - - } - _out = left; - // NB: crc32 stored as signed 32-bit int, zswap32 returns signed too - if ((state.flags ? hold : zswap32(hold)) !== state.check) { - strm.msg = 'incorrect data check'; - state.mode = BAD; - break; - } - //=== INITBITS(); - hold = 0; - bits = 0; - //===// - //Tracev((stderr, "inflate: check matches trailer\n")); - } - state.mode = LENGTH; - /* falls through */ - case LENGTH: - if (state.wrap && state.flags) { - //=== NEEDBITS(32); - while (bits < 32) { - if (have === 0) { break inf_leave; } - have--; - hold += input[next++] << bits; - bits += 8; - } - //===// - if (hold !== (state.total & 0xffffffff)) { - strm.msg = 'incorrect length check'; - state.mode = BAD; - break; - } - //=== INITBITS(); - hold = 0; - bits = 0; - //===// - //Tracev((stderr, "inflate: length matches trailer\n")); - } - state.mode = DONE; - /* falls through */ - case DONE: - ret = Z_STREAM_END; - break inf_leave; - case BAD: - ret = Z_DATA_ERROR; - break inf_leave; - case MEM: - return Z_MEM_ERROR; - case SYNC: - /* falls through */ - default: - return Z_STREAM_ERROR; - } - } - - // inf_leave <- here is real place for "goto inf_leave", emulated via "break inf_leave" - - /* - Return from inflate(), updating the total counts and the check value. - If there was no progress during the inflate() call, return a buffer - error. Call updatewindow() to create and/or update the window state. - Note: a memory error from inflate() is non-recoverable. - */ - - //--- RESTORE() --- - strm.next_out = put; - strm.avail_out = left; - strm.next_in = next; - strm.avail_in = have; - state.hold = hold; - state.bits = bits; - //--- - - if (state.wsize || (_out !== strm.avail_out && state.mode < BAD && - (state.mode < CHECK || flush !== Z_FINISH))) { - if (updatewindow(strm, strm.output, strm.next_out, _out - strm.avail_out)) { - state.mode = MEM; - return Z_MEM_ERROR; - } - } - _in -= strm.avail_in; - _out -= strm.avail_out; - strm.total_in += _in; - strm.total_out += _out; - state.total += _out; - if (state.wrap && _out) { - strm.adler = state.check = /*UPDATE(state.check, strm.next_out - _out, _out);*/ - (state.flags ? crc32(state.check, output, _out, strm.next_out - _out) : adler32(state.check, output, _out, strm.next_out - _out)); - } - strm.data_type = state.bits + (state.last ? 64 : 0) + - (state.mode === TYPE ? 128 : 0) + - (state.mode === LEN_ || state.mode === COPY_ ? 256 : 0); - if (((_in === 0 && _out === 0) || flush === Z_FINISH) && ret === Z_OK) { - ret = Z_BUF_ERROR; - } - return ret; -} - -function inflateEnd(strm) { - - if (!strm || !strm.state /*|| strm->zfree == (free_func)0*/) { - return Z_STREAM_ERROR; - } - - var state = strm.state; - if (state.window) { - state.window = null; - } - strm.state = null; - return Z_OK; -} - -function inflateGetHeader(strm, head) { - var state; - - /* check state */ - if (!strm || !strm.state) { return Z_STREAM_ERROR; } - state = strm.state; - if ((state.wrap & 2) === 0) { return Z_STREAM_ERROR; } - - /* save header structure */ - state.head = head; - head.done = false; - return Z_OK; -} - -function inflateSetDictionary(strm, dictionary) { - var dictLength = dictionary.length; - - var state; - var dictid; - var ret; - - /* check state */ - if (!strm /* == Z_NULL */ || !strm.state /* == Z_NULL */) { return Z_STREAM_ERROR; } - state = strm.state; - - if (state.wrap !== 0 && state.mode !== DICT) { - return Z_STREAM_ERROR; - } - - /* check for correct dictionary identifier */ - if (state.mode === DICT) { - dictid = 1; /* adler32(0, null, 0)*/ - /* dictid = adler32(dictid, dictionary, dictLength); */ - dictid = adler32(dictid, dictionary, dictLength, 0); - if (dictid !== state.check) { - return Z_DATA_ERROR; - } - } - /* copy dictionary to window using updatewindow(), which will amend the - existing dictionary if appropriate */ - ret = updatewindow(strm, dictionary, dictLength, dictLength); - if (ret) { - state.mode = MEM; - return Z_MEM_ERROR; - } - state.havedict = 1; - // Tracev((stderr, "inflate: dictionary set\n")); - return Z_OK; -} - -exports.inflateReset = inflateReset; -exports.inflateReset2 = inflateReset2; -exports.inflateResetKeep = inflateResetKeep; -exports.inflateInit = inflateInit; -exports.inflateInit2 = inflateInit2; -exports.inflate = inflate; -exports.inflateEnd = inflateEnd; -exports.inflateGetHeader = inflateGetHeader; -exports.inflateSetDictionary = inflateSetDictionary; -exports.inflateInfo = 'pako inflate (from Nodeca project)'; - -/* Not implemented -exports.inflateCopy = inflateCopy; -exports.inflateGetDictionary = inflateGetDictionary; -exports.inflateMark = inflateMark; -exports.inflatePrime = inflatePrime; -exports.inflateSync = inflateSync; -exports.inflateSyncPoint = inflateSyncPoint; -exports.inflateUndermine = inflateUndermine; -*/ - -},{"../utils/common":172,"./adler32":174,"./crc32":176,"./inffast":179,"./inftrees":181}],181:[function(require,module,exports){ -'use strict'; - -// (C) 1995-2013 Jean-loup Gailly and Mark Adler -// (C) 2014-2017 Vitaly Puzrin and Andrey Tupitsin -// -// This software is provided 'as-is', without any express or implied -// warranty. In no event will the authors be held liable for any damages -// arising from the use of this software. -// -// Permission is granted to anyone to use this software for any purpose, -// including commercial applications, and to alter it and redistribute it -// freely, subject to the following restrictions: -// -// 1. The origin of this software must not be misrepresented; you must not -// claim that you wrote the original software. If you use this software -// in a product, an acknowledgment in the product documentation would be -// appreciated but is not required. -// 2. Altered source versions must be plainly marked as such, and must not be -// misrepresented as being the original software. -// 3. This notice may not be removed or altered from any source distribution. - -var utils = require('../utils/common'); - -var MAXBITS = 15; -var ENOUGH_LENS = 852; -var ENOUGH_DISTS = 592; -//var ENOUGH = (ENOUGH_LENS+ENOUGH_DISTS); - -var CODES = 0; -var LENS = 1; -var DISTS = 2; - -var lbase = [ /* Length codes 257..285 base */ - 3, 4, 5, 6, 7, 8, 9, 10, 11, 13, 15, 17, 19, 23, 27, 31, - 35, 43, 51, 59, 67, 83, 99, 115, 131, 163, 195, 227, 258, 0, 0 -]; - -var lext = [ /* Length codes 257..285 extra */ - 16, 16, 16, 16, 16, 16, 16, 16, 17, 17, 17, 17, 18, 18, 18, 18, - 19, 19, 19, 19, 20, 20, 20, 20, 21, 21, 21, 21, 16, 72, 78 -]; - -var dbase = [ /* Distance codes 0..29 base */ - 1, 2, 3, 4, 5, 7, 9, 13, 17, 25, 33, 49, 65, 97, 129, 193, - 257, 385, 513, 769, 1025, 1537, 2049, 3073, 4097, 6145, - 8193, 12289, 16385, 24577, 0, 0 -]; - -var dext = [ /* Distance codes 0..29 extra */ - 16, 16, 16, 16, 17, 17, 18, 18, 19, 19, 20, 20, 21, 21, 22, 22, - 23, 23, 24, 24, 25, 25, 26, 26, 27, 27, - 28, 28, 29, 29, 64, 64 -]; - -module.exports = function inflate_table(type, lens, lens_index, codes, table, table_index, work, opts) -{ - var bits = opts.bits; - //here = opts.here; /* table entry for duplication */ - - var len = 0; /* a code's length in bits */ - var sym = 0; /* index of code symbols */ - var min = 0, max = 0; /* minimum and maximum code lengths */ - var root = 0; /* number of index bits for root table */ - var curr = 0; /* number of index bits for current table */ - var drop = 0; /* code bits to drop for sub-table */ - var left = 0; /* number of prefix codes available */ - var used = 0; /* code entries in table used */ - var huff = 0; /* Huffman code */ - var incr; /* for incrementing code, index */ - var fill; /* index for replicating entries */ - var low; /* low bits for current root entry */ - var mask; /* mask for low root bits */ - var next; /* next available space in table */ - var base = null; /* base value table to use */ - var base_index = 0; -// var shoextra; /* extra bits table to use */ - var end; /* use base and extra for symbol > end */ - var count = new utils.Buf16(MAXBITS + 1); //[MAXBITS+1]; /* number of codes of each length */ - var offs = new utils.Buf16(MAXBITS + 1); //[MAXBITS+1]; /* offsets in table for each length */ - var extra = null; - var extra_index = 0; - - var here_bits, here_op, here_val; - - /* - Process a set of code lengths to create a canonical Huffman code. The - code lengths are lens[0..codes-1]. Each length corresponds to the - symbols 0..codes-1. The Huffman code is generated by first sorting the - symbols by length from short to long, and retaining the symbol order - for codes with equal lengths. Then the code starts with all zero bits - for the first code of the shortest length, and the codes are integer - increments for the same length, and zeros are appended as the length - increases. For the deflate format, these bits are stored backwards - from their more natural integer increment ordering, and so when the - decoding tables are built in the large loop below, the integer codes - are incremented backwards. - - This routine assumes, but does not check, that all of the entries in - lens[] are in the range 0..MAXBITS. The caller must assure this. - 1..MAXBITS is interpreted as that code length. zero means that that - symbol does not occur in this code. - - The codes are sorted by computing a count of codes for each length, - creating from that a table of starting indices for each length in the - sorted table, and then entering the symbols in order in the sorted - table. The sorted table is work[], with that space being provided by - the caller. - - The length counts are used for other purposes as well, i.e. finding - the minimum and maximum length codes, determining if there are any - codes at all, checking for a valid set of lengths, and looking ahead - at length counts to determine sub-table sizes when building the - decoding tables. - */ - - /* accumulate lengths for codes (assumes lens[] all in 0..MAXBITS) */ - for (len = 0; len <= MAXBITS; len++) { - count[len] = 0; - } - for (sym = 0; sym < codes; sym++) { - count[lens[lens_index + sym]]++; - } - - /* bound code lengths, force root to be within code lengths */ - root = bits; - for (max = MAXBITS; max >= 1; max--) { - if (count[max] !== 0) { break; } - } - if (root > max) { - root = max; - } - if (max === 0) { /* no symbols to code at all */ - //table.op[opts.table_index] = 64; //here.op = (var char)64; /* invalid code marker */ - //table.bits[opts.table_index] = 1; //here.bits = (var char)1; - //table.val[opts.table_index++] = 0; //here.val = (var short)0; - table[table_index++] = (1 << 24) | (64 << 16) | 0; - - - //table.op[opts.table_index] = 64; - //table.bits[opts.table_index] = 1; - //table.val[opts.table_index++] = 0; - table[table_index++] = (1 << 24) | (64 << 16) | 0; - - opts.bits = 1; - return 0; /* no symbols, but wait for decoding to report error */ - } - for (min = 1; min < max; min++) { - if (count[min] !== 0) { break; } - } - if (root < min) { - root = min; - } - - /* check for an over-subscribed or incomplete set of lengths */ - left = 1; - for (len = 1; len <= MAXBITS; len++) { - left <<= 1; - left -= count[len]; - if (left < 0) { - return -1; - } /* over-subscribed */ - } - if (left > 0 && (type === CODES || max !== 1)) { - return -1; /* incomplete set */ - } - - /* generate offsets into symbol table for each length for sorting */ - offs[1] = 0; - for (len = 1; len < MAXBITS; len++) { - offs[len + 1] = offs[len] + count[len]; - } - - /* sort symbols by length, by symbol order within each length */ - for (sym = 0; sym < codes; sym++) { - if (lens[lens_index + sym] !== 0) { - work[offs[lens[lens_index + sym]]++] = sym; - } - } - - /* - Create and fill in decoding tables. In this loop, the table being - filled is at next and has curr index bits. The code being used is huff - with length len. That code is converted to an index by dropping drop - bits off of the bottom. For codes where len is less than drop + curr, - those top drop + curr - len bits are incremented through all values to - fill the table with replicated entries. - - root is the number of index bits for the root table. When len exceeds - root, sub-tables are created pointed to by the root entry with an index - of the low root bits of huff. This is saved in low to check for when a - new sub-table should be started. drop is zero when the root table is - being filled, and drop is root when sub-tables are being filled. - - When a new sub-table is needed, it is necessary to look ahead in the - code lengths to determine what size sub-table is needed. The length - counts are used for this, and so count[] is decremented as codes are - entered in the tables. - - used keeps track of how many table entries have been allocated from the - provided *table space. It is checked for LENS and DIST tables against - the constants ENOUGH_LENS and ENOUGH_DISTS to guard against changes in - the initial root table size constants. See the comments in inftrees.h - for more information. - - sym increments through all symbols, and the loop terminates when - all codes of length max, i.e. all codes, have been processed. This - routine permits incomplete codes, so another loop after this one fills - in the rest of the decoding tables with invalid code markers. - */ - - /* set up for code type */ - // poor man optimization - use if-else instead of switch, - // to avoid deopts in old v8 - if (type === CODES) { - base = extra = work; /* dummy value--not used */ - end = 19; - - } else if (type === LENS) { - base = lbase; - base_index -= 257; - extra = lext; - extra_index -= 257; - end = 256; - - } else { /* DISTS */ - base = dbase; - extra = dext; - end = -1; - } - - /* initialize opts for loop */ - huff = 0; /* starting code */ - sym = 0; /* starting code symbol */ - len = min; /* starting code length */ - next = table_index; /* current table to fill in */ - curr = root; /* current table index bits */ - drop = 0; /* current bits to drop from code for index */ - low = -1; /* trigger new sub-table when len > root */ - used = 1 << root; /* use root table entries */ - mask = used - 1; /* mask for comparing low */ - - /* check available table space */ - if ((type === LENS && used > ENOUGH_LENS) || - (type === DISTS && used > ENOUGH_DISTS)) { - return 1; - } - - /* process all codes and make table entries */ - for (;;) { - /* create table entry */ - here_bits = len - drop; - if (work[sym] < end) { - here_op = 0; - here_val = work[sym]; - } - else if (work[sym] > end) { - here_op = extra[extra_index + work[sym]]; - here_val = base[base_index + work[sym]]; - } - else { - here_op = 32 + 64; /* end of block */ - here_val = 0; - } - - /* replicate for those indices with low len bits equal to huff */ - incr = 1 << (len - drop); - fill = 1 << curr; - min = fill; /* save offset to next table */ - do { - fill -= incr; - table[next + (huff >> drop) + fill] = (here_bits << 24) | (here_op << 16) | here_val |0; - } while (fill !== 0); - - /* backwards increment the len-bit code huff */ - incr = 1 << (len - 1); - while (huff & incr) { - incr >>= 1; - } - if (incr !== 0) { - huff &= incr - 1; - huff += incr; - } else { - huff = 0; - } - - /* go to next symbol, update count, len */ - sym++; - if (--count[len] === 0) { - if (len === max) { break; } - len = lens[lens_index + work[sym]]; - } - - /* create new sub-table if needed */ - if (len > root && (huff & mask) !== low) { - /* if first time, transition to sub-tables */ - if (drop === 0) { - drop = root; - } - - /* increment past last table */ - next += min; /* here min is 1 << curr */ - - /* determine length of next table */ - curr = len - drop; - left = 1 << curr; - while (curr + drop < max) { - left -= count[curr + drop]; - if (left <= 0) { break; } - curr++; - left <<= 1; - } - - /* check for enough space */ - used += 1 << curr; - if ((type === LENS && used > ENOUGH_LENS) || - (type === DISTS && used > ENOUGH_DISTS)) { - return 1; - } - - /* point entry in root table to sub-table */ - low = huff & mask; - /*table.op[low] = curr; - table.bits[low] = root; - table.val[low] = next - opts.table_index;*/ - table[low] = (root << 24) | (curr << 16) | (next - table_index) |0; - } - } - - /* fill in remaining table entry if code is incomplete (guaranteed to have - at most one remaining entry, since if the code is incomplete, the - maximum code length that was allowed to get this far is one bit) */ - if (huff !== 0) { - //table.op[next + huff] = 64; /* invalid code marker */ - //table.bits[next + huff] = len - drop; - //table.val[next + huff] = 0; - table[next + huff] = ((len - drop) << 24) | (64 << 16) |0; - } - - /* set return parameters */ - //opts.table_index += used; - opts.bits = root; - return 0; -}; - -},{"../utils/common":172}],182:[function(require,module,exports){ -'use strict'; - -// (C) 1995-2013 Jean-loup Gailly and Mark Adler -// (C) 2014-2017 Vitaly Puzrin and Andrey Tupitsin -// -// This software is provided 'as-is', without any express or implied -// warranty. In no event will the authors be held liable for any damages -// arising from the use of this software. -// -// Permission is granted to anyone to use this software for any purpose, -// including commercial applications, and to alter it and redistribute it -// freely, subject to the following restrictions: -// -// 1. The origin of this software must not be misrepresented; you must not -// claim that you wrote the original software. If you use this software -// in a product, an acknowledgment in the product documentation would be -// appreciated but is not required. -// 2. Altered source versions must be plainly marked as such, and must not be -// misrepresented as being the original software. -// 3. This notice may not be removed or altered from any source distribution. - -module.exports = { - 2: 'need dictionary', /* Z_NEED_DICT 2 */ - 1: 'stream end', /* Z_STREAM_END 1 */ - 0: '', /* Z_OK 0 */ - '-1': 'file error', /* Z_ERRNO (-1) */ - '-2': 'stream error', /* Z_STREAM_ERROR (-2) */ - '-3': 'data error', /* Z_DATA_ERROR (-3) */ - '-4': 'insufficient memory', /* Z_MEM_ERROR (-4) */ - '-5': 'buffer error', /* Z_BUF_ERROR (-5) */ - '-6': 'incompatible version' /* Z_VERSION_ERROR (-6) */ -}; - -},{}],183:[function(require,module,exports){ -'use strict'; - -// (C) 1995-2013 Jean-loup Gailly and Mark Adler -// (C) 2014-2017 Vitaly Puzrin and Andrey Tupitsin -// -// This software is provided 'as-is', without any express or implied -// warranty. In no event will the authors be held liable for any damages -// arising from the use of this software. -// -// Permission is granted to anyone to use this software for any purpose, -// including commercial applications, and to alter it and redistribute it -// freely, subject to the following restrictions: -// -// 1. The origin of this software must not be misrepresented; you must not -// claim that you wrote the original software. If you use this software -// in a product, an acknowledgment in the product documentation would be -// appreciated but is not required. -// 2. Altered source versions must be plainly marked as such, and must not be -// misrepresented as being the original software. -// 3. This notice may not be removed or altered from any source distribution. - -/* eslint-disable space-unary-ops */ - -var utils = require('../utils/common'); - -/* Public constants ==========================================================*/ -/* ===========================================================================*/ - - -//var Z_FILTERED = 1; -//var Z_HUFFMAN_ONLY = 2; -//var Z_RLE = 3; -var Z_FIXED = 4; -//var Z_DEFAULT_STRATEGY = 0; - -/* Possible values of the data_type field (though see inflate()) */ -var Z_BINARY = 0; -var Z_TEXT = 1; -//var Z_ASCII = 1; // = Z_TEXT -var Z_UNKNOWN = 2; - -/*============================================================================*/ - - -function zero(buf) { var len = buf.length; while (--len >= 0) { buf[len] = 0; } } - -// From zutil.h - -var STORED_BLOCK = 0; -var STATIC_TREES = 1; -var DYN_TREES = 2; -/* The three kinds of block type */ - -var MIN_MATCH = 3; -var MAX_MATCH = 258; -/* The minimum and maximum match lengths */ - -// From deflate.h -/* =========================================================================== - * Internal compression state. - */ - -var LENGTH_CODES = 29; -/* number of length codes, not counting the special END_BLOCK code */ - -var LITERALS = 256; -/* number of literal bytes 0..255 */ - -var L_CODES = LITERALS + 1 + LENGTH_CODES; -/* number of Literal or Length codes, including the END_BLOCK code */ - -var D_CODES = 30; -/* number of distance codes */ - -var BL_CODES = 19; -/* number of codes used to transfer the bit lengths */ - -var HEAP_SIZE = 2 * L_CODES + 1; -/* maximum heap size */ - -var MAX_BITS = 15; -/* All codes must not exceed MAX_BITS bits */ - -var Buf_size = 16; -/* size of bit buffer in bi_buf */ - - -/* =========================================================================== - * Constants - */ - -var MAX_BL_BITS = 7; -/* Bit length codes must not exceed MAX_BL_BITS bits */ - -var END_BLOCK = 256; -/* end of block literal code */ - -var REP_3_6 = 16; -/* repeat previous bit length 3-6 times (2 bits of repeat count) */ - -var REPZ_3_10 = 17; -/* repeat a zero length 3-10 times (3 bits of repeat count) */ - -var REPZ_11_138 = 18; -/* repeat a zero length 11-138 times (7 bits of repeat count) */ - -/* eslint-disable comma-spacing,array-bracket-spacing */ -var extra_lbits = /* extra bits for each length code */ - [0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0]; - -var extra_dbits = /* extra bits for each distance code */ - [0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13]; - -var extra_blbits = /* extra bits for each bit length code */ - [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7]; - -var bl_order = - [16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]; -/* eslint-enable comma-spacing,array-bracket-spacing */ - -/* The lengths of the bit length codes are sent in order of decreasing - * probability, to avoid transmitting the lengths for unused bit length codes. - */ - -/* =========================================================================== - * Local data. These are initialized only once. - */ - -// We pre-fill arrays with 0 to avoid uninitialized gaps - -var DIST_CODE_LEN = 512; /* see definition of array dist_code below */ - -// !!!! Use flat array instead of structure, Freq = i*2, Len = i*2+1 -var static_ltree = new Array((L_CODES + 2) * 2); -zero(static_ltree); -/* The static literal tree. Since the bit lengths are imposed, there is no - * need for the L_CODES extra codes used during heap construction. However - * The codes 286 and 287 are needed to build a canonical tree (see _tr_init - * below). - */ - -var static_dtree = new Array(D_CODES * 2); -zero(static_dtree); -/* The static distance tree. (Actually a trivial tree since all codes use - * 5 bits.) - */ - -var _dist_code = new Array(DIST_CODE_LEN); -zero(_dist_code); -/* Distance codes. The first 256 values correspond to the distances - * 3 .. 258, the last 256 values correspond to the top 8 bits of - * the 15 bit distances. - */ - -var _length_code = new Array(MAX_MATCH - MIN_MATCH + 1); -zero(_length_code); -/* length code for each normalized match length (0 == MIN_MATCH) */ - -var base_length = new Array(LENGTH_CODES); -zero(base_length); -/* First normalized length for each code (0 = MIN_MATCH) */ - -var base_dist = new Array(D_CODES); -zero(base_dist); -/* First normalized distance for each code (0 = distance of 1) */ - - -function StaticTreeDesc(static_tree, extra_bits, extra_base, elems, max_length) { - - this.static_tree = static_tree; /* static tree or NULL */ - this.extra_bits = extra_bits; /* extra bits for each code or NULL */ - this.extra_base = extra_base; /* base index for extra_bits */ - this.elems = elems; /* max number of elements in the tree */ - this.max_length = max_length; /* max bit length for the codes */ - - // show if `static_tree` has data or dummy - needed for monomorphic objects - this.has_stree = static_tree && static_tree.length; -} - - -var static_l_desc; -var static_d_desc; -var static_bl_desc; - - -function TreeDesc(dyn_tree, stat_desc) { - this.dyn_tree = dyn_tree; /* the dynamic tree */ - this.max_code = 0; /* largest code with non zero frequency */ - this.stat_desc = stat_desc; /* the corresponding static tree */ -} - - - -function d_code(dist) { - return dist < 256 ? _dist_code[dist] : _dist_code[256 + (dist >>> 7)]; -} - - -/* =========================================================================== - * Output a short LSB first on the stream. - * IN assertion: there is enough room in pendingBuf. - */ -function put_short(s, w) { -// put_byte(s, (uch)((w) & 0xff)); -// put_byte(s, (uch)((ush)(w) >> 8)); - s.pending_buf[s.pending++] = (w) & 0xff; - s.pending_buf[s.pending++] = (w >>> 8) & 0xff; -} - - -/* =========================================================================== - * Send a value on a given number of bits. - * IN assertion: length <= 16 and value fits in length bits. - */ -function send_bits(s, value, length) { - if (s.bi_valid > (Buf_size - length)) { - s.bi_buf |= (value << s.bi_valid) & 0xffff; - put_short(s, s.bi_buf); - s.bi_buf = value >> (Buf_size - s.bi_valid); - s.bi_valid += length - Buf_size; - } else { - s.bi_buf |= (value << s.bi_valid) & 0xffff; - s.bi_valid += length; - } -} - - -function send_code(s, c, tree) { - send_bits(s, tree[c * 2]/*.Code*/, tree[c * 2 + 1]/*.Len*/); -} - - -/* =========================================================================== - * Reverse the first len bits of a code, using straightforward code (a faster - * method would use a table) - * IN assertion: 1 <= len <= 15 - */ -function bi_reverse(code, len) { - var res = 0; - do { - res |= code & 1; - code >>>= 1; - res <<= 1; - } while (--len > 0); - return res >>> 1; -} - - -/* =========================================================================== - * Flush the bit buffer, keeping at most 7 bits in it. - */ -function bi_flush(s) { - if (s.bi_valid === 16) { - put_short(s, s.bi_buf); - s.bi_buf = 0; - s.bi_valid = 0; - - } else if (s.bi_valid >= 8) { - s.pending_buf[s.pending++] = s.bi_buf & 0xff; - s.bi_buf >>= 8; - s.bi_valid -= 8; - } -} - - -/* =========================================================================== - * Compute the optimal bit lengths for a tree and update the total bit length - * for the current block. - * IN assertion: the fields freq and dad are set, heap[heap_max] and - * above are the tree nodes sorted by increasing frequency. - * OUT assertions: the field len is set to the optimal bit length, the - * array bl_count contains the frequencies for each bit length. - * The length opt_len is updated; static_len is also updated if stree is - * not null. - */ -function gen_bitlen(s, desc) -// deflate_state *s; -// tree_desc *desc; /* the tree descriptor */ -{ - var tree = desc.dyn_tree; - var max_code = desc.max_code; - var stree = desc.stat_desc.static_tree; - var has_stree = desc.stat_desc.has_stree; - var extra = desc.stat_desc.extra_bits; - var base = desc.stat_desc.extra_base; - var max_length = desc.stat_desc.max_length; - var h; /* heap index */ - var n, m; /* iterate over the tree elements */ - var bits; /* bit length */ - var xbits; /* extra bits */ - var f; /* frequency */ - var overflow = 0; /* number of elements with bit length too large */ - - for (bits = 0; bits <= MAX_BITS; bits++) { - s.bl_count[bits] = 0; - } - - /* In a first pass, compute the optimal bit lengths (which may - * overflow in the case of the bit length tree). - */ - tree[s.heap[s.heap_max] * 2 + 1]/*.Len*/ = 0; /* root of the heap */ - - for (h = s.heap_max + 1; h < HEAP_SIZE; h++) { - n = s.heap[h]; - bits = tree[tree[n * 2 + 1]/*.Dad*/ * 2 + 1]/*.Len*/ + 1; - if (bits > max_length) { - bits = max_length; - overflow++; - } - tree[n * 2 + 1]/*.Len*/ = bits; - /* We overwrite tree[n].Dad which is no longer needed */ - - if (n > max_code) { continue; } /* not a leaf node */ - - s.bl_count[bits]++; - xbits = 0; - if (n >= base) { - xbits = extra[n - base]; - } - f = tree[n * 2]/*.Freq*/; - s.opt_len += f * (bits + xbits); - if (has_stree) { - s.static_len += f * (stree[n * 2 + 1]/*.Len*/ + xbits); - } - } - if (overflow === 0) { return; } - - // Trace((stderr,"\nbit length overflow\n")); - /* This happens for example on obj2 and pic of the Calgary corpus */ - - /* Find the first bit length which could increase: */ - do { - bits = max_length - 1; - while (s.bl_count[bits] === 0) { bits--; } - s.bl_count[bits]--; /* move one leaf down the tree */ - s.bl_count[bits + 1] += 2; /* move one overflow item as its brother */ - s.bl_count[max_length]--; - /* The brother of the overflow item also moves one step up, - * but this does not affect bl_count[max_length] - */ - overflow -= 2; - } while (overflow > 0); - - /* Now recompute all bit lengths, scanning in increasing frequency. - * h is still equal to HEAP_SIZE. (It is simpler to reconstruct all - * lengths instead of fixing only the wrong ones. This idea is taken - * from 'ar' written by Haruhiko Okumura.) - */ - for (bits = max_length; bits !== 0; bits--) { - n = s.bl_count[bits]; - while (n !== 0) { - m = s.heap[--h]; - if (m > max_code) { continue; } - if (tree[m * 2 + 1]/*.Len*/ !== bits) { - // Trace((stderr,"code %d bits %d->%d\n", m, tree[m].Len, bits)); - s.opt_len += (bits - tree[m * 2 + 1]/*.Len*/) * tree[m * 2]/*.Freq*/; - tree[m * 2 + 1]/*.Len*/ = bits; - } - n--; - } - } -} - - -/* =========================================================================== - * Generate the codes for a given tree and bit counts (which need not be - * optimal). - * IN assertion: the array bl_count contains the bit length statistics for - * the given tree and the field len is set for all tree elements. - * OUT assertion: the field code is set for all tree elements of non - * zero code length. - */ -function gen_codes(tree, max_code, bl_count) -// ct_data *tree; /* the tree to decorate */ -// int max_code; /* largest code with non zero frequency */ -// ushf *bl_count; /* number of codes at each bit length */ -{ - var next_code = new Array(MAX_BITS + 1); /* next code value for each bit length */ - var code = 0; /* running code value */ - var bits; /* bit index */ - var n; /* code index */ - - /* The distribution counts are first used to generate the code values - * without bit reversal. - */ - for (bits = 1; bits <= MAX_BITS; bits++) { - next_code[bits] = code = (code + bl_count[bits - 1]) << 1; - } - /* Check that the bit counts in bl_count are consistent. The last code - * must be all ones. - */ - //Assert (code + bl_count[MAX_BITS]-1 == (1< length code (0..28) */ - length = 0; - for (code = 0; code < LENGTH_CODES - 1; code++) { - base_length[code] = length; - for (n = 0; n < (1 << extra_lbits[code]); n++) { - _length_code[length++] = code; - } - } - //Assert (length == 256, "tr_static_init: length != 256"); - /* Note that the length 255 (match length 258) can be represented - * in two different ways: code 284 + 5 bits or code 285, so we - * overwrite length_code[255] to use the best encoding: - */ - _length_code[length - 1] = code; - - /* Initialize the mapping dist (0..32K) -> dist code (0..29) */ - dist = 0; - for (code = 0; code < 16; code++) { - base_dist[code] = dist; - for (n = 0; n < (1 << extra_dbits[code]); n++) { - _dist_code[dist++] = code; - } - } - //Assert (dist == 256, "tr_static_init: dist != 256"); - dist >>= 7; /* from now on, all distances are divided by 128 */ - for (; code < D_CODES; code++) { - base_dist[code] = dist << 7; - for (n = 0; n < (1 << (extra_dbits[code] - 7)); n++) { - _dist_code[256 + dist++] = code; - } - } - //Assert (dist == 256, "tr_static_init: 256+dist != 512"); - - /* Construct the codes of the static literal tree */ - for (bits = 0; bits <= MAX_BITS; bits++) { - bl_count[bits] = 0; - } - - n = 0; - while (n <= 143) { - static_ltree[n * 2 + 1]/*.Len*/ = 8; - n++; - bl_count[8]++; - } - while (n <= 255) { - static_ltree[n * 2 + 1]/*.Len*/ = 9; - n++; - bl_count[9]++; - } - while (n <= 279) { - static_ltree[n * 2 + 1]/*.Len*/ = 7; - n++; - bl_count[7]++; - } - while (n <= 287) { - static_ltree[n * 2 + 1]/*.Len*/ = 8; - n++; - bl_count[8]++; - } - /* Codes 286 and 287 do not exist, but we must include them in the - * tree construction to get a canonical Huffman tree (longest code - * all ones) - */ - gen_codes(static_ltree, L_CODES + 1, bl_count); - - /* The static distance tree is trivial: */ - for (n = 0; n < D_CODES; n++) { - static_dtree[n * 2 + 1]/*.Len*/ = 5; - static_dtree[n * 2]/*.Code*/ = bi_reverse(n, 5); - } - - // Now data ready and we can init static trees - static_l_desc = new StaticTreeDesc(static_ltree, extra_lbits, LITERALS + 1, L_CODES, MAX_BITS); - static_d_desc = new StaticTreeDesc(static_dtree, extra_dbits, 0, D_CODES, MAX_BITS); - static_bl_desc = new StaticTreeDesc(new Array(0), extra_blbits, 0, BL_CODES, MAX_BL_BITS); - - //static_init_done = true; -} - - -/* =========================================================================== - * Initialize a new block. - */ -function init_block(s) { - var n; /* iterates over tree elements */ - - /* Initialize the trees. */ - for (n = 0; n < L_CODES; n++) { s.dyn_ltree[n * 2]/*.Freq*/ = 0; } - for (n = 0; n < D_CODES; n++) { s.dyn_dtree[n * 2]/*.Freq*/ = 0; } - for (n = 0; n < BL_CODES; n++) { s.bl_tree[n * 2]/*.Freq*/ = 0; } - - s.dyn_ltree[END_BLOCK * 2]/*.Freq*/ = 1; - s.opt_len = s.static_len = 0; - s.last_lit = s.matches = 0; -} - - -/* =========================================================================== - * Flush the bit buffer and align the output on a byte boundary - */ -function bi_windup(s) -{ - if (s.bi_valid > 8) { - put_short(s, s.bi_buf); - } else if (s.bi_valid > 0) { - //put_byte(s, (Byte)s->bi_buf); - s.pending_buf[s.pending++] = s.bi_buf; - } - s.bi_buf = 0; - s.bi_valid = 0; -} - -/* =========================================================================== - * Copy a stored block, storing first the length and its - * one's complement if requested. - */ -function copy_block(s, buf, len, header) -//DeflateState *s; -//charf *buf; /* the input data */ -//unsigned len; /* its length */ -//int header; /* true if block header must be written */ -{ - bi_windup(s); /* align on byte boundary */ - - if (header) { - put_short(s, len); - put_short(s, ~len); - } -// while (len--) { -// put_byte(s, *buf++); -// } - utils.arraySet(s.pending_buf, s.window, buf, len, s.pending); - s.pending += len; -} - -/* =========================================================================== - * Compares to subtrees, using the tree depth as tie breaker when - * the subtrees have equal frequency. This minimizes the worst case length. - */ -function smaller(tree, n, m, depth) { - var _n2 = n * 2; - var _m2 = m * 2; - return (tree[_n2]/*.Freq*/ < tree[_m2]/*.Freq*/ || - (tree[_n2]/*.Freq*/ === tree[_m2]/*.Freq*/ && depth[n] <= depth[m])); -} - -/* =========================================================================== - * Restore the heap property by moving down the tree starting at node k, - * exchanging a node with the smallest of its two sons if necessary, stopping - * when the heap property is re-established (each father smaller than its - * two sons). - */ -function pqdownheap(s, tree, k) -// deflate_state *s; -// ct_data *tree; /* the tree to restore */ -// int k; /* node to move down */ -{ - var v = s.heap[k]; - var j = k << 1; /* left son of k */ - while (j <= s.heap_len) { - /* Set j to the smallest of the two sons: */ - if (j < s.heap_len && - smaller(tree, s.heap[j + 1], s.heap[j], s.depth)) { - j++; - } - /* Exit if v is smaller than both sons */ - if (smaller(tree, v, s.heap[j], s.depth)) { break; } - - /* Exchange v with the smallest son */ - s.heap[k] = s.heap[j]; - k = j; - - /* And continue down the tree, setting j to the left son of k */ - j <<= 1; - } - s.heap[k] = v; -} - - -// inlined manually -// var SMALLEST = 1; - -/* =========================================================================== - * Send the block data compressed using the given Huffman trees - */ -function compress_block(s, ltree, dtree) -// deflate_state *s; -// const ct_data *ltree; /* literal tree */ -// const ct_data *dtree; /* distance tree */ -{ - var dist; /* distance of matched string */ - var lc; /* match length or unmatched char (if dist == 0) */ - var lx = 0; /* running index in l_buf */ - var code; /* the code to send */ - var extra; /* number of extra bits to send */ - - if (s.last_lit !== 0) { - do { - dist = (s.pending_buf[s.d_buf + lx * 2] << 8) | (s.pending_buf[s.d_buf + lx * 2 + 1]); - lc = s.pending_buf[s.l_buf + lx]; - lx++; - - if (dist === 0) { - send_code(s, lc, ltree); /* send a literal byte */ - //Tracecv(isgraph(lc), (stderr," '%c' ", lc)); - } else { - /* Here, lc is the match length - MIN_MATCH */ - code = _length_code[lc]; - send_code(s, code + LITERALS + 1, ltree); /* send the length code */ - extra = extra_lbits[code]; - if (extra !== 0) { - lc -= base_length[code]; - send_bits(s, lc, extra); /* send the extra length bits */ - } - dist--; /* dist is now the match distance - 1 */ - code = d_code(dist); - //Assert (code < D_CODES, "bad d_code"); - - send_code(s, code, dtree); /* send the distance code */ - extra = extra_dbits[code]; - if (extra !== 0) { - dist -= base_dist[code]; - send_bits(s, dist, extra); /* send the extra distance bits */ - } - } /* literal or match pair ? */ - - /* Check that the overlay between pending_buf and d_buf+l_buf is ok: */ - //Assert((uInt)(s->pending) < s->lit_bufsize + 2*lx, - // "pendingBuf overflow"); - - } while (lx < s.last_lit); - } - - send_code(s, END_BLOCK, ltree); -} - - -/* =========================================================================== - * Construct one Huffman tree and assigns the code bit strings and lengths. - * Update the total bit length for the current block. - * IN assertion: the field freq is set for all tree elements. - * OUT assertions: the fields len and code are set to the optimal bit length - * and corresponding code. The length opt_len is updated; static_len is - * also updated if stree is not null. The field max_code is set. - */ -function build_tree(s, desc) -// deflate_state *s; -// tree_desc *desc; /* the tree descriptor */ -{ - var tree = desc.dyn_tree; - var stree = desc.stat_desc.static_tree; - var has_stree = desc.stat_desc.has_stree; - var elems = desc.stat_desc.elems; - var n, m; /* iterate over heap elements */ - var max_code = -1; /* largest code with non zero frequency */ - var node; /* new node being created */ - - /* Construct the initial heap, with least frequent element in - * heap[SMALLEST]. The sons of heap[n] are heap[2*n] and heap[2*n+1]. - * heap[0] is not used. - */ - s.heap_len = 0; - s.heap_max = HEAP_SIZE; - - for (n = 0; n < elems; n++) { - if (tree[n * 2]/*.Freq*/ !== 0) { - s.heap[++s.heap_len] = max_code = n; - s.depth[n] = 0; - - } else { - tree[n * 2 + 1]/*.Len*/ = 0; - } - } - - /* The pkzip format requires that at least one distance code exists, - * and that at least one bit should be sent even if there is only one - * possible code. So to avoid special checks later on we force at least - * two codes of non zero frequency. - */ - while (s.heap_len < 2) { - node = s.heap[++s.heap_len] = (max_code < 2 ? ++max_code : 0); - tree[node * 2]/*.Freq*/ = 1; - s.depth[node] = 0; - s.opt_len--; - - if (has_stree) { - s.static_len -= stree[node * 2 + 1]/*.Len*/; - } - /* node is 0 or 1 so it does not have extra bits */ - } - desc.max_code = max_code; - - /* The elements heap[heap_len/2+1 .. heap_len] are leaves of the tree, - * establish sub-heaps of increasing lengths: - */ - for (n = (s.heap_len >> 1/*int /2*/); n >= 1; n--) { pqdownheap(s, tree, n); } - - /* Construct the Huffman tree by repeatedly combining the least two - * frequent nodes. - */ - node = elems; /* next internal node of the tree */ - do { - //pqremove(s, tree, n); /* n = node of least frequency */ - /*** pqremove ***/ - n = s.heap[1/*SMALLEST*/]; - s.heap[1/*SMALLEST*/] = s.heap[s.heap_len--]; - pqdownheap(s, tree, 1/*SMALLEST*/); - /***/ - - m = s.heap[1/*SMALLEST*/]; /* m = node of next least frequency */ - - s.heap[--s.heap_max] = n; /* keep the nodes sorted by frequency */ - s.heap[--s.heap_max] = m; - - /* Create a new node father of n and m */ - tree[node * 2]/*.Freq*/ = tree[n * 2]/*.Freq*/ + tree[m * 2]/*.Freq*/; - s.depth[node] = (s.depth[n] >= s.depth[m] ? s.depth[n] : s.depth[m]) + 1; - tree[n * 2 + 1]/*.Dad*/ = tree[m * 2 + 1]/*.Dad*/ = node; - - /* and insert the new node in the heap */ - s.heap[1/*SMALLEST*/] = node++; - pqdownheap(s, tree, 1/*SMALLEST*/); - - } while (s.heap_len >= 2); - - s.heap[--s.heap_max] = s.heap[1/*SMALLEST*/]; - - /* At this point, the fields freq and dad are set. We can now - * generate the bit lengths. - */ - gen_bitlen(s, desc); - - /* The field len is now set, we can generate the bit codes */ - gen_codes(tree, max_code, s.bl_count); -} - - -/* =========================================================================== - * Scan a literal or distance tree to determine the frequencies of the codes - * in the bit length tree. - */ -function scan_tree(s, tree, max_code) -// deflate_state *s; -// ct_data *tree; /* the tree to be scanned */ -// int max_code; /* and its largest code of non zero frequency */ -{ - var n; /* iterates over all tree elements */ - var prevlen = -1; /* last emitted length */ - var curlen; /* length of current code */ - - var nextlen = tree[0 * 2 + 1]/*.Len*/; /* length of next code */ - - var count = 0; /* repeat count of the current code */ - var max_count = 7; /* max repeat count */ - var min_count = 4; /* min repeat count */ - - if (nextlen === 0) { - max_count = 138; - min_count = 3; - } - tree[(max_code + 1) * 2 + 1]/*.Len*/ = 0xffff; /* guard */ - - for (n = 0; n <= max_code; n++) { - curlen = nextlen; - nextlen = tree[(n + 1) * 2 + 1]/*.Len*/; - - if (++count < max_count && curlen === nextlen) { - continue; - - } else if (count < min_count) { - s.bl_tree[curlen * 2]/*.Freq*/ += count; - - } else if (curlen !== 0) { - - if (curlen !== prevlen) { s.bl_tree[curlen * 2]/*.Freq*/++; } - s.bl_tree[REP_3_6 * 2]/*.Freq*/++; - - } else if (count <= 10) { - s.bl_tree[REPZ_3_10 * 2]/*.Freq*/++; - - } else { - s.bl_tree[REPZ_11_138 * 2]/*.Freq*/++; - } - - count = 0; - prevlen = curlen; - - if (nextlen === 0) { - max_count = 138; - min_count = 3; - - } else if (curlen === nextlen) { - max_count = 6; - min_count = 3; - - } else { - max_count = 7; - min_count = 4; - } - } -} - - -/* =========================================================================== - * Send a literal or distance tree in compressed form, using the codes in - * bl_tree. - */ -function send_tree(s, tree, max_code) -// deflate_state *s; -// ct_data *tree; /* the tree to be scanned */ -// int max_code; /* and its largest code of non zero frequency */ -{ - var n; /* iterates over all tree elements */ - var prevlen = -1; /* last emitted length */ - var curlen; /* length of current code */ - - var nextlen = tree[0 * 2 + 1]/*.Len*/; /* length of next code */ - - var count = 0; /* repeat count of the current code */ - var max_count = 7; /* max repeat count */ - var min_count = 4; /* min repeat count */ - - /* tree[max_code+1].Len = -1; */ /* guard already set */ - if (nextlen === 0) { - max_count = 138; - min_count = 3; - } - - for (n = 0; n <= max_code; n++) { - curlen = nextlen; - nextlen = tree[(n + 1) * 2 + 1]/*.Len*/; - - if (++count < max_count && curlen === nextlen) { - continue; - - } else if (count < min_count) { - do { send_code(s, curlen, s.bl_tree); } while (--count !== 0); - - } else if (curlen !== 0) { - if (curlen !== prevlen) { - send_code(s, curlen, s.bl_tree); - count--; - } - //Assert(count >= 3 && count <= 6, " 3_6?"); - send_code(s, REP_3_6, s.bl_tree); - send_bits(s, count - 3, 2); - - } else if (count <= 10) { - send_code(s, REPZ_3_10, s.bl_tree); - send_bits(s, count - 3, 3); - - } else { - send_code(s, REPZ_11_138, s.bl_tree); - send_bits(s, count - 11, 7); - } - - count = 0; - prevlen = curlen; - if (nextlen === 0) { - max_count = 138; - min_count = 3; - - } else if (curlen === nextlen) { - max_count = 6; - min_count = 3; - - } else { - max_count = 7; - min_count = 4; - } - } -} - - -/* =========================================================================== - * Construct the Huffman tree for the bit lengths and return the index in - * bl_order of the last bit length code to send. - */ -function build_bl_tree(s) { - var max_blindex; /* index of last bit length code of non zero freq */ - - /* Determine the bit length frequencies for literal and distance trees */ - scan_tree(s, s.dyn_ltree, s.l_desc.max_code); - scan_tree(s, s.dyn_dtree, s.d_desc.max_code); - - /* Build the bit length tree: */ - build_tree(s, s.bl_desc); - /* opt_len now includes the length of the tree representations, except - * the lengths of the bit lengths codes and the 5+5+4 bits for the counts. - */ - - /* Determine the number of bit length codes to send. The pkzip format - * requires that at least 4 bit length codes be sent. (appnote.txt says - * 3 but the actual value used is 4.) - */ - for (max_blindex = BL_CODES - 1; max_blindex >= 3; max_blindex--) { - if (s.bl_tree[bl_order[max_blindex] * 2 + 1]/*.Len*/ !== 0) { - break; - } - } - /* Update opt_len to include the bit length tree and counts */ - s.opt_len += 3 * (max_blindex + 1) + 5 + 5 + 4; - //Tracev((stderr, "\ndyn trees: dyn %ld, stat %ld", - // s->opt_len, s->static_len)); - - return max_blindex; -} - - -/* =========================================================================== - * Send the header for a block using dynamic Huffman trees: the counts, the - * lengths of the bit length codes, the literal tree and the distance tree. - * IN assertion: lcodes >= 257, dcodes >= 1, blcodes >= 4. - */ -function send_all_trees(s, lcodes, dcodes, blcodes) -// deflate_state *s; -// int lcodes, dcodes, blcodes; /* number of codes for each tree */ -{ - var rank; /* index in bl_order */ - - //Assert (lcodes >= 257 && dcodes >= 1 && blcodes >= 4, "not enough codes"); - //Assert (lcodes <= L_CODES && dcodes <= D_CODES && blcodes <= BL_CODES, - // "too many codes"); - //Tracev((stderr, "\nbl counts: ")); - send_bits(s, lcodes - 257, 5); /* not +255 as stated in appnote.txt */ - send_bits(s, dcodes - 1, 5); - send_bits(s, blcodes - 4, 4); /* not -3 as stated in appnote.txt */ - for (rank = 0; rank < blcodes; rank++) { - //Tracev((stderr, "\nbl code %2d ", bl_order[rank])); - send_bits(s, s.bl_tree[bl_order[rank] * 2 + 1]/*.Len*/, 3); - } - //Tracev((stderr, "\nbl tree: sent %ld", s->bits_sent)); - - send_tree(s, s.dyn_ltree, lcodes - 1); /* literal tree */ - //Tracev((stderr, "\nlit tree: sent %ld", s->bits_sent)); - - send_tree(s, s.dyn_dtree, dcodes - 1); /* distance tree */ - //Tracev((stderr, "\ndist tree: sent %ld", s->bits_sent)); -} - - -/* =========================================================================== - * Check if the data type is TEXT or BINARY, using the following algorithm: - * - TEXT if the two conditions below are satisfied: - * a) There are no non-portable control characters belonging to the - * "black list" (0..6, 14..25, 28..31). - * b) There is at least one printable character belonging to the - * "white list" (9 {TAB}, 10 {LF}, 13 {CR}, 32..255). - * - BINARY otherwise. - * - The following partially-portable control characters form a - * "gray list" that is ignored in this detection algorithm: - * (7 {BEL}, 8 {BS}, 11 {VT}, 12 {FF}, 26 {SUB}, 27 {ESC}). - * IN assertion: the fields Freq of dyn_ltree are set. - */ -function detect_data_type(s) { - /* black_mask is the bit mask of black-listed bytes - * set bits 0..6, 14..25, and 28..31 - * 0xf3ffc07f = binary 11110011111111111100000001111111 - */ - var black_mask = 0xf3ffc07f; - var n; - - /* Check for non-textual ("black-listed") bytes. */ - for (n = 0; n <= 31; n++, black_mask >>>= 1) { - if ((black_mask & 1) && (s.dyn_ltree[n * 2]/*.Freq*/ !== 0)) { - return Z_BINARY; - } - } - - /* Check for textual ("white-listed") bytes. */ - if (s.dyn_ltree[9 * 2]/*.Freq*/ !== 0 || s.dyn_ltree[10 * 2]/*.Freq*/ !== 0 || - s.dyn_ltree[13 * 2]/*.Freq*/ !== 0) { - return Z_TEXT; - } - for (n = 32; n < LITERALS; n++) { - if (s.dyn_ltree[n * 2]/*.Freq*/ !== 0) { - return Z_TEXT; - } - } - - /* There are no "black-listed" or "white-listed" bytes: - * this stream either is empty or has tolerated ("gray-listed") bytes only. - */ - return Z_BINARY; -} - - -var static_init_done = false; - -/* =========================================================================== - * Initialize the tree data structures for a new zlib stream. - */ -function _tr_init(s) -{ - - if (!static_init_done) { - tr_static_init(); - static_init_done = true; - } - - s.l_desc = new TreeDesc(s.dyn_ltree, static_l_desc); - s.d_desc = new TreeDesc(s.dyn_dtree, static_d_desc); - s.bl_desc = new TreeDesc(s.bl_tree, static_bl_desc); - - s.bi_buf = 0; - s.bi_valid = 0; - - /* Initialize the first block of the first file: */ - init_block(s); -} - - -/* =========================================================================== - * Send a stored block - */ -function _tr_stored_block(s, buf, stored_len, last) -//DeflateState *s; -//charf *buf; /* input block */ -//ulg stored_len; /* length of input block */ -//int last; /* one if this is the last block for a file */ -{ - send_bits(s, (STORED_BLOCK << 1) + (last ? 1 : 0), 3); /* send block type */ - copy_block(s, buf, stored_len, true); /* with header */ -} - - -/* =========================================================================== - * Send one empty static block to give enough lookahead for inflate. - * This takes 10 bits, of which 7 may remain in the bit buffer. - */ -function _tr_align(s) { - send_bits(s, STATIC_TREES << 1, 3); - send_code(s, END_BLOCK, static_ltree); - bi_flush(s); -} - - -/* =========================================================================== - * Determine the best encoding for the current block: dynamic trees, static - * trees or store, and output the encoded block to the zip file. - */ -function _tr_flush_block(s, buf, stored_len, last) -//DeflateState *s; -//charf *buf; /* input block, or NULL if too old */ -//ulg stored_len; /* length of input block */ -//int last; /* one if this is the last block for a file */ -{ - var opt_lenb, static_lenb; /* opt_len and static_len in bytes */ - var max_blindex = 0; /* index of last bit length code of non zero freq */ - - /* Build the Huffman trees unless a stored block is forced */ - if (s.level > 0) { - - /* Check if the file is binary or text */ - if (s.strm.data_type === Z_UNKNOWN) { - s.strm.data_type = detect_data_type(s); - } - - /* Construct the literal and distance trees */ - build_tree(s, s.l_desc); - // Tracev((stderr, "\nlit data: dyn %ld, stat %ld", s->opt_len, - // s->static_len)); - - build_tree(s, s.d_desc); - // Tracev((stderr, "\ndist data: dyn %ld, stat %ld", s->opt_len, - // s->static_len)); - /* At this point, opt_len and static_len are the total bit lengths of - * the compressed block data, excluding the tree representations. - */ - - /* Build the bit length tree for the above two trees, and get the index - * in bl_order of the last bit length code to send. - */ - max_blindex = build_bl_tree(s); - - /* Determine the best encoding. Compute the block lengths in bytes. */ - opt_lenb = (s.opt_len + 3 + 7) >>> 3; - static_lenb = (s.static_len + 3 + 7) >>> 3; - - // Tracev((stderr, "\nopt %lu(%lu) stat %lu(%lu) stored %lu lit %u ", - // opt_lenb, s->opt_len, static_lenb, s->static_len, stored_len, - // s->last_lit)); - - if (static_lenb <= opt_lenb) { opt_lenb = static_lenb; } - - } else { - // Assert(buf != (char*)0, "lost buf"); - opt_lenb = static_lenb = stored_len + 5; /* force a stored block */ - } - - if ((stored_len + 4 <= opt_lenb) && (buf !== -1)) { - /* 4: two words for the lengths */ - - /* The test buf != NULL is only necessary if LIT_BUFSIZE > WSIZE. - * Otherwise we can't have processed more than WSIZE input bytes since - * the last block flush, because compression would have been - * successful. If LIT_BUFSIZE <= WSIZE, it is never too late to - * transform a block into a stored block. - */ - _tr_stored_block(s, buf, stored_len, last); - - } else if (s.strategy === Z_FIXED || static_lenb === opt_lenb) { - - send_bits(s, (STATIC_TREES << 1) + (last ? 1 : 0), 3); - compress_block(s, static_ltree, static_dtree); - - } else { - send_bits(s, (DYN_TREES << 1) + (last ? 1 : 0), 3); - send_all_trees(s, s.l_desc.max_code + 1, s.d_desc.max_code + 1, max_blindex + 1); - compress_block(s, s.dyn_ltree, s.dyn_dtree); - } - // Assert (s->compressed_len == s->bits_sent, "bad compressed size"); - /* The above check is made mod 2^32, for files larger than 512 MB - * and uLong implemented on 32 bits. - */ - init_block(s); - - if (last) { - bi_windup(s); - } - // Tracev((stderr,"\ncomprlen %lu(%lu) ", s->compressed_len>>3, - // s->compressed_len-7*last)); -} - -/* =========================================================================== - * Save the match info and tally the frequency counts. Return true if - * the current block must be flushed. - */ -function _tr_tally(s, dist, lc) -// deflate_state *s; -// unsigned dist; /* distance of matched string */ -// unsigned lc; /* match length-MIN_MATCH or unmatched char (if dist==0) */ -{ - //var out_length, in_length, dcode; - - s.pending_buf[s.d_buf + s.last_lit * 2] = (dist >>> 8) & 0xff; - s.pending_buf[s.d_buf + s.last_lit * 2 + 1] = dist & 0xff; - - s.pending_buf[s.l_buf + s.last_lit] = lc & 0xff; - s.last_lit++; - - if (dist === 0) { - /* lc is the unmatched char */ - s.dyn_ltree[lc * 2]/*.Freq*/++; - } else { - s.matches++; - /* Here, lc is the match length - MIN_MATCH */ - dist--; /* dist = match distance - 1 */ - //Assert((ush)dist < (ush)MAX_DIST(s) && - // (ush)lc <= (ush)(MAX_MATCH-MIN_MATCH) && - // (ush)d_code(dist) < (ush)D_CODES, "_tr_tally: bad match"); - - s.dyn_ltree[(_length_code[lc] + LITERALS + 1) * 2]/*.Freq*/++; - s.dyn_dtree[d_code(dist) * 2]/*.Freq*/++; - } - -// (!) This block is disabled in zlib defaults, -// don't enable it for binary compatibility - -//#ifdef TRUNCATE_BLOCK -// /* Try to guess if it is profitable to stop the current block here */ -// if ((s.last_lit & 0x1fff) === 0 && s.level > 2) { -// /* Compute an upper bound for the compressed length */ -// out_length = s.last_lit*8; -// in_length = s.strstart - s.block_start; -// -// for (dcode = 0; dcode < D_CODES; dcode++) { -// out_length += s.dyn_dtree[dcode*2]/*.Freq*/ * (5 + extra_dbits[dcode]); -// } -// out_length >>>= 3; -// //Tracev((stderr,"\nlast_lit %u, in %ld, out ~%ld(%ld%%) ", -// // s->last_lit, in_length, out_length, -// // 100L - out_length*100L/in_length)); -// if (s.matches < (s.last_lit>>1)/*int /2*/ && out_length < (in_length>>1)/*int /2*/) { -// return true; -// } -// } -//#endif - - return (s.last_lit === s.lit_bufsize - 1); - /* We avoid equality with lit_bufsize because of wraparound at 64K - * on 16 bit machines and because stored blocks are restricted to - * 64K-1 bytes. - */ -} - -exports._tr_init = _tr_init; -exports._tr_stored_block = _tr_stored_block; -exports._tr_flush_block = _tr_flush_block; -exports._tr_tally = _tr_tally; -exports._tr_align = _tr_align; - -},{"../utils/common":172}],184:[function(require,module,exports){ -'use strict'; - -// (C) 1995-2013 Jean-loup Gailly and Mark Adler -// (C) 2014-2017 Vitaly Puzrin and Andrey Tupitsin -// -// This software is provided 'as-is', without any express or implied -// warranty. In no event will the authors be held liable for any damages -// arising from the use of this software. -// -// Permission is granted to anyone to use this software for any purpose, -// including commercial applications, and to alter it and redistribute it -// freely, subject to the following restrictions: -// -// 1. The origin of this software must not be misrepresented; you must not -// claim that you wrote the original software. If you use this software -// in a product, an acknowledgment in the product documentation would be -// appreciated but is not required. -// 2. Altered source versions must be plainly marked as such, and must not be -// misrepresented as being the original software. -// 3. This notice may not be removed or altered from any source distribution. - -function ZStream() { - /* next input byte */ - this.input = null; // JS specific, because we have no pointers - this.next_in = 0; - /* number of bytes available at input */ - this.avail_in = 0; - /* total number of input bytes read so far */ - this.total_in = 0; - /* next output byte should be put there */ - this.output = null; // JS specific, because we have no pointers - this.next_out = 0; - /* remaining free space at output */ - this.avail_out = 0; - /* total number of bytes output so far */ - this.total_out = 0; - /* last error message, NULL if no error */ - this.msg = ''/*Z_NULL*/; - /* not visible by applications */ - this.state = null; - /* best guess about the data type: binary or text */ - this.data_type = 2/*Z_UNKNOWN*/; - /* adler32 value of the uncompressed data */ - this.adler = 0; -} - -module.exports = ZStream; - -},{}],185:[function(require,module,exports){ -module.exports={"2.16.840.1.101.3.4.1.1": "aes-128-ecb", -"2.16.840.1.101.3.4.1.2": "aes-128-cbc", -"2.16.840.1.101.3.4.1.3": "aes-128-ofb", -"2.16.840.1.101.3.4.1.4": "aes-128-cfb", -"2.16.840.1.101.3.4.1.21": "aes-192-ecb", -"2.16.840.1.101.3.4.1.22": "aes-192-cbc", -"2.16.840.1.101.3.4.1.23": "aes-192-ofb", -"2.16.840.1.101.3.4.1.24": "aes-192-cfb", -"2.16.840.1.101.3.4.1.41": "aes-256-ecb", -"2.16.840.1.101.3.4.1.42": "aes-256-cbc", -"2.16.840.1.101.3.4.1.43": "aes-256-ofb", -"2.16.840.1.101.3.4.1.44": "aes-256-cfb" -} -},{}],186:[function(require,module,exports){ -// from https://github.com/indutny/self-signed/blob/gh-pages/lib/asn1.js -// Fedor, you are amazing. -'use strict' - -var asn1 = require('asn1.js') - -exports.certificate = require('./certificate') - -var RSAPrivateKey = asn1.define('RSAPrivateKey', function () { - this.seq().obj( - this.key('version').int(), - this.key('modulus').int(), - this.key('publicExponent').int(), - this.key('privateExponent').int(), - this.key('prime1').int(), - this.key('prime2').int(), - this.key('exponent1').int(), - this.key('exponent2').int(), - this.key('coefficient').int() - ) -}) -exports.RSAPrivateKey = RSAPrivateKey - -var RSAPublicKey = asn1.define('RSAPublicKey', function () { - this.seq().obj( - this.key('modulus').int(), - this.key('publicExponent').int() - ) -}) -exports.RSAPublicKey = RSAPublicKey - -var PublicKey = asn1.define('SubjectPublicKeyInfo', function () { - this.seq().obj( - this.key('algorithm').use(AlgorithmIdentifier), - this.key('subjectPublicKey').bitstr() - ) -}) -exports.PublicKey = PublicKey - -var AlgorithmIdentifier = asn1.define('AlgorithmIdentifier', function () { - this.seq().obj( - this.key('algorithm').objid(), - this.key('none').null_().optional(), - this.key('curve').objid().optional(), - this.key('params').seq().obj( - this.key('p').int(), - this.key('q').int(), - this.key('g').int() - ).optional() - ) -}) - -var PrivateKeyInfo = asn1.define('PrivateKeyInfo', function () { - this.seq().obj( - this.key('version').int(), - this.key('algorithm').use(AlgorithmIdentifier), - this.key('subjectPrivateKey').octstr() - ) -}) -exports.PrivateKey = PrivateKeyInfo -var EncryptedPrivateKeyInfo = asn1.define('EncryptedPrivateKeyInfo', function () { - this.seq().obj( - this.key('algorithm').seq().obj( - this.key('id').objid(), - this.key('decrypt').seq().obj( - this.key('kde').seq().obj( - this.key('id').objid(), - this.key('kdeparams').seq().obj( - this.key('salt').octstr(), - this.key('iters').int() - ) - ), - this.key('cipher').seq().obj( - this.key('algo').objid(), - this.key('iv').octstr() - ) - ) - ), - this.key('subjectPrivateKey').octstr() - ) -}) - -exports.EncryptedPrivateKey = EncryptedPrivateKeyInfo - -var DSAPrivateKey = asn1.define('DSAPrivateKey', function () { - this.seq().obj( - this.key('version').int(), - this.key('p').int(), - this.key('q').int(), - this.key('g').int(), - this.key('pub_key').int(), - this.key('priv_key').int() - ) -}) -exports.DSAPrivateKey = DSAPrivateKey - -exports.DSAparam = asn1.define('DSAparam', function () { - this.int() -}) - -var ECPrivateKey = asn1.define('ECPrivateKey', function () { - this.seq().obj( - this.key('version').int(), - this.key('privateKey').octstr(), - this.key('parameters').optional().explicit(0).use(ECParameters), - this.key('publicKey').optional().explicit(1).bitstr() - ) -}) -exports.ECPrivateKey = ECPrivateKey - -var ECParameters = asn1.define('ECParameters', function () { - this.choice({ - namedCurve: this.objid() - }) -}) - -exports.signature = asn1.define('signature', function () { - this.seq().obj( - this.key('r').int(), - this.key('s').int() - ) -}) - -},{"./certificate":187,"asn1.js":3}],187:[function(require,module,exports){ -// from https://github.com/Rantanen/node-dtls/blob/25a7dc861bda38cfeac93a723500eea4f0ac2e86/Certificate.js -// thanks to @Rantanen - -'use strict' - -var asn = require('asn1.js') - -var Time = asn.define('Time', function () { - this.choice({ - utcTime: this.utctime(), - generalTime: this.gentime() - }) -}) - -var AttributeTypeValue = asn.define('AttributeTypeValue', function () { - this.seq().obj( - this.key('type').objid(), - this.key('value').any() - ) -}) - -var AlgorithmIdentifier = asn.define('AlgorithmIdentifier', function () { - this.seq().obj( - this.key('algorithm').objid(), - this.key('parameters').optional(), - this.key('curve').objid().optional() - ) -}) - -var SubjectPublicKeyInfo = asn.define('SubjectPublicKeyInfo', function () { - this.seq().obj( - this.key('algorithm').use(AlgorithmIdentifier), - this.key('subjectPublicKey').bitstr() - ) -}) - -var RelativeDistinguishedName = asn.define('RelativeDistinguishedName', function () { - this.setof(AttributeTypeValue) -}) - -var RDNSequence = asn.define('RDNSequence', function () { - this.seqof(RelativeDistinguishedName) -}) - -var Name = asn.define('Name', function () { - this.choice({ - rdnSequence: this.use(RDNSequence) - }) -}) - -var Validity = asn.define('Validity', function () { - this.seq().obj( - this.key('notBefore').use(Time), - this.key('notAfter').use(Time) - ) -}) - -var Extension = asn.define('Extension', function () { - this.seq().obj( - this.key('extnID').objid(), - this.key('critical').bool().def(false), - this.key('extnValue').octstr() - ) -}) - -var TBSCertificate = asn.define('TBSCertificate', function () { - this.seq().obj( - this.key('version').explicit(0).int().optional(), - this.key('serialNumber').int(), - this.key('signature').use(AlgorithmIdentifier), - this.key('issuer').use(Name), - this.key('validity').use(Validity), - this.key('subject').use(Name), - this.key('subjectPublicKeyInfo').use(SubjectPublicKeyInfo), - this.key('issuerUniqueID').implicit(1).bitstr().optional(), - this.key('subjectUniqueID').implicit(2).bitstr().optional(), - this.key('extensions').explicit(3).seqof(Extension).optional() - ) -}) - -var X509Certificate = asn.define('X509Certificate', function () { - this.seq().obj( - this.key('tbsCertificate').use(TBSCertificate), - this.key('signatureAlgorithm').use(AlgorithmIdentifier), - this.key('signatureValue').bitstr() - ) -}) - -module.exports = X509Certificate - -},{"asn1.js":3}],188:[function(require,module,exports){ -// adapted from https://github.com/apatil/pemstrip -var findProc = /Proc-Type: 4,ENCRYPTED[\n\r]+DEK-Info: AES-((?:128)|(?:192)|(?:256))-CBC,([0-9A-H]+)[\n\r]+([0-9A-z\n\r\+\/\=]+)[\n\r]+/m -var startRegex = /^-----BEGIN ((?:.*? KEY)|CERTIFICATE)-----/m -var fullRegex = /^-----BEGIN ((?:.*? KEY)|CERTIFICATE)-----([0-9A-z\n\r\+\/\=]+)-----END \1-----$/m -var evp = require('evp_bytestokey') -var ciphers = require('browserify-aes') -var Buffer = require('safe-buffer').Buffer -module.exports = function (okey, password) { - var key = okey.toString() - var match = key.match(findProc) - var decrypted - if (!match) { - var match2 = key.match(fullRegex) - decrypted = new Buffer(match2[2].replace(/[\r\n]/g, ''), 'base64') - } else { - var suite = 'aes' + match[1] - var iv = Buffer.from(match[2], 'hex') - var cipherText = Buffer.from(match[3].replace(/[\r\n]/g, ''), 'base64') - var cipherKey = evp(password, iv.slice(0, 8), parseInt(match[1], 10)).key - var out = [] - var cipher = ciphers.createDecipheriv(suite, cipherKey, iv) - out.push(cipher.update(cipherText)) - out.push(cipher.final()) - decrypted = Buffer.concat(out) - } - var tag = key.match(startRegex)[1] - return { - tag: tag, - data: decrypted - } -} - -},{"browserify-aes":57,"evp_bytestokey":131,"safe-buffer":216}],189:[function(require,module,exports){ -var asn1 = require('./asn1') -var aesid = require('./aesid.json') -var fixProc = require('./fixProc') -var ciphers = require('browserify-aes') -var compat = require('pbkdf2') -var Buffer = require('safe-buffer').Buffer -module.exports = parseKeys - -function parseKeys (buffer) { - var password - if (typeof buffer === 'object' && !Buffer.isBuffer(buffer)) { - password = buffer.passphrase - buffer = buffer.key - } - if (typeof buffer === 'string') { - buffer = Buffer.from(buffer) - } - - var stripped = fixProc(buffer, password) - - var type = stripped.tag - var data = stripped.data - var subtype, ndata - switch (type) { - case 'CERTIFICATE': - ndata = asn1.certificate.decode(data, 'der').tbsCertificate.subjectPublicKeyInfo - // falls through - case 'PUBLIC KEY': - if (!ndata) { - ndata = asn1.PublicKey.decode(data, 'der') - } - subtype = ndata.algorithm.algorithm.join('.') - switch (subtype) { - case '1.2.840.113549.1.1.1': - return asn1.RSAPublicKey.decode(ndata.subjectPublicKey.data, 'der') - case '1.2.840.10045.2.1': - ndata.subjectPrivateKey = ndata.subjectPublicKey - return { - type: 'ec', - data: ndata - } - case '1.2.840.10040.4.1': - ndata.algorithm.params.pub_key = asn1.DSAparam.decode(ndata.subjectPublicKey.data, 'der') - return { - type: 'dsa', - data: ndata.algorithm.params - } - default: throw new Error('unknown key id ' + subtype) - } - throw new Error('unknown key type ' + type) - case 'ENCRYPTED PRIVATE KEY': - data = asn1.EncryptedPrivateKey.decode(data, 'der') - data = decrypt(data, password) - // falls through - case 'PRIVATE KEY': - ndata = asn1.PrivateKey.decode(data, 'der') - subtype = ndata.algorithm.algorithm.join('.') - switch (subtype) { - case '1.2.840.113549.1.1.1': - return asn1.RSAPrivateKey.decode(ndata.subjectPrivateKey, 'der') - case '1.2.840.10045.2.1': - return { - curve: ndata.algorithm.curve, - privateKey: asn1.ECPrivateKey.decode(ndata.subjectPrivateKey, 'der').privateKey - } - case '1.2.840.10040.4.1': - ndata.algorithm.params.priv_key = asn1.DSAparam.decode(ndata.subjectPrivateKey, 'der') - return { - type: 'dsa', - params: ndata.algorithm.params - } - default: throw new Error('unknown key id ' + subtype) - } - throw new Error('unknown key type ' + type) - case 'RSA PUBLIC KEY': - return asn1.RSAPublicKey.decode(data, 'der') - case 'RSA PRIVATE KEY': - return asn1.RSAPrivateKey.decode(data, 'der') - case 'DSA PRIVATE KEY': - return { - type: 'dsa', - params: asn1.DSAPrivateKey.decode(data, 'der') - } - case 'EC PRIVATE KEY': - data = asn1.ECPrivateKey.decode(data, 'der') - return { - curve: data.parameters.value, - privateKey: data.privateKey - } - default: throw new Error('unknown key type ' + type) - } -} -parseKeys.signature = asn1.signature -function decrypt (data, password) { - var salt = data.algorithm.decrypt.kde.kdeparams.salt - var iters = parseInt(data.algorithm.decrypt.kde.kdeparams.iters.toString(), 10) - var algo = aesid[data.algorithm.decrypt.cipher.algo.join('.')] - var iv = data.algorithm.decrypt.cipher.iv - var cipherText = data.subjectPrivateKey - var keylen = parseInt(algo.split('-')[1], 10) / 8 - var key = compat.pbkdf2Sync(password, salt, iters, keylen, 'sha1') - var cipher = ciphers.createDecipheriv(algo, key, iv) - var out = [] - out.push(cipher.update(cipherText)) - out.push(cipher.final()) - return Buffer.concat(out) -} - -},{"./aesid.json":185,"./asn1":186,"./fixProc":188,"browserify-aes":57,"pbkdf2":191,"safe-buffer":216}],190:[function(require,module,exports){ -(function (process){ -// .dirname, .basename, and .extname methods are extracted from Node.js v8.11.1, -// backported and transplited with Babel, with backwards-compat fixes - -// Copyright Joyent, Inc. and other Node contributors. -// -// Permission is hereby granted, free of charge, to any person obtaining a -// copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to permit -// persons to whom the Software is furnished to do so, subject to the -// following conditions: -// -// The above copyright notice and this permission notice shall be included -// in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN -// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR -// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE -// USE OR OTHER DEALINGS IN THE SOFTWARE. - -// resolves . and .. elements in a path array with directory names there -// must be no slashes, empty elements, or device names (c:\) in the array -// (so also no leading and trailing slashes - it does not distinguish -// relative and absolute paths) -function normalizeArray(parts, allowAboveRoot) { - // if the path tries to go above the root, `up` ends up > 0 - var up = 0; - for (var i = parts.length - 1; i >= 0; i--) { - var last = parts[i]; - if (last === '.') { - parts.splice(i, 1); - } else if (last === '..') { - parts.splice(i, 1); - up++; - } else if (up) { - parts.splice(i, 1); - up--; - } - } - - // if the path is allowed to go above the root, restore leading ..s - if (allowAboveRoot) { - for (; up--; up) { - parts.unshift('..'); - } - } - - return parts; -} - -// path.resolve([from ...], to) -// posix version -exports.resolve = function() { - var resolvedPath = '', - resolvedAbsolute = false; - - for (var i = arguments.length - 1; i >= -1 && !resolvedAbsolute; i--) { - var path = (i >= 0) ? arguments[i] : process.cwd(); - - // Skip empty and invalid entries - if (typeof path !== 'string') { - throw new TypeError('Arguments to path.resolve must be strings'); - } else if (!path) { - continue; - } - - resolvedPath = path + '/' + resolvedPath; - resolvedAbsolute = path.charAt(0) === '/'; - } - - // At this point the path should be resolved to a full absolute path, but - // handle relative paths to be safe (might happen when process.cwd() fails) - - // Normalize the path - resolvedPath = normalizeArray(filter(resolvedPath.split('/'), function(p) { - return !!p; - }), !resolvedAbsolute).join('/'); - - return ((resolvedAbsolute ? '/' : '') + resolvedPath) || '.'; -}; - -// path.normalize(path) -// posix version -exports.normalize = function(path) { - var isAbsolute = exports.isAbsolute(path), - trailingSlash = substr(path, -1) === '/'; - - // Normalize the path - path = normalizeArray(filter(path.split('/'), function(p) { - return !!p; - }), !isAbsolute).join('/'); - - if (!path && !isAbsolute) { - path = '.'; - } - if (path && trailingSlash) { - path += '/'; - } - - return (isAbsolute ? '/' : '') + path; -}; - -// posix version -exports.isAbsolute = function(path) { - return path.charAt(0) === '/'; -}; - -// posix version -exports.join = function() { - var paths = Array.prototype.slice.call(arguments, 0); - return exports.normalize(filter(paths, function(p, index) { - if (typeof p !== 'string') { - throw new TypeError('Arguments to path.join must be strings'); - } - return p; - }).join('/')); -}; - - -// path.relative(from, to) -// posix version -exports.relative = function(from, to) { - from = exports.resolve(from).substr(1); - to = exports.resolve(to).substr(1); - - function trim(arr) { - var start = 0; - for (; start < arr.length; start++) { - if (arr[start] !== '') break; - } - - var end = arr.length - 1; - for (; end >= 0; end--) { - if (arr[end] !== '') break; - } - - if (start > end) return []; - return arr.slice(start, end - start + 1); - } - - var fromParts = trim(from.split('/')); - var toParts = trim(to.split('/')); - - var length = Math.min(fromParts.length, toParts.length); - var samePartsLength = length; - for (var i = 0; i < length; i++) { - if (fromParts[i] !== toParts[i]) { - samePartsLength = i; - break; - } - } - - var outputParts = []; - for (var i = samePartsLength; i < fromParts.length; i++) { - outputParts.push('..'); - } - - outputParts = outputParts.concat(toParts.slice(samePartsLength)); - - return outputParts.join('/'); -}; - -exports.sep = '/'; -exports.delimiter = ':'; - -exports.dirname = function (path) { - if (typeof path !== 'string') path = path + ''; - if (path.length === 0) return '.'; - var code = path.charCodeAt(0); - var hasRoot = code === 47 /*/*/; - var end = -1; - var matchedSlash = true; - for (var i = path.length - 1; i >= 1; --i) { - code = path.charCodeAt(i); - if (code === 47 /*/*/) { - if (!matchedSlash) { - end = i; - break; - } - } else { - // We saw the first non-path separator - matchedSlash = false; - } - } - - if (end === -1) return hasRoot ? '/' : '.'; - if (hasRoot && end === 1) { - // return '//'; - // Backwards-compat fix: - return '/'; - } - return path.slice(0, end); -}; - -function basename(path) { - if (typeof path !== 'string') path = path + ''; - - var start = 0; - var end = -1; - var matchedSlash = true; - var i; - - for (i = path.length - 1; i >= 0; --i) { - if (path.charCodeAt(i) === 47 /*/*/) { - // If we reached a path separator that was not part of a set of path - // separators at the end of the string, stop now - if (!matchedSlash) { - start = i + 1; - break; - } - } else if (end === -1) { - // We saw the first non-path separator, mark this as the end of our - // path component - matchedSlash = false; - end = i + 1; - } - } - - if (end === -1) return ''; - return path.slice(start, end); -} - -// Uses a mixed approach for backwards-compatibility, as ext behavior changed -// in new Node.js versions, so only basename() above is backported here -exports.basename = function (path, ext) { - var f = basename(path); - if (ext && f.substr(-1 * ext.length) === ext) { - f = f.substr(0, f.length - ext.length); - } - return f; -}; - -exports.extname = function (path) { - if (typeof path !== 'string') path = path + ''; - var startDot = -1; - var startPart = 0; - var end = -1; - var matchedSlash = true; - // Track the state of characters (if any) we see before our first dot and - // after any path separator we find - var preDotState = 0; - for (var i = path.length - 1; i >= 0; --i) { - var code = path.charCodeAt(i); - if (code === 47 /*/*/) { - // If we reached a path separator that was not part of a set of path - // separators at the end of the string, stop now - if (!matchedSlash) { - startPart = i + 1; - break; - } - continue; - } - if (end === -1) { - // We saw the first non-path separator, mark this as the end of our - // extension - matchedSlash = false; - end = i + 1; - } - if (code === 46 /*.*/) { - // If this is our first dot, mark it as the start of our extension - if (startDot === -1) - startDot = i; - else if (preDotState !== 1) - preDotState = 1; - } else if (startDot !== -1) { - // We saw a non-dot and non-path separator before our dot, so we should - // have a good chance at having a non-empty extension - preDotState = -1; - } - } - - if (startDot === -1 || end === -1 || - // We saw a non-dot character immediately before the dot - preDotState === 0 || - // The (right-most) trimmed path component is exactly '..' - preDotState === 1 && startDot === end - 1 && startDot === startPart + 1) { - return ''; - } - return path.slice(startDot, end); -}; - -function filter (xs, f) { - if (xs.filter) return xs.filter(f); - var res = []; - for (var i = 0; i < xs.length; i++) { - if (f(xs[i], i, xs)) res.push(xs[i]); - } - return res; -} - -// String.prototype.substr - negative index don't work in IE8 -var substr = 'ab'.substr(-1) === 'b' - ? function (str, start, len) { return str.substr(start, len) } - : function (str, start, len) { - if (start < 0) start = str.length + start; - return str.substr(start, len); - } -; - -}).call(this,require('_process')) -},{"_process":197}],191:[function(require,module,exports){ -exports.pbkdf2 = require('./lib/async') -exports.pbkdf2Sync = require('./lib/sync') - -},{"./lib/async":192,"./lib/sync":195}],192:[function(require,module,exports){ -(function (process,global){ -var checkParameters = require('./precondition') -var defaultEncoding = require('./default-encoding') -var sync = require('./sync') -var Buffer = require('safe-buffer').Buffer - -var ZERO_BUF -var subtle = global.crypto && global.crypto.subtle -var toBrowser = { - 'sha': 'SHA-1', - 'sha-1': 'SHA-1', - 'sha1': 'SHA-1', - 'sha256': 'SHA-256', - 'sha-256': 'SHA-256', - 'sha384': 'SHA-384', - 'sha-384': 'SHA-384', - 'sha-512': 'SHA-512', - 'sha512': 'SHA-512' -} -var checks = [] -function checkNative (algo) { - if (global.process && !global.process.browser) { - return Promise.resolve(false) - } - if (!subtle || !subtle.importKey || !subtle.deriveBits) { - return Promise.resolve(false) - } - if (checks[algo] !== undefined) { - return checks[algo] - } - ZERO_BUF = ZERO_BUF || Buffer.alloc(8) - var prom = browserPbkdf2(ZERO_BUF, ZERO_BUF, 10, 128, algo) - .then(function () { - return true - }).catch(function () { - return false - }) - checks[algo] = prom - return prom -} - -function browserPbkdf2 (password, salt, iterations, length, algo) { - return subtle.importKey( - 'raw', password, {name: 'PBKDF2'}, false, ['deriveBits'] - ).then(function (key) { - return subtle.deriveBits({ - name: 'PBKDF2', - salt: salt, - iterations: iterations, - hash: { - name: algo - } - }, key, length << 3) - }).then(function (res) { - return Buffer.from(res) - }) -} - -function resolvePromise (promise, callback) { - promise.then(function (out) { - process.nextTick(function () { - callback(null, out) - }) - }, function (e) { - process.nextTick(function () { - callback(e) - }) - }) -} -module.exports = function (password, salt, iterations, keylen, digest, callback) { - if (typeof digest === 'function') { - callback = digest - digest = undefined - } - - digest = digest || 'sha1' - var algo = toBrowser[digest.toLowerCase()] - - if (!algo || typeof global.Promise !== 'function') { - return process.nextTick(function () { - var out - try { - out = sync(password, salt, iterations, keylen, digest) - } catch (e) { - return callback(e) - } - callback(null, out) - }) - } - - checkParameters(password, salt, iterations, keylen) - if (typeof callback !== 'function') throw new Error('No callback provided to pbkdf2') - if (!Buffer.isBuffer(password)) password = Buffer.from(password, defaultEncoding) - if (!Buffer.isBuffer(salt)) salt = Buffer.from(salt, defaultEncoding) - - resolvePromise(checkNative(algo).then(function (resp) { - if (resp) return browserPbkdf2(password, salt, iterations, keylen, algo) - - return sync(password, salt, iterations, keylen, digest) - }), callback) -} - -}).call(this,require('_process'),typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) -},{"./default-encoding":193,"./precondition":194,"./sync":195,"_process":197,"safe-buffer":216}],193:[function(require,module,exports){ -(function (process){ -var defaultEncoding -/* istanbul ignore next */ -if (process.browser) { - defaultEncoding = 'utf-8' -} else { - var pVersionMajor = parseInt(process.version.split('.')[0].slice(1), 10) - - defaultEncoding = pVersionMajor >= 6 ? 'utf-8' : 'binary' -} -module.exports = defaultEncoding - -}).call(this,require('_process')) -},{"_process":197}],194:[function(require,module,exports){ -(function (Buffer){ -var MAX_ALLOC = Math.pow(2, 30) - 1 // default in iojs - -function checkBuffer (buf, name) { - if (typeof buf !== 'string' && !Buffer.isBuffer(buf)) { - throw new TypeError(name + ' must be a buffer or string') - } -} - -module.exports = function (password, salt, iterations, keylen) { - checkBuffer(password, 'Password') - checkBuffer(salt, 'Salt') - - if (typeof iterations !== 'number') { - throw new TypeError('Iterations not a number') - } - - if (iterations < 0) { - throw new TypeError('Bad iterations') - } - - if (typeof keylen !== 'number') { - throw new TypeError('Key length not a number') - } - - if (keylen < 0 || keylen > MAX_ALLOC || keylen !== keylen) { /* eslint no-self-compare: 0 */ - throw new TypeError('Bad key length') - } -} - -}).call(this,{"isBuffer":require("../../insert-module-globals/node_modules/is-buffer/index.js")}) -},{"../../insert-module-globals/node_modules/is-buffer/index.js":157}],195:[function(require,module,exports){ -var md5 = require('create-hash/md5') -var RIPEMD160 = require('ripemd160') -var sha = require('sha.js') - -var checkParameters = require('./precondition') -var defaultEncoding = require('./default-encoding') -var Buffer = require('safe-buffer').Buffer -var ZEROS = Buffer.alloc(128) -var sizes = { - md5: 16, - sha1: 20, - sha224: 28, - sha256: 32, - sha384: 48, - sha512: 64, - rmd160: 20, - ripemd160: 20 -} - -function Hmac (alg, key, saltLen) { - var hash = getDigest(alg) - var blocksize = (alg === 'sha512' || alg === 'sha384') ? 128 : 64 - - if (key.length > blocksize) { - key = hash(key) - } else if (key.length < blocksize) { - key = Buffer.concat([key, ZEROS], blocksize) - } - - var ipad = Buffer.allocUnsafe(blocksize + sizes[alg]) - var opad = Buffer.allocUnsafe(blocksize + sizes[alg]) - for (var i = 0; i < blocksize; i++) { - ipad[i] = key[i] ^ 0x36 - opad[i] = key[i] ^ 0x5C - } - - var ipad1 = Buffer.allocUnsafe(blocksize + saltLen + 4) - ipad.copy(ipad1, 0, 0, blocksize) - this.ipad1 = ipad1 - this.ipad2 = ipad - this.opad = opad - this.alg = alg - this.blocksize = blocksize - this.hash = hash - this.size = sizes[alg] -} - -Hmac.prototype.run = function (data, ipad) { - data.copy(ipad, this.blocksize) - var h = this.hash(ipad) - h.copy(this.opad, this.blocksize) - return this.hash(this.opad) -} - -function getDigest (alg) { - function shaFunc (data) { - return sha(alg).update(data).digest() - } - function rmd160Func (data) { - return new RIPEMD160().update(data).digest() - } - - if (alg === 'rmd160' || alg === 'ripemd160') return rmd160Func - if (alg === 'md5') return md5 - return shaFunc -} - -function pbkdf2 (password, salt, iterations, keylen, digest) { - checkParameters(password, salt, iterations, keylen) - - if (!Buffer.isBuffer(password)) password = Buffer.from(password, defaultEncoding) - if (!Buffer.isBuffer(salt)) salt = Buffer.from(salt, defaultEncoding) - - digest = digest || 'sha1' - - var hmac = new Hmac(digest, password, salt.length) - - var DK = Buffer.allocUnsafe(keylen) - var block1 = Buffer.allocUnsafe(salt.length + 4) - salt.copy(block1, 0, 0, salt.length) - - var destPos = 0 - var hLen = sizes[digest] - var l = Math.ceil(keylen / hLen) - - for (var i = 1; i <= l; i++) { - block1.writeUInt32BE(i, salt.length) - - var T = hmac.run(block1, hmac.ipad1) - var U = T - - for (var j = 1; j < iterations; j++) { - U = hmac.run(U, hmac.ipad2) - for (var k = 0; k < hLen; k++) T[k] ^= U[k] - } - - T.copy(DK, destPos) - destPos += hLen - } - - return DK -} - -module.exports = pbkdf2 - -},{"./default-encoding":193,"./precondition":194,"create-hash/md5":95,"ripemd160":215,"safe-buffer":216,"sha.js":218}],196:[function(require,module,exports){ -(function (process){ -'use strict'; - -if (!process.version || - process.version.indexOf('v0.') === 0 || - process.version.indexOf('v1.') === 0 && process.version.indexOf('v1.8.') !== 0) { - module.exports = { nextTick: nextTick }; -} else { - module.exports = process -} - -function nextTick(fn, arg1, arg2, arg3) { - if (typeof fn !== 'function') { - throw new TypeError('"callback" argument must be a function'); - } - var len = arguments.length; - var args, i; - switch (len) { - case 0: - case 1: - return process.nextTick(fn); - case 2: - return process.nextTick(function afterTickOne() { - fn.call(null, arg1); - }); - case 3: - return process.nextTick(function afterTickTwo() { - fn.call(null, arg1, arg2); - }); - case 4: - return process.nextTick(function afterTickThree() { - fn.call(null, arg1, arg2, arg3); - }); - default: - args = new Array(len - 1); - i = 0; - while (i < args.length) { - args[i++] = arguments[i]; - } - return process.nextTick(function afterTick() { - fn.apply(null, args); - }); - } -} - - -}).call(this,require('_process')) -},{"_process":197}],197:[function(require,module,exports){ -// shim for using process in browser -var process = module.exports = {}; - -// cached from whatever global is present so that test runners that stub it -// don't break things. But we need to wrap it in a try catch in case it is -// wrapped in strict mode code which doesn't define any globals. It's inside a -// function because try/catches deoptimize in certain engines. - -var cachedSetTimeout; -var cachedClearTimeout; - -function defaultSetTimout() { - throw new Error('setTimeout has not been defined'); -} -function defaultClearTimeout () { - throw new Error('clearTimeout has not been defined'); -} -(function () { - try { - if (typeof setTimeout === 'function') { - cachedSetTimeout = setTimeout; - } else { - cachedSetTimeout = defaultSetTimout; - } - } catch (e) { - cachedSetTimeout = defaultSetTimout; - } - try { - if (typeof clearTimeout === 'function') { - cachedClearTimeout = clearTimeout; - } else { - cachedClearTimeout = defaultClearTimeout; - } - } catch (e) { - cachedClearTimeout = defaultClearTimeout; - } -} ()) -function runTimeout(fun) { - if (cachedSetTimeout === setTimeout) { - //normal enviroments in sane situations - return setTimeout(fun, 0); - } - // if setTimeout wasn't available but was latter defined - if ((cachedSetTimeout === defaultSetTimout || !cachedSetTimeout) && setTimeout) { - cachedSetTimeout = setTimeout; - return setTimeout(fun, 0); - } - try { - // when when somebody has screwed with setTimeout but no I.E. maddness - return cachedSetTimeout(fun, 0); - } catch(e){ - try { - // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally - return cachedSetTimeout.call(null, fun, 0); - } catch(e){ - // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error - return cachedSetTimeout.call(this, fun, 0); - } - } - - -} -function runClearTimeout(marker) { - if (cachedClearTimeout === clearTimeout) { - //normal enviroments in sane situations - return clearTimeout(marker); - } - // if clearTimeout wasn't available but was latter defined - if ((cachedClearTimeout === defaultClearTimeout || !cachedClearTimeout) && clearTimeout) { - cachedClearTimeout = clearTimeout; - return clearTimeout(marker); - } - try { - // when when somebody has screwed with setTimeout but no I.E. maddness - return cachedClearTimeout(marker); - } catch (e){ - try { - // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally - return cachedClearTimeout.call(null, marker); - } catch (e){ - // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error. - // Some versions of I.E. have different rules for clearTimeout vs setTimeout - return cachedClearTimeout.call(this, marker); - } - } - - - -} -var queue = []; -var draining = false; -var currentQueue; -var queueIndex = -1; - -function cleanUpNextTick() { - if (!draining || !currentQueue) { - return; - } - draining = false; - if (currentQueue.length) { - queue = currentQueue.concat(queue); - } else { - queueIndex = -1; - } - if (queue.length) { - drainQueue(); - } -} - -function drainQueue() { - if (draining) { - return; - } - var timeout = runTimeout(cleanUpNextTick); - draining = true; - - var len = queue.length; - while(len) { - currentQueue = queue; - queue = []; - while (++queueIndex < len) { - if (currentQueue) { - currentQueue[queueIndex].run(); - } - } - queueIndex = -1; - len = queue.length; - } - currentQueue = null; - draining = false; - runClearTimeout(timeout); -} - -process.nextTick = function (fun) { - var args = new Array(arguments.length - 1); - if (arguments.length > 1) { - for (var i = 1; i < arguments.length; i++) { - args[i - 1] = arguments[i]; - } - } - queue.push(new Item(fun, args)); - if (queue.length === 1 && !draining) { - runTimeout(drainQueue); - } -}; - -// v8 likes predictible objects -function Item(fun, array) { - this.fun = fun; - this.array = array; -} -Item.prototype.run = function () { - this.fun.apply(null, this.array); -}; -process.title = 'browser'; -process.browser = true; -process.env = {}; -process.argv = []; -process.version = ''; // empty string to avoid regexp issues -process.versions = {}; - -function noop() {} - -process.on = noop; -process.addListener = noop; -process.once = noop; -process.off = noop; -process.removeListener = noop; -process.removeAllListeners = noop; -process.emit = noop; -process.prependListener = noop; -process.prependOnceListener = noop; - -process.listeners = function (name) { return [] } - -process.binding = function (name) { - throw new Error('process.binding is not supported'); -}; - -process.cwd = function () { return '/' }; -process.chdir = function (dir) { - throw new Error('process.chdir is not supported'); -}; -process.umask = function() { return 0; }; - -},{}],198:[function(require,module,exports){ -exports.publicEncrypt = require('./publicEncrypt') -exports.privateDecrypt = require('./privateDecrypt') - -exports.privateEncrypt = function privateEncrypt (key, buf) { - return exports.publicEncrypt(key, buf, true) -} - -exports.publicDecrypt = function publicDecrypt (key, buf) { - return exports.privateDecrypt(key, buf, true) -} - -},{"./privateDecrypt":200,"./publicEncrypt":201}],199:[function(require,module,exports){ -var createHash = require('create-hash') -var Buffer = require('safe-buffer').Buffer - -module.exports = function (seed, len) { - var t = Buffer.alloc(0) - var i = 0 - var c - while (t.length < len) { - c = i2ops(i++) - t = Buffer.concat([t, createHash('sha1').update(seed).update(c).digest()]) - } - return t.slice(0, len) -} - -function i2ops (c) { - var out = Buffer.allocUnsafe(4) - out.writeUInt32BE(c, 0) - return out -} - -},{"create-hash":94,"safe-buffer":216}],200:[function(require,module,exports){ -var parseKeys = require('parse-asn1') -var mgf = require('./mgf') -var xor = require('./xor') -var BN = require('bn.js') -var crt = require('browserify-rsa') -var createHash = require('create-hash') -var withPublic = require('./withPublic') -var Buffer = require('safe-buffer').Buffer - -module.exports = function privateDecrypt (privateKey, enc, reverse) { - var padding - if (privateKey.padding) { - padding = privateKey.padding - } else if (reverse) { - padding = 1 - } else { - padding = 4 - } - - var key = parseKeys(privateKey) - var k = key.modulus.byteLength() - if (enc.length > k || new BN(enc).cmp(key.modulus) >= 0) { - throw new Error('decryption error') - } - var msg - if (reverse) { - msg = withPublic(new BN(enc), key) - } else { - msg = crt(enc, key) - } - var zBuffer = Buffer.alloc(k - msg.length) - msg = Buffer.concat([zBuffer, msg], k) - if (padding === 4) { - return oaep(key, msg) - } else if (padding === 1) { - return pkcs1(key, msg, reverse) - } else if (padding === 3) { - return msg - } else { - throw new Error('unknown padding') - } -} - -function oaep (key, msg) { - var k = key.modulus.byteLength() - var iHash = createHash('sha1').update(Buffer.alloc(0)).digest() - var hLen = iHash.length - if (msg[0] !== 0) { - throw new Error('decryption error') - } - var maskedSeed = msg.slice(1, hLen + 1) - var maskedDb = msg.slice(hLen + 1) - var seed = xor(maskedSeed, mgf(maskedDb, hLen)) - var db = xor(maskedDb, mgf(seed, k - hLen - 1)) - if (compare(iHash, db.slice(0, hLen))) { - throw new Error('decryption error') - } - var i = hLen - while (db[i] === 0) { - i++ - } - if (db[i++] !== 1) { - throw new Error('decryption error') - } - return db.slice(i) -} - -function pkcs1 (key, msg, reverse) { - var p1 = msg.slice(0, 2) - var i = 2 - var status = 0 - while (msg[i++] !== 0) { - if (i >= msg.length) { - status++ - break - } - } - var ps = msg.slice(2, i - 1) - - if ((p1.toString('hex') !== '0002' && !reverse) || (p1.toString('hex') !== '0001' && reverse)) { - status++ - } - if (ps.length < 8) { - status++ - } - if (status) { - throw new Error('decryption error') - } - return msg.slice(i) -} -function compare (a, b) { - a = Buffer.from(a) - b = Buffer.from(b) - var dif = 0 - var len = a.length - if (a.length !== b.length) { - dif++ - len = Math.min(a.length, b.length) - } - var i = -1 - while (++i < len) { - dif += (a[i] ^ b[i]) - } - return dif -} - -},{"./mgf":199,"./withPublic":202,"./xor":203,"bn.js":52,"browserify-rsa":75,"create-hash":94,"parse-asn1":189,"safe-buffer":216}],201:[function(require,module,exports){ -var parseKeys = require('parse-asn1') -var randomBytes = require('randombytes') -var createHash = require('create-hash') -var mgf = require('./mgf') -var xor = require('./xor') -var BN = require('bn.js') -var withPublic = require('./withPublic') -var crt = require('browserify-rsa') -var Buffer = require('safe-buffer').Buffer - -module.exports = function publicEncrypt (publicKey, msg, reverse) { - var padding - if (publicKey.padding) { - padding = publicKey.padding - } else if (reverse) { - padding = 1 - } else { - padding = 4 - } - var key = parseKeys(publicKey) - var paddedMsg - if (padding === 4) { - paddedMsg = oaep(key, msg) - } else if (padding === 1) { - paddedMsg = pkcs1(key, msg, reverse) - } else if (padding === 3) { - paddedMsg = new BN(msg) - if (paddedMsg.cmp(key.modulus) >= 0) { - throw new Error('data too long for modulus') - } - } else { - throw new Error('unknown padding') - } - if (reverse) { - return crt(paddedMsg, key) - } else { - return withPublic(paddedMsg, key) - } -} - -function oaep (key, msg) { - var k = key.modulus.byteLength() - var mLen = msg.length - var iHash = createHash('sha1').update(Buffer.alloc(0)).digest() - var hLen = iHash.length - var hLen2 = 2 * hLen - if (mLen > k - hLen2 - 2) { - throw new Error('message too long') - } - var ps = Buffer.alloc(k - mLen - hLen2 - 2) - var dblen = k - hLen - 1 - var seed = randomBytes(hLen) - var maskedDb = xor(Buffer.concat([iHash, ps, Buffer.alloc(1, 1), msg], dblen), mgf(seed, dblen)) - var maskedSeed = xor(seed, mgf(maskedDb, hLen)) - return new BN(Buffer.concat([Buffer.alloc(1), maskedSeed, maskedDb], k)) -} -function pkcs1 (key, msg, reverse) { - var mLen = msg.length - var k = key.modulus.byteLength() - if (mLen > k - 11) { - throw new Error('message too long') - } - var ps - if (reverse) { - ps = Buffer.alloc(k - mLen - 3, 0xff) - } else { - ps = nonZero(k - mLen - 3) - } - return new BN(Buffer.concat([Buffer.from([0, reverse ? 1 : 2]), ps, Buffer.alloc(1), msg], k)) -} -function nonZero (len) { - var out = Buffer.allocUnsafe(len) - var i = 0 - var cache = randomBytes(len * 2) - var cur = 0 - var num - while (i < len) { - if (cur === cache.length) { - cache = randomBytes(len * 2) - cur = 0 - } - num = cache[cur++] - if (num) { - out[i++] = num - } - } - return out -} - -},{"./mgf":199,"./withPublic":202,"./xor":203,"bn.js":52,"browserify-rsa":75,"create-hash":94,"parse-asn1":189,"randombytes":208,"safe-buffer":216}],202:[function(require,module,exports){ -var BN = require('bn.js') -var Buffer = require('safe-buffer').Buffer - -function withPublic (paddedMsg, key) { - return Buffer.from(paddedMsg - .toRed(BN.mont(key.modulus)) - .redPow(new BN(key.publicExponent)) - .fromRed() - .toArray()) -} - -module.exports = withPublic - -},{"bn.js":52,"safe-buffer":216}],203:[function(require,module,exports){ -module.exports = function xor (a, b) { - var len = a.length - var i = -1 - while (++i < len) { - a[i] ^= b[i] - } - return a -} - -},{}],204:[function(require,module,exports){ -(function (global){ -/*! https://mths.be/punycode v1.4.1 by @mathias */ -;(function(root) { - - /** Detect free variables */ - var freeExports = typeof exports == 'object' && exports && - !exports.nodeType && exports; - var freeModule = typeof module == 'object' && module && - !module.nodeType && module; - var freeGlobal = typeof global == 'object' && global; - if ( - freeGlobal.global === freeGlobal || - freeGlobal.window === freeGlobal || - freeGlobal.self === freeGlobal - ) { - root = freeGlobal; - } - - /** - * The `punycode` object. - * @name punycode - * @type Object - */ - var punycode, - - /** Highest positive signed 32-bit float value */ - maxInt = 2147483647, // aka. 0x7FFFFFFF or 2^31-1 - - /** Bootstring parameters */ - base = 36, - tMin = 1, - tMax = 26, - skew = 38, - damp = 700, - initialBias = 72, - initialN = 128, // 0x80 - delimiter = '-', // '\x2D' - - /** Regular expressions */ - regexPunycode = /^xn--/, - regexNonASCII = /[^\x20-\x7E]/, // unprintable ASCII chars + non-ASCII chars - regexSeparators = /[\x2E\u3002\uFF0E\uFF61]/g, // RFC 3490 separators - - /** Error messages */ - errors = { - 'overflow': 'Overflow: input needs wider integers to process', - 'not-basic': 'Illegal input >= 0x80 (not a basic code point)', - 'invalid-input': 'Invalid input' - }, - - /** Convenience shortcuts */ - baseMinusTMin = base - tMin, - floor = Math.floor, - stringFromCharCode = String.fromCharCode, - - /** Temporary variable */ - key; - - /*--------------------------------------------------------------------------*/ - - /** - * A generic error utility function. - * @private - * @param {String} type The error type. - * @returns {Error} Throws a `RangeError` with the applicable error message. - */ - function error(type) { - throw new RangeError(errors[type]); - } - - /** - * A generic `Array#map` utility function. - * @private - * @param {Array} array The array to iterate over. - * @param {Function} callback The function that gets called for every array - * item. - * @returns {Array} A new array of values returned by the callback function. - */ - function map(array, fn) { - var length = array.length; - var result = []; - while (length--) { - result[length] = fn(array[length]); - } - return result; - } - - /** - * A simple `Array#map`-like wrapper to work with domain name strings or email - * addresses. - * @private - * @param {String} domain The domain name or email address. - * @param {Function} callback The function that gets called for every - * character. - * @returns {Array} A new string of characters returned by the callback - * function. - */ - function mapDomain(string, fn) { - var parts = string.split('@'); - var result = ''; - if (parts.length > 1) { - // In email addresses, only the domain name should be punycoded. Leave - // the local part (i.e. everything up to `@`) intact. - result = parts[0] + '@'; - string = parts[1]; - } - // Avoid `split(regex)` for IE8 compatibility. See #17. - string = string.replace(regexSeparators, '\x2E'); - var labels = string.split('.'); - var encoded = map(labels, fn).join('.'); - return result + encoded; - } - - /** - * Creates an array containing the numeric code points of each Unicode - * character in the string. While JavaScript uses UCS-2 internally, - * this function will convert a pair of surrogate halves (each of which - * UCS-2 exposes as separate characters) into a single code point, - * matching UTF-16. - * @see `punycode.ucs2.encode` - * @see - * @memberOf punycode.ucs2 - * @name decode - * @param {String} string The Unicode input string (UCS-2). - * @returns {Array} The new array of code points. - */ - function ucs2decode(string) { - var output = [], - counter = 0, - length = string.length, - value, - extra; - while (counter < length) { - value = string.charCodeAt(counter++); - if (value >= 0xD800 && value <= 0xDBFF && counter < length) { - // high surrogate, and there is a next character - extra = string.charCodeAt(counter++); - if ((extra & 0xFC00) == 0xDC00) { // low surrogate - output.push(((value & 0x3FF) << 10) + (extra & 0x3FF) + 0x10000); - } else { - // unmatched surrogate; only append this code unit, in case the next - // code unit is the high surrogate of a surrogate pair - output.push(value); - counter--; - } - } else { - output.push(value); - } - } - return output; - } - - /** - * Creates a string based on an array of numeric code points. - * @see `punycode.ucs2.decode` - * @memberOf punycode.ucs2 - * @name encode - * @param {Array} codePoints The array of numeric code points. - * @returns {String} The new Unicode string (UCS-2). - */ - function ucs2encode(array) { - return map(array, function(value) { - var output = ''; - if (value > 0xFFFF) { - value -= 0x10000; - output += stringFromCharCode(value >>> 10 & 0x3FF | 0xD800); - value = 0xDC00 | value & 0x3FF; - } - output += stringFromCharCode(value); - return output; - }).join(''); - } - - /** - * Converts a basic code point into a digit/integer. - * @see `digitToBasic()` - * @private - * @param {Number} codePoint The basic numeric code point value. - * @returns {Number} The numeric value of a basic code point (for use in - * representing integers) in the range `0` to `base - 1`, or `base` if - * the code point does not represent a value. - */ - function basicToDigit(codePoint) { - if (codePoint - 48 < 10) { - return codePoint - 22; - } - if (codePoint - 65 < 26) { - return codePoint - 65; - } - if (codePoint - 97 < 26) { - return codePoint - 97; - } - return base; - } - - /** - * Converts a digit/integer into a basic code point. - * @see `basicToDigit()` - * @private - * @param {Number} digit The numeric value of a basic code point. - * @returns {Number} The basic code point whose value (when used for - * representing integers) is `digit`, which needs to be in the range - * `0` to `base - 1`. If `flag` is non-zero, the uppercase form is - * used; else, the lowercase form is used. The behavior is undefined - * if `flag` is non-zero and `digit` has no uppercase form. - */ - function digitToBasic(digit, flag) { - // 0..25 map to ASCII a..z or A..Z - // 26..35 map to ASCII 0..9 - return digit + 22 + 75 * (digit < 26) - ((flag != 0) << 5); - } - - /** - * Bias adaptation function as per section 3.4 of RFC 3492. - * https://tools.ietf.org/html/rfc3492#section-3.4 - * @private - */ - function adapt(delta, numPoints, firstTime) { - var k = 0; - delta = firstTime ? floor(delta / damp) : delta >> 1; - delta += floor(delta / numPoints); - for (/* no initialization */; delta > baseMinusTMin * tMax >> 1; k += base) { - delta = floor(delta / baseMinusTMin); - } - return floor(k + (baseMinusTMin + 1) * delta / (delta + skew)); - } - - /** - * Converts a Punycode string of ASCII-only symbols to a string of Unicode - * symbols. - * @memberOf punycode - * @param {String} input The Punycode string of ASCII-only symbols. - * @returns {String} The resulting string of Unicode symbols. - */ - function decode(input) { - // Don't use UCS-2 - var output = [], - inputLength = input.length, - out, - i = 0, - n = initialN, - bias = initialBias, - basic, - j, - index, - oldi, - w, - k, - digit, - t, - /** Cached calculation results */ - baseMinusT; - - // Handle the basic code points: let `basic` be the number of input code - // points before the last delimiter, or `0` if there is none, then copy - // the first basic code points to the output. - - basic = input.lastIndexOf(delimiter); - if (basic < 0) { - basic = 0; - } - - for (j = 0; j < basic; ++j) { - // if it's not a basic code point - if (input.charCodeAt(j) >= 0x80) { - error('not-basic'); - } - output.push(input.charCodeAt(j)); - } - - // Main decoding loop: start just after the last delimiter if any basic code - // points were copied; start at the beginning otherwise. - - for (index = basic > 0 ? basic + 1 : 0; index < inputLength; /* no final expression */) { - - // `index` is the index of the next character to be consumed. - // Decode a generalized variable-length integer into `delta`, - // which gets added to `i`. The overflow checking is easier - // if we increase `i` as we go, then subtract off its starting - // value at the end to obtain `delta`. - for (oldi = i, w = 1, k = base; /* no condition */; k += base) { - - if (index >= inputLength) { - error('invalid-input'); - } - - digit = basicToDigit(input.charCodeAt(index++)); - - if (digit >= base || digit > floor((maxInt - i) / w)) { - error('overflow'); - } - - i += digit * w; - t = k <= bias ? tMin : (k >= bias + tMax ? tMax : k - bias); - - if (digit < t) { - break; - } - - baseMinusT = base - t; - if (w > floor(maxInt / baseMinusT)) { - error('overflow'); - } - - w *= baseMinusT; - - } - - out = output.length + 1; - bias = adapt(i - oldi, out, oldi == 0); - - // `i` was supposed to wrap around from `out` to `0`, - // incrementing `n` each time, so we'll fix that now: - if (floor(i / out) > maxInt - n) { - error('overflow'); - } - - n += floor(i / out); - i %= out; - - // Insert `n` at position `i` of the output - output.splice(i++, 0, n); - - } - - return ucs2encode(output); - } - - /** - * Converts a string of Unicode symbols (e.g. a domain name label) to a - * Punycode string of ASCII-only symbols. - * @memberOf punycode - * @param {String} input The string of Unicode symbols. - * @returns {String} The resulting Punycode string of ASCII-only symbols. - */ - function encode(input) { - var n, - delta, - handledCPCount, - basicLength, - bias, - j, - m, - q, - k, - t, - currentValue, - output = [], - /** `inputLength` will hold the number of code points in `input`. */ - inputLength, - /** Cached calculation results */ - handledCPCountPlusOne, - baseMinusT, - qMinusT; - - // Convert the input in UCS-2 to Unicode - input = ucs2decode(input); - - // Cache the length - inputLength = input.length; - - // Initialize the state - n = initialN; - delta = 0; - bias = initialBias; - - // Handle the basic code points - for (j = 0; j < inputLength; ++j) { - currentValue = input[j]; - if (currentValue < 0x80) { - output.push(stringFromCharCode(currentValue)); - } - } - - handledCPCount = basicLength = output.length; - - // `handledCPCount` is the number of code points that have been handled; - // `basicLength` is the number of basic code points. - - // Finish the basic string - if it is not empty - with a delimiter - if (basicLength) { - output.push(delimiter); - } - - // Main encoding loop: - while (handledCPCount < inputLength) { - - // All non-basic code points < n have been handled already. Find the next - // larger one: - for (m = maxInt, j = 0; j < inputLength; ++j) { - currentValue = input[j]; - if (currentValue >= n && currentValue < m) { - m = currentValue; - } - } - - // Increase `delta` enough to advance the decoder's state to , - // but guard against overflow - handledCPCountPlusOne = handledCPCount + 1; - if (m - n > floor((maxInt - delta) / handledCPCountPlusOne)) { - error('overflow'); - } - - delta += (m - n) * handledCPCountPlusOne; - n = m; - - for (j = 0; j < inputLength; ++j) { - currentValue = input[j]; - - if (currentValue < n && ++delta > maxInt) { - error('overflow'); - } - - if (currentValue == n) { - // Represent delta as a generalized variable-length integer - for (q = delta, k = base; /* no condition */; k += base) { - t = k <= bias ? tMin : (k >= bias + tMax ? tMax : k - bias); - if (q < t) { - break; - } - qMinusT = q - t; - baseMinusT = base - t; - output.push( - stringFromCharCode(digitToBasic(t + qMinusT % baseMinusT, 0)) - ); - q = floor(qMinusT / baseMinusT); - } - - output.push(stringFromCharCode(digitToBasic(q, 0))); - bias = adapt(delta, handledCPCountPlusOne, handledCPCount == basicLength); - delta = 0; - ++handledCPCount; - } - } - - ++delta; - ++n; - - } - return output.join(''); - } - - /** - * Converts a Punycode string representing a domain name or an email address - * to Unicode. Only the Punycoded parts of the input will be converted, i.e. - * it doesn't matter if you call it on a string that has already been - * converted to Unicode. - * @memberOf punycode - * @param {String} input The Punycoded domain name or email address to - * convert to Unicode. - * @returns {String} The Unicode representation of the given Punycode - * string. - */ - function toUnicode(input) { - return mapDomain(input, function(string) { - return regexPunycode.test(string) - ? decode(string.slice(4).toLowerCase()) - : string; - }); - } - - /** - * Converts a Unicode string representing a domain name or an email address to - * Punycode. Only the non-ASCII parts of the domain name will be converted, - * i.e. it doesn't matter if you call it with a domain that's already in - * ASCII. - * @memberOf punycode - * @param {String} input The domain name or email address to convert, as a - * Unicode string. - * @returns {String} The Punycode representation of the given domain name or - * email address. - */ - function toASCII(input) { - return mapDomain(input, function(string) { - return regexNonASCII.test(string) - ? 'xn--' + encode(string) - : string; - }); - } - - /*--------------------------------------------------------------------------*/ - - /** Define the public API */ - punycode = { - /** - * A string representing the current Punycode.js version number. - * @memberOf punycode - * @type String - */ - 'version': '1.4.1', - /** - * An object of methods to convert from JavaScript's internal character - * representation (UCS-2) to Unicode code points, and back. - * @see - * @memberOf punycode - * @type Object - */ - 'ucs2': { - 'decode': ucs2decode, - 'encode': ucs2encode - }, - 'decode': decode, - 'encode': encode, - 'toASCII': toASCII, - 'toUnicode': toUnicode - }; - - /** Expose `punycode` */ - // Some AMD build optimizers, like r.js, check for specific condition patterns - // like the following: - if ( - typeof define == 'function' && - typeof define.amd == 'object' && - define.amd - ) { - define('punycode', function() { - return punycode; - }); - } else if (freeExports && freeModule) { - if (module.exports == freeExports) { - // in Node.js, io.js, or RingoJS v0.8.0+ - freeModule.exports = punycode; - } else { - // in Narwhal or RingoJS v0.7.0- - for (key in punycode) { - punycode.hasOwnProperty(key) && (freeExports[key] = punycode[key]); - } - } - } else { - // in Rhino or a web browser - root.punycode = punycode; - } - -}(this)); - -}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) -},{}],205:[function(require,module,exports){ -// Copyright Joyent, Inc. and other Node contributors. -// -// Permission is hereby granted, free of charge, to any person obtaining a -// copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to permit -// persons to whom the Software is furnished to do so, subject to the -// following conditions: -// -// The above copyright notice and this permission notice shall be included -// in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN -// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR -// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE -// USE OR OTHER DEALINGS IN THE SOFTWARE. - -'use strict'; - -// If obj.hasOwnProperty has been overridden, then calling -// obj.hasOwnProperty(prop) will break. -// See: https://github.com/joyent/node/issues/1707 -function hasOwnProperty(obj, prop) { - return Object.prototype.hasOwnProperty.call(obj, prop); -} - -module.exports = function(qs, sep, eq, options) { - sep = sep || '&'; - eq = eq || '='; - var obj = {}; - - if (typeof qs !== 'string' || qs.length === 0) { - return obj; - } - - var regexp = /\+/g; - qs = qs.split(sep); - - var maxKeys = 1000; - if (options && typeof options.maxKeys === 'number') { - maxKeys = options.maxKeys; - } - - var len = qs.length; - // maxKeys <= 0 means that we should not limit keys count - if (maxKeys > 0 && len > maxKeys) { - len = maxKeys; - } - - for (var i = 0; i < len; ++i) { - var x = qs[i].replace(regexp, '%20'), - idx = x.indexOf(eq), - kstr, vstr, k, v; - - if (idx >= 0) { - kstr = x.substr(0, idx); - vstr = x.substr(idx + 1); - } else { - kstr = x; - vstr = ''; - } - - k = decodeURIComponent(kstr); - v = decodeURIComponent(vstr); - - if (!hasOwnProperty(obj, k)) { - obj[k] = v; - } else if (isArray(obj[k])) { - obj[k].push(v); - } else { - obj[k] = [obj[k], v]; - } - } - - return obj; -}; - -var isArray = Array.isArray || function (xs) { - return Object.prototype.toString.call(xs) === '[object Array]'; -}; - -},{}],206:[function(require,module,exports){ -// Copyright Joyent, Inc. and other Node contributors. -// -// Permission is hereby granted, free of charge, to any person obtaining a -// copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to permit -// persons to whom the Software is furnished to do so, subject to the -// following conditions: -// -// The above copyright notice and this permission notice shall be included -// in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN -// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR -// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE -// USE OR OTHER DEALINGS IN THE SOFTWARE. - -'use strict'; - -var stringifyPrimitive = function(v) { - switch (typeof v) { - case 'string': - return v; - - case 'boolean': - return v ? 'true' : 'false'; - - case 'number': - return isFinite(v) ? v : ''; - - default: - return ''; - } -}; - -module.exports = function(obj, sep, eq, name) { - sep = sep || '&'; - eq = eq || '='; - if (obj === null) { - obj = undefined; - } - - if (typeof obj === 'object') { - return map(objectKeys(obj), function(k) { - var ks = encodeURIComponent(stringifyPrimitive(k)) + eq; - if (isArray(obj[k])) { - return map(obj[k], function(v) { - return ks + encodeURIComponent(stringifyPrimitive(v)); - }).join(sep); - } else { - return ks + encodeURIComponent(stringifyPrimitive(obj[k])); - } - }).join(sep); - - } - - if (!name) return ''; - return encodeURIComponent(stringifyPrimitive(name)) + eq + - encodeURIComponent(stringifyPrimitive(obj)); -}; - -var isArray = Array.isArray || function (xs) { - return Object.prototype.toString.call(xs) === '[object Array]'; -}; - -function map (xs, f) { - if (xs.map) return xs.map(f); - var res = []; - for (var i = 0; i < xs.length; i++) { - res.push(f(xs[i], i)); - } - return res; -} - -var objectKeys = Object.keys || function (obj) { - var res = []; - for (var key in obj) { - if (Object.prototype.hasOwnProperty.call(obj, key)) res.push(key); - } - return res; -}; - -},{}],207:[function(require,module,exports){ -'use strict'; - -exports.decode = exports.parse = require('./decode'); -exports.encode = exports.stringify = require('./encode'); - -},{"./decode":205,"./encode":206}],208:[function(require,module,exports){ -(function (process,global){ -'use strict' - -// limit of Crypto.getRandomValues() -// https://developer.mozilla.org/en-US/docs/Web/API/Crypto/getRandomValues -var MAX_BYTES = 65536 - -// Node supports requesting up to this number of bytes -// https://github.com/nodejs/node/blob/master/lib/internal/crypto/random.js#L48 -var MAX_UINT32 = 4294967295 - -function oldBrowser () { - throw new Error('Secure random number generation is not supported by this browser.\nUse Chrome, Firefox or Internet Explorer 11') -} - -var Buffer = require('safe-buffer').Buffer -var crypto = global.crypto || global.msCrypto - -if (crypto && crypto.getRandomValues) { - module.exports = randomBytes -} else { - module.exports = oldBrowser -} - -function randomBytes (size, cb) { - // phantomjs needs to throw - if (size > MAX_UINT32) throw new RangeError('requested too many random bytes') - - var bytes = Buffer.allocUnsafe(size) - - if (size > 0) { // getRandomValues fails on IE if size == 0 - if (size > MAX_BYTES) { // this is the max bytes crypto.getRandomValues - // can do at once see https://developer.mozilla.org/en-US/docs/Web/API/window.crypto.getRandomValues - for (var generated = 0; generated < size; generated += MAX_BYTES) { - // buffer.slice automatically checks if the end is past the end of - // the buffer so we don't have to here - crypto.getRandomValues(bytes.slice(generated, generated + MAX_BYTES)) - } - } else { - crypto.getRandomValues(bytes) - } - } - - if (typeof cb === 'function') { - return process.nextTick(function () { - cb(null, bytes) - }) - } - - return bytes -} - -}).call(this,require('_process'),typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) -},{"_process":197,"safe-buffer":216}],209:[function(require,module,exports){ -(function (process,global){ -'use strict' - -function oldBrowser () { - throw new Error('secure random number generation not supported by this browser\nuse chrome, FireFox or Internet Explorer 11') -} -var safeBuffer = require('safe-buffer') -var randombytes = require('randombytes') -var Buffer = safeBuffer.Buffer -var kBufferMaxLength = safeBuffer.kMaxLength -var crypto = global.crypto || global.msCrypto -var kMaxUint32 = Math.pow(2, 32) - 1 -function assertOffset (offset, length) { - if (typeof offset !== 'number' || offset !== offset) { // eslint-disable-line no-self-compare - throw new TypeError('offset must be a number') - } - - if (offset > kMaxUint32 || offset < 0) { - throw new TypeError('offset must be a uint32') - } - - if (offset > kBufferMaxLength || offset > length) { - throw new RangeError('offset out of range') - } -} - -function assertSize (size, offset, length) { - if (typeof size !== 'number' || size !== size) { // eslint-disable-line no-self-compare - throw new TypeError('size must be a number') - } - - if (size > kMaxUint32 || size < 0) { - throw new TypeError('size must be a uint32') - } - - if (size + offset > length || size > kBufferMaxLength) { - throw new RangeError('buffer too small') - } -} -if ((crypto && crypto.getRandomValues) || !process.browser) { - exports.randomFill = randomFill - exports.randomFillSync = randomFillSync -} else { - exports.randomFill = oldBrowser - exports.randomFillSync = oldBrowser -} -function randomFill (buf, offset, size, cb) { - if (!Buffer.isBuffer(buf) && !(buf instanceof global.Uint8Array)) { - throw new TypeError('"buf" argument must be a Buffer or Uint8Array') - } - - if (typeof offset === 'function') { - cb = offset - offset = 0 - size = buf.length - } else if (typeof size === 'function') { - cb = size - size = buf.length - offset - } else if (typeof cb !== 'function') { - throw new TypeError('"cb" argument must be a function') - } - assertOffset(offset, buf.length) - assertSize(size, offset, buf.length) - return actualFill(buf, offset, size, cb) -} - -function actualFill (buf, offset, size, cb) { - if (process.browser) { - var ourBuf = buf.buffer - var uint = new Uint8Array(ourBuf, offset, size) - crypto.getRandomValues(uint) - if (cb) { - process.nextTick(function () { - cb(null, buf) - }) - return - } - return buf - } - if (cb) { - randombytes(size, function (err, bytes) { - if (err) { - return cb(err) - } - bytes.copy(buf, offset) - cb(null, buf) - }) - return - } - var bytes = randombytes(size) - bytes.copy(buf, offset) - return buf -} -function randomFillSync (buf, offset, size) { - if (typeof offset === 'undefined') { - offset = 0 - } - if (!Buffer.isBuffer(buf) && !(buf instanceof global.Uint8Array)) { - throw new TypeError('"buf" argument must be a Buffer or Uint8Array') - } - - assertOffset(offset, buf.length) - - if (size === undefined) size = buf.length - offset - - assertSize(size, offset, buf.length) - - return actualFill(buf, offset, size) -} - -}).call(this,require('_process'),typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) -},{"_process":197,"randombytes":208,"safe-buffer":216}],210:[function(require,module,exports){ -(function (process){ -// Copyright Joyent, Inc. and other Node contributors. -// -// Permission is hereby granted, free of charge, to any person obtaining a -// copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to permit -// persons to whom the Software is furnished to do so, subject to the -// following conditions: -// -// The above copyright notice and this permission notice shall be included -// in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN -// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR -// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE -// USE OR OTHER DEALINGS IN THE SOFTWARE. - -// a duplex stream is just a stream that is both readable and writable. -// Since JS doesn't have multiple prototypal inheritance, this class -// prototypally inherits from Readable, and then parasitically from -// Writable. - -module.exports = Duplex; - -/**/ -var objectKeys = Object.keys || function (obj) { - var keys = []; - for (var key in obj) keys.push(key); - return keys; -} -/**/ - - -/**/ -var util = require('core-util-is'); -util.inherits = require('inherits'); -/**/ - -var Readable = require('./_stream_readable'); -var Writable = require('./_stream_writable'); - -util.inherits(Duplex, Readable); - -forEach(objectKeys(Writable.prototype), function(method) { - if (!Duplex.prototype[method]) - Duplex.prototype[method] = Writable.prototype[method]; -}); - -function Duplex(options) { - if (!(this instanceof Duplex)) - return new Duplex(options); - - Readable.call(this, options); - Writable.call(this, options); - - if (options && options.readable === false) - this.readable = false; - - if (options && options.writable === false) - this.writable = false; - - this.allowHalfOpen = true; - if (options && options.allowHalfOpen === false) - this.allowHalfOpen = false; - - this.once('end', onend); -} - -// the no-half-open enforcer -function onend() { - // if we allow half-open state, or if the writable side ended, - // then we're ok. - if (this.allowHalfOpen || this._writableState.ended) - return; - - // no more data can be written. - // But allow more writes to happen in this tick. - process.nextTick(this.end.bind(this)); -} - -function forEach (xs, f) { - for (var i = 0, l = xs.length; i < l; i++) { - f(xs[i], i); - } -} - -}).call(this,require('_process')) -},{"./_stream_readable":211,"./_stream_writable":213,"_process":197,"core-util-is":92,"inherits":156}],211:[function(require,module,exports){ -(function (process){ -// Copyright Joyent, Inc. and other Node contributors. -// -// Permission is hereby granted, free of charge, to any person obtaining a -// copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to permit -// persons to whom the Software is furnished to do so, subject to the -// following conditions: -// -// The above copyright notice and this permission notice shall be included -// in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN -// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR -// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE -// USE OR OTHER DEALINGS IN THE SOFTWARE. - -module.exports = Readable; - -/**/ -var isArray = require('isarray'); -/**/ - - -/**/ -var Buffer = require('buffer').Buffer; -/**/ - -Readable.ReadableState = ReadableState; - -var EE = require('events').EventEmitter; - -/**/ -if (!EE.listenerCount) EE.listenerCount = function(emitter, type) { - return emitter.listeners(type).length; -}; -/**/ - -var Stream = require('stream'); - -/**/ -var util = require('core-util-is'); -util.inherits = require('inherits'); -/**/ - -var StringDecoder; - - -/**/ -var debug = require('util'); -if (debug && debug.debuglog) { - debug = debug.debuglog('stream'); -} else { - debug = function () {}; -} -/**/ - - -util.inherits(Readable, Stream); - -function ReadableState(options, stream) { - var Duplex = require('./_stream_duplex'); - - options = options || {}; - - // the point at which it stops calling _read() to fill the buffer - // Note: 0 is a valid value, means "don't call _read preemptively ever" - var hwm = options.highWaterMark; - var defaultHwm = options.objectMode ? 16 : 16 * 1024; - this.highWaterMark = (hwm || hwm === 0) ? hwm : defaultHwm; - - // cast to ints. - this.highWaterMark = ~~this.highWaterMark; - - this.buffer = []; - this.length = 0; - this.pipes = null; - this.pipesCount = 0; - this.flowing = null; - this.ended = false; - this.endEmitted = false; - this.reading = false; - - // a flag to be able to tell if the onwrite cb is called immediately, - // or on a later tick. We set this to true at first, because any - // actions that shouldn't happen until "later" should generally also - // not happen before the first write call. - this.sync = true; - - // whenever we return null, then we set a flag to say - // that we're awaiting a 'readable' event emission. - this.needReadable = false; - this.emittedReadable = false; - this.readableListening = false; - - - // object stream flag. Used to make read(n) ignore n and to - // make all the buffer merging and length checks go away - this.objectMode = !!options.objectMode; - - if (stream instanceof Duplex) - this.objectMode = this.objectMode || !!options.readableObjectMode; - - // Crypto is kind of old and crusty. Historically, its default string - // encoding is 'binary' so we have to make this configurable. - // Everything else in the universe uses 'utf8', though. - this.defaultEncoding = options.defaultEncoding || 'utf8'; - - // when piping, we only care about 'readable' events that happen - // after read()ing all the bytes and not getting any pushback. - this.ranOut = false; - - // the number of writers that are awaiting a drain event in .pipe()s - this.awaitDrain = 0; - - // if true, a maybeReadMore has been scheduled - this.readingMore = false; - - this.decoder = null; - this.encoding = null; - if (options.encoding) { - if (!StringDecoder) - StringDecoder = require('string_decoder/').StringDecoder; - this.decoder = new StringDecoder(options.encoding); - this.encoding = options.encoding; - } -} - -function Readable(options) { - var Duplex = require('./_stream_duplex'); - - if (!(this instanceof Readable)) - return new Readable(options); - - this._readableState = new ReadableState(options, this); - - // legacy - this.readable = true; - - Stream.call(this); -} - -// Manually shove something into the read() buffer. -// This returns true if the highWaterMark has not been hit yet, -// similar to how Writable.write() returns true if you should -// write() some more. -Readable.prototype.push = function(chunk, encoding) { - var state = this._readableState; - - if (util.isString(chunk) && !state.objectMode) { - encoding = encoding || state.defaultEncoding; - if (encoding !== state.encoding) { - chunk = new Buffer(chunk, encoding); - encoding = ''; - } - } - - return readableAddChunk(this, state, chunk, encoding, false); -}; - -// Unshift should *always* be something directly out of read() -Readable.prototype.unshift = function(chunk) { - var state = this._readableState; - return readableAddChunk(this, state, chunk, '', true); -}; - -function readableAddChunk(stream, state, chunk, encoding, addToFront) { - var er = chunkInvalid(state, chunk); - if (er) { - stream.emit('error', er); - } else if (util.isNullOrUndefined(chunk)) { - state.reading = false; - if (!state.ended) - onEofChunk(stream, state); - } else if (state.objectMode || chunk && chunk.length > 0) { - if (state.ended && !addToFront) { - var e = new Error('stream.push() after EOF'); - stream.emit('error', e); - } else if (state.endEmitted && addToFront) { - var e = new Error('stream.unshift() after end event'); - stream.emit('error', e); - } else { - if (state.decoder && !addToFront && !encoding) - chunk = state.decoder.write(chunk); - - if (!addToFront) - state.reading = false; - - // if we want the data now, just emit it. - if (state.flowing && state.length === 0 && !state.sync) { - stream.emit('data', chunk); - stream.read(0); - } else { - // update the buffer info. - state.length += state.objectMode ? 1 : chunk.length; - if (addToFront) - state.buffer.unshift(chunk); - else - state.buffer.push(chunk); - - if (state.needReadable) - emitReadable(stream); - } - - maybeReadMore(stream, state); - } - } else if (!addToFront) { - state.reading = false; - } - - return needMoreData(state); -} - - - -// if it's past the high water mark, we can push in some more. -// Also, if we have no data yet, we can stand some -// more bytes. This is to work around cases where hwm=0, -// such as the repl. Also, if the push() triggered a -// readable event, and the user called read(largeNumber) such that -// needReadable was set, then we ought to push more, so that another -// 'readable' event will be triggered. -function needMoreData(state) { - return !state.ended && - (state.needReadable || - state.length < state.highWaterMark || - state.length === 0); -} - -// backwards compatibility. -Readable.prototype.setEncoding = function(enc) { - if (!StringDecoder) - StringDecoder = require('string_decoder/').StringDecoder; - this._readableState.decoder = new StringDecoder(enc); - this._readableState.encoding = enc; - return this; -}; - -// Don't raise the hwm > 128MB -var MAX_HWM = 0x800000; -function roundUpToNextPowerOf2(n) { - if (n >= MAX_HWM) { - n = MAX_HWM; - } else { - // Get the next highest power of 2 - n--; - for (var p = 1; p < 32; p <<= 1) n |= n >> p; - n++; - } - return n; -} - -function howMuchToRead(n, state) { - if (state.length === 0 && state.ended) - return 0; - - if (state.objectMode) - return n === 0 ? 0 : 1; - - if (isNaN(n) || util.isNull(n)) { - // only flow one buffer at a time - if (state.flowing && state.buffer.length) - return state.buffer[0].length; - else - return state.length; - } - - if (n <= 0) - return 0; - - // If we're asking for more than the target buffer level, - // then raise the water mark. Bump up to the next highest - // power of 2, to prevent increasing it excessively in tiny - // amounts. - if (n > state.highWaterMark) - state.highWaterMark = roundUpToNextPowerOf2(n); - - // don't have that much. return null, unless we've ended. - if (n > state.length) { - if (!state.ended) { - state.needReadable = true; - return 0; - } else - return state.length; - } - - return n; -} - -// you can override either this method, or the async _read(n) below. -Readable.prototype.read = function(n) { - debug('read', n); - var state = this._readableState; - var nOrig = n; - - if (!util.isNumber(n) || n > 0) - state.emittedReadable = false; - - // if we're doing read(0) to trigger a readable event, but we - // already have a bunch of data in the buffer, then just trigger - // the 'readable' event and move on. - if (n === 0 && - state.needReadable && - (state.length >= state.highWaterMark || state.ended)) { - debug('read: emitReadable', state.length, state.ended); - if (state.length === 0 && state.ended) - endReadable(this); - else - emitReadable(this); - return null; - } - - n = howMuchToRead(n, state); - - // if we've ended, and we're now clear, then finish it up. - if (n === 0 && state.ended) { - if (state.length === 0) - endReadable(this); - return null; - } - - // All the actual chunk generation logic needs to be - // *below* the call to _read. The reason is that in certain - // synthetic stream cases, such as passthrough streams, _read - // may be a completely synchronous operation which may change - // the state of the read buffer, providing enough data when - // before there was *not* enough. - // - // So, the steps are: - // 1. Figure out what the state of things will be after we do - // a read from the buffer. - // - // 2. If that resulting state will trigger a _read, then call _read. - // Note that this may be asynchronous, or synchronous. Yes, it is - // deeply ugly to write APIs this way, but that still doesn't mean - // that the Readable class should behave improperly, as streams are - // designed to be sync/async agnostic. - // Take note if the _read call is sync or async (ie, if the read call - // has returned yet), so that we know whether or not it's safe to emit - // 'readable' etc. - // - // 3. Actually pull the requested chunks out of the buffer and return. - - // if we need a readable event, then we need to do some reading. - var doRead = state.needReadable; - debug('need readable', doRead); - - // if we currently have less than the highWaterMark, then also read some - if (state.length === 0 || state.length - n < state.highWaterMark) { - doRead = true; - debug('length less than watermark', doRead); - } - - // however, if we've ended, then there's no point, and if we're already - // reading, then it's unnecessary. - if (state.ended || state.reading) { - doRead = false; - debug('reading or ended', doRead); - } - - if (doRead) { - debug('do read'); - state.reading = true; - state.sync = true; - // if the length is currently zero, then we *need* a readable event. - if (state.length === 0) - state.needReadable = true; - // call internal read method - this._read(state.highWaterMark); - state.sync = false; - } - - // If _read pushed data synchronously, then `reading` will be false, - // and we need to re-evaluate how much data we can return to the user. - if (doRead && !state.reading) - n = howMuchToRead(nOrig, state); - - var ret; - if (n > 0) - ret = fromList(n, state); - else - ret = null; - - if (util.isNull(ret)) { - state.needReadable = true; - n = 0; - } - - state.length -= n; - - // If we have nothing in the buffer, then we want to know - // as soon as we *do* get something into the buffer. - if (state.length === 0 && !state.ended) - state.needReadable = true; - - // If we tried to read() past the EOF, then emit end on the next tick. - if (nOrig !== n && state.ended && state.length === 0) - endReadable(this); - - if (!util.isNull(ret)) - this.emit('data', ret); - - return ret; -}; - -function chunkInvalid(state, chunk) { - var er = null; - if (!util.isBuffer(chunk) && - !util.isString(chunk) && - !util.isNullOrUndefined(chunk) && - !state.objectMode) { - er = new TypeError('Invalid non-string/buffer chunk'); - } - return er; -} - - -function onEofChunk(stream, state) { - if (state.decoder && !state.ended) { - var chunk = state.decoder.end(); - if (chunk && chunk.length) { - state.buffer.push(chunk); - state.length += state.objectMode ? 1 : chunk.length; - } - } - state.ended = true; - - // emit 'readable' now to make sure it gets picked up. - emitReadable(stream); -} - -// Don't emit readable right away in sync mode, because this can trigger -// another read() call => stack overflow. This way, it might trigger -// a nextTick recursion warning, but that's not so bad. -function emitReadable(stream) { - var state = stream._readableState; - state.needReadable = false; - if (!state.emittedReadable) { - debug('emitReadable', state.flowing); - state.emittedReadable = true; - if (state.sync) - process.nextTick(function() { - emitReadable_(stream); - }); - else - emitReadable_(stream); - } -} - -function emitReadable_(stream) { - debug('emit readable'); - stream.emit('readable'); - flow(stream); -} - - -// at this point, the user has presumably seen the 'readable' event, -// and called read() to consume some data. that may have triggered -// in turn another _read(n) call, in which case reading = true if -// it's in progress. -// However, if we're not ended, or reading, and the length < hwm, -// then go ahead and try to read some more preemptively. -function maybeReadMore(stream, state) { - if (!state.readingMore) { - state.readingMore = true; - process.nextTick(function() { - maybeReadMore_(stream, state); - }); - } -} - -function maybeReadMore_(stream, state) { - var len = state.length; - while (!state.reading && !state.flowing && !state.ended && - state.length < state.highWaterMark) { - debug('maybeReadMore read 0'); - stream.read(0); - if (len === state.length) - // didn't get any data, stop spinning. - break; - else - len = state.length; - } - state.readingMore = false; -} - -// abstract method. to be overridden in specific implementation classes. -// call cb(er, data) where data is <= n in length. -// for virtual (non-string, non-buffer) streams, "length" is somewhat -// arbitrary, and perhaps not very meaningful. -Readable.prototype._read = function(n) { - this.emit('error', new Error('not implemented')); -}; - -Readable.prototype.pipe = function(dest, pipeOpts) { - var src = this; - var state = this._readableState; - - switch (state.pipesCount) { - case 0: - state.pipes = dest; - break; - case 1: - state.pipes = [state.pipes, dest]; - break; - default: - state.pipes.push(dest); - break; - } - state.pipesCount += 1; - debug('pipe count=%d opts=%j', state.pipesCount, pipeOpts); - - var doEnd = (!pipeOpts || pipeOpts.end !== false) && - dest !== process.stdout && - dest !== process.stderr; - - var endFn = doEnd ? onend : cleanup; - if (state.endEmitted) - process.nextTick(endFn); - else - src.once('end', endFn); - - dest.on('unpipe', onunpipe); - function onunpipe(readable) { - debug('onunpipe'); - if (readable === src) { - cleanup(); - } - } - - function onend() { - debug('onend'); - dest.end(); - } - - // when the dest drains, it reduces the awaitDrain counter - // on the source. This would be more elegant with a .once() - // handler in flow(), but adding and removing repeatedly is - // too slow. - var ondrain = pipeOnDrain(src); - dest.on('drain', ondrain); - - function cleanup() { - debug('cleanup'); - // cleanup event handlers once the pipe is broken - dest.removeListener('close', onclose); - dest.removeListener('finish', onfinish); - dest.removeListener('drain', ondrain); - dest.removeListener('error', onerror); - dest.removeListener('unpipe', onunpipe); - src.removeListener('end', onend); - src.removeListener('end', cleanup); - src.removeListener('data', ondata); - - // if the reader is waiting for a drain event from this - // specific writer, then it would cause it to never start - // flowing again. - // So, if this is awaiting a drain, then we just call it now. - // If we don't know, then assume that we are waiting for one. - if (state.awaitDrain && - (!dest._writableState || dest._writableState.needDrain)) - ondrain(); - } - - src.on('data', ondata); - function ondata(chunk) { - debug('ondata'); - var ret = dest.write(chunk); - if (false === ret) { - debug('false write response, pause', - src._readableState.awaitDrain); - src._readableState.awaitDrain++; - src.pause(); - } - } - - // if the dest has an error, then stop piping into it. - // however, don't suppress the throwing behavior for this. - function onerror(er) { - debug('onerror', er); - unpipe(); - dest.removeListener('error', onerror); - if (EE.listenerCount(dest, 'error') === 0) - dest.emit('error', er); - } - // This is a brutally ugly hack to make sure that our error handler - // is attached before any userland ones. NEVER DO THIS. - if (!dest._events || !dest._events.error) - dest.on('error', onerror); - else if (isArray(dest._events.error)) - dest._events.error.unshift(onerror); - else - dest._events.error = [onerror, dest._events.error]; - - - - // Both close and finish should trigger unpipe, but only once. - function onclose() { - dest.removeListener('finish', onfinish); - unpipe(); - } - dest.once('close', onclose); - function onfinish() { - debug('onfinish'); - dest.removeListener('close', onclose); - unpipe(); - } - dest.once('finish', onfinish); - - function unpipe() { - debug('unpipe'); - src.unpipe(dest); - } - - // tell the dest that it's being piped to - dest.emit('pipe', src); - - // start the flow if it hasn't been started already. - if (!state.flowing) { - debug('pipe resume'); - src.resume(); - } - - return dest; -}; - -function pipeOnDrain(src) { - return function() { - var state = src._readableState; - debug('pipeOnDrain', state.awaitDrain); - if (state.awaitDrain) - state.awaitDrain--; - if (state.awaitDrain === 0 && EE.listenerCount(src, 'data')) { - state.flowing = true; - flow(src); - } - }; -} - - -Readable.prototype.unpipe = function(dest) { - var state = this._readableState; - - // if we're not piping anywhere, then do nothing. - if (state.pipesCount === 0) - return this; - - // just one destination. most common case. - if (state.pipesCount === 1) { - // passed in one, but it's not the right one. - if (dest && dest !== state.pipes) - return this; - - if (!dest) - dest = state.pipes; - - // got a match. - state.pipes = null; - state.pipesCount = 0; - state.flowing = false; - if (dest) - dest.emit('unpipe', this); - return this; - } - - // slow case. multiple pipe destinations. - - if (!dest) { - // remove all. - var dests = state.pipes; - var len = state.pipesCount; - state.pipes = null; - state.pipesCount = 0; - state.flowing = false; - - for (var i = 0; i < len; i++) - dests[i].emit('unpipe', this); - return this; - } - - // try to find the right one. - var i = indexOf(state.pipes, dest); - if (i === -1) - return this; - - state.pipes.splice(i, 1); - state.pipesCount -= 1; - if (state.pipesCount === 1) - state.pipes = state.pipes[0]; - - dest.emit('unpipe', this); - - return this; -}; - -// set up data events if they are asked for -// Ensure readable listeners eventually get something -Readable.prototype.on = function(ev, fn) { - var res = Stream.prototype.on.call(this, ev, fn); - - // If listening to data, and it has not explicitly been paused, - // then call resume to start the flow of data on the next tick. - if (ev === 'data' && false !== this._readableState.flowing) { - this.resume(); - } - - if (ev === 'readable' && this.readable) { - var state = this._readableState; - if (!state.readableListening) { - state.readableListening = true; - state.emittedReadable = false; - state.needReadable = true; - if (!state.reading) { - var self = this; - process.nextTick(function() { - debug('readable nexttick read 0'); - self.read(0); - }); - } else if (state.length) { - emitReadable(this, state); - } - } - } - - return res; -}; -Readable.prototype.addListener = Readable.prototype.on; - -// pause() and resume() are remnants of the legacy readable stream API -// If the user uses them, then switch into old mode. -Readable.prototype.resume = function() { - var state = this._readableState; - if (!state.flowing) { - debug('resume'); - state.flowing = true; - if (!state.reading) { - debug('resume read 0'); - this.read(0); - } - resume(this, state); - } - return this; -}; - -function resume(stream, state) { - if (!state.resumeScheduled) { - state.resumeScheduled = true; - process.nextTick(function() { - resume_(stream, state); - }); - } -} - -function resume_(stream, state) { - state.resumeScheduled = false; - stream.emit('resume'); - flow(stream); - if (state.flowing && !state.reading) - stream.read(0); -} - -Readable.prototype.pause = function() { - debug('call pause flowing=%j', this._readableState.flowing); - if (false !== this._readableState.flowing) { - debug('pause'); - this._readableState.flowing = false; - this.emit('pause'); - } - return this; -}; - -function flow(stream) { - var state = stream._readableState; - debug('flow', state.flowing); - if (state.flowing) { - do { - var chunk = stream.read(); - } while (null !== chunk && state.flowing); - } -} - -// wrap an old-style stream as the async data source. -// This is *not* part of the readable stream interface. -// It is an ugly unfortunate mess of history. -Readable.prototype.wrap = function(stream) { - var state = this._readableState; - var paused = false; - - var self = this; - stream.on('end', function() { - debug('wrapped end'); - if (state.decoder && !state.ended) { - var chunk = state.decoder.end(); - if (chunk && chunk.length) - self.push(chunk); - } - - self.push(null); - }); - - stream.on('data', function(chunk) { - debug('wrapped data'); - if (state.decoder) - chunk = state.decoder.write(chunk); - if (!chunk || !state.objectMode && !chunk.length) - return; - - var ret = self.push(chunk); - if (!ret) { - paused = true; - stream.pause(); - } - }); - - // proxy all the other methods. - // important when wrapping filters and duplexes. - for (var i in stream) { - if (util.isFunction(stream[i]) && util.isUndefined(this[i])) { - this[i] = function(method) { return function() { - return stream[method].apply(stream, arguments); - }}(i); - } - } - - // proxy certain important events. - var events = ['error', 'close', 'destroy', 'pause', 'resume']; - forEach(events, function(ev) { - stream.on(ev, self.emit.bind(self, ev)); - }); - - // when we try to consume some more bytes, simply unpause the - // underlying stream. - self._read = function(n) { - debug('wrapped _read', n); - if (paused) { - paused = false; - stream.resume(); - } - }; - - return self; -}; - - - -// exposed for testing purposes only. -Readable._fromList = fromList; - -// Pluck off n bytes from an array of buffers. -// Length is the combined lengths of all the buffers in the list. -function fromList(n, state) { - var list = state.buffer; - var length = state.length; - var stringMode = !!state.decoder; - var objectMode = !!state.objectMode; - var ret; - - // nothing in the list, definitely empty. - if (list.length === 0) - return null; - - if (length === 0) - ret = null; - else if (objectMode) - ret = list.shift(); - else if (!n || n >= length) { - // read it all, truncate the array. - if (stringMode) - ret = list.join(''); - else - ret = Buffer.concat(list, length); - list.length = 0; - } else { - // read just some of it. - if (n < list[0].length) { - // just take a part of the first list item. - // slice is the same for buffers and strings. - var buf = list[0]; - ret = buf.slice(0, n); - list[0] = buf.slice(n); - } else if (n === list[0].length) { - // first list is a perfect match - ret = list.shift(); - } else { - // complex case. - // we have enough to cover it, but it spans past the first buffer. - if (stringMode) - ret = ''; - else - ret = new Buffer(n); - - var c = 0; - for (var i = 0, l = list.length; i < l && c < n; i++) { - var buf = list[0]; - var cpy = Math.min(n - c, buf.length); - - if (stringMode) - ret += buf.slice(0, cpy); - else - buf.copy(ret, c, 0, cpy); - - if (cpy < buf.length) - list[0] = buf.slice(cpy); - else - list.shift(); - - c += cpy; - } - } - } - - return ret; -} - -function endReadable(stream) { - var state = stream._readableState; - - // If we get here before consuming all the bytes, then that is a - // bug in node. Should never happen. - if (state.length > 0) - throw new Error('endReadable called on non-empty stream'); - - if (!state.endEmitted) { - state.ended = true; - process.nextTick(function() { - // Check that we didn't get one last unshift. - if (!state.endEmitted && state.length === 0) { - state.endEmitted = true; - stream.readable = false; - stream.emit('end'); - } - }); - } -} - -function forEach (xs, f) { - for (var i = 0, l = xs.length; i < l; i++) { - f(xs[i], i); - } -} - -function indexOf (xs, x) { - for (var i = 0, l = xs.length; i < l; i++) { - if (xs[i] === x) return i; - } - return -1; -} - -}).call(this,require('_process')) -},{"./_stream_duplex":210,"_process":197,"buffer":89,"core-util-is":92,"events":130,"inherits":156,"isarray":158,"stream":225,"string_decoder/":257,"util":54}],212:[function(require,module,exports){ -// Copyright Joyent, Inc. and other Node contributors. -// -// Permission is hereby granted, free of charge, to any person obtaining a -// copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to permit -// persons to whom the Software is furnished to do so, subject to the -// following conditions: -// -// The above copyright notice and this permission notice shall be included -// in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN -// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR -// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE -// USE OR OTHER DEALINGS IN THE SOFTWARE. - - -// a transform stream is a readable/writable stream where you do -// something with the data. Sometimes it's called a "filter", -// but that's not a great name for it, since that implies a thing where -// some bits pass through, and others are simply ignored. (That would -// be a valid example of a transform, of course.) -// -// While the output is causally related to the input, it's not a -// necessarily symmetric or synchronous transformation. For example, -// a zlib stream might take multiple plain-text writes(), and then -// emit a single compressed chunk some time in the future. -// -// Here's how this works: -// -// The Transform stream has all the aspects of the readable and writable -// stream classes. When you write(chunk), that calls _write(chunk,cb) -// internally, and returns false if there's a lot of pending writes -// buffered up. When you call read(), that calls _read(n) until -// there's enough pending readable data buffered up. -// -// In a transform stream, the written data is placed in a buffer. When -// _read(n) is called, it transforms the queued up data, calling the -// buffered _write cb's as it consumes chunks. If consuming a single -// written chunk would result in multiple output chunks, then the first -// outputted bit calls the readcb, and subsequent chunks just go into -// the read buffer, and will cause it to emit 'readable' if necessary. -// -// This way, back-pressure is actually determined by the reading side, -// since _read has to be called to start processing a new chunk. However, -// a pathological inflate type of transform can cause excessive buffering -// here. For example, imagine a stream where every byte of input is -// interpreted as an integer from 0-255, and then results in that many -// bytes of output. Writing the 4 bytes {ff,ff,ff,ff} would result in -// 1kb of data being output. In this case, you could write a very small -// amount of input, and end up with a very large amount of output. In -// such a pathological inflating mechanism, there'd be no way to tell -// the system to stop doing the transform. A single 4MB write could -// cause the system to run out of memory. -// -// However, even in such a pathological case, only a single written chunk -// would be consumed, and then the rest would wait (un-transformed) until -// the results of the previous transformed chunk were consumed. - -module.exports = Transform; - -var Duplex = require('./_stream_duplex'); - -/**/ -var util = require('core-util-is'); -util.inherits = require('inherits'); -/**/ - -util.inherits(Transform, Duplex); - - -function TransformState(options, stream) { - this.afterTransform = function(er, data) { - return afterTransform(stream, er, data); - }; - - this.needTransform = false; - this.transforming = false; - this.writecb = null; - this.writechunk = null; -} - -function afterTransform(stream, er, data) { - var ts = stream._transformState; - ts.transforming = false; - - var cb = ts.writecb; - - if (!cb) - return stream.emit('error', new Error('no writecb in Transform class')); - - ts.writechunk = null; - ts.writecb = null; - - if (!util.isNullOrUndefined(data)) - stream.push(data); - - if (cb) - cb(er); - - var rs = stream._readableState; - rs.reading = false; - if (rs.needReadable || rs.length < rs.highWaterMark) { - stream._read(rs.highWaterMark); - } -} - - -function Transform(options) { - if (!(this instanceof Transform)) - return new Transform(options); - - Duplex.call(this, options); - - this._transformState = new TransformState(options, this); - - // when the writable side finishes, then flush out anything remaining. - var stream = this; - - // start out asking for a readable event once data is transformed. - this._readableState.needReadable = true; - - // we have implemented the _read method, and done the other things - // that Readable wants before the first _read call, so unset the - // sync guard flag. - this._readableState.sync = false; - - this.once('prefinish', function() { - if (util.isFunction(this._flush)) - this._flush(function(er) { - done(stream, er); - }); - else - done(stream); - }); -} - -Transform.prototype.push = function(chunk, encoding) { - this._transformState.needTransform = false; - return Duplex.prototype.push.call(this, chunk, encoding); -}; - -// This is the part where you do stuff! -// override this function in implementation classes. -// 'chunk' is an input chunk. -// -// Call `push(newChunk)` to pass along transformed output -// to the readable side. You may call 'push' zero or more times. -// -// Call `cb(err)` when you are done with this chunk. If you pass -// an error, then that'll put the hurt on the whole operation. If you -// never call cb(), then you'll never get another chunk. -Transform.prototype._transform = function(chunk, encoding, cb) { - throw new Error('not implemented'); -}; - -Transform.prototype._write = function(chunk, encoding, cb) { - var ts = this._transformState; - ts.writecb = cb; - ts.writechunk = chunk; - ts.writeencoding = encoding; - if (!ts.transforming) { - var rs = this._readableState; - if (ts.needTransform || - rs.needReadable || - rs.length < rs.highWaterMark) - this._read(rs.highWaterMark); - } -}; - -// Doesn't matter what the args are here. -// _transform does all the work. -// That we got here means that the readable side wants more data. -Transform.prototype._read = function(n) { - var ts = this._transformState; - - if (!util.isNull(ts.writechunk) && ts.writecb && !ts.transforming) { - ts.transforming = true; - this._transform(ts.writechunk, ts.writeencoding, ts.afterTransform); - } else { - // mark that we need a transform, so that any data that comes in - // will get processed, now that we've asked for it. - ts.needTransform = true; - } -}; - - -function done(stream, er) { - if (er) - return stream.emit('error', er); - - // if there's nothing in the write buffer, then that means - // that nothing more will ever be provided - var ws = stream._writableState; - var ts = stream._transformState; - - if (ws.length) - throw new Error('calling transform done when ws.length != 0'); - - if (ts.transforming) - throw new Error('calling transform done when still transforming'); - - return stream.push(null); -} - -},{"./_stream_duplex":210,"core-util-is":92,"inherits":156}],213:[function(require,module,exports){ -(function (process){ -// Copyright Joyent, Inc. and other Node contributors. -// -// Permission is hereby granted, free of charge, to any person obtaining a -// copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to permit -// persons to whom the Software is furnished to do so, subject to the -// following conditions: -// -// The above copyright notice and this permission notice shall be included -// in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN -// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR -// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE -// USE OR OTHER DEALINGS IN THE SOFTWARE. - -// A bit simpler than readable streams. -// Implement an async ._write(chunk, cb), and it'll handle all -// the drain event emission and buffering. - -module.exports = Writable; - -/**/ -var Buffer = require('buffer').Buffer; -/**/ - -Writable.WritableState = WritableState; - - -/**/ -var util = require('core-util-is'); -util.inherits = require('inherits'); -/**/ - -var Stream = require('stream'); - -util.inherits(Writable, Stream); - -function WriteReq(chunk, encoding, cb) { - this.chunk = chunk; - this.encoding = encoding; - this.callback = cb; -} - -function WritableState(options, stream) { - var Duplex = require('./_stream_duplex'); - - options = options || {}; - - // the point at which write() starts returning false - // Note: 0 is a valid value, means that we always return false if - // the entire buffer is not flushed immediately on write() - var hwm = options.highWaterMark; - var defaultHwm = options.objectMode ? 16 : 16 * 1024; - this.highWaterMark = (hwm || hwm === 0) ? hwm : defaultHwm; - - // object stream flag to indicate whether or not this stream - // contains buffers or objects. - this.objectMode = !!options.objectMode; - - if (stream instanceof Duplex) - this.objectMode = this.objectMode || !!options.writableObjectMode; - - // cast to ints. - this.highWaterMark = ~~this.highWaterMark; - - this.needDrain = false; - // at the start of calling end() - this.ending = false; - // when end() has been called, and returned - this.ended = false; - // when 'finish' is emitted - this.finished = false; - - // should we decode strings into buffers before passing to _write? - // this is here so that some node-core streams can optimize string - // handling at a lower level. - var noDecode = options.decodeStrings === false; - this.decodeStrings = !noDecode; - - // Crypto is kind of old and crusty. Historically, its default string - // encoding is 'binary' so we have to make this configurable. - // Everything else in the universe uses 'utf8', though. - this.defaultEncoding = options.defaultEncoding || 'utf8'; - - // not an actual buffer we keep track of, but a measurement - // of how much we're waiting to get pushed to some underlying - // socket or file. - this.length = 0; - - // a flag to see when we're in the middle of a write. - this.writing = false; - - // when true all writes will be buffered until .uncork() call - this.corked = 0; - - // a flag to be able to tell if the onwrite cb is called immediately, - // or on a later tick. We set this to true at first, because any - // actions that shouldn't happen until "later" should generally also - // not happen before the first write call. - this.sync = true; - - // a flag to know if we're processing previously buffered items, which - // may call the _write() callback in the same tick, so that we don't - // end up in an overlapped onwrite situation. - this.bufferProcessing = false; - - // the callback that's passed to _write(chunk,cb) - this.onwrite = function(er) { - onwrite(stream, er); - }; - - // the callback that the user supplies to write(chunk,encoding,cb) - this.writecb = null; - - // the amount that is being written when _write is called. - this.writelen = 0; - - this.buffer = []; - - // number of pending user-supplied write callbacks - // this must be 0 before 'finish' can be emitted - this.pendingcb = 0; - - // emit prefinish if the only thing we're waiting for is _write cbs - // This is relevant for synchronous Transform streams - this.prefinished = false; - - // True if the error was already emitted and should not be thrown again - this.errorEmitted = false; -} - -function Writable(options) { - var Duplex = require('./_stream_duplex'); - - // Writable ctor is applied to Duplexes, though they're not - // instanceof Writable, they're instanceof Readable. - if (!(this instanceof Writable) && !(this instanceof Duplex)) - return new Writable(options); - - this._writableState = new WritableState(options, this); - - // legacy. - this.writable = true; - - Stream.call(this); -} - -// Otherwise people can pipe Writable streams, which is just wrong. -Writable.prototype.pipe = function() { - this.emit('error', new Error('Cannot pipe. Not readable.')); -}; - - -function writeAfterEnd(stream, state, cb) { - var er = new Error('write after end'); - // TODO: defer error events consistently everywhere, not just the cb - stream.emit('error', er); - process.nextTick(function() { - cb(er); - }); -} - -// If we get something that is not a buffer, string, null, or undefined, -// and we're not in objectMode, then that's an error. -// Otherwise stream chunks are all considered to be of length=1, and the -// watermarks determine how many objects to keep in the buffer, rather than -// how many bytes or characters. -function validChunk(stream, state, chunk, cb) { - var valid = true; - if (!util.isBuffer(chunk) && - !util.isString(chunk) && - !util.isNullOrUndefined(chunk) && - !state.objectMode) { - var er = new TypeError('Invalid non-string/buffer chunk'); - stream.emit('error', er); - process.nextTick(function() { - cb(er); - }); - valid = false; - } - return valid; -} - -Writable.prototype.write = function(chunk, encoding, cb) { - var state = this._writableState; - var ret = false; - - if (util.isFunction(encoding)) { - cb = encoding; - encoding = null; - } - - if (util.isBuffer(chunk)) - encoding = 'buffer'; - else if (!encoding) - encoding = state.defaultEncoding; - - if (!util.isFunction(cb)) - cb = function() {}; - - if (state.ended) - writeAfterEnd(this, state, cb); - else if (validChunk(this, state, chunk, cb)) { - state.pendingcb++; - ret = writeOrBuffer(this, state, chunk, encoding, cb); - } - - return ret; -}; - -Writable.prototype.cork = function() { - var state = this._writableState; - - state.corked++; -}; - -Writable.prototype.uncork = function() { - var state = this._writableState; - - if (state.corked) { - state.corked--; - - if (!state.writing && - !state.corked && - !state.finished && - !state.bufferProcessing && - state.buffer.length) - clearBuffer(this, state); - } -}; - -function decodeChunk(state, chunk, encoding) { - if (!state.objectMode && - state.decodeStrings !== false && - util.isString(chunk)) { - chunk = new Buffer(chunk, encoding); - } - return chunk; -} - -// if we're already writing something, then just put this -// in the queue, and wait our turn. Otherwise, call _write -// If we return false, then we need a drain event, so set that flag. -function writeOrBuffer(stream, state, chunk, encoding, cb) { - chunk = decodeChunk(state, chunk, encoding); - if (util.isBuffer(chunk)) - encoding = 'buffer'; - var len = state.objectMode ? 1 : chunk.length; - - state.length += len; - - var ret = state.length < state.highWaterMark; - // we must ensure that previous needDrain will not be reset to false. - if (!ret) - state.needDrain = true; - - if (state.writing || state.corked) - state.buffer.push(new WriteReq(chunk, encoding, cb)); - else - doWrite(stream, state, false, len, chunk, encoding, cb); - - return ret; -} - -function doWrite(stream, state, writev, len, chunk, encoding, cb) { - state.writelen = len; - state.writecb = cb; - state.writing = true; - state.sync = true; - if (writev) - stream._writev(chunk, state.onwrite); - else - stream._write(chunk, encoding, state.onwrite); - state.sync = false; -} - -function onwriteError(stream, state, sync, er, cb) { - if (sync) - process.nextTick(function() { - state.pendingcb--; - cb(er); - }); - else { - state.pendingcb--; - cb(er); - } - - stream._writableState.errorEmitted = true; - stream.emit('error', er); -} - -function onwriteStateUpdate(state) { - state.writing = false; - state.writecb = null; - state.length -= state.writelen; - state.writelen = 0; -} - -function onwrite(stream, er) { - var state = stream._writableState; - var sync = state.sync; - var cb = state.writecb; - - onwriteStateUpdate(state); - - if (er) - onwriteError(stream, state, sync, er, cb); - else { - // Check if we're actually ready to finish, but don't emit yet - var finished = needFinish(stream, state); - - if (!finished && - !state.corked && - !state.bufferProcessing && - state.buffer.length) { - clearBuffer(stream, state); - } - - if (sync) { - process.nextTick(function() { - afterWrite(stream, state, finished, cb); - }); - } else { - afterWrite(stream, state, finished, cb); - } - } -} - -function afterWrite(stream, state, finished, cb) { - if (!finished) - onwriteDrain(stream, state); - state.pendingcb--; - cb(); - finishMaybe(stream, state); -} - -// Must force callback to be called on nextTick, so that we don't -// emit 'drain' before the write() consumer gets the 'false' return -// value, and has a chance to attach a 'drain' listener. -function onwriteDrain(stream, state) { - if (state.length === 0 && state.needDrain) { - state.needDrain = false; - stream.emit('drain'); - } -} - - -// if there's something in the buffer waiting, then process it -function clearBuffer(stream, state) { - state.bufferProcessing = true; - - if (stream._writev && state.buffer.length > 1) { - // Fast case, write everything using _writev() - var cbs = []; - for (var c = 0; c < state.buffer.length; c++) - cbs.push(state.buffer[c].callback); - - // count the one we are adding, as well. - // TODO(isaacs) clean this up - state.pendingcb++; - doWrite(stream, state, true, state.length, state.buffer, '', function(err) { - for (var i = 0; i < cbs.length; i++) { - state.pendingcb--; - cbs[i](err); - } - }); - - // Clear buffer - state.buffer = []; - } else { - // Slow case, write chunks one-by-one - for (var c = 0; c < state.buffer.length; c++) { - var entry = state.buffer[c]; - var chunk = entry.chunk; - var encoding = entry.encoding; - var cb = entry.callback; - var len = state.objectMode ? 1 : chunk.length; - - doWrite(stream, state, false, len, chunk, encoding, cb); - - // if we didn't call the onwrite immediately, then - // it means that we need to wait until it does. - // also, that means that the chunk and cb are currently - // being processed, so move the buffer counter past them. - if (state.writing) { - c++; - break; - } - } - - if (c < state.buffer.length) - state.buffer = state.buffer.slice(c); - else - state.buffer.length = 0; - } - - state.bufferProcessing = false; -} - -Writable.prototype._write = function(chunk, encoding, cb) { - cb(new Error('not implemented')); - -}; - -Writable.prototype._writev = null; - -Writable.prototype.end = function(chunk, encoding, cb) { - var state = this._writableState; - - if (util.isFunction(chunk)) { - cb = chunk; - chunk = null; - encoding = null; - } else if (util.isFunction(encoding)) { - cb = encoding; - encoding = null; - } - - if (!util.isNullOrUndefined(chunk)) - this.write(chunk, encoding); - - // .end() fully uncorks - if (state.corked) { - state.corked = 1; - this.uncork(); - } - - // ignore unnecessary end() calls. - if (!state.ending && !state.finished) - endWritable(this, state, cb); -}; - - -function needFinish(stream, state) { - return (state.ending && - state.length === 0 && - !state.finished && - !state.writing); -} - -function prefinish(stream, state) { - if (!state.prefinished) { - state.prefinished = true; - stream.emit('prefinish'); - } -} - -function finishMaybe(stream, state) { - var need = needFinish(stream, state); - if (need) { - if (state.pendingcb === 0) { - prefinish(stream, state); - state.finished = true; - stream.emit('finish'); - } else - prefinish(stream, state); - } - return need; -} - -function endWritable(stream, state, cb) { - state.ending = true; - finishMaybe(stream, state); - if (cb) { - if (state.finished) - process.nextTick(cb); - else - stream.once('finish', cb); - } - state.ended = true; -} - -}).call(this,require('_process')) -},{"./_stream_duplex":210,"_process":197,"buffer":89,"core-util-is":92,"inherits":156,"stream":225}],214:[function(require,module,exports){ -module.exports = require("./lib/_stream_transform.js") - -},{"./lib/_stream_transform.js":212}],215:[function(require,module,exports){ -'use strict' -var Buffer = require('buffer').Buffer -var inherits = require('inherits') -var HashBase = require('hash-base') - -var ARRAY16 = new Array(16) - -var zl = [ - 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, - 7, 4, 13, 1, 10, 6, 15, 3, 12, 0, 9, 5, 2, 14, 11, 8, - 3, 10, 14, 4, 9, 15, 8, 1, 2, 7, 0, 6, 13, 11, 5, 12, - 1, 9, 11, 10, 0, 8, 12, 4, 13, 3, 7, 15, 14, 5, 6, 2, - 4, 0, 5, 9, 7, 12, 2, 10, 14, 1, 3, 8, 11, 6, 15, 13 -] - -var zr = [ - 5, 14, 7, 0, 9, 2, 11, 4, 13, 6, 15, 8, 1, 10, 3, 12, - 6, 11, 3, 7, 0, 13, 5, 10, 14, 15, 8, 12, 4, 9, 1, 2, - 15, 5, 1, 3, 7, 14, 6, 9, 11, 8, 12, 2, 10, 0, 4, 13, - 8, 6, 4, 1, 3, 11, 15, 0, 5, 12, 2, 13, 9, 7, 10, 14, - 12, 15, 10, 4, 1, 5, 8, 7, 6, 2, 13, 14, 0, 3, 9, 11 -] - -var sl = [ - 11, 14, 15, 12, 5, 8, 7, 9, 11, 13, 14, 15, 6, 7, 9, 8, - 7, 6, 8, 13, 11, 9, 7, 15, 7, 12, 15, 9, 11, 7, 13, 12, - 11, 13, 6, 7, 14, 9, 13, 15, 14, 8, 13, 6, 5, 12, 7, 5, - 11, 12, 14, 15, 14, 15, 9, 8, 9, 14, 5, 6, 8, 6, 5, 12, - 9, 15, 5, 11, 6, 8, 13, 12, 5, 12, 13, 14, 11, 8, 5, 6 -] - -var sr = [ - 8, 9, 9, 11, 13, 15, 15, 5, 7, 7, 8, 11, 14, 14, 12, 6, - 9, 13, 15, 7, 12, 8, 9, 11, 7, 7, 12, 7, 6, 15, 13, 11, - 9, 7, 15, 11, 8, 6, 6, 14, 12, 13, 5, 14, 13, 13, 7, 5, - 15, 5, 8, 11, 14, 14, 6, 14, 6, 9, 12, 9, 12, 5, 15, 8, - 8, 5, 12, 9, 12, 5, 14, 6, 8, 13, 6, 5, 15, 13, 11, 11 -] - -var hl = [0x00000000, 0x5a827999, 0x6ed9eba1, 0x8f1bbcdc, 0xa953fd4e] -var hr = [0x50a28be6, 0x5c4dd124, 0x6d703ef3, 0x7a6d76e9, 0x00000000] - -function RIPEMD160 () { - HashBase.call(this, 64) - - // state - this._a = 0x67452301 - this._b = 0xefcdab89 - this._c = 0x98badcfe - this._d = 0x10325476 - this._e = 0xc3d2e1f0 -} - -inherits(RIPEMD160, HashBase) - -RIPEMD160.prototype._update = function () { - var words = ARRAY16 - for (var j = 0; j < 16; ++j) words[j] = this._block.readInt32LE(j * 4) - - var al = this._a | 0 - var bl = this._b | 0 - var cl = this._c | 0 - var dl = this._d | 0 - var el = this._e | 0 - - var ar = this._a | 0 - var br = this._b | 0 - var cr = this._c | 0 - var dr = this._d | 0 - var er = this._e | 0 - - // computation - for (var i = 0; i < 80; i += 1) { - var tl - var tr - if (i < 16) { - tl = fn1(al, bl, cl, dl, el, words[zl[i]], hl[0], sl[i]) - tr = fn5(ar, br, cr, dr, er, words[zr[i]], hr[0], sr[i]) - } else if (i < 32) { - tl = fn2(al, bl, cl, dl, el, words[zl[i]], hl[1], sl[i]) - tr = fn4(ar, br, cr, dr, er, words[zr[i]], hr[1], sr[i]) - } else if (i < 48) { - tl = fn3(al, bl, cl, dl, el, words[zl[i]], hl[2], sl[i]) - tr = fn3(ar, br, cr, dr, er, words[zr[i]], hr[2], sr[i]) - } else if (i < 64) { - tl = fn4(al, bl, cl, dl, el, words[zl[i]], hl[3], sl[i]) - tr = fn2(ar, br, cr, dr, er, words[zr[i]], hr[3], sr[i]) - } else { // if (i<80) { - tl = fn5(al, bl, cl, dl, el, words[zl[i]], hl[4], sl[i]) - tr = fn1(ar, br, cr, dr, er, words[zr[i]], hr[4], sr[i]) - } - - al = el - el = dl - dl = rotl(cl, 10) - cl = bl - bl = tl - - ar = er - er = dr - dr = rotl(cr, 10) - cr = br - br = tr - } - - // update state - var t = (this._b + cl + dr) | 0 - this._b = (this._c + dl + er) | 0 - this._c = (this._d + el + ar) | 0 - this._d = (this._e + al + br) | 0 - this._e = (this._a + bl + cr) | 0 - this._a = t -} - -RIPEMD160.prototype._digest = function () { - // create padding and handle blocks - this._block[this._blockOffset++] = 0x80 - if (this._blockOffset > 56) { - this._block.fill(0, this._blockOffset, 64) - this._update() - this._blockOffset = 0 - } - - this._block.fill(0, this._blockOffset, 56) - this._block.writeUInt32LE(this._length[0], 56) - this._block.writeUInt32LE(this._length[1], 60) - this._update() - - // produce result - var buffer = Buffer.alloc ? Buffer.alloc(20) : new Buffer(20) - buffer.writeInt32LE(this._a, 0) - buffer.writeInt32LE(this._b, 4) - buffer.writeInt32LE(this._c, 8) - buffer.writeInt32LE(this._d, 12) - buffer.writeInt32LE(this._e, 16) - return buffer -} - -function rotl (x, n) { - return (x << n) | (x >>> (32 - n)) -} - -function fn1 (a, b, c, d, e, m, k, s) { - return (rotl((a + (b ^ c ^ d) + m + k) | 0, s) + e) | 0 -} - -function fn2 (a, b, c, d, e, m, k, s) { - return (rotl((a + ((b & c) | ((~b) & d)) + m + k) | 0, s) + e) | 0 -} - -function fn3 (a, b, c, d, e, m, k, s) { - return (rotl((a + ((b | (~c)) ^ d) + m + k) | 0, s) + e) | 0 -} - -function fn4 (a, b, c, d, e, m, k, s) { - return (rotl((a + ((b & d) | (c & (~d))) + m + k) | 0, s) + e) | 0 -} - -function fn5 (a, b, c, d, e, m, k, s) { - return (rotl((a + (b ^ (c | (~d))) + m + k) | 0, s) + e) | 0 -} - -module.exports = RIPEMD160 - -},{"buffer":89,"hash-base":132,"inherits":156}],216:[function(require,module,exports){ -/* eslint-disable node/no-deprecated-api */ -var buffer = require('buffer') -var Buffer = buffer.Buffer - -// alternative to using Object.keys for old browsers -function copyProps (src, dst) { - for (var key in src) { - dst[key] = src[key] - } -} -if (Buffer.from && Buffer.alloc && Buffer.allocUnsafe && Buffer.allocUnsafeSlow) { - module.exports = buffer -} else { - // Copy properties from require('buffer') - copyProps(buffer, exports) - exports.Buffer = SafeBuffer -} - -function SafeBuffer (arg, encodingOrOffset, length) { - return Buffer(arg, encodingOrOffset, length) -} - -// Copy static methods from Buffer -copyProps(Buffer, SafeBuffer) - -SafeBuffer.from = function (arg, encodingOrOffset, length) { - if (typeof arg === 'number') { - throw new TypeError('Argument must not be a number') - } - return Buffer(arg, encodingOrOffset, length) -} - -SafeBuffer.alloc = function (size, fill, encoding) { - if (typeof size !== 'number') { - throw new TypeError('Argument must be a number') - } - var buf = Buffer(size) - if (fill !== undefined) { - if (typeof encoding === 'string') { - buf.fill(fill, encoding) - } else { - buf.fill(fill) - } - } else { - buf.fill(0) - } - return buf -} - -SafeBuffer.allocUnsafe = function (size) { - if (typeof size !== 'number') { - throw new TypeError('Argument must be a number') - } - return Buffer(size) -} - -SafeBuffer.allocUnsafeSlow = function (size) { - if (typeof size !== 'number') { - throw new TypeError('Argument must be a number') - } - return buffer.SlowBuffer(size) -} - -},{"buffer":89}],217:[function(require,module,exports){ -var Buffer = require('safe-buffer').Buffer - -// prototype class for hash functions -function Hash (blockSize, finalSize) { - this._block = Buffer.alloc(blockSize) - this._finalSize = finalSize - this._blockSize = blockSize - this._len = 0 -} - -Hash.prototype.update = function (data, enc) { - if (typeof data === 'string') { - enc = enc || 'utf8' - data = Buffer.from(data, enc) - } - - var block = this._block - var blockSize = this._blockSize - var length = data.length - var accum = this._len - - for (var offset = 0; offset < length;) { - var assigned = accum % blockSize - var remainder = Math.min(length - offset, blockSize - assigned) - - for (var i = 0; i < remainder; i++) { - block[assigned + i] = data[offset + i] - } - - accum += remainder - offset += remainder - - if ((accum % blockSize) === 0) { - this._update(block) - } - } - - this._len += length - return this -} - -Hash.prototype.digest = function (enc) { - var rem = this._len % this._blockSize - - this._block[rem] = 0x80 - - // zero (rem + 1) trailing bits, where (rem + 1) is the smallest - // non-negative solution to the equation (length + 1 + (rem + 1)) === finalSize mod blockSize - this._block.fill(0, rem + 1) - - if (rem >= this._finalSize) { - this._update(this._block) - this._block.fill(0) - } - - var bits = this._len * 8 - - // uint32 - if (bits <= 0xffffffff) { - this._block.writeUInt32BE(bits, this._blockSize - 4) - - // uint64 - } else { - var lowBits = (bits & 0xffffffff) >>> 0 - var highBits = (bits - lowBits) / 0x100000000 - - this._block.writeUInt32BE(highBits, this._blockSize - 8) - this._block.writeUInt32BE(lowBits, this._blockSize - 4) - } - - this._update(this._block) - var hash = this._hash() - - return enc ? hash.toString(enc) : hash -} - -Hash.prototype._update = function () { - throw new Error('_update must be implemented by subclass') -} - -module.exports = Hash - -},{"safe-buffer":216}],218:[function(require,module,exports){ -var exports = module.exports = function SHA (algorithm) { - algorithm = algorithm.toLowerCase() - - var Algorithm = exports[algorithm] - if (!Algorithm) throw new Error(algorithm + ' is not supported (we accept pull requests)') - - return new Algorithm() -} - -exports.sha = require('./sha') -exports.sha1 = require('./sha1') -exports.sha224 = require('./sha224') -exports.sha256 = require('./sha256') -exports.sha384 = require('./sha384') -exports.sha512 = require('./sha512') - -},{"./sha":219,"./sha1":220,"./sha224":221,"./sha256":222,"./sha384":223,"./sha512":224}],219:[function(require,module,exports){ -/* - * A JavaScript implementation of the Secure Hash Algorithm, SHA-0, as defined - * in FIPS PUB 180-1 - * This source code is derived from sha1.js of the same repository. - * The difference between SHA-0 and SHA-1 is just a bitwise rotate left - * operation was added. - */ - -var inherits = require('inherits') -var Hash = require('./hash') -var Buffer = require('safe-buffer').Buffer - -var K = [ - 0x5a827999, 0x6ed9eba1, 0x8f1bbcdc | 0, 0xca62c1d6 | 0 -] - -var W = new Array(80) - -function Sha () { - this.init() - this._w = W - - Hash.call(this, 64, 56) -} - -inherits(Sha, Hash) - -Sha.prototype.init = function () { - this._a = 0x67452301 - this._b = 0xefcdab89 - this._c = 0x98badcfe - this._d = 0x10325476 - this._e = 0xc3d2e1f0 - - return this -} - -function rotl5 (num) { - return (num << 5) | (num >>> 27) -} - -function rotl30 (num) { - return (num << 30) | (num >>> 2) -} - -function ft (s, b, c, d) { - if (s === 0) return (b & c) | ((~b) & d) - if (s === 2) return (b & c) | (b & d) | (c & d) - return b ^ c ^ d -} - -Sha.prototype._update = function (M) { - var W = this._w - - var a = this._a | 0 - var b = this._b | 0 - var c = this._c | 0 - var d = this._d | 0 - var e = this._e | 0 - - for (var i = 0; i < 16; ++i) W[i] = M.readInt32BE(i * 4) - for (; i < 80; ++i) W[i] = W[i - 3] ^ W[i - 8] ^ W[i - 14] ^ W[i - 16] - - for (var j = 0; j < 80; ++j) { - var s = ~~(j / 20) - var t = (rotl5(a) + ft(s, b, c, d) + e + W[j] + K[s]) | 0 - - e = d - d = c - c = rotl30(b) - b = a - a = t - } - - this._a = (a + this._a) | 0 - this._b = (b + this._b) | 0 - this._c = (c + this._c) | 0 - this._d = (d + this._d) | 0 - this._e = (e + this._e) | 0 -} - -Sha.prototype._hash = function () { - var H = Buffer.allocUnsafe(20) - - H.writeInt32BE(this._a | 0, 0) - H.writeInt32BE(this._b | 0, 4) - H.writeInt32BE(this._c | 0, 8) - H.writeInt32BE(this._d | 0, 12) - H.writeInt32BE(this._e | 0, 16) - - return H -} - -module.exports = Sha - -},{"./hash":217,"inherits":156,"safe-buffer":216}],220:[function(require,module,exports){ -/* - * A JavaScript implementation of the Secure Hash Algorithm, SHA-1, as defined - * in FIPS PUB 180-1 - * Version 2.1a Copyright Paul Johnston 2000 - 2002. - * Other contributors: Greg Holt, Andrew Kepert, Ydnar, Lostinet - * Distributed under the BSD License - * See http://pajhome.org.uk/crypt/md5 for details. - */ - -var inherits = require('inherits') -var Hash = require('./hash') -var Buffer = require('safe-buffer').Buffer - -var K = [ - 0x5a827999, 0x6ed9eba1, 0x8f1bbcdc | 0, 0xca62c1d6 | 0 -] - -var W = new Array(80) - -function Sha1 () { - this.init() - this._w = W - - Hash.call(this, 64, 56) -} - -inherits(Sha1, Hash) - -Sha1.prototype.init = function () { - this._a = 0x67452301 - this._b = 0xefcdab89 - this._c = 0x98badcfe - this._d = 0x10325476 - this._e = 0xc3d2e1f0 - - return this -} - -function rotl1 (num) { - return (num << 1) | (num >>> 31) -} - -function rotl5 (num) { - return (num << 5) | (num >>> 27) -} - -function rotl30 (num) { - return (num << 30) | (num >>> 2) -} - -function ft (s, b, c, d) { - if (s === 0) return (b & c) | ((~b) & d) - if (s === 2) return (b & c) | (b & d) | (c & d) - return b ^ c ^ d -} - -Sha1.prototype._update = function (M) { - var W = this._w - - var a = this._a | 0 - var b = this._b | 0 - var c = this._c | 0 - var d = this._d | 0 - var e = this._e | 0 - - for (var i = 0; i < 16; ++i) W[i] = M.readInt32BE(i * 4) - for (; i < 80; ++i) W[i] = rotl1(W[i - 3] ^ W[i - 8] ^ W[i - 14] ^ W[i - 16]) - - for (var j = 0; j < 80; ++j) { - var s = ~~(j / 20) - var t = (rotl5(a) + ft(s, b, c, d) + e + W[j] + K[s]) | 0 - - e = d - d = c - c = rotl30(b) - b = a - a = t - } - - this._a = (a + this._a) | 0 - this._b = (b + this._b) | 0 - this._c = (c + this._c) | 0 - this._d = (d + this._d) | 0 - this._e = (e + this._e) | 0 -} - -Sha1.prototype._hash = function () { - var H = Buffer.allocUnsafe(20) - - H.writeInt32BE(this._a | 0, 0) - H.writeInt32BE(this._b | 0, 4) - H.writeInt32BE(this._c | 0, 8) - H.writeInt32BE(this._d | 0, 12) - H.writeInt32BE(this._e | 0, 16) - - return H -} - -module.exports = Sha1 - -},{"./hash":217,"inherits":156,"safe-buffer":216}],221:[function(require,module,exports){ -/** - * A JavaScript implementation of the Secure Hash Algorithm, SHA-256, as defined - * in FIPS 180-2 - * Version 2.2-beta Copyright Angel Marin, Paul Johnston 2000 - 2009. - * Other contributors: Greg Holt, Andrew Kepert, Ydnar, Lostinet - * - */ - -var inherits = require('inherits') -var Sha256 = require('./sha256') -var Hash = require('./hash') -var Buffer = require('safe-buffer').Buffer - -var W = new Array(64) - -function Sha224 () { - this.init() - - this._w = W // new Array(64) - - Hash.call(this, 64, 56) -} - -inherits(Sha224, Sha256) - -Sha224.prototype.init = function () { - this._a = 0xc1059ed8 - this._b = 0x367cd507 - this._c = 0x3070dd17 - this._d = 0xf70e5939 - this._e = 0xffc00b31 - this._f = 0x68581511 - this._g = 0x64f98fa7 - this._h = 0xbefa4fa4 - - return this -} - -Sha224.prototype._hash = function () { - var H = Buffer.allocUnsafe(28) - - H.writeInt32BE(this._a, 0) - H.writeInt32BE(this._b, 4) - H.writeInt32BE(this._c, 8) - H.writeInt32BE(this._d, 12) - H.writeInt32BE(this._e, 16) - H.writeInt32BE(this._f, 20) - H.writeInt32BE(this._g, 24) - - return H -} - -module.exports = Sha224 - -},{"./hash":217,"./sha256":222,"inherits":156,"safe-buffer":216}],222:[function(require,module,exports){ -/** - * A JavaScript implementation of the Secure Hash Algorithm, SHA-256, as defined - * in FIPS 180-2 - * Version 2.2-beta Copyright Angel Marin, Paul Johnston 2000 - 2009. - * Other contributors: Greg Holt, Andrew Kepert, Ydnar, Lostinet - * - */ - -var inherits = require('inherits') -var Hash = require('./hash') -var Buffer = require('safe-buffer').Buffer - -var K = [ - 0x428A2F98, 0x71374491, 0xB5C0FBCF, 0xE9B5DBA5, - 0x3956C25B, 0x59F111F1, 0x923F82A4, 0xAB1C5ED5, - 0xD807AA98, 0x12835B01, 0x243185BE, 0x550C7DC3, - 0x72BE5D74, 0x80DEB1FE, 0x9BDC06A7, 0xC19BF174, - 0xE49B69C1, 0xEFBE4786, 0x0FC19DC6, 0x240CA1CC, - 0x2DE92C6F, 0x4A7484AA, 0x5CB0A9DC, 0x76F988DA, - 0x983E5152, 0xA831C66D, 0xB00327C8, 0xBF597FC7, - 0xC6E00BF3, 0xD5A79147, 0x06CA6351, 0x14292967, - 0x27B70A85, 0x2E1B2138, 0x4D2C6DFC, 0x53380D13, - 0x650A7354, 0x766A0ABB, 0x81C2C92E, 0x92722C85, - 0xA2BFE8A1, 0xA81A664B, 0xC24B8B70, 0xC76C51A3, - 0xD192E819, 0xD6990624, 0xF40E3585, 0x106AA070, - 0x19A4C116, 0x1E376C08, 0x2748774C, 0x34B0BCB5, - 0x391C0CB3, 0x4ED8AA4A, 0x5B9CCA4F, 0x682E6FF3, - 0x748F82EE, 0x78A5636F, 0x84C87814, 0x8CC70208, - 0x90BEFFFA, 0xA4506CEB, 0xBEF9A3F7, 0xC67178F2 -] - -var W = new Array(64) - -function Sha256 () { - this.init() - - this._w = W // new Array(64) - - Hash.call(this, 64, 56) -} - -inherits(Sha256, Hash) - -Sha256.prototype.init = function () { - this._a = 0x6a09e667 - this._b = 0xbb67ae85 - this._c = 0x3c6ef372 - this._d = 0xa54ff53a - this._e = 0x510e527f - this._f = 0x9b05688c - this._g = 0x1f83d9ab - this._h = 0x5be0cd19 - - return this -} - -function ch (x, y, z) { - return z ^ (x & (y ^ z)) -} - -function maj (x, y, z) { - return (x & y) | (z & (x | y)) -} - -function sigma0 (x) { - return (x >>> 2 | x << 30) ^ (x >>> 13 | x << 19) ^ (x >>> 22 | x << 10) -} - -function sigma1 (x) { - return (x >>> 6 | x << 26) ^ (x >>> 11 | x << 21) ^ (x >>> 25 | x << 7) -} - -function gamma0 (x) { - return (x >>> 7 | x << 25) ^ (x >>> 18 | x << 14) ^ (x >>> 3) -} - -function gamma1 (x) { - return (x >>> 17 | x << 15) ^ (x >>> 19 | x << 13) ^ (x >>> 10) -} - -Sha256.prototype._update = function (M) { - var W = this._w - - var a = this._a | 0 - var b = this._b | 0 - var c = this._c | 0 - var d = this._d | 0 - var e = this._e | 0 - var f = this._f | 0 - var g = this._g | 0 - var h = this._h | 0 - - for (var i = 0; i < 16; ++i) W[i] = M.readInt32BE(i * 4) - for (; i < 64; ++i) W[i] = (gamma1(W[i - 2]) + W[i - 7] + gamma0(W[i - 15]) + W[i - 16]) | 0 - - for (var j = 0; j < 64; ++j) { - var T1 = (h + sigma1(e) + ch(e, f, g) + K[j] + W[j]) | 0 - var T2 = (sigma0(a) + maj(a, b, c)) | 0 - - h = g - g = f - f = e - e = (d + T1) | 0 - d = c - c = b - b = a - a = (T1 + T2) | 0 - } - - this._a = (a + this._a) | 0 - this._b = (b + this._b) | 0 - this._c = (c + this._c) | 0 - this._d = (d + this._d) | 0 - this._e = (e + this._e) | 0 - this._f = (f + this._f) | 0 - this._g = (g + this._g) | 0 - this._h = (h + this._h) | 0 -} - -Sha256.prototype._hash = function () { - var H = Buffer.allocUnsafe(32) - - H.writeInt32BE(this._a, 0) - H.writeInt32BE(this._b, 4) - H.writeInt32BE(this._c, 8) - H.writeInt32BE(this._d, 12) - H.writeInt32BE(this._e, 16) - H.writeInt32BE(this._f, 20) - H.writeInt32BE(this._g, 24) - H.writeInt32BE(this._h, 28) - - return H -} - -module.exports = Sha256 - -},{"./hash":217,"inherits":156,"safe-buffer":216}],223:[function(require,module,exports){ -var inherits = require('inherits') -var SHA512 = require('./sha512') -var Hash = require('./hash') -var Buffer = require('safe-buffer').Buffer - -var W = new Array(160) - -function Sha384 () { - this.init() - this._w = W - - Hash.call(this, 128, 112) -} - -inherits(Sha384, SHA512) - -Sha384.prototype.init = function () { - this._ah = 0xcbbb9d5d - this._bh = 0x629a292a - this._ch = 0x9159015a - this._dh = 0x152fecd8 - this._eh = 0x67332667 - this._fh = 0x8eb44a87 - this._gh = 0xdb0c2e0d - this._hh = 0x47b5481d - - this._al = 0xc1059ed8 - this._bl = 0x367cd507 - this._cl = 0x3070dd17 - this._dl = 0xf70e5939 - this._el = 0xffc00b31 - this._fl = 0x68581511 - this._gl = 0x64f98fa7 - this._hl = 0xbefa4fa4 - - return this -} - -Sha384.prototype._hash = function () { - var H = Buffer.allocUnsafe(48) - - function writeInt64BE (h, l, offset) { - H.writeInt32BE(h, offset) - H.writeInt32BE(l, offset + 4) - } - - writeInt64BE(this._ah, this._al, 0) - writeInt64BE(this._bh, this._bl, 8) - writeInt64BE(this._ch, this._cl, 16) - writeInt64BE(this._dh, this._dl, 24) - writeInt64BE(this._eh, this._el, 32) - writeInt64BE(this._fh, this._fl, 40) - - return H -} - -module.exports = Sha384 - -},{"./hash":217,"./sha512":224,"inherits":156,"safe-buffer":216}],224:[function(require,module,exports){ -var inherits = require('inherits') -var Hash = require('./hash') -var Buffer = require('safe-buffer').Buffer - -var K = [ - 0x428a2f98, 0xd728ae22, 0x71374491, 0x23ef65cd, - 0xb5c0fbcf, 0xec4d3b2f, 0xe9b5dba5, 0x8189dbbc, - 0x3956c25b, 0xf348b538, 0x59f111f1, 0xb605d019, - 0x923f82a4, 0xaf194f9b, 0xab1c5ed5, 0xda6d8118, - 0xd807aa98, 0xa3030242, 0x12835b01, 0x45706fbe, - 0x243185be, 0x4ee4b28c, 0x550c7dc3, 0xd5ffb4e2, - 0x72be5d74, 0xf27b896f, 0x80deb1fe, 0x3b1696b1, - 0x9bdc06a7, 0x25c71235, 0xc19bf174, 0xcf692694, - 0xe49b69c1, 0x9ef14ad2, 0xefbe4786, 0x384f25e3, - 0x0fc19dc6, 0x8b8cd5b5, 0x240ca1cc, 0x77ac9c65, - 0x2de92c6f, 0x592b0275, 0x4a7484aa, 0x6ea6e483, - 0x5cb0a9dc, 0xbd41fbd4, 0x76f988da, 0x831153b5, - 0x983e5152, 0xee66dfab, 0xa831c66d, 0x2db43210, - 0xb00327c8, 0x98fb213f, 0xbf597fc7, 0xbeef0ee4, - 0xc6e00bf3, 0x3da88fc2, 0xd5a79147, 0x930aa725, - 0x06ca6351, 0xe003826f, 0x14292967, 0x0a0e6e70, - 0x27b70a85, 0x46d22ffc, 0x2e1b2138, 0x5c26c926, - 0x4d2c6dfc, 0x5ac42aed, 0x53380d13, 0x9d95b3df, - 0x650a7354, 0x8baf63de, 0x766a0abb, 0x3c77b2a8, - 0x81c2c92e, 0x47edaee6, 0x92722c85, 0x1482353b, - 0xa2bfe8a1, 0x4cf10364, 0xa81a664b, 0xbc423001, - 0xc24b8b70, 0xd0f89791, 0xc76c51a3, 0x0654be30, - 0xd192e819, 0xd6ef5218, 0xd6990624, 0x5565a910, - 0xf40e3585, 0x5771202a, 0x106aa070, 0x32bbd1b8, - 0x19a4c116, 0xb8d2d0c8, 0x1e376c08, 0x5141ab53, - 0x2748774c, 0xdf8eeb99, 0x34b0bcb5, 0xe19b48a8, - 0x391c0cb3, 0xc5c95a63, 0x4ed8aa4a, 0xe3418acb, - 0x5b9cca4f, 0x7763e373, 0x682e6ff3, 0xd6b2b8a3, - 0x748f82ee, 0x5defb2fc, 0x78a5636f, 0x43172f60, - 0x84c87814, 0xa1f0ab72, 0x8cc70208, 0x1a6439ec, - 0x90befffa, 0x23631e28, 0xa4506ceb, 0xde82bde9, - 0xbef9a3f7, 0xb2c67915, 0xc67178f2, 0xe372532b, - 0xca273ece, 0xea26619c, 0xd186b8c7, 0x21c0c207, - 0xeada7dd6, 0xcde0eb1e, 0xf57d4f7f, 0xee6ed178, - 0x06f067aa, 0x72176fba, 0x0a637dc5, 0xa2c898a6, - 0x113f9804, 0xbef90dae, 0x1b710b35, 0x131c471b, - 0x28db77f5, 0x23047d84, 0x32caab7b, 0x40c72493, - 0x3c9ebe0a, 0x15c9bebc, 0x431d67c4, 0x9c100d4c, - 0x4cc5d4be, 0xcb3e42b6, 0x597f299c, 0xfc657e2a, - 0x5fcb6fab, 0x3ad6faec, 0x6c44198c, 0x4a475817 -] - -var W = new Array(160) - -function Sha512 () { - this.init() - this._w = W - - Hash.call(this, 128, 112) -} - -inherits(Sha512, Hash) - -Sha512.prototype.init = function () { - this._ah = 0x6a09e667 - this._bh = 0xbb67ae85 - this._ch = 0x3c6ef372 - this._dh = 0xa54ff53a - this._eh = 0x510e527f - this._fh = 0x9b05688c - this._gh = 0x1f83d9ab - this._hh = 0x5be0cd19 - - this._al = 0xf3bcc908 - this._bl = 0x84caa73b - this._cl = 0xfe94f82b - this._dl = 0x5f1d36f1 - this._el = 0xade682d1 - this._fl = 0x2b3e6c1f - this._gl = 0xfb41bd6b - this._hl = 0x137e2179 - - return this -} - -function Ch (x, y, z) { - return z ^ (x & (y ^ z)) -} - -function maj (x, y, z) { - return (x & y) | (z & (x | y)) -} - -function sigma0 (x, xl) { - return (x >>> 28 | xl << 4) ^ (xl >>> 2 | x << 30) ^ (xl >>> 7 | x << 25) -} - -function sigma1 (x, xl) { - return (x >>> 14 | xl << 18) ^ (x >>> 18 | xl << 14) ^ (xl >>> 9 | x << 23) -} - -function Gamma0 (x, xl) { - return (x >>> 1 | xl << 31) ^ (x >>> 8 | xl << 24) ^ (x >>> 7) -} - -function Gamma0l (x, xl) { - return (x >>> 1 | xl << 31) ^ (x >>> 8 | xl << 24) ^ (x >>> 7 | xl << 25) -} - -function Gamma1 (x, xl) { - return (x >>> 19 | xl << 13) ^ (xl >>> 29 | x << 3) ^ (x >>> 6) -} - -function Gamma1l (x, xl) { - return (x >>> 19 | xl << 13) ^ (xl >>> 29 | x << 3) ^ (x >>> 6 | xl << 26) -} - -function getCarry (a, b) { - return (a >>> 0) < (b >>> 0) ? 1 : 0 -} - -Sha512.prototype._update = function (M) { - var W = this._w - - var ah = this._ah | 0 - var bh = this._bh | 0 - var ch = this._ch | 0 - var dh = this._dh | 0 - var eh = this._eh | 0 - var fh = this._fh | 0 - var gh = this._gh | 0 - var hh = this._hh | 0 - - var al = this._al | 0 - var bl = this._bl | 0 - var cl = this._cl | 0 - var dl = this._dl | 0 - var el = this._el | 0 - var fl = this._fl | 0 - var gl = this._gl | 0 - var hl = this._hl | 0 - - for (var i = 0; i < 32; i += 2) { - W[i] = M.readInt32BE(i * 4) - W[i + 1] = M.readInt32BE(i * 4 + 4) - } - for (; i < 160; i += 2) { - var xh = W[i - 15 * 2] - var xl = W[i - 15 * 2 + 1] - var gamma0 = Gamma0(xh, xl) - var gamma0l = Gamma0l(xl, xh) - - xh = W[i - 2 * 2] - xl = W[i - 2 * 2 + 1] - var gamma1 = Gamma1(xh, xl) - var gamma1l = Gamma1l(xl, xh) - - // W[i] = gamma0 + W[i - 7] + gamma1 + W[i - 16] - var Wi7h = W[i - 7 * 2] - var Wi7l = W[i - 7 * 2 + 1] - - var Wi16h = W[i - 16 * 2] - var Wi16l = W[i - 16 * 2 + 1] - - var Wil = (gamma0l + Wi7l) | 0 - var Wih = (gamma0 + Wi7h + getCarry(Wil, gamma0l)) | 0 - Wil = (Wil + gamma1l) | 0 - Wih = (Wih + gamma1 + getCarry(Wil, gamma1l)) | 0 - Wil = (Wil + Wi16l) | 0 - Wih = (Wih + Wi16h + getCarry(Wil, Wi16l)) | 0 - - W[i] = Wih - W[i + 1] = Wil - } - - for (var j = 0; j < 160; j += 2) { - Wih = W[j] - Wil = W[j + 1] - - var majh = maj(ah, bh, ch) - var majl = maj(al, bl, cl) - - var sigma0h = sigma0(ah, al) - var sigma0l = sigma0(al, ah) - var sigma1h = sigma1(eh, el) - var sigma1l = sigma1(el, eh) - - // t1 = h + sigma1 + ch + K[j] + W[j] - var Kih = K[j] - var Kil = K[j + 1] - - var chh = Ch(eh, fh, gh) - var chl = Ch(el, fl, gl) - - var t1l = (hl + sigma1l) | 0 - var t1h = (hh + sigma1h + getCarry(t1l, hl)) | 0 - t1l = (t1l + chl) | 0 - t1h = (t1h + chh + getCarry(t1l, chl)) | 0 - t1l = (t1l + Kil) | 0 - t1h = (t1h + Kih + getCarry(t1l, Kil)) | 0 - t1l = (t1l + Wil) | 0 - t1h = (t1h + Wih + getCarry(t1l, Wil)) | 0 - - // t2 = sigma0 + maj - var t2l = (sigma0l + majl) | 0 - var t2h = (sigma0h + majh + getCarry(t2l, sigma0l)) | 0 - - hh = gh - hl = gl - gh = fh - gl = fl - fh = eh - fl = el - el = (dl + t1l) | 0 - eh = (dh + t1h + getCarry(el, dl)) | 0 - dh = ch - dl = cl - ch = bh - cl = bl - bh = ah - bl = al - al = (t1l + t2l) | 0 - ah = (t1h + t2h + getCarry(al, t1l)) | 0 - } - - this._al = (this._al + al) | 0 - this._bl = (this._bl + bl) | 0 - this._cl = (this._cl + cl) | 0 - this._dl = (this._dl + dl) | 0 - this._el = (this._el + el) | 0 - this._fl = (this._fl + fl) | 0 - this._gl = (this._gl + gl) | 0 - this._hl = (this._hl + hl) | 0 - - this._ah = (this._ah + ah + getCarry(this._al, al)) | 0 - this._bh = (this._bh + bh + getCarry(this._bl, bl)) | 0 - this._ch = (this._ch + ch + getCarry(this._cl, cl)) | 0 - this._dh = (this._dh + dh + getCarry(this._dl, dl)) | 0 - this._eh = (this._eh + eh + getCarry(this._el, el)) | 0 - this._fh = (this._fh + fh + getCarry(this._fl, fl)) | 0 - this._gh = (this._gh + gh + getCarry(this._gl, gl)) | 0 - this._hh = (this._hh + hh + getCarry(this._hl, hl)) | 0 -} - -Sha512.prototype._hash = function () { - var H = Buffer.allocUnsafe(64) - - function writeInt64BE (h, l, offset) { - H.writeInt32BE(h, offset) - H.writeInt32BE(l, offset + 4) - } - - writeInt64BE(this._ah, this._al, 0) - writeInt64BE(this._bh, this._bl, 8) - writeInt64BE(this._ch, this._cl, 16) - writeInt64BE(this._dh, this._dl, 24) - writeInt64BE(this._eh, this._el, 32) - writeInt64BE(this._fh, this._fl, 40) - writeInt64BE(this._gh, this._gl, 48) - writeInt64BE(this._hh, this._hl, 56) - - return H -} - -module.exports = Sha512 - -},{"./hash":217,"inherits":156,"safe-buffer":216}],225:[function(require,module,exports){ -// Copyright Joyent, Inc. and other Node contributors. -// -// Permission is hereby granted, free of charge, to any person obtaining a -// copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to permit -// persons to whom the Software is furnished to do so, subject to the -// following conditions: -// -// The above copyright notice and this permission notice shall be included -// in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN -// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR -// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE -// USE OR OTHER DEALINGS IN THE SOFTWARE. - -module.exports = Stream; - -var EE = require('events').EventEmitter; -var inherits = require('inherits'); - -inherits(Stream, EE); -Stream.Readable = require('readable-stream/readable.js'); -Stream.Writable = require('readable-stream/writable.js'); -Stream.Duplex = require('readable-stream/duplex.js'); -Stream.Transform = require('readable-stream/transform.js'); -Stream.PassThrough = require('readable-stream/passthrough.js'); - -// Backwards-compat with node 0.4.x -Stream.Stream = Stream; - - - -// old-style streams. Note that the pipe method (the only relevant -// part of this class) is overridden in the Readable class. - -function Stream() { - EE.call(this); -} - -Stream.prototype.pipe = function(dest, options) { - var source = this; - - function ondata(chunk) { - if (dest.writable) { - if (false === dest.write(chunk) && source.pause) { - source.pause(); - } - } - } - - source.on('data', ondata); - - function ondrain() { - if (source.readable && source.resume) { - source.resume(); - } - } - - dest.on('drain', ondrain); - - // If the 'end' option is not supplied, dest.end() will be called when - // source gets the 'end' or 'close' events. Only dest.end() once. - if (!dest._isStdio && (!options || options.end !== false)) { - source.on('end', onend); - source.on('close', onclose); - } - - var didOnEnd = false; - function onend() { - if (didOnEnd) return; - didOnEnd = true; - - dest.end(); - } - - - function onclose() { - if (didOnEnd) return; - didOnEnd = true; - - if (typeof dest.destroy === 'function') dest.destroy(); - } - - // don't leave dangling pipes when there are errors. - function onerror(er) { - cleanup(); - if (EE.listenerCount(this, 'error') === 0) { - throw er; // Unhandled stream error in pipe. - } - } - - source.on('error', onerror); - dest.on('error', onerror); - - // remove all the event listeners that were added. - function cleanup() { - source.removeListener('data', ondata); - dest.removeListener('drain', ondrain); - - source.removeListener('end', onend); - source.removeListener('close', onclose); - - source.removeListener('error', onerror); - dest.removeListener('error', onerror); - - source.removeListener('end', cleanup); - source.removeListener('close', cleanup); - - dest.removeListener('close', cleanup); - } - - source.on('end', cleanup); - source.on('close', cleanup); - - dest.on('close', cleanup); - - dest.emit('pipe', source); - - // Allow for unix-like usage: A.pipe(B).pipe(C) - return dest; -}; - -},{"events":130,"inherits":156,"readable-stream/duplex.js":227,"readable-stream/passthrough.js":236,"readable-stream/readable.js":237,"readable-stream/transform.js":238,"readable-stream/writable.js":239}],226:[function(require,module,exports){ -var toString = {}.toString; - -module.exports = Array.isArray || function (arr) { - return toString.call(arr) == '[object Array]'; -}; - -},{}],227:[function(require,module,exports){ -module.exports = require('./lib/_stream_duplex.js'); - -},{"./lib/_stream_duplex.js":228}],228:[function(require,module,exports){ -// Copyright Joyent, Inc. and other Node contributors. -// -// Permission is hereby granted, free of charge, to any person obtaining a -// copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to permit -// persons to whom the Software is furnished to do so, subject to the -// following conditions: -// -// The above copyright notice and this permission notice shall be included -// in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN -// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR -// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE -// USE OR OTHER DEALINGS IN THE SOFTWARE. - -// a duplex stream is just a stream that is both readable and writable. -// Since JS doesn't have multiple prototypal inheritance, this class -// prototypally inherits from Readable, and then parasitically from -// Writable. - -'use strict'; - -/**/ - -var pna = require('process-nextick-args'); -/**/ - -/**/ -var objectKeys = Object.keys || function (obj) { - var keys = []; - for (var key in obj) { - keys.push(key); - }return keys; -}; -/**/ - -module.exports = Duplex; - -/**/ -var util = require('core-util-is'); -util.inherits = require('inherits'); -/**/ - -var Readable = require('./_stream_readable'); -var Writable = require('./_stream_writable'); - -util.inherits(Duplex, Readable); - -{ - // avoid scope creep, the keys array can then be collected - var keys = objectKeys(Writable.prototype); - for (var v = 0; v < keys.length; v++) { - var method = keys[v]; - if (!Duplex.prototype[method]) Duplex.prototype[method] = Writable.prototype[method]; - } -} - -function Duplex(options) { - if (!(this instanceof Duplex)) return new Duplex(options); - - Readable.call(this, options); - Writable.call(this, options); - - if (options && options.readable === false) this.readable = false; - - if (options && options.writable === false) this.writable = false; - - this.allowHalfOpen = true; - if (options && options.allowHalfOpen === false) this.allowHalfOpen = false; - - this.once('end', onend); -} - -Object.defineProperty(Duplex.prototype, 'writableHighWaterMark', { - // making it explicit this property is not enumerable - // because otherwise some prototype manipulation in - // userland will fail - enumerable: false, - get: function () { - return this._writableState.highWaterMark; - } -}); - -// the no-half-open enforcer -function onend() { - // if we allow half-open state, or if the writable side ended, - // then we're ok. - if (this.allowHalfOpen || this._writableState.ended) return; - - // no more data can be written. - // But allow more writes to happen in this tick. - pna.nextTick(onEndNT, this); -} - -function onEndNT(self) { - self.end(); -} - -Object.defineProperty(Duplex.prototype, 'destroyed', { - get: function () { - if (this._readableState === undefined || this._writableState === undefined) { - return false; - } - return this._readableState.destroyed && this._writableState.destroyed; - }, - set: function (value) { - // we ignore the value if the stream - // has not been initialized yet - if (this._readableState === undefined || this._writableState === undefined) { - return; - } - - // backward compatibility, the user is explicitly - // managing destroyed - this._readableState.destroyed = value; - this._writableState.destroyed = value; - } -}); - -Duplex.prototype._destroy = function (err, cb) { - this.push(null); - this.end(); - - pna.nextTick(cb, err); -}; -},{"./_stream_readable":230,"./_stream_writable":232,"core-util-is":92,"inherits":156,"process-nextick-args":196}],229:[function(require,module,exports){ -// Copyright Joyent, Inc. and other Node contributors. -// -// Permission is hereby granted, free of charge, to any person obtaining a -// copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to permit -// persons to whom the Software is furnished to do so, subject to the -// following conditions: -// -// The above copyright notice and this permission notice shall be included -// in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN -// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR -// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE -// USE OR OTHER DEALINGS IN THE SOFTWARE. - -// a passthrough stream. -// basically just the most minimal sort of Transform stream. -// Every written chunk gets output as-is. - -'use strict'; - -module.exports = PassThrough; - -var Transform = require('./_stream_transform'); - -/**/ -var util = require('core-util-is'); -util.inherits = require('inherits'); -/**/ - -util.inherits(PassThrough, Transform); - -function PassThrough(options) { - if (!(this instanceof PassThrough)) return new PassThrough(options); - - Transform.call(this, options); -} - -PassThrough.prototype._transform = function (chunk, encoding, cb) { - cb(null, chunk); -}; -},{"./_stream_transform":231,"core-util-is":92,"inherits":156}],230:[function(require,module,exports){ -(function (process,global){ -// Copyright Joyent, Inc. and other Node contributors. -// -// Permission is hereby granted, free of charge, to any person obtaining a -// copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to permit -// persons to whom the Software is furnished to do so, subject to the -// following conditions: -// -// The above copyright notice and this permission notice shall be included -// in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN -// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR -// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE -// USE OR OTHER DEALINGS IN THE SOFTWARE. - -'use strict'; - -/**/ - -var pna = require('process-nextick-args'); -/**/ - -module.exports = Readable; - -/**/ -var isArray = require('isarray'); -/**/ - -/**/ -var Duplex; -/**/ - -Readable.ReadableState = ReadableState; - -/**/ -var EE = require('events').EventEmitter; - -var EElistenerCount = function (emitter, type) { - return emitter.listeners(type).length; -}; -/**/ - -/**/ -var Stream = require('./internal/streams/stream'); -/**/ - -/**/ - -var Buffer = require('safe-buffer').Buffer; -var OurUint8Array = global.Uint8Array || function () {}; -function _uint8ArrayToBuffer(chunk) { - return Buffer.from(chunk); -} -function _isUint8Array(obj) { - return Buffer.isBuffer(obj) || obj instanceof OurUint8Array; -} - -/**/ - -/**/ -var util = require('core-util-is'); -util.inherits = require('inherits'); -/**/ - -/**/ -var debugUtil = require('util'); -var debug = void 0; -if (debugUtil && debugUtil.debuglog) { - debug = debugUtil.debuglog('stream'); -} else { - debug = function () {}; -} -/**/ - -var BufferList = require('./internal/streams/BufferList'); -var destroyImpl = require('./internal/streams/destroy'); -var StringDecoder; - -util.inherits(Readable, Stream); - -var kProxyEvents = ['error', 'close', 'destroy', 'pause', 'resume']; - -function prependListener(emitter, event, fn) { - // Sadly this is not cacheable as some libraries bundle their own - // event emitter implementation with them. - if (typeof emitter.prependListener === 'function') return emitter.prependListener(event, fn); - - // This is a hack to make sure that our error handler is attached before any - // userland ones. NEVER DO THIS. This is here only because this code needs - // to continue to work with older versions of Node.js that do not include - // the prependListener() method. The goal is to eventually remove this hack. - if (!emitter._events || !emitter._events[event]) emitter.on(event, fn);else if (isArray(emitter._events[event])) emitter._events[event].unshift(fn);else emitter._events[event] = [fn, emitter._events[event]]; -} - -function ReadableState(options, stream) { - Duplex = Duplex || require('./_stream_duplex'); - - options = options || {}; - - // Duplex streams are both readable and writable, but share - // the same options object. - // However, some cases require setting options to different - // values for the readable and the writable sides of the duplex stream. - // These options can be provided separately as readableXXX and writableXXX. - var isDuplex = stream instanceof Duplex; - - // object stream flag. Used to make read(n) ignore n and to - // make all the buffer merging and length checks go away - this.objectMode = !!options.objectMode; - - if (isDuplex) this.objectMode = this.objectMode || !!options.readableObjectMode; - - // the point at which it stops calling _read() to fill the buffer - // Note: 0 is a valid value, means "don't call _read preemptively ever" - var hwm = options.highWaterMark; - var readableHwm = options.readableHighWaterMark; - var defaultHwm = this.objectMode ? 16 : 16 * 1024; - - if (hwm || hwm === 0) this.highWaterMark = hwm;else if (isDuplex && (readableHwm || readableHwm === 0)) this.highWaterMark = readableHwm;else this.highWaterMark = defaultHwm; - - // cast to ints. - this.highWaterMark = Math.floor(this.highWaterMark); - - // A linked list is used to store data chunks instead of an array because the - // linked list can remove elements from the beginning faster than - // array.shift() - this.buffer = new BufferList(); - this.length = 0; - this.pipes = null; - this.pipesCount = 0; - this.flowing = null; - this.ended = false; - this.endEmitted = false; - this.reading = false; - - // a flag to be able to tell if the event 'readable'/'data' is emitted - // immediately, or on a later tick. We set this to true at first, because - // any actions that shouldn't happen until "later" should generally also - // not happen before the first read call. - this.sync = true; - - // whenever we return null, then we set a flag to say - // that we're awaiting a 'readable' event emission. - this.needReadable = false; - this.emittedReadable = false; - this.readableListening = false; - this.resumeScheduled = false; - - // has it been destroyed - this.destroyed = false; - - // Crypto is kind of old and crusty. Historically, its default string - // encoding is 'binary' so we have to make this configurable. - // Everything else in the universe uses 'utf8', though. - this.defaultEncoding = options.defaultEncoding || 'utf8'; - - // the number of writers that are awaiting a drain event in .pipe()s - this.awaitDrain = 0; - - // if true, a maybeReadMore has been scheduled - this.readingMore = false; - - this.decoder = null; - this.encoding = null; - if (options.encoding) { - if (!StringDecoder) StringDecoder = require('string_decoder/').StringDecoder; - this.decoder = new StringDecoder(options.encoding); - this.encoding = options.encoding; - } -} - -function Readable(options) { - Duplex = Duplex || require('./_stream_duplex'); - - if (!(this instanceof Readable)) return new Readable(options); - - this._readableState = new ReadableState(options, this); - - // legacy - this.readable = true; - - if (options) { - if (typeof options.read === 'function') this._read = options.read; - - if (typeof options.destroy === 'function') this._destroy = options.destroy; - } - - Stream.call(this); -} - -Object.defineProperty(Readable.prototype, 'destroyed', { - get: function () { - if (this._readableState === undefined) { - return false; - } - return this._readableState.destroyed; - }, - set: function (value) { - // we ignore the value if the stream - // has not been initialized yet - if (!this._readableState) { - return; - } - - // backward compatibility, the user is explicitly - // managing destroyed - this._readableState.destroyed = value; - } -}); - -Readable.prototype.destroy = destroyImpl.destroy; -Readable.prototype._undestroy = destroyImpl.undestroy; -Readable.prototype._destroy = function (err, cb) { - this.push(null); - cb(err); -}; - -// Manually shove something into the read() buffer. -// This returns true if the highWaterMark has not been hit yet, -// similar to how Writable.write() returns true if you should -// write() some more. -Readable.prototype.push = function (chunk, encoding) { - var state = this._readableState; - var skipChunkCheck; - - if (!state.objectMode) { - if (typeof chunk === 'string') { - encoding = encoding || state.defaultEncoding; - if (encoding !== state.encoding) { - chunk = Buffer.from(chunk, encoding); - encoding = ''; - } - skipChunkCheck = true; - } - } else { - skipChunkCheck = true; - } - - return readableAddChunk(this, chunk, encoding, false, skipChunkCheck); -}; - -// Unshift should *always* be something directly out of read() -Readable.prototype.unshift = function (chunk) { - return readableAddChunk(this, chunk, null, true, false); -}; - -function readableAddChunk(stream, chunk, encoding, addToFront, skipChunkCheck) { - var state = stream._readableState; - if (chunk === null) { - state.reading = false; - onEofChunk(stream, state); - } else { - var er; - if (!skipChunkCheck) er = chunkInvalid(state, chunk); - if (er) { - stream.emit('error', er); - } else if (state.objectMode || chunk && chunk.length > 0) { - if (typeof chunk !== 'string' && !state.objectMode && Object.getPrototypeOf(chunk) !== Buffer.prototype) { - chunk = _uint8ArrayToBuffer(chunk); - } - - if (addToFront) { - if (state.endEmitted) stream.emit('error', new Error('stream.unshift() after end event'));else addChunk(stream, state, chunk, true); - } else if (state.ended) { - stream.emit('error', new Error('stream.push() after EOF')); - } else { - state.reading = false; - if (state.decoder && !encoding) { - chunk = state.decoder.write(chunk); - if (state.objectMode || chunk.length !== 0) addChunk(stream, state, chunk, false);else maybeReadMore(stream, state); - } else { - addChunk(stream, state, chunk, false); - } - } - } else if (!addToFront) { - state.reading = false; - } - } - - return needMoreData(state); -} - -function addChunk(stream, state, chunk, addToFront) { - if (state.flowing && state.length === 0 && !state.sync) { - stream.emit('data', chunk); - stream.read(0); - } else { - // update the buffer info. - state.length += state.objectMode ? 1 : chunk.length; - if (addToFront) state.buffer.unshift(chunk);else state.buffer.push(chunk); - - if (state.needReadable) emitReadable(stream); - } - maybeReadMore(stream, state); -} - -function chunkInvalid(state, chunk) { - var er; - if (!_isUint8Array(chunk) && typeof chunk !== 'string' && chunk !== undefined && !state.objectMode) { - er = new TypeError('Invalid non-string/buffer chunk'); - } - return er; -} - -// if it's past the high water mark, we can push in some more. -// Also, if we have no data yet, we can stand some -// more bytes. This is to work around cases where hwm=0, -// such as the repl. Also, if the push() triggered a -// readable event, and the user called read(largeNumber) such that -// needReadable was set, then we ought to push more, so that another -// 'readable' event will be triggered. -function needMoreData(state) { - return !state.ended && (state.needReadable || state.length < state.highWaterMark || state.length === 0); -} - -Readable.prototype.isPaused = function () { - return this._readableState.flowing === false; -}; - -// backwards compatibility. -Readable.prototype.setEncoding = function (enc) { - if (!StringDecoder) StringDecoder = require('string_decoder/').StringDecoder; - this._readableState.decoder = new StringDecoder(enc); - this._readableState.encoding = enc; - return this; -}; - -// Don't raise the hwm > 8MB -var MAX_HWM = 0x800000; -function computeNewHighWaterMark(n) { - if (n >= MAX_HWM) { - n = MAX_HWM; - } else { - // Get the next highest power of 2 to prevent increasing hwm excessively in - // tiny amounts - n--; - n |= n >>> 1; - n |= n >>> 2; - n |= n >>> 4; - n |= n >>> 8; - n |= n >>> 16; - n++; - } - return n; -} - -// This function is designed to be inlinable, so please take care when making -// changes to the function body. -function howMuchToRead(n, state) { - if (n <= 0 || state.length === 0 && state.ended) return 0; - if (state.objectMode) return 1; - if (n !== n) { - // Only flow one buffer at a time - if (state.flowing && state.length) return state.buffer.head.data.length;else return state.length; - } - // If we're asking for more than the current hwm, then raise the hwm. - if (n > state.highWaterMark) state.highWaterMark = computeNewHighWaterMark(n); - if (n <= state.length) return n; - // Don't have enough - if (!state.ended) { - state.needReadable = true; - return 0; - } - return state.length; -} - -// you can override either this method, or the async _read(n) below. -Readable.prototype.read = function (n) { - debug('read', n); - n = parseInt(n, 10); - var state = this._readableState; - var nOrig = n; - - if (n !== 0) state.emittedReadable = false; - - // if we're doing read(0) to trigger a readable event, but we - // already have a bunch of data in the buffer, then just trigger - // the 'readable' event and move on. - if (n === 0 && state.needReadable && (state.length >= state.highWaterMark || state.ended)) { - debug('read: emitReadable', state.length, state.ended); - if (state.length === 0 && state.ended) endReadable(this);else emitReadable(this); - return null; - } - - n = howMuchToRead(n, state); - - // if we've ended, and we're now clear, then finish it up. - if (n === 0 && state.ended) { - if (state.length === 0) endReadable(this); - return null; - } - - // All the actual chunk generation logic needs to be - // *below* the call to _read. The reason is that in certain - // synthetic stream cases, such as passthrough streams, _read - // may be a completely synchronous operation which may change - // the state of the read buffer, providing enough data when - // before there was *not* enough. - // - // So, the steps are: - // 1. Figure out what the state of things will be after we do - // a read from the buffer. - // - // 2. If that resulting state will trigger a _read, then call _read. - // Note that this may be asynchronous, or synchronous. Yes, it is - // deeply ugly to write APIs this way, but that still doesn't mean - // that the Readable class should behave improperly, as streams are - // designed to be sync/async agnostic. - // Take note if the _read call is sync or async (ie, if the read call - // has returned yet), so that we know whether or not it's safe to emit - // 'readable' etc. - // - // 3. Actually pull the requested chunks out of the buffer and return. - - // if we need a readable event, then we need to do some reading. - var doRead = state.needReadable; - debug('need readable', doRead); - - // if we currently have less than the highWaterMark, then also read some - if (state.length === 0 || state.length - n < state.highWaterMark) { - doRead = true; - debug('length less than watermark', doRead); - } - - // however, if we've ended, then there's no point, and if we're already - // reading, then it's unnecessary. - if (state.ended || state.reading) { - doRead = false; - debug('reading or ended', doRead); - } else if (doRead) { - debug('do read'); - state.reading = true; - state.sync = true; - // if the length is currently zero, then we *need* a readable event. - if (state.length === 0) state.needReadable = true; - // call internal read method - this._read(state.highWaterMark); - state.sync = false; - // If _read pushed data synchronously, then `reading` will be false, - // and we need to re-evaluate how much data we can return to the user. - if (!state.reading) n = howMuchToRead(nOrig, state); - } - - var ret; - if (n > 0) ret = fromList(n, state);else ret = null; - - if (ret === null) { - state.needReadable = true; - n = 0; - } else { - state.length -= n; - } - - if (state.length === 0) { - // If we have nothing in the buffer, then we want to know - // as soon as we *do* get something into the buffer. - if (!state.ended) state.needReadable = true; - - // If we tried to read() past the EOF, then emit end on the next tick. - if (nOrig !== n && state.ended) endReadable(this); - } - - if (ret !== null) this.emit('data', ret); - - return ret; -}; - -function onEofChunk(stream, state) { - if (state.ended) return; - if (state.decoder) { - var chunk = state.decoder.end(); - if (chunk && chunk.length) { - state.buffer.push(chunk); - state.length += state.objectMode ? 1 : chunk.length; - } - } - state.ended = true; - - // emit 'readable' now to make sure it gets picked up. - emitReadable(stream); -} - -// Don't emit readable right away in sync mode, because this can trigger -// another read() call => stack overflow. This way, it might trigger -// a nextTick recursion warning, but that's not so bad. -function emitReadable(stream) { - var state = stream._readableState; - state.needReadable = false; - if (!state.emittedReadable) { - debug('emitReadable', state.flowing); - state.emittedReadable = true; - if (state.sync) pna.nextTick(emitReadable_, stream);else emitReadable_(stream); - } -} - -function emitReadable_(stream) { - debug('emit readable'); - stream.emit('readable'); - flow(stream); -} - -// at this point, the user has presumably seen the 'readable' event, -// and called read() to consume some data. that may have triggered -// in turn another _read(n) call, in which case reading = true if -// it's in progress. -// However, if we're not ended, or reading, and the length < hwm, -// then go ahead and try to read some more preemptively. -function maybeReadMore(stream, state) { - if (!state.readingMore) { - state.readingMore = true; - pna.nextTick(maybeReadMore_, stream, state); - } -} - -function maybeReadMore_(stream, state) { - var len = state.length; - while (!state.reading && !state.flowing && !state.ended && state.length < state.highWaterMark) { - debug('maybeReadMore read 0'); - stream.read(0); - if (len === state.length) - // didn't get any data, stop spinning. - break;else len = state.length; - } - state.readingMore = false; -} - -// abstract method. to be overridden in specific implementation classes. -// call cb(er, data) where data is <= n in length. -// for virtual (non-string, non-buffer) streams, "length" is somewhat -// arbitrary, and perhaps not very meaningful. -Readable.prototype._read = function (n) { - this.emit('error', new Error('_read() is not implemented')); -}; - -Readable.prototype.pipe = function (dest, pipeOpts) { - var src = this; - var state = this._readableState; - - switch (state.pipesCount) { - case 0: - state.pipes = dest; - break; - case 1: - state.pipes = [state.pipes, dest]; - break; - default: - state.pipes.push(dest); - break; - } - state.pipesCount += 1; - debug('pipe count=%d opts=%j', state.pipesCount, pipeOpts); - - var doEnd = (!pipeOpts || pipeOpts.end !== false) && dest !== process.stdout && dest !== process.stderr; - - var endFn = doEnd ? onend : unpipe; - if (state.endEmitted) pna.nextTick(endFn);else src.once('end', endFn); - - dest.on('unpipe', onunpipe); - function onunpipe(readable, unpipeInfo) { - debug('onunpipe'); - if (readable === src) { - if (unpipeInfo && unpipeInfo.hasUnpiped === false) { - unpipeInfo.hasUnpiped = true; - cleanup(); - } - } - } - - function onend() { - debug('onend'); - dest.end(); - } - - // when the dest drains, it reduces the awaitDrain counter - // on the source. This would be more elegant with a .once() - // handler in flow(), but adding and removing repeatedly is - // too slow. - var ondrain = pipeOnDrain(src); - dest.on('drain', ondrain); - - var cleanedUp = false; - function cleanup() { - debug('cleanup'); - // cleanup event handlers once the pipe is broken - dest.removeListener('close', onclose); - dest.removeListener('finish', onfinish); - dest.removeListener('drain', ondrain); - dest.removeListener('error', onerror); - dest.removeListener('unpipe', onunpipe); - src.removeListener('end', onend); - src.removeListener('end', unpipe); - src.removeListener('data', ondata); - - cleanedUp = true; - - // if the reader is waiting for a drain event from this - // specific writer, then it would cause it to never start - // flowing again. - // So, if this is awaiting a drain, then we just call it now. - // If we don't know, then assume that we are waiting for one. - if (state.awaitDrain && (!dest._writableState || dest._writableState.needDrain)) ondrain(); - } - - // If the user pushes more data while we're writing to dest then we'll end up - // in ondata again. However, we only want to increase awaitDrain once because - // dest will only emit one 'drain' event for the multiple writes. - // => Introduce a guard on increasing awaitDrain. - var increasedAwaitDrain = false; - src.on('data', ondata); - function ondata(chunk) { - debug('ondata'); - increasedAwaitDrain = false; - var ret = dest.write(chunk); - if (false === ret && !increasedAwaitDrain) { - // If the user unpiped during `dest.write()`, it is possible - // to get stuck in a permanently paused state if that write - // also returned false. - // => Check whether `dest` is still a piping destination. - if ((state.pipesCount === 1 && state.pipes === dest || state.pipesCount > 1 && indexOf(state.pipes, dest) !== -1) && !cleanedUp) { - debug('false write response, pause', src._readableState.awaitDrain); - src._readableState.awaitDrain++; - increasedAwaitDrain = true; - } - src.pause(); - } - } - - // if the dest has an error, then stop piping into it. - // however, don't suppress the throwing behavior for this. - function onerror(er) { - debug('onerror', er); - unpipe(); - dest.removeListener('error', onerror); - if (EElistenerCount(dest, 'error') === 0) dest.emit('error', er); - } - - // Make sure our error handler is attached before userland ones. - prependListener(dest, 'error', onerror); - - // Both close and finish should trigger unpipe, but only once. - function onclose() { - dest.removeListener('finish', onfinish); - unpipe(); - } - dest.once('close', onclose); - function onfinish() { - debug('onfinish'); - dest.removeListener('close', onclose); - unpipe(); - } - dest.once('finish', onfinish); - - function unpipe() { - debug('unpipe'); - src.unpipe(dest); - } - - // tell the dest that it's being piped to - dest.emit('pipe', src); - - // start the flow if it hasn't been started already. - if (!state.flowing) { - debug('pipe resume'); - src.resume(); - } - - return dest; -}; - -function pipeOnDrain(src) { - return function () { - var state = src._readableState; - debug('pipeOnDrain', state.awaitDrain); - if (state.awaitDrain) state.awaitDrain--; - if (state.awaitDrain === 0 && EElistenerCount(src, 'data')) { - state.flowing = true; - flow(src); - } - }; -} - -Readable.prototype.unpipe = function (dest) { - var state = this._readableState; - var unpipeInfo = { hasUnpiped: false }; - - // if we're not piping anywhere, then do nothing. - if (state.pipesCount === 0) return this; - - // just one destination. most common case. - if (state.pipesCount === 1) { - // passed in one, but it's not the right one. - if (dest && dest !== state.pipes) return this; - - if (!dest) dest = state.pipes; - - // got a match. - state.pipes = null; - state.pipesCount = 0; - state.flowing = false; - if (dest) dest.emit('unpipe', this, unpipeInfo); - return this; - } - - // slow case. multiple pipe destinations. - - if (!dest) { - // remove all. - var dests = state.pipes; - var len = state.pipesCount; - state.pipes = null; - state.pipesCount = 0; - state.flowing = false; - - for (var i = 0; i < len; i++) { - dests[i].emit('unpipe', this, unpipeInfo); - }return this; - } - - // try to find the right one. - var index = indexOf(state.pipes, dest); - if (index === -1) return this; - - state.pipes.splice(index, 1); - state.pipesCount -= 1; - if (state.pipesCount === 1) state.pipes = state.pipes[0]; - - dest.emit('unpipe', this, unpipeInfo); - - return this; -}; - -// set up data events if they are asked for -// Ensure readable listeners eventually get something -Readable.prototype.on = function (ev, fn) { - var res = Stream.prototype.on.call(this, ev, fn); - - if (ev === 'data') { - // Start flowing on next tick if stream isn't explicitly paused - if (this._readableState.flowing !== false) this.resume(); - } else if (ev === 'readable') { - var state = this._readableState; - if (!state.endEmitted && !state.readableListening) { - state.readableListening = state.needReadable = true; - state.emittedReadable = false; - if (!state.reading) { - pna.nextTick(nReadingNextTick, this); - } else if (state.length) { - emitReadable(this); - } - } - } - - return res; -}; -Readable.prototype.addListener = Readable.prototype.on; - -function nReadingNextTick(self) { - debug('readable nexttick read 0'); - self.read(0); -} - -// pause() and resume() are remnants of the legacy readable stream API -// If the user uses them, then switch into old mode. -Readable.prototype.resume = function () { - var state = this._readableState; - if (!state.flowing) { - debug('resume'); - state.flowing = true; - resume(this, state); - } - return this; -}; - -function resume(stream, state) { - if (!state.resumeScheduled) { - state.resumeScheduled = true; - pna.nextTick(resume_, stream, state); - } -} - -function resume_(stream, state) { - if (!state.reading) { - debug('resume read 0'); - stream.read(0); - } - - state.resumeScheduled = false; - state.awaitDrain = 0; - stream.emit('resume'); - flow(stream); - if (state.flowing && !state.reading) stream.read(0); -} - -Readable.prototype.pause = function () { - debug('call pause flowing=%j', this._readableState.flowing); - if (false !== this._readableState.flowing) { - debug('pause'); - this._readableState.flowing = false; - this.emit('pause'); - } - return this; -}; - -function flow(stream) { - var state = stream._readableState; - debug('flow', state.flowing); - while (state.flowing && stream.read() !== null) {} -} - -// wrap an old-style stream as the async data source. -// This is *not* part of the readable stream interface. -// It is an ugly unfortunate mess of history. -Readable.prototype.wrap = function (stream) { - var _this = this; - - var state = this._readableState; - var paused = false; - - stream.on('end', function () { - debug('wrapped end'); - if (state.decoder && !state.ended) { - var chunk = state.decoder.end(); - if (chunk && chunk.length) _this.push(chunk); - } - - _this.push(null); - }); - - stream.on('data', function (chunk) { - debug('wrapped data'); - if (state.decoder) chunk = state.decoder.write(chunk); - - // don't skip over falsy values in objectMode - if (state.objectMode && (chunk === null || chunk === undefined)) return;else if (!state.objectMode && (!chunk || !chunk.length)) return; - - var ret = _this.push(chunk); - if (!ret) { - paused = true; - stream.pause(); - } - }); - - // proxy all the other methods. - // important when wrapping filters and duplexes. - for (var i in stream) { - if (this[i] === undefined && typeof stream[i] === 'function') { - this[i] = function (method) { - return function () { - return stream[method].apply(stream, arguments); - }; - }(i); - } - } - - // proxy certain important events. - for (var n = 0; n < kProxyEvents.length; n++) { - stream.on(kProxyEvents[n], this.emit.bind(this, kProxyEvents[n])); - } - - // when we try to consume some more bytes, simply unpause the - // underlying stream. - this._read = function (n) { - debug('wrapped _read', n); - if (paused) { - paused = false; - stream.resume(); - } - }; - - return this; -}; - -Object.defineProperty(Readable.prototype, 'readableHighWaterMark', { - // making it explicit this property is not enumerable - // because otherwise some prototype manipulation in - // userland will fail - enumerable: false, - get: function () { - return this._readableState.highWaterMark; - } -}); - -// exposed for testing purposes only. -Readable._fromList = fromList; - -// Pluck off n bytes from an array of buffers. -// Length is the combined lengths of all the buffers in the list. -// This function is designed to be inlinable, so please take care when making -// changes to the function body. -function fromList(n, state) { - // nothing buffered - if (state.length === 0) return null; - - var ret; - if (state.objectMode) ret = state.buffer.shift();else if (!n || n >= state.length) { - // read it all, truncate the list - if (state.decoder) ret = state.buffer.join('');else if (state.buffer.length === 1) ret = state.buffer.head.data;else ret = state.buffer.concat(state.length); - state.buffer.clear(); - } else { - // read part of list - ret = fromListPartial(n, state.buffer, state.decoder); - } - - return ret; -} - -// Extracts only enough buffered data to satisfy the amount requested. -// This function is designed to be inlinable, so please take care when making -// changes to the function body. -function fromListPartial(n, list, hasStrings) { - var ret; - if (n < list.head.data.length) { - // slice is the same for buffers and strings - ret = list.head.data.slice(0, n); - list.head.data = list.head.data.slice(n); - } else if (n === list.head.data.length) { - // first chunk is a perfect match - ret = list.shift(); - } else { - // result spans more than one buffer - ret = hasStrings ? copyFromBufferString(n, list) : copyFromBuffer(n, list); - } - return ret; -} - -// Copies a specified amount of characters from the list of buffered data -// chunks. -// This function is designed to be inlinable, so please take care when making -// changes to the function body. -function copyFromBufferString(n, list) { - var p = list.head; - var c = 1; - var ret = p.data; - n -= ret.length; - while (p = p.next) { - var str = p.data; - var nb = n > str.length ? str.length : n; - if (nb === str.length) ret += str;else ret += str.slice(0, n); - n -= nb; - if (n === 0) { - if (nb === str.length) { - ++c; - if (p.next) list.head = p.next;else list.head = list.tail = null; - } else { - list.head = p; - p.data = str.slice(nb); - } - break; - } - ++c; - } - list.length -= c; - return ret; -} - -// Copies a specified amount of bytes from the list of buffered data chunks. -// This function is designed to be inlinable, so please take care when making -// changes to the function body. -function copyFromBuffer(n, list) { - var ret = Buffer.allocUnsafe(n); - var p = list.head; - var c = 1; - p.data.copy(ret); - n -= p.data.length; - while (p = p.next) { - var buf = p.data; - var nb = n > buf.length ? buf.length : n; - buf.copy(ret, ret.length - n, 0, nb); - n -= nb; - if (n === 0) { - if (nb === buf.length) { - ++c; - if (p.next) list.head = p.next;else list.head = list.tail = null; - } else { - list.head = p; - p.data = buf.slice(nb); - } - break; - } - ++c; - } - list.length -= c; - return ret; -} - -function endReadable(stream) { - var state = stream._readableState; - - // If we get here before consuming all the bytes, then that is a - // bug in node. Should never happen. - if (state.length > 0) throw new Error('"endReadable()" called on non-empty stream'); - - if (!state.endEmitted) { - state.ended = true; - pna.nextTick(endReadableNT, state, stream); - } -} - -function endReadableNT(state, stream) { - // Check that we didn't get one last unshift. - if (!state.endEmitted && state.length === 0) { - state.endEmitted = true; - stream.readable = false; - stream.emit('end'); - } -} - -function indexOf(xs, x) { - for (var i = 0, l = xs.length; i < l; i++) { - if (xs[i] === x) return i; - } - return -1; -} -}).call(this,require('_process'),typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) -},{"./_stream_duplex":228,"./internal/streams/BufferList":233,"./internal/streams/destroy":234,"./internal/streams/stream":235,"_process":197,"core-util-is":92,"events":130,"inherits":156,"isarray":226,"process-nextick-args":196,"safe-buffer":216,"string_decoder/":240,"util":54}],231:[function(require,module,exports){ -// Copyright Joyent, Inc. and other Node contributors. -// -// Permission is hereby granted, free of charge, to any person obtaining a -// copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to permit -// persons to whom the Software is furnished to do so, subject to the -// following conditions: -// -// The above copyright notice and this permission notice shall be included -// in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN -// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR -// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE -// USE OR OTHER DEALINGS IN THE SOFTWARE. - -// a transform stream is a readable/writable stream where you do -// something with the data. Sometimes it's called a "filter", -// but that's not a great name for it, since that implies a thing where -// some bits pass through, and others are simply ignored. (That would -// be a valid example of a transform, of course.) -// -// While the output is causally related to the input, it's not a -// necessarily symmetric or synchronous transformation. For example, -// a zlib stream might take multiple plain-text writes(), and then -// emit a single compressed chunk some time in the future. -// -// Here's how this works: -// -// The Transform stream has all the aspects of the readable and writable -// stream classes. When you write(chunk), that calls _write(chunk,cb) -// internally, and returns false if there's a lot of pending writes -// buffered up. When you call read(), that calls _read(n) until -// there's enough pending readable data buffered up. -// -// In a transform stream, the written data is placed in a buffer. When -// _read(n) is called, it transforms the queued up data, calling the -// buffered _write cb's as it consumes chunks. If consuming a single -// written chunk would result in multiple output chunks, then the first -// outputted bit calls the readcb, and subsequent chunks just go into -// the read buffer, and will cause it to emit 'readable' if necessary. -// -// This way, back-pressure is actually determined by the reading side, -// since _read has to be called to start processing a new chunk. However, -// a pathological inflate type of transform can cause excessive buffering -// here. For example, imagine a stream where every byte of input is -// interpreted as an integer from 0-255, and then results in that many -// bytes of output. Writing the 4 bytes {ff,ff,ff,ff} would result in -// 1kb of data being output. In this case, you could write a very small -// amount of input, and end up with a very large amount of output. In -// such a pathological inflating mechanism, there'd be no way to tell -// the system to stop doing the transform. A single 4MB write could -// cause the system to run out of memory. -// -// However, even in such a pathological case, only a single written chunk -// would be consumed, and then the rest would wait (un-transformed) until -// the results of the previous transformed chunk were consumed. - -'use strict'; - -module.exports = Transform; - -var Duplex = require('./_stream_duplex'); - -/**/ -var util = require('core-util-is'); -util.inherits = require('inherits'); -/**/ - -util.inherits(Transform, Duplex); - -function afterTransform(er, data) { - var ts = this._transformState; - ts.transforming = false; - - var cb = ts.writecb; - - if (!cb) { - return this.emit('error', new Error('write callback called multiple times')); - } - - ts.writechunk = null; - ts.writecb = null; - - if (data != null) // single equals check for both `null` and `undefined` - this.push(data); - - cb(er); - - var rs = this._readableState; - rs.reading = false; - if (rs.needReadable || rs.length < rs.highWaterMark) { - this._read(rs.highWaterMark); - } -} - -function Transform(options) { - if (!(this instanceof Transform)) return new Transform(options); - - Duplex.call(this, options); - - this._transformState = { - afterTransform: afterTransform.bind(this), - needTransform: false, - transforming: false, - writecb: null, - writechunk: null, - writeencoding: null - }; - - // start out asking for a readable event once data is transformed. - this._readableState.needReadable = true; - - // we have implemented the _read method, and done the other things - // that Readable wants before the first _read call, so unset the - // sync guard flag. - this._readableState.sync = false; - - if (options) { - if (typeof options.transform === 'function') this._transform = options.transform; - - if (typeof options.flush === 'function') this._flush = options.flush; - } - - // When the writable side finishes, then flush out anything remaining. - this.on('prefinish', prefinish); -} - -function prefinish() { - var _this = this; - - if (typeof this._flush === 'function') { - this._flush(function (er, data) { - done(_this, er, data); - }); - } else { - done(this, null, null); - } -} - -Transform.prototype.push = function (chunk, encoding) { - this._transformState.needTransform = false; - return Duplex.prototype.push.call(this, chunk, encoding); -}; - -// This is the part where you do stuff! -// override this function in implementation classes. -// 'chunk' is an input chunk. -// -// Call `push(newChunk)` to pass along transformed output -// to the readable side. You may call 'push' zero or more times. -// -// Call `cb(err)` when you are done with this chunk. If you pass -// an error, then that'll put the hurt on the whole operation. If you -// never call cb(), then you'll never get another chunk. -Transform.prototype._transform = function (chunk, encoding, cb) { - throw new Error('_transform() is not implemented'); -}; - -Transform.prototype._write = function (chunk, encoding, cb) { - var ts = this._transformState; - ts.writecb = cb; - ts.writechunk = chunk; - ts.writeencoding = encoding; - if (!ts.transforming) { - var rs = this._readableState; - if (ts.needTransform || rs.needReadable || rs.length < rs.highWaterMark) this._read(rs.highWaterMark); - } -}; - -// Doesn't matter what the args are here. -// _transform does all the work. -// That we got here means that the readable side wants more data. -Transform.prototype._read = function (n) { - var ts = this._transformState; - - if (ts.writechunk !== null && ts.writecb && !ts.transforming) { - ts.transforming = true; - this._transform(ts.writechunk, ts.writeencoding, ts.afterTransform); - } else { - // mark that we need a transform, so that any data that comes in - // will get processed, now that we've asked for it. - ts.needTransform = true; - } -}; - -Transform.prototype._destroy = function (err, cb) { - var _this2 = this; - - Duplex.prototype._destroy.call(this, err, function (err2) { - cb(err2); - _this2.emit('close'); - }); -}; - -function done(stream, er, data) { - if (er) return stream.emit('error', er); - - if (data != null) // single equals check for both `null` and `undefined` - stream.push(data); - - // if there's nothing in the write buffer, then that means - // that nothing more will ever be provided - if (stream._writableState.length) throw new Error('Calling transform done when ws.length != 0'); - - if (stream._transformState.transforming) throw new Error('Calling transform done when still transforming'); - - return stream.push(null); -} -},{"./_stream_duplex":228,"core-util-is":92,"inherits":156}],232:[function(require,module,exports){ -(function (process,global,setImmediate){ -// Copyright Joyent, Inc. and other Node contributors. -// -// Permission is hereby granted, free of charge, to any person obtaining a -// copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to permit -// persons to whom the Software is furnished to do so, subject to the -// following conditions: -// -// The above copyright notice and this permission notice shall be included -// in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN -// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR -// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE -// USE OR OTHER DEALINGS IN THE SOFTWARE. - -// A bit simpler than readable streams. -// Implement an async ._write(chunk, encoding, cb), and it'll handle all -// the drain event emission and buffering. - -'use strict'; - -/**/ - -var pna = require('process-nextick-args'); -/**/ - -module.exports = Writable; - -/* */ -function WriteReq(chunk, encoding, cb) { - this.chunk = chunk; - this.encoding = encoding; - this.callback = cb; - this.next = null; -} - -// It seems a linked list but it is not -// there will be only 2 of these for each stream -function CorkedRequest(state) { - var _this = this; - - this.next = null; - this.entry = null; - this.finish = function () { - onCorkedFinish(_this, state); - }; -} -/* */ - -/**/ -var asyncWrite = !process.browser && ['v0.10', 'v0.9.'].indexOf(process.version.slice(0, 5)) > -1 ? setImmediate : pna.nextTick; -/**/ - -/**/ -var Duplex; -/**/ - -Writable.WritableState = WritableState; - -/**/ -var util = require('core-util-is'); -util.inherits = require('inherits'); -/**/ - -/**/ -var internalUtil = { - deprecate: require('util-deprecate') -}; -/**/ - -/**/ -var Stream = require('./internal/streams/stream'); -/**/ - -/**/ - -var Buffer = require('safe-buffer').Buffer; -var OurUint8Array = global.Uint8Array || function () {}; -function _uint8ArrayToBuffer(chunk) { - return Buffer.from(chunk); -} -function _isUint8Array(obj) { - return Buffer.isBuffer(obj) || obj instanceof OurUint8Array; -} - -/**/ - -var destroyImpl = require('./internal/streams/destroy'); - -util.inherits(Writable, Stream); - -function nop() {} - -function WritableState(options, stream) { - Duplex = Duplex || require('./_stream_duplex'); - - options = options || {}; - - // Duplex streams are both readable and writable, but share - // the same options object. - // However, some cases require setting options to different - // values for the readable and the writable sides of the duplex stream. - // These options can be provided separately as readableXXX and writableXXX. - var isDuplex = stream instanceof Duplex; - - // object stream flag to indicate whether or not this stream - // contains buffers or objects. - this.objectMode = !!options.objectMode; - - if (isDuplex) this.objectMode = this.objectMode || !!options.writableObjectMode; - - // the point at which write() starts returning false - // Note: 0 is a valid value, means that we always return false if - // the entire buffer is not flushed immediately on write() - var hwm = options.highWaterMark; - var writableHwm = options.writableHighWaterMark; - var defaultHwm = this.objectMode ? 16 : 16 * 1024; - - if (hwm || hwm === 0) this.highWaterMark = hwm;else if (isDuplex && (writableHwm || writableHwm === 0)) this.highWaterMark = writableHwm;else this.highWaterMark = defaultHwm; - - // cast to ints. - this.highWaterMark = Math.floor(this.highWaterMark); - - // if _final has been called - this.finalCalled = false; - - // drain event flag. - this.needDrain = false; - // at the start of calling end() - this.ending = false; - // when end() has been called, and returned - this.ended = false; - // when 'finish' is emitted - this.finished = false; - - // has it been destroyed - this.destroyed = false; - - // should we decode strings into buffers before passing to _write? - // this is here so that some node-core streams can optimize string - // handling at a lower level. - var noDecode = options.decodeStrings === false; - this.decodeStrings = !noDecode; - - // Crypto is kind of old and crusty. Historically, its default string - // encoding is 'binary' so we have to make this configurable. - // Everything else in the universe uses 'utf8', though. - this.defaultEncoding = options.defaultEncoding || 'utf8'; - - // not an actual buffer we keep track of, but a measurement - // of how much we're waiting to get pushed to some underlying - // socket or file. - this.length = 0; - - // a flag to see when we're in the middle of a write. - this.writing = false; - - // when true all writes will be buffered until .uncork() call - this.corked = 0; - - // a flag to be able to tell if the onwrite cb is called immediately, - // or on a later tick. We set this to true at first, because any - // actions that shouldn't happen until "later" should generally also - // not happen before the first write call. - this.sync = true; - - // a flag to know if we're processing previously buffered items, which - // may call the _write() callback in the same tick, so that we don't - // end up in an overlapped onwrite situation. - this.bufferProcessing = false; - - // the callback that's passed to _write(chunk,cb) - this.onwrite = function (er) { - onwrite(stream, er); - }; - - // the callback that the user supplies to write(chunk,encoding,cb) - this.writecb = null; - - // the amount that is being written when _write is called. - this.writelen = 0; - - this.bufferedRequest = null; - this.lastBufferedRequest = null; - - // number of pending user-supplied write callbacks - // this must be 0 before 'finish' can be emitted - this.pendingcb = 0; - - // emit prefinish if the only thing we're waiting for is _write cbs - // This is relevant for synchronous Transform streams - this.prefinished = false; - - // True if the error was already emitted and should not be thrown again - this.errorEmitted = false; - - // count buffered requests - this.bufferedRequestCount = 0; - - // allocate the first CorkedRequest, there is always - // one allocated and free to use, and we maintain at most two - this.corkedRequestsFree = new CorkedRequest(this); -} - -WritableState.prototype.getBuffer = function getBuffer() { - var current = this.bufferedRequest; - var out = []; - while (current) { - out.push(current); - current = current.next; - } - return out; -}; - -(function () { - try { - Object.defineProperty(WritableState.prototype, 'buffer', { - get: internalUtil.deprecate(function () { - return this.getBuffer(); - }, '_writableState.buffer is deprecated. Use _writableState.getBuffer ' + 'instead.', 'DEP0003') - }); - } catch (_) {} -})(); - -// Test _writableState for inheritance to account for Duplex streams, -// whose prototype chain only points to Readable. -var realHasInstance; -if (typeof Symbol === 'function' && Symbol.hasInstance && typeof Function.prototype[Symbol.hasInstance] === 'function') { - realHasInstance = Function.prototype[Symbol.hasInstance]; - Object.defineProperty(Writable, Symbol.hasInstance, { - value: function (object) { - if (realHasInstance.call(this, object)) return true; - if (this !== Writable) return false; - - return object && object._writableState instanceof WritableState; - } - }); -} else { - realHasInstance = function (object) { - return object instanceof this; - }; -} - -function Writable(options) { - Duplex = Duplex || require('./_stream_duplex'); - - // Writable ctor is applied to Duplexes, too. - // `realHasInstance` is necessary because using plain `instanceof` - // would return false, as no `_writableState` property is attached. - - // Trying to use the custom `instanceof` for Writable here will also break the - // Node.js LazyTransform implementation, which has a non-trivial getter for - // `_writableState` that would lead to infinite recursion. - if (!realHasInstance.call(Writable, this) && !(this instanceof Duplex)) { - return new Writable(options); - } - - this._writableState = new WritableState(options, this); - - // legacy. - this.writable = true; - - if (options) { - if (typeof options.write === 'function') this._write = options.write; - - if (typeof options.writev === 'function') this._writev = options.writev; - - if (typeof options.destroy === 'function') this._destroy = options.destroy; - - if (typeof options.final === 'function') this._final = options.final; - } - - Stream.call(this); -} - -// Otherwise people can pipe Writable streams, which is just wrong. -Writable.prototype.pipe = function () { - this.emit('error', new Error('Cannot pipe, not readable')); -}; - -function writeAfterEnd(stream, cb) { - var er = new Error('write after end'); - // TODO: defer error events consistently everywhere, not just the cb - stream.emit('error', er); - pna.nextTick(cb, er); -} - -// Checks that a user-supplied chunk is valid, especially for the particular -// mode the stream is in. Currently this means that `null` is never accepted -// and undefined/non-string values are only allowed in object mode. -function validChunk(stream, state, chunk, cb) { - var valid = true; - var er = false; - - if (chunk === null) { - er = new TypeError('May not write null values to stream'); - } else if (typeof chunk !== 'string' && chunk !== undefined && !state.objectMode) { - er = new TypeError('Invalid non-string/buffer chunk'); - } - if (er) { - stream.emit('error', er); - pna.nextTick(cb, er); - valid = false; - } - return valid; -} - -Writable.prototype.write = function (chunk, encoding, cb) { - var state = this._writableState; - var ret = false; - var isBuf = !state.objectMode && _isUint8Array(chunk); - - if (isBuf && !Buffer.isBuffer(chunk)) { - chunk = _uint8ArrayToBuffer(chunk); - } - - if (typeof encoding === 'function') { - cb = encoding; - encoding = null; - } - - if (isBuf) encoding = 'buffer';else if (!encoding) encoding = state.defaultEncoding; - - if (typeof cb !== 'function') cb = nop; - - if (state.ended) writeAfterEnd(this, cb);else if (isBuf || validChunk(this, state, chunk, cb)) { - state.pendingcb++; - ret = writeOrBuffer(this, state, isBuf, chunk, encoding, cb); - } - - return ret; -}; - -Writable.prototype.cork = function () { - var state = this._writableState; - - state.corked++; -}; - -Writable.prototype.uncork = function () { - var state = this._writableState; - - if (state.corked) { - state.corked--; - - if (!state.writing && !state.corked && !state.finished && !state.bufferProcessing && state.bufferedRequest) clearBuffer(this, state); - } -}; - -Writable.prototype.setDefaultEncoding = function setDefaultEncoding(encoding) { - // node::ParseEncoding() requires lower case. - if (typeof encoding === 'string') encoding = encoding.toLowerCase(); - if (!(['hex', 'utf8', 'utf-8', 'ascii', 'binary', 'base64', 'ucs2', 'ucs-2', 'utf16le', 'utf-16le', 'raw'].indexOf((encoding + '').toLowerCase()) > -1)) throw new TypeError('Unknown encoding: ' + encoding); - this._writableState.defaultEncoding = encoding; - return this; -}; - -function decodeChunk(state, chunk, encoding) { - if (!state.objectMode && state.decodeStrings !== false && typeof chunk === 'string') { - chunk = Buffer.from(chunk, encoding); - } - return chunk; -} - -Object.defineProperty(Writable.prototype, 'writableHighWaterMark', { - // making it explicit this property is not enumerable - // because otherwise some prototype manipulation in - // userland will fail - enumerable: false, - get: function () { - return this._writableState.highWaterMark; - } -}); - -// if we're already writing something, then just put this -// in the queue, and wait our turn. Otherwise, call _write -// If we return false, then we need a drain event, so set that flag. -function writeOrBuffer(stream, state, isBuf, chunk, encoding, cb) { - if (!isBuf) { - var newChunk = decodeChunk(state, chunk, encoding); - if (chunk !== newChunk) { - isBuf = true; - encoding = 'buffer'; - chunk = newChunk; - } - } - var len = state.objectMode ? 1 : chunk.length; - - state.length += len; - - var ret = state.length < state.highWaterMark; - // we must ensure that previous needDrain will not be reset to false. - if (!ret) state.needDrain = true; - - if (state.writing || state.corked) { - var last = state.lastBufferedRequest; - state.lastBufferedRequest = { - chunk: chunk, - encoding: encoding, - isBuf: isBuf, - callback: cb, - next: null - }; - if (last) { - last.next = state.lastBufferedRequest; - } else { - state.bufferedRequest = state.lastBufferedRequest; - } - state.bufferedRequestCount += 1; - } else { - doWrite(stream, state, false, len, chunk, encoding, cb); - } - - return ret; -} - -function doWrite(stream, state, writev, len, chunk, encoding, cb) { - state.writelen = len; - state.writecb = cb; - state.writing = true; - state.sync = true; - if (writev) stream._writev(chunk, state.onwrite);else stream._write(chunk, encoding, state.onwrite); - state.sync = false; -} - -function onwriteError(stream, state, sync, er, cb) { - --state.pendingcb; - - if (sync) { - // defer the callback if we are being called synchronously - // to avoid piling up things on the stack - pna.nextTick(cb, er); - // this can emit finish, and it will always happen - // after error - pna.nextTick(finishMaybe, stream, state); - stream._writableState.errorEmitted = true; - stream.emit('error', er); - } else { - // the caller expect this to happen before if - // it is async - cb(er); - stream._writableState.errorEmitted = true; - stream.emit('error', er); - // this can emit finish, but finish must - // always follow error - finishMaybe(stream, state); - } -} - -function onwriteStateUpdate(state) { - state.writing = false; - state.writecb = null; - state.length -= state.writelen; - state.writelen = 0; -} - -function onwrite(stream, er) { - var state = stream._writableState; - var sync = state.sync; - var cb = state.writecb; - - onwriteStateUpdate(state); - - if (er) onwriteError(stream, state, sync, er, cb);else { - // Check if we're actually ready to finish, but don't emit yet - var finished = needFinish(state); - - if (!finished && !state.corked && !state.bufferProcessing && state.bufferedRequest) { - clearBuffer(stream, state); - } - - if (sync) { - /**/ - asyncWrite(afterWrite, stream, state, finished, cb); - /**/ - } else { - afterWrite(stream, state, finished, cb); - } - } -} - -function afterWrite(stream, state, finished, cb) { - if (!finished) onwriteDrain(stream, state); - state.pendingcb--; - cb(); - finishMaybe(stream, state); -} - -// Must force callback to be called on nextTick, so that we don't -// emit 'drain' before the write() consumer gets the 'false' return -// value, and has a chance to attach a 'drain' listener. -function onwriteDrain(stream, state) { - if (state.length === 0 && state.needDrain) { - state.needDrain = false; - stream.emit('drain'); - } -} - -// if there's something in the buffer waiting, then process it -function clearBuffer(stream, state) { - state.bufferProcessing = true; - var entry = state.bufferedRequest; - - if (stream._writev && entry && entry.next) { - // Fast case, write everything using _writev() - var l = state.bufferedRequestCount; - var buffer = new Array(l); - var holder = state.corkedRequestsFree; - holder.entry = entry; - - var count = 0; - var allBuffers = true; - while (entry) { - buffer[count] = entry; - if (!entry.isBuf) allBuffers = false; - entry = entry.next; - count += 1; - } - buffer.allBuffers = allBuffers; - - doWrite(stream, state, true, state.length, buffer, '', holder.finish); - - // doWrite is almost always async, defer these to save a bit of time - // as the hot path ends with doWrite - state.pendingcb++; - state.lastBufferedRequest = null; - if (holder.next) { - state.corkedRequestsFree = holder.next; - holder.next = null; - } else { - state.corkedRequestsFree = new CorkedRequest(state); - } - state.bufferedRequestCount = 0; - } else { - // Slow case, write chunks one-by-one - while (entry) { - var chunk = entry.chunk; - var encoding = entry.encoding; - var cb = entry.callback; - var len = state.objectMode ? 1 : chunk.length; - - doWrite(stream, state, false, len, chunk, encoding, cb); - entry = entry.next; - state.bufferedRequestCount--; - // if we didn't call the onwrite immediately, then - // it means that we need to wait until it does. - // also, that means that the chunk and cb are currently - // being processed, so move the buffer counter past them. - if (state.writing) { - break; - } - } - - if (entry === null) state.lastBufferedRequest = null; - } - - state.bufferedRequest = entry; - state.bufferProcessing = false; -} - -Writable.prototype._write = function (chunk, encoding, cb) { - cb(new Error('_write() is not implemented')); -}; - -Writable.prototype._writev = null; - -Writable.prototype.end = function (chunk, encoding, cb) { - var state = this._writableState; - - if (typeof chunk === 'function') { - cb = chunk; - chunk = null; - encoding = null; - } else if (typeof encoding === 'function') { - cb = encoding; - encoding = null; - } - - if (chunk !== null && chunk !== undefined) this.write(chunk, encoding); - - // .end() fully uncorks - if (state.corked) { - state.corked = 1; - this.uncork(); - } - - // ignore unnecessary end() calls. - if (!state.ending && !state.finished) endWritable(this, state, cb); -}; - -function needFinish(state) { - return state.ending && state.length === 0 && state.bufferedRequest === null && !state.finished && !state.writing; -} -function callFinal(stream, state) { - stream._final(function (err) { - state.pendingcb--; - if (err) { - stream.emit('error', err); - } - state.prefinished = true; - stream.emit('prefinish'); - finishMaybe(stream, state); - }); -} -function prefinish(stream, state) { - if (!state.prefinished && !state.finalCalled) { - if (typeof stream._final === 'function') { - state.pendingcb++; - state.finalCalled = true; - pna.nextTick(callFinal, stream, state); - } else { - state.prefinished = true; - stream.emit('prefinish'); - } - } -} - -function finishMaybe(stream, state) { - var need = needFinish(state); - if (need) { - prefinish(stream, state); - if (state.pendingcb === 0) { - state.finished = true; - stream.emit('finish'); - } - } - return need; -} - -function endWritable(stream, state, cb) { - state.ending = true; - finishMaybe(stream, state); - if (cb) { - if (state.finished) pna.nextTick(cb);else stream.once('finish', cb); - } - state.ended = true; - stream.writable = false; -} - -function onCorkedFinish(corkReq, state, err) { - var entry = corkReq.entry; - corkReq.entry = null; - while (entry) { - var cb = entry.callback; - state.pendingcb--; - cb(err); - entry = entry.next; - } - if (state.corkedRequestsFree) { - state.corkedRequestsFree.next = corkReq; - } else { - state.corkedRequestsFree = corkReq; - } -} - -Object.defineProperty(Writable.prototype, 'destroyed', { - get: function () { - if (this._writableState === undefined) { - return false; - } - return this._writableState.destroyed; - }, - set: function (value) { - // we ignore the value if the stream - // has not been initialized yet - if (!this._writableState) { - return; - } - - // backward compatibility, the user is explicitly - // managing destroyed - this._writableState.destroyed = value; - } -}); - -Writable.prototype.destroy = destroyImpl.destroy; -Writable.prototype._undestroy = destroyImpl.undestroy; -Writable.prototype._destroy = function (err, cb) { - this.end(); - cb(err); -}; -}).call(this,require('_process'),typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {},require("timers").setImmediate) -},{"./_stream_duplex":228,"./internal/streams/destroy":234,"./internal/streams/stream":235,"_process":197,"core-util-is":92,"inherits":156,"process-nextick-args":196,"safe-buffer":216,"timers":258,"util-deprecate":262}],233:[function(require,module,exports){ -'use strict'; - -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - -var Buffer = require('safe-buffer').Buffer; -var util = require('util'); - -function copyBuffer(src, target, offset) { - src.copy(target, offset); -} - -module.exports = function () { - function BufferList() { - _classCallCheck(this, BufferList); - - this.head = null; - this.tail = null; - this.length = 0; - } - - BufferList.prototype.push = function push(v) { - var entry = { data: v, next: null }; - if (this.length > 0) this.tail.next = entry;else this.head = entry; - this.tail = entry; - ++this.length; - }; - - BufferList.prototype.unshift = function unshift(v) { - var entry = { data: v, next: this.head }; - if (this.length === 0) this.tail = entry; - this.head = entry; - ++this.length; - }; - - BufferList.prototype.shift = function shift() { - if (this.length === 0) return; - var ret = this.head.data; - if (this.length === 1) this.head = this.tail = null;else this.head = this.head.next; - --this.length; - return ret; - }; - - BufferList.prototype.clear = function clear() { - this.head = this.tail = null; - this.length = 0; - }; - - BufferList.prototype.join = function join(s) { - if (this.length === 0) return ''; - var p = this.head; - var ret = '' + p.data; - while (p = p.next) { - ret += s + p.data; - }return ret; - }; - - BufferList.prototype.concat = function concat(n) { - if (this.length === 0) return Buffer.alloc(0); - if (this.length === 1) return this.head.data; - var ret = Buffer.allocUnsafe(n >>> 0); - var p = this.head; - var i = 0; - while (p) { - copyBuffer(p.data, ret, i); - i += p.data.length; - p = p.next; - } - return ret; - }; - - return BufferList; -}(); - -if (util && util.inspect && util.inspect.custom) { - module.exports.prototype[util.inspect.custom] = function () { - var obj = util.inspect({ length: this.length }); - return this.constructor.name + ' ' + obj; - }; -} -},{"safe-buffer":216,"util":54}],234:[function(require,module,exports){ -'use strict'; - -/**/ - -var pna = require('process-nextick-args'); -/**/ - -// undocumented cb() API, needed for core, not for public API -function destroy(err, cb) { - var _this = this; - - var readableDestroyed = this._readableState && this._readableState.destroyed; - var writableDestroyed = this._writableState && this._writableState.destroyed; - - if (readableDestroyed || writableDestroyed) { - if (cb) { - cb(err); - } else if (err && (!this._writableState || !this._writableState.errorEmitted)) { - pna.nextTick(emitErrorNT, this, err); - } - return this; - } - - // we set destroyed to true before firing error callbacks in order - // to make it re-entrance safe in case destroy() is called within callbacks - - if (this._readableState) { - this._readableState.destroyed = true; - } - - // if this is a duplex stream mark the writable part as destroyed as well - if (this._writableState) { - this._writableState.destroyed = true; - } - - this._destroy(err || null, function (err) { - if (!cb && err) { - pna.nextTick(emitErrorNT, _this, err); - if (_this._writableState) { - _this._writableState.errorEmitted = true; - } - } else if (cb) { - cb(err); - } - }); - - return this; -} - -function undestroy() { - if (this._readableState) { - this._readableState.destroyed = false; - this._readableState.reading = false; - this._readableState.ended = false; - this._readableState.endEmitted = false; - } - - if (this._writableState) { - this._writableState.destroyed = false; - this._writableState.ended = false; - this._writableState.ending = false; - this._writableState.finished = false; - this._writableState.errorEmitted = false; - } -} - -function emitErrorNT(self, err) { - self.emit('error', err); -} - -module.exports = { - destroy: destroy, - undestroy: undestroy -}; -},{"process-nextick-args":196}],235:[function(require,module,exports){ -module.exports = require('events').EventEmitter; - -},{"events":130}],236:[function(require,module,exports){ -module.exports = require('./readable').PassThrough - -},{"./readable":237}],237:[function(require,module,exports){ -exports = module.exports = require('./lib/_stream_readable.js'); -exports.Stream = exports; -exports.Readable = exports; -exports.Writable = require('./lib/_stream_writable.js'); -exports.Duplex = require('./lib/_stream_duplex.js'); -exports.Transform = require('./lib/_stream_transform.js'); -exports.PassThrough = require('./lib/_stream_passthrough.js'); - -},{"./lib/_stream_duplex.js":228,"./lib/_stream_passthrough.js":229,"./lib/_stream_readable.js":230,"./lib/_stream_transform.js":231,"./lib/_stream_writable.js":232}],238:[function(require,module,exports){ -module.exports = require('./readable').Transform - -},{"./readable":237}],239:[function(require,module,exports){ -module.exports = require('./lib/_stream_writable.js'); - -},{"./lib/_stream_writable.js":232}],240:[function(require,module,exports){ -arguments[4][83][0].apply(exports,arguments) -},{"dup":83,"safe-buffer":216}],241:[function(require,module,exports){ -(function (global){ -var ClientRequest = require('./lib/request') -var response = require('./lib/response') -var extend = require('xtend') -var statusCodes = require('builtin-status-codes') -var url = require('url') - -var http = exports - -http.request = function (opts, cb) { - if (typeof opts === 'string') - opts = url.parse(opts) - else - opts = extend(opts) - - // Normally, the page is loaded from http or https, so not specifying a protocol - // will result in a (valid) protocol-relative url. However, this won't work if - // the protocol is something else, like 'file:' - var defaultProtocol = global.location.protocol.search(/^https?:$/) === -1 ? 'http:' : '' - - var protocol = opts.protocol || defaultProtocol - var host = opts.hostname || opts.host - var port = opts.port - var path = opts.path || '/' - - // Necessary for IPv6 addresses - if (host && host.indexOf(':') !== -1) - host = '[' + host + ']' - - // This may be a relative url. The browser should always be able to interpret it correctly. - opts.url = (host ? (protocol + '//' + host) : '') + (port ? ':' + port : '') + path - opts.method = (opts.method || 'GET').toUpperCase() - opts.headers = opts.headers || {} - - // Also valid opts.auth, opts.mode - - var req = new ClientRequest(opts) - if (cb) - req.on('response', cb) - return req -} - -http.get = function get (opts, cb) { - var req = http.request(opts, cb) - req.end() - return req -} - -http.ClientRequest = ClientRequest -http.IncomingMessage = response.IncomingMessage - -http.Agent = function () {} -http.Agent.defaultMaxSockets = 4 - -http.globalAgent = new http.Agent() - -http.STATUS_CODES = statusCodes - -http.METHODS = [ - 'CHECKOUT', - 'CONNECT', - 'COPY', - 'DELETE', - 'GET', - 'HEAD', - 'LOCK', - 'M-SEARCH', - 'MERGE', - 'MKACTIVITY', - 'MKCOL', - 'MOVE', - 'NOTIFY', - 'OPTIONS', - 'PATCH', - 'POST', - 'PROPFIND', - 'PROPPATCH', - 'PURGE', - 'PUT', - 'REPORT', - 'SEARCH', - 'SUBSCRIBE', - 'TRACE', - 'UNLOCK', - 'UNSUBSCRIBE' -] -}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) -},{"./lib/request":243,"./lib/response":244,"builtin-status-codes":90,"url":260,"xtend":276}],242:[function(require,module,exports){ -(function (global){ -exports.fetch = isFunction(global.fetch) && isFunction(global.ReadableStream) - -exports.writableStream = isFunction(global.WritableStream) - -exports.abortController = isFunction(global.AbortController) - -exports.blobConstructor = false -try { - new Blob([new ArrayBuffer(1)]) - exports.blobConstructor = true -} catch (e) {} - -// The xhr request to example.com may violate some restrictive CSP configurations, -// so if we're running in a browser that supports `fetch`, avoid calling getXHR() -// and assume support for certain features below. -var xhr -function getXHR () { - // Cache the xhr value - if (xhr !== undefined) return xhr - - if (global.XMLHttpRequest) { - xhr = new global.XMLHttpRequest() - // If XDomainRequest is available (ie only, where xhr might not work - // cross domain), use the page location. Otherwise use example.com - // Note: this doesn't actually make an http request. - try { - xhr.open('GET', global.XDomainRequest ? '/' : 'https://example.com') - } catch(e) { - xhr = null - } - } else { - // Service workers don't have XHR - xhr = null - } - return xhr -} - -function checkTypeSupport (type) { - var xhr = getXHR() - if (!xhr) return false - try { - xhr.responseType = type - return xhr.responseType === type - } catch (e) {} - return false -} - -// For some strange reason, Safari 7.0 reports typeof global.ArrayBuffer === 'object'. -// Safari 7.1 appears to have fixed this bug. -var haveArrayBuffer = typeof global.ArrayBuffer !== 'undefined' -var haveSlice = haveArrayBuffer && isFunction(global.ArrayBuffer.prototype.slice) - -// If fetch is supported, then arraybuffer will be supported too. Skip calling -// checkTypeSupport(), since that calls getXHR(). -exports.arraybuffer = exports.fetch || (haveArrayBuffer && checkTypeSupport('arraybuffer')) - -// These next two tests unavoidably show warnings in Chrome. Since fetch will always -// be used if it's available, just return false for these to avoid the warnings. -exports.msstream = !exports.fetch && haveSlice && checkTypeSupport('ms-stream') -exports.mozchunkedarraybuffer = !exports.fetch && haveArrayBuffer && - checkTypeSupport('moz-chunked-arraybuffer') - -// If fetch is supported, then overrideMimeType will be supported too. Skip calling -// getXHR(). -exports.overrideMimeType = exports.fetch || (getXHR() ? isFunction(getXHR().overrideMimeType) : false) - -exports.vbArray = isFunction(global.VBArray) - -function isFunction (value) { - return typeof value === 'function' -} - -xhr = null // Help gc - -}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) -},{}],243:[function(require,module,exports){ -(function (process,global,Buffer){ -var capability = require('./capability') -var inherits = require('inherits') -var response = require('./response') -var stream = require('readable-stream') -var toArrayBuffer = require('to-arraybuffer') - -var IncomingMessage = response.IncomingMessage -var rStates = response.readyStates - -function decideMode (preferBinary, useFetch) { - if (capability.fetch && useFetch) { - return 'fetch' - } else if (capability.mozchunkedarraybuffer) { - return 'moz-chunked-arraybuffer' - } else if (capability.msstream) { - return 'ms-stream' - } else if (capability.arraybuffer && preferBinary) { - return 'arraybuffer' - } else if (capability.vbArray && preferBinary) { - return 'text:vbarray' - } else { - return 'text' - } -} - -var ClientRequest = module.exports = function (opts) { - var self = this - stream.Writable.call(self) - - self._opts = opts - self._body = [] - self._headers = {} - if (opts.auth) - self.setHeader('Authorization', 'Basic ' + new Buffer(opts.auth).toString('base64')) - Object.keys(opts.headers).forEach(function (name) { - self.setHeader(name, opts.headers[name]) - }) - - var preferBinary - var useFetch = true - if (opts.mode === 'disable-fetch' || ('requestTimeout' in opts && !capability.abortController)) { - // If the use of XHR should be preferred. Not typically needed. - useFetch = false - preferBinary = true - } else if (opts.mode === 'prefer-streaming') { - // If streaming is a high priority but binary compatibility and - // the accuracy of the 'content-type' header aren't - preferBinary = false - } else if (opts.mode === 'allow-wrong-content-type') { - // If streaming is more important than preserving the 'content-type' header - preferBinary = !capability.overrideMimeType - } else if (!opts.mode || opts.mode === 'default' || opts.mode === 'prefer-fast') { - // Use binary if text streaming may corrupt data or the content-type header, or for speed - preferBinary = true - } else { - throw new Error('Invalid value for opts.mode') - } - self._mode = decideMode(preferBinary, useFetch) - self._fetchTimer = null - - self.on('finish', function () { - self._onFinish() - }) -} - -inherits(ClientRequest, stream.Writable) - -ClientRequest.prototype.setHeader = function (name, value) { - var self = this - var lowerName = name.toLowerCase() - // This check is not necessary, but it prevents warnings from browsers about setting unsafe - // headers. To be honest I'm not entirely sure hiding these warnings is a good thing, but - // http-browserify did it, so I will too. - if (unsafeHeaders.indexOf(lowerName) !== -1) - return - - self._headers[lowerName] = { - name: name, - value: value - } -} - -ClientRequest.prototype.getHeader = function (name) { - var header = this._headers[name.toLowerCase()] - if (header) - return header.value - return null -} - -ClientRequest.prototype.removeHeader = function (name) { - var self = this - delete self._headers[name.toLowerCase()] -} - -ClientRequest.prototype._onFinish = function () { - var self = this - - if (self._destroyed) - return - var opts = self._opts - - var headersObj = self._headers - var body = null - if (opts.method !== 'GET' && opts.method !== 'HEAD') { - if (capability.arraybuffer) { - body = toArrayBuffer(Buffer.concat(self._body)) - } else if (capability.blobConstructor) { - body = new global.Blob(self._body.map(function (buffer) { - return toArrayBuffer(buffer) - }), { - type: (headersObj['content-type'] || {}).value || '' - }) - } else { - // get utf8 string - body = Buffer.concat(self._body).toString() - } - } - - // create flattened list of headers - var headersList = [] - Object.keys(headersObj).forEach(function (keyName) { - var name = headersObj[keyName].name - var value = headersObj[keyName].value - if (Array.isArray(value)) { - value.forEach(function (v) { - headersList.push([name, v]) - }) - } else { - headersList.push([name, value]) - } - }) - - if (self._mode === 'fetch') { - var signal = null - var fetchTimer = null - if (capability.abortController) { - var controller = new AbortController() - signal = controller.signal - self._fetchAbortController = controller - - if ('requestTimeout' in opts && opts.requestTimeout !== 0) { - self._fetchTimer = global.setTimeout(function () { - self.emit('requestTimeout') - if (self._fetchAbortController) - self._fetchAbortController.abort() - }, opts.requestTimeout) - } - } - - global.fetch(self._opts.url, { - method: self._opts.method, - headers: headersList, - body: body || undefined, - mode: 'cors', - credentials: opts.withCredentials ? 'include' : 'same-origin', - signal: signal - }).then(function (response) { - self._fetchResponse = response - self._connect() - }, function (reason) { - global.clearTimeout(self._fetchTimer) - if (!self._destroyed) - self.emit('error', reason) - }) - } else { - var xhr = self._xhr = new global.XMLHttpRequest() - try { - xhr.open(self._opts.method, self._opts.url, true) - } catch (err) { - process.nextTick(function () { - self.emit('error', err) - }) - return - } - - // Can't set responseType on really old browsers - if ('responseType' in xhr) - xhr.responseType = self._mode.split(':')[0] - - if ('withCredentials' in xhr) - xhr.withCredentials = !!opts.withCredentials - - if (self._mode === 'text' && 'overrideMimeType' in xhr) - xhr.overrideMimeType('text/plain; charset=x-user-defined') - - if ('requestTimeout' in opts) { - xhr.timeout = opts.requestTimeout - xhr.ontimeout = function () { - self.emit('requestTimeout') - } - } - - headersList.forEach(function (header) { - xhr.setRequestHeader(header[0], header[1]) - }) - - self._response = null - xhr.onreadystatechange = function () { - switch (xhr.readyState) { - case rStates.LOADING: - case rStates.DONE: - self._onXHRProgress() - break - } - } - // Necessary for streaming in Firefox, since xhr.response is ONLY defined - // in onprogress, not in onreadystatechange with xhr.readyState = 3 - if (self._mode === 'moz-chunked-arraybuffer') { - xhr.onprogress = function () { - self._onXHRProgress() - } - } - - xhr.onerror = function () { - if (self._destroyed) - return - self.emit('error', new Error('XHR error')) - } - - try { - xhr.send(body) - } catch (err) { - process.nextTick(function () { - self.emit('error', err) - }) - return - } - } -} - -/** - * Checks if xhr.status is readable and non-zero, indicating no error. - * Even though the spec says it should be available in readyState 3, - * accessing it throws an exception in IE8 - */ -function statusValid (xhr) { - try { - var status = xhr.status - return (status !== null && status !== 0) - } catch (e) { - return false - } -} - -ClientRequest.prototype._onXHRProgress = function () { - var self = this - - if (!statusValid(self._xhr) || self._destroyed) - return - - if (!self._response) - self._connect() - - self._response._onXHRProgress() -} - -ClientRequest.prototype._connect = function () { - var self = this - - if (self._destroyed) - return - - self._response = new IncomingMessage(self._xhr, self._fetchResponse, self._mode, self._fetchTimer) - self._response.on('error', function(err) { - self.emit('error', err) - }) - - self.emit('response', self._response) -} - -ClientRequest.prototype._write = function (chunk, encoding, cb) { - var self = this - - self._body.push(chunk) - cb() -} - -ClientRequest.prototype.abort = ClientRequest.prototype.destroy = function () { - var self = this - self._destroyed = true - global.clearTimeout(self._fetchTimer) - if (self._response) - self._response._destroyed = true - if (self._xhr) - self._xhr.abort() - else if (self._fetchAbortController) - self._fetchAbortController.abort() -} - -ClientRequest.prototype.end = function (data, encoding, cb) { - var self = this - if (typeof data === 'function') { - cb = data - data = undefined - } - - stream.Writable.prototype.end.call(self, data, encoding, cb) -} - -ClientRequest.prototype.flushHeaders = function () {} -ClientRequest.prototype.setTimeout = function () {} -ClientRequest.prototype.setNoDelay = function () {} -ClientRequest.prototype.setSocketKeepAlive = function () {} - -// Taken from http://www.w3.org/TR/XMLHttpRequest/#the-setrequestheader%28%29-method -var unsafeHeaders = [ - 'accept-charset', - 'accept-encoding', - 'access-control-request-headers', - 'access-control-request-method', - 'connection', - 'content-length', - 'cookie', - 'cookie2', - 'date', - 'dnt', - 'expect', - 'host', - 'keep-alive', - 'origin', - 'referer', - 'te', - 'trailer', - 'transfer-encoding', - 'upgrade', - 'via' -] - -}).call(this,require('_process'),typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {},require("buffer").Buffer) -},{"./capability":242,"./response":244,"_process":197,"buffer":89,"inherits":156,"readable-stream":254,"to-arraybuffer":259}],244:[function(require,module,exports){ -(function (process,global,Buffer){ -var capability = require('./capability') -var inherits = require('inherits') -var stream = require('readable-stream') - -var rStates = exports.readyStates = { - UNSENT: 0, - OPENED: 1, - HEADERS_RECEIVED: 2, - LOADING: 3, - DONE: 4 -} - -var IncomingMessage = exports.IncomingMessage = function (xhr, response, mode, fetchTimer) { - var self = this - stream.Readable.call(self) - - self._mode = mode - self.headers = {} - self.rawHeaders = [] - self.trailers = {} - self.rawTrailers = [] - - // Fake the 'close' event, but only once 'end' fires - self.on('end', function () { - // The nextTick is necessary to prevent the 'request' module from causing an infinite loop - process.nextTick(function () { - self.emit('close') - }) - }) - - if (mode === 'fetch') { - self._fetchResponse = response - - self.url = response.url - self.statusCode = response.status - self.statusMessage = response.statusText - - response.headers.forEach(function (header, key){ - self.headers[key.toLowerCase()] = header - self.rawHeaders.push(key, header) - }) - - if (capability.writableStream) { - var writable = new WritableStream({ - write: function (chunk) { - return new Promise(function (resolve, reject) { - if (self._destroyed) { - reject() - } else if(self.push(new Buffer(chunk))) { - resolve() - } else { - self._resumeFetch = resolve - } - }) - }, - close: function () { - global.clearTimeout(fetchTimer) - if (!self._destroyed) - self.push(null) - }, - abort: function (err) { - if (!self._destroyed) - self.emit('error', err) - } - }) - - try { - response.body.pipeTo(writable).catch(function (err) { - global.clearTimeout(fetchTimer) - if (!self._destroyed) - self.emit('error', err) - }) - return - } catch (e) {} // pipeTo method isn't defined. Can't find a better way to feature test this - } - // fallback for when writableStream or pipeTo aren't available - var reader = response.body.getReader() - function read () { - reader.read().then(function (result) { - if (self._destroyed) - return - if (result.done) { - global.clearTimeout(fetchTimer) - self.push(null) - return - } - self.push(new Buffer(result.value)) - read() - }).catch(function (err) { - global.clearTimeout(fetchTimer) - if (!self._destroyed) - self.emit('error', err) - }) - } - read() - } else { - self._xhr = xhr - self._pos = 0 - - self.url = xhr.responseURL - self.statusCode = xhr.status - self.statusMessage = xhr.statusText - var headers = xhr.getAllResponseHeaders().split(/\r?\n/) - headers.forEach(function (header) { - var matches = header.match(/^([^:]+):\s*(.*)/) - if (matches) { - var key = matches[1].toLowerCase() - if (key === 'set-cookie') { - if (self.headers[key] === undefined) { - self.headers[key] = [] - } - self.headers[key].push(matches[2]) - } else if (self.headers[key] !== undefined) { - self.headers[key] += ', ' + matches[2] - } else { - self.headers[key] = matches[2] - } - self.rawHeaders.push(matches[1], matches[2]) - } - }) - - self._charset = 'x-user-defined' - if (!capability.overrideMimeType) { - var mimeType = self.rawHeaders['mime-type'] - if (mimeType) { - var charsetMatch = mimeType.match(/;\s*charset=([^;])(;|$)/) - if (charsetMatch) { - self._charset = charsetMatch[1].toLowerCase() - } - } - if (!self._charset) - self._charset = 'utf-8' // best guess - } - } -} - -inherits(IncomingMessage, stream.Readable) - -IncomingMessage.prototype._read = function () { - var self = this - - var resolve = self._resumeFetch - if (resolve) { - self._resumeFetch = null - resolve() - } -} - -IncomingMessage.prototype._onXHRProgress = function () { - var self = this - - var xhr = self._xhr - - var response = null - switch (self._mode) { - case 'text:vbarray': // For IE9 - if (xhr.readyState !== rStates.DONE) - break - try { - // This fails in IE8 - response = new global.VBArray(xhr.responseBody).toArray() - } catch (e) {} - if (response !== null) { - self.push(new Buffer(response)) - break - } - // Falls through in IE8 - case 'text': - try { // This will fail when readyState = 3 in IE9. Switch mode and wait for readyState = 4 - response = xhr.responseText - } catch (e) { - self._mode = 'text:vbarray' - break - } - if (response.length > self._pos) { - var newData = response.substr(self._pos) - if (self._charset === 'x-user-defined') { - var buffer = new Buffer(newData.length) - for (var i = 0; i < newData.length; i++) - buffer[i] = newData.charCodeAt(i) & 0xff - - self.push(buffer) - } else { - self.push(newData, self._charset) - } - self._pos = response.length - } - break - case 'arraybuffer': - if (xhr.readyState !== rStates.DONE || !xhr.response) - break - response = xhr.response - self.push(new Buffer(new Uint8Array(response))) - break - case 'moz-chunked-arraybuffer': // take whole - response = xhr.response - if (xhr.readyState !== rStates.LOADING || !response) - break - self.push(new Buffer(new Uint8Array(response))) - break - case 'ms-stream': - response = xhr.response - if (xhr.readyState !== rStates.LOADING) - break - var reader = new global.MSStreamReader() - reader.onprogress = function () { - if (reader.result.byteLength > self._pos) { - self.push(new Buffer(new Uint8Array(reader.result.slice(self._pos)))) - self._pos = reader.result.byteLength - } - } - reader.onload = function () { - self.push(null) - } - // reader.onerror = ??? // TODO: this - reader.readAsArrayBuffer(response) - break - } - - // The ms-stream case handles end separately in reader.onload() - if (self._xhr.readyState === rStates.DONE && self._mode !== 'ms-stream') { - self.push(null) - } -} - -}).call(this,require('_process'),typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {},require("buffer").Buffer) -},{"./capability":242,"_process":197,"buffer":89,"inherits":156,"readable-stream":254}],245:[function(require,module,exports){ -arguments[4][226][0].apply(exports,arguments) -},{"dup":226}],246:[function(require,module,exports){ -arguments[4][228][0].apply(exports,arguments) -},{"./_stream_readable":248,"./_stream_writable":250,"core-util-is":92,"dup":228,"inherits":156,"process-nextick-args":196}],247:[function(require,module,exports){ -arguments[4][229][0].apply(exports,arguments) -},{"./_stream_transform":249,"core-util-is":92,"dup":229,"inherits":156}],248:[function(require,module,exports){ -arguments[4][230][0].apply(exports,arguments) -},{"./_stream_duplex":246,"./internal/streams/BufferList":251,"./internal/streams/destroy":252,"./internal/streams/stream":253,"_process":197,"core-util-is":92,"dup":230,"events":130,"inherits":156,"isarray":245,"process-nextick-args":196,"safe-buffer":216,"string_decoder/":255,"util":54}],249:[function(require,module,exports){ -arguments[4][231][0].apply(exports,arguments) -},{"./_stream_duplex":246,"core-util-is":92,"dup":231,"inherits":156}],250:[function(require,module,exports){ -arguments[4][232][0].apply(exports,arguments) -},{"./_stream_duplex":246,"./internal/streams/destroy":252,"./internal/streams/stream":253,"_process":197,"core-util-is":92,"dup":232,"inherits":156,"process-nextick-args":196,"safe-buffer":216,"timers":258,"util-deprecate":262}],251:[function(require,module,exports){ -arguments[4][233][0].apply(exports,arguments) -},{"dup":233,"safe-buffer":216,"util":54}],252:[function(require,module,exports){ -arguments[4][234][0].apply(exports,arguments) -},{"dup":234,"process-nextick-args":196}],253:[function(require,module,exports){ -arguments[4][235][0].apply(exports,arguments) -},{"dup":235,"events":130}],254:[function(require,module,exports){ -arguments[4][237][0].apply(exports,arguments) -},{"./lib/_stream_duplex.js":246,"./lib/_stream_passthrough.js":247,"./lib/_stream_readable.js":248,"./lib/_stream_transform.js":249,"./lib/_stream_writable.js":250,"dup":237}],255:[function(require,module,exports){ -arguments[4][83][0].apply(exports,arguments) -},{"dup":83,"safe-buffer":216}],256:[function(require,module,exports){ -(function (process,Buffer){ - -/** - * Module dependencies. - */ - -var assert = require('assert'); -var debug = require('debug')('stream-parser'); - -/** - * Module exports. - */ - -module.exports = Parser; - -/** - * Parser states. - */ - -var INIT = -1; -var BUFFERING = 0; -var SKIPPING = 1; -var PASSTHROUGH = 2; - -/** - * The `Parser` stream mixin works with either `Writable` or `Transform` stream - * instances/subclasses. Provides a convenient generic "parsing" API: - * - * _bytes(n, cb) - buffers "n" bytes and then calls "cb" with the "chunk" - * _skipBytes(n, cb) - skips "n" bytes and then calls "cb" when done - * - * If you extend a `Transform` stream, then the `_passthrough()` function is also - * added: - * - * _passthrough(n, cb) - passes through "n" bytes untouched and then calls "cb" - * - * @param {Stream} stream Transform or Writable stream instance to extend - * @api public - */ - -function Parser (stream) { - var isTransform = stream && 'function' == typeof stream._transform; - var isWritable = stream && 'function' == typeof stream._write; - - if (!isTransform && !isWritable) throw new Error('must pass a Writable or Transform stream in'); - debug('extending Parser into stream'); - - // Transform streams and Writable streams get `_bytes()` and `_skipBytes()` - stream._bytes = _bytes; - stream._skipBytes = _skipBytes; - - // only Transform streams get the `_passthrough()` function - if (isTransform) stream._passthrough = _passthrough; - - // take control of the streams2 callback functions for this stream - if (isTransform) { - stream._transform = transform; - } else { - stream._write = write; - } -} - -function init (stream) { - debug('initializing parser stream'); - - // number of bytes left to parser for the next "chunk" - stream._parserBytesLeft = 0; - - // array of Buffer instances that make up the next "chunk" - stream._parserBuffers = []; - - // number of bytes parsed so far for the next "chunk" - stream._parserBuffered = 0; - - // flag that keeps track of if what the parser should do with bytes received - stream._parserState = INIT; - - // the callback for the next "chunk" - stream._parserCallback = null; - - // XXX: backwards compat with the old Transform API... remove at some point.. - if ('function' == typeof stream.push) { - stream._parserOutput = stream.push.bind(stream); - } - - stream._parserInit = true; -} - -/** - * Buffers `n` bytes and then invokes `fn` once that amount has been collected. - * - * @param {Number} n the number of bytes to buffer - * @param {Function} fn callback function to invoke when `n` bytes are buffered - * @api public - */ - -function _bytes (n, fn) { - assert(!this._parserCallback, 'there is already a "callback" set!'); - assert(isFinite(n) && n > 0, 'can only buffer a finite number of bytes > 0, got "' + n + '"'); - if (!this._parserInit) init(this); - debug('buffering %o bytes', n); - this._parserBytesLeft = n; - this._parserCallback = fn; - this._parserState = BUFFERING; -} - -/** - * Skips over the next `n` bytes, then invokes `fn` once that amount has - * been discarded. - * - * @param {Number} n the number of bytes to discard - * @param {Function} fn callback function to invoke when `n` bytes have been skipped - * @api public - */ - -function _skipBytes (n, fn) { - assert(!this._parserCallback, 'there is already a "callback" set!'); - assert(n > 0, 'can only skip > 0 bytes, got "' + n + '"'); - if (!this._parserInit) init(this); - debug('skipping %o bytes', n); - this._parserBytesLeft = n; - this._parserCallback = fn; - this._parserState = SKIPPING; -} - -/** - * Passes through `n` bytes to the readable side of this stream untouched, - * then invokes `fn` once that amount has been passed through. - * - * @param {Number} n the number of bytes to pass through - * @param {Function} fn callback function to invoke when `n` bytes have passed through - * @api public - */ - -function _passthrough (n, fn) { - assert(!this._parserCallback, 'There is already a "callback" set!'); - assert(n > 0, 'can only pass through > 0 bytes, got "' + n + '"'); - if (!this._parserInit) init(this); - debug('passing through %o bytes', n); - this._parserBytesLeft = n; - this._parserCallback = fn; - this._parserState = PASSTHROUGH; -} - -/** - * The `_write()` callback function implementation. - * - * @api private - */ - -function write (chunk, encoding, fn) { - if (!this._parserInit) init(this); - debug('write(%o bytes)', chunk.length); - - // XXX: old Writable stream API compat... remove at some point... - if ('function' == typeof encoding) fn = encoding; - - data(this, chunk, null, fn); -} - -/** - * The `_transform()` callback function implementation. - * - * @api private - */ - - -function transform (chunk, output, fn) { - if (!this._parserInit) init(this); - debug('transform(%o bytes)', chunk.length); - - // XXX: old Transform stream API compat... remove at some point... - if ('function' != typeof output) { - output = this._parserOutput; - } - - data(this, chunk, output, fn); -} - -/** - * The internal buffering/passthrough logic... - * - * This `_data` function get's "trampolined" to prevent stack overflows for tight - * loops. This technique requires us to return a "thunk" function for any - * synchronous action. Async stuff breaks the trampoline, but that's ok since it's - * working with a new stack at that point anyway. - * - * @api private - */ - -function _data (stream, chunk, output, fn) { - if (stream._parserBytesLeft <= 0) { - return fn(new Error('got data but not currently parsing anything')); - } - - if (chunk.length <= stream._parserBytesLeft) { - // small buffer fits within the "_parserBytesLeft" window - return function () { - return process(stream, chunk, output, fn); - }; - } else { - // large buffer needs to be sliced on "_parserBytesLeft" and processed - return function () { - var b = chunk.slice(0, stream._parserBytesLeft); - return process(stream, b, output, function (err) { - if (err) return fn(err); - if (chunk.length > b.length) { - return function () { - return _data(stream, chunk.slice(b.length), output, fn); - }; - } - }); - }; - } -} - -/** - * The internal `process` function gets called by the `data` function when - * something "interesting" happens. This function takes care of buffering the - * bytes when buffering, passing through the bytes when doing that, and invoking - * the user callback when the number of bytes has been reached. - * - * @api private - */ - -function process (stream, chunk, output, fn) { - stream._parserBytesLeft -= chunk.length; - debug('%o bytes left for stream piece', stream._parserBytesLeft); - - if (stream._parserState === BUFFERING) { - // buffer - stream._parserBuffers.push(chunk); - stream._parserBuffered += chunk.length; - } else if (stream._parserState === PASSTHROUGH) { - // passthrough - output(chunk); - } - // don't need to do anything for the SKIPPING case - - if (0 === stream._parserBytesLeft) { - // done with stream "piece", invoke the callback - var cb = stream._parserCallback; - if (cb && stream._parserState === BUFFERING && stream._parserBuffers.length > 1) { - chunk = Buffer.concat(stream._parserBuffers, stream._parserBuffered); - } - if (stream._parserState !== BUFFERING) { - chunk = null; - } - stream._parserCallback = null; - stream._parserBuffered = 0; - stream._parserState = INIT; - stream._parserBuffers.splice(0); // empty - - if (cb) { - var args = []; - if (chunk) { - // buffered - args.push(chunk); - } else { - // passthrough - } - if (output) { - // on a Transform stream, has "output" function - args.push(output); - } - var async = cb.length > args.length; - if (async) { - args.push(trampoline(fn)); - } - // invoke cb - var rtn = cb.apply(stream, args); - if (!async || fn === rtn) return fn; - } - } else { - // need more bytes - return fn; - } -} - -var data = trampoline(_data); - -/** - * Generic thunk-based "trampoline" helper function. - * - * @param {Function} input function - * @return {Function} "trampolined" function - * @api private - */ - -function trampoline (fn) { - return function () { - var result = fn.apply(this, arguments); - - while ('function' == typeof result) { - result = result(); - } - - return result; - }; -} - -}).call(this,require('_process'),require("buffer").Buffer) -},{"_process":197,"assert":17,"buffer":89,"debug":99}],257:[function(require,module,exports){ -// Copyright Joyent, Inc. and other Node contributors. -// -// Permission is hereby granted, free of charge, to any person obtaining a -// copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to permit -// persons to whom the Software is furnished to do so, subject to the -// following conditions: -// -// The above copyright notice and this permission notice shall be included -// in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN -// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR -// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE -// USE OR OTHER DEALINGS IN THE SOFTWARE. - -var Buffer = require('buffer').Buffer; - -var isBufferEncoding = Buffer.isEncoding - || function(encoding) { - switch (encoding && encoding.toLowerCase()) { - case 'hex': case 'utf8': case 'utf-8': case 'ascii': case 'binary': case 'base64': case 'ucs2': case 'ucs-2': case 'utf16le': case 'utf-16le': case 'raw': return true; - default: return false; - } - } - - -function assertEncoding(encoding) { - if (encoding && !isBufferEncoding(encoding)) { - throw new Error('Unknown encoding: ' + encoding); - } -} - -// StringDecoder provides an interface for efficiently splitting a series of -// buffers into a series of JS strings without breaking apart multi-byte -// characters. CESU-8 is handled as part of the UTF-8 encoding. -// -// @TODO Handling all encodings inside a single object makes it very difficult -// to reason about this code, so it should be split up in the future. -// @TODO There should be a utf8-strict encoding that rejects invalid UTF-8 code -// points as used by CESU-8. -var StringDecoder = exports.StringDecoder = function(encoding) { - this.encoding = (encoding || 'utf8').toLowerCase().replace(/[-_]/, ''); - assertEncoding(encoding); - switch (this.encoding) { - case 'utf8': - // CESU-8 represents each of Surrogate Pair by 3-bytes - this.surrogateSize = 3; - break; - case 'ucs2': - case 'utf16le': - // UTF-16 represents each of Surrogate Pair by 2-bytes - this.surrogateSize = 2; - this.detectIncompleteChar = utf16DetectIncompleteChar; - break; - case 'base64': - // Base-64 stores 3 bytes in 4 chars, and pads the remainder. - this.surrogateSize = 3; - this.detectIncompleteChar = base64DetectIncompleteChar; - break; - default: - this.write = passThroughWrite; - return; - } - - // Enough space to store all bytes of a single character. UTF-8 needs 4 - // bytes, but CESU-8 may require up to 6 (3 bytes per surrogate). - this.charBuffer = new Buffer(6); - // Number of bytes received for the current incomplete multi-byte character. - this.charReceived = 0; - // Number of bytes expected for the current incomplete multi-byte character. - this.charLength = 0; -}; - - -// write decodes the given buffer and returns it as JS string that is -// guaranteed to not contain any partial multi-byte characters. Any partial -// character found at the end of the buffer is buffered up, and will be -// returned when calling write again with the remaining bytes. -// -// Note: Converting a Buffer containing an orphan surrogate to a String -// currently works, but converting a String to a Buffer (via `new Buffer`, or -// Buffer#write) will replace incomplete surrogates with the unicode -// replacement character. See https://codereview.chromium.org/121173009/ . -StringDecoder.prototype.write = function(buffer) { - var charStr = ''; - // if our last write ended with an incomplete multibyte character - while (this.charLength) { - // determine how many remaining bytes this buffer has to offer for this char - var available = (buffer.length >= this.charLength - this.charReceived) ? - this.charLength - this.charReceived : - buffer.length; - - // add the new bytes to the char buffer - buffer.copy(this.charBuffer, this.charReceived, 0, available); - this.charReceived += available; - - if (this.charReceived < this.charLength) { - // still not enough chars in this buffer? wait for more ... - return ''; - } - - // remove bytes belonging to the current character from the buffer - buffer = buffer.slice(available, buffer.length); - - // get the character that was split - charStr = this.charBuffer.slice(0, this.charLength).toString(this.encoding); - - // CESU-8: lead surrogate (D800-DBFF) is also the incomplete character - var charCode = charStr.charCodeAt(charStr.length - 1); - if (charCode >= 0xD800 && charCode <= 0xDBFF) { - this.charLength += this.surrogateSize; - charStr = ''; - continue; - } - this.charReceived = this.charLength = 0; - - // if there are no more bytes in this buffer, just emit our char - if (buffer.length === 0) { - return charStr; - } - break; - } - - // determine and set charLength / charReceived - this.detectIncompleteChar(buffer); - - var end = buffer.length; - if (this.charLength) { - // buffer the incomplete character bytes we got - buffer.copy(this.charBuffer, 0, buffer.length - this.charReceived, end); - end -= this.charReceived; - } - - charStr += buffer.toString(this.encoding, 0, end); - - var end = charStr.length - 1; - var charCode = charStr.charCodeAt(end); - // CESU-8: lead surrogate (D800-DBFF) is also the incomplete character - if (charCode >= 0xD800 && charCode <= 0xDBFF) { - var size = this.surrogateSize; - this.charLength += size; - this.charReceived += size; - this.charBuffer.copy(this.charBuffer, size, 0, size); - buffer.copy(this.charBuffer, 0, 0, size); - return charStr.substring(0, end); - } - - // or just emit the charStr - return charStr; -}; - -// detectIncompleteChar determines if there is an incomplete UTF-8 character at -// the end of the given buffer. If so, it sets this.charLength to the byte -// length that character, and sets this.charReceived to the number of bytes -// that are available for this character. -StringDecoder.prototype.detectIncompleteChar = function(buffer) { - // determine how many bytes we have to check at the end of this buffer - var i = (buffer.length >= 3) ? 3 : buffer.length; - - // Figure out if one of the last i bytes of our buffer announces an - // incomplete char. - for (; i > 0; i--) { - var c = buffer[buffer.length - i]; - - // See http://en.wikipedia.org/wiki/UTF-8#Description - - // 110XXXXX - if (i == 1 && c >> 5 == 0x06) { - this.charLength = 2; - break; - } - - // 1110XXXX - if (i <= 2 && c >> 4 == 0x0E) { - this.charLength = 3; - break; - } - - // 11110XXX - if (i <= 3 && c >> 3 == 0x1E) { - this.charLength = 4; - break; - } - } - this.charReceived = i; -}; - -StringDecoder.prototype.end = function(buffer) { - var res = ''; - if (buffer && buffer.length) - res = this.write(buffer); - - if (this.charReceived) { - var cr = this.charReceived; - var buf = this.charBuffer; - var enc = this.encoding; - res += buf.slice(0, cr).toString(enc); - } - - return res; -}; - -function passThroughWrite(buffer) { - return buffer.toString(this.encoding); -} - -function utf16DetectIncompleteChar(buffer) { - this.charReceived = buffer.length % 2; - this.charLength = this.charReceived ? 2 : 0; -} - -function base64DetectIncompleteChar(buffer) { - this.charReceived = buffer.length % 3; - this.charLength = this.charReceived ? 3 : 0; -} - -},{"buffer":89}],258:[function(require,module,exports){ -(function (setImmediate,clearImmediate){ -var nextTick = require('process/browser.js').nextTick; -var apply = Function.prototype.apply; -var slice = Array.prototype.slice; -var immediateIds = {}; -var nextImmediateId = 0; - -// DOM APIs, for completeness - -exports.setTimeout = function() { - return new Timeout(apply.call(setTimeout, window, arguments), clearTimeout); -}; -exports.setInterval = function() { - return new Timeout(apply.call(setInterval, window, arguments), clearInterval); -}; -exports.clearTimeout = -exports.clearInterval = function(timeout) { timeout.close(); }; - -function Timeout(id, clearFn) { - this._id = id; - this._clearFn = clearFn; -} -Timeout.prototype.unref = Timeout.prototype.ref = function() {}; -Timeout.prototype.close = function() { - this._clearFn.call(window, this._id); -}; - -// Does not start the time, just sets up the members needed. -exports.enroll = function(item, msecs) { - clearTimeout(item._idleTimeoutId); - item._idleTimeout = msecs; -}; - -exports.unenroll = function(item) { - clearTimeout(item._idleTimeoutId); - item._idleTimeout = -1; -}; - -exports._unrefActive = exports.active = function(item) { - clearTimeout(item._idleTimeoutId); - - var msecs = item._idleTimeout; - if (msecs >= 0) { - item._idleTimeoutId = setTimeout(function onTimeout() { - if (item._onTimeout) - item._onTimeout(); - }, msecs); - } -}; - -// That's not how node.js implements it but the exposed api is the same. -exports.setImmediate = typeof setImmediate === "function" ? setImmediate : function(fn) { - var id = nextImmediateId++; - var args = arguments.length < 2 ? false : slice.call(arguments, 1); - - immediateIds[id] = true; - - nextTick(function onNextTick() { - if (immediateIds[id]) { - // fn.call() is faster so we optimize for the common use-case - // @see http://jsperf.com/call-apply-segu - if (args) { - fn.apply(null, args); - } else { - fn.call(null); - } - // Prevent ids from leaking - exports.clearImmediate(id); - } - }); - - return id; -}; - -exports.clearImmediate = typeof clearImmediate === "function" ? clearImmediate : function(id) { - delete immediateIds[id]; -}; -}).call(this,require("timers").setImmediate,require("timers").clearImmediate) -},{"process/browser.js":197,"timers":258}],259:[function(require,module,exports){ -var Buffer = require('buffer').Buffer - -module.exports = function (buf) { - // If the buffer is backed by a Uint8Array, a faster version will work - if (buf instanceof Uint8Array) { - // If the buffer isn't a subarray, return the underlying ArrayBuffer - if (buf.byteOffset === 0 && buf.byteLength === buf.buffer.byteLength) { - return buf.buffer - } else if (typeof buf.buffer.slice === 'function') { - // Otherwise we need to get a proper copy - return buf.buffer.slice(buf.byteOffset, buf.byteOffset + buf.byteLength) - } - } - - if (Buffer.isBuffer(buf)) { - // This is the slow version that will work with any Buffer - // implementation (even in old browsers) - var arrayCopy = new Uint8Array(buf.length) - var len = buf.length - for (var i = 0; i < len; i++) { - arrayCopy[i] = buf[i] - } - return arrayCopy.buffer - } else { - throw new Error('Argument must be a Buffer') - } -} - -},{"buffer":89}],260:[function(require,module,exports){ -// Copyright Joyent, Inc. and other Node contributors. -// -// Permission is hereby granted, free of charge, to any person obtaining a -// copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to permit -// persons to whom the Software is furnished to do so, subject to the -// following conditions: -// -// The above copyright notice and this permission notice shall be included -// in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN -// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR -// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE -// USE OR OTHER DEALINGS IN THE SOFTWARE. - -'use strict'; - -var punycode = require('punycode'); -var util = require('./util'); - -exports.parse = urlParse; -exports.resolve = urlResolve; -exports.resolveObject = urlResolveObject; -exports.format = urlFormat; - -exports.Url = Url; - -function Url() { - this.protocol = null; - this.slashes = null; - this.auth = null; - this.host = null; - this.port = null; - this.hostname = null; - this.hash = null; - this.search = null; - this.query = null; - this.pathname = null; - this.path = null; - this.href = null; -} - -// Reference: RFC 3986, RFC 1808, RFC 2396 - -// define these here so at least they only have to be -// compiled once on the first module load. -var protocolPattern = /^([a-z0-9.+-]+:)/i, - portPattern = /:[0-9]*$/, - - // Special case for a simple path URL - simplePathPattern = /^(\/\/?(?!\/)[^\?\s]*)(\?[^\s]*)?$/, - - // RFC 2396: characters reserved for delimiting URLs. - // We actually just auto-escape these. - delims = ['<', '>', '"', '`', ' ', '\r', '\n', '\t'], - - // RFC 2396: characters not allowed for various reasons. - unwise = ['{', '}', '|', '\\', '^', '`'].concat(delims), - - // Allowed by RFCs, but cause of XSS attacks. Always escape these. - autoEscape = ['\''].concat(unwise), - // Characters that are never ever allowed in a hostname. - // Note that any invalid chars are also handled, but these - // are the ones that are *expected* to be seen, so we fast-path - // them. - nonHostChars = ['%', '/', '?', ';', '#'].concat(autoEscape), - hostEndingChars = ['/', '?', '#'], - hostnameMaxLen = 255, - hostnamePartPattern = /^[+a-z0-9A-Z_-]{0,63}$/, - hostnamePartStart = /^([+a-z0-9A-Z_-]{0,63})(.*)$/, - // protocols that can allow "unsafe" and "unwise" chars. - unsafeProtocol = { - 'javascript': true, - 'javascript:': true - }, - // protocols that never have a hostname. - hostlessProtocol = { - 'javascript': true, - 'javascript:': true - }, - // protocols that always contain a // bit. - slashedProtocol = { - 'http': true, - 'https': true, - 'ftp': true, - 'gopher': true, - 'file': true, - 'http:': true, - 'https:': true, - 'ftp:': true, - 'gopher:': true, - 'file:': true - }, - querystring = require('querystring'); - -function urlParse(url, parseQueryString, slashesDenoteHost) { - if (url && util.isObject(url) && url instanceof Url) return url; - - var u = new Url; - u.parse(url, parseQueryString, slashesDenoteHost); - return u; -} - -Url.prototype.parse = function(url, parseQueryString, slashesDenoteHost) { - if (!util.isString(url)) { - throw new TypeError("Parameter 'url' must be a string, not " + typeof url); - } - - // Copy chrome, IE, opera backslash-handling behavior. - // Back slashes before the query string get converted to forward slashes - // See: https://code.google.com/p/chromium/issues/detail?id=25916 - var queryIndex = url.indexOf('?'), - splitter = - (queryIndex !== -1 && queryIndex < url.indexOf('#')) ? '?' : '#', - uSplit = url.split(splitter), - slashRegex = /\\/g; - uSplit[0] = uSplit[0].replace(slashRegex, '/'); - url = uSplit.join(splitter); - - var rest = url; - - // trim before proceeding. - // This is to support parse stuff like " http://foo.com \n" - rest = rest.trim(); - - if (!slashesDenoteHost && url.split('#').length === 1) { - // Try fast path regexp - var simplePath = simplePathPattern.exec(rest); - if (simplePath) { - this.path = rest; - this.href = rest; - this.pathname = simplePath[1]; - if (simplePath[2]) { - this.search = simplePath[2]; - if (parseQueryString) { - this.query = querystring.parse(this.search.substr(1)); - } else { - this.query = this.search.substr(1); - } - } else if (parseQueryString) { - this.search = ''; - this.query = {}; - } - return this; - } - } - - var proto = protocolPattern.exec(rest); - if (proto) { - proto = proto[0]; - var lowerProto = proto.toLowerCase(); - this.protocol = lowerProto; - rest = rest.substr(proto.length); - } - - // figure out if it's got a host - // user@server is *always* interpreted as a hostname, and url - // resolution will treat //foo/bar as host=foo,path=bar because that's - // how the browser resolves relative URLs. - if (slashesDenoteHost || proto || rest.match(/^\/\/[^@\/]+@[^@\/]+/)) { - var slashes = rest.substr(0, 2) === '//'; - if (slashes && !(proto && hostlessProtocol[proto])) { - rest = rest.substr(2); - this.slashes = true; - } - } - - if (!hostlessProtocol[proto] && - (slashes || (proto && !slashedProtocol[proto]))) { - - // there's a hostname. - // the first instance of /, ?, ;, or # ends the host. - // - // If there is an @ in the hostname, then non-host chars *are* allowed - // to the left of the last @ sign, unless some host-ending character - // comes *before* the @-sign. - // URLs are obnoxious. - // - // ex: - // http://a@b@c/ => user:a@b host:c - // http://a@b?@c => user:a host:c path:/?@c - - // v0.12 TODO(isaacs): This is not quite how Chrome does things. - // Review our test case against browsers more comprehensively. - - // find the first instance of any hostEndingChars - var hostEnd = -1; - for (var i = 0; i < hostEndingChars.length; i++) { - var hec = rest.indexOf(hostEndingChars[i]); - if (hec !== -1 && (hostEnd === -1 || hec < hostEnd)) - hostEnd = hec; - } - - // at this point, either we have an explicit point where the - // auth portion cannot go past, or the last @ char is the decider. - var auth, atSign; - if (hostEnd === -1) { - // atSign can be anywhere. - atSign = rest.lastIndexOf('@'); - } else { - // atSign must be in auth portion. - // http://a@b/c@d => host:b auth:a path:/c@d - atSign = rest.lastIndexOf('@', hostEnd); - } - - // Now we have a portion which is definitely the auth. - // Pull that off. - if (atSign !== -1) { - auth = rest.slice(0, atSign); - rest = rest.slice(atSign + 1); - this.auth = decodeURIComponent(auth); - } - - // the host is the remaining to the left of the first non-host char - hostEnd = -1; - for (var i = 0; i < nonHostChars.length; i++) { - var hec = rest.indexOf(nonHostChars[i]); - if (hec !== -1 && (hostEnd === -1 || hec < hostEnd)) - hostEnd = hec; - } - // if we still have not hit it, then the entire thing is a host. - if (hostEnd === -1) - hostEnd = rest.length; - - this.host = rest.slice(0, hostEnd); - rest = rest.slice(hostEnd); - - // pull out port. - this.parseHost(); - - // we've indicated that there is a hostname, - // so even if it's empty, it has to be present. - this.hostname = this.hostname || ''; - - // if hostname begins with [ and ends with ] - // assume that it's an IPv6 address. - var ipv6Hostname = this.hostname[0] === '[' && - this.hostname[this.hostname.length - 1] === ']'; - - // validate a little. - if (!ipv6Hostname) { - var hostparts = this.hostname.split(/\./); - for (var i = 0, l = hostparts.length; i < l; i++) { - var part = hostparts[i]; - if (!part) continue; - if (!part.match(hostnamePartPattern)) { - var newpart = ''; - for (var j = 0, k = part.length; j < k; j++) { - if (part.charCodeAt(j) > 127) { - // we replace non-ASCII char with a temporary placeholder - // we need this to make sure size of hostname is not - // broken by replacing non-ASCII by nothing - newpart += 'x'; - } else { - newpart += part[j]; - } - } - // we test again with ASCII char only - if (!newpart.match(hostnamePartPattern)) { - var validParts = hostparts.slice(0, i); - var notHost = hostparts.slice(i + 1); - var bit = part.match(hostnamePartStart); - if (bit) { - validParts.push(bit[1]); - notHost.unshift(bit[2]); - } - if (notHost.length) { - rest = '/' + notHost.join('.') + rest; - } - this.hostname = validParts.join('.'); - break; - } - } - } - } - - if (this.hostname.length > hostnameMaxLen) { - this.hostname = ''; - } else { - // hostnames are always lower case. - this.hostname = this.hostname.toLowerCase(); - } - - if (!ipv6Hostname) { - // IDNA Support: Returns a punycoded representation of "domain". - // It only converts parts of the domain name that - // have non-ASCII characters, i.e. it doesn't matter if - // you call it with a domain that already is ASCII-only. - this.hostname = punycode.toASCII(this.hostname); - } - - var p = this.port ? ':' + this.port : ''; - var h = this.hostname || ''; - this.host = h + p; - this.href += this.host; - - // strip [ and ] from the hostname - // the host field still retains them, though - if (ipv6Hostname) { - this.hostname = this.hostname.substr(1, this.hostname.length - 2); - if (rest[0] !== '/') { - rest = '/' + rest; - } - } - } - - // now rest is set to the post-host stuff. - // chop off any delim chars. - if (!unsafeProtocol[lowerProto]) { - - // First, make 100% sure that any "autoEscape" chars get - // escaped, even if encodeURIComponent doesn't think they - // need to be. - for (var i = 0, l = autoEscape.length; i < l; i++) { - var ae = autoEscape[i]; - if (rest.indexOf(ae) === -1) - continue; - var esc = encodeURIComponent(ae); - if (esc === ae) { - esc = escape(ae); - } - rest = rest.split(ae).join(esc); - } - } - - - // chop off from the tail first. - var hash = rest.indexOf('#'); - if (hash !== -1) { - // got a fragment string. - this.hash = rest.substr(hash); - rest = rest.slice(0, hash); - } - var qm = rest.indexOf('?'); - if (qm !== -1) { - this.search = rest.substr(qm); - this.query = rest.substr(qm + 1); - if (parseQueryString) { - this.query = querystring.parse(this.query); - } - rest = rest.slice(0, qm); - } else if (parseQueryString) { - // no query string, but parseQueryString still requested - this.search = ''; - this.query = {}; - } - if (rest) this.pathname = rest; - if (slashedProtocol[lowerProto] && - this.hostname && !this.pathname) { - this.pathname = '/'; - } - - //to support http.request - if (this.pathname || this.search) { - var p = this.pathname || ''; - var s = this.search || ''; - this.path = p + s; - } - - // finally, reconstruct the href based on what has been validated. - this.href = this.format(); - return this; -}; - -// format a parsed object into a url string -function urlFormat(obj) { - // ensure it's an object, and not a string url. - // If it's an obj, this is a no-op. - // this way, you can call url_format() on strings - // to clean up potentially wonky urls. - if (util.isString(obj)) obj = urlParse(obj); - if (!(obj instanceof Url)) return Url.prototype.format.call(obj); - return obj.format(); -} - -Url.prototype.format = function() { - var auth = this.auth || ''; - if (auth) { - auth = encodeURIComponent(auth); - auth = auth.replace(/%3A/i, ':'); - auth += '@'; - } - - var protocol = this.protocol || '', - pathname = this.pathname || '', - hash = this.hash || '', - host = false, - query = ''; - - if (this.host) { - host = auth + this.host; - } else if (this.hostname) { - host = auth + (this.hostname.indexOf(':') === -1 ? - this.hostname : - '[' + this.hostname + ']'); - if (this.port) { - host += ':' + this.port; - } - } - - if (this.query && - util.isObject(this.query) && - Object.keys(this.query).length) { - query = querystring.stringify(this.query); - } - - var search = this.search || (query && ('?' + query)) || ''; - - if (protocol && protocol.substr(-1) !== ':') protocol += ':'; - - // only the slashedProtocols get the //. Not mailto:, xmpp:, etc. - // unless they had them to begin with. - if (this.slashes || - (!protocol || slashedProtocol[protocol]) && host !== false) { - host = '//' + (host || ''); - if (pathname && pathname.charAt(0) !== '/') pathname = '/' + pathname; - } else if (!host) { - host = ''; - } - - if (hash && hash.charAt(0) !== '#') hash = '#' + hash; - if (search && search.charAt(0) !== '?') search = '?' + search; - - pathname = pathname.replace(/[?#]/g, function(match) { - return encodeURIComponent(match); - }); - search = search.replace('#', '%23'); - - return protocol + host + pathname + search + hash; -}; - -function urlResolve(source, relative) { - return urlParse(source, false, true).resolve(relative); -} - -Url.prototype.resolve = function(relative) { - return this.resolveObject(urlParse(relative, false, true)).format(); -}; - -function urlResolveObject(source, relative) { - if (!source) return relative; - return urlParse(source, false, true).resolveObject(relative); -} - -Url.prototype.resolveObject = function(relative) { - if (util.isString(relative)) { - var rel = new Url(); - rel.parse(relative, false, true); - relative = rel; - } - - var result = new Url(); - var tkeys = Object.keys(this); - for (var tk = 0; tk < tkeys.length; tk++) { - var tkey = tkeys[tk]; - result[tkey] = this[tkey]; - } - - // hash is always overridden, no matter what. - // even href="" will remove it. - result.hash = relative.hash; - - // if the relative url is empty, then there's nothing left to do here. - if (relative.href === '') { - result.href = result.format(); - return result; - } - - // hrefs like //foo/bar always cut to the protocol. - if (relative.slashes && !relative.protocol) { - // take everything except the protocol from relative - var rkeys = Object.keys(relative); - for (var rk = 0; rk < rkeys.length; rk++) { - var rkey = rkeys[rk]; - if (rkey !== 'protocol') - result[rkey] = relative[rkey]; - } - - //urlParse appends trailing / to urls like http://www.example.com - if (slashedProtocol[result.protocol] && - result.hostname && !result.pathname) { - result.path = result.pathname = '/'; - } - - result.href = result.format(); - return result; - } - - if (relative.protocol && relative.protocol !== result.protocol) { - // if it's a known url protocol, then changing - // the protocol does weird things - // first, if it's not file:, then we MUST have a host, - // and if there was a path - // to begin with, then we MUST have a path. - // if it is file:, then the host is dropped, - // because that's known to be hostless. - // anything else is assumed to be absolute. - if (!slashedProtocol[relative.protocol]) { - var keys = Object.keys(relative); - for (var v = 0; v < keys.length; v++) { - var k = keys[v]; - result[k] = relative[k]; - } - result.href = result.format(); - return result; - } - - result.protocol = relative.protocol; - if (!relative.host && !hostlessProtocol[relative.protocol]) { - var relPath = (relative.pathname || '').split('/'); - while (relPath.length && !(relative.host = relPath.shift())); - if (!relative.host) relative.host = ''; - if (!relative.hostname) relative.hostname = ''; - if (relPath[0] !== '') relPath.unshift(''); - if (relPath.length < 2) relPath.unshift(''); - result.pathname = relPath.join('/'); - } else { - result.pathname = relative.pathname; - } - result.search = relative.search; - result.query = relative.query; - result.host = relative.host || ''; - result.auth = relative.auth; - result.hostname = relative.hostname || relative.host; - result.port = relative.port; - // to support http.request - if (result.pathname || result.search) { - var p = result.pathname || ''; - var s = result.search || ''; - result.path = p + s; - } - result.slashes = result.slashes || relative.slashes; - result.href = result.format(); - return result; - } - - var isSourceAbs = (result.pathname && result.pathname.charAt(0) === '/'), - isRelAbs = ( - relative.host || - relative.pathname && relative.pathname.charAt(0) === '/' - ), - mustEndAbs = (isRelAbs || isSourceAbs || - (result.host && relative.pathname)), - removeAllDots = mustEndAbs, - srcPath = result.pathname && result.pathname.split('/') || [], - relPath = relative.pathname && relative.pathname.split('/') || [], - psychotic = result.protocol && !slashedProtocol[result.protocol]; - - // if the url is a non-slashed url, then relative - // links like ../.. should be able - // to crawl up to the hostname, as well. This is strange. - // result.protocol has already been set by now. - // Later on, put the first path part into the host field. - if (psychotic) { - result.hostname = ''; - result.port = null; - if (result.host) { - if (srcPath[0] === '') srcPath[0] = result.host; - else srcPath.unshift(result.host); - } - result.host = ''; - if (relative.protocol) { - relative.hostname = null; - relative.port = null; - if (relative.host) { - if (relPath[0] === '') relPath[0] = relative.host; - else relPath.unshift(relative.host); - } - relative.host = null; - } - mustEndAbs = mustEndAbs && (relPath[0] === '' || srcPath[0] === ''); - } - - if (isRelAbs) { - // it's absolute. - result.host = (relative.host || relative.host === '') ? - relative.host : result.host; - result.hostname = (relative.hostname || relative.hostname === '') ? - relative.hostname : result.hostname; - result.search = relative.search; - result.query = relative.query; - srcPath = relPath; - // fall through to the dot-handling below. - } else if (relPath.length) { - // it's relative - // throw away the existing file, and take the new path instead. - if (!srcPath) srcPath = []; - srcPath.pop(); - srcPath = srcPath.concat(relPath); - result.search = relative.search; - result.query = relative.query; - } else if (!util.isNullOrUndefined(relative.search)) { - // just pull out the search. - // like href='?foo'. - // Put this after the other two cases because it simplifies the booleans - if (psychotic) { - result.hostname = result.host = srcPath.shift(); - //occationaly the auth can get stuck only in host - //this especially happens in cases like - //url.resolveObject('mailto:local1@domain1', 'local2@domain2') - var authInHost = result.host && result.host.indexOf('@') > 0 ? - result.host.split('@') : false; - if (authInHost) { - result.auth = authInHost.shift(); - result.host = result.hostname = authInHost.shift(); - } - } - result.search = relative.search; - result.query = relative.query; - //to support http.request - if (!util.isNull(result.pathname) || !util.isNull(result.search)) { - result.path = (result.pathname ? result.pathname : '') + - (result.search ? result.search : ''); - } - result.href = result.format(); - return result; - } - - if (!srcPath.length) { - // no path at all. easy. - // we've already handled the other stuff above. - result.pathname = null; - //to support http.request - if (result.search) { - result.path = '/' + result.search; - } else { - result.path = null; - } - result.href = result.format(); - return result; - } - - // if a url ENDs in . or .., then it must get a trailing slash. - // however, if it ends in anything else non-slashy, - // then it must NOT get a trailing slash. - var last = srcPath.slice(-1)[0]; - var hasTrailingSlash = ( - (result.host || relative.host || srcPath.length > 1) && - (last === '.' || last === '..') || last === ''); - - // strip single dots, resolve double dots to parent dir - // if the path tries to go above the root, `up` ends up > 0 - var up = 0; - for (var i = srcPath.length; i >= 0; i--) { - last = srcPath[i]; - if (last === '.') { - srcPath.splice(i, 1); - } else if (last === '..') { - srcPath.splice(i, 1); - up++; - } else if (up) { - srcPath.splice(i, 1); - up--; - } - } - - // if the path is allowed to go above the root, restore leading ..s - if (!mustEndAbs && !removeAllDots) { - for (; up--; up) { - srcPath.unshift('..'); - } - } - - if (mustEndAbs && srcPath[0] !== '' && - (!srcPath[0] || srcPath[0].charAt(0) !== '/')) { - srcPath.unshift(''); - } - - if (hasTrailingSlash && (srcPath.join('/').substr(-1) !== '/')) { - srcPath.push(''); - } - - var isAbsolute = srcPath[0] === '' || - (srcPath[0] && srcPath[0].charAt(0) === '/'); - - // put the host back - if (psychotic) { - result.hostname = result.host = isAbsolute ? '' : - srcPath.length ? srcPath.shift() : ''; - //occationaly the auth can get stuck only in host - //this especially happens in cases like - //url.resolveObject('mailto:local1@domain1', 'local2@domain2') - var authInHost = result.host && result.host.indexOf('@') > 0 ? - result.host.split('@') : false; - if (authInHost) { - result.auth = authInHost.shift(); - result.host = result.hostname = authInHost.shift(); - } - } - - mustEndAbs = mustEndAbs || (result.host && srcPath.length); - - if (mustEndAbs && !isAbsolute) { - srcPath.unshift(''); - } - - if (!srcPath.length) { - result.pathname = null; - result.path = null; - } else { - result.pathname = srcPath.join('/'); - } - - //to support request.http - if (!util.isNull(result.pathname) || !util.isNull(result.search)) { - result.path = (result.pathname ? result.pathname : '') + - (result.search ? result.search : ''); - } - result.auth = relative.auth || result.auth; - result.slashes = result.slashes || relative.slashes; - result.href = result.format(); - return result; -}; - -Url.prototype.parseHost = function() { - var host = this.host; - var port = portPattern.exec(host); - if (port) { - port = port[0]; - if (port !== ':') { - this.port = port.substr(1); - } - host = host.substr(0, host.length - port.length); - } - if (host) this.hostname = host; -}; - -},{"./util":261,"punycode":204,"querystring":207}],261:[function(require,module,exports){ -'use strict'; - -module.exports = { - isString: function(arg) { - return typeof(arg) === 'string'; - }, - isObject: function(arg) { - return typeof(arg) === 'object' && arg !== null; - }, - isNull: function(arg) { - return arg === null; - }, - isNullOrUndefined: function(arg) { - return arg == null; - } -}; - -},{}],262:[function(require,module,exports){ -(function (global){ - -/** - * Module exports. - */ - -module.exports = deprecate; - -/** - * Mark that a method should not be used. - * Returns a modified function which warns once by default. - * - * If `localStorage.noDeprecation = true` is set, then it is a no-op. - * - * If `localStorage.throwDeprecation = true` is set, then deprecated functions - * will throw an Error when invoked. - * - * If `localStorage.traceDeprecation = true` is set, then deprecated functions - * will invoke `console.trace()` instead of `console.error()`. - * - * @param {Function} fn - the function to deprecate - * @param {String} msg - the string to print to the console when `fn` is invoked - * @returns {Function} a new "deprecated" version of `fn` - * @api public - */ - -function deprecate (fn, msg) { - if (config('noDeprecation')) { - return fn; - } - - var warned = false; - function deprecated() { - if (!warned) { - if (config('throwDeprecation')) { - throw new Error(msg); - } else if (config('traceDeprecation')) { - console.trace(msg); - } else { - console.warn(msg); - } - warned = true; - } - return fn.apply(this, arguments); - } - - return deprecated; -} - -/** - * Checks `localStorage` for boolean values for the given `name`. - * - * @param {String} name - * @returns {Boolean} - * @api private - */ - -function config (name) { - // accessing global.localStorage can trigger a DOMException in sandboxed iframes - try { - if (!global.localStorage) return false; - } catch (_) { - return false; - } - var val = global.localStorage[name]; - if (null == val) return false; - return String(val).toLowerCase() === 'true'; -} - -}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) -},{}],263:[function(require,module,exports){ -arguments[4][19][0].apply(exports,arguments) -},{"dup":19}],264:[function(require,module,exports){ -arguments[4][20][0].apply(exports,arguments) -},{"./support/isBuffer":263,"_process":197,"dup":20,"inherits":156}],265:[function(require,module,exports){ -var v1 = require('./v1'); -var v4 = require('./v4'); - -var uuid = v4; -uuid.v1 = v1; -uuid.v4 = v4; - -module.exports = uuid; - -},{"./v1":268,"./v4":269}],266:[function(require,module,exports){ -/** - * Convert array of 16 byte values to UUID string format of the form: - * XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX - */ -var byteToHex = []; -for (var i = 0; i < 256; ++i) { - byteToHex[i] = (i + 0x100).toString(16).substr(1); -} - -function bytesToUuid(buf, offset) { - var i = offset || 0; - var bth = byteToHex; - // join used to fix memory issue caused by concatenation: https://bugs.chromium.org/p/v8/issues/detail?id=3175#c4 - return ([ - bth[buf[i++]], bth[buf[i++]], - bth[buf[i++]], bth[buf[i++]], '-', - bth[buf[i++]], bth[buf[i++]], '-', - bth[buf[i++]], bth[buf[i++]], '-', - bth[buf[i++]], bth[buf[i++]], '-', - bth[buf[i++]], bth[buf[i++]], - bth[buf[i++]], bth[buf[i++]], - bth[buf[i++]], bth[buf[i++]] - ]).join(''); -} - -module.exports = bytesToUuid; - -},{}],267:[function(require,module,exports){ -// Unique ID creation requires a high quality random # generator. In the -// browser this is a little complicated due to unknown quality of Math.random() -// and inconsistent support for the `crypto` API. We do the best we can via -// feature-detection - -// getRandomValues needs to be invoked in a context where "this" is a Crypto -// implementation. Also, find the complete implementation of crypto on IE11. -var getRandomValues = (typeof(crypto) != 'undefined' && crypto.getRandomValues && crypto.getRandomValues.bind(crypto)) || - (typeof(msCrypto) != 'undefined' && typeof window.msCrypto.getRandomValues == 'function' && msCrypto.getRandomValues.bind(msCrypto)); - -if (getRandomValues) { - // WHATWG crypto RNG - http://wiki.whatwg.org/wiki/Crypto - var rnds8 = new Uint8Array(16); // eslint-disable-line no-undef - - module.exports = function whatwgRNG() { - getRandomValues(rnds8); - return rnds8; - }; -} else { - // Math.random()-based (RNG) - // - // If all else fails, use Math.random(). It's fast, but is of unspecified - // quality. - var rnds = new Array(16); - - module.exports = function mathRNG() { - for (var i = 0, r; i < 16; i++) { - if ((i & 0x03) === 0) r = Math.random() * 0x100000000; - rnds[i] = r >>> ((i & 0x03) << 3) & 0xff; - } - - return rnds; - }; -} - -},{}],268:[function(require,module,exports){ -var rng = require('./lib/rng'); -var bytesToUuid = require('./lib/bytesToUuid'); - -// **`v1()` - Generate time-based UUID** -// -// Inspired by https://github.com/LiosK/UUID.js -// and http://docs.python.org/library/uuid.html - -var _nodeId; -var _clockseq; - -// Previous uuid creation time -var _lastMSecs = 0; -var _lastNSecs = 0; - -// See https://github.com/uuidjs/uuid for API details -function v1(options, buf, offset) { - var i = buf && offset || 0; - var b = buf || []; - - options = options || {}; - var node = options.node || _nodeId; - var clockseq = options.clockseq !== undefined ? options.clockseq : _clockseq; - - // node and clockseq need to be initialized to random values if they're not - // specified. We do this lazily to minimize issues related to insufficient - // system entropy. See #189 - if (node == null || clockseq == null) { - var seedBytes = rng(); - if (node == null) { - // Per 4.5, create and 48-bit node id, (47 random bits + multicast bit = 1) - node = _nodeId = [ - seedBytes[0] | 0x01, - seedBytes[1], seedBytes[2], seedBytes[3], seedBytes[4], seedBytes[5] - ]; - } - if (clockseq == null) { - // Per 4.2.2, randomize (14 bit) clockseq - clockseq = _clockseq = (seedBytes[6] << 8 | seedBytes[7]) & 0x3fff; - } - } - - // UUID timestamps are 100 nano-second units since the Gregorian epoch, - // (1582-10-15 00:00). JSNumbers aren't precise enough for this, so - // time is handled internally as 'msecs' (integer milliseconds) and 'nsecs' - // (100-nanoseconds offset from msecs) since unix epoch, 1970-01-01 00:00. - var msecs = options.msecs !== undefined ? options.msecs : new Date().getTime(); - - // Per 4.2.1.2, use count of uuid's generated during the current clock - // cycle to simulate higher resolution clock - var nsecs = options.nsecs !== undefined ? options.nsecs : _lastNSecs + 1; - - // Time since last uuid creation (in msecs) - var dt = (msecs - _lastMSecs) + (nsecs - _lastNSecs)/10000; - - // Per 4.2.1.2, Bump clockseq on clock regression - if (dt < 0 && options.clockseq === undefined) { - clockseq = clockseq + 1 & 0x3fff; - } - - // Reset nsecs if clock regresses (new clockseq) or we've moved onto a new - // time interval - if ((dt < 0 || msecs > _lastMSecs) && options.nsecs === undefined) { - nsecs = 0; - } - - // Per 4.2.1.2 Throw error if too many uuids are requested - if (nsecs >= 10000) { - throw new Error('uuid.v1(): Can\'t create more than 10M uuids/sec'); - } - - _lastMSecs = msecs; - _lastNSecs = nsecs; - _clockseq = clockseq; - - // Per 4.1.4 - Convert from unix epoch to Gregorian epoch - msecs += 12219292800000; - - // `time_low` - var tl = ((msecs & 0xfffffff) * 10000 + nsecs) % 0x100000000; - b[i++] = tl >>> 24 & 0xff; - b[i++] = tl >>> 16 & 0xff; - b[i++] = tl >>> 8 & 0xff; - b[i++] = tl & 0xff; - - // `time_mid` - var tmh = (msecs / 0x100000000 * 10000) & 0xfffffff; - b[i++] = tmh >>> 8 & 0xff; - b[i++] = tmh & 0xff; - - // `time_high_and_version` - b[i++] = tmh >>> 24 & 0xf | 0x10; // include version - b[i++] = tmh >>> 16 & 0xff; - - // `clock_seq_hi_and_reserved` (Per 4.2.2 - include variant) - b[i++] = clockseq >>> 8 | 0x80; - - // `clock_seq_low` - b[i++] = clockseq & 0xff; - - // `node` - for (var n = 0; n < 6; ++n) { - b[i + n] = node[n]; - } - - return buf ? buf : bytesToUuid(b); -} - -module.exports = v1; - -},{"./lib/bytesToUuid":266,"./lib/rng":267}],269:[function(require,module,exports){ -var rng = require('./lib/rng'); -var bytesToUuid = require('./lib/bytesToUuid'); - -function v4(options, buf, offset) { - var i = buf && offset || 0; - - if (typeof(options) == 'string') { - buf = options === 'binary' ? new Array(16) : null; - options = null; - } - options = options || {}; - - var rnds = options.random || (options.rng || rng)(); - - // Per 4.4, set bits for version and `clock_seq_hi_and_reserved` - rnds[6] = (rnds[6] & 0x0f) | 0x40; - rnds[8] = (rnds[8] & 0x3f) | 0x80; - - // Copy bytes to buffer, if provided - if (buf) { - for (var ii = 0; ii < 16; ++ii) { - buf[i + ii] = rnds[ii]; - } - } - - return buf || bytesToUuid(rnds); -} - -module.exports = v4; - -},{"./lib/bytesToUuid":266,"./lib/rng":267}],270:[function(require,module,exports){ -var indexOf = function (xs, item) { - if (xs.indexOf) return xs.indexOf(item); - else for (var i = 0; i < xs.length; i++) { - if (xs[i] === item) return i; - } - return -1; -}; -var Object_keys = function (obj) { - if (Object.keys) return Object.keys(obj) - else { - var res = []; - for (var key in obj) res.push(key) - return res; - } -}; - -var forEach = function (xs, fn) { - if (xs.forEach) return xs.forEach(fn) - else for (var i = 0; i < xs.length; i++) { - fn(xs[i], i, xs); - } -}; - -var defineProp = (function() { - try { - Object.defineProperty({}, '_', {}); - return function(obj, name, value) { - Object.defineProperty(obj, name, { - writable: true, - enumerable: false, - configurable: true, - value: value - }) - }; - } catch(e) { - return function(obj, name, value) { - obj[name] = value; - }; - } -}()); - -var globals = ['Array', 'Boolean', 'Date', 'Error', 'EvalError', 'Function', -'Infinity', 'JSON', 'Math', 'NaN', 'Number', 'Object', 'RangeError', -'ReferenceError', 'RegExp', 'String', 'SyntaxError', 'TypeError', 'URIError', -'decodeURI', 'decodeURIComponent', 'encodeURI', 'encodeURIComponent', 'escape', -'eval', 'isFinite', 'isNaN', 'parseFloat', 'parseInt', 'undefined', 'unescape']; - -function Context() {} -Context.prototype = {}; - -var Script = exports.Script = function NodeScript (code) { - if (!(this instanceof Script)) return new Script(code); - this.code = code; -}; - -Script.prototype.runInContext = function (context) { - if (!(context instanceof Context)) { - throw new TypeError("needs a 'context' argument."); - } - - var iframe = document.createElement('iframe'); - if (!iframe.style) iframe.style = {}; - iframe.style.display = 'none'; - - document.body.appendChild(iframe); - - var win = iframe.contentWindow; - var wEval = win.eval, wExecScript = win.execScript; - - if (!wEval && wExecScript) { - // win.eval() magically appears when this is called in IE: - wExecScript.call(win, 'null'); - wEval = win.eval; - } - - forEach(Object_keys(context), function (key) { - win[key] = context[key]; - }); - forEach(globals, function (key) { - if (context[key]) { - win[key] = context[key]; - } - }); - - var winKeys = Object_keys(win); - - var res = wEval.call(win, this.code); - - forEach(Object_keys(win), function (key) { - // Avoid copying circular objects like `top` and `window` by only - // updating existing context properties or new properties in the `win` - // that was only introduced after the eval. - if (key in context || indexOf(winKeys, key) === -1) { - context[key] = win[key]; - } - }); - - forEach(globals, function (key) { - if (!(key in context)) { - defineProp(context, key, win[key]); - } - }); - - document.body.removeChild(iframe); - - return res; -}; - -Script.prototype.runInThisContext = function () { - return eval(this.code); // maybe... -}; - -Script.prototype.runInNewContext = function (context) { - var ctx = Script.createContext(context); - var res = this.runInContext(ctx); - - if (context) { - forEach(Object_keys(ctx), function (key) { - context[key] = ctx[key]; - }); - } - - return res; -}; - -forEach(Object_keys(Script.prototype), function (name) { - exports[name] = Script[name] = function (code) { - var s = Script(code); - return s[name].apply(s, [].slice.call(arguments, 1)); - }; -}); - -exports.isContext = function (context) { - return context instanceof Context; -}; - -exports.createScript = function (code) { - return exports.Script(code); -}; - -exports.createContext = Script.createContext = function (context) { - var copy = new Context(); - if(typeof context === 'object') { - forEach(Object_keys(context), function (key) { - copy[key] = context[key]; - }); - } - return copy; -}; - -},{}],271:[function(require,module,exports){ - -/** - * References: - * - http://tools.ietf.org/html/rfc2361 - * - http://www.sonicspot.com/guide/wavefiles.html - * - https://ccrma.stanford.edu/courses/422/projects/WaveFormat/ - * - http://www-mmsp.ece.mcgill.ca/Documents/AudioFormats/WAVE/WAVE.html - * - http://www.blitter.com/~russtopia/MIDI/~jglatt/tech/wave.htm - */ - -/** - * The `Reader` class accepts a WAVE audio file, emits a "format" event, and - * outputs the raw "data" from the WAVE file (usually raw PCM data, but if the - * WAVE file uses compression then the compressed data will be output, you are - * responsible for uncompressing in that case if necessary). - */ - -exports.Reader = require('./lib/reader'); - -/** - * The `Writer` class outputs a valid WAVE file from the audio data written to - * it. You may set any of the "channels", "sampleRate" or "bitsPerSample" - * properties before writing the first chunk. You may also set the "dataLength" to - * the number of bytes expected in the "data" portion of the WAVE file. If - * "dataLength" is not set, then the maximum valid length for a WAVE file is - * written. - */ - -exports.Writer = require('./lib/writer'); - -/** - * The `FileWriter` is a subclass of `Writer` that automatically takes care of - * writing the "header" event at the end of the stream to the beginning of the - * output file. - */ - -exports.FileWriter = require('./lib/file-writer'); - -},{"./lib/file-writer":272,"./lib/reader":273,"./lib/writer":274}],272:[function(require,module,exports){ - -/** - * Module dependencies. - */ - -var fs = require('fs'); -var Writer = require('./writer'); -var inherits = require('util').inherits; - -/** - * Module exports. - */ - -module.exports = FileWriter; - -/** - * The `FileWriter` class. - * - * @param {String} path The file path to write the WAVE file to - * @param {Object} opts Object contains options for the stream and format info - * @api public - */ - -function FileWriter (path, opts) { - if (!(this instanceof FileWriter)) return new FileWriter(path, opts); - Writer.call(this, opts); - this.path = path; - this.file = fs.createWriteStream(path, opts); - this.pipe(this.file); - this.on('header', this._onHeader); -} -inherits(FileWriter, Writer); - -/** - * Writes the updated WAVE header to the beginning of the file. - * Emits a "done" event when everything is all good. - * - * @api private - */ - -FileWriter.prototype._onHeader = function (header) { - var self = this; - var fd; - - function onOpen (err, f) { - if (err) return self.emit('error', err); - fd = f; - fs.write(fd, header, 0, header.length, 0, onWrite); - } - - function onWrite (err, bytesWritten) { - if (err) return self.emit('error', err); - if (bytesWritten !== header.length) { - return self.emit('error', new Error('problem writing "header" data')); - } - fs.close(fd, onClose); - } - - function onClose (err) { - if (err) return self.emit('error', err); - self.emit('done'); - } - - fs.open(self.path, 'r+', onOpen); -}; - -},{"./writer":274,"fs":82,"util":264}],273:[function(require,module,exports){ - -/** - * Module dependencies. - */ - -var util = require('util'); -var Parser = require('stream-parser'); -var Transform = require('readable-stream/transform'); -var debug = require('debug')('wave:reader'); -var inherits = util.inherits; -var f = util.format; - -/** - * Values for the `audioFormat` byte. - */ - -var formats = { - WAVE_FORMAT_UNKNOWN: 0x0000, // Microsoft Unknown Wave Format - WAVE_FORMAT_PCM: 0x0001, // Microsoft PCM Format - WAVE_FORMAT_ADPCM: 0x0002, // Microsoft ADPCM Format - WAVE_FORMAT_IEEE_FLOAT: 0x0003, // IEEE float - WAVE_FORMAT_VSELP: 0x0004, // Compaq Computer's VSELP - WAVE_FORMAT_IBM_CVSD: 0x0005, // IBM CVSD - WAVE_FORMAT_ALAW: 0x0006, // 8-bit ITU-T G.711 A-law - WAVE_FORMAT_MULAW: 0x0007, // 8-bit ITU-T G.711 ยต-law - WAVE_FORMAT_EXTENSIBLE: 0xFFFE // Determined by SubFormat -}; - -/** - * Module exports. - */ - -module.exports = Reader; - -/** - * The `Reader` class accepts a WAV audio file written to it and outputs the raw - * audio data with the WAV header stripped (most of the time, PCM audio data will - * be output, depending on the `audioFormat` property). - * - * A `"format"` event gets emitted after the WAV header has been parsed. - * - * @param {Object} opts optional options object - * @api public - */ - -function Reader (opts) { - if (!(this instanceof Reader)) { - return new Reader(opts); - } - Transform.call(this, opts); - - this._bytes(4, this._onRiffID); -} -inherits(Reader, Transform); - -/** - * Mixin `Parser`. - */ - -Parser(Reader.prototype); - -// the beginning of the WAV file -Reader.prototype._onRiffID = function (chunk) { - debug('onRiffID: %o', chunk); - var id = this.riffId = chunk.toString('ascii'); - if (id === 'RIFF') { - debug('detected little-endian WAVE file'); - this.endianness = 'LE'; - this._bytes(4, this._onChunkSize); - } else if (id === 'RIFX') { - debug('detected big-endian WAVE file'); - this.endianness = 'BE'; - this._bytes(4, this._onChunkSize); - } else { - this.emit('error', new Error(f('bad "chunk id": expected "RIFF" or "RIFX", got %j', id))); - } -}; - -// size of the WAV -Reader.prototype._onChunkSize = function (chunk) { - debug('onChunkSize: %o', chunk); - this.chunkSize = chunk['readUInt32' + this.endianness](0); - this._bytes(4, this._onFormat); -}; - -// the RIFF "format", should always be "WAVE" -Reader.prototype._onFormat = function (chunk) { - debug('onFormat: %o', chunk); - this.waveId = chunk.toString('ascii'); - if (this.waveId === 'WAVE') { - this._bytes(4, this._onSubchunk1ID); - } else { - this.emit('error', new Error(f('bad "format": expected "WAVE", got %j', this.waveId))); - } -}; - -// size of the "subchunk1" (the header) -Reader.prototype._onSubchunk1ID = function (chunk) { - debug('onSubchunk1ID: %o', chunk); - var subchunk1ID = chunk.toString('ascii'); - this.chunkId = subchunk1ID; - if (subchunk1ID === 'fmt ') { - this._bytes(4, this._onSubchunk1Size); - } else { - this.emit('error', new Error(f('bad "fmt id": expected "fmt ", got %j', subchunk1ID))); - } -}; - -Reader.prototype._onSubchunk1Size = function (chunk) { - debug('onSubchunk1Size: %o', chunk); - this.subchunk1Size = chunk['readUInt32' + this.endianness](0); - // TODO: assert should be 16 for PCM - this._bytes(this.subchunk1Size, this._onSubchunk1); -}; - -Reader.prototype._onSubchunk1 = function (chunk) { - debug('onSubchunk1: %o', chunk); - this.audioFormat = chunk['readUInt16' + this.endianness](0); - this.channels = chunk['readUInt16' + this.endianness](2); - this.sampleRate = chunk['readUInt32' + this.endianness](4); - this.byteRate = chunk['readUInt32' + this.endianness](8); // useless... - this.blockAlign = chunk['readUInt16' + this.endianness](12); // useless... - this.bitDepth = chunk['readUInt16' + this.endianness](14); - this.signed = this.bitDepth !== 8; - - var format = { - audioFormat: this.audioFormat, - endianness: this.endianness, - channels: this.channels, - sampleRate: this.sampleRate, - byteRate: this.byteRate, - blockAlign: this.blockAlign, - bitDepth: this.bitDepth, - signed: this.signed - }; - - switch (format.audioFormat) { - case formats.WAVE_FORMAT_PCM: - // default, common case. don't need to do anything. - break; - case formats.WAVE_FORMAT_IEEE_FLOAT: - format.float = true; - break; - case formats.WAVE_FORMAT_ALAW: - format.alaw = true; - break; - case formats.WAVE_FORMAT_MULAW: - format.ulaw = true; - break; - } - - this.emit('format', format); - - this._bytes(4, this._onSubchunk2ID); -}; - -Reader.prototype._onSubchunk2ID = function (chunk) { - debug('onSubchunk2ID: %o', chunk); - var subchunk2ID = chunk.toString('ascii'); - - if (subchunk2ID === 'data') { - // Data Chunk - "data" - this._bytes(4, this._onDataChunkSize); - } else if (subchunk2ID === 'fact') { - // Fact Chunk - "fact" - this._bytes(4, this._onFactChunkSize); - } else { - // Unknown Chunk - parse it an emit a "chunk" event - debug('parsing unknown %o chunk', subchunk2ID); - this.unknownID = subchunk2ID; - this._bytes(4, this._onUnknownChunkSize); - } -}; - -// size of the remaining data in this WAV file -Reader.prototype._onDataChunkSize = function (chunk) { - debug('onDataChunkSize: %o', chunk); - var chunkSize = chunk['readUInt32' + this.endianness](0); - - if (chunkSize === 0) { - // Some encoders write `0` for the byte length here in the case of a WAV file - // being generated on-the-fly. In that case, we're just gonna passthrough the - // remaining bytes assuming they're going to be audio data. - chunkSize = Infinity; - } - - this._passthrough(chunkSize, this._onDataChunkDone); -}; - -Reader.prototype._onDataChunkDone = function () { - debug('onFactChunkDone'); - // now we're done with the "data" chunk so read a new "chunk ID" to figure out - // what's next - this._bytes(4, this._onSubchunk2ID); -}; - -Reader.prototype._onFactChunkSize = function (chunk) { - debug('onFactChunkSize: %o', chunk); - var chunkDataSize = chunk['readUInt32' + this.endianness](0); - this._bytes(chunkDataSize, this._onFactChunkData); -}; - -Reader.prototype._onFactChunkData = function (chunk) { - debug('onFactChunkData: %o', chunk); - // There is currently only one field defined for the format dependant data. - // It is a single 4-byte value that specifies the number of samples in the - // waveform data chunk. - // - // The number of samples field is redundant for sampled data, since the Data - // chunk indicates the length of the data. The number of samples can be - // determined from the length of the data and the container size as determined - // from the Format chunk. - var numSamples = chunk['readUInt32' + this.endianness](0); - debug('number of samples: %o', numSamples); - this.numSamples = numSamples; - - // now we're done with the "fact" chunk so read a new "chunk ID" to figure out - // what's next - this._bytes(4, this._onSubchunk2ID); -}; - -Reader.prototype._onUnknownChunkSize = function (chunk) { - debug('onUnknownChunkSize: %o', chunk); - var chunkSize = chunk['readUInt32' + this.endianness](0); - this._bytes(chunkSize, this._onUnknownChunkData); -}; - -Reader.prototype._onUnknownChunkData = function (chunk) { - debug('onUnknownChunkData: %o', chunk); - - this.emit('chunk', { - id: this.unknownID, - data: chunk - }); - - // now we're done with the "unknown" chunk so read a new "chunk ID" to figure - // out what's next - this._bytes(4, this._onSubchunk2ID); -}; - -},{"debug":99,"readable-stream/transform":214,"stream-parser":256,"util":264}],274:[function(require,module,exports){ -(function (process){ - -/** - * Module dependencies. - */ - -var inherits = require('util').inherits; -var Transform = require('readable-stream/transform'); -var debug = require('debug')('wave:writer'); -var bufferAlloc = require('buffer-alloc'); -var bufferFrom = require('buffer-from'); - -/** - * Module exports. - */ - -module.exports = Writer; - -/** - * RIFF Chunk IDs in Buffers. - * - * @api private - */ - -var RIFF = bufferFrom('RIFF'); -var WAVE = bufferFrom('WAVE'); -var fmt = bufferFrom('fmt '); -var data = bufferFrom('data'); - -/** - * The max size of the "data" chunk of a WAVE file. This is the max unsigned - * 32-bit int value, minus 100 bytes (overkill, 44 would be safe) for the header. - * - * @api private - */ - -var MAX_WAV = 4294967295 - 100; - -/** - * The `Writer` class accepts raw audio data written to it (only PCM audio data is - * currently supported), and outputs a WAV file with a valid WAVE header at the - * beginning specifying the formatting information of the audio stream. - * - * Note that there's an interesting problem, because the WAVE header also - * specifies the total byte length of the audio data in the file, and there's no - * way that we can know this ahead of time. Therefore the WAVE header will contain - * a byte-length if `0` initially, which most WAVE decoders will know means to - * just read until `EOF`. - * - * Optionally, if you are in a situation where you can seek back to the beginning - * of the destination of the WAVE file (like writing to a regular file, for - * example), then you may listen for the `"header"` event which will be emitted - * _after_ all the data has been written, and you can go back and rewrite the new - * header with proper audio byte length into the beginning of the destination - * (though if your destination _is_ a regular file, you should use the the - * `FileWriter` class instead). - * - * @param {Object} opts optional options object - * @api public - */ - -function Writer (opts) { - if (!(this instanceof Writer)) { - return new Writer(opts); - } - Transform.call(this, opts); - - // TODO: allow/properly handle other WAVE audio formats - this.endianness = 'LE'; - this.format = 1; // raw PCM - this.channels = 2; - this.sampleRate = 44100; - this.bitDepth = 16; - this.bytesProcessed = 0; - - if (opts) { - if (opts.format != null) this.format = opts.format; - if (opts.channels != null) this.channels = opts.channels; - if (opts.sampleRate != null) this.sampleRate = opts.sampleRate; - if (opts.bitDepth != null) this.bitDepth = opts.bitDepth; - } - - this._writeHeader(); -} -inherits(Writer, Transform); - -/** - * Writes the WAVE header. - * - * @api private - */ - -Writer.prototype._writeHeader = function () { - debug('_writeHeader()'); - - // TODO: 44 is only for format 1 (PCM), any other - // format will have a variable size... - var headerLength = 44; - - var dataLength = this.dataLength; - if (dataLength == null) { - debug('using default "dataLength" of %d', MAX_WAV); - dataLength = MAX_WAV; - } - var fileSize = dataLength + headerLength; - var header = bufferAlloc(headerLength); - var offset = 0; - - // write the "RIFF" identifier - RIFF.copy(header, offset); - offset += RIFF.length; - - // write the file size minus the identifier and this 32-bit int - header['writeUInt32' + this.endianness](fileSize - 8, offset); - offset += 4; - - // write the "WAVE" identifier - WAVE.copy(header, offset); - offset += WAVE.length; - - // write the "fmt " sub-chunk identifier - fmt.copy(header, offset); - offset += fmt.length; - - // write the size of the "fmt " chunk - // XXX: value of 16 is hard-coded for raw PCM format. other formats have - // different size. - header['writeUInt32' + this.endianness](16, offset); - offset += 4; - - // write the audio format code - header['writeUInt16' + this.endianness](this.format, offset); - offset += 2; - - // write the number of channels - header['writeUInt16' + this.endianness](this.channels, offset); - offset += 2; - - // write the sample rate - header['writeUInt32' + this.endianness](this.sampleRate, offset); - offset += 4; - - // write the byte rate - var byteRate = this.byteRate; - if (byteRate == null) { - byteRate = this.sampleRate * this.channels * this.bitDepth / 8; - } - header['writeUInt32' + this.endianness](byteRate, offset); - offset += 4; - - // write the block align - var blockAlign = this.blockAlign; - if (blockAlign == null) { - blockAlign = this.channels * this.bitDepth / 8; - } - header['writeUInt16' + this.endianness](blockAlign, offset); - offset += 2; - - // write the bits per sample - header['writeUInt16' + this.endianness](this.bitDepth, offset); - offset += 2; - - // write the "data" sub-chunk ID - data.copy(header, offset); - offset += data.length; - - // write the remaining length of the rest of the data - header['writeUInt32' + this.endianness](dataLength, offset); - offset += 4; - - // save the "header" Buffer for the end, we emit the "header" event at the end - // with the "size" values properly filled out. if this stream is being piped to - // a file (or anything else seekable), then this correct header should be placed - // at the very beginning of the file. - this._header = header; - this.headerLength = headerLength; - - this.push(header); -}; - -/** - * Called for the "end" event of this Writer instance. - * - * @api private - */ - -Writer.prototype._onEnd = function (write) { - debug('_onEnd()'); -}; - -/** - * Transform incoming data. We don't do anything special, just pass it through. - * - * @api private - */ - -Writer.prototype._transform = function (chunk, enc, done) { - this.push(chunk); - this.bytesProcessed += chunk.length; - done(); -}; - -/** - * Emits a "header" event after the readable side of the stream has finished. - * - * @api private - */ - -Writer.prototype._flush = function (done) { - debug('_flush()'); - done(); - this.dataLength = this.bytesProcessed; - process.nextTick(this._emitHeader.bind(this)); -}; - -/** - * Emits the "header" event. This can safely be ignored, or if you are writing - * this WAVE file to somewhere that is seekable (i.e. the filesystem), then you - * should write this "header" buffer at the beginning of the file to get the - * correct file size values in the file. This isn't too important since most audio - * players look at the file size rather than those byte values in the header, but - * it's good to when when possible. - * - * @api private - */ - -Writer.prototype._emitHeader = function () { - debug('_emitHeader()'); - var dataLength = this.dataLength; - var headerLength = this.headerLength; - var header = this._header; - - // write the file length at the beginning of the header - header['writeUInt32' + this.endianness](dataLength + headerLength - 8, 4); - - // write the data length at the end of the header - header['writeUInt32' + this.endianness](dataLength, headerLength - 4); - - this.emit('header', header); -}; - -}).call(this,require('_process')) -},{"_process":197,"buffer-alloc":85,"buffer-from":87,"debug":99,"readable-stream/transform":214,"util":264}],275:[function(require,module,exports){ -'use strict'; - -module.exports = function () { - throw new Error( - 'ws does not work in the browser. Browser clients must use the native ' + - 'WebSocket object' - ); -}; - -},{}],276:[function(require,module,exports){ -module.exports = extend - -var hasOwnProperty = Object.prototype.hasOwnProperty; - -function extend() { - var target = {} - - for (var i = 0; i < arguments.length; i++) { - var source = arguments[i] - - for (var key in source) { - if (hasOwnProperty.call(source, key)) { - target[key] = source[key] - } - } - } - - return target -} - -},{}]},{},[149])(149) -}); diff --git a/server.js b/server.js index 7162a0e..13c7a5c 100644 --- a/server.js +++ b/server.js @@ -20,6 +20,11 @@ var port = config.port || 8446; var publicFolder = argv.public || 'public'; app.use(express.static(path.join(__dirname, publicFolder))); +// Serve Houndify directly from node_modules at js/houndify.js path +app.get('/js/houndify.js', function(req, res) { + res.sendFile(path.join(__dirname, 'node_modules/houndify/dist/houndify.js')); +}); + //authenticates requests app.get('/houndifyAuth', Houndify.HoundifyExpress.createAuthenticationHandler({