@ardennguyen/zalo-agent-cli 1.0.7 → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/DISCLAIMER.md +2 -2
- package/README.md +146 -69
- package/node_modules/asynckit/LICENSE +21 -0
- package/node_modules/asynckit/README.md +233 -0
- package/node_modules/asynckit/bench.js +76 -0
- package/node_modules/asynckit/index.js +6 -0
- package/node_modules/asynckit/lib/abort.js +29 -0
- package/node_modules/asynckit/lib/async.js +34 -0
- package/node_modules/asynckit/lib/defer.js +26 -0
- package/node_modules/asynckit/lib/iterate.js +75 -0
- package/node_modules/asynckit/lib/readable_asynckit.js +91 -0
- package/node_modules/asynckit/lib/readable_parallel.js +25 -0
- package/node_modules/asynckit/lib/readable_serial.js +25 -0
- package/node_modules/asynckit/lib/readable_serial_ordered.js +29 -0
- package/node_modules/asynckit/lib/state.js +37 -0
- package/node_modules/asynckit/lib/streamify.js +141 -0
- package/node_modules/asynckit/lib/terminator.js +29 -0
- package/node_modules/asynckit/package.json +63 -0
- package/node_modules/asynckit/parallel.js +43 -0
- package/node_modules/asynckit/serial.js +17 -0
- package/node_modules/asynckit/serialOrdered.js +75 -0
- package/node_modules/asynckit/stream.js +21 -0
- package/node_modules/bignumber.js/CHANGELOG.md +381 -0
- package/node_modules/bignumber.js/LICENCE.md +26 -0
- package/node_modules/bignumber.js/README.md +289 -0
- package/node_modules/bignumber.js/bignumber.d.mts +6 -0
- package/node_modules/bignumber.js/bignumber.d.ts +5 -0
- package/node_modules/bignumber.js/bignumber.js +2922 -0
- package/node_modules/bignumber.js/bignumber.mjs +2907 -0
- package/node_modules/bignumber.js/doc/API.html +2249 -0
- package/node_modules/bignumber.js/package.json +60 -0
- package/node_modules/bignumber.js/types.d.ts +1821 -0
- package/node_modules/call-bind-apply-helpers/.eslintrc +17 -0
- package/node_modules/call-bind-apply-helpers/.github/FUNDING.yml +12 -0
- package/node_modules/call-bind-apply-helpers/.nycrc +9 -0
- package/node_modules/call-bind-apply-helpers/CHANGELOG.md +30 -0
- package/node_modules/call-bind-apply-helpers/LICENSE +21 -0
- package/node_modules/call-bind-apply-helpers/README.md +62 -0
- package/node_modules/call-bind-apply-helpers/actualApply.d.ts +1 -0
- package/node_modules/call-bind-apply-helpers/actualApply.js +10 -0
- package/node_modules/call-bind-apply-helpers/applyBind.d.ts +19 -0
- package/node_modules/call-bind-apply-helpers/applyBind.js +10 -0
- package/node_modules/call-bind-apply-helpers/functionApply.d.ts +1 -0
- package/node_modules/call-bind-apply-helpers/functionApply.js +4 -0
- package/node_modules/call-bind-apply-helpers/functionCall.d.ts +1 -0
- package/node_modules/call-bind-apply-helpers/functionCall.js +4 -0
- package/node_modules/call-bind-apply-helpers/index.d.ts +64 -0
- package/node_modules/call-bind-apply-helpers/index.js +15 -0
- package/node_modules/call-bind-apply-helpers/package.json +85 -0
- package/node_modules/call-bind-apply-helpers/reflectApply.d.ts +3 -0
- package/node_modules/call-bind-apply-helpers/reflectApply.js +4 -0
- package/node_modules/call-bind-apply-helpers/test/index.js +63 -0
- package/node_modules/call-bind-apply-helpers/tsconfig.json +9 -0
- package/node_modules/combined-stream/License +19 -0
- package/node_modules/combined-stream/Readme.md +138 -0
- package/node_modules/combined-stream/lib/combined_stream.js +208 -0
- package/node_modules/combined-stream/package.json +25 -0
- package/node_modules/crypto-js/CONTRIBUTING.md +28 -0
- package/node_modules/crypto-js/LICENSE +24 -0
- package/node_modules/crypto-js/README.md +275 -0
- package/node_modules/crypto-js/aes.js +234 -0
- package/node_modules/crypto-js/blowfish.js +471 -0
- package/node_modules/crypto-js/bower.json +39 -0
- package/node_modules/crypto-js/cipher-core.js +895 -0
- package/node_modules/crypto-js/core.js +807 -0
- package/node_modules/crypto-js/crypto-js.js +6657 -0
- package/node_modules/crypto-js/docs/QuickStartGuide.wiki +470 -0
- package/node_modules/crypto-js/enc-base64.js +136 -0
- package/node_modules/crypto-js/enc-base64url.js +148 -0
- package/node_modules/crypto-js/enc-hex.js +18 -0
- package/node_modules/crypto-js/enc-latin1.js +18 -0
- package/node_modules/crypto-js/enc-utf16.js +149 -0
- package/node_modules/crypto-js/enc-utf8.js +18 -0
- package/node_modules/crypto-js/evpkdf.js +134 -0
- package/node_modules/crypto-js/format-hex.js +66 -0
- package/node_modules/crypto-js/format-openssl.js +18 -0
- package/node_modules/crypto-js/hmac-md5.js +18 -0
- package/node_modules/crypto-js/hmac-ripemd160.js +18 -0
- package/node_modules/crypto-js/hmac-sha1.js +18 -0
- package/node_modules/crypto-js/hmac-sha224.js +18 -0
- package/node_modules/crypto-js/hmac-sha256.js +18 -0
- package/node_modules/crypto-js/hmac-sha3.js +18 -0
- package/node_modules/crypto-js/hmac-sha384.js +18 -0
- package/node_modules/crypto-js/hmac-sha512.js +18 -0
- package/node_modules/crypto-js/hmac.js +143 -0
- package/node_modules/crypto-js/index.js +18 -0
- package/node_modules/crypto-js/lib-typedarrays.js +76 -0
- package/node_modules/crypto-js/md5.js +268 -0
- package/node_modules/crypto-js/mode-cfb.js +80 -0
- package/node_modules/crypto-js/mode-ctr-gladman.js +116 -0
- package/node_modules/crypto-js/mode-ctr.js +58 -0
- package/node_modules/crypto-js/mode-ecb.js +40 -0
- package/node_modules/crypto-js/mode-ofb.js +54 -0
- package/node_modules/crypto-js/package.json +42 -0
- package/node_modules/crypto-js/pad-ansix923.js +49 -0
- package/node_modules/crypto-js/pad-iso10126.js +44 -0
- package/node_modules/crypto-js/pad-iso97971.js +40 -0
- package/node_modules/crypto-js/pad-nopadding.js +30 -0
- package/node_modules/crypto-js/pad-pkcs7.js +18 -0
- package/node_modules/crypto-js/pad-zeropadding.js +47 -0
- package/node_modules/crypto-js/pbkdf2.js +145 -0
- package/node_modules/crypto-js/rabbit-legacy.js +190 -0
- package/node_modules/crypto-js/rabbit.js +192 -0
- package/node_modules/crypto-js/rc4.js +139 -0
- package/node_modules/crypto-js/ripemd160.js +267 -0
- package/node_modules/crypto-js/sha1.js +150 -0
- package/node_modules/crypto-js/sha224.js +80 -0
- package/node_modules/crypto-js/sha256.js +199 -0
- package/node_modules/crypto-js/sha3.js +326 -0
- package/node_modules/crypto-js/sha384.js +83 -0
- package/node_modules/crypto-js/sha512.js +326 -0
- package/node_modules/crypto-js/tripledes.js +779 -0
- package/node_modules/crypto-js/x64-core.js +304 -0
- package/node_modules/delayed-stream/.npmignore +1 -0
- package/node_modules/delayed-stream/License +19 -0
- package/node_modules/delayed-stream/Makefile +7 -0
- package/node_modules/delayed-stream/Readme.md +141 -0
- package/node_modules/delayed-stream/lib/delayed_stream.js +107 -0
- package/node_modules/delayed-stream/package.json +27 -0
- package/node_modules/dunder-proto/.eslintrc +5 -0
- package/node_modules/dunder-proto/.github/FUNDING.yml +12 -0
- package/node_modules/dunder-proto/.nycrc +13 -0
- package/node_modules/dunder-proto/CHANGELOG.md +24 -0
- package/node_modules/dunder-proto/LICENSE +21 -0
- package/node_modules/dunder-proto/README.md +54 -0
- package/node_modules/dunder-proto/get.d.ts +5 -0
- package/node_modules/dunder-proto/get.js +30 -0
- package/node_modules/dunder-proto/package.json +76 -0
- package/node_modules/dunder-proto/set.d.ts +5 -0
- package/node_modules/dunder-proto/set.js +35 -0
- package/node_modules/dunder-proto/test/get.js +34 -0
- package/node_modules/dunder-proto/test/index.js +4 -0
- package/node_modules/dunder-proto/test/set.js +50 -0
- package/node_modules/dunder-proto/tsconfig.json +9 -0
- package/node_modules/es-define-property/.eslintrc +13 -0
- package/node_modules/es-define-property/.github/FUNDING.yml +12 -0
- package/node_modules/es-define-property/.nycrc +9 -0
- package/node_modules/es-define-property/CHANGELOG.md +29 -0
- package/node_modules/es-define-property/LICENSE +21 -0
- package/node_modules/es-define-property/README.md +49 -0
- package/node_modules/es-define-property/index.d.ts +3 -0
- package/node_modules/es-define-property/index.js +14 -0
- package/node_modules/es-define-property/package.json +81 -0
- package/node_modules/es-define-property/test/index.js +56 -0
- package/node_modules/es-define-property/tsconfig.json +10 -0
- package/node_modules/es-errors/.eslintrc +5 -0
- package/node_modules/es-errors/.github/FUNDING.yml +12 -0
- package/node_modules/es-errors/CHANGELOG.md +40 -0
- package/node_modules/es-errors/LICENSE +21 -0
- package/node_modules/es-errors/README.md +55 -0
- package/node_modules/es-errors/eval.d.ts +3 -0
- package/node_modules/es-errors/eval.js +4 -0
- package/node_modules/es-errors/index.d.ts +3 -0
- package/node_modules/es-errors/index.js +4 -0
- package/node_modules/es-errors/package.json +80 -0
- package/node_modules/es-errors/range.d.ts +3 -0
- package/node_modules/es-errors/range.js +4 -0
- package/node_modules/es-errors/ref.d.ts +3 -0
- package/node_modules/es-errors/ref.js +4 -0
- package/node_modules/es-errors/syntax.d.ts +3 -0
- package/node_modules/es-errors/syntax.js +4 -0
- package/node_modules/es-errors/test/index.js +19 -0
- package/node_modules/es-errors/tsconfig.json +49 -0
- package/node_modules/es-errors/type.d.ts +3 -0
- package/node_modules/es-errors/type.js +4 -0
- package/node_modules/es-errors/uri.d.ts +3 -0
- package/node_modules/es-errors/uri.js +4 -0
- package/node_modules/es-object-atoms/.eslintrc +16 -0
- package/node_modules/es-object-atoms/.github/FUNDING.yml +12 -0
- package/node_modules/es-object-atoms/CHANGELOG.md +44 -0
- package/node_modules/es-object-atoms/LICENSE +21 -0
- package/node_modules/es-object-atoms/README.md +63 -0
- package/node_modules/es-object-atoms/RequireObjectCoercible.d.ts +3 -0
- package/node_modules/es-object-atoms/RequireObjectCoercible.js +11 -0
- package/node_modules/es-object-atoms/ToObject.d.ts +7 -0
- package/node_modules/es-object-atoms/ToObject.js +10 -0
- package/node_modules/es-object-atoms/index.d.ts +3 -0
- package/node_modules/es-object-atoms/index.js +4 -0
- package/node_modules/es-object-atoms/isObject.d.ts +3 -0
- package/node_modules/es-object-atoms/isObject.js +6 -0
- package/node_modules/es-object-atoms/package.json +79 -0
- package/node_modules/es-object-atoms/test/index.js +38 -0
- package/node_modules/es-object-atoms/tsconfig.json +7 -0
- package/node_modules/es-set-tostringtag/.eslintrc +13 -0
- package/node_modules/es-set-tostringtag/.nycrc +9 -0
- package/node_modules/es-set-tostringtag/CHANGELOG.md +67 -0
- package/node_modules/es-set-tostringtag/LICENSE +21 -0
- package/node_modules/es-set-tostringtag/README.md +53 -0
- package/node_modules/es-set-tostringtag/index.d.ts +10 -0
- package/node_modules/es-set-tostringtag/index.js +35 -0
- package/node_modules/es-set-tostringtag/package.json +78 -0
- package/node_modules/es-set-tostringtag/test/index.js +85 -0
- package/node_modules/es-set-tostringtag/tsconfig.json +9 -0
- package/node_modules/form-data/CHANGELOG.md +686 -0
- package/node_modules/form-data/License +19 -0
- package/node_modules/form-data/README.md +355 -0
- package/node_modules/form-data/index.d.ts +62 -0
- package/node_modules/form-data/lib/browser.js +4 -0
- package/node_modules/form-data/lib/form_data.js +506 -0
- package/node_modules/form-data/lib/populate.js +10 -0
- package/node_modules/form-data/node_modules/mime-db/HISTORY.md +507 -0
- package/node_modules/form-data/node_modules/mime-db/LICENSE +23 -0
- package/node_modules/form-data/node_modules/mime-db/README.md +100 -0
- package/node_modules/form-data/node_modules/mime-db/db.json +8519 -0
- package/node_modules/form-data/node_modules/mime-db/index.js +12 -0
- package/node_modules/form-data/node_modules/mime-db/package.json +60 -0
- package/node_modules/form-data/node_modules/mime-types/HISTORY.md +397 -0
- package/node_modules/form-data/node_modules/mime-types/LICENSE +23 -0
- package/node_modules/form-data/node_modules/mime-types/README.md +113 -0
- package/node_modules/form-data/node_modules/mime-types/index.js +188 -0
- package/node_modules/form-data/node_modules/mime-types/package.json +44 -0
- package/node_modules/form-data/package.json +82 -0
- package/node_modules/function-bind/.eslintrc +21 -0
- package/node_modules/function-bind/.github/FUNDING.yml +12 -0
- package/node_modules/function-bind/.github/SECURITY.md +3 -0
- package/node_modules/function-bind/.nycrc +13 -0
- package/node_modules/function-bind/CHANGELOG.md +136 -0
- package/node_modules/function-bind/LICENSE +20 -0
- package/node_modules/function-bind/README.md +46 -0
- package/node_modules/function-bind/implementation.js +84 -0
- package/node_modules/function-bind/index.js +5 -0
- package/node_modules/function-bind/package.json +87 -0
- package/node_modules/function-bind/test/.eslintrc +9 -0
- package/node_modules/function-bind/test/index.js +252 -0
- package/node_modules/get-intrinsic/.eslintrc +42 -0
- package/node_modules/get-intrinsic/.github/FUNDING.yml +12 -0
- package/node_modules/get-intrinsic/.nycrc +9 -0
- package/node_modules/get-intrinsic/CHANGELOG.md +186 -0
- package/node_modules/get-intrinsic/LICENSE +21 -0
- package/node_modules/get-intrinsic/README.md +71 -0
- package/node_modules/get-intrinsic/index.js +378 -0
- package/node_modules/get-intrinsic/package.json +97 -0
- package/node_modules/get-intrinsic/test/GetIntrinsic.js +274 -0
- package/node_modules/get-proto/.eslintrc +10 -0
- package/node_modules/get-proto/.github/FUNDING.yml +12 -0
- package/node_modules/get-proto/.nycrc +9 -0
- package/node_modules/get-proto/CHANGELOG.md +21 -0
- package/node_modules/get-proto/LICENSE +21 -0
- package/node_modules/get-proto/Object.getPrototypeOf.d.ts +5 -0
- package/node_modules/get-proto/Object.getPrototypeOf.js +6 -0
- package/node_modules/get-proto/README.md +50 -0
- package/node_modules/get-proto/Reflect.getPrototypeOf.d.ts +3 -0
- package/node_modules/get-proto/Reflect.getPrototypeOf.js +4 -0
- package/node_modules/get-proto/index.d.ts +5 -0
- package/node_modules/get-proto/index.js +27 -0
- package/node_modules/get-proto/package.json +81 -0
- package/node_modules/get-proto/test/index.js +68 -0
- package/node_modules/get-proto/tsconfig.json +9 -0
- package/node_modules/gopd/.eslintrc +16 -0
- package/node_modules/gopd/.github/FUNDING.yml +12 -0
- package/node_modules/gopd/CHANGELOG.md +45 -0
- package/node_modules/gopd/LICENSE +21 -0
- package/node_modules/gopd/README.md +40 -0
- package/node_modules/gopd/gOPD.d.ts +1 -0
- package/node_modules/gopd/gOPD.js +4 -0
- package/node_modules/gopd/index.d.ts +5 -0
- package/node_modules/gopd/index.js +15 -0
- package/node_modules/gopd/package.json +77 -0
- package/node_modules/gopd/test/index.js +36 -0
- package/node_modules/gopd/tsconfig.json +9 -0
- package/node_modules/has-symbols/.eslintrc +11 -0
- package/node_modules/has-symbols/.github/FUNDING.yml +12 -0
- package/node_modules/has-symbols/.nycrc +9 -0
- package/node_modules/has-symbols/CHANGELOG.md +91 -0
- package/node_modules/has-symbols/LICENSE +21 -0
- package/node_modules/has-symbols/README.md +46 -0
- package/node_modules/has-symbols/index.d.ts +3 -0
- package/node_modules/has-symbols/index.js +14 -0
- package/node_modules/has-symbols/package.json +111 -0
- package/node_modules/has-symbols/shams.d.ts +3 -0
- package/node_modules/has-symbols/shams.js +45 -0
- package/node_modules/has-symbols/test/index.js +22 -0
- package/node_modules/has-symbols/test/shams/core-js.js +29 -0
- package/node_modules/has-symbols/test/shams/get-own-property-symbols.js +29 -0
- package/node_modules/has-symbols/test/tests.js +58 -0
- package/node_modules/has-symbols/tsconfig.json +10 -0
- package/node_modules/has-tostringtag/.eslintrc +5 -0
- package/node_modules/has-tostringtag/.github/FUNDING.yml +12 -0
- package/node_modules/has-tostringtag/.nycrc +13 -0
- package/node_modules/has-tostringtag/CHANGELOG.md +42 -0
- package/node_modules/has-tostringtag/LICENSE +21 -0
- package/node_modules/has-tostringtag/README.md +46 -0
- package/node_modules/has-tostringtag/index.d.ts +3 -0
- package/node_modules/has-tostringtag/index.js +8 -0
- package/node_modules/has-tostringtag/package.json +108 -0
- package/node_modules/has-tostringtag/shams.d.ts +3 -0
- package/node_modules/has-tostringtag/shams.js +8 -0
- package/node_modules/has-tostringtag/test/index.js +21 -0
- package/node_modules/has-tostringtag/test/shams/core-js.js +31 -0
- package/node_modules/has-tostringtag/test/shams/get-own-property-symbols.js +30 -0
- package/node_modules/has-tostringtag/test/tests.js +15 -0
- package/node_modules/has-tostringtag/tsconfig.json +49 -0
- package/node_modules/hasown/.github/FUNDING.yml +12 -0
- package/node_modules/hasown/.nycrc +13 -0
- package/node_modules/hasown/CHANGELOG.md +58 -0
- package/node_modules/hasown/LICENSE +21 -0
- package/node_modules/hasown/README.md +40 -0
- package/node_modules/hasown/eslint.config.mjs +6 -0
- package/node_modules/hasown/index.d.ts +3 -0
- package/node_modules/hasown/index.js +8 -0
- package/node_modules/hasown/package.json +91 -0
- package/node_modules/hasown/tsconfig.json +6 -0
- package/node_modules/json-bigint/LICENSE +20 -0
- package/node_modules/json-bigint/README.md +240 -0
- package/node_modules/json-bigint/index.js +12 -0
- package/node_modules/json-bigint/lib/parse.js +443 -0
- package/node_modules/json-bigint/lib/stringify.js +384 -0
- package/node_modules/json-bigint/package.json +34 -0
- package/node_modules/math-intrinsics/.eslintrc +16 -0
- package/node_modules/math-intrinsics/.github/FUNDING.yml +12 -0
- package/node_modules/math-intrinsics/CHANGELOG.md +24 -0
- package/node_modules/math-intrinsics/LICENSE +21 -0
- package/node_modules/math-intrinsics/README.md +50 -0
- package/node_modules/math-intrinsics/abs.d.ts +1 -0
- package/node_modules/math-intrinsics/abs.js +4 -0
- package/node_modules/math-intrinsics/constants/maxArrayLength.d.ts +3 -0
- package/node_modules/math-intrinsics/constants/maxArrayLength.js +4 -0
- package/node_modules/math-intrinsics/constants/maxSafeInteger.d.ts +3 -0
- package/node_modules/math-intrinsics/constants/maxSafeInteger.js +5 -0
- package/node_modules/math-intrinsics/constants/maxValue.d.ts +3 -0
- package/node_modules/math-intrinsics/constants/maxValue.js +5 -0
- package/node_modules/math-intrinsics/floor.d.ts +1 -0
- package/node_modules/math-intrinsics/floor.js +4 -0
- package/node_modules/math-intrinsics/isFinite.d.ts +3 -0
- package/node_modules/math-intrinsics/isFinite.js +12 -0
- package/node_modules/math-intrinsics/isInteger.d.ts +3 -0
- package/node_modules/math-intrinsics/isInteger.js +16 -0
- package/node_modules/math-intrinsics/isNaN.d.ts +1 -0
- package/node_modules/math-intrinsics/isNaN.js +6 -0
- package/node_modules/math-intrinsics/isNegativeZero.d.ts +3 -0
- package/node_modules/math-intrinsics/isNegativeZero.js +6 -0
- package/node_modules/math-intrinsics/max.d.ts +1 -0
- package/node_modules/math-intrinsics/max.js +4 -0
- package/node_modules/math-intrinsics/min.d.ts +1 -0
- package/node_modules/math-intrinsics/min.js +4 -0
- package/node_modules/math-intrinsics/mod.d.ts +3 -0
- package/node_modules/math-intrinsics/mod.js +9 -0
- package/node_modules/math-intrinsics/package.json +86 -0
- package/node_modules/math-intrinsics/pow.d.ts +1 -0
- package/node_modules/math-intrinsics/pow.js +4 -0
- package/node_modules/math-intrinsics/round.d.ts +1 -0
- package/node_modules/math-intrinsics/round.js +4 -0
- package/node_modules/math-intrinsics/sign.d.ts +3 -0
- package/node_modules/math-intrinsics/sign.js +11 -0
- package/node_modules/math-intrinsics/test/index.js +192 -0
- package/node_modules/math-intrinsics/tsconfig.json +3 -0
- package/node_modules/pako/LICENSE +21 -0
- package/node_modules/pako/README.md +155 -0
- package/node_modules/pako/dist/pako.es5.js +6760 -0
- package/node_modules/pako/dist/pako.es5.min.js +2 -0
- package/node_modules/pako/dist/pako.esm.mjs +6945 -0
- package/node_modules/pako/dist/pako.js +6964 -0
- package/node_modules/pako/dist/pako.min.js +2 -0
- package/node_modules/pako/dist/pako_deflate.es5.js +3953 -0
- package/node_modules/pako/dist/pako_deflate.es5.min.js +2 -0
- package/node_modules/pako/dist/pako_deflate.js +4154 -0
- package/node_modules/pako/dist/pako_deflate.min.js +2 -0
- package/node_modules/pako/dist/pako_inflate.es5.js +3272 -0
- package/node_modules/pako/dist/pako_inflate.es5.min.js +2 -0
- package/node_modules/pako/dist/pako_inflate.js +3279 -0
- package/node_modules/pako/dist/pako_inflate.min.js +2 -0
- package/node_modules/pako/index.js +18 -0
- package/node_modules/pako/lib/deflate.js +387 -0
- package/node_modules/pako/lib/inflate.js +456 -0
- package/node_modules/pako/lib/utils/common.js +48 -0
- package/node_modules/pako/lib/utils/strings.js +174 -0
- package/node_modules/pako/lib/zlib/README +59 -0
- package/node_modules/pako/lib/zlib/adler32.js +51 -0
- package/node_modules/pako/lib/zlib/constants.js +68 -0
- package/node_modules/pako/lib/zlib/crc32.js +59 -0
- package/node_modules/pako/lib/zlib/deflate.js +2069 -0
- package/node_modules/pako/lib/zlib/gzheader.js +58 -0
- package/node_modules/pako/lib/zlib/inffast.js +344 -0
- package/node_modules/pako/lib/zlib/inflate.js +1575 -0
- package/node_modules/pako/lib/zlib/inftrees.js +340 -0
- package/node_modules/pako/lib/zlib/messages.js +32 -0
- package/node_modules/pako/lib/zlib/trees.js +1179 -0
- package/node_modules/pako/lib/zlib/zstream.js +47 -0
- package/node_modules/pako/package.json +73 -0
- package/node_modules/semver/LICENSE +15 -0
- package/node_modules/semver/README.md +680 -0
- package/node_modules/semver/bin/semver.js +195 -0
- package/node_modules/semver/classes/comparator.js +143 -0
- package/node_modules/semver/classes/index.js +7 -0
- package/node_modules/semver/classes/range.js +577 -0
- package/node_modules/semver/classes/semver.js +350 -0
- package/node_modules/semver/functions/clean.js +8 -0
- package/node_modules/semver/functions/cmp.js +54 -0
- package/node_modules/semver/functions/coerce.js +62 -0
- package/node_modules/semver/functions/compare-build.js +9 -0
- package/node_modules/semver/functions/compare-loose.js +5 -0
- package/node_modules/semver/functions/compare.js +7 -0
- package/node_modules/semver/functions/diff.js +60 -0
- package/node_modules/semver/functions/eq.js +5 -0
- package/node_modules/semver/functions/gt.js +5 -0
- package/node_modules/semver/functions/gte.js +5 -0
- package/node_modules/semver/functions/inc.js +21 -0
- package/node_modules/semver/functions/lt.js +5 -0
- package/node_modules/semver/functions/lte.js +5 -0
- package/node_modules/semver/functions/major.js +5 -0
- package/node_modules/semver/functions/minor.js +5 -0
- package/node_modules/semver/functions/neq.js +5 -0
- package/node_modules/semver/functions/parse.js +18 -0
- package/node_modules/semver/functions/patch.js +5 -0
- package/node_modules/semver/functions/prerelease.js +8 -0
- package/node_modules/semver/functions/rcompare.js +5 -0
- package/node_modules/semver/functions/rsort.js +5 -0
- package/node_modules/semver/functions/satisfies.js +12 -0
- package/node_modules/semver/functions/sort.js +5 -0
- package/node_modules/semver/functions/truncate.js +48 -0
- package/node_modules/semver/functions/valid.js +8 -0
- package/node_modules/semver/index.js +93 -0
- package/node_modules/semver/internal/constants.js +37 -0
- package/node_modules/semver/internal/debug.js +11 -0
- package/node_modules/semver/internal/identifiers.js +29 -0
- package/node_modules/semver/internal/lrucache.js +42 -0
- package/node_modules/semver/internal/parse-options.js +17 -0
- package/node_modules/semver/internal/re.js +223 -0
- package/node_modules/semver/package.json +78 -0
- package/node_modules/semver/preload.js +4 -0
- package/node_modules/semver/range.bnf +17 -0
- package/node_modules/semver/ranges/gtr.js +6 -0
- package/node_modules/semver/ranges/intersects.js +9 -0
- package/node_modules/semver/ranges/ltr.js +6 -0
- package/node_modules/semver/ranges/max-satisfying.js +27 -0
- package/node_modules/semver/ranges/min-satisfying.js +26 -0
- package/node_modules/semver/ranges/min-version.js +63 -0
- package/node_modules/semver/ranges/outside.js +82 -0
- package/node_modules/semver/ranges/simplify.js +49 -0
- package/node_modules/semver/ranges/subset.js +249 -0
- package/node_modules/semver/ranges/to-comparators.js +10 -0
- package/node_modules/semver/ranges/valid.js +13 -0
- package/node_modules/spark-md5/LICENSE +13 -0
- package/node_modules/spark-md5/README.md +191 -0
- package/node_modules/spark-md5/package.json +35 -0
- package/node_modules/spark-md5/spark-md5.js +751 -0
- package/node_modules/spark-md5/spark-md5.min.js +1 -0
- package/node_modules/tldts/LICENSE +13 -0
- package/node_modules/tldts/README.md +327 -0
- package/node_modules/tldts/bin/cli.js +21 -0
- package/node_modules/tldts/dist/cjs/index.js +666 -0
- package/node_modules/tldts/dist/cjs/index.js.map +1 -0
- package/node_modules/tldts/dist/cjs/src/data/trie.js +14 -0
- package/node_modules/tldts/dist/cjs/src/data/trie.js.map +1 -0
- package/node_modules/tldts/dist/cjs/src/suffix-trie.js +67 -0
- package/node_modules/tldts/dist/cjs/src/suffix-trie.js.map +1 -0
- package/node_modules/tldts/dist/cjs/tsconfig.tsbuildinfo +1 -0
- package/node_modules/tldts/dist/es6/index.js +33 -0
- package/node_modules/tldts/dist/es6/index.js.map +1 -0
- package/node_modules/tldts/dist/es6/src/data/trie.js +11 -0
- package/node_modules/tldts/dist/es6/src/data/trie.js.map +1 -0
- package/node_modules/tldts/dist/es6/src/suffix-trie.js +64 -0
- package/node_modules/tldts/dist/es6/src/suffix-trie.js.map +1 -0
- package/node_modules/tldts/dist/es6/tsconfig.bundle.tsbuildinfo +1 -0
- package/node_modules/tldts/dist/index.cjs.min.js +2 -0
- package/node_modules/tldts/dist/index.cjs.min.js.map +1 -0
- package/node_modules/tldts/dist/index.esm.min.js +2 -0
- package/node_modules/tldts/dist/index.esm.min.js.map +1 -0
- package/node_modules/tldts/dist/index.umd.min.js +2 -0
- package/node_modules/tldts/dist/index.umd.min.js.map +1 -0
- package/node_modules/tldts/dist/types/index.d.ts +7 -0
- package/node_modules/tldts/dist/types/src/data/trie.d.ts +5 -0
- package/node_modules/tldts/dist/types/src/suffix-trie.d.ts +5 -0
- package/node_modules/tldts/index.ts +62 -0
- package/node_modules/tldts/package.json +91 -0
- package/node_modules/tldts/src/data/trie.ts +14 -0
- package/node_modules/tldts/src/suffix-trie.ts +110 -0
- package/node_modules/tldts-core/LICENSE +13 -0
- package/node_modules/tldts-core/README.md +3 -0
- package/node_modules/tldts-core/dist/cjs/index.js +561 -0
- package/node_modules/tldts-core/dist/cjs/index.js.map +1 -0
- package/node_modules/tldts-core/dist/cjs/src/domain-without-suffix.js +15 -0
- package/node_modules/tldts-core/dist/cjs/src/domain-without-suffix.js.map +1 -0
- package/node_modules/tldts-core/dist/cjs/src/domain.js +83 -0
- package/node_modules/tldts-core/dist/cjs/src/domain.js.map +1 -0
- package/node_modules/tldts-core/dist/cjs/src/extract-hostname.js +149 -0
- package/node_modules/tldts-core/dist/cjs/src/extract-hostname.js.map +1 -0
- package/node_modules/tldts-core/dist/cjs/src/factory.js +104 -0
- package/node_modules/tldts-core/dist/cjs/src/factory.js.map +1 -0
- package/node_modules/tldts-core/dist/cjs/src/is-ip.js +72 -0
- package/node_modules/tldts-core/dist/cjs/src/is-ip.js.map +1 -0
- package/node_modules/tldts-core/dist/cjs/src/is-valid.js +69 -0
- package/node_modules/tldts-core/dist/cjs/src/is-valid.js.map +1 -0
- package/node_modules/tldts-core/dist/cjs/src/lookup/fast-path.js +69 -0
- package/node_modules/tldts-core/dist/cjs/src/lookup/fast-path.js.map +1 -0
- package/node_modules/tldts-core/dist/cjs/src/lookup/interface.js +3 -0
- package/node_modules/tldts-core/dist/cjs/src/lookup/interface.js.map +1 -0
- package/node_modules/tldts-core/dist/cjs/src/options.js +22 -0
- package/node_modules/tldts-core/dist/cjs/src/options.js.map +1 -0
- package/node_modules/tldts-core/dist/cjs/src/subdomain.js +14 -0
- package/node_modules/tldts-core/dist/cjs/src/subdomain.js.map +1 -0
- package/node_modules/tldts-core/dist/cjs/tsconfig.tsbuildinfo +1 -0
- package/node_modules/tldts-core/dist/es6/index.js +4 -0
- package/node_modules/tldts-core/dist/es6/index.js.map +1 -0
- package/node_modules/tldts-core/dist/es6/src/domain-without-suffix.js +12 -0
- package/node_modules/tldts-core/dist/es6/src/domain-without-suffix.js.map +1 -0
- package/node_modules/tldts-core/dist/es6/src/domain.js +80 -0
- package/node_modules/tldts-core/dist/es6/src/domain.js.map +1 -0
- package/node_modules/tldts-core/dist/es6/src/extract-hostname.js +146 -0
- package/node_modules/tldts-core/dist/es6/src/extract-hostname.js.map +1 -0
- package/node_modules/tldts-core/dist/es6/src/factory.js +99 -0
- package/node_modules/tldts-core/dist/es6/src/factory.js.map +1 -0
- package/node_modules/tldts-core/dist/es6/src/is-ip.js +69 -0
- package/node_modules/tldts-core/dist/es6/src/is-ip.js.map +1 -0
- package/node_modules/tldts-core/dist/es6/src/is-valid.js +66 -0
- package/node_modules/tldts-core/dist/es6/src/is-valid.js.map +1 -0
- package/node_modules/tldts-core/dist/es6/src/lookup/fast-path.js +66 -0
- package/node_modules/tldts-core/dist/es6/src/lookup/fast-path.js.map +1 -0
- package/node_modules/tldts-core/dist/es6/src/lookup/interface.js +2 -0
- package/node_modules/tldts-core/dist/es6/src/lookup/interface.js.map +1 -0
- package/node_modules/tldts-core/dist/es6/src/options.js +19 -0
- package/node_modules/tldts-core/dist/es6/src/options.js.map +1 -0
- package/node_modules/tldts-core/dist/es6/src/subdomain.js +11 -0
- package/node_modules/tldts-core/dist/es6/src/subdomain.js.map +1 -0
- package/node_modules/tldts-core/dist/es6/tsconfig.bundle.tsbuildinfo +1 -0
- package/node_modules/tldts-core/dist/types/index.d.ts +4 -0
- package/node_modules/tldts-core/dist/types/src/domain-without-suffix.d.ts +6 -0
- package/node_modules/tldts-core/dist/types/src/domain.d.ts +5 -0
- package/node_modules/tldts-core/dist/types/src/extract-hostname.d.ts +5 -0
- package/node_modules/tldts-core/dist/types/src/factory.d.ts +28 -0
- package/node_modules/tldts-core/dist/types/src/is-ip.d.ts +6 -0
- package/node_modules/tldts-core/dist/types/src/is-valid.d.ts +15 -0
- package/node_modules/tldts-core/dist/types/src/lookup/fast-path.d.ts +2 -0
- package/node_modules/tldts-core/dist/types/src/lookup/interface.d.ts +9 -0
- package/node_modules/tldts-core/dist/types/src/options.d.ts +10 -0
- package/node_modules/tldts-core/dist/types/src/subdomain.d.ts +4 -0
- package/node_modules/tldts-core/index.ts +10 -0
- package/node_modules/tldts-core/package.json +68 -0
- package/node_modules/tldts-core/src/domain-without-suffix.ts +14 -0
- package/node_modules/tldts-core/src/domain.ts +100 -0
- package/node_modules/tldts-core/src/extract-hostname.ts +170 -0
- package/node_modules/tldts-core/src/factory.ts +160 -0
- package/node_modules/tldts-core/src/is-ip.ts +87 -0
- package/node_modules/tldts-core/src/is-valid.ts +79 -0
- package/node_modules/tldts-core/src/lookup/fast-path.ts +80 -0
- package/node_modules/tldts-core/src/lookup/interface.ts +10 -0
- package/node_modules/tldts-core/src/options.ts +39 -0
- package/node_modules/tldts-core/src/subdomain.ts +11 -0
- package/node_modules/tough-cookie/LICENSE +12 -0
- package/node_modules/tough-cookie/README.md +154 -0
- package/node_modules/tough-cookie/dist/cookie/canonicalDomain.d.ts +33 -0
- package/node_modules/tough-cookie/dist/cookie/canonicalDomain.js +65 -0
- package/node_modules/tough-cookie/dist/cookie/constants.d.ts +54 -0
- package/node_modules/tough-cookie/dist/cookie/constants.js +38 -0
- package/node_modules/tough-cookie/dist/cookie/cookie.d.ts +326 -0
- package/node_modules/tough-cookie/dist/cookie/cookie.js +831 -0
- package/node_modules/tough-cookie/dist/cookie/cookieCompare.d.ts +58 -0
- package/node_modules/tough-cookie/dist/cookie/cookieCompare.js +84 -0
- package/node_modules/tough-cookie/dist/cookie/cookieJar.d.ts +621 -0
- package/node_modules/tough-cookie/dist/cookie/cookieJar.js +1000 -0
- package/node_modules/tough-cookie/dist/cookie/defaultPath.d.ts +40 -0
- package/node_modules/tough-cookie/dist/cookie/defaultPath.js +60 -0
- package/node_modules/tough-cookie/dist/cookie/domainMatch.d.ts +38 -0
- package/node_modules/tough-cookie/dist/cookie/domainMatch.js +94 -0
- package/node_modules/tough-cookie/dist/cookie/formatDate.d.ts +15 -0
- package/node_modules/tough-cookie/dist/cookie/formatDate.js +20 -0
- package/node_modules/tough-cookie/dist/cookie/index.d.ts +29 -0
- package/node_modules/tough-cookie/dist/cookie/index.js +54 -0
- package/node_modules/tough-cookie/dist/cookie/parseDate.d.ts +103 -0
- package/node_modules/tough-cookie/dist/cookie/parseDate.js +323 -0
- package/node_modules/tough-cookie/dist/cookie/permutePath.d.ts +14 -0
- package/node_modules/tough-cookie/dist/cookie/permutePath.js +32 -0
- package/node_modules/tough-cookie/dist/getPublicSuffix.d.ts +55 -0
- package/node_modules/tough-cookie/dist/getPublicSuffix.js +71 -0
- package/node_modules/tough-cookie/dist/memstore.d.ts +220 -0
- package/node_modules/tough-cookie/dist/memstore.js +187 -0
- package/node_modules/tough-cookie/dist/pathMatch.d.ts +17 -0
- package/node_modules/tough-cookie/dist/pathMatch.js +40 -0
- package/node_modules/tough-cookie/dist/permuteDomain.d.ts +15 -0
- package/node_modules/tough-cookie/dist/permuteDomain.js +44 -0
- package/node_modules/tough-cookie/dist/store.d.ts +211 -0
- package/node_modules/tough-cookie/dist/store.js +76 -0
- package/node_modules/tough-cookie/dist/utils.d.ts +34 -0
- package/node_modules/tough-cookie/dist/utils.js +99 -0
- package/node_modules/tough-cookie/dist/validators.d.ts +24 -0
- package/node_modules/tough-cookie/dist/validators.js +90 -0
- package/node_modules/tough-cookie/dist/version.d.ts +5 -0
- package/node_modules/tough-cookie/dist/version.js +8 -0
- package/node_modules/tough-cookie/package.json +144 -0
- package/node_modules/ws/LICENSE +20 -0
- package/node_modules/ws/README.md +548 -0
- package/node_modules/ws/browser.js +8 -0
- package/node_modules/ws/index.js +22 -0
- package/node_modules/ws/lib/buffer-util.js +131 -0
- package/node_modules/ws/lib/constants.js +19 -0
- package/node_modules/ws/lib/event-target.js +292 -0
- package/node_modules/ws/lib/extension.js +203 -0
- package/node_modules/ws/lib/limiter.js +55 -0
- package/node_modules/ws/lib/permessage-deflate.js +530 -0
- package/node_modules/ws/lib/receiver.js +743 -0
- package/node_modules/ws/lib/sender.js +607 -0
- package/node_modules/ws/lib/stream.js +161 -0
- package/node_modules/ws/lib/subprotocol.js +62 -0
- package/node_modules/ws/lib/validation.js +152 -0
- package/node_modules/ws/lib/websocket-server.js +562 -0
- package/node_modules/ws/lib/websocket.js +1407 -0
- package/node_modules/ws/package.json +74 -0
- package/node_modules/ws/wrapper.mjs +21 -0
- package/node_modules/zca-js/.prettierrc +5 -0
- package/node_modules/zca-js/CODE_OF_CONDUCT.md +163 -0
- package/node_modules/zca-js/CONTRIBUTING.md +470 -0
- package/node_modules/zca-js/LICENSE +21 -0
- package/node_modules/zca-js/README.md +225 -0
- package/node_modules/zca-js/SECURITY.md +83 -0
- package/node_modules/zca-js/dist/Errors/ZaloApiError.d.ts +4 -0
- package/node_modules/zca-js/dist/Errors/ZaloApiError.js +7 -0
- package/node_modules/zca-js/dist/Errors/ZaloApiLoginQRAborted.d.ts +4 -0
- package/node_modules/zca-js/dist/Errors/ZaloApiLoginQRAborted.js +7 -0
- package/node_modules/zca-js/dist/Errors/ZaloApiLoginQRDeclined.d.ts +4 -0
- package/node_modules/zca-js/dist/Errors/ZaloApiLoginQRDeclined.js +7 -0
- package/node_modules/zca-js/dist/Errors/ZaloApiMissingImageMetadataGetter.d.ts +4 -0
- package/node_modules/zca-js/dist/Errors/ZaloApiMissingImageMetadataGetter.js +7 -0
- package/node_modules/zca-js/dist/Errors/index.d.ts +4 -0
- package/node_modules/zca-js/dist/Errors/index.js +4 -0
- package/node_modules/zca-js/dist/apis/acceptFriendRequest.d.ts +2 -0
- package/node_modules/zca-js/dist/apis/acceptFriendRequest.js +28 -0
- package/node_modules/zca-js/dist/apis/addGroupBlockedMember.d.ts +2 -0
- package/node_modules/zca-js/dist/apis/addGroupBlockedMember.js +28 -0
- package/node_modules/zca-js/dist/apis/addGroupDeputy.d.ts +2 -0
- package/node_modules/zca-js/dist/apis/addGroupDeputy.js +30 -0
- package/node_modules/zca-js/dist/apis/addPollOptions.d.ts +14 -0
- package/node_modules/zca-js/dist/apis/addPollOptions.js +26 -0
- package/node_modules/zca-js/dist/apis/addQuickMessage.d.ts +11 -0
- package/node_modules/zca-js/dist/apis/addQuickMessage.js +60 -0
- package/node_modules/zca-js/dist/apis/addReaction.d.ts +18 -0
- package/node_modules/zca-js/dist/apis/addReaction.js +294 -0
- package/node_modules/zca-js/dist/apis/addUnreadMark.d.ts +8 -0
- package/node_modules/zca-js/dist/apis/addUnreadMark.js +52 -0
- package/node_modules/zca-js/dist/apis/addUserToGroup.d.ts +5 -0
- package/node_modules/zca-js/dist/apis/addUserToGroup.js +34 -0
- package/node_modules/zca-js/dist/apis/blockUser.d.ts +2 -0
- package/node_modules/zca-js/dist/apis/blockUser.js +28 -0
- package/node_modules/zca-js/dist/apis/blockViewFeed.d.ts +2 -0
- package/node_modules/zca-js/dist/apis/blockViewFeed.js +30 -0
- package/node_modules/zca-js/dist/apis/changeAccountAvatar.d.ts +3 -0
- package/node_modules/zca-js/dist/apis/changeAccountAvatar.js +52 -0
- package/node_modules/zca-js/dist/apis/changeFriendAlias.d.ts +2 -0
- package/node_modules/zca-js/dist/apis/changeFriendAlias.js +27 -0
- package/node_modules/zca-js/dist/apis/changeGroupAvatar.d.ts +3 -0
- package/node_modules/zca-js/dist/apis/changeGroupAvatar.js +44 -0
- package/node_modules/zca-js/dist/apis/changeGroupName.d.ts +4 -0
- package/node_modules/zca-js/dist/apis/changeGroupName.js +32 -0
- package/node_modules/zca-js/dist/apis/changeGroupOwner.d.ts +4 -0
- package/node_modules/zca-js/dist/apis/changeGroupOwner.js +30 -0
- package/node_modules/zca-js/dist/apis/createAutoReply.d.ts +14 -0
- package/node_modules/zca-js/dist/apis/createAutoReply.js +37 -0
- package/node_modules/zca-js/dist/apis/createBankAccount.d.ts +8 -0
- package/node_modules/zca-js/dist/apis/createBankAccount.js +32 -0
- package/node_modules/zca-js/dist/apis/createCatalog.d.ts +7 -0
- package/node_modules/zca-js/dist/apis/createCatalog.js +29 -0
- package/node_modules/zca-js/dist/apis/createGroup.d.ts +28 -0
- package/node_modules/zca-js/dist/apis/createGroup.js +43 -0
- package/node_modules/zca-js/dist/apis/createNote.d.ts +7 -0
- package/node_modules/zca-js/dist/apis/createNote.js +47 -0
- package/node_modules/zca-js/dist/apis/createPoll.d.ts +36 -0
- package/node_modules/zca-js/dist/apis/createPoll.js +40 -0
- package/node_modules/zca-js/dist/apis/createProductCatalog.d.ts +23 -0
- package/node_modules/zca-js/dist/apis/createProductCatalog.js +50 -0
- package/node_modules/zca-js/dist/apis/createReminder.d.ts +12 -0
- package/node_modules/zca-js/dist/apis/createReminder.js +63 -0
- package/node_modules/zca-js/dist/apis/custom.d.ts +9 -0
- package/node_modules/zca-js/dist/apis/custom.js +15 -0
- package/node_modules/zca-js/dist/apis/deleteAutoReply.d.ts +5 -0
- package/node_modules/zca-js/dist/apis/deleteAutoReply.js +29 -0
- package/node_modules/zca-js/dist/apis/deleteAvatar.d.ts +9 -0
- package/node_modules/zca-js/dist/apis/deleteAvatar.js +27 -0
- package/node_modules/zca-js/dist/apis/deleteBankAccount.d.ts +11 -0
- package/node_modules/zca-js/dist/apis/deleteBankAccount.js +32 -0
- package/node_modules/zca-js/dist/apis/deleteCatalog.d.ts +2 -0
- package/node_modules/zca-js/dist/apis/deleteCatalog.js +28 -0
- package/node_modules/zca-js/dist/apis/deleteChat.d.ts +19 -0
- package/node_modules/zca-js/dist/apis/deleteChat.js +50 -0
- package/node_modules/zca-js/dist/apis/deleteGroupInviteBox.d.ts +9 -0
- package/node_modules/zca-js/dist/apis/deleteGroupInviteBox.js +27 -0
- package/node_modules/zca-js/dist/apis/deleteMessage.d.ts +14 -0
- package/node_modules/zca-js/dist/apis/deleteMessage.js +52 -0
- package/node_modules/zca-js/dist/apis/deleteProductCatalog.d.ts +10 -0
- package/node_modules/zca-js/dist/apis/deleteProductCatalog.js +31 -0
- package/node_modules/zca-js/dist/apis/deleteSnapshotMobileMsg.js +18 -0
- package/node_modules/zca-js/dist/apis/disableGroupLink.d.ts +2 -0
- package/node_modules/zca-js/dist/apis/disableGroupLink.js +24 -0
- package/node_modules/zca-js/dist/apis/disperseGroup.d.ts +2 -0
- package/node_modules/zca-js/dist/apis/disperseGroup.js +28 -0
- package/node_modules/zca-js/dist/apis/editNote.d.ts +17 -0
- package/node_modules/zca-js/dist/apis/editNote.js +46 -0
- package/node_modules/zca-js/dist/apis/editReminder.d.ts +13 -0
- package/node_modules/zca-js/dist/apis/editReminder.js +61 -0
- package/node_modules/zca-js/dist/apis/enableGroupLink.d.ts +6 -0
- package/node_modules/zca-js/dist/apis/enableGroupLink.js +25 -0
- package/node_modules/zca-js/dist/apis/fetchAccountInfo.d.ts +5 -0
- package/node_modules/zca-js/dist/apis/fetchAccountInfo.js +10 -0
- package/node_modules/zca-js/dist/apis/findUser.d.ts +3 -0
- package/node_modules/zca-js/dist/apis/findUser.js +42 -0
- package/node_modules/zca-js/dist/apis/findUserByUsername.d.ts +3 -0
- package/node_modules/zca-js/dist/apis/findUserByUsername.js +27 -0
- package/node_modules/zca-js/dist/apis/forwardMessage.d.ts +24 -0
- package/node_modules/zca-js/dist/apis/forwardMessage.js +114 -0
- package/node_modules/zca-js/dist/apis/getAliasList.d.ts +8 -0
- package/node_modules/zca-js/dist/apis/getAliasList.js +27 -0
- package/node_modules/zca-js/dist/apis/getAllFriends.d.ts +3 -0
- package/node_modules/zca-js/dist/apis/getAllFriends.js +34 -0
- package/node_modules/zca-js/dist/apis/getAllGroups.d.ts +7 -0
- package/node_modules/zca-js/dist/apis/getAllGroups.js +10 -0
- package/node_modules/zca-js/dist/apis/getArchivedChatList.d.ts +5 -0
- package/node_modules/zca-js/dist/apis/getArchivedChatList.js +23 -0
- package/node_modules/zca-js/dist/apis/getAutoDeleteChat.d.ts +9 -0
- package/node_modules/zca-js/dist/apis/getAutoDeleteChat.js +21 -0
- package/node_modules/zca-js/dist/apis/getAutoReplyList.d.ts +6 -0
- package/node_modules/zca-js/dist/apis/getAutoReplyList.js +24 -0
- package/node_modules/zca-js/dist/apis/getAvatarList.d.ts +12 -0
- package/node_modules/zca-js/dist/apis/getAvatarList.js +28 -0
- package/node_modules/zca-js/dist/apis/getAvatarUrlProfile.d.ts +7 -0
- package/node_modules/zca-js/dist/apis/getAvatarUrlProfile.js +30 -0
- package/node_modules/zca-js/dist/apis/getBizAccount.d.ts +24 -0
- package/node_modules/zca-js/dist/apis/getBizAccount.js +27 -0
- package/node_modules/zca-js/dist/apis/getCatalogList.d.ts +18 -0
- package/node_modules/zca-js/dist/apis/getCatalogList.js +32 -0
- package/node_modules/zca-js/dist/apis/getCloseFriends.d.ts +3 -0
- package/node_modules/zca-js/dist/apis/getCloseFriends.js +20 -0
- package/node_modules/zca-js/dist/apis/getContext.d.ts +1 -0
- package/node_modules/zca-js/dist/apis/getContext.js +4 -0
- package/node_modules/zca-js/dist/apis/getCookie.d.ts +1 -0
- package/node_modules/zca-js/dist/apis/getCookie.js +9 -0
- package/node_modules/zca-js/dist/apis/getCrossDB.js +18 -0
- package/node_modules/zca-js/dist/apis/getFriendBoardList.d.ts +5 -0
- package/node_modules/zca-js/dist/apis/getFriendBoardList.js +26 -0
- package/node_modules/zca-js/dist/apis/getFriendOnlines.d.ts +10 -0
- package/node_modules/zca-js/dist/apis/getFriendOnlines.js +35 -0
- package/node_modules/zca-js/dist/apis/getFriendRecommendations.d.ts +42 -0
- package/node_modules/zca-js/dist/apis/getFriendRecommendations.js +27 -0
- package/node_modules/zca-js/dist/apis/getFriendRequestStatus.d.ts +8 -0
- package/node_modules/zca-js/dist/apis/getFriendRequestStatus.js +25 -0
- package/node_modules/zca-js/dist/apis/getFullAvatar.d.ts +5 -0
- package/node_modules/zca-js/dist/apis/getFullAvatar.js +25 -0
- package/node_modules/zca-js/dist/apis/getGroupBlockedMember.d.ts +23 -0
- package/node_modules/zca-js/dist/apis/getGroupBlockedMember.js +29 -0
- package/node_modules/zca-js/dist/apis/getGroupChatHistory.d.ts +8 -0
- package/node_modules/zca-js/dist/apis/getGroupChatHistory.js +36 -0
- package/node_modules/zca-js/dist/apis/getGroupInfo.d.ts +16 -0
- package/node_modules/zca-js/dist/apis/getGroupInfo.js +32 -0
- package/node_modules/zca-js/dist/apis/getGroupInviteBoxInfo.d.ts +32 -0
- package/node_modules/zca-js/dist/apis/getGroupInviteBoxInfo.js +38 -0
- package/node_modules/zca-js/dist/apis/getGroupInviteBoxList.d.ts +38 -0
- package/node_modules/zca-js/dist/apis/getGroupInviteBoxList.js +31 -0
- package/node_modules/zca-js/dist/apis/getGroupLinkDetail.d.ts +9 -0
- package/node_modules/zca-js/dist/apis/getGroupLinkDetail.js +25 -0
- package/node_modules/zca-js/dist/apis/getGroupLinkInfo.d.ts +34 -0
- package/node_modules/zca-js/dist/apis/getGroupLinkInfo.js +28 -0
- package/node_modules/zca-js/dist/apis/getGroupMembersInfo.d.ts +17 -0
- package/node_modules/zca-js/dist/apis/getGroupMembersInfo.js +24 -0
- package/node_modules/zca-js/dist/apis/getHiddenConversations.d.ts +11 -0
- package/node_modules/zca-js/dist/apis/getHiddenConversations.js +23 -0
- package/node_modules/zca-js/dist/apis/getLabels.d.ts +7 -0
- package/node_modules/zca-js/dist/apis/getLabels.js +28 -0
- package/node_modules/zca-js/dist/apis/getListBank.d.ts +5 -0
- package/node_modules/zca-js/dist/apis/getListBank.js +20 -0
- package/node_modules/zca-js/dist/apis/getListBankAccount.d.ts +7 -0
- package/node_modules/zca-js/dist/apis/getListBankAccount.js +27 -0
- package/node_modules/zca-js/dist/apis/getListBoard.d.ts +21 -0
- package/node_modules/zca-js/dist/apis/getListBoard.js +45 -0
- package/node_modules/zca-js/dist/apis/getListDevice.d.ts +10 -0
- package/node_modules/zca-js/dist/apis/getListDevice.js +22 -0
- package/node_modules/zca-js/dist/apis/getListReminder.d.ts +28 -0
- package/node_modules/zca-js/dist/apis/getListReminder.js +47 -0
- package/node_modules/zca-js/dist/apis/getMultiUsersByPhones.d.ts +5 -0
- package/node_modules/zca-js/dist/apis/getMultiUsersByPhones.js +39 -0
- package/node_modules/zca-js/dist/apis/getMute.d.ts +13 -0
- package/node_modules/zca-js/dist/apis/getMute.js +22 -0
- package/node_modules/zca-js/dist/apis/getOwnId.d.ts +1 -0
- package/node_modules/zca-js/dist/apis/getOwnId.js +4 -0
- package/node_modules/zca-js/dist/apis/getPendingGroupMembers.d.ts +11 -0
- package/node_modules/zca-js/dist/apis/getPendingGroupMembers.js +27 -0
- package/node_modules/zca-js/dist/apis/getPinConversations.d.ts +5 -0
- package/node_modules/zca-js/dist/apis/getPinConversations.js +22 -0
- package/node_modules/zca-js/dist/apis/getPollDetail.d.ts +3 -0
- package/node_modules/zca-js/dist/apis/getPollDetail.js +30 -0
- package/node_modules/zca-js/dist/apis/getProductCatalogList.d.ts +20 -0
- package/node_modules/zca-js/dist/apis/getProductCatalogList.js +33 -0
- package/node_modules/zca-js/dist/apis/getQR.d.ts +4 -0
- package/node_modules/zca-js/dist/apis/getQR.js +29 -0
- package/node_modules/zca-js/dist/apis/getQuickMessageList.d.ts +7 -0
- package/node_modules/zca-js/dist/apis/getQuickMessageList.js +24 -0
- package/node_modules/zca-js/dist/apis/getRelatedFriendGroup.d.ts +6 -0
- package/node_modules/zca-js/dist/apis/getRelatedFriendGroup.js +30 -0
- package/node_modules/zca-js/dist/apis/getReminder.d.ts +3 -0
- package/node_modules/zca-js/dist/apis/getReminder.js +25 -0
- package/node_modules/zca-js/dist/apis/getReminderResponses.d.ts +5 -0
- package/node_modules/zca-js/dist/apis/getReminderResponses.js +24 -0
- package/node_modules/zca-js/dist/apis/getSentFriendRequest.d.ts +18 -0
- package/node_modules/zca-js/dist/apis/getSentFriendRequest.js +24 -0
- package/node_modules/zca-js/dist/apis/getSettings.d.ts +3 -0
- package/node_modules/zca-js/dist/apis/getSettings.js +20 -0
- package/node_modules/zca-js/dist/apis/getStickerCategoryDetail.d.ts +3 -0
- package/node_modules/zca-js/dist/apis/getStickerCategoryDetail.js +24 -0
- package/node_modules/zca-js/dist/apis/getStickers.d.ts +1 -0
- package/node_modules/zca-js/dist/apis/getStickers.js +40 -0
- package/node_modules/zca-js/dist/apis/getStickersDetail.d.ts +3 -0
- package/node_modules/zca-js/dist/apis/getStickersDetail.js +40 -0
- package/node_modules/zca-js/dist/apis/getUnreadMark.d.ts +14 -0
- package/node_modules/zca-js/dist/apis/getUnreadMark.js +30 -0
- package/node_modules/zca-js/dist/apis/getUserInfo.d.ts +8 -0
- package/node_modules/zca-js/dist/apis/getUserInfo.js +44 -0
- package/node_modules/zca-js/dist/apis/inviteUserToGroups.d.ts +10 -0
- package/node_modules/zca-js/dist/apis/inviteUserToGroups.js +30 -0
- package/node_modules/zca-js/dist/apis/joinGroupInviteBox.d.ts +2 -0
- package/node_modules/zca-js/dist/apis/joinGroupInviteBox.js +25 -0
- package/node_modules/zca-js/dist/apis/joinGroupLink.d.ts +2 -0
- package/node_modules/zca-js/dist/apis/joinGroupLink.js +27 -0
- package/node_modules/zca-js/dist/apis/keepAlive.d.ts +4 -0
- package/node_modules/zca-js/dist/apis/keepAlive.js +22 -0
- package/node_modules/zca-js/dist/apis/lastOnline.d.ts +7 -0
- package/node_modules/zca-js/dist/apis/lastOnline.js +26 -0
- package/node_modules/zca-js/dist/apis/leaveGroup.d.ts +4 -0
- package/node_modules/zca-js/dist/apis/leaveGroup.js +33 -0
- package/node_modules/zca-js/dist/apis/listen.d.ts +102 -0
- package/node_modules/zca-js/dist/apis/listen.js +425 -0
- package/node_modules/zca-js/dist/apis/lockPoll.d.ts +2 -0
- package/node_modules/zca-js/dist/apis/lockPoll.js +28 -0
- package/node_modules/zca-js/dist/apis/login.d.ts +3 -0
- package/node_modules/zca-js/dist/apis/login.js +96 -0
- package/node_modules/zca-js/dist/apis/loginQR.d.ts +71 -0
- package/node_modules/zca-js/dist/apis/loginQR.js +376 -0
- package/node_modules/zca-js/dist/apis/logoutV2.js +79 -0
- package/node_modules/zca-js/dist/apis/lostFocus.d.ts +4 -0
- package/node_modules/zca-js/dist/apis/lostFocus.js +23 -0
- package/node_modules/zca-js/dist/apis/parseLink.d.ts +21 -0
- package/node_modules/zca-js/dist/apis/parseLink.js +27 -0
- package/node_modules/zca-js/dist/apis/pullMobileMsg.js +22 -0
- package/node_modules/zca-js/dist/apis/registerCatalog.d.ts +2 -0
- package/node_modules/zca-js/dist/apis/registerCatalog.js +27 -0
- package/node_modules/zca-js/dist/apis/rejectFriendRequest.d.ts +2 -0
- package/node_modules/zca-js/dist/apis/rejectFriendRequest.js +27 -0
- package/node_modules/zca-js/dist/apis/removeFriend.d.ts +2 -0
- package/node_modules/zca-js/dist/apis/removeFriend.js +28 -0
- package/node_modules/zca-js/dist/apis/removeFriendAlias.d.ts +2 -0
- package/node_modules/zca-js/dist/apis/removeFriendAlias.js +24 -0
- package/node_modules/zca-js/dist/apis/removeGroupBlockedMember.d.ts +2 -0
- package/node_modules/zca-js/dist/apis/removeGroupBlockedMember.js +28 -0
- package/node_modules/zca-js/dist/apis/removeGroupDeputy.d.ts +2 -0
- package/node_modules/zca-js/dist/apis/removeGroupDeputy.js +30 -0
- package/node_modules/zca-js/dist/apis/removeQuickMessage.d.ts +5 -0
- package/node_modules/zca-js/dist/apis/removeQuickMessage.js +27 -0
- package/node_modules/zca-js/dist/apis/removeReminder.d.ts +3 -0
- package/node_modules/zca-js/dist/apis/removeReminder.js +40 -0
- package/node_modules/zca-js/dist/apis/removeUnreadMark.d.ts +8 -0
- package/node_modules/zca-js/dist/apis/removeUnreadMark.js +50 -0
- package/node_modules/zca-js/dist/apis/removeUserFromGroup.d.ts +4 -0
- package/node_modules/zca-js/dist/apis/removeUserFromGroup.js +34 -0
- package/node_modules/zca-js/dist/apis/requestSyncMessage.js +18 -0
- package/node_modules/zca-js/dist/apis/resetHiddenConversPin.d.ts +2 -0
- package/node_modules/zca-js/dist/apis/resetHiddenConversPin.js +20 -0
- package/node_modules/zca-js/dist/apis/reuseAvatar.d.ts +2 -0
- package/node_modules/zca-js/dist/apis/reuseAvatar.js +26 -0
- package/node_modules/zca-js/dist/apis/reviewPendingMemberRequest.d.ts +14 -0
- package/node_modules/zca-js/dist/apis/reviewPendingMemberRequest.js +38 -0
- package/node_modules/zca-js/dist/apis/scanURL.d.ts +4 -0
- package/node_modules/zca-js/dist/apis/scanURL.js +28 -0
- package/node_modules/zca-js/dist/apis/searchSticker.d.ts +3 -0
- package/node_modules/zca-js/dist/apis/searchSticker.js +28 -0
- package/node_modules/zca-js/dist/apis/sendBankCard.d.ts +9 -0
- package/node_modules/zca-js/dist/apis/sendBankCard.js +53 -0
- package/node_modules/zca-js/dist/apis/sendCard.d.ts +10 -0
- package/node_modules/zca-js/dist/apis/sendCard.js +75 -0
- package/node_modules/zca-js/dist/apis/sendDeliveredEvent.d.ts +16 -0
- package/node_modules/zca-js/dist/apis/sendDeliveredEvent.js +55 -0
- package/node_modules/zca-js/dist/apis/sendFriendRequest.d.ts +2 -0
- package/node_modules/zca-js/dist/apis/sendFriendRequest.js +39 -0
- package/node_modules/zca-js/dist/apis/sendLink.d.ts +10 -0
- package/node_modules/zca-js/dist/apis/sendLink.js +78 -0
- package/node_modules/zca-js/dist/apis/sendMessage.d.ts +105 -0
- package/node_modules/zca-js/dist/apis/sendMessage.js +486 -0
- package/node_modules/zca-js/dist/apis/sendReport.d.ts +17 -0
- package/node_modules/zca-js/dist/apis/sendReport.js +53 -0
- package/node_modules/zca-js/dist/apis/sendSeenEvent.d.ts +16 -0
- package/node_modules/zca-js/dist/apis/sendSeenEvent.js +63 -0
- package/node_modules/zca-js/dist/apis/sendSticker.d.ts +10 -0
- package/node_modules/zca-js/dist/apis/sendSticker.js +74 -0
- package/node_modules/zca-js/dist/apis/sendTypingEvent.d.ts +5 -0
- package/node_modules/zca-js/dist/apis/sendTypingEvent.js +33 -0
- package/node_modules/zca-js/dist/apis/sendVideo.d.ts +35 -0
- package/node_modules/zca-js/dist/apis/sendVideo.js +134 -0
- package/node_modules/zca-js/dist/apis/sendVoice.d.ts +12 -0
- package/node_modules/zca-js/dist/apis/sendVoice.js +89 -0
- package/node_modules/zca-js/dist/apis/setHiddenConversations.d.ts +3 -0
- package/node_modules/zca-js/dist/apis/setHiddenConversations.js +39 -0
- package/node_modules/zca-js/dist/apis/setMute.d.ts +20 -0
- package/node_modules/zca-js/dist/apis/setMute.js +67 -0
- package/node_modules/zca-js/dist/apis/setPinnedConversations.d.ts +3 -0
- package/node_modules/zca-js/dist/apis/setPinnedConversations.js +34 -0
- package/node_modules/zca-js/dist/apis/sharePoll.d.ts +2 -0
- package/node_modules/zca-js/dist/apis/sharePoll.js +28 -0
- package/node_modules/zca-js/dist/apis/unblockUser.d.ts +2 -0
- package/node_modules/zca-js/dist/apis/unblockUser.js +28 -0
- package/node_modules/zca-js/dist/apis/undo.d.ts +9 -0
- package/node_modules/zca-js/dist/apis/undo.js +42 -0
- package/node_modules/zca-js/dist/apis/undoFriendRequest.d.ts +2 -0
- package/node_modules/zca-js/dist/apis/undoFriendRequest.js +27 -0
- package/node_modules/zca-js/dist/apis/updateActiveStatus.d.ts +4 -0
- package/node_modules/zca-js/dist/apis/updateActiveStatus.js +27 -0
- package/node_modules/zca-js/dist/apis/updateArchivedChatList.d.ts +10 -0
- package/node_modules/zca-js/dist/apis/updateArchivedChatList.js +34 -0
- package/node_modules/zca-js/dist/apis/updateAutoDeleteChat.d.ts +9 -0
- package/node_modules/zca-js/dist/apis/updateAutoDeleteChat.js +40 -0
- package/node_modules/zca-js/dist/apis/updateAutoReply.d.ts +15 -0
- package/node_modules/zca-js/dist/apis/updateAutoReply.js +38 -0
- package/node_modules/zca-js/dist/apis/updateBankAccount.d.ts +9 -0
- package/node_modules/zca-js/dist/apis/updateBankAccount.js +31 -0
- package/node_modules/zca-js/dist/apis/updateCatalog.d.ts +11 -0
- package/node_modules/zca-js/dist/apis/updateCatalog.js +30 -0
- package/node_modules/zca-js/dist/apis/updateGroupSettings.d.ts +40 -0
- package/node_modules/zca-js/dist/apis/updateGroupSettings.js +43 -0
- package/node_modules/zca-js/dist/apis/updateHiddenConversPin.d.ts +2 -0
- package/node_modules/zca-js/dist/apis/updateHiddenConversPin.js +30 -0
- package/node_modules/zca-js/dist/apis/updateLabels.d.ts +15 -0
- package/node_modules/zca-js/dist/apis/updateLabels.js +34 -0
- package/node_modules/zca-js/dist/apis/updateLang.d.ts +6 -0
- package/node_modules/zca-js/dist/apis/updateLang.js +30 -0
- package/node_modules/zca-js/dist/apis/updateProductCatalog.d.ts +25 -0
- package/node_modules/zca-js/dist/apis/updateProductCatalog.js +51 -0
- package/node_modules/zca-js/dist/apis/updateProfile.d.ts +20 -0
- package/node_modules/zca-js/dist/apis/updateProfile.js +43 -0
- package/node_modules/zca-js/dist/apis/updateProfileBio.d.ts +2 -0
- package/node_modules/zca-js/dist/apis/updateProfileBio.js +27 -0
- package/node_modules/zca-js/dist/apis/updateQuickMessage.d.ts +11 -0
- package/node_modules/zca-js/dist/apis/updateQuickMessage.js +61 -0
- package/node_modules/zca-js/dist/apis/updateSettings.d.ts +16 -0
- package/node_modules/zca-js/dist/apis/updateSettings.js +90 -0
- package/node_modules/zca-js/dist/apis/upgradeGroupToCommunity.d.ts +2 -0
- package/node_modules/zca-js/dist/apis/upgradeGroupToCommunity.js +27 -0
- package/node_modules/zca-js/dist/apis/uploadAttachment.d.ts +50 -0
- package/node_modules/zca-js/dist/apis/uploadAttachment.js +197 -0
- package/node_modules/zca-js/dist/apis/uploadProductPhoto.d.ts +14 -0
- package/node_modules/zca-js/dist/apis/uploadProductPhoto.js +50 -0
- package/node_modules/zca-js/dist/apis/votePoll.d.ts +5 -0
- package/node_modules/zca-js/dist/apis/votePoll.js +29 -0
- package/node_modules/zca-js/dist/apis.d.ts +317 -0
- package/node_modules/zca-js/dist/apis.js +327 -0
- package/node_modules/zca-js/dist/cjs/Errors/ZaloApiError.cjs +11 -0
- package/node_modules/zca-js/dist/cjs/Errors/ZaloApiLoginQRAborted.cjs +12 -0
- package/node_modules/zca-js/dist/cjs/Errors/ZaloApiLoginQRDeclined.cjs +12 -0
- package/node_modules/zca-js/dist/cjs/Errors/ZaloApiMissingImageMetadataGetter.cjs +12 -0
- package/node_modules/zca-js/dist/cjs/apis/acceptFriendRequest.cjs +33 -0
- package/node_modules/zca-js/dist/cjs/apis/addGroupBlockedMember.cjs +33 -0
- package/node_modules/zca-js/dist/cjs/apis/addGroupDeputy.cjs +35 -0
- package/node_modules/zca-js/dist/cjs/apis/addPollOptions.cjs +31 -0
- package/node_modules/zca-js/dist/cjs/apis/addQuickMessage.cjs +65 -0
- package/node_modules/zca-js/dist/cjs/apis/addReaction.cjs +308 -0
- package/node_modules/zca-js/dist/cjs/apis/addUnreadMark.cjs +66 -0
- package/node_modules/zca-js/dist/cjs/apis/addUserToGroup.cjs +39 -0
- package/node_modules/zca-js/dist/cjs/apis/blockUser.cjs +33 -0
- package/node_modules/zca-js/dist/cjs/apis/blockViewFeed.cjs +35 -0
- package/node_modules/zca-js/dist/cjs/apis/changeAccountAvatar.cjs +57 -0
- package/node_modules/zca-js/dist/cjs/apis/changeFriendAlias.cjs +32 -0
- package/node_modules/zca-js/dist/cjs/apis/changeGroupAvatar.cjs +49 -0
- package/node_modules/zca-js/dist/cjs/apis/changeGroupName.cjs +37 -0
- package/node_modules/zca-js/dist/cjs/apis/changeGroupOwner.cjs +35 -0
- package/node_modules/zca-js/dist/cjs/apis/createAutoReply.cjs +42 -0
- package/node_modules/zca-js/dist/cjs/apis/createBankAccount.cjs +37 -0
- package/node_modules/zca-js/dist/cjs/apis/createCatalog.cjs +34 -0
- package/node_modules/zca-js/dist/cjs/apis/createGroup.cjs +48 -0
- package/node_modules/zca-js/dist/cjs/apis/createNote.cjs +52 -0
- package/node_modules/zca-js/dist/cjs/apis/createPoll.cjs +45 -0
- package/node_modules/zca-js/dist/cjs/apis/createProductCatalog.cjs +55 -0
- package/node_modules/zca-js/dist/cjs/apis/createReminder.cjs +77 -0
- package/node_modules/zca-js/dist/cjs/apis/custom.cjs +19 -0
- package/node_modules/zca-js/dist/cjs/apis/deleteAutoReply.cjs +34 -0
- package/node_modules/zca-js/dist/cjs/apis/deleteAvatar.cjs +32 -0
- package/node_modules/zca-js/dist/cjs/apis/deleteBankAccount.cjs +37 -0
- package/node_modules/zca-js/dist/cjs/apis/deleteCatalog.cjs +33 -0
- package/node_modules/zca-js/dist/cjs/apis/deleteChat.cjs +64 -0
- package/node_modules/zca-js/dist/cjs/apis/deleteGroupInviteBox.cjs +32 -0
- package/node_modules/zca-js/dist/cjs/apis/deleteMessage.cjs +66 -0
- package/node_modules/zca-js/dist/cjs/apis/deleteProductCatalog.cjs +36 -0
- package/node_modules/zca-js/dist/cjs/apis/deleteSnapshotMobileMsg.cjs +22 -0
- package/node_modules/zca-js/dist/cjs/apis/disableGroupLink.cjs +29 -0
- package/node_modules/zca-js/dist/cjs/apis/disperseGroup.cjs +33 -0
- package/node_modules/zca-js/dist/cjs/apis/editNote.cjs +51 -0
- package/node_modules/zca-js/dist/cjs/apis/editReminder.cjs +75 -0
- package/node_modules/zca-js/dist/cjs/apis/enableGroupLink.cjs +30 -0
- package/node_modules/zca-js/dist/cjs/apis/fetchAccountInfo.cjs +15 -0
- package/node_modules/zca-js/dist/cjs/apis/findUser.cjs +56 -0
- package/node_modules/zca-js/dist/cjs/apis/findUserByUsername.cjs +41 -0
- package/node_modules/zca-js/dist/cjs/apis/forwardMessage.cjs +129 -0
- package/node_modules/zca-js/dist/cjs/apis/getAliasList.cjs +32 -0
- package/node_modules/zca-js/dist/cjs/apis/getAllFriends.cjs +48 -0
- package/node_modules/zca-js/dist/cjs/apis/getAllGroups.cjs +15 -0
- package/node_modules/zca-js/dist/cjs/apis/getArchivedChatList.cjs +28 -0
- package/node_modules/zca-js/dist/cjs/apis/getAutoDeleteChat.cjs +26 -0
- package/node_modules/zca-js/dist/cjs/apis/getAutoReplyList.cjs +29 -0
- package/node_modules/zca-js/dist/cjs/apis/getAvatarList.cjs +33 -0
- package/node_modules/zca-js/dist/cjs/apis/getAvatarUrlProfile.cjs +44 -0
- package/node_modules/zca-js/dist/cjs/apis/getBizAccount.cjs +32 -0
- package/node_modules/zca-js/dist/cjs/apis/getCatalogList.cjs +37 -0
- package/node_modules/zca-js/dist/cjs/apis/getCloseFriends.cjs +25 -0
- package/node_modules/zca-js/dist/cjs/apis/getContext.cjs +9 -0
- package/node_modules/zca-js/dist/cjs/apis/getCookie.cjs +14 -0
- package/node_modules/zca-js/dist/cjs/apis/getCrossDB.cjs +22 -0
- package/node_modules/zca-js/dist/cjs/apis/getFriendBoardList.cjs +31 -0
- package/node_modules/zca-js/dist/cjs/apis/getFriendOnlines.cjs +40 -0
- package/node_modules/zca-js/dist/cjs/apis/getFriendRecommendations.cjs +32 -0
- package/node_modules/zca-js/dist/cjs/apis/getFriendRequestStatus.cjs +30 -0
- package/node_modules/zca-js/dist/cjs/apis/getFullAvatar.cjs +30 -0
- package/node_modules/zca-js/dist/cjs/apis/getGroupBlockedMember.cjs +34 -0
- package/node_modules/zca-js/dist/cjs/apis/getGroupChatHistory.cjs +51 -0
- package/node_modules/zca-js/dist/cjs/apis/getGroupInfo.cjs +37 -0
- package/node_modules/zca-js/dist/cjs/apis/getGroupInviteBoxInfo.cjs +43 -0
- package/node_modules/zca-js/dist/cjs/apis/getGroupInviteBoxList.cjs +36 -0
- package/node_modules/zca-js/dist/cjs/apis/getGroupLinkDetail.cjs +30 -0
- package/node_modules/zca-js/dist/cjs/apis/getGroupLinkInfo.cjs +33 -0
- package/node_modules/zca-js/dist/cjs/apis/getGroupMembersInfo.cjs +29 -0
- package/node_modules/zca-js/dist/cjs/apis/getHiddenConversations.cjs +28 -0
- package/node_modules/zca-js/dist/cjs/apis/getLabels.cjs +33 -0
- package/node_modules/zca-js/dist/cjs/apis/getListBank.cjs +25 -0
- package/node_modules/zca-js/dist/cjs/apis/getListBankAccount.cjs +32 -0
- package/node_modules/zca-js/dist/cjs/apis/getListBoard.cjs +59 -0
- package/node_modules/zca-js/dist/cjs/apis/getListDevice.cjs +27 -0
- package/node_modules/zca-js/dist/cjs/apis/getListReminder.cjs +61 -0
- package/node_modules/zca-js/dist/cjs/apis/getMultiUsersByPhones.cjs +53 -0
- package/node_modules/zca-js/dist/cjs/apis/getMute.cjs +27 -0
- package/node_modules/zca-js/dist/cjs/apis/getOwnId.cjs +9 -0
- package/node_modules/zca-js/dist/cjs/apis/getPendingGroupMembers.cjs +32 -0
- package/node_modules/zca-js/dist/cjs/apis/getPinConversations.cjs +27 -0
- package/node_modules/zca-js/dist/cjs/apis/getPollDetail.cjs +35 -0
- package/node_modules/zca-js/dist/cjs/apis/getProductCatalogList.cjs +38 -0
- package/node_modules/zca-js/dist/cjs/apis/getQR.cjs +34 -0
- package/node_modules/zca-js/dist/cjs/apis/getQuickMessageList.cjs +29 -0
- package/node_modules/zca-js/dist/cjs/apis/getRelatedFriendGroup.cjs +35 -0
- package/node_modules/zca-js/dist/cjs/apis/getReminder.cjs +30 -0
- package/node_modules/zca-js/dist/cjs/apis/getReminderResponses.cjs +29 -0
- package/node_modules/zca-js/dist/cjs/apis/getSentFriendRequest.cjs +29 -0
- package/node_modules/zca-js/dist/cjs/apis/getSettings.cjs +25 -0
- package/node_modules/zca-js/dist/cjs/apis/getStickerCategoryDetail.cjs +29 -0
- package/node_modules/zca-js/dist/cjs/apis/getStickers.cjs +45 -0
- package/node_modules/zca-js/dist/cjs/apis/getStickersDetail.cjs +45 -0
- package/node_modules/zca-js/dist/cjs/apis/getUnreadMark.cjs +35 -0
- package/node_modules/zca-js/dist/cjs/apis/getUserInfo.cjs +58 -0
- package/node_modules/zca-js/dist/cjs/apis/inviteUserToGroups.cjs +35 -0
- package/node_modules/zca-js/dist/cjs/apis/joinGroupInviteBox.cjs +30 -0
- package/node_modules/zca-js/dist/cjs/apis/joinGroupLink.cjs +32 -0
- package/node_modules/zca-js/dist/cjs/apis/keepAlive.cjs +27 -0
- package/node_modules/zca-js/dist/cjs/apis/lastOnline.cjs +31 -0
- package/node_modules/zca-js/dist/cjs/apis/leaveGroup.cjs +38 -0
- package/node_modules/zca-js/dist/cjs/apis/listen.cjs +440 -0
- package/node_modules/zca-js/dist/cjs/apis/lockPoll.cjs +33 -0
- package/node_modules/zca-js/dist/cjs/apis/login.cjs +102 -0
- package/node_modules/zca-js/dist/cjs/apis/loginQR.cjs +368 -0
- package/node_modules/zca-js/dist/cjs/apis/logoutV2.cjs +83 -0
- package/node_modules/zca-js/dist/cjs/apis/lostFocus.cjs +28 -0
- package/node_modules/zca-js/dist/cjs/apis/parseLink.cjs +32 -0
- package/node_modules/zca-js/dist/cjs/apis/pullMobileMsg.cjs +26 -0
- package/node_modules/zca-js/dist/cjs/apis/registerCatalog.cjs +32 -0
- package/node_modules/zca-js/dist/cjs/apis/rejectFriendRequest.cjs +32 -0
- package/node_modules/zca-js/dist/cjs/apis/removeFriend.cjs +33 -0
- package/node_modules/zca-js/dist/cjs/apis/removeFriendAlias.cjs +29 -0
- package/node_modules/zca-js/dist/cjs/apis/removeGroupBlockedMember.cjs +33 -0
- package/node_modules/zca-js/dist/cjs/apis/removeGroupDeputy.cjs +35 -0
- package/node_modules/zca-js/dist/cjs/apis/removeQuickMessage.cjs +32 -0
- package/node_modules/zca-js/dist/cjs/apis/removeReminder.cjs +54 -0
- package/node_modules/zca-js/dist/cjs/apis/removeUnreadMark.cjs +64 -0
- package/node_modules/zca-js/dist/cjs/apis/removeUserFromGroup.cjs +39 -0
- package/node_modules/zca-js/dist/cjs/apis/requestSyncMessage.cjs +22 -0
- package/node_modules/zca-js/dist/cjs/apis/resetHiddenConversPin.cjs +25 -0
- package/node_modules/zca-js/dist/cjs/apis/reuseAvatar.cjs +31 -0
- package/node_modules/zca-js/dist/cjs/apis/reviewPendingMemberRequest.cjs +43 -0
- package/node_modules/zca-js/dist/cjs/apis/scanURL.cjs +33 -0
- package/node_modules/zca-js/dist/cjs/apis/searchSticker.cjs +33 -0
- package/node_modules/zca-js/dist/cjs/apis/sendBankCard.cjs +68 -0
- package/node_modules/zca-js/dist/cjs/apis/sendCard.cjs +89 -0
- package/node_modules/zca-js/dist/cjs/apis/sendDeliveredEvent.cjs +69 -0
- package/node_modules/zca-js/dist/cjs/apis/sendFriendRequest.cjs +44 -0
- package/node_modules/zca-js/dist/cjs/apis/sendLink.cjs +92 -0
- package/node_modules/zca-js/dist/cjs/apis/sendMessage.cjs +500 -0
- package/node_modules/zca-js/dist/cjs/apis/sendReport.cjs +67 -0
- package/node_modules/zca-js/dist/cjs/apis/sendSeenEvent.cjs +77 -0
- package/node_modules/zca-js/dist/cjs/apis/sendSticker.cjs +88 -0
- package/node_modules/zca-js/dist/cjs/apis/sendTypingEvent.cjs +47 -0
- package/node_modules/zca-js/dist/cjs/apis/sendVideo.cjs +148 -0
- package/node_modules/zca-js/dist/cjs/apis/sendVoice.cjs +103 -0
- package/node_modules/zca-js/dist/cjs/apis/setHiddenConversations.cjs +53 -0
- package/node_modules/zca-js/dist/cjs/apis/setMute.cjs +81 -0
- package/node_modules/zca-js/dist/cjs/apis/setPinnedConversations.cjs +48 -0
- package/node_modules/zca-js/dist/cjs/apis/sharePoll.cjs +33 -0
- package/node_modules/zca-js/dist/cjs/apis/unblockUser.cjs +33 -0
- package/node_modules/zca-js/dist/cjs/apis/undo.cjs +56 -0
- package/node_modules/zca-js/dist/cjs/apis/undoFriendRequest.cjs +32 -0
- package/node_modules/zca-js/dist/cjs/apis/updateActiveStatus.cjs +32 -0
- package/node_modules/zca-js/dist/cjs/apis/updateArchivedChatList.cjs +39 -0
- package/node_modules/zca-js/dist/cjs/apis/updateAutoDeleteChat.cjs +54 -0
- package/node_modules/zca-js/dist/cjs/apis/updateAutoReply.cjs +43 -0
- package/node_modules/zca-js/dist/cjs/apis/updateBankAccount.cjs +36 -0
- package/node_modules/zca-js/dist/cjs/apis/updateCatalog.cjs +35 -0
- package/node_modules/zca-js/dist/cjs/apis/updateGroupSettings.cjs +48 -0
- package/node_modules/zca-js/dist/cjs/apis/updateHiddenConversPin.cjs +35 -0
- package/node_modules/zca-js/dist/cjs/apis/updateLabels.cjs +39 -0
- package/node_modules/zca-js/dist/cjs/apis/updateLang.cjs +35 -0
- package/node_modules/zca-js/dist/cjs/apis/updateProductCatalog.cjs +56 -0
- package/node_modules/zca-js/dist/cjs/apis/updateProfile.cjs +48 -0
- package/node_modules/zca-js/dist/cjs/apis/updateProfileBio.cjs +32 -0
- package/node_modules/zca-js/dist/cjs/apis/updateQuickMessage.cjs +66 -0
- package/node_modules/zca-js/dist/cjs/apis/updateSettings.cjs +95 -0
- package/node_modules/zca-js/dist/cjs/apis/upgradeGroupToCommunity.cjs +32 -0
- package/node_modules/zca-js/dist/cjs/apis/uploadAttachment.cjs +211 -0
- package/node_modules/zca-js/dist/cjs/apis/uploadProductPhoto.cjs +55 -0
- package/node_modules/zca-js/dist/cjs/apis/votePoll.cjs +34 -0
- package/node_modules/zca-js/dist/cjs/apis.cjs +332 -0
- package/node_modules/zca-js/dist/cjs/context.cjs +34 -0
- package/node_modules/zca-js/dist/cjs/index.cjs +159 -0
- package/node_modules/zca-js/dist/cjs/models/AutoReply.cjs +9 -0
- package/node_modules/zca-js/dist/cjs/models/Bank.cjs +263 -0
- package/node_modules/zca-js/dist/cjs/models/Board.cjs +8 -0
- package/node_modules/zca-js/dist/cjs/models/DeliveredMessage.cjs +23 -0
- package/node_modules/zca-js/dist/cjs/models/Enum.cjs +27 -0
- package/node_modules/zca-js/dist/cjs/models/FriendEvent.cjs +87 -0
- package/node_modules/zca-js/dist/cjs/models/Group.cjs +13 -0
- package/node_modules/zca-js/dist/cjs/models/GroupEvent.cjs +94 -0
- package/node_modules/zca-js/dist/cjs/models/Message.cjs +35 -0
- package/node_modules/zca-js/dist/cjs/models/Reaction.cjs +74 -0
- package/node_modules/zca-js/dist/cjs/models/Reminder.cjs +9 -0
- package/node_modules/zca-js/dist/cjs/models/SeenMessage.cjs +23 -0
- package/node_modules/zca-js/dist/cjs/models/Typing.cjs +23 -0
- package/node_modules/zca-js/dist/cjs/models/Undo.cjs +16 -0
- package/node_modules/zca-js/dist/cjs/models/ZBusiness.cjs +39 -0
- package/node_modules/zca-js/dist/cjs/update.cjs +34 -0
- package/node_modules/zca-js/dist/cjs/utils.cjs +703 -0
- package/node_modules/zca-js/dist/cjs/zalo.cjs +112 -0
- package/node_modules/zca-js/dist/context.d.ts +179 -0
- package/node_modules/zca-js/dist/context.js +28 -0
- package/node_modules/zca-js/dist/index.d.ts +166 -0
- package/node_modules/zca-js/dist/index.js +14 -0
- package/node_modules/zca-js/dist/models/Attachment.d.ts +9 -0
- package/node_modules/zca-js/dist/models/Attachment.js +1 -0
- package/node_modules/zca-js/dist/models/AutoReply.d.ts +20 -0
- package/node_modules/zca-js/dist/models/AutoReply.js +7 -0
- package/node_modules/zca-js/dist/models/Bank.d.ts +291 -0
- package/node_modules/zca-js/dist/models/Bank.js +262 -0
- package/node_modules/zca-js/dist/models/Board.d.ts +60 -0
- package/node_modules/zca-js/dist/models/Board.js +6 -0
- package/node_modules/zca-js/dist/models/Catalog.d.ts +16 -0
- package/node_modules/zca-js/dist/models/Catalog.js +1 -0
- package/node_modules/zca-js/dist/models/DeliveredMessage.d.ts +27 -0
- package/node_modules/zca-js/dist/models/DeliveredMessage.js +17 -0
- package/node_modules/zca-js/dist/models/Enum.d.ts +21 -0
- package/node_modules/zca-js/dist/models/Enum.js +25 -0
- package/node_modules/zca-js/dist/models/FriendEvent.d.ts +107 -0
- package/node_modules/zca-js/dist/models/FriendEvent.js +83 -0
- package/node_modules/zca-js/dist/models/Group.d.ts +125 -0
- package/node_modules/zca-js/dist/models/Group.js +11 -0
- package/node_modules/zca-js/dist/models/GroupEvent.d.ts +178 -0
- package/node_modules/zca-js/dist/models/GroupEvent.js +90 -0
- package/node_modules/zca-js/dist/models/Label.d.ts +10 -0
- package/node_modules/zca-js/dist/models/Label.js +1 -0
- package/node_modules/zca-js/dist/models/Message.d.ts +91 -0
- package/node_modules/zca-js/dist/models/Message.js +29 -0
- package/node_modules/zca-js/dist/models/ProductCatalog.d.ts +17 -0
- package/node_modules/zca-js/dist/models/ProductCatalog.js +1 -0
- package/node_modules/zca-js/dist/models/QuickMessage.d.ts +25 -0
- package/node_modules/zca-js/dist/models/QuickMessage.js +1 -0
- package/node_modules/zca-js/dist/models/Reaction.d.ts +85 -0
- package/node_modules/zca-js/dist/models/Reaction.js +70 -0
- package/node_modules/zca-js/dist/models/Reminder.d.ts +51 -0
- package/node_modules/zca-js/dist/models/Reminder.js +7 -0
- package/node_modules/zca-js/dist/models/SeenMessage.d.ts +26 -0
- package/node_modules/zca-js/dist/models/SeenMessage.js +17 -0
- package/node_modules/zca-js/dist/models/Sticker.d.ts +27 -0
- package/node_modules/zca-js/dist/models/Sticker.js +1 -0
- package/node_modules/zca-js/dist/models/Typing.d.ts +24 -0
- package/node_modules/zca-js/dist/models/Typing.js +17 -0
- package/node_modules/zca-js/dist/models/Undo.d.ts +34 -0
- package/node_modules/zca-js/dist/models/Undo.js +12 -0
- package/node_modules/zca-js/dist/models/User.d.ts +70 -0
- package/node_modules/zca-js/dist/models/User.js +1 -0
- package/node_modules/zca-js/dist/models/ZBusiness.d.ts +22 -0
- package/node_modules/zca-js/dist/models/ZBusiness.js +35 -0
- package/node_modules/zca-js/dist/models/index.d.ts +22 -0
- package/node_modules/zca-js/dist/models/index.js +22 -0
- package/node_modules/zca-js/dist/update.d.ts +2 -0
- package/node_modules/zca-js/dist/update.js +29 -0
- package/node_modules/zca-js/dist/utils.d.ts +167 -0
- package/node_modules/zca-js/dist/utils.js +719 -0
- package/node_modules/zca-js/dist/zalo.d.ts +41 -0
- package/node_modules/zca-js/dist/zalo.js +107 -0
- package/node_modules/zca-js/eslint.config.js +21 -0
- package/node_modules/zca-js/index.d.ts +2 -0
- package/node_modules/zca-js/package.json +78 -0
- package/node_modules/zca-js/rollup.config.js +28 -0
- package/package.json +79 -62
- package/patches/zca-js+2.2.0.patch +1677 -0
- package/src/cli.test.js +34 -5
- package/src/commands/account.js +98 -5
- package/src/commands/auto-reply.js +30 -10
- package/src/commands/catalog.js +5 -4
- package/src/commands/conv.js +551 -14
- package/src/commands/friend.js +19 -7
- package/src/commands/group.js +82 -31
- package/src/commands/listen.js +607 -65
- package/src/commands/login.js +179 -20
- package/src/commands/mcp.js +392 -41
- package/src/commands/msg.js +1278 -139
- package/src/commands/oa-listen.js +130 -20
- package/src/commands/oa.js +26 -5
- package/src/commands/poll.js +7 -2
- package/src/commands/profile.js +3 -2
- package/src/commands/sync.js +2052 -0
- package/src/core/accounts.js +69 -6
- package/src/core/cached-message.js +200 -0
- package/src/core/coverage.js +90 -0
- package/src/core/daemon-channel.js +638 -0
- package/src/core/daemon-sync.js +181 -0
- package/src/core/db.js +1610 -0
- package/src/core/forward.js +112 -0
- package/src/core/group-history.js +248 -0
- package/src/core/group-members.js +68 -0
- package/src/core/group-settings.js +250 -0
- package/src/core/history-fetch.js +208 -0
- package/src/core/listener-lifecycle.js +90 -0
- package/src/core/live-api.js +47 -0
- package/src/core/live-store.js +733 -0
- package/src/core/lock.js +129 -0
- package/src/core/logout.js +289 -0
- package/src/core/offline-queue.js +194 -0
- package/src/core/pin.js +222 -0
- package/src/core/read-state.js +318 -0
- package/src/core/receipts.js +679 -0
- package/src/core/recent-conversations.js +30 -0
- package/src/core/self-heal.js +522 -0
- package/src/core/socket-tap.js +154 -0
- package/src/core/sync-v2/assets.js +181 -0
- package/src/core/sync-v2/board.js +338 -0
- package/src/core/sync-v2/conv-state.js +152 -0
- package/src/core/sync-v2/gap-advice.js +110 -0
- package/src/core/sync-v2/gid.js +103 -0
- package/src/core/sync-v2/index.js +1208 -0
- package/src/core/sync-v2/keepalive.js +177 -0
- package/src/core/sync-v2/media.js +704 -0
- package/src/core/sync-v2/message-types.js +522 -0
- package/src/core/sync-v2/plan.js +95 -0
- package/src/core/sync-v2/reactions.js +236 -0
- package/src/core/sync-v2/renewlink.js +124 -0
- package/src/core/sync-v2/zcloud-cipher.js +88 -0
- package/src/core/sync-v2/zcloud.js +675 -0
- package/src/core/sync.js +540 -0
- package/src/core/zalo-client.js +179 -61
- package/src/core/zca-custom.js +78 -0
- package/src/index.js +14 -3
- package/src/mcp/mcp-config.js +40 -3
- package/src/mcp/mcp-http-transport.js +11 -2
- package/src/mcp/mcp-server.js +4 -2
- package/src/mcp/mcp-tools.js +837 -97
- package/src/mcp/message-buffer.js +38 -8
- package/src/mcp/message-buffer.test.js +67 -15
- package/src/mcp/notifier.js +17 -1
- package/src/mcp/notifier.test.js +6 -0
- package/src/utils/bank-helpers.js +8 -3
- package/src/utils/device-fingerprint.js +72 -0
- package/src/utils/mentions.js +140 -0
- package/src/utils/my-documents.js +95 -0
- package/src/utils/open-file.js +49 -0
- package/src/utils/output.js +75 -4
- package/src/utils/parse-options.js +56 -0
- package/src/utils/qr-http-server.js +44 -7
- package/src/utils/quote.js +203 -0
- package/src/utils/thread-type.js +72 -0
- package/src/utils/update-check.js +42 -1
- package/src/utils/urgency.js +29 -0
- package/src/mcp/media-downloader.js +0 -191
- package/src/mcp/media-downloader.test.js +0 -45
- package/src/utils/qr-display.test.js +0 -97
|
@@ -0,0 +1,2069 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
// (C) 1995-2013 Jean-loup Gailly and Mark Adler
|
|
4
|
+
// (C) 2014-2017 Vitaly Puzrin and Andrey Tupitsin
|
|
5
|
+
//
|
|
6
|
+
// This software is provided 'as-is', without any express or implied
|
|
7
|
+
// warranty. In no event will the authors be held liable for any damages
|
|
8
|
+
// arising from the use of this software.
|
|
9
|
+
//
|
|
10
|
+
// Permission is granted to anyone to use this software for any purpose,
|
|
11
|
+
// including commercial applications, and to alter it and redistribute it
|
|
12
|
+
// freely, subject to the following restrictions:
|
|
13
|
+
//
|
|
14
|
+
// 1. The origin of this software must not be misrepresented; you must not
|
|
15
|
+
// claim that you wrote the original software. If you use this software
|
|
16
|
+
// in a product, an acknowledgment in the product documentation would be
|
|
17
|
+
// appreciated but is not required.
|
|
18
|
+
// 2. Altered source versions must be plainly marked as such, and must not be
|
|
19
|
+
// misrepresented as being the original software.
|
|
20
|
+
// 3. This notice may not be removed or altered from any source distribution.
|
|
21
|
+
|
|
22
|
+
const { _tr_init, _tr_stored_block, _tr_flush_block, _tr_tally, _tr_align } = require('./trees');
|
|
23
|
+
const adler32 = require('./adler32');
|
|
24
|
+
const crc32 = require('./crc32');
|
|
25
|
+
const msg = require('./messages');
|
|
26
|
+
|
|
27
|
+
/* Public constants ==========================================================*/
|
|
28
|
+
/* ===========================================================================*/
|
|
29
|
+
|
|
30
|
+
const {
|
|
31
|
+
Z_NO_FLUSH, Z_PARTIAL_FLUSH, Z_FULL_FLUSH, Z_FINISH, Z_BLOCK,
|
|
32
|
+
Z_OK, Z_STREAM_END, Z_STREAM_ERROR, Z_DATA_ERROR, Z_BUF_ERROR,
|
|
33
|
+
Z_DEFAULT_COMPRESSION,
|
|
34
|
+
Z_FILTERED, Z_HUFFMAN_ONLY, Z_RLE, Z_FIXED, Z_DEFAULT_STRATEGY,
|
|
35
|
+
Z_UNKNOWN,
|
|
36
|
+
Z_DEFLATED
|
|
37
|
+
} = require('./constants');
|
|
38
|
+
|
|
39
|
+
/*============================================================================*/
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
const MAX_MEM_LEVEL = 9;
|
|
43
|
+
/* Maximum value for memLevel in deflateInit2 */
|
|
44
|
+
const MAX_WBITS = 15;
|
|
45
|
+
/* 32K LZ77 window */
|
|
46
|
+
const DEF_MEM_LEVEL = 8;
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
const LENGTH_CODES = 29;
|
|
50
|
+
/* number of length codes, not counting the special END_BLOCK code */
|
|
51
|
+
const LITERALS = 256;
|
|
52
|
+
/* number of literal bytes 0..255 */
|
|
53
|
+
const L_CODES = LITERALS + 1 + LENGTH_CODES;
|
|
54
|
+
/* number of Literal or Length codes, including the END_BLOCK code */
|
|
55
|
+
const D_CODES = 30;
|
|
56
|
+
/* number of distance codes */
|
|
57
|
+
const BL_CODES = 19;
|
|
58
|
+
/* number of codes used to transfer the bit lengths */
|
|
59
|
+
const HEAP_SIZE = 2 * L_CODES + 1;
|
|
60
|
+
/* maximum heap size */
|
|
61
|
+
const MAX_BITS = 15;
|
|
62
|
+
/* All codes must not exceed MAX_BITS bits */
|
|
63
|
+
|
|
64
|
+
const MIN_MATCH = 3;
|
|
65
|
+
const MAX_MATCH = 258;
|
|
66
|
+
const MIN_LOOKAHEAD = (MAX_MATCH + MIN_MATCH + 1);
|
|
67
|
+
|
|
68
|
+
const PRESET_DICT = 0x20;
|
|
69
|
+
|
|
70
|
+
const INIT_STATE = 42; /* zlib header -> BUSY_STATE */
|
|
71
|
+
//#ifdef GZIP
|
|
72
|
+
const GZIP_STATE = 57; /* gzip header -> BUSY_STATE | EXTRA_STATE */
|
|
73
|
+
//#endif
|
|
74
|
+
const EXTRA_STATE = 69; /* gzip extra block -> NAME_STATE */
|
|
75
|
+
const NAME_STATE = 73; /* gzip file name -> COMMENT_STATE */
|
|
76
|
+
const COMMENT_STATE = 91; /* gzip comment -> HCRC_STATE */
|
|
77
|
+
const HCRC_STATE = 103; /* gzip header CRC -> BUSY_STATE */
|
|
78
|
+
const BUSY_STATE = 113; /* deflate -> FINISH_STATE */
|
|
79
|
+
const FINISH_STATE = 666; /* stream complete */
|
|
80
|
+
|
|
81
|
+
const BS_NEED_MORE = 1; /* block not completed, need more input or more output */
|
|
82
|
+
const BS_BLOCK_DONE = 2; /* block flush performed */
|
|
83
|
+
const BS_FINISH_STARTED = 3; /* finish started, need only more output at next deflate */
|
|
84
|
+
const BS_FINISH_DONE = 4; /* finish done, accept no more input or output */
|
|
85
|
+
|
|
86
|
+
const OS_CODE = 0x03; // Unix :) . Don't detect, use this default.
|
|
87
|
+
|
|
88
|
+
const err = (strm, errorCode) => {
|
|
89
|
+
strm.msg = msg[errorCode];
|
|
90
|
+
return errorCode;
|
|
91
|
+
};
|
|
92
|
+
|
|
93
|
+
const rank = (f) => {
|
|
94
|
+
return ((f) * 2) - ((f) > 4 ? 9 : 0);
|
|
95
|
+
};
|
|
96
|
+
|
|
97
|
+
const zero = (buf) => {
|
|
98
|
+
let len = buf.length; while (--len >= 0) { buf[len] = 0; }
|
|
99
|
+
};
|
|
100
|
+
|
|
101
|
+
/* ===========================================================================
|
|
102
|
+
* Slide the hash table when sliding the window down (could be avoided with 32
|
|
103
|
+
* bit values at the expense of memory usage). We slide even when level == 0 to
|
|
104
|
+
* keep the hash table consistent if we switch back to level > 0 later.
|
|
105
|
+
*/
|
|
106
|
+
const slide_hash = (s) => {
|
|
107
|
+
let n, m;
|
|
108
|
+
let p;
|
|
109
|
+
let wsize = s.w_size;
|
|
110
|
+
|
|
111
|
+
n = s.hash_size;
|
|
112
|
+
p = n;
|
|
113
|
+
do {
|
|
114
|
+
m = s.head[--p];
|
|
115
|
+
s.head[p] = (m >= wsize ? m - wsize : 0);
|
|
116
|
+
} while (--n);
|
|
117
|
+
n = wsize;
|
|
118
|
+
//#ifndef FASTEST
|
|
119
|
+
p = n;
|
|
120
|
+
do {
|
|
121
|
+
m = s.prev[--p];
|
|
122
|
+
s.prev[p] = (m >= wsize ? m - wsize : 0);
|
|
123
|
+
/* If n is not on any hash chain, prev[n] is garbage but
|
|
124
|
+
* its value will never be used.
|
|
125
|
+
*/
|
|
126
|
+
} while (--n);
|
|
127
|
+
//#endif
|
|
128
|
+
};
|
|
129
|
+
|
|
130
|
+
/* eslint-disable new-cap */
|
|
131
|
+
let HASH = (s, prev, data) => ((prev << s.hash_shift) ^ data) & s.hash_mask;
|
|
132
|
+
|
|
133
|
+
|
|
134
|
+
/* ===========================================================================
|
|
135
|
+
* Insert string str in the dictionary and set match_head to the previous head
|
|
136
|
+
* of the hash chain (the most recent string with same hash key). Return
|
|
137
|
+
* the previous length of the hash chain.
|
|
138
|
+
* IN assertion: all calls to INSERT_STRING are made with consecutive input
|
|
139
|
+
* characters and the first MIN_MATCH bytes of str are valid (except for
|
|
140
|
+
* the last MIN_MATCH-1 bytes of the input file).
|
|
141
|
+
*/
|
|
142
|
+
const INSERT_STRING = (s, str) => {
|
|
143
|
+
let h;
|
|
144
|
+
if (s.legacy_hash) {
|
|
145
|
+
/* UPDATE_HASH(s, s->ins_h, s->window[(str) + (MIN_MATCH-1)]); */
|
|
146
|
+
h = s.ins_h = HASH(s, s.ins_h, s.window[str + MIN_MATCH - 1]);
|
|
147
|
+
} else {
|
|
148
|
+
// ANZAC++ hash: reads 4 bytes, matches node.js zlib output (legacyHash
|
|
149
|
+
// restores classic zlib hash). Faster, with fewer collisions.
|
|
150
|
+
const w = s.window;
|
|
151
|
+
// Read 4 bytes little-endian. Math.imul reproduces C uint32 overflow in
|
|
152
|
+
// `(value * 66521 + 66521) >> 16` exactly.
|
|
153
|
+
const value = w[str] | (w[str + 1] << 8) | (w[str + 2] << 16) | (w[str + 3] << 24);
|
|
154
|
+
h = s.ins_h = ((Math.imul(value, 66521) + 66521) >>> 16) & s.hash_mask;
|
|
155
|
+
}
|
|
156
|
+
const hash_head = s.prev[str & s.w_mask] = s.head[h];
|
|
157
|
+
s.head[h] = str;
|
|
158
|
+
return hash_head;
|
|
159
|
+
};
|
|
160
|
+
|
|
161
|
+
|
|
162
|
+
/* =========================================================================
|
|
163
|
+
* Flush as much pending output as possible. All deflate() output, except for
|
|
164
|
+
* some deflate_stored() output, goes through this function so some
|
|
165
|
+
* applications may wish to modify it to avoid allocating a large
|
|
166
|
+
* strm->next_out buffer and copying into it. (See also read_buf()).
|
|
167
|
+
*/
|
|
168
|
+
const flush_pending = (strm) => {
|
|
169
|
+
const s = strm.state;
|
|
170
|
+
|
|
171
|
+
//_tr_flush_bits(s);
|
|
172
|
+
let len = s.pending;
|
|
173
|
+
if (len > strm.avail_out) {
|
|
174
|
+
len = strm.avail_out;
|
|
175
|
+
}
|
|
176
|
+
if (len === 0) { return; }
|
|
177
|
+
|
|
178
|
+
strm.output.set(s.pending_buf.subarray(s.pending_out, s.pending_out + len), strm.next_out);
|
|
179
|
+
strm.next_out += len;
|
|
180
|
+
s.pending_out += len;
|
|
181
|
+
strm.total_out += len;
|
|
182
|
+
strm.avail_out -= len;
|
|
183
|
+
s.pending -= len;
|
|
184
|
+
if (s.pending === 0) {
|
|
185
|
+
s.pending_out = 0;
|
|
186
|
+
}
|
|
187
|
+
};
|
|
188
|
+
|
|
189
|
+
|
|
190
|
+
const flush_block_only = (s, last) => {
|
|
191
|
+
_tr_flush_block(s, (s.block_start >= 0 ? s.block_start : -1), s.strstart - s.block_start, last);
|
|
192
|
+
s.block_start = s.strstart;
|
|
193
|
+
flush_pending(s.strm);
|
|
194
|
+
};
|
|
195
|
+
|
|
196
|
+
|
|
197
|
+
const put_byte = (s, b) => {
|
|
198
|
+
s.pending_buf[s.pending++] = b;
|
|
199
|
+
};
|
|
200
|
+
|
|
201
|
+
|
|
202
|
+
/* =========================================================================
|
|
203
|
+
* Put a short in the pending buffer. The 16-bit value is put in MSB order.
|
|
204
|
+
* IN assertion: the stream state is correct and there is enough room in
|
|
205
|
+
* pending_buf.
|
|
206
|
+
*/
|
|
207
|
+
const putShortMSB = (s, b) => {
|
|
208
|
+
|
|
209
|
+
// put_byte(s, (Byte)(b >> 8));
|
|
210
|
+
// put_byte(s, (Byte)(b & 0xff));
|
|
211
|
+
s.pending_buf[s.pending++] = (b >>> 8) & 0xff;
|
|
212
|
+
s.pending_buf[s.pending++] = b & 0xff;
|
|
213
|
+
};
|
|
214
|
+
|
|
215
|
+
|
|
216
|
+
/* ===========================================================================
|
|
217
|
+
* Read a new buffer from the current input stream, update the adler32
|
|
218
|
+
* and total number of bytes read. All deflate() input goes through
|
|
219
|
+
* this function so some applications may wish to modify it to avoid
|
|
220
|
+
* allocating a large strm->input buffer and copying from it.
|
|
221
|
+
* (See also flush_pending()).
|
|
222
|
+
*/
|
|
223
|
+
const read_buf = (strm, buf, start, size) => {
|
|
224
|
+
|
|
225
|
+
let len = strm.avail_in;
|
|
226
|
+
|
|
227
|
+
if (len > size) { len = size; }
|
|
228
|
+
if (len === 0) { return 0; }
|
|
229
|
+
|
|
230
|
+
strm.avail_in -= len;
|
|
231
|
+
|
|
232
|
+
// zmemcpy(buf, strm->next_in, len);
|
|
233
|
+
buf.set(strm.input.subarray(strm.next_in, strm.next_in + len), start);
|
|
234
|
+
if (strm.state.wrap === 1) {
|
|
235
|
+
strm.adler = adler32(strm.adler, buf, len, start);
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
else if (strm.state.wrap === 2) {
|
|
239
|
+
strm.adler = crc32(strm.adler, buf, len, start);
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
strm.next_in += len;
|
|
243
|
+
strm.total_in += len;
|
|
244
|
+
|
|
245
|
+
return len;
|
|
246
|
+
};
|
|
247
|
+
|
|
248
|
+
|
|
249
|
+
/* ===========================================================================
|
|
250
|
+
* Set match_start to the longest match starting at the given string and
|
|
251
|
+
* return its length. Matches shorter or equal to prev_length are discarded,
|
|
252
|
+
* in which case the result is equal to prev_length and match_start is
|
|
253
|
+
* garbage.
|
|
254
|
+
* IN assertions: cur_match is the head of the hash chain for the current
|
|
255
|
+
* string (strstart) and its distance is <= MAX_DIST, and prev_length >= 1
|
|
256
|
+
* OUT assertion: the match length is not greater than s->lookahead.
|
|
257
|
+
*/
|
|
258
|
+
const longest_match = (s, cur_match) => {
|
|
259
|
+
|
|
260
|
+
let chain_length = s.max_chain_length; /* max hash chain length */
|
|
261
|
+
let scan = s.strstart; /* current string */
|
|
262
|
+
let match; /* matched string */
|
|
263
|
+
let len; /* length of current match */
|
|
264
|
+
let best_len = s.prev_length; /* best match length so far */
|
|
265
|
+
let nice_match = s.nice_match; /* stop if match long enough */
|
|
266
|
+
const limit = (s.strstart > (s.w_size - MIN_LOOKAHEAD)) ?
|
|
267
|
+
s.strstart - (s.w_size - MIN_LOOKAHEAD) : 0/*NIL*/;
|
|
268
|
+
|
|
269
|
+
const _win = s.window; // shortcut
|
|
270
|
+
|
|
271
|
+
const wmask = s.w_mask;
|
|
272
|
+
const prev = s.prev;
|
|
273
|
+
|
|
274
|
+
/* Stop when cur_match becomes <= limit. To simplify the code,
|
|
275
|
+
* we prevent matches with the string of window index 0.
|
|
276
|
+
*/
|
|
277
|
+
|
|
278
|
+
const strend = s.strstart + MAX_MATCH;
|
|
279
|
+
let scan_end1 = _win[scan + best_len - 1];
|
|
280
|
+
let scan_end = _win[scan + best_len];
|
|
281
|
+
|
|
282
|
+
/* The code is optimized for HASH_BITS >= 8 and MAX_MATCH-2 multiple of 16.
|
|
283
|
+
* It is easy to get rid of this optimization if necessary.
|
|
284
|
+
*/
|
|
285
|
+
// Assert(s->hash_bits >= 8 && MAX_MATCH == 258, "Code too clever");
|
|
286
|
+
|
|
287
|
+
/* Do not waste too much time if we already have a good match: */
|
|
288
|
+
if (s.prev_length >= s.good_match) {
|
|
289
|
+
chain_length >>= 2;
|
|
290
|
+
}
|
|
291
|
+
/* Do not look for matches beyond the end of the input. This is necessary
|
|
292
|
+
* to make deflate deterministic.
|
|
293
|
+
*/
|
|
294
|
+
if (nice_match > s.lookahead) { nice_match = s.lookahead; }
|
|
295
|
+
|
|
296
|
+
// Assert((ulg)s->strstart <= s->window_size-MIN_LOOKAHEAD, "need lookahead");
|
|
297
|
+
|
|
298
|
+
do {
|
|
299
|
+
// Assert(cur_match < s->strstart, "no future");
|
|
300
|
+
match = cur_match;
|
|
301
|
+
|
|
302
|
+
/* Skip to next match if the match length cannot increase
|
|
303
|
+
* or if the match length is less than 2. Note that the checks below
|
|
304
|
+
* for insufficient lookahead only occur occasionally for performance
|
|
305
|
+
* reasons. Therefore uninitialized memory will be accessed, and
|
|
306
|
+
* conditional jumps will be made that depend on those values.
|
|
307
|
+
* However the length of the match is limited to the lookahead, so
|
|
308
|
+
* the output of deflate is not affected by the uninitialized values.
|
|
309
|
+
*/
|
|
310
|
+
|
|
311
|
+
if (_win[match + best_len] !== scan_end ||
|
|
312
|
+
_win[match + best_len - 1] !== scan_end1 ||
|
|
313
|
+
_win[match] !== _win[scan] ||
|
|
314
|
+
_win[++match] !== _win[scan + 1]) {
|
|
315
|
+
continue;
|
|
316
|
+
}
|
|
317
|
+
|
|
318
|
+
/* The check at best_len-1 can be removed because it will be made
|
|
319
|
+
* again later. (This heuristic is not always a win.)
|
|
320
|
+
* It is not necessary to compare scan[2] and match[2] since they
|
|
321
|
+
* are always equal when the other bytes match, given that
|
|
322
|
+
* the hash keys are equal and that HASH_BITS >= 8.
|
|
323
|
+
*/
|
|
324
|
+
scan += 2;
|
|
325
|
+
match++;
|
|
326
|
+
// Assert(*scan == *match, "match[2]?");
|
|
327
|
+
|
|
328
|
+
/* We check for insufficient lookahead only every 8th comparison;
|
|
329
|
+
* the 256th check will be made at strstart+258.
|
|
330
|
+
*/
|
|
331
|
+
do {
|
|
332
|
+
/*jshint noempty:false*/
|
|
333
|
+
} while (_win[++scan] === _win[++match] && _win[++scan] === _win[++match] &&
|
|
334
|
+
_win[++scan] === _win[++match] && _win[++scan] === _win[++match] &&
|
|
335
|
+
_win[++scan] === _win[++match] && _win[++scan] === _win[++match] &&
|
|
336
|
+
_win[++scan] === _win[++match] && _win[++scan] === _win[++match] &&
|
|
337
|
+
scan < strend);
|
|
338
|
+
|
|
339
|
+
// Assert(scan <= s->window+(unsigned)(s->window_size-1), "wild scan");
|
|
340
|
+
|
|
341
|
+
len = MAX_MATCH - (strend - scan);
|
|
342
|
+
scan = strend - MAX_MATCH;
|
|
343
|
+
|
|
344
|
+
if (len > best_len) {
|
|
345
|
+
s.match_start = cur_match;
|
|
346
|
+
best_len = len;
|
|
347
|
+
if (len >= nice_match) {
|
|
348
|
+
break;
|
|
349
|
+
}
|
|
350
|
+
scan_end1 = _win[scan + best_len - 1];
|
|
351
|
+
scan_end = _win[scan + best_len];
|
|
352
|
+
}
|
|
353
|
+
} while ((cur_match = prev[cur_match & wmask]) > limit && --chain_length !== 0);
|
|
354
|
+
|
|
355
|
+
if (best_len <= s.lookahead) {
|
|
356
|
+
return best_len;
|
|
357
|
+
}
|
|
358
|
+
return s.lookahead;
|
|
359
|
+
};
|
|
360
|
+
|
|
361
|
+
|
|
362
|
+
/* ===========================================================================
|
|
363
|
+
* Fill the window when the lookahead becomes insufficient.
|
|
364
|
+
* Updates strstart and lookahead.
|
|
365
|
+
*
|
|
366
|
+
* IN assertion: lookahead < MIN_LOOKAHEAD
|
|
367
|
+
* OUT assertions: strstart <= window_size-MIN_LOOKAHEAD
|
|
368
|
+
* At least one byte has been read, or avail_in == 0; reads are
|
|
369
|
+
* performed for at least two bytes (required for the zip translate_eol
|
|
370
|
+
* option -- not supported here).
|
|
371
|
+
*/
|
|
372
|
+
const fill_window = (s) => {
|
|
373
|
+
|
|
374
|
+
const _w_size = s.w_size;
|
|
375
|
+
let n, more, str;
|
|
376
|
+
|
|
377
|
+
//Assert(s->lookahead < MIN_LOOKAHEAD, "already enough lookahead");
|
|
378
|
+
|
|
379
|
+
do {
|
|
380
|
+
more = s.window_size - s.lookahead - s.strstart;
|
|
381
|
+
|
|
382
|
+
// JS ints have 32 bit, block below not needed
|
|
383
|
+
/* Deal with !@#$% 64K limit: */
|
|
384
|
+
//if (sizeof(int) <= 2) {
|
|
385
|
+
// if (more == 0 && s->strstart == 0 && s->lookahead == 0) {
|
|
386
|
+
// more = wsize;
|
|
387
|
+
//
|
|
388
|
+
// } else if (more == (unsigned)(-1)) {
|
|
389
|
+
// /* Very unlikely, but possible on 16 bit machine if
|
|
390
|
+
// * strstart == 0 && lookahead == 1 (input done a byte at time)
|
|
391
|
+
// */
|
|
392
|
+
// more--;
|
|
393
|
+
// }
|
|
394
|
+
//}
|
|
395
|
+
|
|
396
|
+
|
|
397
|
+
/* If the window is almost full and there is insufficient lookahead,
|
|
398
|
+
* move the upper half to the lower one to make room in the upper half.
|
|
399
|
+
*/
|
|
400
|
+
if (s.strstart >= _w_size + (_w_size - MIN_LOOKAHEAD)) {
|
|
401
|
+
|
|
402
|
+
s.window.set(s.window.subarray(_w_size, _w_size + _w_size - more), 0);
|
|
403
|
+
s.match_start -= _w_size;
|
|
404
|
+
s.strstart -= _w_size;
|
|
405
|
+
/* we now have strstart >= MAX_DIST */
|
|
406
|
+
s.block_start -= _w_size;
|
|
407
|
+
if (s.insert > s.strstart) {
|
|
408
|
+
s.insert = s.strstart;
|
|
409
|
+
}
|
|
410
|
+
slide_hash(s);
|
|
411
|
+
more += _w_size;
|
|
412
|
+
}
|
|
413
|
+
if (s.strm.avail_in === 0) {
|
|
414
|
+
break;
|
|
415
|
+
}
|
|
416
|
+
|
|
417
|
+
/* If there was no sliding:
|
|
418
|
+
* strstart <= WSIZE+MAX_DIST-1 && lookahead <= MIN_LOOKAHEAD - 1 &&
|
|
419
|
+
* more == window_size - lookahead - strstart
|
|
420
|
+
* => more >= window_size - (MIN_LOOKAHEAD-1 + WSIZE + MAX_DIST-1)
|
|
421
|
+
* => more >= window_size - 2*WSIZE + 2
|
|
422
|
+
* In the BIG_MEM or MMAP case (not yet supported),
|
|
423
|
+
* window_size == input_size + MIN_LOOKAHEAD &&
|
|
424
|
+
* strstart + s->lookahead <= input_size => more >= MIN_LOOKAHEAD.
|
|
425
|
+
* Otherwise, window_size == 2*WSIZE so more >= 2.
|
|
426
|
+
* If there was sliding, more >= WSIZE. So in all cases, more >= 2.
|
|
427
|
+
*/
|
|
428
|
+
//Assert(more >= 2, "more < 2");
|
|
429
|
+
n = read_buf(s.strm, s.window, s.strstart + s.lookahead, more);
|
|
430
|
+
s.lookahead += n;
|
|
431
|
+
|
|
432
|
+
/* Initialize the hash value now that we have some input: */
|
|
433
|
+
if (!s.legacy_hash) {
|
|
434
|
+
/* The 4-byte hash reads one extra byte, so it needs one more available. */
|
|
435
|
+
if (s.lookahead + s.insert > MIN_MATCH) {
|
|
436
|
+
str = s.strstart - s.insert;
|
|
437
|
+
while (s.insert) {
|
|
438
|
+
INSERT_STRING(s, str);
|
|
439
|
+
str++;
|
|
440
|
+
s.insert--;
|
|
441
|
+
if (s.lookahead + s.insert <= MIN_MATCH) {
|
|
442
|
+
break;
|
|
443
|
+
}
|
|
444
|
+
}
|
|
445
|
+
}
|
|
446
|
+
} else if (s.lookahead + s.insert >= MIN_MATCH) {
|
|
447
|
+
str = s.strstart - s.insert;
|
|
448
|
+
s.ins_h = s.window[str];
|
|
449
|
+
|
|
450
|
+
/* UPDATE_HASH(s, s->ins_h, s->window[str + 1]); */
|
|
451
|
+
s.ins_h = HASH(s, s.ins_h, s.window[str + 1]);
|
|
452
|
+
//#if MIN_MATCH != 3
|
|
453
|
+
// Call update_hash() MIN_MATCH-3 more times
|
|
454
|
+
//#endif
|
|
455
|
+
while (s.insert) {
|
|
456
|
+
INSERT_STRING(s, str);
|
|
457
|
+
str++;
|
|
458
|
+
s.insert--;
|
|
459
|
+
if (s.lookahead + s.insert < MIN_MATCH) {
|
|
460
|
+
break;
|
|
461
|
+
}
|
|
462
|
+
}
|
|
463
|
+
}
|
|
464
|
+
/* If the whole input has less than MIN_MATCH bytes, ins_h is garbage,
|
|
465
|
+
* but this is not important since only literal bytes will be emitted.
|
|
466
|
+
*/
|
|
467
|
+
|
|
468
|
+
} while (s.lookahead < MIN_LOOKAHEAD && s.strm.avail_in !== 0);
|
|
469
|
+
|
|
470
|
+
/* If the WIN_INIT bytes after the end of the current data have never been
|
|
471
|
+
* written, then zero those bytes in order to avoid memory check reports of
|
|
472
|
+
* the use of uninitialized (or uninitialised as Julian writes) bytes by
|
|
473
|
+
* the longest match routines. Update the high water mark for the next
|
|
474
|
+
* time through here. WIN_INIT is set to MAX_MATCH since the longest match
|
|
475
|
+
* routines allow scanning to strstart + MAX_MATCH, ignoring lookahead.
|
|
476
|
+
*/
|
|
477
|
+
// if (s.high_water < s.window_size) {
|
|
478
|
+
// const curr = s.strstart + s.lookahead;
|
|
479
|
+
// let init = 0;
|
|
480
|
+
//
|
|
481
|
+
// if (s.high_water < curr) {
|
|
482
|
+
// /* Previous high water mark below current data -- zero WIN_INIT
|
|
483
|
+
// * bytes or up to end of window, whichever is less.
|
|
484
|
+
// */
|
|
485
|
+
// init = s.window_size - curr;
|
|
486
|
+
// if (init > WIN_INIT)
|
|
487
|
+
// init = WIN_INIT;
|
|
488
|
+
// zmemzero(s->window + curr, (unsigned)init);
|
|
489
|
+
// s->high_water = curr + init;
|
|
490
|
+
// }
|
|
491
|
+
// else if (s->high_water < (ulg)curr + WIN_INIT) {
|
|
492
|
+
// /* High water mark at or above current data, but below current data
|
|
493
|
+
// * plus WIN_INIT -- zero out to current data plus WIN_INIT, or up
|
|
494
|
+
// * to end of window, whichever is less.
|
|
495
|
+
// */
|
|
496
|
+
// init = (ulg)curr + WIN_INIT - s->high_water;
|
|
497
|
+
// if (init > s->window_size - s->high_water)
|
|
498
|
+
// init = s->window_size - s->high_water;
|
|
499
|
+
// zmemzero(s->window + s->high_water, (unsigned)init);
|
|
500
|
+
// s->high_water += init;
|
|
501
|
+
// }
|
|
502
|
+
// }
|
|
503
|
+
//
|
|
504
|
+
// Assert((ulg)s->strstart <= s->window_size - MIN_LOOKAHEAD,
|
|
505
|
+
// "not enough room for search");
|
|
506
|
+
};
|
|
507
|
+
|
|
508
|
+
/* ===========================================================================
|
|
509
|
+
* Copy without compression as much as possible from the input stream, return
|
|
510
|
+
* the current block state.
|
|
511
|
+
*
|
|
512
|
+
* In case deflateParams() is used to later switch to a non-zero compression
|
|
513
|
+
* level, s->matches (otherwise unused when storing) keeps track of the number
|
|
514
|
+
* of hash table slides to perform. If s->matches is 1, then one hash table
|
|
515
|
+
* slide will be done when switching. If s->matches is 2, the maximum value
|
|
516
|
+
* allowed here, then the hash table will be cleared, since two or more slides
|
|
517
|
+
* is the same as a clear.
|
|
518
|
+
*
|
|
519
|
+
* deflate_stored() is written to minimize the number of times an input byte is
|
|
520
|
+
* copied. It is most efficient with large input and output buffers, which
|
|
521
|
+
* maximizes the opportunites to have a single copy from next_in to next_out.
|
|
522
|
+
*/
|
|
523
|
+
const deflate_stored = (s, flush) => {
|
|
524
|
+
|
|
525
|
+
/* Smallest worthy block size when not flushing or finishing. By default
|
|
526
|
+
* this is 32K. This can be as small as 507 bytes for memLevel == 1. For
|
|
527
|
+
* large input and output buffers, the stored block size will be larger.
|
|
528
|
+
*/
|
|
529
|
+
let min_block = s.pending_buf_size - 5 > s.w_size ? s.w_size : s.pending_buf_size - 5;
|
|
530
|
+
|
|
531
|
+
/* Copy as many min_block or larger stored blocks directly to next_out as
|
|
532
|
+
* possible. If flushing, copy the remaining available input to next_out as
|
|
533
|
+
* stored blocks, if there is enough space.
|
|
534
|
+
*/
|
|
535
|
+
let len, left, have, last = 0;
|
|
536
|
+
let used = s.strm.avail_in;
|
|
537
|
+
do {
|
|
538
|
+
/* Set len to the maximum size block that we can copy directly with the
|
|
539
|
+
* available input data and output space. Set left to how much of that
|
|
540
|
+
* would be copied from what's left in the window.
|
|
541
|
+
*/
|
|
542
|
+
len = 65535/* MAX_STORED */; /* maximum deflate stored block length */
|
|
543
|
+
have = (s.bi_valid + 42) >> 3; /* number of header bytes */
|
|
544
|
+
if (s.strm.avail_out < have) { /* need room for header */
|
|
545
|
+
break;
|
|
546
|
+
}
|
|
547
|
+
/* maximum stored block length that will fit in avail_out: */
|
|
548
|
+
have = s.strm.avail_out - have;
|
|
549
|
+
left = s.strstart - s.block_start; /* bytes left in window */
|
|
550
|
+
if (len > left + s.strm.avail_in) {
|
|
551
|
+
len = left + s.strm.avail_in; /* limit len to the input */
|
|
552
|
+
}
|
|
553
|
+
if (len > have) {
|
|
554
|
+
len = have; /* limit len to the output */
|
|
555
|
+
}
|
|
556
|
+
|
|
557
|
+
/* If the stored block would be less than min_block in length, or if
|
|
558
|
+
* unable to copy all of the available input when flushing, then try
|
|
559
|
+
* copying to the window and the pending buffer instead. Also don't
|
|
560
|
+
* write an empty block when flushing -- deflate() does that.
|
|
561
|
+
*/
|
|
562
|
+
if (len < min_block && ((len === 0 && flush !== Z_FINISH) ||
|
|
563
|
+
flush === Z_NO_FLUSH ||
|
|
564
|
+
len !== left + s.strm.avail_in)) {
|
|
565
|
+
break;
|
|
566
|
+
}
|
|
567
|
+
|
|
568
|
+
/* Make a dummy stored block in pending to get the header bytes,
|
|
569
|
+
* including any pending bits. This also updates the debugging counts.
|
|
570
|
+
*/
|
|
571
|
+
last = flush === Z_FINISH && len === left + s.strm.avail_in ? 1 : 0;
|
|
572
|
+
_tr_stored_block(s, 0, 0, last);
|
|
573
|
+
|
|
574
|
+
/* Replace the lengths in the dummy stored block with len. */
|
|
575
|
+
s.pending_buf[s.pending - 4] = len;
|
|
576
|
+
s.pending_buf[s.pending - 3] = len >> 8;
|
|
577
|
+
s.pending_buf[s.pending - 2] = ~len;
|
|
578
|
+
s.pending_buf[s.pending - 1] = ~len >> 8;
|
|
579
|
+
|
|
580
|
+
/* Write the stored block header bytes. */
|
|
581
|
+
flush_pending(s.strm);
|
|
582
|
+
|
|
583
|
+
//#ifdef ZLIB_DEBUG
|
|
584
|
+
// /* Update debugging counts for the data about to be copied. */
|
|
585
|
+
// s->compressed_len += len << 3;
|
|
586
|
+
// s->bits_sent += len << 3;
|
|
587
|
+
//#endif
|
|
588
|
+
|
|
589
|
+
/* Copy uncompressed bytes from the window to next_out. */
|
|
590
|
+
if (left) {
|
|
591
|
+
if (left > len) {
|
|
592
|
+
left = len;
|
|
593
|
+
}
|
|
594
|
+
//zmemcpy(s->strm->next_out, s->window + s->block_start, left);
|
|
595
|
+
s.strm.output.set(s.window.subarray(s.block_start, s.block_start + left), s.strm.next_out);
|
|
596
|
+
s.strm.next_out += left;
|
|
597
|
+
s.strm.avail_out -= left;
|
|
598
|
+
s.strm.total_out += left;
|
|
599
|
+
s.block_start += left;
|
|
600
|
+
len -= left;
|
|
601
|
+
}
|
|
602
|
+
|
|
603
|
+
/* Copy uncompressed bytes directly from next_in to next_out, updating
|
|
604
|
+
* the check value.
|
|
605
|
+
*/
|
|
606
|
+
if (len) {
|
|
607
|
+
read_buf(s.strm, s.strm.output, s.strm.next_out, len);
|
|
608
|
+
s.strm.next_out += len;
|
|
609
|
+
s.strm.avail_out -= len;
|
|
610
|
+
s.strm.total_out += len;
|
|
611
|
+
}
|
|
612
|
+
} while (last === 0);
|
|
613
|
+
|
|
614
|
+
/* Update the sliding window with the last s->w_size bytes of the copied
|
|
615
|
+
* data, or append all of the copied data to the existing window if less
|
|
616
|
+
* than s->w_size bytes were copied. Also update the number of bytes to
|
|
617
|
+
* insert in the hash tables, in the event that deflateParams() switches to
|
|
618
|
+
* a non-zero compression level.
|
|
619
|
+
*/
|
|
620
|
+
used -= s.strm.avail_in; /* number of input bytes directly copied */
|
|
621
|
+
if (used) {
|
|
622
|
+
/* If any input was used, then no unused input remains in the window,
|
|
623
|
+
* therefore s->block_start == s->strstart.
|
|
624
|
+
*/
|
|
625
|
+
if (used >= s.w_size) { /* supplant the previous history */
|
|
626
|
+
s.matches = 2; /* clear hash */
|
|
627
|
+
//zmemcpy(s->window, s->strm->next_in - s->w_size, s->w_size);
|
|
628
|
+
s.window.set(s.strm.input.subarray(s.strm.next_in - s.w_size, s.strm.next_in), 0);
|
|
629
|
+
s.strstart = s.w_size;
|
|
630
|
+
s.insert = s.strstart;
|
|
631
|
+
}
|
|
632
|
+
else {
|
|
633
|
+
if (s.window_size - s.strstart <= used) {
|
|
634
|
+
/* Slide the window down. */
|
|
635
|
+
s.strstart -= s.w_size;
|
|
636
|
+
//zmemcpy(s->window, s->window + s->w_size, s->strstart);
|
|
637
|
+
s.window.set(s.window.subarray(s.w_size, s.w_size + s.strstart), 0);
|
|
638
|
+
if (s.matches < 2) {
|
|
639
|
+
s.matches++; /* add a pending slide_hash() */
|
|
640
|
+
}
|
|
641
|
+
if (s.insert > s.strstart) {
|
|
642
|
+
s.insert = s.strstart;
|
|
643
|
+
}
|
|
644
|
+
}
|
|
645
|
+
//zmemcpy(s->window + s->strstart, s->strm->next_in - used, used);
|
|
646
|
+
s.window.set(s.strm.input.subarray(s.strm.next_in - used, s.strm.next_in), s.strstart);
|
|
647
|
+
s.strstart += used;
|
|
648
|
+
s.insert += used > s.w_size - s.insert ? s.w_size - s.insert : used;
|
|
649
|
+
}
|
|
650
|
+
s.block_start = s.strstart;
|
|
651
|
+
}
|
|
652
|
+
if (s.high_water < s.strstart) {
|
|
653
|
+
s.high_water = s.strstart;
|
|
654
|
+
}
|
|
655
|
+
|
|
656
|
+
/* If the last block was written to next_out, then done. */
|
|
657
|
+
if (last) {
|
|
658
|
+
return BS_FINISH_DONE;
|
|
659
|
+
}
|
|
660
|
+
|
|
661
|
+
/* If flushing and all input has been consumed, then done. */
|
|
662
|
+
if (flush !== Z_NO_FLUSH && flush !== Z_FINISH &&
|
|
663
|
+
s.strm.avail_in === 0 && s.strstart === s.block_start) {
|
|
664
|
+
return BS_BLOCK_DONE;
|
|
665
|
+
}
|
|
666
|
+
|
|
667
|
+
/* Fill the window with any remaining input. */
|
|
668
|
+
have = s.window_size - s.strstart;
|
|
669
|
+
if (s.strm.avail_in > have && s.block_start >= s.w_size) {
|
|
670
|
+
/* Slide the window down. */
|
|
671
|
+
s.block_start -= s.w_size;
|
|
672
|
+
s.strstart -= s.w_size;
|
|
673
|
+
//zmemcpy(s->window, s->window + s->w_size, s->strstart);
|
|
674
|
+
s.window.set(s.window.subarray(s.w_size, s.w_size + s.strstart), 0);
|
|
675
|
+
if (s.matches < 2) {
|
|
676
|
+
s.matches++; /* add a pending slide_hash() */
|
|
677
|
+
}
|
|
678
|
+
have += s.w_size; /* more space now */
|
|
679
|
+
if (s.insert > s.strstart) {
|
|
680
|
+
s.insert = s.strstart;
|
|
681
|
+
}
|
|
682
|
+
}
|
|
683
|
+
if (have > s.strm.avail_in) {
|
|
684
|
+
have = s.strm.avail_in;
|
|
685
|
+
}
|
|
686
|
+
if (have) {
|
|
687
|
+
read_buf(s.strm, s.window, s.strstart, have);
|
|
688
|
+
s.strstart += have;
|
|
689
|
+
s.insert += have > s.w_size - s.insert ? s.w_size - s.insert : have;
|
|
690
|
+
}
|
|
691
|
+
if (s.high_water < s.strstart) {
|
|
692
|
+
s.high_water = s.strstart;
|
|
693
|
+
}
|
|
694
|
+
|
|
695
|
+
/* There was not enough avail_out to write a complete worthy or flushed
|
|
696
|
+
* stored block to next_out. Write a stored block to pending instead, if we
|
|
697
|
+
* have enough input for a worthy block, or if flushing and there is enough
|
|
698
|
+
* room for the remaining input as a stored block in the pending buffer.
|
|
699
|
+
*/
|
|
700
|
+
have = (s.bi_valid + 42) >> 3; /* number of header bytes */
|
|
701
|
+
/* maximum stored block length that will fit in pending: */
|
|
702
|
+
have = s.pending_buf_size - have > 65535/* MAX_STORED */ ? 65535/* MAX_STORED */ : s.pending_buf_size - have;
|
|
703
|
+
min_block = have > s.w_size ? s.w_size : have;
|
|
704
|
+
left = s.strstart - s.block_start;
|
|
705
|
+
if (left >= min_block ||
|
|
706
|
+
((left || flush === Z_FINISH) && flush !== Z_NO_FLUSH &&
|
|
707
|
+
s.strm.avail_in === 0 && left <= have)) {
|
|
708
|
+
len = left > have ? have : left;
|
|
709
|
+
last = flush === Z_FINISH && s.strm.avail_in === 0 &&
|
|
710
|
+
len === left ? 1 : 0;
|
|
711
|
+
_tr_stored_block(s, s.block_start, len, last);
|
|
712
|
+
s.block_start += len;
|
|
713
|
+
flush_pending(s.strm);
|
|
714
|
+
}
|
|
715
|
+
|
|
716
|
+
/* We've done all we can with the available input and output. */
|
|
717
|
+
return last ? BS_FINISH_STARTED : BS_NEED_MORE;
|
|
718
|
+
};
|
|
719
|
+
|
|
720
|
+
|
|
721
|
+
/* ===========================================================================
|
|
722
|
+
* Compress as much as possible from the input stream, return the current
|
|
723
|
+
* block state.
|
|
724
|
+
* This function does not perform lazy evaluation of matches and inserts
|
|
725
|
+
* new strings in the dictionary only for unmatched strings or for short
|
|
726
|
+
* matches. It is used only for the fast compression options.
|
|
727
|
+
*/
|
|
728
|
+
const deflate_fast = (s, flush) => {
|
|
729
|
+
|
|
730
|
+
let hash_head; /* head of the hash chain */
|
|
731
|
+
let bflush; /* set if current block must be flushed */
|
|
732
|
+
|
|
733
|
+
for (;;) {
|
|
734
|
+
/* Make sure that we always have enough lookahead, except
|
|
735
|
+
* at the end of the input file. We need MAX_MATCH bytes
|
|
736
|
+
* for the next match, plus MIN_MATCH bytes to insert the
|
|
737
|
+
* string following the next match.
|
|
738
|
+
*/
|
|
739
|
+
if (s.lookahead < MIN_LOOKAHEAD) {
|
|
740
|
+
fill_window(s);
|
|
741
|
+
if (s.lookahead < MIN_LOOKAHEAD && flush === Z_NO_FLUSH) {
|
|
742
|
+
return BS_NEED_MORE;
|
|
743
|
+
}
|
|
744
|
+
if (s.lookahead === 0) {
|
|
745
|
+
break; /* flush the current block */
|
|
746
|
+
}
|
|
747
|
+
}
|
|
748
|
+
|
|
749
|
+
/* Insert the string window[strstart .. strstart+2] in the
|
|
750
|
+
* dictionary, and set hash_head to the head of the hash chain:
|
|
751
|
+
*/
|
|
752
|
+
hash_head = 0/*NIL*/;
|
|
753
|
+
if (s.lookahead >= MIN_MATCH) {
|
|
754
|
+
hash_head = INSERT_STRING(s, s.strstart);
|
|
755
|
+
}
|
|
756
|
+
|
|
757
|
+
/* Find the longest match, discarding those <= prev_length.
|
|
758
|
+
* At this point we have always match_length < MIN_MATCH
|
|
759
|
+
*/
|
|
760
|
+
if (hash_head !== 0/*NIL*/ && ((s.strstart - hash_head) <= (s.w_size - MIN_LOOKAHEAD))) {
|
|
761
|
+
/* To simplify the code, we prevent matches with the string
|
|
762
|
+
* of window index 0 (in particular we have to avoid a match
|
|
763
|
+
* of the string with itself at the start of the input file).
|
|
764
|
+
*/
|
|
765
|
+
s.match_length = longest_match(s, hash_head);
|
|
766
|
+
/* longest_match() sets match_start */
|
|
767
|
+
}
|
|
768
|
+
if (s.match_length >= MIN_MATCH) {
|
|
769
|
+
// check_match(s, s.strstart, s.match_start, s.match_length); // for debug only
|
|
770
|
+
|
|
771
|
+
/*** _tr_tally_dist(s, s.strstart - s.match_start,
|
|
772
|
+
s.match_length - MIN_MATCH, bflush); ***/
|
|
773
|
+
bflush = _tr_tally(s, s.strstart - s.match_start, s.match_length - MIN_MATCH);
|
|
774
|
+
|
|
775
|
+
s.lookahead -= s.match_length;
|
|
776
|
+
|
|
777
|
+
/* Insert new strings in the hash table only if the match length
|
|
778
|
+
* is not too large. This saves time but degrades compression.
|
|
779
|
+
*/
|
|
780
|
+
if (s.match_length <= s.max_lazy_match/*max_insert_length*/ && s.lookahead >= MIN_MATCH) {
|
|
781
|
+
s.match_length--; /* string at strstart already in table */
|
|
782
|
+
do {
|
|
783
|
+
s.strstart++;
|
|
784
|
+
hash_head = INSERT_STRING(s, s.strstart);
|
|
785
|
+
/* strstart never exceeds WSIZE-MAX_MATCH, so there are
|
|
786
|
+
* always MIN_MATCH bytes ahead.
|
|
787
|
+
*/
|
|
788
|
+
} while (--s.match_length !== 0);
|
|
789
|
+
s.strstart++;
|
|
790
|
+
} else
|
|
791
|
+
{
|
|
792
|
+
s.strstart += s.match_length;
|
|
793
|
+
s.match_length = 0;
|
|
794
|
+
if (s.legacy_hash) {
|
|
795
|
+
s.ins_h = s.window[s.strstart];
|
|
796
|
+
/* UPDATE_HASH(s, s.ins_h, s.window[s.strstart+1]); */
|
|
797
|
+
s.ins_h = HASH(s, s.ins_h, s.window[s.strstart + 1]);
|
|
798
|
+
|
|
799
|
+
//#if MIN_MATCH != 3
|
|
800
|
+
// Call UPDATE_HASH() MIN_MATCH-3 more times
|
|
801
|
+
//#endif
|
|
802
|
+
/* If lookahead < MIN_MATCH, ins_h is garbage, but it does not
|
|
803
|
+
* matter since it will be recomputed at next deflate call.
|
|
804
|
+
*/
|
|
805
|
+
}
|
|
806
|
+
}
|
|
807
|
+
} else {
|
|
808
|
+
/* No match, output a literal byte */
|
|
809
|
+
//Tracevv((stderr,"%c", s.window[s.strstart]));
|
|
810
|
+
/*** _tr_tally_lit(s, s.window[s.strstart], bflush); ***/
|
|
811
|
+
bflush = _tr_tally(s, 0, s.window[s.strstart]);
|
|
812
|
+
|
|
813
|
+
s.lookahead--;
|
|
814
|
+
s.strstart++;
|
|
815
|
+
}
|
|
816
|
+
if (bflush) {
|
|
817
|
+
/*** FLUSH_BLOCK(s, 0); ***/
|
|
818
|
+
flush_block_only(s, false);
|
|
819
|
+
if (s.strm.avail_out === 0) {
|
|
820
|
+
return BS_NEED_MORE;
|
|
821
|
+
}
|
|
822
|
+
/***/
|
|
823
|
+
}
|
|
824
|
+
}
|
|
825
|
+
s.insert = ((s.strstart < (MIN_MATCH - 1)) ? s.strstart : MIN_MATCH - 1);
|
|
826
|
+
if (flush === Z_FINISH) {
|
|
827
|
+
/*** FLUSH_BLOCK(s, 1); ***/
|
|
828
|
+
flush_block_only(s, true);
|
|
829
|
+
if (s.strm.avail_out === 0) {
|
|
830
|
+
return BS_FINISH_STARTED;
|
|
831
|
+
}
|
|
832
|
+
/***/
|
|
833
|
+
return BS_FINISH_DONE;
|
|
834
|
+
}
|
|
835
|
+
if (s.sym_next) {
|
|
836
|
+
/*** FLUSH_BLOCK(s, 0); ***/
|
|
837
|
+
flush_block_only(s, false);
|
|
838
|
+
if (s.strm.avail_out === 0) {
|
|
839
|
+
return BS_NEED_MORE;
|
|
840
|
+
}
|
|
841
|
+
/***/
|
|
842
|
+
}
|
|
843
|
+
return BS_BLOCK_DONE;
|
|
844
|
+
};
|
|
845
|
+
|
|
846
|
+
/* ===========================================================================
|
|
847
|
+
* Same as above, but achieves better compression. We use a lazy
|
|
848
|
+
* evaluation for matches: a match is finally adopted only if there is
|
|
849
|
+
* no better match at the next window position.
|
|
850
|
+
*/
|
|
851
|
+
const deflate_slow = (s, flush) => {
|
|
852
|
+
|
|
853
|
+
let hash_head; /* head of hash chain */
|
|
854
|
+
let bflush; /* set if current block must be flushed */
|
|
855
|
+
|
|
856
|
+
let max_insert;
|
|
857
|
+
|
|
858
|
+
/* Process the input block. */
|
|
859
|
+
for (;;) {
|
|
860
|
+
/* Make sure that we always have enough lookahead, except
|
|
861
|
+
* at the end of the input file. We need MAX_MATCH bytes
|
|
862
|
+
* for the next match, plus MIN_MATCH bytes to insert the
|
|
863
|
+
* string following the next match.
|
|
864
|
+
*/
|
|
865
|
+
if (s.lookahead < MIN_LOOKAHEAD) {
|
|
866
|
+
fill_window(s);
|
|
867
|
+
if (s.lookahead < MIN_LOOKAHEAD && flush === Z_NO_FLUSH) {
|
|
868
|
+
return BS_NEED_MORE;
|
|
869
|
+
}
|
|
870
|
+
if (s.lookahead === 0) { break; } /* flush the current block */
|
|
871
|
+
}
|
|
872
|
+
|
|
873
|
+
/* Insert the string window[strstart .. strstart+2] in the
|
|
874
|
+
* dictionary, and set hash_head to the head of the hash chain:
|
|
875
|
+
*/
|
|
876
|
+
hash_head = 0/*NIL*/;
|
|
877
|
+
if (s.lookahead >= MIN_MATCH) {
|
|
878
|
+
hash_head = INSERT_STRING(s, s.strstart);
|
|
879
|
+
}
|
|
880
|
+
|
|
881
|
+
/* Find the longest match, discarding those <= prev_length.
|
|
882
|
+
*/
|
|
883
|
+
s.prev_length = s.match_length;
|
|
884
|
+
s.prev_match = s.match_start;
|
|
885
|
+
s.match_length = MIN_MATCH - 1;
|
|
886
|
+
|
|
887
|
+
if (hash_head !== 0/*NIL*/ && s.prev_length < s.max_lazy_match &&
|
|
888
|
+
s.strstart - hash_head <= (s.w_size - MIN_LOOKAHEAD)/*MAX_DIST(s)*/) {
|
|
889
|
+
/* To simplify the code, we prevent matches with the string
|
|
890
|
+
* of window index 0 (in particular we have to avoid a match
|
|
891
|
+
* of the string with itself at the start of the input file).
|
|
892
|
+
*/
|
|
893
|
+
s.match_length = longest_match(s, hash_head);
|
|
894
|
+
/* longest_match() sets match_start */
|
|
895
|
+
|
|
896
|
+
if (s.match_length <= 5 &&
|
|
897
|
+
(s.strategy === Z_FILTERED || (s.match_length === MIN_MATCH && s.strstart - s.match_start > 4096/*TOO_FAR*/))) {
|
|
898
|
+
|
|
899
|
+
/* If prev_match is also MIN_MATCH, match_start is garbage
|
|
900
|
+
* but we will ignore the current match anyway.
|
|
901
|
+
*/
|
|
902
|
+
s.match_length = MIN_MATCH - 1;
|
|
903
|
+
}
|
|
904
|
+
}
|
|
905
|
+
/* If there was a match at the previous step and the current
|
|
906
|
+
* match is not better, output the previous match:
|
|
907
|
+
*/
|
|
908
|
+
if (s.prev_length >= MIN_MATCH && s.match_length <= s.prev_length) {
|
|
909
|
+
max_insert = s.strstart + s.lookahead - MIN_MATCH;
|
|
910
|
+
/* Do not insert strings in hash table beyond this. */
|
|
911
|
+
|
|
912
|
+
//check_match(s, s.strstart-1, s.prev_match, s.prev_length);
|
|
913
|
+
|
|
914
|
+
/***_tr_tally_dist(s, s.strstart - 1 - s.prev_match,
|
|
915
|
+
s.prev_length - MIN_MATCH, bflush);***/
|
|
916
|
+
bflush = _tr_tally(s, s.strstart - 1 - s.prev_match, s.prev_length - MIN_MATCH);
|
|
917
|
+
/* Insert in hash table all strings up to the end of the match.
|
|
918
|
+
* strstart-1 and strstart are already inserted. If there is not
|
|
919
|
+
* enough lookahead, the last two strings are not inserted in
|
|
920
|
+
* the hash table.
|
|
921
|
+
*/
|
|
922
|
+
s.lookahead -= s.prev_length - 1;
|
|
923
|
+
s.prev_length -= 2;
|
|
924
|
+
do {
|
|
925
|
+
if (++s.strstart <= max_insert) {
|
|
926
|
+
hash_head = INSERT_STRING(s, s.strstart);
|
|
927
|
+
}
|
|
928
|
+
} while (--s.prev_length !== 0);
|
|
929
|
+
s.match_available = 0;
|
|
930
|
+
s.match_length = MIN_MATCH - 1;
|
|
931
|
+
s.strstart++;
|
|
932
|
+
|
|
933
|
+
if (bflush) {
|
|
934
|
+
/*** FLUSH_BLOCK(s, 0); ***/
|
|
935
|
+
flush_block_only(s, false);
|
|
936
|
+
if (s.strm.avail_out === 0) {
|
|
937
|
+
return BS_NEED_MORE;
|
|
938
|
+
}
|
|
939
|
+
/***/
|
|
940
|
+
}
|
|
941
|
+
|
|
942
|
+
} else if (s.match_available) {
|
|
943
|
+
/* If there was no match at the previous position, output a
|
|
944
|
+
* single literal. If there was a match but the current match
|
|
945
|
+
* is longer, truncate the previous match to a single literal.
|
|
946
|
+
*/
|
|
947
|
+
//Tracevv((stderr,"%c", s->window[s->strstart-1]));
|
|
948
|
+
/*** _tr_tally_lit(s, s.window[s.strstart-1], bflush); ***/
|
|
949
|
+
bflush = _tr_tally(s, 0, s.window[s.strstart - 1]);
|
|
950
|
+
|
|
951
|
+
if (bflush) {
|
|
952
|
+
/*** FLUSH_BLOCK_ONLY(s, 0) ***/
|
|
953
|
+
flush_block_only(s, false);
|
|
954
|
+
/***/
|
|
955
|
+
}
|
|
956
|
+
s.strstart++;
|
|
957
|
+
s.lookahead--;
|
|
958
|
+
if (s.strm.avail_out === 0) {
|
|
959
|
+
return BS_NEED_MORE;
|
|
960
|
+
}
|
|
961
|
+
} else {
|
|
962
|
+
/* There is no previous match to compare with, wait for
|
|
963
|
+
* the next step to decide.
|
|
964
|
+
*/
|
|
965
|
+
s.match_available = 1;
|
|
966
|
+
s.strstart++;
|
|
967
|
+
s.lookahead--;
|
|
968
|
+
}
|
|
969
|
+
}
|
|
970
|
+
//Assert (flush != Z_NO_FLUSH, "no flush?");
|
|
971
|
+
if (s.match_available) {
|
|
972
|
+
//Tracevv((stderr,"%c", s->window[s->strstart-1]));
|
|
973
|
+
/*** _tr_tally_lit(s, s.window[s.strstart-1], bflush); ***/
|
|
974
|
+
bflush = _tr_tally(s, 0, s.window[s.strstart - 1]);
|
|
975
|
+
|
|
976
|
+
s.match_available = 0;
|
|
977
|
+
}
|
|
978
|
+
s.insert = s.strstart < MIN_MATCH - 1 ? s.strstart : MIN_MATCH - 1;
|
|
979
|
+
if (flush === Z_FINISH) {
|
|
980
|
+
/*** FLUSH_BLOCK(s, 1); ***/
|
|
981
|
+
flush_block_only(s, true);
|
|
982
|
+
if (s.strm.avail_out === 0) {
|
|
983
|
+
return BS_FINISH_STARTED;
|
|
984
|
+
}
|
|
985
|
+
/***/
|
|
986
|
+
return BS_FINISH_DONE;
|
|
987
|
+
}
|
|
988
|
+
if (s.sym_next) {
|
|
989
|
+
/*** FLUSH_BLOCK(s, 0); ***/
|
|
990
|
+
flush_block_only(s, false);
|
|
991
|
+
if (s.strm.avail_out === 0) {
|
|
992
|
+
return BS_NEED_MORE;
|
|
993
|
+
}
|
|
994
|
+
/***/
|
|
995
|
+
}
|
|
996
|
+
|
|
997
|
+
return BS_BLOCK_DONE;
|
|
998
|
+
};
|
|
999
|
+
|
|
1000
|
+
|
|
1001
|
+
/* ===========================================================================
|
|
1002
|
+
* For Z_RLE, simply look for runs of bytes, generate matches only of distance
|
|
1003
|
+
* one. Do not maintain a hash table. (It will be regenerated if this run of
|
|
1004
|
+
* deflate switches away from Z_RLE.)
|
|
1005
|
+
*/
|
|
1006
|
+
const deflate_rle = (s, flush) => {
|
|
1007
|
+
|
|
1008
|
+
let bflush; /* set if current block must be flushed */
|
|
1009
|
+
let prev; /* byte at distance one to match */
|
|
1010
|
+
let scan, strend; /* scan goes up to strend for length of run */
|
|
1011
|
+
|
|
1012
|
+
const _win = s.window;
|
|
1013
|
+
|
|
1014
|
+
for (;;) {
|
|
1015
|
+
/* Make sure that we always have enough lookahead, except
|
|
1016
|
+
* at the end of the input file. We need MAX_MATCH bytes
|
|
1017
|
+
* for the longest run, plus one for the unrolled loop.
|
|
1018
|
+
*/
|
|
1019
|
+
if (s.lookahead <= MAX_MATCH) {
|
|
1020
|
+
fill_window(s);
|
|
1021
|
+
if (s.lookahead <= MAX_MATCH && flush === Z_NO_FLUSH) {
|
|
1022
|
+
return BS_NEED_MORE;
|
|
1023
|
+
}
|
|
1024
|
+
if (s.lookahead === 0) { break; } /* flush the current block */
|
|
1025
|
+
}
|
|
1026
|
+
|
|
1027
|
+
/* See how many times the previous byte repeats */
|
|
1028
|
+
s.match_length = 0;
|
|
1029
|
+
if (s.lookahead >= MIN_MATCH && s.strstart > 0) {
|
|
1030
|
+
scan = s.strstart - 1;
|
|
1031
|
+
prev = _win[scan];
|
|
1032
|
+
if (prev === _win[++scan] && prev === _win[++scan] && prev === _win[++scan]) {
|
|
1033
|
+
strend = s.strstart + MAX_MATCH;
|
|
1034
|
+
do {
|
|
1035
|
+
/*jshint noempty:false*/
|
|
1036
|
+
} while (prev === _win[++scan] && prev === _win[++scan] &&
|
|
1037
|
+
prev === _win[++scan] && prev === _win[++scan] &&
|
|
1038
|
+
prev === _win[++scan] && prev === _win[++scan] &&
|
|
1039
|
+
prev === _win[++scan] && prev === _win[++scan] &&
|
|
1040
|
+
scan < strend);
|
|
1041
|
+
s.match_length = MAX_MATCH - (strend - scan);
|
|
1042
|
+
if (s.match_length > s.lookahead) {
|
|
1043
|
+
s.match_length = s.lookahead;
|
|
1044
|
+
}
|
|
1045
|
+
}
|
|
1046
|
+
//Assert(scan <= s->window+(uInt)(s->window_size-1), "wild scan");
|
|
1047
|
+
}
|
|
1048
|
+
|
|
1049
|
+
/* Emit match if have run of MIN_MATCH or longer, else emit literal */
|
|
1050
|
+
if (s.match_length >= MIN_MATCH) {
|
|
1051
|
+
//check_match(s, s.strstart, s.strstart - 1, s.match_length);
|
|
1052
|
+
|
|
1053
|
+
/*** _tr_tally_dist(s, 1, s.match_length - MIN_MATCH, bflush); ***/
|
|
1054
|
+
bflush = _tr_tally(s, 1, s.match_length - MIN_MATCH);
|
|
1055
|
+
|
|
1056
|
+
s.lookahead -= s.match_length;
|
|
1057
|
+
s.strstart += s.match_length;
|
|
1058
|
+
s.match_length = 0;
|
|
1059
|
+
} else {
|
|
1060
|
+
/* No match, output a literal byte */
|
|
1061
|
+
//Tracevv((stderr,"%c", s->window[s->strstart]));
|
|
1062
|
+
/*** _tr_tally_lit(s, s.window[s.strstart], bflush); ***/
|
|
1063
|
+
bflush = _tr_tally(s, 0, s.window[s.strstart]);
|
|
1064
|
+
|
|
1065
|
+
s.lookahead--;
|
|
1066
|
+
s.strstart++;
|
|
1067
|
+
}
|
|
1068
|
+
if (bflush) {
|
|
1069
|
+
/*** FLUSH_BLOCK(s, 0); ***/
|
|
1070
|
+
flush_block_only(s, false);
|
|
1071
|
+
if (s.strm.avail_out === 0) {
|
|
1072
|
+
return BS_NEED_MORE;
|
|
1073
|
+
}
|
|
1074
|
+
/***/
|
|
1075
|
+
}
|
|
1076
|
+
}
|
|
1077
|
+
s.insert = 0;
|
|
1078
|
+
if (flush === Z_FINISH) {
|
|
1079
|
+
/*** FLUSH_BLOCK(s, 1); ***/
|
|
1080
|
+
flush_block_only(s, true);
|
|
1081
|
+
if (s.strm.avail_out === 0) {
|
|
1082
|
+
return BS_FINISH_STARTED;
|
|
1083
|
+
}
|
|
1084
|
+
/***/
|
|
1085
|
+
return BS_FINISH_DONE;
|
|
1086
|
+
}
|
|
1087
|
+
if (s.sym_next) {
|
|
1088
|
+
/*** FLUSH_BLOCK(s, 0); ***/
|
|
1089
|
+
flush_block_only(s, false);
|
|
1090
|
+
if (s.strm.avail_out === 0) {
|
|
1091
|
+
return BS_NEED_MORE;
|
|
1092
|
+
}
|
|
1093
|
+
/***/
|
|
1094
|
+
}
|
|
1095
|
+
return BS_BLOCK_DONE;
|
|
1096
|
+
};
|
|
1097
|
+
|
|
1098
|
+
/* ===========================================================================
|
|
1099
|
+
* For Z_HUFFMAN_ONLY, do not look for matches. Do not maintain a hash table.
|
|
1100
|
+
* (It will be regenerated if this run of deflate switches away from Huffman.)
|
|
1101
|
+
*/
|
|
1102
|
+
const deflate_huff = (s, flush) => {
|
|
1103
|
+
|
|
1104
|
+
let bflush; /* set if current block must be flushed */
|
|
1105
|
+
|
|
1106
|
+
for (;;) {
|
|
1107
|
+
/* Make sure that we have a literal to write. */
|
|
1108
|
+
if (s.lookahead === 0) {
|
|
1109
|
+
fill_window(s);
|
|
1110
|
+
if (s.lookahead === 0) {
|
|
1111
|
+
if (flush === Z_NO_FLUSH) {
|
|
1112
|
+
return BS_NEED_MORE;
|
|
1113
|
+
}
|
|
1114
|
+
break; /* flush the current block */
|
|
1115
|
+
}
|
|
1116
|
+
}
|
|
1117
|
+
|
|
1118
|
+
/* Output a literal byte */
|
|
1119
|
+
s.match_length = 0;
|
|
1120
|
+
//Tracevv((stderr,"%c", s->window[s->strstart]));
|
|
1121
|
+
/*** _tr_tally_lit(s, s.window[s.strstart], bflush); ***/
|
|
1122
|
+
bflush = _tr_tally(s, 0, s.window[s.strstart]);
|
|
1123
|
+
s.lookahead--;
|
|
1124
|
+
s.strstart++;
|
|
1125
|
+
if (bflush) {
|
|
1126
|
+
/*** FLUSH_BLOCK(s, 0); ***/
|
|
1127
|
+
flush_block_only(s, false);
|
|
1128
|
+
if (s.strm.avail_out === 0) {
|
|
1129
|
+
return BS_NEED_MORE;
|
|
1130
|
+
}
|
|
1131
|
+
/***/
|
|
1132
|
+
}
|
|
1133
|
+
}
|
|
1134
|
+
s.insert = 0;
|
|
1135
|
+
if (flush === Z_FINISH) {
|
|
1136
|
+
/*** FLUSH_BLOCK(s, 1); ***/
|
|
1137
|
+
flush_block_only(s, true);
|
|
1138
|
+
if (s.strm.avail_out === 0) {
|
|
1139
|
+
return BS_FINISH_STARTED;
|
|
1140
|
+
}
|
|
1141
|
+
/***/
|
|
1142
|
+
return BS_FINISH_DONE;
|
|
1143
|
+
}
|
|
1144
|
+
if (s.sym_next) {
|
|
1145
|
+
/*** FLUSH_BLOCK(s, 0); ***/
|
|
1146
|
+
flush_block_only(s, false);
|
|
1147
|
+
if (s.strm.avail_out === 0) {
|
|
1148
|
+
return BS_NEED_MORE;
|
|
1149
|
+
}
|
|
1150
|
+
/***/
|
|
1151
|
+
}
|
|
1152
|
+
return BS_BLOCK_DONE;
|
|
1153
|
+
};
|
|
1154
|
+
|
|
1155
|
+
/* Values for max_lazy_match, good_match and max_chain_length, depending on
|
|
1156
|
+
* the desired pack level (0..9). The values given below have been tuned to
|
|
1157
|
+
* exclude worst case performance for pathological files. Better values may be
|
|
1158
|
+
* found for specific files.
|
|
1159
|
+
*/
|
|
1160
|
+
function Config(good_length, max_lazy, nice_length, max_chain, func) {
|
|
1161
|
+
|
|
1162
|
+
this.good_length = good_length;
|
|
1163
|
+
this.max_lazy = max_lazy;
|
|
1164
|
+
this.nice_length = nice_length;
|
|
1165
|
+
this.max_chain = max_chain;
|
|
1166
|
+
this.func = func;
|
|
1167
|
+
}
|
|
1168
|
+
|
|
1169
|
+
const configuration_table = [
|
|
1170
|
+
/* good lazy nice chain */
|
|
1171
|
+
new Config(0, 0, 0, 0, deflate_stored), /* 0 store only */
|
|
1172
|
+
new Config(4, 4, 8, 4, deflate_fast), /* 1 max speed, no lazy matches */
|
|
1173
|
+
new Config(4, 5, 16, 8, deflate_fast), /* 2 */
|
|
1174
|
+
new Config(4, 6, 32, 32, deflate_fast), /* 3 */
|
|
1175
|
+
|
|
1176
|
+
new Config(4, 4, 16, 16, deflate_slow), /* 4 lazy matches */
|
|
1177
|
+
new Config(8, 16, 32, 32, deflate_slow), /* 5 */
|
|
1178
|
+
new Config(8, 16, 128, 128, deflate_slow), /* 6 */
|
|
1179
|
+
new Config(8, 32, 128, 256, deflate_slow), /* 7 */
|
|
1180
|
+
new Config(32, 128, 258, 1024, deflate_slow), /* 8 */
|
|
1181
|
+
new Config(32, 258, 258, 4096, deflate_slow) /* 9 max compression */
|
|
1182
|
+
];
|
|
1183
|
+
|
|
1184
|
+
|
|
1185
|
+
/* ===========================================================================
|
|
1186
|
+
* Initialize the "longest match" routines for a new zlib stream
|
|
1187
|
+
*/
|
|
1188
|
+
const lm_init = (s) => {
|
|
1189
|
+
|
|
1190
|
+
s.window_size = 2 * s.w_size;
|
|
1191
|
+
|
|
1192
|
+
/*** CLEAR_HASH(s); ***/
|
|
1193
|
+
zero(s.head); // Fill with NIL (= 0);
|
|
1194
|
+
|
|
1195
|
+
/* Set the default configuration parameters:
|
|
1196
|
+
*/
|
|
1197
|
+
s.max_lazy_match = configuration_table[s.level].max_lazy;
|
|
1198
|
+
s.good_match = configuration_table[s.level].good_length;
|
|
1199
|
+
s.nice_match = configuration_table[s.level].nice_length;
|
|
1200
|
+
s.max_chain_length = configuration_table[s.level].max_chain;
|
|
1201
|
+
|
|
1202
|
+
s.strstart = 0;
|
|
1203
|
+
s.block_start = 0;
|
|
1204
|
+
s.lookahead = 0;
|
|
1205
|
+
s.insert = 0;
|
|
1206
|
+
s.match_length = s.prev_length = MIN_MATCH - 1;
|
|
1207
|
+
s.match_available = 0;
|
|
1208
|
+
s.ins_h = 0;
|
|
1209
|
+
};
|
|
1210
|
+
|
|
1211
|
+
|
|
1212
|
+
function DeflateState() {
|
|
1213
|
+
this.strm = null; /* pointer back to this zlib stream */
|
|
1214
|
+
this.status = 0; /* as the name implies */
|
|
1215
|
+
this.pending_buf = null; /* output still pending */
|
|
1216
|
+
this.pending_buf_size = 0; /* size of pending_buf */
|
|
1217
|
+
this.pending_out = 0; /* next pending byte to output to the stream */
|
|
1218
|
+
this.pending = 0; /* nb of bytes in the pending buffer */
|
|
1219
|
+
this.wrap = 0; /* bit 0 true for zlib, bit 1 true for gzip */
|
|
1220
|
+
this.gzhead = null; /* gzip header information to write */
|
|
1221
|
+
this.gzindex = 0; /* where in extra, name, or comment */
|
|
1222
|
+
this.method = Z_DEFLATED; /* can only be DEFLATED */
|
|
1223
|
+
this.last_flush = -1; /* value of flush param for previous deflate call */
|
|
1224
|
+
|
|
1225
|
+
this.w_size = 0; /* LZ77 window size (32K by default) */
|
|
1226
|
+
this.w_bits = 0; /* log2(w_size) (8..16) */
|
|
1227
|
+
this.w_mask = 0; /* w_size - 1 */
|
|
1228
|
+
|
|
1229
|
+
this.window = null;
|
|
1230
|
+
/* Sliding window. Input bytes are read into the second half of the window,
|
|
1231
|
+
* and move to the first half later to keep a dictionary of at least wSize
|
|
1232
|
+
* bytes. With this organization, matches are limited to a distance of
|
|
1233
|
+
* wSize-MAX_MATCH bytes, but this ensures that IO is always
|
|
1234
|
+
* performed with a length multiple of the block size.
|
|
1235
|
+
*/
|
|
1236
|
+
|
|
1237
|
+
this.window_size = 0;
|
|
1238
|
+
/* Actual size of window: 2*wSize, except when the user input buffer
|
|
1239
|
+
* is directly used as sliding window.
|
|
1240
|
+
*/
|
|
1241
|
+
|
|
1242
|
+
this.prev = null;
|
|
1243
|
+
/* Link to older string with same hash index. To limit the size of this
|
|
1244
|
+
* array to 64K, this link is maintained only for the last 32K strings.
|
|
1245
|
+
* An index in this array is thus a window index modulo 32K.
|
|
1246
|
+
*/
|
|
1247
|
+
|
|
1248
|
+
this.head = null; /* Heads of the hash chains or NIL. */
|
|
1249
|
+
|
|
1250
|
+
this.ins_h = 0; /* hash index of string to be inserted */
|
|
1251
|
+
this.legacy_hash = 0; /* use classic zlib hash instead of default ANZAC++ */
|
|
1252
|
+
this.hash_size = 0; /* number of elements in hash table */
|
|
1253
|
+
this.hash_bits = 0; /* log2(hash_size) */
|
|
1254
|
+
this.hash_mask = 0; /* hash_size-1 */
|
|
1255
|
+
|
|
1256
|
+
this.hash_shift = 0;
|
|
1257
|
+
/* Number of bits by which ins_h must be shifted at each input
|
|
1258
|
+
* step. It must be such that after MIN_MATCH steps, the oldest
|
|
1259
|
+
* byte no longer takes part in the hash key, that is:
|
|
1260
|
+
* hash_shift * MIN_MATCH >= hash_bits
|
|
1261
|
+
*/
|
|
1262
|
+
|
|
1263
|
+
this.block_start = 0;
|
|
1264
|
+
/* Window position at the beginning of the current output block. Gets
|
|
1265
|
+
* negative when the window is moved backwards.
|
|
1266
|
+
*/
|
|
1267
|
+
|
|
1268
|
+
this.match_length = 0; /* length of best match */
|
|
1269
|
+
this.prev_match = 0; /* previous match */
|
|
1270
|
+
this.match_available = 0; /* set if previous match exists */
|
|
1271
|
+
this.strstart = 0; /* start of string to insert */
|
|
1272
|
+
this.match_start = 0; /* start of matching string */
|
|
1273
|
+
this.lookahead = 0; /* number of valid bytes ahead in window */
|
|
1274
|
+
|
|
1275
|
+
this.prev_length = 0;
|
|
1276
|
+
/* Length of the best match at previous step. Matches not greater than this
|
|
1277
|
+
* are discarded. This is used in the lazy match evaluation.
|
|
1278
|
+
*/
|
|
1279
|
+
|
|
1280
|
+
this.max_chain_length = 0;
|
|
1281
|
+
/* To speed up deflation, hash chains are never searched beyond this
|
|
1282
|
+
* length. A higher limit improves compression ratio but degrades the
|
|
1283
|
+
* speed.
|
|
1284
|
+
*/
|
|
1285
|
+
|
|
1286
|
+
this.max_lazy_match = 0;
|
|
1287
|
+
/* Attempt to find a better match only when the current match is strictly
|
|
1288
|
+
* smaller than this value. This mechanism is used only for compression
|
|
1289
|
+
* levels >= 4.
|
|
1290
|
+
*/
|
|
1291
|
+
// That's alias to max_lazy_match, don't use directly
|
|
1292
|
+
//this.max_insert_length = 0;
|
|
1293
|
+
/* Insert new strings in the hash table only if the match length is not
|
|
1294
|
+
* greater than this length. This saves time but degrades compression.
|
|
1295
|
+
* max_insert_length is used only for compression levels <= 3.
|
|
1296
|
+
*/
|
|
1297
|
+
|
|
1298
|
+
this.level = 0; /* compression level (1..9) */
|
|
1299
|
+
this.strategy = 0; /* favor or force Huffman coding*/
|
|
1300
|
+
|
|
1301
|
+
this.good_match = 0;
|
|
1302
|
+
/* Use a faster search when the previous match is longer than this */
|
|
1303
|
+
|
|
1304
|
+
this.nice_match = 0; /* Stop searching when current match exceeds this */
|
|
1305
|
+
|
|
1306
|
+
/* used by trees.c: */
|
|
1307
|
+
|
|
1308
|
+
/* Didn't use ct_data typedef below to suppress compiler warning */
|
|
1309
|
+
|
|
1310
|
+
// struct ct_data_s dyn_ltree[HEAP_SIZE]; /* literal and length tree */
|
|
1311
|
+
// struct ct_data_s dyn_dtree[2*D_CODES+1]; /* distance tree */
|
|
1312
|
+
// struct ct_data_s bl_tree[2*BL_CODES+1]; /* Huffman tree for bit lengths */
|
|
1313
|
+
|
|
1314
|
+
// Use flat array of DOUBLE size, with interleaved fata,
|
|
1315
|
+
// because JS does not support effective
|
|
1316
|
+
this.dyn_ltree = new Uint16Array(HEAP_SIZE * 2);
|
|
1317
|
+
this.dyn_dtree = new Uint16Array((2 * D_CODES + 1) * 2);
|
|
1318
|
+
this.bl_tree = new Uint16Array((2 * BL_CODES + 1) * 2);
|
|
1319
|
+
zero(this.dyn_ltree);
|
|
1320
|
+
zero(this.dyn_dtree);
|
|
1321
|
+
zero(this.bl_tree);
|
|
1322
|
+
|
|
1323
|
+
this.l_desc = null; /* desc. for literal tree */
|
|
1324
|
+
this.d_desc = null; /* desc. for distance tree */
|
|
1325
|
+
this.bl_desc = null; /* desc. for bit length tree */
|
|
1326
|
+
|
|
1327
|
+
//ush bl_count[MAX_BITS+1];
|
|
1328
|
+
this.bl_count = new Uint16Array(MAX_BITS + 1);
|
|
1329
|
+
/* number of codes at each bit length for an optimal tree */
|
|
1330
|
+
|
|
1331
|
+
//int heap[2*L_CODES+1]; /* heap used to build the Huffman trees */
|
|
1332
|
+
this.heap = new Uint16Array(2 * L_CODES + 1); /* heap used to build the Huffman trees */
|
|
1333
|
+
zero(this.heap);
|
|
1334
|
+
|
|
1335
|
+
this.heap_len = 0; /* number of elements in the heap */
|
|
1336
|
+
this.heap_max = 0; /* element of largest frequency */
|
|
1337
|
+
/* The sons of heap[n] are heap[2*n] and heap[2*n+1]. heap[0] is not used.
|
|
1338
|
+
* The same heap array is used to build all trees.
|
|
1339
|
+
*/
|
|
1340
|
+
|
|
1341
|
+
this.depth = new Uint16Array(2 * L_CODES + 1); //uch depth[2*L_CODES+1];
|
|
1342
|
+
zero(this.depth);
|
|
1343
|
+
/* Depth of each subtree used as tie breaker for trees of equal frequency
|
|
1344
|
+
*/
|
|
1345
|
+
|
|
1346
|
+
this.sym_buf = 0; /* buffer for distances and literals/lengths */
|
|
1347
|
+
|
|
1348
|
+
this.lit_bufsize = 0;
|
|
1349
|
+
/* Size of match buffer for literals/lengths. There are 4 reasons for
|
|
1350
|
+
* limiting lit_bufsize to 64K:
|
|
1351
|
+
* - frequencies can be kept in 16 bit counters
|
|
1352
|
+
* - if compression is not successful for the first block, all input
|
|
1353
|
+
* data is still in the window so we can still emit a stored block even
|
|
1354
|
+
* when input comes from standard input. (This can also be done for
|
|
1355
|
+
* all blocks if lit_bufsize is not greater than 32K.)
|
|
1356
|
+
* - if compression is not successful for a file smaller than 64K, we can
|
|
1357
|
+
* even emit a stored file instead of a stored block (saving 5 bytes).
|
|
1358
|
+
* This is applicable only for zip (not gzip or zlib).
|
|
1359
|
+
* - creating new Huffman trees less frequently may not provide fast
|
|
1360
|
+
* adaptation to changes in the input data statistics. (Take for
|
|
1361
|
+
* example a binary file with poorly compressible code followed by
|
|
1362
|
+
* a highly compressible string table.) Smaller buffer sizes give
|
|
1363
|
+
* fast adaptation but have of course the overhead of transmitting
|
|
1364
|
+
* trees more frequently.
|
|
1365
|
+
* - I can't count above 4
|
|
1366
|
+
*/
|
|
1367
|
+
|
|
1368
|
+
this.sym_next = 0; /* running index in sym_buf */
|
|
1369
|
+
this.sym_end = 0; /* symbol table full when sym_next reaches this */
|
|
1370
|
+
|
|
1371
|
+
this.opt_len = 0; /* bit length of current block with optimal trees */
|
|
1372
|
+
this.static_len = 0; /* bit length of current block with static trees */
|
|
1373
|
+
this.matches = 0; /* number of string matches in current block */
|
|
1374
|
+
this.insert = 0; /* bytes at end of window left to insert */
|
|
1375
|
+
|
|
1376
|
+
|
|
1377
|
+
this.bi_buf = 0;
|
|
1378
|
+
/* Output buffer. bits are inserted starting at the bottom (least
|
|
1379
|
+
* significant bits).
|
|
1380
|
+
*/
|
|
1381
|
+
this.bi_valid = 0;
|
|
1382
|
+
/* Number of valid bits in bi_buf. All bits above the last valid bit
|
|
1383
|
+
* are always zero.
|
|
1384
|
+
*/
|
|
1385
|
+
|
|
1386
|
+
// Used for window memory init. We safely ignore it for JS. That makes
|
|
1387
|
+
// sense only for pointers and memory check tools.
|
|
1388
|
+
//this.high_water = 0;
|
|
1389
|
+
/* High water mark offset in window for initialized bytes -- bytes above
|
|
1390
|
+
* this are set to zero in order to avoid memory check warnings when
|
|
1391
|
+
* longest match routines access bytes past the input. This is then
|
|
1392
|
+
* updated to the new high water mark.
|
|
1393
|
+
*/
|
|
1394
|
+
}
|
|
1395
|
+
|
|
1396
|
+
|
|
1397
|
+
/* =========================================================================
|
|
1398
|
+
* Check for a valid deflate stream state. Return 0 if ok, 1 if not.
|
|
1399
|
+
*/
|
|
1400
|
+
const deflateStateCheck = (strm) => {
|
|
1401
|
+
|
|
1402
|
+
if (!strm) {
|
|
1403
|
+
return 1;
|
|
1404
|
+
}
|
|
1405
|
+
const s = strm.state;
|
|
1406
|
+
if (!s || s.strm !== strm || (s.status !== INIT_STATE &&
|
|
1407
|
+
//#ifdef GZIP
|
|
1408
|
+
s.status !== GZIP_STATE &&
|
|
1409
|
+
//#endif
|
|
1410
|
+
s.status !== EXTRA_STATE &&
|
|
1411
|
+
s.status !== NAME_STATE &&
|
|
1412
|
+
s.status !== COMMENT_STATE &&
|
|
1413
|
+
s.status !== HCRC_STATE &&
|
|
1414
|
+
s.status !== BUSY_STATE &&
|
|
1415
|
+
s.status !== FINISH_STATE)) {
|
|
1416
|
+
return 1;
|
|
1417
|
+
}
|
|
1418
|
+
return 0;
|
|
1419
|
+
};
|
|
1420
|
+
|
|
1421
|
+
|
|
1422
|
+
const deflateResetKeep = (strm) => {
|
|
1423
|
+
|
|
1424
|
+
if (deflateStateCheck(strm)) {
|
|
1425
|
+
return err(strm, Z_STREAM_ERROR);
|
|
1426
|
+
}
|
|
1427
|
+
|
|
1428
|
+
strm.total_in = strm.total_out = 0;
|
|
1429
|
+
strm.data_type = Z_UNKNOWN;
|
|
1430
|
+
|
|
1431
|
+
const s = strm.state;
|
|
1432
|
+
s.pending = 0;
|
|
1433
|
+
s.pending_out = 0;
|
|
1434
|
+
|
|
1435
|
+
if (s.wrap < 0) {
|
|
1436
|
+
s.wrap = -s.wrap;
|
|
1437
|
+
/* was made negative by deflate(..., Z_FINISH); */
|
|
1438
|
+
}
|
|
1439
|
+
s.status =
|
|
1440
|
+
//#ifdef GZIP
|
|
1441
|
+
s.wrap === 2 ? GZIP_STATE :
|
|
1442
|
+
//#endif
|
|
1443
|
+
s.wrap ? INIT_STATE : BUSY_STATE;
|
|
1444
|
+
strm.adler = (s.wrap === 2) ?
|
|
1445
|
+
0 // crc32(0, Z_NULL, 0)
|
|
1446
|
+
:
|
|
1447
|
+
1; // adler32(0, Z_NULL, 0)
|
|
1448
|
+
s.last_flush = -2;
|
|
1449
|
+
_tr_init(s);
|
|
1450
|
+
return Z_OK;
|
|
1451
|
+
};
|
|
1452
|
+
|
|
1453
|
+
|
|
1454
|
+
const deflateReset = (strm) => {
|
|
1455
|
+
|
|
1456
|
+
const ret = deflateResetKeep(strm);
|
|
1457
|
+
if (ret === Z_OK) {
|
|
1458
|
+
lm_init(strm.state);
|
|
1459
|
+
}
|
|
1460
|
+
return ret;
|
|
1461
|
+
};
|
|
1462
|
+
|
|
1463
|
+
|
|
1464
|
+
const deflateSetHeader = (strm, head) => {
|
|
1465
|
+
|
|
1466
|
+
if (deflateStateCheck(strm) || strm.state.wrap !== 2) {
|
|
1467
|
+
return Z_STREAM_ERROR;
|
|
1468
|
+
}
|
|
1469
|
+
strm.state.gzhead = head;
|
|
1470
|
+
return Z_OK;
|
|
1471
|
+
};
|
|
1472
|
+
|
|
1473
|
+
|
|
1474
|
+
const deflateInit2 = (strm, level, method, windowBits, memLevel, strategy, legacyHash) => {
|
|
1475
|
+
|
|
1476
|
+
if (!strm) { // === Z_NULL
|
|
1477
|
+
return Z_STREAM_ERROR;
|
|
1478
|
+
}
|
|
1479
|
+
let wrap = 1;
|
|
1480
|
+
|
|
1481
|
+
if (level === Z_DEFAULT_COMPRESSION) {
|
|
1482
|
+
level = 6;
|
|
1483
|
+
}
|
|
1484
|
+
|
|
1485
|
+
if (windowBits < 0) { /* suppress zlib wrapper */
|
|
1486
|
+
wrap = 0;
|
|
1487
|
+
windowBits = -windowBits;
|
|
1488
|
+
}
|
|
1489
|
+
|
|
1490
|
+
else if (windowBits > 15) {
|
|
1491
|
+
wrap = 2; /* write gzip wrapper instead */
|
|
1492
|
+
windowBits -= 16;
|
|
1493
|
+
}
|
|
1494
|
+
|
|
1495
|
+
|
|
1496
|
+
if (memLevel < 1 || memLevel > MAX_MEM_LEVEL || method !== Z_DEFLATED ||
|
|
1497
|
+
windowBits < 8 || windowBits > 15 || level < 0 || level > 9 ||
|
|
1498
|
+
strategy < 0 || strategy > Z_FIXED || (windowBits === 8 && wrap !== 1)) {
|
|
1499
|
+
return err(strm, Z_STREAM_ERROR);
|
|
1500
|
+
}
|
|
1501
|
+
|
|
1502
|
+
|
|
1503
|
+
if (windowBits === 8) {
|
|
1504
|
+
windowBits = 9;
|
|
1505
|
+
}
|
|
1506
|
+
/* until 256-byte window bug fixed */
|
|
1507
|
+
|
|
1508
|
+
const s = new DeflateState();
|
|
1509
|
+
|
|
1510
|
+
strm.state = s;
|
|
1511
|
+
s.strm = strm;
|
|
1512
|
+
s.status = INIT_STATE; /* to pass state test in deflateReset() */
|
|
1513
|
+
|
|
1514
|
+
s.wrap = wrap;
|
|
1515
|
+
s.gzhead = null;
|
|
1516
|
+
s.w_bits = windowBits;
|
|
1517
|
+
s.w_size = 1 << s.w_bits;
|
|
1518
|
+
s.w_mask = s.w_size - 1;
|
|
1519
|
+
|
|
1520
|
+
s.legacy_hash = legacyHash ? 1 : 0;
|
|
1521
|
+
|
|
1522
|
+
s.hash_bits = memLevel + 7;
|
|
1523
|
+
/* ANZAC++ hash needs >= 15 hash bits to span its 4 read bytes. */
|
|
1524
|
+
if (!s.legacy_hash && s.hash_bits < 15) {
|
|
1525
|
+
s.hash_bits = 15;
|
|
1526
|
+
}
|
|
1527
|
+
s.hash_size = 1 << s.hash_bits;
|
|
1528
|
+
s.hash_mask = s.hash_size - 1;
|
|
1529
|
+
s.hash_shift = ~~((s.hash_bits + MIN_MATCH - 1) / MIN_MATCH);
|
|
1530
|
+
|
|
1531
|
+
s.window = new Uint8Array(s.w_size * 2);
|
|
1532
|
+
s.head = new Uint16Array(s.hash_size);
|
|
1533
|
+
s.prev = new Uint16Array(s.w_size);
|
|
1534
|
+
|
|
1535
|
+
// Don't need mem init magic for JS.
|
|
1536
|
+
//s.high_water = 0; /* nothing written to s->window yet */
|
|
1537
|
+
|
|
1538
|
+
s.lit_bufsize = 1 << (memLevel + 6); /* 16K elements by default */
|
|
1539
|
+
|
|
1540
|
+
/* We overlay pending_buf and sym_buf. This works since the average size
|
|
1541
|
+
* for length/distance pairs over any compressed block is assured to be 31
|
|
1542
|
+
* bits or less.
|
|
1543
|
+
*
|
|
1544
|
+
* Analysis: The longest fixed codes are a length code of 8 bits plus 5
|
|
1545
|
+
* extra bits, for lengths 131 to 257. The longest fixed distance codes are
|
|
1546
|
+
* 5 bits plus 13 extra bits, for distances 16385 to 32768. The longest
|
|
1547
|
+
* possible fixed-codes length/distance pair is then 31 bits total.
|
|
1548
|
+
*
|
|
1549
|
+
* sym_buf starts one-fourth of the way into pending_buf. So there are
|
|
1550
|
+
* three bytes in sym_buf for every four bytes in pending_buf. Each symbol
|
|
1551
|
+
* in sym_buf is three bytes -- two for the distance and one for the
|
|
1552
|
+
* literal/length. As each symbol is consumed, the pointer to the next
|
|
1553
|
+
* sym_buf value to read moves forward three bytes. From that symbol, up to
|
|
1554
|
+
* 31 bits are written to pending_buf. The closest the written pending_buf
|
|
1555
|
+
* bits gets to the next sym_buf symbol to read is just before the last
|
|
1556
|
+
* code is written. At that time, 31*(n-2) bits have been written, just
|
|
1557
|
+
* after 24*(n-2) bits have been consumed from sym_buf. sym_buf starts at
|
|
1558
|
+
* 8*n bits into pending_buf. (Note that the symbol buffer fills when n-1
|
|
1559
|
+
* symbols are written.) The closest the writing gets to what is unread is
|
|
1560
|
+
* then n+14 bits. Here n is lit_bufsize, which is 16384 by default, and
|
|
1561
|
+
* can range from 128 to 32768.
|
|
1562
|
+
*
|
|
1563
|
+
* Therefore, at a minimum, there are 142 bits of space between what is
|
|
1564
|
+
* written and what is read in the overlain buffers, so the symbols cannot
|
|
1565
|
+
* be overwritten by the compressed data. That space is actually 139 bits,
|
|
1566
|
+
* due to the three-bit fixed-code block header.
|
|
1567
|
+
*
|
|
1568
|
+
* That covers the case where either Z_FIXED is specified, forcing fixed
|
|
1569
|
+
* codes, or when the use of fixed codes is chosen, because that choice
|
|
1570
|
+
* results in a smaller compressed block than dynamic codes. That latter
|
|
1571
|
+
* condition then assures that the above analysis also covers all dynamic
|
|
1572
|
+
* blocks. A dynamic-code block will only be chosen to be emitted if it has
|
|
1573
|
+
* fewer bits than a fixed-code block would for the same set of symbols.
|
|
1574
|
+
* Therefore its average symbol length is assured to be less than 31. So
|
|
1575
|
+
* the compressed data for a dynamic block also cannot overwrite the
|
|
1576
|
+
* symbols from which it is being constructed.
|
|
1577
|
+
*/
|
|
1578
|
+
|
|
1579
|
+
s.pending_buf_size = s.lit_bufsize * 4;
|
|
1580
|
+
s.pending_buf = new Uint8Array(s.pending_buf_size);
|
|
1581
|
+
|
|
1582
|
+
// It is offset from `s.pending_buf` (size is `s.lit_bufsize * 2`)
|
|
1583
|
+
//s->sym_buf = s->pending_buf + s->lit_bufsize;
|
|
1584
|
+
s.sym_buf = s.lit_bufsize;
|
|
1585
|
+
|
|
1586
|
+
//s->sym_end = (s->lit_bufsize - 1) * 3;
|
|
1587
|
+
s.sym_end = (s.lit_bufsize - 1) * 3;
|
|
1588
|
+
/* We avoid equality with lit_bufsize*3 because of wraparound at 64K
|
|
1589
|
+
* on 16 bit machines and because stored blocks are restricted to
|
|
1590
|
+
* 64K-1 bytes.
|
|
1591
|
+
*/
|
|
1592
|
+
|
|
1593
|
+
s.level = level;
|
|
1594
|
+
s.strategy = strategy;
|
|
1595
|
+
s.method = method;
|
|
1596
|
+
|
|
1597
|
+
return deflateReset(strm);
|
|
1598
|
+
};
|
|
1599
|
+
|
|
1600
|
+
const deflateInit = (strm, level) => {
|
|
1601
|
+
|
|
1602
|
+
return deflateInit2(strm, level, Z_DEFLATED, MAX_WBITS, DEF_MEM_LEVEL, Z_DEFAULT_STRATEGY);
|
|
1603
|
+
};
|
|
1604
|
+
|
|
1605
|
+
|
|
1606
|
+
/* ========================================================================= */
|
|
1607
|
+
const deflate = (strm, flush) => {
|
|
1608
|
+
|
|
1609
|
+
if (deflateStateCheck(strm) || flush > Z_BLOCK || flush < 0) {
|
|
1610
|
+
return strm ? err(strm, Z_STREAM_ERROR) : Z_STREAM_ERROR;
|
|
1611
|
+
}
|
|
1612
|
+
|
|
1613
|
+
const s = strm.state;
|
|
1614
|
+
|
|
1615
|
+
if (!strm.output ||
|
|
1616
|
+
(strm.avail_in !== 0 && !strm.input) ||
|
|
1617
|
+
(s.status === FINISH_STATE && flush !== Z_FINISH)) {
|
|
1618
|
+
return err(strm, (strm.avail_out === 0) ? Z_BUF_ERROR : Z_STREAM_ERROR);
|
|
1619
|
+
}
|
|
1620
|
+
|
|
1621
|
+
const old_flush = s.last_flush;
|
|
1622
|
+
s.last_flush = flush;
|
|
1623
|
+
|
|
1624
|
+
/* Flush as much pending output as possible */
|
|
1625
|
+
if (s.pending !== 0) {
|
|
1626
|
+
flush_pending(strm);
|
|
1627
|
+
if (strm.avail_out === 0) {
|
|
1628
|
+
/* Since avail_out is 0, deflate will be called again with
|
|
1629
|
+
* more output space, but possibly with both pending and
|
|
1630
|
+
* avail_in equal to zero. There won't be anything to do,
|
|
1631
|
+
* but this is not an error situation so make sure we
|
|
1632
|
+
* return OK instead of BUF_ERROR at next call of deflate:
|
|
1633
|
+
*/
|
|
1634
|
+
s.last_flush = -1;
|
|
1635
|
+
return Z_OK;
|
|
1636
|
+
}
|
|
1637
|
+
|
|
1638
|
+
/* Make sure there is something to do and avoid duplicate consecutive
|
|
1639
|
+
* flushes. For repeated and useless calls with Z_FINISH, we keep
|
|
1640
|
+
* returning Z_STREAM_END instead of Z_BUF_ERROR.
|
|
1641
|
+
*/
|
|
1642
|
+
} else if (strm.avail_in === 0 && rank(flush) <= rank(old_flush) &&
|
|
1643
|
+
flush !== Z_FINISH) {
|
|
1644
|
+
return err(strm, Z_BUF_ERROR);
|
|
1645
|
+
}
|
|
1646
|
+
|
|
1647
|
+
/* User must not provide more input after the first FINISH: */
|
|
1648
|
+
if (s.status === FINISH_STATE && strm.avail_in !== 0) {
|
|
1649
|
+
return err(strm, Z_BUF_ERROR);
|
|
1650
|
+
}
|
|
1651
|
+
|
|
1652
|
+
/* Write the header */
|
|
1653
|
+
if (s.status === INIT_STATE && s.wrap === 0) {
|
|
1654
|
+
s.status = BUSY_STATE;
|
|
1655
|
+
}
|
|
1656
|
+
if (s.status === INIT_STATE) {
|
|
1657
|
+
/* zlib header */
|
|
1658
|
+
let header = (Z_DEFLATED + ((s.w_bits - 8) << 4)) << 8;
|
|
1659
|
+
let level_flags = -1;
|
|
1660
|
+
|
|
1661
|
+
if (s.strategy >= Z_HUFFMAN_ONLY || s.level < 2) {
|
|
1662
|
+
level_flags = 0;
|
|
1663
|
+
} else if (s.level < 6) {
|
|
1664
|
+
level_flags = 1;
|
|
1665
|
+
} else if (s.level === 6) {
|
|
1666
|
+
level_flags = 2;
|
|
1667
|
+
} else {
|
|
1668
|
+
level_flags = 3;
|
|
1669
|
+
}
|
|
1670
|
+
header |= (level_flags << 6);
|
|
1671
|
+
if (s.strstart !== 0) { header |= PRESET_DICT; }
|
|
1672
|
+
header += 31 - (header % 31);
|
|
1673
|
+
|
|
1674
|
+
putShortMSB(s, header);
|
|
1675
|
+
|
|
1676
|
+
/* Save the adler32 of the preset dictionary: */
|
|
1677
|
+
if (s.strstart !== 0) {
|
|
1678
|
+
putShortMSB(s, strm.adler >>> 16);
|
|
1679
|
+
putShortMSB(s, strm.adler & 0xffff);
|
|
1680
|
+
}
|
|
1681
|
+
strm.adler = 1; // adler32(0L, Z_NULL, 0);
|
|
1682
|
+
s.status = BUSY_STATE;
|
|
1683
|
+
|
|
1684
|
+
/* Compression must start with an empty pending buffer */
|
|
1685
|
+
flush_pending(strm);
|
|
1686
|
+
if (s.pending !== 0) {
|
|
1687
|
+
s.last_flush = -1;
|
|
1688
|
+
return Z_OK;
|
|
1689
|
+
}
|
|
1690
|
+
}
|
|
1691
|
+
//#ifdef GZIP
|
|
1692
|
+
if (s.status === GZIP_STATE) {
|
|
1693
|
+
/* gzip header */
|
|
1694
|
+
strm.adler = 0; //crc32(0L, Z_NULL, 0);
|
|
1695
|
+
put_byte(s, 31);
|
|
1696
|
+
put_byte(s, 139);
|
|
1697
|
+
put_byte(s, 8);
|
|
1698
|
+
if (!s.gzhead) { // s->gzhead == Z_NULL
|
|
1699
|
+
put_byte(s, 0);
|
|
1700
|
+
put_byte(s, 0);
|
|
1701
|
+
put_byte(s, 0);
|
|
1702
|
+
put_byte(s, 0);
|
|
1703
|
+
put_byte(s, 0);
|
|
1704
|
+
put_byte(s, s.level === 9 ? 2 :
|
|
1705
|
+
(s.strategy >= Z_HUFFMAN_ONLY || s.level < 2 ?
|
|
1706
|
+
4 : 0));
|
|
1707
|
+
put_byte(s, OS_CODE);
|
|
1708
|
+
s.status = BUSY_STATE;
|
|
1709
|
+
|
|
1710
|
+
/* Compression must start with an empty pending buffer */
|
|
1711
|
+
flush_pending(strm);
|
|
1712
|
+
if (s.pending !== 0) {
|
|
1713
|
+
s.last_flush = -1;
|
|
1714
|
+
return Z_OK;
|
|
1715
|
+
}
|
|
1716
|
+
}
|
|
1717
|
+
else {
|
|
1718
|
+
put_byte(s, (s.gzhead.text ? 1 : 0) +
|
|
1719
|
+
(s.gzhead.hcrc ? 2 : 0) +
|
|
1720
|
+
(!s.gzhead.extra ? 0 : 4) +
|
|
1721
|
+
(!s.gzhead.name ? 0 : 8) +
|
|
1722
|
+
(!s.gzhead.comment ? 0 : 16)
|
|
1723
|
+
);
|
|
1724
|
+
put_byte(s, s.gzhead.time & 0xff);
|
|
1725
|
+
put_byte(s, (s.gzhead.time >> 8) & 0xff);
|
|
1726
|
+
put_byte(s, (s.gzhead.time >> 16) & 0xff);
|
|
1727
|
+
put_byte(s, (s.gzhead.time >> 24) & 0xff);
|
|
1728
|
+
put_byte(s, s.level === 9 ? 2 :
|
|
1729
|
+
(s.strategy >= Z_HUFFMAN_ONLY || s.level < 2 ?
|
|
1730
|
+
4 : 0));
|
|
1731
|
+
put_byte(s, s.gzhead.os & 0xff);
|
|
1732
|
+
if (s.gzhead.extra && s.gzhead.extra.length) {
|
|
1733
|
+
put_byte(s, s.gzhead.extra.length & 0xff);
|
|
1734
|
+
put_byte(s, (s.gzhead.extra.length >> 8) & 0xff);
|
|
1735
|
+
}
|
|
1736
|
+
if (s.gzhead.hcrc) {
|
|
1737
|
+
strm.adler = crc32(strm.adler, s.pending_buf, s.pending, 0);
|
|
1738
|
+
}
|
|
1739
|
+
s.gzindex = 0;
|
|
1740
|
+
s.status = EXTRA_STATE;
|
|
1741
|
+
}
|
|
1742
|
+
}
|
|
1743
|
+
if (s.status === EXTRA_STATE) {
|
|
1744
|
+
if (s.gzhead.extra/* != Z_NULL*/) {
|
|
1745
|
+
let beg = s.pending; /* start of bytes to update crc */
|
|
1746
|
+
let left = (s.gzhead.extra.length & 0xffff) - s.gzindex;
|
|
1747
|
+
while (s.pending + left > s.pending_buf_size) {
|
|
1748
|
+
let copy = s.pending_buf_size - s.pending;
|
|
1749
|
+
// zmemcpy(s.pending_buf + s.pending,
|
|
1750
|
+
// s.gzhead.extra + s.gzindex, copy);
|
|
1751
|
+
s.pending_buf.set(s.gzhead.extra.subarray(s.gzindex, s.gzindex + copy), s.pending);
|
|
1752
|
+
s.pending = s.pending_buf_size;
|
|
1753
|
+
//--- HCRC_UPDATE(beg) ---//
|
|
1754
|
+
if (s.gzhead.hcrc && s.pending > beg) {
|
|
1755
|
+
strm.adler = crc32(strm.adler, s.pending_buf, s.pending - beg, beg);
|
|
1756
|
+
}
|
|
1757
|
+
//---//
|
|
1758
|
+
s.gzindex += copy;
|
|
1759
|
+
flush_pending(strm);
|
|
1760
|
+
if (s.pending !== 0) {
|
|
1761
|
+
s.last_flush = -1;
|
|
1762
|
+
return Z_OK;
|
|
1763
|
+
}
|
|
1764
|
+
beg = 0;
|
|
1765
|
+
left -= copy;
|
|
1766
|
+
}
|
|
1767
|
+
// JS specific: s.gzhead.extra may be TypedArray or Array for backward compatibility
|
|
1768
|
+
// TypedArray.slice and TypedArray.from don't exist in IE10-IE11
|
|
1769
|
+
let gzhead_extra = new Uint8Array(s.gzhead.extra);
|
|
1770
|
+
// zmemcpy(s->pending_buf + s->pending,
|
|
1771
|
+
// s->gzhead->extra + s->gzindex, left);
|
|
1772
|
+
s.pending_buf.set(gzhead_extra.subarray(s.gzindex, s.gzindex + left), s.pending);
|
|
1773
|
+
s.pending += left;
|
|
1774
|
+
//--- HCRC_UPDATE(beg) ---//
|
|
1775
|
+
if (s.gzhead.hcrc && s.pending > beg) {
|
|
1776
|
+
strm.adler = crc32(strm.adler, s.pending_buf, s.pending - beg, beg);
|
|
1777
|
+
}
|
|
1778
|
+
//---//
|
|
1779
|
+
s.gzindex = 0;
|
|
1780
|
+
}
|
|
1781
|
+
s.status = NAME_STATE;
|
|
1782
|
+
}
|
|
1783
|
+
if (s.status === NAME_STATE) {
|
|
1784
|
+
if (s.gzhead.name/* != Z_NULL*/) {
|
|
1785
|
+
let beg = s.pending; /* start of bytes to update crc */
|
|
1786
|
+
let val;
|
|
1787
|
+
do {
|
|
1788
|
+
if (s.pending === s.pending_buf_size) {
|
|
1789
|
+
//--- HCRC_UPDATE(beg) ---//
|
|
1790
|
+
if (s.gzhead.hcrc && s.pending > beg) {
|
|
1791
|
+
strm.adler = crc32(strm.adler, s.pending_buf, s.pending - beg, beg);
|
|
1792
|
+
}
|
|
1793
|
+
//---//
|
|
1794
|
+
flush_pending(strm);
|
|
1795
|
+
if (s.pending !== 0) {
|
|
1796
|
+
s.last_flush = -1;
|
|
1797
|
+
return Z_OK;
|
|
1798
|
+
}
|
|
1799
|
+
beg = 0;
|
|
1800
|
+
}
|
|
1801
|
+
// JS specific: little magic to add zero terminator to end of string
|
|
1802
|
+
if (s.gzindex < s.gzhead.name.length) {
|
|
1803
|
+
val = s.gzhead.name.charCodeAt(s.gzindex++) & 0xff;
|
|
1804
|
+
} else {
|
|
1805
|
+
val = 0;
|
|
1806
|
+
}
|
|
1807
|
+
put_byte(s, val);
|
|
1808
|
+
} while (val !== 0);
|
|
1809
|
+
//--- HCRC_UPDATE(beg) ---//
|
|
1810
|
+
if (s.gzhead.hcrc && s.pending > beg) {
|
|
1811
|
+
strm.adler = crc32(strm.adler, s.pending_buf, s.pending - beg, beg);
|
|
1812
|
+
}
|
|
1813
|
+
//---//
|
|
1814
|
+
s.gzindex = 0;
|
|
1815
|
+
}
|
|
1816
|
+
s.status = COMMENT_STATE;
|
|
1817
|
+
}
|
|
1818
|
+
if (s.status === COMMENT_STATE) {
|
|
1819
|
+
if (s.gzhead.comment/* != Z_NULL*/) {
|
|
1820
|
+
let beg = s.pending; /* start of bytes to update crc */
|
|
1821
|
+
let val;
|
|
1822
|
+
do {
|
|
1823
|
+
if (s.pending === s.pending_buf_size) {
|
|
1824
|
+
//--- HCRC_UPDATE(beg) ---//
|
|
1825
|
+
if (s.gzhead.hcrc && s.pending > beg) {
|
|
1826
|
+
strm.adler = crc32(strm.adler, s.pending_buf, s.pending - beg, beg);
|
|
1827
|
+
}
|
|
1828
|
+
//---//
|
|
1829
|
+
flush_pending(strm);
|
|
1830
|
+
if (s.pending !== 0) {
|
|
1831
|
+
s.last_flush = -1;
|
|
1832
|
+
return Z_OK;
|
|
1833
|
+
}
|
|
1834
|
+
beg = 0;
|
|
1835
|
+
}
|
|
1836
|
+
// JS specific: little magic to add zero terminator to end of string
|
|
1837
|
+
if (s.gzindex < s.gzhead.comment.length) {
|
|
1838
|
+
val = s.gzhead.comment.charCodeAt(s.gzindex++) & 0xff;
|
|
1839
|
+
} else {
|
|
1840
|
+
val = 0;
|
|
1841
|
+
}
|
|
1842
|
+
put_byte(s, val);
|
|
1843
|
+
} while (val !== 0);
|
|
1844
|
+
//--- HCRC_UPDATE(beg) ---//
|
|
1845
|
+
if (s.gzhead.hcrc && s.pending > beg) {
|
|
1846
|
+
strm.adler = crc32(strm.adler, s.pending_buf, s.pending - beg, beg);
|
|
1847
|
+
}
|
|
1848
|
+
//---//
|
|
1849
|
+
}
|
|
1850
|
+
s.status = HCRC_STATE;
|
|
1851
|
+
}
|
|
1852
|
+
if (s.status === HCRC_STATE) {
|
|
1853
|
+
if (s.gzhead.hcrc) {
|
|
1854
|
+
if (s.pending + 2 > s.pending_buf_size) {
|
|
1855
|
+
flush_pending(strm);
|
|
1856
|
+
if (s.pending !== 0) {
|
|
1857
|
+
s.last_flush = -1;
|
|
1858
|
+
return Z_OK;
|
|
1859
|
+
}
|
|
1860
|
+
}
|
|
1861
|
+
put_byte(s, strm.adler & 0xff);
|
|
1862
|
+
put_byte(s, (strm.adler >> 8) & 0xff);
|
|
1863
|
+
strm.adler = 0; //crc32(0L, Z_NULL, 0);
|
|
1864
|
+
}
|
|
1865
|
+
s.status = BUSY_STATE;
|
|
1866
|
+
|
|
1867
|
+
/* Compression must start with an empty pending buffer */
|
|
1868
|
+
flush_pending(strm);
|
|
1869
|
+
if (s.pending !== 0) {
|
|
1870
|
+
s.last_flush = -1;
|
|
1871
|
+
return Z_OK;
|
|
1872
|
+
}
|
|
1873
|
+
}
|
|
1874
|
+
//#endif
|
|
1875
|
+
|
|
1876
|
+
/* Start a new block or continue the current one.
|
|
1877
|
+
*/
|
|
1878
|
+
if (strm.avail_in !== 0 || s.lookahead !== 0 ||
|
|
1879
|
+
(flush !== Z_NO_FLUSH && s.status !== FINISH_STATE)) {
|
|
1880
|
+
let bstate = s.level === 0 ? deflate_stored(s, flush) :
|
|
1881
|
+
s.strategy === Z_HUFFMAN_ONLY ? deflate_huff(s, flush) :
|
|
1882
|
+
s.strategy === Z_RLE ? deflate_rle(s, flush) :
|
|
1883
|
+
configuration_table[s.level].func(s, flush);
|
|
1884
|
+
|
|
1885
|
+
if (bstate === BS_FINISH_STARTED || bstate === BS_FINISH_DONE) {
|
|
1886
|
+
s.status = FINISH_STATE;
|
|
1887
|
+
}
|
|
1888
|
+
if (bstate === BS_NEED_MORE || bstate === BS_FINISH_STARTED) {
|
|
1889
|
+
if (strm.avail_out === 0) {
|
|
1890
|
+
s.last_flush = -1;
|
|
1891
|
+
/* avoid BUF_ERROR next call, see above */
|
|
1892
|
+
}
|
|
1893
|
+
return Z_OK;
|
|
1894
|
+
/* If flush != Z_NO_FLUSH && avail_out == 0, the next call
|
|
1895
|
+
* of deflate should use the same flush parameter to make sure
|
|
1896
|
+
* that the flush is complete. So we don't have to output an
|
|
1897
|
+
* empty block here, this will be done at next call. This also
|
|
1898
|
+
* ensures that for a very small output buffer, we emit at most
|
|
1899
|
+
* one empty block.
|
|
1900
|
+
*/
|
|
1901
|
+
}
|
|
1902
|
+
if (bstate === BS_BLOCK_DONE) {
|
|
1903
|
+
if (flush === Z_PARTIAL_FLUSH) {
|
|
1904
|
+
_tr_align(s);
|
|
1905
|
+
}
|
|
1906
|
+
else if (flush !== Z_BLOCK) { /* FULL_FLUSH or SYNC_FLUSH */
|
|
1907
|
+
|
|
1908
|
+
_tr_stored_block(s, 0, 0, false);
|
|
1909
|
+
/* For a full flush, this empty block will be recognized
|
|
1910
|
+
* as a special marker by inflate_sync().
|
|
1911
|
+
*/
|
|
1912
|
+
if (flush === Z_FULL_FLUSH) {
|
|
1913
|
+
/*** CLEAR_HASH(s); ***/ /* forget history */
|
|
1914
|
+
zero(s.head); // Fill with NIL (= 0);
|
|
1915
|
+
|
|
1916
|
+
if (s.lookahead === 0) {
|
|
1917
|
+
s.strstart = 0;
|
|
1918
|
+
s.block_start = 0;
|
|
1919
|
+
s.insert = 0;
|
|
1920
|
+
}
|
|
1921
|
+
}
|
|
1922
|
+
}
|
|
1923
|
+
flush_pending(strm);
|
|
1924
|
+
if (strm.avail_out === 0) {
|
|
1925
|
+
s.last_flush = -1; /* avoid BUF_ERROR at next call, see above */
|
|
1926
|
+
return Z_OK;
|
|
1927
|
+
}
|
|
1928
|
+
}
|
|
1929
|
+
}
|
|
1930
|
+
|
|
1931
|
+
if (flush !== Z_FINISH) { return Z_OK; }
|
|
1932
|
+
if (s.wrap <= 0) { return Z_STREAM_END; }
|
|
1933
|
+
|
|
1934
|
+
/* Write the trailer */
|
|
1935
|
+
if (s.wrap === 2) {
|
|
1936
|
+
put_byte(s, strm.adler & 0xff);
|
|
1937
|
+
put_byte(s, (strm.adler >> 8) & 0xff);
|
|
1938
|
+
put_byte(s, (strm.adler >> 16) & 0xff);
|
|
1939
|
+
put_byte(s, (strm.adler >> 24) & 0xff);
|
|
1940
|
+
put_byte(s, strm.total_in & 0xff);
|
|
1941
|
+
put_byte(s, (strm.total_in >> 8) & 0xff);
|
|
1942
|
+
put_byte(s, (strm.total_in >> 16) & 0xff);
|
|
1943
|
+
put_byte(s, (strm.total_in >> 24) & 0xff);
|
|
1944
|
+
}
|
|
1945
|
+
else
|
|
1946
|
+
{
|
|
1947
|
+
putShortMSB(s, strm.adler >>> 16);
|
|
1948
|
+
putShortMSB(s, strm.adler & 0xffff);
|
|
1949
|
+
}
|
|
1950
|
+
|
|
1951
|
+
flush_pending(strm);
|
|
1952
|
+
/* If avail_out is zero, the application will call deflate again
|
|
1953
|
+
* to flush the rest.
|
|
1954
|
+
*/
|
|
1955
|
+
if (s.wrap > 0) { s.wrap = -s.wrap; }
|
|
1956
|
+
/* write the trailer only once! */
|
|
1957
|
+
return s.pending !== 0 ? Z_OK : Z_STREAM_END;
|
|
1958
|
+
};
|
|
1959
|
+
|
|
1960
|
+
|
|
1961
|
+
const deflateEnd = (strm) => {
|
|
1962
|
+
|
|
1963
|
+
if (deflateStateCheck(strm)) {
|
|
1964
|
+
return Z_STREAM_ERROR;
|
|
1965
|
+
}
|
|
1966
|
+
|
|
1967
|
+
const status = strm.state.status;
|
|
1968
|
+
|
|
1969
|
+
strm.state = null;
|
|
1970
|
+
|
|
1971
|
+
return status === BUSY_STATE ? err(strm, Z_DATA_ERROR) : Z_OK;
|
|
1972
|
+
};
|
|
1973
|
+
|
|
1974
|
+
|
|
1975
|
+
/* =========================================================================
|
|
1976
|
+
* Initializes the compression dictionary from the given byte
|
|
1977
|
+
* sequence without producing any compressed output.
|
|
1978
|
+
*/
|
|
1979
|
+
const deflateSetDictionary = (strm, dictionary) => {
|
|
1980
|
+
|
|
1981
|
+
let dictLength = dictionary.length;
|
|
1982
|
+
|
|
1983
|
+
if (deflateStateCheck(strm)) {
|
|
1984
|
+
return Z_STREAM_ERROR;
|
|
1985
|
+
}
|
|
1986
|
+
|
|
1987
|
+
const s = strm.state;
|
|
1988
|
+
const wrap = s.wrap;
|
|
1989
|
+
|
|
1990
|
+
if (wrap === 2 || (wrap === 1 && s.status !== INIT_STATE) || s.lookahead) {
|
|
1991
|
+
return Z_STREAM_ERROR;
|
|
1992
|
+
}
|
|
1993
|
+
|
|
1994
|
+
/* when using zlib wrappers, compute Adler-32 for provided dictionary */
|
|
1995
|
+
if (wrap === 1) {
|
|
1996
|
+
/* adler32(strm->adler, dictionary, dictLength); */
|
|
1997
|
+
strm.adler = adler32(strm.adler, dictionary, dictLength, 0);
|
|
1998
|
+
}
|
|
1999
|
+
|
|
2000
|
+
s.wrap = 0; /* avoid computing Adler-32 in read_buf */
|
|
2001
|
+
|
|
2002
|
+
/* if dictionary would fill window, just replace the history */
|
|
2003
|
+
if (dictLength >= s.w_size) {
|
|
2004
|
+
if (wrap === 0) { /* already empty otherwise */
|
|
2005
|
+
/*** CLEAR_HASH(s); ***/
|
|
2006
|
+
zero(s.head); // Fill with NIL (= 0);
|
|
2007
|
+
s.strstart = 0;
|
|
2008
|
+
s.block_start = 0;
|
|
2009
|
+
s.insert = 0;
|
|
2010
|
+
}
|
|
2011
|
+
/* use the tail */
|
|
2012
|
+
// dictionary = dictionary.slice(dictLength - s.w_size);
|
|
2013
|
+
let tmpDict = new Uint8Array(s.w_size);
|
|
2014
|
+
tmpDict.set(dictionary.subarray(dictLength - s.w_size, dictLength), 0);
|
|
2015
|
+
dictionary = tmpDict;
|
|
2016
|
+
dictLength = s.w_size;
|
|
2017
|
+
}
|
|
2018
|
+
/* insert dictionary into window and hash */
|
|
2019
|
+
const avail = strm.avail_in;
|
|
2020
|
+
const next = strm.next_in;
|
|
2021
|
+
const input = strm.input;
|
|
2022
|
+
strm.avail_in = dictLength;
|
|
2023
|
+
strm.next_in = 0;
|
|
2024
|
+
strm.input = dictionary;
|
|
2025
|
+
fill_window(s);
|
|
2026
|
+
while (s.lookahead >= MIN_MATCH) {
|
|
2027
|
+
let str = s.strstart;
|
|
2028
|
+
let n = s.lookahead - (MIN_MATCH - 1);
|
|
2029
|
+
do {
|
|
2030
|
+
INSERT_STRING(s, str);
|
|
2031
|
+
str++;
|
|
2032
|
+
} while (--n);
|
|
2033
|
+
s.strstart = str;
|
|
2034
|
+
s.lookahead = MIN_MATCH - 1;
|
|
2035
|
+
fill_window(s);
|
|
2036
|
+
}
|
|
2037
|
+
s.strstart += s.lookahead;
|
|
2038
|
+
s.block_start = s.strstart;
|
|
2039
|
+
s.insert = s.lookahead;
|
|
2040
|
+
s.lookahead = 0;
|
|
2041
|
+
s.match_length = s.prev_length = MIN_MATCH - 1;
|
|
2042
|
+
s.match_available = 0;
|
|
2043
|
+
strm.next_in = next;
|
|
2044
|
+
strm.input = input;
|
|
2045
|
+
strm.avail_in = avail;
|
|
2046
|
+
s.wrap = wrap;
|
|
2047
|
+
return Z_OK;
|
|
2048
|
+
};
|
|
2049
|
+
|
|
2050
|
+
|
|
2051
|
+
module.exports.deflateInit = deflateInit;
|
|
2052
|
+
module.exports.deflateInit2 = deflateInit2;
|
|
2053
|
+
module.exports.deflateReset = deflateReset;
|
|
2054
|
+
module.exports.deflateResetKeep = deflateResetKeep;
|
|
2055
|
+
module.exports.deflateSetHeader = deflateSetHeader;
|
|
2056
|
+
module.exports.deflate = deflate;
|
|
2057
|
+
module.exports.deflateEnd = deflateEnd;
|
|
2058
|
+
module.exports.deflateSetDictionary = deflateSetDictionary;
|
|
2059
|
+
module.exports.deflateInfo = 'pako deflate (from Nodeca project)';
|
|
2060
|
+
|
|
2061
|
+
/* Not implemented
|
|
2062
|
+
module.exports.deflateBound = deflateBound;
|
|
2063
|
+
module.exports.deflateCopy = deflateCopy;
|
|
2064
|
+
module.exports.deflateGetDictionary = deflateGetDictionary;
|
|
2065
|
+
module.exports.deflateParams = deflateParams;
|
|
2066
|
+
module.exports.deflatePending = deflatePending;
|
|
2067
|
+
module.exports.deflatePrime = deflatePrime;
|
|
2068
|
+
module.exports.deflateTune = deflateTune;
|
|
2069
|
+
*/
|