@airgap/coinlib-core 0.13.11-beta.1 → 0.13.11-beta.2
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/actions/Action.d.ts +24 -0
- package/actions/Action.js +119 -0
- package/actions/Action.js.map +1 -0
- package/actions/LinkedAction.d.ts +10 -0
- package/actions/LinkedAction.js +95 -0
- package/actions/LinkedAction.js.map +1 -0
- package/actions/RepeatableAction.d.ts +8 -0
- package/actions/RepeatableAction.js +92 -0
- package/actions/RepeatableAction.js.map +1 -0
- package/actions/SimpleAction.d.ts +7 -0
- package/actions/SimpleAction.js +80 -0
- package/actions/SimpleAction.js.map +1 -0
- package/actions/StateMachine.d.ts +9 -0
- package/actions/StateMachine.js +42 -0
- package/actions/StateMachine.js.map +1 -0
- package/data/KeyPair.d.ts +5 -0
- package/data/KeyPair.js +3 -0
- package/data/KeyPair.js.map +1 -0
- package/data/Lazy.d.ts +14 -0
- package/data/Lazy.js +83 -0
- package/data/Lazy.js.map +1 -0
- package/data/RPCBody.d.ts +7 -0
- package/data/RPCBody.js +16 -0
- package/data/RPCBody.js.map +1 -0
- package/dependencies/src/@stablelib/binary-1.0.1/packages/binary/binary.d.ts +230 -0
- package/dependencies/src/@stablelib/binary-1.0.1/packages/binary/binary.js +471 -0
- package/dependencies/src/@stablelib/binary-1.0.1/packages/binary/binary.js.map +1 -0
- package/dependencies/src/@stablelib/blake2b-1.0.1/packages/blake2b/blake2b.d.ts +76 -0
- package/dependencies/src/@stablelib/blake2b-1.0.1/packages/blake2b/blake2b.js +455 -0
- package/dependencies/src/@stablelib/blake2b-1.0.1/packages/blake2b/blake2b.js.map +1 -0
- package/dependencies/src/@stablelib/ed25519-1.0.3/packages/ed25519/ed25519.d.ts +27 -0
- package/dependencies/src/@stablelib/ed25519-1.0.3/packages/ed25519/ed25519.js +848 -0
- package/dependencies/src/@stablelib/ed25519-1.0.3/packages/ed25519/ed25519.js.map +1 -0
- package/dependencies/src/@stablelib/hash-1.0.1/packages/hash/hash.d.ts +22 -0
- package/dependencies/src/@stablelib/hash-1.0.1/packages/hash/hash.js +14 -0
- package/dependencies/src/@stablelib/hash-1.0.1/packages/hash/hash.js.map +1 -0
- package/dependencies/src/@stablelib/int-1.0.1/packages/int/int.d.ts +29 -0
- package/dependencies/src/@stablelib/int-1.0.1/packages/int/int.js +63 -0
- package/dependencies/src/@stablelib/int-1.0.1/packages/int/int.js.map +1 -0
- package/dependencies/src/@stablelib/random-1.0.2/packages/random/random.d.ts +36 -0
- package/dependencies/src/@stablelib/random-1.0.2/packages/random/random.js +87 -0
- package/dependencies/src/@stablelib/random-1.0.2/packages/random/random.js.map +1 -0
- package/dependencies/src/@stablelib/random-1.0.2/packages/random/source/browser.d.ts +8 -0
- package/dependencies/src/@stablelib/random-1.0.2/packages/random/source/browser.js +33 -0
- package/dependencies/src/@stablelib/random-1.0.2/packages/random/source/browser.js.map +1 -0
- package/dependencies/src/@stablelib/random-1.0.2/packages/random/source/index.d.ts +11 -0
- package/dependencies/src/@stablelib/random-1.0.2/packages/random/source/index.js +5 -0
- package/dependencies/src/@stablelib/random-1.0.2/packages/random/source/index.js.map +1 -0
- package/dependencies/src/@stablelib/random-1.0.2/packages/random/source/node.d.ts +8 -0
- package/dependencies/src/@stablelib/random-1.0.2/packages/random/source/node.js +43 -0
- package/dependencies/src/@stablelib/random-1.0.2/packages/random/source/node.js.map +1 -0
- package/dependencies/src/@stablelib/random-1.0.2/packages/random/source/system.d.ts +8 -0
- package/dependencies/src/@stablelib/random-1.0.2/packages/random/source/system.js +37 -0
- package/dependencies/src/@stablelib/random-1.0.2/packages/random/source/system.js.map +1 -0
- package/dependencies/src/@stablelib/sha512/packages/sha512/sha512.d.ts +73 -0
- package/dependencies/src/@stablelib/sha512/packages/sha512/sha512.js +552 -0
- package/dependencies/src/@stablelib/sha512/packages/sha512/sha512.js.map +1 -0
- package/dependencies/src/@stablelib/sha512-1.0.1/packages/sha512/sha512.d.ts +73 -0
- package/dependencies/src/@stablelib/sha512-1.0.1/packages/sha512/sha512.js +552 -0
- package/dependencies/src/@stablelib/sha512-1.0.1/packages/sha512/sha512.js.map +1 -0
- package/dependencies/src/@stablelib/wipe-1.0.1/packages/wipe/wipe.d.ts +18 -0
- package/dependencies/src/@stablelib/wipe-1.0.1/packages/wipe/wipe.js +29 -0
- package/dependencies/src/@stablelib/wipe-1.0.1/packages/wipe/wipe.js.map +1 -0
- package/dependencies/src/@taquito/local-forging-15.0.1/packages/taquito-local-forging/src/codec.d.ts +57 -0
- package/dependencies/src/@taquito/local-forging-15.0.1/packages/taquito-local-forging/src/codec.js +384 -0
- package/dependencies/src/@taquito/local-forging-15.0.1/packages/taquito-local-forging/src/codec.js.map +1 -0
- package/dependencies/src/@taquito/local-forging-15.0.1/packages/taquito-local-forging/src/constants.d.ts +63 -0
- package/dependencies/src/@taquito/local-forging-15.0.1/packages/taquito-local-forging/src/constants.js +264 -0
- package/dependencies/src/@taquito/local-forging-15.0.1/packages/taquito-local-forging/src/constants.js.map +1 -0
- package/dependencies/src/@taquito/local-forging-15.0.1/packages/taquito-local-forging/src/decoder.d.ts +5 -0
- package/dependencies/src/@taquito/local-forging-15.0.1/packages/taquito-local-forging/src/decoder.js +82 -0
- package/dependencies/src/@taquito/local-forging-15.0.1/packages/taquito-local-forging/src/decoder.js.map +1 -0
- package/dependencies/src/@taquito/local-forging-15.0.1/packages/taquito-local-forging/src/encoder.d.ts +4 -0
- package/dependencies/src/@taquito/local-forging-15.0.1/packages/taquito-local-forging/src/encoder.js +67 -0
- package/dependencies/src/@taquito/local-forging-15.0.1/packages/taquito-local-forging/src/encoder.js.map +1 -0
- package/dependencies/src/@taquito/local-forging-15.0.1/packages/taquito-local-forging/src/error.d.ts +89 -0
- package/dependencies/src/@taquito/local-forging-15.0.1/packages/taquito-local-forging/src/error.js +169 -0
- package/dependencies/src/@taquito/local-forging-15.0.1/packages/taquito-local-forging/src/error.js.map +1 -0
- package/dependencies/src/@taquito/local-forging-15.0.1/packages/taquito-local-forging/src/interface.d.ts +9 -0
- package/dependencies/src/@taquito/local-forging-15.0.1/packages/taquito-local-forging/src/interface.js +3 -0
- package/dependencies/src/@taquito/local-forging-15.0.1/packages/taquito-local-forging/src/interface.js.map +1 -0
- package/dependencies/src/@taquito/local-forging-15.0.1/packages/taquito-local-forging/src/michelson/codec.d.ts +42 -0
- package/dependencies/src/@taquito/local-forging-15.0.1/packages/taquito-local-forging/src/michelson/codec.js +270 -0
- package/dependencies/src/@taquito/local-forging-15.0.1/packages/taquito-local-forging/src/michelson/codec.js.map +1 -0
- package/dependencies/src/@taquito/local-forging-15.0.1/packages/taquito-local-forging/src/proto14-kathmandu/codec-proto14.d.ts +15 -0
- package/dependencies/src/@taquito/local-forging-15.0.1/packages/taquito-local-forging/src/proto14-kathmandu/codec-proto14.js +80 -0
- package/dependencies/src/@taquito/local-forging-15.0.1/packages/taquito-local-forging/src/proto14-kathmandu/codec-proto14.js.map +1 -0
- package/dependencies/src/@taquito/local-forging-15.0.1/packages/taquito-local-forging/src/proto14-kathmandu/constants-proto14.d.ts +12 -0
- package/dependencies/src/@taquito/local-forging-15.0.1/packages/taquito-local-forging/src/proto14-kathmandu/constants-proto14.js +184 -0
- package/dependencies/src/@taquito/local-forging-15.0.1/packages/taquito-local-forging/src/proto14-kathmandu/constants-proto14.js.map +1 -0
- package/dependencies/src/@taquito/local-forging-15.0.1/packages/taquito-local-forging/src/proto14-kathmandu/decoder-proto14.d.ts +5 -0
- package/dependencies/src/@taquito/local-forging-15.0.1/packages/taquito-local-forging/src/proto14-kathmandu/decoder-proto14.js +81 -0
- package/dependencies/src/@taquito/local-forging-15.0.1/packages/taquito-local-forging/src/proto14-kathmandu/decoder-proto14.js.map +1 -0
- package/dependencies/src/@taquito/local-forging-15.0.1/packages/taquito-local-forging/src/proto14-kathmandu/encoder-proto14.d.ts +4 -0
- package/dependencies/src/@taquito/local-forging-15.0.1/packages/taquito-local-forging/src/proto14-kathmandu/encoder-proto14.js +76 -0
- package/dependencies/src/@taquito/local-forging-15.0.1/packages/taquito-local-forging/src/proto14-kathmandu/encoder-proto14.js.map +1 -0
- package/dependencies/src/@taquito/local-forging-15.0.1/packages/taquito-local-forging/src/proto14-kathmandu/michelson/codec-proto14.d.ts +14 -0
- package/dependencies/src/@taquito/local-forging-15.0.1/packages/taquito-local-forging/src/proto14-kathmandu/michelson/codec-proto14.js +150 -0
- package/dependencies/src/@taquito/local-forging-15.0.1/packages/taquito-local-forging/src/proto14-kathmandu/michelson/codec-proto14.js.map +1 -0
- package/dependencies/src/@taquito/local-forging-15.0.1/packages/taquito-local-forging/src/protocols.d.ts +17 -0
- package/dependencies/src/@taquito/local-forging-15.0.1/packages/taquito-local-forging/src/protocols.js +41 -0
- package/dependencies/src/@taquito/local-forging-15.0.1/packages/taquito-local-forging/src/protocols.js.map +1 -0
- package/dependencies/src/@taquito/local-forging-15.0.1/packages/taquito-local-forging/src/schema/operation.d.ts +150 -0
- package/dependencies/src/@taquito/local-forging-15.0.1/packages/taquito-local-forging/src/schema/operation.js +217 -0
- package/dependencies/src/@taquito/local-forging-15.0.1/packages/taquito-local-forging/src/schema/operation.js.map +1 -0
- package/dependencies/src/@taquito/local-forging-15.0.1/packages/taquito-local-forging/src/taquito-local-forging.d.ts +26 -0
- package/dependencies/src/@taquito/local-forging-15.0.1/packages/taquito-local-forging/src/taquito-local-forging.js +115 -0
- package/dependencies/src/@taquito/local-forging-15.0.1/packages/taquito-local-forging/src/taquito-local-forging.js.map +1 -0
- package/dependencies/src/@taquito/local-forging-15.0.1/packages/taquito-local-forging/src/uint8array-consumer.d.ts +9 -0
- package/dependencies/src/@taquito/local-forging-15.0.1/packages/taquito-local-forging/src/uint8array-consumer.js +35 -0
- package/dependencies/src/@taquito/local-forging-15.0.1/packages/taquito-local-forging/src/uint8array-consumer.js.map +1 -0
- package/dependencies/src/@taquito/local-forging-15.0.1/packages/taquito-local-forging/src/utils.d.ts +3 -0
- package/dependencies/src/@taquito/local-forging-15.0.1/packages/taquito-local-forging/src/utils.js +26 -0
- package/dependencies/src/@taquito/local-forging-15.0.1/packages/taquito-local-forging/src/utils.js.map +1 -0
- package/dependencies/src/@taquito/local-forging-15.0.1/packages/taquito-local-forging/src/validator.d.ts +13 -0
- package/dependencies/src/@taquito/local-forging-15.0.1/packages/taquito-local-forging/src/validator.js +52 -0
- package/dependencies/src/@taquito/local-forging-15.0.1/packages/taquito-local-forging/src/validator.js.map +1 -0
- package/dependencies/src/@taquito/local-forging-15.0.1/packages/taquito-local-forging/src/version.d.ts +4 -0
- package/dependencies/src/@taquito/local-forging-15.0.1/packages/taquito-local-forging/src/version.js +9 -0
- package/dependencies/src/@taquito/local-forging-15.0.1/packages/taquito-local-forging/src/version.js.map +1 -0
- package/dependencies/src/@taquito/local-forging-15.0.1/packages/taquito-rpc/src/opkind.d.ts +34 -0
- package/dependencies/src/@taquito/local-forging-15.0.1/packages/taquito-rpc/src/opkind.js +39 -0
- package/dependencies/src/@taquito/local-forging-15.0.1/packages/taquito-rpc/src/opkind.js.map +1 -0
- package/dependencies/src/@taquito/local-forging-15.0.1/packages/taquito-rpc/src/types.d.ts +1590 -0
- package/dependencies/src/@taquito/local-forging-15.0.1/packages/taquito-rpc/src/types.js +35 -0
- package/dependencies/src/@taquito/local-forging-15.0.1/packages/taquito-rpc/src/types.js.map +1 -0
- package/dependencies/src/@taquito/utils-15.0.1/packages/taquito-utils/src/constants.d.ts +91 -0
- package/dependencies/src/@taquito/utils-15.0.1/packages/taquito-utils/src/constants.js +127 -0
- package/dependencies/src/@taquito/utils-15.0.1/packages/taquito-utils/src/constants.js.map +1 -0
- package/dependencies/src/@taquito/utils-15.0.1/packages/taquito-utils/src/errors.d.ts +145 -0
- package/dependencies/src/@taquito/utils-15.0.1/packages/taquito-utils/src/errors.js +270 -0
- package/dependencies/src/@taquito/utils-15.0.1/packages/taquito-utils/src/errors.js.map +1 -0
- package/dependencies/src/@taquito/utils-15.0.1/packages/taquito-utils/src/format.d.ts +4 -0
- package/dependencies/src/@taquito/utils-15.0.1/packages/taquito-utils/src/format.js +33 -0
- package/dependencies/src/@taquito/utils-15.0.1/packages/taquito-utils/src/format.js.map +1 -0
- package/dependencies/src/@taquito/utils-15.0.1/packages/taquito-utils/src/taquito-utils.d.ts +163 -0
- package/dependencies/src/@taquito/utils-15.0.1/packages/taquito-utils/src/taquito-utils.js +438 -0
- package/dependencies/src/@taquito/utils-15.0.1/packages/taquito-utils/src/taquito-utils.js.map +1 -0
- package/dependencies/src/@taquito/utils-15.0.1/packages/taquito-utils/src/validators.d.ts +158 -0
- package/dependencies/src/@taquito/utils-15.0.1/packages/taquito-utils/src/validators.js +254 -0
- package/dependencies/src/@taquito/utils-15.0.1/packages/taquito-utils/src/validators.js.map +1 -0
- package/dependencies/src/@taquito/utils-15.0.1/packages/taquito-utils/src/verify-signature.d.ts +24 -0
- package/dependencies/src/@taquito/utils-15.0.1/packages/taquito-utils/src/verify-signature.js +126 -0
- package/dependencies/src/@taquito/utils-15.0.1/packages/taquito-utils/src/verify-signature.js.map +1 -0
- package/dependencies/src/@taquito/utils-15.0.1/packages/taquito-utils/src/version.d.ts +4 -0
- package/dependencies/src/@taquito/utils-15.0.1/packages/taquito-utils/src/version.js +9 -0
- package/dependencies/src/@taquito/utils-15.0.1/packages/taquito-utils/src/version.js.map +1 -0
- package/dependencies/src/axios-0.19.0/index.d.ts +152 -0
- package/dependencies/src/axios-0.19.0/index.js +1 -0
- package/dependencies/src/axios-0.19.0/lib/adapters/http.js +275 -0
- package/dependencies/src/axios-0.19.0/lib/adapters/xhr.js +174 -0
- package/dependencies/src/axios-0.19.0/lib/axios.js +53 -0
- package/dependencies/src/axios-0.19.0/lib/cancel/Cancel.js +19 -0
- package/dependencies/src/axios-0.19.0/lib/cancel/CancelToken.js +57 -0
- package/dependencies/src/axios-0.19.0/lib/cancel/isCancel.js +5 -0
- package/dependencies/src/axios-0.19.0/lib/core/Axios.js +86 -0
- package/dependencies/src/axios-0.19.0/lib/core/InterceptorManager.js +52 -0
- package/dependencies/src/axios-0.19.0/lib/core/createError.js +18 -0
- package/dependencies/src/axios-0.19.0/lib/core/dispatchRequest.js +86 -0
- package/dependencies/src/axios-0.19.0/lib/core/enhanceError.js +42 -0
- package/dependencies/src/axios-0.19.0/lib/core/mergeConfig.js +51 -0
- package/dependencies/src/axios-0.19.0/lib/core/settle.js +25 -0
- package/dependencies/src/axios-0.19.0/lib/core/transformData.js +20 -0
- package/dependencies/src/axios-0.19.0/lib/defaults.js +98 -0
- package/dependencies/src/axios-0.19.0/lib/helpers/bind.js +11 -0
- package/dependencies/src/axios-0.19.0/lib/helpers/buildURL.js +71 -0
- package/dependencies/src/axios-0.19.0/lib/helpers/combineURLs.js +14 -0
- package/dependencies/src/axios-0.19.0/lib/helpers/cookies.js +53 -0
- package/dependencies/src/axios-0.19.0/lib/helpers/deprecatedMethod.js +24 -0
- package/dependencies/src/axios-0.19.0/lib/helpers/isAbsoluteURL.js +14 -0
- package/dependencies/src/axios-0.19.0/lib/helpers/isURLSameOrigin.js +68 -0
- package/dependencies/src/axios-0.19.0/lib/helpers/normalizeHeaderName.js +12 -0
- package/dependencies/src/axios-0.19.0/lib/helpers/parseHeaders.js +53 -0
- package/dependencies/src/axios-0.19.0/lib/helpers/spread.js +27 -0
- package/dependencies/src/axios-0.19.0/lib/utils.js +334 -0
- package/dependencies/src/axios-0.19.0/package.json +85 -0
- package/dependencies/src/base-x-3.0.7/src/index.d.ts +10 -0
- package/dependencies/src/base-x-3.0.7/src/index.js +120 -0
- package/dependencies/src/base64-js-1.3.1/index.js +152 -0
- package/dependencies/src/bech32-0.0.3/index.js +139 -0
- package/dependencies/src/bech32-1.1.3/index.js +147 -0
- package/dependencies/src/big-integer-1.6.45/BigInteger.d.ts +2393 -0
- package/dependencies/src/big-integer-1.6.45/BigInteger.js +1452 -0
- package/dependencies/src/bigi-1.4.2/lib/bigi.js +1509 -0
- package/dependencies/src/bigi-1.4.2/lib/convert.js +91 -0
- package/dependencies/src/bigi-1.4.2/lib/index.js +6 -0
- package/dependencies/src/bigi-1.4.2/package.json +55 -0
- package/dependencies/src/bignumber.js-9.0.0/bignumber.d.ts +1829 -0
- package/dependencies/src/bignumber.js-9.0.0/bignumber.js +2902 -0
- package/dependencies/src/bip32-2.0.4/src/bip32.js +290 -0
- package/dependencies/src/bip32-2.0.4/src/crypto.js +26 -0
- package/dependencies/src/bip32-2.0.4/src/index.js +7 -0
- package/dependencies/src/bip32-path-0.4.2/index.js +96 -0
- package/dependencies/src/bip39-2.5.0/index.js +153 -0
- package/dependencies/src/bip39-2.5.0/wordlists/chinese_simplified.json +2050 -0
- package/dependencies/src/bip39-2.5.0/wordlists/chinese_traditional.json +2050 -0
- package/dependencies/src/bip39-2.5.0/wordlists/english.json +2050 -0
- package/dependencies/src/bip39-2.5.0/wordlists/french.json +2050 -0
- package/dependencies/src/bip39-2.5.0/wordlists/italian.json +2050 -0
- package/dependencies/src/bip39-2.5.0/wordlists/japanese.json +2050 -0
- package/dependencies/src/bip39-2.5.0/wordlists/korean.json +2050 -0
- package/dependencies/src/bip39-2.5.0/wordlists/spanish.json +2050 -0
- package/dependencies/src/bip66-1.1.5/index.js +113 -0
- package/dependencies/src/bitcoin-ops-1.4.1/index.json +120 -0
- package/dependencies/src/bitcoin-ops-1.4.1/map.js +9 -0
- package/dependencies/src/bitcoinjs-message-2.1.1/index.js +157 -0
- package/dependencies/src/bitgo-utxo-lib-5d91049fd7a988382df81c8260e244ee56d57aac/src/address.js +109 -0
- package/dependencies/src/bitgo-utxo-lib-5d91049fd7a988382df81c8260e244ee56d57aac/src/block.js +234 -0
- package/dependencies/src/bitgo-utxo-lib-5d91049fd7a988382df81c8260e244ee56d57aac/src/bufferWriter.js +40 -0
- package/dependencies/src/bitgo-utxo-lib-5d91049fd7a988382df81c8260e244ee56d57aac/src/bufferutils.js +65 -0
- package/dependencies/src/bitgo-utxo-lib-5d91049fd7a988382df81c8260e244ee56d57aac/src/coins.js +53 -0
- package/dependencies/src/bitgo-utxo-lib-5d91049fd7a988382df81c8260e244ee56d57aac/src/crypto.js +43 -0
- package/dependencies/src/bitgo-utxo-lib-5d91049fd7a988382df81c8260e244ee56d57aac/src/ecdsa.js +161 -0
- package/dependencies/src/bitgo-utxo-lib-5d91049fd7a988382df81c8260e244ee56d57aac/src/ecpair.js +155 -0
- package/dependencies/src/bitgo-utxo-lib-5d91049fd7a988382df81c8260e244ee56d57aac/src/ecsignature.js +97 -0
- package/dependencies/src/bitgo-utxo-lib-5d91049fd7a988382df81c8260e244ee56d57aac/src/fastcurve.js +92 -0
- package/dependencies/src/bitgo-utxo-lib-5d91049fd7a988382df81c8260e244ee56d57aac/src/hdnode.js +363 -0
- package/dependencies/src/bitgo-utxo-lib-5d91049fd7a988382df81c8260e244ee56d57aac/src/index.js +24 -0
- package/dependencies/src/bitgo-utxo-lib-5d91049fd7a988382df81c8260e244ee56d57aac/src/networks.js +214 -0
- package/dependencies/src/bitgo-utxo-lib-5d91049fd7a988382df81c8260e244ee56d57aac/src/script.js +214 -0
- package/dependencies/src/bitgo-utxo-lib-5d91049fd7a988382df81c8260e244ee56d57aac/src/script_number.js +68 -0
- package/dependencies/src/bitgo-utxo-lib-5d91049fd7a988382df81c8260e244ee56d57aac/src/templates/index.js +74 -0
- package/dependencies/src/bitgo-utxo-lib-5d91049fd7a988382df81c8260e244ee56d57aac/src/templates/multisig/index.js +4 -0
- package/dependencies/src/bitgo-utxo-lib-5d91049fd7a988382df81c8260e244ee56d57aac/src/templates/multisig/input.js +71 -0
- package/dependencies/src/bitgo-utxo-lib-5d91049fd7a988382df81c8260e244ee56d57aac/src/templates/multisig/output.js +64 -0
- package/dependencies/src/bitgo-utxo-lib-5d91049fd7a988382df81c8260e244ee56d57aac/src/templates/nulldata.js +39 -0
- package/dependencies/src/bitgo-utxo-lib-5d91049fd7a988382df81c8260e244ee56d57aac/src/templates/pubkey/index.js +4 -0
- package/dependencies/src/bitgo-utxo-lib-5d91049fd7a988382df81c8260e244ee56d57aac/src/templates/pubkey/input.js +39 -0
- package/dependencies/src/bitgo-utxo-lib-5d91049fd7a988382df81c8260e244ee56d57aac/src/templates/pubkey/output.js +33 -0
- package/dependencies/src/bitgo-utxo-lib-5d91049fd7a988382df81c8260e244ee56d57aac/src/templates/pubkeyhash/index.js +4 -0
- package/dependencies/src/bitgo-utxo-lib-5d91049fd7a988382df81c8260e244ee56d57aac/src/templates/pubkeyhash/input.js +51 -0
- package/dependencies/src/bitgo-utxo-lib-5d91049fd7a988382df81c8260e244ee56d57aac/src/templates/pubkeyhash/output.js +42 -0
- package/dependencies/src/bitgo-utxo-lib-5d91049fd7a988382df81c8260e244ee56d57aac/src/templates/scripthash/index.js +4 -0
- package/dependencies/src/bitgo-utxo-lib-5d91049fd7a988382df81c8260e244ee56d57aac/src/templates/scripthash/input.js +84 -0
- package/dependencies/src/bitgo-utxo-lib-5d91049fd7a988382df81c8260e244ee56d57aac/src/templates/scripthash/output.js +34 -0
- package/dependencies/src/bitgo-utxo-lib-5d91049fd7a988382df81c8260e244ee56d57aac/src/templates/witnesscommitment/index.js +3 -0
- package/dependencies/src/bitgo-utxo-lib-5d91049fd7a988382df81c8260e244ee56d57aac/src/templates/witnesscommitment/output.js +42 -0
- package/dependencies/src/bitgo-utxo-lib-5d91049fd7a988382df81c8260e244ee56d57aac/src/templates/witnesspubkeyhash/index.js +4 -0
- package/dependencies/src/bitgo-utxo-lib-5d91049fd7a988382df81c8260e244ee56d57aac/src/templates/witnesspubkeyhash/input.js +44 -0
- package/dependencies/src/bitgo-utxo-lib-5d91049fd7a988382df81c8260e244ee56d57aac/src/templates/witnesspubkeyhash/output.js +33 -0
- package/dependencies/src/bitgo-utxo-lib-5d91049fd7a988382df81c8260e244ee56d57aac/src/templates/witnessscripthash/index.js +4 -0
- package/dependencies/src/bitgo-utxo-lib-5d91049fd7a988382df81c8260e244ee56d57aac/src/templates/witnessscripthash/input.js +63 -0
- package/dependencies/src/bitgo-utxo-lib-5d91049fd7a988382df81c8260e244ee56d57aac/src/templates/witnessscripthash/output.js +33 -0
- package/dependencies/src/bitgo-utxo-lib-5d91049fd7a988382df81c8260e244ee56d57aac/src/transaction.js +1125 -0
- package/dependencies/src/bitgo-utxo-lib-5d91049fd7a988382df81c8260e244ee56d57aac/src/transaction_builder.js +892 -0
- package/dependencies/src/bitgo-utxo-lib-5d91049fd7a988382df81c8260e244ee56d57aac/src/types.js +55 -0
- package/dependencies/src/blake2b-6268e6dd678661e0acc4359e9171b97eb1ebf8ac/index.js +313 -0
- package/dependencies/src/blake2b-wasm-193cdb71656c1a6c7f89b05d0327bb9b758d071b/blake2b.js +63 -0
- package/dependencies/src/blake2b-wasm-193cdb71656c1a6c7f89b05d0327bb9b758d071b/index.js +128 -0
- package/dependencies/src/blakejs-1.1.0/blake2b.js +273 -0
- package/dependencies/src/blakejs-1.1.0/blake2s.js +190 -0
- package/dependencies/src/blakejs-1.1.0/index.js +15 -0
- package/dependencies/src/blakejs-1.1.0/util.js +81 -0
- package/dependencies/src/bn.js-4.11.8/lib/bn.js +3427 -0
- package/dependencies/src/brorand-1.1.0/index.js +65 -0
- package/dependencies/src/bs58-4.0.1/index.js +4 -0
- package/dependencies/src/bs58check-2.1.2/base.js +50 -0
- package/dependencies/src/bs58check-2.1.2/index.js +12 -0
- package/dependencies/src/bs58grscheck-2.1.2/base.js +50 -0
- package/dependencies/src/bs58grscheck-2.1.2/index.js +12 -0
- package/dependencies/src/buffer-5.6.0/index.d.ts +186 -0
- package/dependencies/src/buffer-5.6.0/index.js +1794 -0
- package/dependencies/src/buffer-equals-1.0.4/index.js +26 -0
- package/dependencies/src/cbor-sync-1.0.4/index.d.ts +11 -0
- package/dependencies/src/cbor-sync-1.0.4/index.js +632 -0
- package/dependencies/src/cipher-base-1.0.4/index.js +99 -0
- package/dependencies/src/cosmjs/index.d.ts +379 -0
- package/dependencies/src/cosmjs/index.js +1297 -0
- package/dependencies/src/cosmjs/index.js.map +1 -0
- package/dependencies/src/create-hash-1.2.0/browser.js +30 -0
- package/dependencies/src/create-hash-1.2.0/index.js +1 -0
- package/dependencies/src/create-hash-1.2.0/md5.js +5 -0
- package/dependencies/src/create-hmac-1.1.4/browser.js +68 -0
- package/dependencies/src/create-hmac-1.1.4/index.js +1 -0
- package/dependencies/src/create-hmac-1.1.7/browser.js +62 -0
- package/dependencies/src/create-hmac-1.1.7/legacy.js +46 -0
- package/dependencies/src/cryptocompare-0.5.0/index.js +138 -0
- package/dependencies/src/cuint-0.2.2/index.js +2 -0
- package/dependencies/src/cuint-0.2.2/lib/uint32.js +451 -0
- package/dependencies/src/cuint-0.2.2/lib/uint64.js +648 -0
- package/dependencies/src/debug-3.1.0/src/browser.js +195 -0
- package/dependencies/src/debug-3.1.0/src/debug.js +225 -0
- package/dependencies/src/drbg.js-1.0.1/hash.js +92 -0
- package/dependencies/src/drbg.js-1.0.1/hmac.js +71 -0
- package/dependencies/src/drbg.js-1.0.1/index.js +4 -0
- package/dependencies/src/drbg.js-1.0.1/lib/hash-info.json +27 -0
- package/dependencies/src/drbg.js-1.0.1/lib/util.js +36 -0
- package/dependencies/src/eciesjs-0.3.9/src/index.d.ts +12 -0
- package/dependencies/src/eciesjs-0.3.9/src/index.js +35 -0
- package/dependencies/src/eciesjs-0.3.9/src/index.js.map +1 -0
- package/dependencies/src/eciesjs-0.3.9/src/keys/PrivateKey.d.ts +12 -0
- package/dependencies/src/eciesjs-0.3.9/src/keys/PrivateKey.js +62 -0
- package/dependencies/src/eciesjs-0.3.9/src/keys/PrivateKey.js.map +1 -0
- package/dependencies/src/eciesjs-0.3.9/src/keys/PublicKey.d.ts +11 -0
- package/dependencies/src/eciesjs-0.3.9/src/keys/PublicKey.js +65 -0
- package/dependencies/src/eciesjs-0.3.9/src/keys/PublicKey.js.map +1 -0
- package/dependencies/src/eciesjs-0.3.9/src/keys/index.d.ts +2 -0
- package/dependencies/src/eciesjs-0.3.9/src/keys/index.js +11 -0
- package/dependencies/src/eciesjs-0.3.9/src/keys/index.js.map +1 -0
- package/dependencies/src/eciesjs-0.3.9/src/utils.d.ts +6 -0
- package/dependencies/src/eciesjs-0.3.9/src/utils.js +65 -0
- package/dependencies/src/eciesjs-0.3.9/src/utils.js.map +1 -0
- package/dependencies/src/ecurve-1.0.6/lib/curve.js +77 -0
- package/dependencies/src/ecurve-1.0.6/lib/curves.json +65 -0
- package/dependencies/src/ecurve-1.0.6/lib/index.js +10 -0
- package/dependencies/src/ecurve-1.0.6/lib/names.js +21 -0
- package/dependencies/src/ecurve-1.0.6/lib/point.js +244 -0
- package/dependencies/src/elliptic-6.5.1/lib/elliptic/curve/base.js +374 -0
- package/dependencies/src/elliptic-6.5.1/lib/elliptic/curve/edwards.js +432 -0
- package/dependencies/src/elliptic-6.5.1/lib/elliptic/curve/index.js +8 -0
- package/dependencies/src/elliptic-6.5.1/lib/elliptic/curve/mont.js +178 -0
- package/dependencies/src/elliptic-6.5.1/lib/elliptic/curve/short.js +937 -0
- package/dependencies/src/elliptic-6.5.1/lib/elliptic/curves.js +206 -0
- package/dependencies/src/elliptic-6.5.1/lib/elliptic/ec/index.js +241 -0
- package/dependencies/src/elliptic-6.5.1/lib/elliptic/ec/key.js +118 -0
- package/dependencies/src/elliptic-6.5.1/lib/elliptic/ec/signature.js +134 -0
- package/dependencies/src/elliptic-6.5.1/lib/elliptic/eddsa/index.js +118 -0
- package/dependencies/src/elliptic-6.5.1/lib/elliptic/eddsa/key.js +95 -0
- package/dependencies/src/elliptic-6.5.1/lib/elliptic/eddsa/signature.js +65 -0
- package/dependencies/src/elliptic-6.5.1/lib/elliptic/precomputed/secp256k1.js +780 -0
- package/dependencies/src/elliptic-6.5.1/lib/elliptic/utils.js +120 -0
- package/dependencies/src/elliptic-6.5.1/lib/elliptic.js +13 -0
- package/dependencies/src/elliptic-6.5.1/package.json +55 -0
- package/dependencies/src/elliptic-6.5.3/lib/elliptic/curve/base.js +376 -0
- package/dependencies/src/elliptic-6.5.3/lib/elliptic/curve/edwards.js +432 -0
- package/dependencies/src/elliptic-6.5.3/lib/elliptic/curve/index.js +8 -0
- package/dependencies/src/elliptic-6.5.3/lib/elliptic/curve/mont.js +178 -0
- package/dependencies/src/elliptic-6.5.3/lib/elliptic/curve/short.js +937 -0
- package/dependencies/src/elliptic-6.5.3/lib/elliptic/curves.js +206 -0
- package/dependencies/src/elliptic-6.5.3/lib/elliptic/ec/index.js +241 -0
- package/dependencies/src/elliptic-6.5.3/lib/elliptic/ec/key.js +118 -0
- package/dependencies/src/elliptic-6.5.3/lib/elliptic/ec/signature.js +166 -0
- package/dependencies/src/elliptic-6.5.3/lib/elliptic/eddsa/index.js +118 -0
- package/dependencies/src/elliptic-6.5.3/lib/elliptic/eddsa/key.js +95 -0
- package/dependencies/src/elliptic-6.5.3/lib/elliptic/eddsa/signature.js +65 -0
- package/dependencies/src/elliptic-6.5.3/lib/elliptic/precomputed/secp256k1.js +780 -0
- package/dependencies/src/elliptic-6.5.3/lib/elliptic/utils.js +119 -0
- package/dependencies/src/elliptic-6.5.3/lib/elliptic.js +13 -0
- package/dependencies/src/elliptic-6.5.3/package.json +55 -0
- package/dependencies/src/ethereum-common-0.2.1/bootstrapNodes.json +92 -0
- package/dependencies/src/ethereum-common-0.2.1/genesisState.json +8895 -0
- package/dependencies/src/ethereum-common-0.2.1/index.js +4 -0
- package/dependencies/src/ethereum-common-0.2.1/params.json +245 -0
- package/dependencies/src/ethereumjs-tx-1.3.7/index.js +298 -0
- package/dependencies/src/ethereumjs-util-5.2.0/index.js +714 -0
- package/dependencies/src/ethjs-util-0.1.4/src/index.js +203 -0
- package/dependencies/src/follow-redirects-1.5.10/http.js +1 -0
- package/dependencies/src/follow-redirects-1.5.10/https.js +1 -0
- package/dependencies/src/follow-redirects-1.5.10/index.js +322 -0
- package/dependencies/src/futoin-hkdf-1.3.3/hkdf.d.ts +29 -0
- package/dependencies/src/futoin-hkdf-1.3.3/hkdf.js +174 -0
- package/dependencies/src/groestl-hash-js-ef6a04f1c4d2f0448f0882b5f213ef7a0659baee/index.js +39 -0
- package/dependencies/src/groestl-hash-js-ef6a04f1c4d2f0448f0882b5f213ef7a0659baee/lib/groestl.js +1248 -0
- package/dependencies/src/groestl-hash-js-ef6a04f1c4d2f0448f0882b5f213ef7a0659baee/lib/helper.js +253 -0
- package/dependencies/src/groestl-hash-js-ef6a04f1c4d2f0448f0882b5f213ef7a0659baee/lib/op.js +462 -0
- package/dependencies/src/groestlcoinjs-message-2.1.0/index.js +245 -0
- package/dependencies/src/hash-base-3.0.4/index.js +95 -0
- package/dependencies/src/hash.js-1.1.7/lib/hash/common.js +92 -0
- package/dependencies/src/hash.js-1.1.7/lib/hash/hmac.js +47 -0
- package/dependencies/src/hash.js-1.1.7/lib/hash/ripemd.js +146 -0
- package/dependencies/src/hash.js-1.1.7/lib/hash/sha/1.js +74 -0
- package/dependencies/src/hash.js-1.1.7/lib/hash/sha/224.js +30 -0
- package/dependencies/src/hash.js-1.1.7/lib/hash/sha/256.js +105 -0
- package/dependencies/src/hash.js-1.1.7/lib/hash/sha/384.js +35 -0
- package/dependencies/src/hash.js-1.1.7/lib/hash/sha/512.js +330 -0
- package/dependencies/src/hash.js-1.1.7/lib/hash/sha/common.js +49 -0
- package/dependencies/src/hash.js-1.1.7/lib/hash/sha.js +7 -0
- package/dependencies/src/hash.js-1.1.7/lib/hash/utils.js +278 -0
- package/dependencies/src/hash.js-1.1.7/lib/hash.js +15 -0
- package/dependencies/src/hd-wallet-js-b216450e56954a6e82ace0aade9474673de5d9d5/src/hd-key.d.ts +15 -0
- package/dependencies/src/hd-wallet-js-b216450e56954a6e82ace0aade9474673de5d9d5/src/hd-key.js +101 -0
- package/dependencies/src/hd-wallet-js-b216450e56954a6e82ace0aade9474673de5d9d5/src/hd-key.js.map +1 -0
- package/dependencies/src/hd-wallet-js-b216450e56954a6e82ace0aade9474673de5d9d5/src/hd-wallet.d.ts +3 -0
- package/dependencies/src/hd-wallet-js-b216450e56954a6e82ace0aade9474673de5d9d5/src/hd-wallet.js +37 -0
- package/dependencies/src/hd-wallet-js-b216450e56954a6e82ace0aade9474673de5d9d5/src/hd-wallet.js.map +1 -0
- package/dependencies/src/hd-wallet-js-b216450e56954a6e82ace0aade9474673de5d9d5/src/index.d.ts +1 -0
- package/dependencies/src/hd-wallet-js-b216450e56954a6e82ace0aade9474673de5d9d5/src/index.js +34 -0
- package/dependencies/src/hd-wallet-js-b216450e56954a6e82ace0aade9474673de5d9d5/src/index.js.map +1 -0
- package/dependencies/src/hmac-drbg-1.0.1/lib/hmac-drbg.js +113 -0
- package/dependencies/src/idna-uts46-hx-3.4.0/idna-map.js +23865 -0
- package/dependencies/src/idna-uts46-hx-3.4.0/index.d.ts +6 -0
- package/dependencies/src/idna-uts46-hx-3.4.0/uts46.js +170 -0
- package/dependencies/src/ieee754-1.1.13/index.js +84 -0
- package/dependencies/src/inherits-2.0.4/inherits.js +9 -0
- package/dependencies/src/inherits-2.0.4/inherits_browser.js +27 -0
- package/dependencies/src/is-buffer-2.0.3/index.js +11 -0
- package/dependencies/src/is-hex-prefixed-1.0.0/src/index.js +13 -0
- package/dependencies/src/js-cuint-0.2.2/index.js +2 -0
- package/dependencies/src/js-cuint-0.2.2/lib/uint32.js +451 -0
- package/dependencies/src/js-cuint-0.2.2/lib/uint64.js +648 -0
- package/dependencies/src/keccak-1.0.2/js.js +2 -0
- package/dependencies/src/keccak-1.0.2/lib/api/index.js +28 -0
- package/dependencies/src/keccak-1.0.2/lib/api/keccak.js +83 -0
- package/dependencies/src/keccak-1.0.2/lib/api/shake.js +74 -0
- package/dependencies/src/keccak-1.0.2/lib/keccak-state.js +187 -0
- package/dependencies/src/keccak-1.0.2/lib/keccak.js +69 -0
- package/dependencies/src/md5.js-1.3.5/index.js +146 -0
- package/dependencies/src/merkle-lib-2.0.10/fastRoot.js +24 -0
- package/dependencies/src/merkle-lib-2.0.10/index.js +34 -0
- package/dependencies/src/minimalistic-assert-1.0.1/index.js +11 -0
- package/dependencies/src/minimalistic-crypto-utils-1.0.1/lib/utils.js +58 -0
- package/dependencies/src/ms-2.1.2/index.js +162 -0
- package/dependencies/src/nan-2.14.0/include_dirs.js +1 -0
- package/dependencies/src/nanoassert-1.1.0/index.js +22 -0
- package/dependencies/src/pako-2.0.3/index.js +18 -0
- package/dependencies/src/pako-2.0.3/lib/deflate.js +373 -0
- package/dependencies/src/pako-2.0.3/lib/inflate.js +402 -0
- package/dependencies/src/pako-2.0.3/lib/utils/common.js +48 -0
- package/dependencies/src/pako-2.0.3/lib/utils/strings.js +187 -0
- package/dependencies/src/pako-2.0.3/lib/zlib/adler32.js +50 -0
- package/dependencies/src/pako-2.0.3/lib/zlib/constants.js +66 -0
- package/dependencies/src/pako-2.0.3/lib/zlib/crc32.js +58 -0
- package/dependencies/src/pako-2.0.3/lib/zlib/deflate.js +1849 -0
- package/dependencies/src/pako-2.0.3/lib/zlib/gzheader.js +58 -0
- package/dependencies/src/pako-2.0.3/lib/zlib/inffast.js +347 -0
- package/dependencies/src/pako-2.0.3/lib/zlib/inflate.js +1625 -0
- package/dependencies/src/pako-2.0.3/lib/zlib/inftrees.js +462 -0
- package/dependencies/src/pako-2.0.3/lib/zlib/messages.js +32 -0
- package/dependencies/src/pako-2.0.3/lib/zlib/trees.js +1192 -0
- package/dependencies/src/pako-2.0.3/lib/zlib/zstream.js +47 -0
- package/dependencies/src/pbkdf2-3.0.17/bench/index.js +35 -0
- package/dependencies/src/pbkdf2-3.0.17/bench/old.js +47 -0
- package/dependencies/src/pbkdf2-3.0.17/browser.js +2 -0
- package/dependencies/src/pbkdf2-3.0.17/index.js +31 -0
- package/dependencies/src/pbkdf2-3.0.17/lib/async.js +100 -0
- package/dependencies/src/pbkdf2-3.0.17/lib/default-encoding.js +10 -0
- package/dependencies/src/pbkdf2-3.0.17/lib/precondition.js +28 -0
- package/dependencies/src/pbkdf2-3.0.17/lib/sync-browser.js +104 -0
- package/dependencies/src/pbkdf2-3.0.17/lib/sync.js +51 -0
- package/dependencies/src/punycode-2.1.1/punycode.js +429 -0
- package/dependencies/src/pushdata-bitcoin-1.0.1/index.js +77 -0
- package/dependencies/src/randombytes-2.1.0/browser.js +50 -0
- package/dependencies/src/randombytes-2.1.0/index.js +1 -0
- package/dependencies/src/ripemd160-2.0.2/index.js +163 -0
- package/dependencies/src/rlp-2.2.3/index.js +230 -0
- package/dependencies/src/safe-buffer-5.2.0/index.js +64 -0
- package/dependencies/src/secp256k1-3.7.1/elliptic.js +2 -0
- package/dependencies/src/secp256k1-3.7.1/lib/assert.js +44 -0
- package/dependencies/src/secp256k1-3.7.1/lib/der.js +193 -0
- package/dependencies/src/secp256k1-3.7.1/lib/elliptic/index.js +263 -0
- package/dependencies/src/secp256k1-3.7.1/lib/index.js +245 -0
- package/dependencies/src/secp256k1-3.7.1/lib/messages.json +37 -0
- package/dependencies/src/secp256k1-4.0.2/elliptic.js +1 -0
- package/dependencies/src/secp256k1-4.0.2/lib/elliptic.js +402 -0
- package/dependencies/src/secp256k1-4.0.2/lib/index.js +336 -0
- package/dependencies/src/sha.js-2.4.11/hash.js +81 -0
- package/dependencies/src/sha.js-2.4.11/index.js +16 -0
- package/dependencies/src/sha.js-2.4.11/sha.js +94 -0
- package/dependencies/src/sha.js-2.4.11/sha1.js +99 -0
- package/dependencies/src/sha.js-2.4.11/sha224.js +53 -0
- package/dependencies/src/sha.js-2.4.11/sha256.js +135 -0
- package/dependencies/src/sha.js-2.4.11/sha384.js +57 -0
- package/dependencies/src/sha.js-2.4.11/sha512.js +260 -0
- package/dependencies/src/strip-hex-prefix-1.0.0/src/index.js +14 -0
- package/dependencies/src/tiny-secp256k1-1.1.3/js.js +276 -0
- package/dependencies/src/tiny-secp256k1-1.1.3/rfc6979.js +62 -0
- package/dependencies/src/tweetnacl-1.0.1/nacl.d.ts +98 -0
- package/dependencies/src/tweetnacl-1.0.1/nacl.js +1164 -0
- package/dependencies/src/tweetnacl-auth-1.0.1/nacl-auth.js +47 -0
- package/dependencies/src/typedarray-to-buffer-4.0.0/index.js +17 -0
- package/dependencies/src/typeforce-1.18.0/errors.js +110 -0
- package/dependencies/src/typeforce-1.18.0/extra.js +91 -0
- package/dependencies/src/typeforce-1.18.0/index.js +260 -0
- package/dependencies/src/typeforce-1.18.0/native.js +21 -0
- package/dependencies/src/unorm-1.6.0/lib/unorm.js +452 -0
- package/dependencies/src/utf8-3.0.0/utf8.js +202 -0
- package/dependencies/src/validate.js-0.13.1/validate.d.ts +55 -0
- package/dependencies/src/validate.js-0.13.1/validate.js +1253 -0
- package/dependencies/src/varuint-bitcoin-1.1.2/index.d.ts +13 -0
- package/dependencies/src/varuint-bitcoin-1.1.2/index.js +90 -0
- package/dependencies/src/wif-2.0.6/index.js +63 -0
- package/dependencies/src/xxhashjs-0.2.2/lib/index.js +4 -0
- package/dependencies/src/xxhashjs-0.2.2/lib/xxhash.js +389 -0
- package/dependencies/src/xxhashjs-0.2.2/lib/xxhash64.js +444 -0
- package/errors/coinlib-error.d.ts +30 -0
- package/errors/coinlib-error.js +62 -0
- package/errors/coinlib-error.js.map +1 -0
- package/errors/index.d.ts +156 -0
- package/errors/index.js +281 -0
- package/errors/index.js.map +1 -0
- package/errors/network.d.ts +0 -0
- package/errors/network.js +2 -0
- package/errors/network.js.map +1 -0
- package/index.d.ts +33 -0
- package/index.js +58 -0
- package/index.js.map +1 -0
- package/interfaces/IAirGapAddress.d.ts +10 -0
- package/interfaces/IAirGapAddress.js +3 -0
- package/interfaces/IAirGapAddress.js.map +1 -0
- package/interfaces/IAirGapSignedTransaction.d.ts +1 -0
- package/interfaces/IAirGapSignedTransaction.js +3 -0
- package/interfaces/IAirGapSignedTransaction.js.map +1 -0
- package/interfaces/IAirGapTransaction.d.ts +53 -0
- package/interfaces/IAirGapTransaction.js +22 -0
- package/interfaces/IAirGapTransaction.js.map +1 -0
- package/interfaces/IAirGapWallet.d.ts +6 -0
- package/interfaces/IAirGapWallet.js +3 -0
- package/interfaces/IAirGapWallet.js.map +1 -0
- package/interfaces/JSONConvertible.d.ts +3 -0
- package/interfaces/JSONConvertible.js +3 -0
- package/interfaces/JSONConvertible.js.map +1 -0
- package/interfaces/RPCConvertible.d.ts +3 -0
- package/interfaces/RPCConvertible.js +3 -0
- package/interfaces/RPCConvertible.js.map +1 -0
- package/networks.d.ts +19 -0
- package/networks.js +1341 -0
- package/networks.js.map +1 -0
- package/package.json +1 -5
- package/protocols/BlockExplorerProtocol.d.ts +6 -0
- package/protocols/BlockExplorerProtocol.js +60 -0
- package/protocols/BlockExplorerProtocol.js.map +1 -0
- package/protocols/CryptoClient.d.ts +15 -0
- package/protocols/CryptoClient.js +84 -0
- package/protocols/CryptoClient.js.map +1 -0
- package/protocols/Ed25519CryptoClient.d.ts +8 -0
- package/protocols/Ed25519CryptoClient.js +107 -0
- package/protocols/Ed25519CryptoClient.js.map +1 -0
- package/protocols/HasConfigurableContract.d.ts +4 -0
- package/protocols/HasConfigurableContract.js +3 -0
- package/protocols/HasConfigurableContract.js.map +1 -0
- package/protocols/ICoinBaseProtocol.d.ts +107 -0
- package/protocols/ICoinBaseProtocol.js +3 -0
- package/protocols/ICoinBaseProtocol.js.map +1 -0
- package/protocols/ICoinDelegateProtocol.d.ts +40 -0
- package/protocols/ICoinDelegateProtocol.js +3 -0
- package/protocols/ICoinDelegateProtocol.js.map +1 -0
- package/protocols/ICoinOfflineProtocol.d.ts +24 -0
- package/protocols/ICoinOfflineProtocol.js +3 -0
- package/protocols/ICoinOfflineProtocol.js.map +1 -0
- package/protocols/ICoinOnlineProtocol.d.ts +46 -0
- package/protocols/ICoinOnlineProtocol.js +3 -0
- package/protocols/ICoinOnlineProtocol.js.map +1 -0
- package/protocols/ICoinProtocol.d.ts +9 -0
- package/protocols/ICoinProtocol.js +3 -0
- package/protocols/ICoinProtocol.js.map +1 -0
- package/protocols/ICoinSubProtocol.d.ts +22 -0
- package/protocols/ICoinSubProtocol.js +9 -0
- package/protocols/ICoinSubProtocol.js.map +1 -0
- package/protocols/NonExtendedProtocol.d.ts +17 -0
- package/protocols/NonExtendedProtocol.js +49 -0
- package/protocols/NonExtendedProtocol.js.map +1 -0
- package/protocols/Secp256k1CryptoClient.d.ts +8 -0
- package/protocols/Secp256k1CryptoClient.js +79 -0
- package/protocols/Secp256k1CryptoClient.js.map +1 -0
- package/protocols/Sr25519CryptoClient.d.ts +8 -0
- package/protocols/Sr25519CryptoClient.js +82 -0
- package/protocols/Sr25519CryptoClient.js.map +1 -0
- package/types/signed-transaction.d.ts +4 -0
- package/types/signed-transaction.js +3 -0
- package/types/signed-transaction.js.map +1 -0
- package/types/unsigned-transaction.d.ts +5 -0
- package/types/unsigned-transaction.js +3 -0
- package/types/unsigned-transaction.js.map +1 -0
- package/utils/AES.d.ts +10 -0
- package/utils/AES.js +165 -0
- package/utils/AES.js.map +1 -0
- package/utils/ErrorWithData.d.ts +4 -0
- package/utils/ErrorWithData.js +29 -0
- package/utils/ErrorWithData.js.map +1 -0
- package/utils/Network.d.ts +2 -0
- package/utils/Network.js +8 -0
- package/utils/Network.js.map +1 -0
- package/utils/ProtocolBlockExplorer.d.ts +6 -0
- package/utils/ProtocolBlockExplorer.js +11 -0
- package/utils/ProtocolBlockExplorer.js.map +1 -0
- package/utils/ProtocolNetwork.d.ts +15 -0
- package/utils/ProtocolNetwork.js +35 -0
- package/utils/ProtocolNetwork.js.map +1 -0
- package/utils/ProtocolOptions.d.ts +5 -0
- package/utils/ProtocolOptions.js +3 -0
- package/utils/ProtocolOptions.js.map +1 -0
- package/utils/ProtocolSymbols.d.ts +45 -0
- package/utils/ProtocolSymbols.js +59 -0
- package/utils/ProtocolSymbols.js.map +1 -0
- package/utils/array.d.ts +4 -0
- package/utils/array.js +36 -0
- package/utils/array.js.map +1 -0
- package/utils/assert.d.ts +2 -0
- package/utils/assert.js +20 -0
- package/utils/assert.js.map +1 -0
- package/utils/base64Check.d.ts +7 -0
- package/utils/base64Check.js +39 -0
- package/utils/base64Check.js.map +1 -0
- package/utils/blake2b.d.ts +7 -0
- package/utils/blake2b.js +23 -0
- package/utils/blake2b.js.map +1 -0
- package/utils/buffer.d.ts +2 -0
- package/utils/buffer.js +8 -0
- package/utils/buffer.js.map +1 -0
- package/utils/cache.d.ts +15 -0
- package/utils/cache.js +97 -0
- package/utils/cache.js.map +1 -0
- package/utils/error.d.ts +1 -0
- package/utils/error.js +8 -0
- package/utils/error.js.map +1 -0
- package/utils/hex.d.ts +14 -0
- package/utils/hex.js +112 -0
- package/utils/hex.js.map +1 -0
- package/utils/interfaces.d.ts +3 -0
- package/utils/interfaces.js +18 -0
- package/utils/interfaces.js.map +1 -0
- package/utils/object.d.ts +1 -0
- package/utils/object.js +23 -0
- package/utils/object.js.map +1 -0
- package/utils/padStart.d.ts +1 -0
- package/utils/padStart.js +20 -0
- package/utils/padStart.js.map +1 -0
- package/utils/remote-data/HttpRemoteData.d.ts +8 -0
- package/utils/remote-data/HttpRemoteData.js +117 -0
- package/utils/remote-data/HttpRemoteData.js.map +1 -0
- package/utils/remote-data/IpfsRemoteData.d.ts +8 -0
- package/utils/remote-data/IpfsRemoteData.js +142 -0
- package/utils/remote-data/IpfsRemoteData.js.map +1 -0
- package/utils/remote-data/RemoteData.d.ts +11 -0
- package/utils/remote-data/RemoteData.js +11 -0
- package/utils/remote-data/RemoteData.js.map +1 -0
- package/utils/remote-data/RemoteDataFactory.d.ts +11 -0
- package/utils/remote-data/RemoteDataFactory.js +29 -0
- package/utils/remote-data/RemoteDataFactory.js.map +1 -0
- package/utils/remote-data/Sha256RemoteData.d.ts +11 -0
- package/utils/remote-data/Sha256RemoteData.js +139 -0
- package/utils/remote-data/Sha256RemoteData.js.map +1 -0
- package/utils/string.d.ts +7 -0
- package/utils/string.js +50 -0
- package/utils/string.js.map +1 -0
- package/utils/type.d.ts +1 -0
- package/utils/type.js +16 -0
- package/utils/type.js.map +1 -0
- package/utils/xxhash.d.ts +5 -0
- package/utils/xxhash.js +18 -0
- package/utils/xxhash.js.map +1 -0
- package/wallet/AirGapCoinWallet.d.ts +19 -0
- package/wallet/AirGapCoinWallet.js +199 -0
- package/wallet/AirGapCoinWallet.js.map +1 -0
- package/wallet/AirGapMarketWallet.d.ts +40 -0
- package/wallet/AirGapMarketWallet.js +221 -0
- package/wallet/AirGapMarketWallet.js.map +1 -0
- package/wallet/AirGapNFTWallet.d.ts +15 -0
- package/wallet/AirGapNFTWallet.js +179 -0
- package/wallet/AirGapNFTWallet.js.map +1 -0
- package/wallet/AirGapWallet.d.ts +35 -0
- package/wallet/AirGapWallet.js +142 -0
- package/wallet/AirGapWallet.js.map +1 -0
|
@@ -0,0 +1,1192 @@
|
|
|
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
|
+
/* eslint-disable space-unary-ops */
|
|
23
|
+
|
|
24
|
+
/* Public constants ==========================================================*/
|
|
25
|
+
/* ===========================================================================*/
|
|
26
|
+
|
|
27
|
+
//const Z_FILTERED = 1;
|
|
28
|
+
//const Z_HUFFMAN_ONLY = 2;
|
|
29
|
+
//const Z_RLE = 3;
|
|
30
|
+
const Z_FIXED = 4
|
|
31
|
+
//const Z_DEFAULT_STRATEGY = 0;
|
|
32
|
+
|
|
33
|
+
/* Possible values of the data_type field (though see inflate()) */
|
|
34
|
+
const Z_BINARY = 0
|
|
35
|
+
const Z_TEXT = 1
|
|
36
|
+
//const Z_ASCII = 1; // = Z_TEXT
|
|
37
|
+
const Z_UNKNOWN = 2
|
|
38
|
+
|
|
39
|
+
/*============================================================================*/
|
|
40
|
+
|
|
41
|
+
function zero(buf) {
|
|
42
|
+
let len = buf.length
|
|
43
|
+
while (--len >= 0) {
|
|
44
|
+
buf[len] = 0
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
// From zutil.h
|
|
49
|
+
|
|
50
|
+
const STORED_BLOCK = 0
|
|
51
|
+
const STATIC_TREES = 1
|
|
52
|
+
const DYN_TREES = 2
|
|
53
|
+
/* The three kinds of block type */
|
|
54
|
+
|
|
55
|
+
const MIN_MATCH = 3
|
|
56
|
+
const MAX_MATCH = 258
|
|
57
|
+
/* The minimum and maximum match lengths */
|
|
58
|
+
|
|
59
|
+
// From deflate.h
|
|
60
|
+
/* ===========================================================================
|
|
61
|
+
* Internal compression state.
|
|
62
|
+
*/
|
|
63
|
+
|
|
64
|
+
const LENGTH_CODES = 29
|
|
65
|
+
/* number of length codes, not counting the special END_BLOCK code */
|
|
66
|
+
|
|
67
|
+
const LITERALS = 256
|
|
68
|
+
/* number of literal bytes 0..255 */
|
|
69
|
+
|
|
70
|
+
const L_CODES = LITERALS + 1 + LENGTH_CODES
|
|
71
|
+
/* number of Literal or Length codes, including the END_BLOCK code */
|
|
72
|
+
|
|
73
|
+
const D_CODES = 30
|
|
74
|
+
/* number of distance codes */
|
|
75
|
+
|
|
76
|
+
const BL_CODES = 19
|
|
77
|
+
/* number of codes used to transfer the bit lengths */
|
|
78
|
+
|
|
79
|
+
const HEAP_SIZE = 2 * L_CODES + 1
|
|
80
|
+
/* maximum heap size */
|
|
81
|
+
|
|
82
|
+
const MAX_BITS = 15
|
|
83
|
+
/* All codes must not exceed MAX_BITS bits */
|
|
84
|
+
|
|
85
|
+
const Buf_size = 16
|
|
86
|
+
/* size of bit buffer in bi_buf */
|
|
87
|
+
|
|
88
|
+
/* ===========================================================================
|
|
89
|
+
* Constants
|
|
90
|
+
*/
|
|
91
|
+
|
|
92
|
+
const MAX_BL_BITS = 7
|
|
93
|
+
/* Bit length codes must not exceed MAX_BL_BITS bits */
|
|
94
|
+
|
|
95
|
+
const END_BLOCK = 256
|
|
96
|
+
/* end of block literal code */
|
|
97
|
+
|
|
98
|
+
const REP_3_6 = 16
|
|
99
|
+
/* repeat previous bit length 3-6 times (2 bits of repeat count) */
|
|
100
|
+
|
|
101
|
+
const REPZ_3_10 = 17
|
|
102
|
+
/* repeat a zero length 3-10 times (3 bits of repeat count) */
|
|
103
|
+
|
|
104
|
+
const REPZ_11_138 = 18
|
|
105
|
+
/* repeat a zero length 11-138 times (7 bits of repeat count) */
|
|
106
|
+
|
|
107
|
+
/* eslint-disable comma-spacing,array-bracket-spacing */
|
|
108
|
+
const extra_lbits =
|
|
109
|
+
/* extra bits for each length code */
|
|
110
|
+
new Uint8Array([0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 0])
|
|
111
|
+
|
|
112
|
+
const extra_dbits =
|
|
113
|
+
/* extra bits for each distance code */
|
|
114
|
+
new Uint8Array([0, 0, 0, 0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10, 11, 11, 12, 12, 13, 13])
|
|
115
|
+
|
|
116
|
+
const extra_blbits = /* extra bits for each bit length code */ new Uint8Array([0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 3, 7])
|
|
117
|
+
|
|
118
|
+
const bl_order = new Uint8Array([16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15])
|
|
119
|
+
/* eslint-enable comma-spacing,array-bracket-spacing */
|
|
120
|
+
|
|
121
|
+
/* The lengths of the bit length codes are sent in order of decreasing
|
|
122
|
+
* probability, to avoid transmitting the lengths for unused bit length codes.
|
|
123
|
+
*/
|
|
124
|
+
|
|
125
|
+
/* ===========================================================================
|
|
126
|
+
* Local data. These are initialized only once.
|
|
127
|
+
*/
|
|
128
|
+
|
|
129
|
+
// We pre-fill arrays with 0 to avoid uninitialized gaps
|
|
130
|
+
|
|
131
|
+
const DIST_CODE_LEN = 512 /* see definition of array dist_code below */
|
|
132
|
+
|
|
133
|
+
// !!!! Use flat array instead of structure, Freq = i*2, Len = i*2+1
|
|
134
|
+
const static_ltree = new Array((L_CODES + 2) * 2)
|
|
135
|
+
zero(static_ltree)
|
|
136
|
+
/* The static literal tree. Since the bit lengths are imposed, there is no
|
|
137
|
+
* need for the L_CODES extra codes used during heap construction. However
|
|
138
|
+
* The codes 286 and 287 are needed to build a canonical tree (see _tr_init
|
|
139
|
+
* below).
|
|
140
|
+
*/
|
|
141
|
+
|
|
142
|
+
const static_dtree = new Array(D_CODES * 2)
|
|
143
|
+
zero(static_dtree)
|
|
144
|
+
/* The static distance tree. (Actually a trivial tree since all codes use
|
|
145
|
+
* 5 bits.)
|
|
146
|
+
*/
|
|
147
|
+
|
|
148
|
+
const _dist_code = new Array(DIST_CODE_LEN)
|
|
149
|
+
zero(_dist_code)
|
|
150
|
+
/* Distance codes. The first 256 values correspond to the distances
|
|
151
|
+
* 3 .. 258, the last 256 values correspond to the top 8 bits of
|
|
152
|
+
* the 15 bit distances.
|
|
153
|
+
*/
|
|
154
|
+
|
|
155
|
+
const _length_code = new Array(MAX_MATCH - MIN_MATCH + 1)
|
|
156
|
+
zero(_length_code)
|
|
157
|
+
/* length code for each normalized match length (0 == MIN_MATCH) */
|
|
158
|
+
|
|
159
|
+
const base_length = new Array(LENGTH_CODES)
|
|
160
|
+
zero(base_length)
|
|
161
|
+
/* First normalized length for each code (0 = MIN_MATCH) */
|
|
162
|
+
|
|
163
|
+
const base_dist = new Array(D_CODES)
|
|
164
|
+
zero(base_dist)
|
|
165
|
+
/* First normalized distance for each code (0 = distance of 1) */
|
|
166
|
+
|
|
167
|
+
function StaticTreeDesc(static_tree, extra_bits, extra_base, elems, max_length) {
|
|
168
|
+
this.static_tree = static_tree /* static tree or NULL */
|
|
169
|
+
this.extra_bits = extra_bits /* extra bits for each code or NULL */
|
|
170
|
+
this.extra_base = extra_base /* base index for extra_bits */
|
|
171
|
+
this.elems = elems /* max number of elements in the tree */
|
|
172
|
+
this.max_length = max_length /* max bit length for the codes */
|
|
173
|
+
|
|
174
|
+
// show if `static_tree` has data or dummy - needed for monomorphic objects
|
|
175
|
+
this.has_stree = static_tree && static_tree.length
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
let static_l_desc
|
|
179
|
+
let static_d_desc
|
|
180
|
+
let static_bl_desc
|
|
181
|
+
|
|
182
|
+
function TreeDesc(dyn_tree, stat_desc) {
|
|
183
|
+
this.dyn_tree = dyn_tree /* the dynamic tree */
|
|
184
|
+
this.max_code = 0 /* largest code with non zero frequency */
|
|
185
|
+
this.stat_desc = stat_desc /* the corresponding static tree */
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
const d_code = (dist) => {
|
|
189
|
+
return dist < 256 ? _dist_code[dist] : _dist_code[256 + (dist >>> 7)]
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
/* ===========================================================================
|
|
193
|
+
* Output a short LSB first on the stream.
|
|
194
|
+
* IN assertion: there is enough room in pendingBuf.
|
|
195
|
+
*/
|
|
196
|
+
const put_short = (s, w) => {
|
|
197
|
+
// put_byte(s, (uch)((w) & 0xff));
|
|
198
|
+
// put_byte(s, (uch)((ush)(w) >> 8));
|
|
199
|
+
s.pending_buf[s.pending++] = w & 0xff
|
|
200
|
+
s.pending_buf[s.pending++] = (w >>> 8) & 0xff
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
/* ===========================================================================
|
|
204
|
+
* Send a value on a given number of bits.
|
|
205
|
+
* IN assertion: length <= 16 and value fits in length bits.
|
|
206
|
+
*/
|
|
207
|
+
const send_bits = (s, value, length) => {
|
|
208
|
+
if (s.bi_valid > Buf_size - length) {
|
|
209
|
+
s.bi_buf |= (value << s.bi_valid) & 0xffff
|
|
210
|
+
put_short(s, s.bi_buf)
|
|
211
|
+
s.bi_buf = value >> (Buf_size - s.bi_valid)
|
|
212
|
+
s.bi_valid += length - Buf_size
|
|
213
|
+
} else {
|
|
214
|
+
s.bi_buf |= (value << s.bi_valid) & 0xffff
|
|
215
|
+
s.bi_valid += length
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
const send_code = (s, c, tree) => {
|
|
220
|
+
send_bits(s, tree[c * 2] /*.Code*/, tree[c * 2 + 1] /*.Len*/)
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
/* ===========================================================================
|
|
224
|
+
* Reverse the first len bits of a code, using straightforward code (a faster
|
|
225
|
+
* method would use a table)
|
|
226
|
+
* IN assertion: 1 <= len <= 15
|
|
227
|
+
*/
|
|
228
|
+
const bi_reverse = (code, len) => {
|
|
229
|
+
let res = 0
|
|
230
|
+
do {
|
|
231
|
+
res |= code & 1
|
|
232
|
+
code >>>= 1
|
|
233
|
+
res <<= 1
|
|
234
|
+
} while (--len > 0)
|
|
235
|
+
return res >>> 1
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
/* ===========================================================================
|
|
239
|
+
* Flush the bit buffer, keeping at most 7 bits in it.
|
|
240
|
+
*/
|
|
241
|
+
const bi_flush = (s) => {
|
|
242
|
+
if (s.bi_valid === 16) {
|
|
243
|
+
put_short(s, s.bi_buf)
|
|
244
|
+
s.bi_buf = 0
|
|
245
|
+
s.bi_valid = 0
|
|
246
|
+
} else if (s.bi_valid >= 8) {
|
|
247
|
+
s.pending_buf[s.pending++] = s.bi_buf & 0xff
|
|
248
|
+
s.bi_buf >>= 8
|
|
249
|
+
s.bi_valid -= 8
|
|
250
|
+
}
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
/* ===========================================================================
|
|
254
|
+
* Compute the optimal bit lengths for a tree and update the total bit length
|
|
255
|
+
* for the current block.
|
|
256
|
+
* IN assertion: the fields freq and dad are set, heap[heap_max] and
|
|
257
|
+
* above are the tree nodes sorted by increasing frequency.
|
|
258
|
+
* OUT assertions: the field len is set to the optimal bit length, the
|
|
259
|
+
* array bl_count contains the frequencies for each bit length.
|
|
260
|
+
* The length opt_len is updated; static_len is also updated if stree is
|
|
261
|
+
* not null.
|
|
262
|
+
*/
|
|
263
|
+
const gen_bitlen = (s, desc) =>
|
|
264
|
+
// deflate_state *s;
|
|
265
|
+
// tree_desc *desc; /* the tree descriptor */
|
|
266
|
+
{
|
|
267
|
+
const tree = desc.dyn_tree
|
|
268
|
+
const max_code = desc.max_code
|
|
269
|
+
const stree = desc.stat_desc.static_tree
|
|
270
|
+
const has_stree = desc.stat_desc.has_stree
|
|
271
|
+
const extra = desc.stat_desc.extra_bits
|
|
272
|
+
const base = desc.stat_desc.extra_base
|
|
273
|
+
const max_length = desc.stat_desc.max_length
|
|
274
|
+
let h /* heap index */
|
|
275
|
+
let n, m /* iterate over the tree elements */
|
|
276
|
+
let bits /* bit length */
|
|
277
|
+
let xbits /* extra bits */
|
|
278
|
+
let f /* frequency */
|
|
279
|
+
let overflow = 0 /* number of elements with bit length too large */
|
|
280
|
+
|
|
281
|
+
for (bits = 0; bits <= MAX_BITS; bits++) {
|
|
282
|
+
s.bl_count[bits] = 0
|
|
283
|
+
}
|
|
284
|
+
|
|
285
|
+
/* In a first pass, compute the optimal bit lengths (which may
|
|
286
|
+
* overflow in the case of the bit length tree).
|
|
287
|
+
*/
|
|
288
|
+
tree[s.heap[s.heap_max] * 2 + 1] /*.Len*/ = 0 /* root of the heap */
|
|
289
|
+
|
|
290
|
+
for (h = s.heap_max + 1; h < HEAP_SIZE; h++) {
|
|
291
|
+
n = s.heap[h]
|
|
292
|
+
bits = tree[tree[n * 2 + 1] /*.Dad*/ * 2 + 1] /*.Len*/ + 1
|
|
293
|
+
if (bits > max_length) {
|
|
294
|
+
bits = max_length
|
|
295
|
+
overflow++
|
|
296
|
+
}
|
|
297
|
+
tree[n * 2 + 1] /*.Len*/ = bits
|
|
298
|
+
/* We overwrite tree[n].Dad which is no longer needed */
|
|
299
|
+
|
|
300
|
+
if (n > max_code) {
|
|
301
|
+
continue
|
|
302
|
+
} /* not a leaf node */
|
|
303
|
+
|
|
304
|
+
s.bl_count[bits]++
|
|
305
|
+
xbits = 0
|
|
306
|
+
if (n >= base) {
|
|
307
|
+
xbits = extra[n - base]
|
|
308
|
+
}
|
|
309
|
+
f = tree[n * 2] /*.Freq*/
|
|
310
|
+
s.opt_len += f * (bits + xbits)
|
|
311
|
+
if (has_stree) {
|
|
312
|
+
s.static_len += f * (stree[n * 2 + 1] /*.Len*/ + xbits)
|
|
313
|
+
}
|
|
314
|
+
}
|
|
315
|
+
if (overflow === 0) {
|
|
316
|
+
return
|
|
317
|
+
}
|
|
318
|
+
|
|
319
|
+
// Trace((stderr,"\nbit length overflow\n"));
|
|
320
|
+
/* This happens for example on obj2 and pic of the Calgary corpus */
|
|
321
|
+
|
|
322
|
+
/* Find the first bit length which could increase: */
|
|
323
|
+
do {
|
|
324
|
+
bits = max_length - 1
|
|
325
|
+
while (s.bl_count[bits] === 0) {
|
|
326
|
+
bits--
|
|
327
|
+
}
|
|
328
|
+
s.bl_count[bits]-- /* move one leaf down the tree */
|
|
329
|
+
s.bl_count[bits + 1] += 2 /* move one overflow item as its brother */
|
|
330
|
+
s.bl_count[max_length]--
|
|
331
|
+
/* The brother of the overflow item also moves one step up,
|
|
332
|
+
* but this does not affect bl_count[max_length]
|
|
333
|
+
*/
|
|
334
|
+
overflow -= 2
|
|
335
|
+
} while (overflow > 0)
|
|
336
|
+
|
|
337
|
+
/* Now recompute all bit lengths, scanning in increasing frequency.
|
|
338
|
+
* h is still equal to HEAP_SIZE. (It is simpler to reconstruct all
|
|
339
|
+
* lengths instead of fixing only the wrong ones. This idea is taken
|
|
340
|
+
* from 'ar' written by Haruhiko Okumura.)
|
|
341
|
+
*/
|
|
342
|
+
for (bits = max_length; bits !== 0; bits--) {
|
|
343
|
+
n = s.bl_count[bits]
|
|
344
|
+
while (n !== 0) {
|
|
345
|
+
m = s.heap[--h]
|
|
346
|
+
if (m > max_code) {
|
|
347
|
+
continue
|
|
348
|
+
}
|
|
349
|
+
if (tree[m * 2 + 1] /*.Len*/ !== bits) {
|
|
350
|
+
// Trace((stderr,"code %d bits %d->%d\n", m, tree[m].Len, bits));
|
|
351
|
+
s.opt_len += (bits - tree[m * 2 + 1]) /*.Len*/ * tree[m * 2] /*.Freq*/
|
|
352
|
+
tree[m * 2 + 1] /*.Len*/ = bits
|
|
353
|
+
}
|
|
354
|
+
n--
|
|
355
|
+
}
|
|
356
|
+
}
|
|
357
|
+
}
|
|
358
|
+
|
|
359
|
+
/* ===========================================================================
|
|
360
|
+
* Generate the codes for a given tree and bit counts (which need not be
|
|
361
|
+
* optimal).
|
|
362
|
+
* IN assertion: the array bl_count contains the bit length statistics for
|
|
363
|
+
* the given tree and the field len is set for all tree elements.
|
|
364
|
+
* OUT assertion: the field code is set for all tree elements of non
|
|
365
|
+
* zero code length.
|
|
366
|
+
*/
|
|
367
|
+
const gen_codes = (tree, max_code, bl_count) =>
|
|
368
|
+
// ct_data *tree; /* the tree to decorate */
|
|
369
|
+
// int max_code; /* largest code with non zero frequency */
|
|
370
|
+
// ushf *bl_count; /* number of codes at each bit length */
|
|
371
|
+
{
|
|
372
|
+
const next_code = new Array(MAX_BITS + 1) /* next code value for each bit length */
|
|
373
|
+
let code = 0 /* running code value */
|
|
374
|
+
let bits /* bit index */
|
|
375
|
+
let n /* code index */
|
|
376
|
+
|
|
377
|
+
/* The distribution counts are first used to generate the code values
|
|
378
|
+
* without bit reversal.
|
|
379
|
+
*/
|
|
380
|
+
for (bits = 1; bits <= MAX_BITS; bits++) {
|
|
381
|
+
next_code[bits] = code = (code + bl_count[bits - 1]) << 1
|
|
382
|
+
}
|
|
383
|
+
/* Check that the bit counts in bl_count are consistent. The last code
|
|
384
|
+
* must be all ones.
|
|
385
|
+
*/
|
|
386
|
+
//Assert (code + bl_count[MAX_BITS]-1 == (1<<MAX_BITS)-1,
|
|
387
|
+
// "inconsistent bit counts");
|
|
388
|
+
//Tracev((stderr,"\ngen_codes: max_code %d ", max_code));
|
|
389
|
+
|
|
390
|
+
for (n = 0; n <= max_code; n++) {
|
|
391
|
+
let len = tree[n * 2 + 1] /*.Len*/
|
|
392
|
+
if (len === 0) {
|
|
393
|
+
continue
|
|
394
|
+
}
|
|
395
|
+
/* Now reverse the bits */
|
|
396
|
+
tree[n * 2] /*.Code*/ = bi_reverse(next_code[len]++, len)
|
|
397
|
+
|
|
398
|
+
//Tracecv(tree != static_ltree, (stderr,"\nn %3d %c l %2d c %4x (%x) ",
|
|
399
|
+
// n, (isgraph(n) ? n : ' '), len, tree[n].Code, next_code[len]-1));
|
|
400
|
+
}
|
|
401
|
+
}
|
|
402
|
+
|
|
403
|
+
/* ===========================================================================
|
|
404
|
+
* Initialize the various 'constant' tables.
|
|
405
|
+
*/
|
|
406
|
+
const tr_static_init = () => {
|
|
407
|
+
let n /* iterates over tree elements */
|
|
408
|
+
let bits /* bit counter */
|
|
409
|
+
let length /* length value */
|
|
410
|
+
let code /* code value */
|
|
411
|
+
let dist /* distance index */
|
|
412
|
+
const bl_count = new Array(MAX_BITS + 1)
|
|
413
|
+
/* number of codes at each bit length for an optimal tree */
|
|
414
|
+
|
|
415
|
+
// do check in _tr_init()
|
|
416
|
+
//if (static_init_done) return;
|
|
417
|
+
|
|
418
|
+
/* For some embedded targets, global variables are not initialized: */
|
|
419
|
+
/*#ifdef NO_INIT_GLOBAL_POINTERS
|
|
420
|
+
static_l_desc.static_tree = static_ltree;
|
|
421
|
+
static_l_desc.extra_bits = extra_lbits;
|
|
422
|
+
static_d_desc.static_tree = static_dtree;
|
|
423
|
+
static_d_desc.extra_bits = extra_dbits;
|
|
424
|
+
static_bl_desc.extra_bits = extra_blbits;
|
|
425
|
+
#endif*/
|
|
426
|
+
|
|
427
|
+
/* Initialize the mapping length (0..255) -> length code (0..28) */
|
|
428
|
+
length = 0
|
|
429
|
+
for (code = 0; code < LENGTH_CODES - 1; code++) {
|
|
430
|
+
base_length[code] = length
|
|
431
|
+
for (n = 0; n < 1 << extra_lbits[code]; n++) {
|
|
432
|
+
_length_code[length++] = code
|
|
433
|
+
}
|
|
434
|
+
}
|
|
435
|
+
//Assert (length == 256, "tr_static_init: length != 256");
|
|
436
|
+
/* Note that the length 255 (match length 258) can be represented
|
|
437
|
+
* in two different ways: code 284 + 5 bits or code 285, so we
|
|
438
|
+
* overwrite length_code[255] to use the best encoding:
|
|
439
|
+
*/
|
|
440
|
+
_length_code[length - 1] = code
|
|
441
|
+
|
|
442
|
+
/* Initialize the mapping dist (0..32K) -> dist code (0..29) */
|
|
443
|
+
dist = 0
|
|
444
|
+
for (code = 0; code < 16; code++) {
|
|
445
|
+
base_dist[code] = dist
|
|
446
|
+
for (n = 0; n < 1 << extra_dbits[code]; n++) {
|
|
447
|
+
_dist_code[dist++] = code
|
|
448
|
+
}
|
|
449
|
+
}
|
|
450
|
+
//Assert (dist == 256, "tr_static_init: dist != 256");
|
|
451
|
+
dist >>= 7 /* from now on, all distances are divided by 128 */
|
|
452
|
+
for (; code < D_CODES; code++) {
|
|
453
|
+
base_dist[code] = dist << 7
|
|
454
|
+
for (n = 0; n < 1 << (extra_dbits[code] - 7); n++) {
|
|
455
|
+
_dist_code[256 + dist++] = code
|
|
456
|
+
}
|
|
457
|
+
}
|
|
458
|
+
//Assert (dist == 256, "tr_static_init: 256+dist != 512");
|
|
459
|
+
|
|
460
|
+
/* Construct the codes of the static literal tree */
|
|
461
|
+
for (bits = 0; bits <= MAX_BITS; bits++) {
|
|
462
|
+
bl_count[bits] = 0
|
|
463
|
+
}
|
|
464
|
+
|
|
465
|
+
n = 0
|
|
466
|
+
while (n <= 143) {
|
|
467
|
+
static_ltree[n * 2 + 1] /*.Len*/ = 8
|
|
468
|
+
n++
|
|
469
|
+
bl_count[8]++
|
|
470
|
+
}
|
|
471
|
+
while (n <= 255) {
|
|
472
|
+
static_ltree[n * 2 + 1] /*.Len*/ = 9
|
|
473
|
+
n++
|
|
474
|
+
bl_count[9]++
|
|
475
|
+
}
|
|
476
|
+
while (n <= 279) {
|
|
477
|
+
static_ltree[n * 2 + 1] /*.Len*/ = 7
|
|
478
|
+
n++
|
|
479
|
+
bl_count[7]++
|
|
480
|
+
}
|
|
481
|
+
while (n <= 287) {
|
|
482
|
+
static_ltree[n * 2 + 1] /*.Len*/ = 8
|
|
483
|
+
n++
|
|
484
|
+
bl_count[8]++
|
|
485
|
+
}
|
|
486
|
+
/* Codes 286 and 287 do not exist, but we must include them in the
|
|
487
|
+
* tree construction to get a canonical Huffman tree (longest code
|
|
488
|
+
* all ones)
|
|
489
|
+
*/
|
|
490
|
+
gen_codes(static_ltree, L_CODES + 1, bl_count)
|
|
491
|
+
|
|
492
|
+
/* The static distance tree is trivial: */
|
|
493
|
+
for (n = 0; n < D_CODES; n++) {
|
|
494
|
+
static_dtree[n * 2 + 1] /*.Len*/ = 5
|
|
495
|
+
static_dtree[n * 2] /*.Code*/ = bi_reverse(n, 5)
|
|
496
|
+
}
|
|
497
|
+
|
|
498
|
+
// Now data ready and we can init static trees
|
|
499
|
+
static_l_desc = new StaticTreeDesc(static_ltree, extra_lbits, LITERALS + 1, L_CODES, MAX_BITS)
|
|
500
|
+
static_d_desc = new StaticTreeDesc(static_dtree, extra_dbits, 0, D_CODES, MAX_BITS)
|
|
501
|
+
static_bl_desc = new StaticTreeDesc(new Array(0), extra_blbits, 0, BL_CODES, MAX_BL_BITS)
|
|
502
|
+
|
|
503
|
+
//static_init_done = true;
|
|
504
|
+
}
|
|
505
|
+
|
|
506
|
+
/* ===========================================================================
|
|
507
|
+
* Initialize a new block.
|
|
508
|
+
*/
|
|
509
|
+
const init_block = (s) => {
|
|
510
|
+
let n /* iterates over tree elements */
|
|
511
|
+
|
|
512
|
+
/* Initialize the trees. */
|
|
513
|
+
for (n = 0; n < L_CODES; n++) {
|
|
514
|
+
s.dyn_ltree[n * 2] /*.Freq*/ = 0
|
|
515
|
+
}
|
|
516
|
+
for (n = 0; n < D_CODES; n++) {
|
|
517
|
+
s.dyn_dtree[n * 2] /*.Freq*/ = 0
|
|
518
|
+
}
|
|
519
|
+
for (n = 0; n < BL_CODES; n++) {
|
|
520
|
+
s.bl_tree[n * 2] /*.Freq*/ = 0
|
|
521
|
+
}
|
|
522
|
+
|
|
523
|
+
s.dyn_ltree[END_BLOCK * 2] /*.Freq*/ = 1
|
|
524
|
+
s.opt_len = s.static_len = 0
|
|
525
|
+
s.last_lit = s.matches = 0
|
|
526
|
+
}
|
|
527
|
+
|
|
528
|
+
/* ===========================================================================
|
|
529
|
+
* Flush the bit buffer and align the output on a byte boundary
|
|
530
|
+
*/
|
|
531
|
+
const bi_windup = (s) => {
|
|
532
|
+
if (s.bi_valid > 8) {
|
|
533
|
+
put_short(s, s.bi_buf)
|
|
534
|
+
} else if (s.bi_valid > 0) {
|
|
535
|
+
//put_byte(s, (Byte)s->bi_buf);
|
|
536
|
+
s.pending_buf[s.pending++] = s.bi_buf
|
|
537
|
+
}
|
|
538
|
+
s.bi_buf = 0
|
|
539
|
+
s.bi_valid = 0
|
|
540
|
+
}
|
|
541
|
+
|
|
542
|
+
/* ===========================================================================
|
|
543
|
+
* Copy a stored block, storing first the length and its
|
|
544
|
+
* one's complement if requested.
|
|
545
|
+
*/
|
|
546
|
+
const copy_block = (s, buf, len, header) =>
|
|
547
|
+
//DeflateState *s;
|
|
548
|
+
//charf *buf; /* the input data */
|
|
549
|
+
//unsigned len; /* its length */
|
|
550
|
+
//int header; /* true if block header must be written */
|
|
551
|
+
{
|
|
552
|
+
bi_windup(s) /* align on byte boundary */
|
|
553
|
+
|
|
554
|
+
if (header) {
|
|
555
|
+
put_short(s, len)
|
|
556
|
+
put_short(s, ~len)
|
|
557
|
+
}
|
|
558
|
+
// while (len--) {
|
|
559
|
+
// put_byte(s, *buf++);
|
|
560
|
+
// }
|
|
561
|
+
s.pending_buf.set(s.window.subarray(buf, buf + len), s.pending)
|
|
562
|
+
s.pending += len
|
|
563
|
+
}
|
|
564
|
+
|
|
565
|
+
/* ===========================================================================
|
|
566
|
+
* Compares to subtrees, using the tree depth as tie breaker when
|
|
567
|
+
* the subtrees have equal frequency. This minimizes the worst case length.
|
|
568
|
+
*/
|
|
569
|
+
const smaller = (tree, n, m, depth) => {
|
|
570
|
+
const _n2 = n * 2
|
|
571
|
+
const _m2 = m * 2
|
|
572
|
+
return tree[_n2] /*.Freq*/ < tree[_m2] /*.Freq*/ || (tree[_n2] /*.Freq*/ === tree[_m2] /*.Freq*/ && depth[n] <= depth[m])
|
|
573
|
+
}
|
|
574
|
+
|
|
575
|
+
/* ===========================================================================
|
|
576
|
+
* Restore the heap property by moving down the tree starting at node k,
|
|
577
|
+
* exchanging a node with the smallest of its two sons if necessary, stopping
|
|
578
|
+
* when the heap property is re-established (each father smaller than its
|
|
579
|
+
* two sons).
|
|
580
|
+
*/
|
|
581
|
+
const pqdownheap = (s, tree, k) =>
|
|
582
|
+
// deflate_state *s;
|
|
583
|
+
// ct_data *tree; /* the tree to restore */
|
|
584
|
+
// int k; /* node to move down */
|
|
585
|
+
{
|
|
586
|
+
const v = s.heap[k]
|
|
587
|
+
let j = k << 1 /* left son of k */
|
|
588
|
+
while (j <= s.heap_len) {
|
|
589
|
+
/* Set j to the smallest of the two sons: */
|
|
590
|
+
if (j < s.heap_len && smaller(tree, s.heap[j + 1], s.heap[j], s.depth)) {
|
|
591
|
+
j++
|
|
592
|
+
}
|
|
593
|
+
/* Exit if v is smaller than both sons */
|
|
594
|
+
if (smaller(tree, v, s.heap[j], s.depth)) {
|
|
595
|
+
break
|
|
596
|
+
}
|
|
597
|
+
|
|
598
|
+
/* Exchange v with the smallest son */
|
|
599
|
+
s.heap[k] = s.heap[j]
|
|
600
|
+
k = j
|
|
601
|
+
|
|
602
|
+
/* And continue down the tree, setting j to the left son of k */
|
|
603
|
+
j <<= 1
|
|
604
|
+
}
|
|
605
|
+
s.heap[k] = v
|
|
606
|
+
}
|
|
607
|
+
|
|
608
|
+
// inlined manually
|
|
609
|
+
// const SMALLEST = 1;
|
|
610
|
+
|
|
611
|
+
/* ===========================================================================
|
|
612
|
+
* Send the block data compressed using the given Huffman trees
|
|
613
|
+
*/
|
|
614
|
+
const compress_block = (s, ltree, dtree) =>
|
|
615
|
+
// deflate_state *s;
|
|
616
|
+
// const ct_data *ltree; /* literal tree */
|
|
617
|
+
// const ct_data *dtree; /* distance tree */
|
|
618
|
+
{
|
|
619
|
+
let dist /* distance of matched string */
|
|
620
|
+
let lc /* match length or unmatched char (if dist == 0) */
|
|
621
|
+
let lx = 0 /* running index in l_buf */
|
|
622
|
+
let code /* the code to send */
|
|
623
|
+
let extra /* number of extra bits to send */
|
|
624
|
+
|
|
625
|
+
if (s.last_lit !== 0) {
|
|
626
|
+
do {
|
|
627
|
+
dist = (s.pending_buf[s.d_buf + lx * 2] << 8) | s.pending_buf[s.d_buf + lx * 2 + 1]
|
|
628
|
+
lc = s.pending_buf[s.l_buf + lx]
|
|
629
|
+
lx++
|
|
630
|
+
|
|
631
|
+
if (dist === 0) {
|
|
632
|
+
send_code(s, lc, ltree) /* send a literal byte */
|
|
633
|
+
//Tracecv(isgraph(lc), (stderr," '%c' ", lc));
|
|
634
|
+
} else {
|
|
635
|
+
/* Here, lc is the match length - MIN_MATCH */
|
|
636
|
+
code = _length_code[lc]
|
|
637
|
+
send_code(s, code + LITERALS + 1, ltree) /* send the length code */
|
|
638
|
+
extra = extra_lbits[code]
|
|
639
|
+
if (extra !== 0) {
|
|
640
|
+
lc -= base_length[code]
|
|
641
|
+
send_bits(s, lc, extra) /* send the extra length bits */
|
|
642
|
+
}
|
|
643
|
+
dist-- /* dist is now the match distance - 1 */
|
|
644
|
+
code = d_code(dist)
|
|
645
|
+
//Assert (code < D_CODES, "bad d_code");
|
|
646
|
+
|
|
647
|
+
send_code(s, code, dtree) /* send the distance code */
|
|
648
|
+
extra = extra_dbits[code]
|
|
649
|
+
if (extra !== 0) {
|
|
650
|
+
dist -= base_dist[code]
|
|
651
|
+
send_bits(s, dist, extra) /* send the extra distance bits */
|
|
652
|
+
}
|
|
653
|
+
} /* literal or match pair ? */
|
|
654
|
+
|
|
655
|
+
/* Check that the overlay between pending_buf and d_buf+l_buf is ok: */
|
|
656
|
+
//Assert((uInt)(s->pending) < s->lit_bufsize + 2*lx,
|
|
657
|
+
// "pendingBuf overflow");
|
|
658
|
+
} while (lx < s.last_lit)
|
|
659
|
+
}
|
|
660
|
+
|
|
661
|
+
send_code(s, END_BLOCK, ltree)
|
|
662
|
+
}
|
|
663
|
+
|
|
664
|
+
/* ===========================================================================
|
|
665
|
+
* Construct one Huffman tree and assigns the code bit strings and lengths.
|
|
666
|
+
* Update the total bit length for the current block.
|
|
667
|
+
* IN assertion: the field freq is set for all tree elements.
|
|
668
|
+
* OUT assertions: the fields len and code are set to the optimal bit length
|
|
669
|
+
* and corresponding code. The length opt_len is updated; static_len is
|
|
670
|
+
* also updated if stree is not null. The field max_code is set.
|
|
671
|
+
*/
|
|
672
|
+
const build_tree = (s, desc) =>
|
|
673
|
+
// deflate_state *s;
|
|
674
|
+
// tree_desc *desc; /* the tree descriptor */
|
|
675
|
+
{
|
|
676
|
+
const tree = desc.dyn_tree
|
|
677
|
+
const stree = desc.stat_desc.static_tree
|
|
678
|
+
const has_stree = desc.stat_desc.has_stree
|
|
679
|
+
const elems = desc.stat_desc.elems
|
|
680
|
+
let n, m /* iterate over heap elements */
|
|
681
|
+
let max_code = -1 /* largest code with non zero frequency */
|
|
682
|
+
let node /* new node being created */
|
|
683
|
+
|
|
684
|
+
/* Construct the initial heap, with least frequent element in
|
|
685
|
+
* heap[SMALLEST]. The sons of heap[n] are heap[2*n] and heap[2*n+1].
|
|
686
|
+
* heap[0] is not used.
|
|
687
|
+
*/
|
|
688
|
+
s.heap_len = 0
|
|
689
|
+
s.heap_max = HEAP_SIZE
|
|
690
|
+
|
|
691
|
+
for (n = 0; n < elems; n++) {
|
|
692
|
+
if (tree[n * 2] /*.Freq*/ !== 0) {
|
|
693
|
+
s.heap[++s.heap_len] = max_code = n
|
|
694
|
+
s.depth[n] = 0
|
|
695
|
+
} else {
|
|
696
|
+
tree[n * 2 + 1] /*.Len*/ = 0
|
|
697
|
+
}
|
|
698
|
+
}
|
|
699
|
+
|
|
700
|
+
/* The pkzip format requires that at least one distance code exists,
|
|
701
|
+
* and that at least one bit should be sent even if there is only one
|
|
702
|
+
* possible code. So to avoid special checks later on we force at least
|
|
703
|
+
* two codes of non zero frequency.
|
|
704
|
+
*/
|
|
705
|
+
while (s.heap_len < 2) {
|
|
706
|
+
node = s.heap[++s.heap_len] = max_code < 2 ? ++max_code : 0
|
|
707
|
+
tree[node * 2] /*.Freq*/ = 1
|
|
708
|
+
s.depth[node] = 0
|
|
709
|
+
s.opt_len--
|
|
710
|
+
|
|
711
|
+
if (has_stree) {
|
|
712
|
+
s.static_len -= stree[node * 2 + 1] /*.Len*/
|
|
713
|
+
}
|
|
714
|
+
/* node is 0 or 1 so it does not have extra bits */
|
|
715
|
+
}
|
|
716
|
+
desc.max_code = max_code
|
|
717
|
+
|
|
718
|
+
/* The elements heap[heap_len/2+1 .. heap_len] are leaves of the tree,
|
|
719
|
+
* establish sub-heaps of increasing lengths:
|
|
720
|
+
*/
|
|
721
|
+
for (n = s.heap_len >> 1 /*int /2*/; n >= 1; n--) {
|
|
722
|
+
pqdownheap(s, tree, n)
|
|
723
|
+
}
|
|
724
|
+
|
|
725
|
+
/* Construct the Huffman tree by repeatedly combining the least two
|
|
726
|
+
* frequent nodes.
|
|
727
|
+
*/
|
|
728
|
+
node = elems /* next internal node of the tree */
|
|
729
|
+
do {
|
|
730
|
+
//pqremove(s, tree, n); /* n = node of least frequency */
|
|
731
|
+
/*** pqremove ***/
|
|
732
|
+
n = s.heap[1 /*SMALLEST*/]
|
|
733
|
+
s.heap[1 /*SMALLEST*/] = s.heap[s.heap_len--]
|
|
734
|
+
pqdownheap(s, tree, 1 /*SMALLEST*/)
|
|
735
|
+
/***/
|
|
736
|
+
|
|
737
|
+
m = s.heap[1 /*SMALLEST*/] /* m = node of next least frequency */
|
|
738
|
+
|
|
739
|
+
s.heap[--s.heap_max] = n /* keep the nodes sorted by frequency */
|
|
740
|
+
s.heap[--s.heap_max] = m
|
|
741
|
+
|
|
742
|
+
/* Create a new node father of n and m */
|
|
743
|
+
tree[node * 2] /*.Freq*/ = tree[n * 2] /*.Freq*/ + tree[m * 2] /*.Freq*/
|
|
744
|
+
s.depth[node] = (s.depth[n] >= s.depth[m] ? s.depth[n] : s.depth[m]) + 1
|
|
745
|
+
tree[n * 2 + 1] /*.Dad*/ = tree[m * 2 + 1] /*.Dad*/ = node
|
|
746
|
+
|
|
747
|
+
/* and insert the new node in the heap */
|
|
748
|
+
s.heap[1 /*SMALLEST*/] = node++
|
|
749
|
+
pqdownheap(s, tree, 1 /*SMALLEST*/)
|
|
750
|
+
} while (s.heap_len >= 2)
|
|
751
|
+
|
|
752
|
+
s.heap[--s.heap_max] = s.heap[1 /*SMALLEST*/]
|
|
753
|
+
|
|
754
|
+
/* At this point, the fields freq and dad are set. We can now
|
|
755
|
+
* generate the bit lengths.
|
|
756
|
+
*/
|
|
757
|
+
gen_bitlen(s, desc)
|
|
758
|
+
|
|
759
|
+
/* The field len is now set, we can generate the bit codes */
|
|
760
|
+
gen_codes(tree, max_code, s.bl_count)
|
|
761
|
+
}
|
|
762
|
+
|
|
763
|
+
/* ===========================================================================
|
|
764
|
+
* Scan a literal or distance tree to determine the frequencies of the codes
|
|
765
|
+
* in the bit length tree.
|
|
766
|
+
*/
|
|
767
|
+
const scan_tree = (s, tree, max_code) =>
|
|
768
|
+
// deflate_state *s;
|
|
769
|
+
// ct_data *tree; /* the tree to be scanned */
|
|
770
|
+
// int max_code; /* and its largest code of non zero frequency */
|
|
771
|
+
{
|
|
772
|
+
let n /* iterates over all tree elements */
|
|
773
|
+
let prevlen = -1 /* last emitted length */
|
|
774
|
+
let curlen /* length of current code */
|
|
775
|
+
|
|
776
|
+
let nextlen = tree[0 * 2 + 1] /*.Len*/ /* length of next code */
|
|
777
|
+
|
|
778
|
+
let count = 0 /* repeat count of the current code */
|
|
779
|
+
let max_count = 7 /* max repeat count */
|
|
780
|
+
let min_count = 4 /* min repeat count */
|
|
781
|
+
|
|
782
|
+
if (nextlen === 0) {
|
|
783
|
+
max_count = 138
|
|
784
|
+
min_count = 3
|
|
785
|
+
}
|
|
786
|
+
tree[(max_code + 1) * 2 + 1] /*.Len*/ = 0xffff /* guard */
|
|
787
|
+
|
|
788
|
+
for (n = 0; n <= max_code; n++) {
|
|
789
|
+
curlen = nextlen
|
|
790
|
+
nextlen = tree[(n + 1) * 2 + 1] /*.Len*/
|
|
791
|
+
|
|
792
|
+
if (++count < max_count && curlen === nextlen) {
|
|
793
|
+
continue
|
|
794
|
+
} else if (count < min_count) {
|
|
795
|
+
s.bl_tree[curlen * 2] /*.Freq*/ += count
|
|
796
|
+
} else if (curlen !== 0) {
|
|
797
|
+
if (curlen !== prevlen) {
|
|
798
|
+
s.bl_tree[curlen * 2] /*.Freq*/++
|
|
799
|
+
}
|
|
800
|
+
s.bl_tree[REP_3_6 * 2] /*.Freq*/++
|
|
801
|
+
} else if (count <= 10) {
|
|
802
|
+
s.bl_tree[REPZ_3_10 * 2] /*.Freq*/++
|
|
803
|
+
} else {
|
|
804
|
+
s.bl_tree[REPZ_11_138 * 2] /*.Freq*/++
|
|
805
|
+
}
|
|
806
|
+
|
|
807
|
+
count = 0
|
|
808
|
+
prevlen = curlen
|
|
809
|
+
|
|
810
|
+
if (nextlen === 0) {
|
|
811
|
+
max_count = 138
|
|
812
|
+
min_count = 3
|
|
813
|
+
} else if (curlen === nextlen) {
|
|
814
|
+
max_count = 6
|
|
815
|
+
min_count = 3
|
|
816
|
+
} else {
|
|
817
|
+
max_count = 7
|
|
818
|
+
min_count = 4
|
|
819
|
+
}
|
|
820
|
+
}
|
|
821
|
+
}
|
|
822
|
+
|
|
823
|
+
/* ===========================================================================
|
|
824
|
+
* Send a literal or distance tree in compressed form, using the codes in
|
|
825
|
+
* bl_tree.
|
|
826
|
+
*/
|
|
827
|
+
const send_tree = (s, tree, max_code) =>
|
|
828
|
+
// deflate_state *s;
|
|
829
|
+
// ct_data *tree; /* the tree to be scanned */
|
|
830
|
+
// int max_code; /* and its largest code of non zero frequency */
|
|
831
|
+
{
|
|
832
|
+
let n /* iterates over all tree elements */
|
|
833
|
+
let prevlen = -1 /* last emitted length */
|
|
834
|
+
let curlen /* length of current code */
|
|
835
|
+
|
|
836
|
+
let nextlen = tree[0 * 2 + 1] /*.Len*/ /* length of next code */
|
|
837
|
+
|
|
838
|
+
let count = 0 /* repeat count of the current code */
|
|
839
|
+
let max_count = 7 /* max repeat count */
|
|
840
|
+
let min_count = 4 /* min repeat count */ /* guard already set */
|
|
841
|
+
|
|
842
|
+
/* tree[max_code+1].Len = -1; */ if (nextlen === 0) {
|
|
843
|
+
max_count = 138
|
|
844
|
+
min_count = 3
|
|
845
|
+
}
|
|
846
|
+
|
|
847
|
+
for (n = 0; n <= max_code; n++) {
|
|
848
|
+
curlen = nextlen
|
|
849
|
+
nextlen = tree[(n + 1) * 2 + 1] /*.Len*/
|
|
850
|
+
|
|
851
|
+
if (++count < max_count && curlen === nextlen) {
|
|
852
|
+
continue
|
|
853
|
+
} else if (count < min_count) {
|
|
854
|
+
do {
|
|
855
|
+
send_code(s, curlen, s.bl_tree)
|
|
856
|
+
} while (--count !== 0)
|
|
857
|
+
} else if (curlen !== 0) {
|
|
858
|
+
if (curlen !== prevlen) {
|
|
859
|
+
send_code(s, curlen, s.bl_tree)
|
|
860
|
+
count--
|
|
861
|
+
}
|
|
862
|
+
//Assert(count >= 3 && count <= 6, " 3_6?");
|
|
863
|
+
send_code(s, REP_3_6, s.bl_tree)
|
|
864
|
+
send_bits(s, count - 3, 2)
|
|
865
|
+
} else if (count <= 10) {
|
|
866
|
+
send_code(s, REPZ_3_10, s.bl_tree)
|
|
867
|
+
send_bits(s, count - 3, 3)
|
|
868
|
+
} else {
|
|
869
|
+
send_code(s, REPZ_11_138, s.bl_tree)
|
|
870
|
+
send_bits(s, count - 11, 7)
|
|
871
|
+
}
|
|
872
|
+
|
|
873
|
+
count = 0
|
|
874
|
+
prevlen = curlen
|
|
875
|
+
if (nextlen === 0) {
|
|
876
|
+
max_count = 138
|
|
877
|
+
min_count = 3
|
|
878
|
+
} else if (curlen === nextlen) {
|
|
879
|
+
max_count = 6
|
|
880
|
+
min_count = 3
|
|
881
|
+
} else {
|
|
882
|
+
max_count = 7
|
|
883
|
+
min_count = 4
|
|
884
|
+
}
|
|
885
|
+
}
|
|
886
|
+
}
|
|
887
|
+
|
|
888
|
+
/* ===========================================================================
|
|
889
|
+
* Construct the Huffman tree for the bit lengths and return the index in
|
|
890
|
+
* bl_order of the last bit length code to send.
|
|
891
|
+
*/
|
|
892
|
+
const build_bl_tree = (s) => {
|
|
893
|
+
let max_blindex /* index of last bit length code of non zero freq */
|
|
894
|
+
|
|
895
|
+
/* Determine the bit length frequencies for literal and distance trees */
|
|
896
|
+
scan_tree(s, s.dyn_ltree, s.l_desc.max_code)
|
|
897
|
+
scan_tree(s, s.dyn_dtree, s.d_desc.max_code)
|
|
898
|
+
|
|
899
|
+
/* Build the bit length tree: */
|
|
900
|
+
build_tree(s, s.bl_desc)
|
|
901
|
+
/* opt_len now includes the length of the tree representations, except
|
|
902
|
+
* the lengths of the bit lengths codes and the 5+5+4 bits for the counts.
|
|
903
|
+
*/
|
|
904
|
+
|
|
905
|
+
/* Determine the number of bit length codes to send. The pkzip format
|
|
906
|
+
* requires that at least 4 bit length codes be sent. (appnote.txt says
|
|
907
|
+
* 3 but the actual value used is 4.)
|
|
908
|
+
*/
|
|
909
|
+
for (max_blindex = BL_CODES - 1; max_blindex >= 3; max_blindex--) {
|
|
910
|
+
if (s.bl_tree[bl_order[max_blindex] * 2 + 1] /*.Len*/ !== 0) {
|
|
911
|
+
break
|
|
912
|
+
}
|
|
913
|
+
}
|
|
914
|
+
/* Update opt_len to include the bit length tree and counts */
|
|
915
|
+
s.opt_len += 3 * (max_blindex + 1) + 5 + 5 + 4
|
|
916
|
+
//Tracev((stderr, "\ndyn trees: dyn %ld, stat %ld",
|
|
917
|
+
// s->opt_len, s->static_len));
|
|
918
|
+
|
|
919
|
+
return max_blindex
|
|
920
|
+
}
|
|
921
|
+
|
|
922
|
+
/* ===========================================================================
|
|
923
|
+
* Send the header for a block using dynamic Huffman trees: the counts, the
|
|
924
|
+
* lengths of the bit length codes, the literal tree and the distance tree.
|
|
925
|
+
* IN assertion: lcodes >= 257, dcodes >= 1, blcodes >= 4.
|
|
926
|
+
*/
|
|
927
|
+
const send_all_trees = (s, lcodes, dcodes, blcodes) =>
|
|
928
|
+
// deflate_state *s;
|
|
929
|
+
// int lcodes, dcodes, blcodes; /* number of codes for each tree */
|
|
930
|
+
{
|
|
931
|
+
let rank /* index in bl_order */
|
|
932
|
+
|
|
933
|
+
//Assert (lcodes >= 257 && dcodes >= 1 && blcodes >= 4, "not enough codes");
|
|
934
|
+
//Assert (lcodes <= L_CODES && dcodes <= D_CODES && blcodes <= BL_CODES,
|
|
935
|
+
// "too many codes");
|
|
936
|
+
//Tracev((stderr, "\nbl counts: "));
|
|
937
|
+
send_bits(s, lcodes - 257, 5) /* not +255 as stated in appnote.txt */
|
|
938
|
+
send_bits(s, dcodes - 1, 5)
|
|
939
|
+
send_bits(s, blcodes - 4, 4) /* not -3 as stated in appnote.txt */
|
|
940
|
+
for (rank = 0; rank < blcodes; rank++) {
|
|
941
|
+
//Tracev((stderr, "\nbl code %2d ", bl_order[rank]));
|
|
942
|
+
send_bits(s, s.bl_tree[bl_order[rank] * 2 + 1] /*.Len*/, 3)
|
|
943
|
+
}
|
|
944
|
+
//Tracev((stderr, "\nbl tree: sent %ld", s->bits_sent));
|
|
945
|
+
|
|
946
|
+
send_tree(s, s.dyn_ltree, lcodes - 1) /* literal tree */
|
|
947
|
+
//Tracev((stderr, "\nlit tree: sent %ld", s->bits_sent));
|
|
948
|
+
|
|
949
|
+
send_tree(s, s.dyn_dtree, dcodes - 1) /* distance tree */
|
|
950
|
+
//Tracev((stderr, "\ndist tree: sent %ld", s->bits_sent));
|
|
951
|
+
}
|
|
952
|
+
|
|
953
|
+
/* ===========================================================================
|
|
954
|
+
* Check if the data type is TEXT or BINARY, using the following algorithm:
|
|
955
|
+
* - TEXT if the two conditions below are satisfied:
|
|
956
|
+
* a) There are no non-portable control characters belonging to the
|
|
957
|
+
* "black list" (0..6, 14..25, 28..31).
|
|
958
|
+
* b) There is at least one printable character belonging to the
|
|
959
|
+
* "white list" (9 {TAB}, 10 {LF}, 13 {CR}, 32..255).
|
|
960
|
+
* - BINARY otherwise.
|
|
961
|
+
* - The following partially-portable control characters form a
|
|
962
|
+
* "gray list" that is ignored in this detection algorithm:
|
|
963
|
+
* (7 {BEL}, 8 {BS}, 11 {VT}, 12 {FF}, 26 {SUB}, 27 {ESC}).
|
|
964
|
+
* IN assertion: the fields Freq of dyn_ltree are set.
|
|
965
|
+
*/
|
|
966
|
+
const detect_data_type = (s) => {
|
|
967
|
+
/* black_mask is the bit mask of black-listed bytes
|
|
968
|
+
* set bits 0..6, 14..25, and 28..31
|
|
969
|
+
* 0xf3ffc07f = binary 11110011111111111100000001111111
|
|
970
|
+
*/
|
|
971
|
+
let black_mask = 0xf3ffc07f
|
|
972
|
+
let n
|
|
973
|
+
|
|
974
|
+
/* Check for non-textual ("black-listed") bytes. */
|
|
975
|
+
for (n = 0; n <= 31; n++, black_mask >>>= 1) {
|
|
976
|
+
if (black_mask & 1 && s.dyn_ltree[n * 2] /*.Freq*/ !== 0) {
|
|
977
|
+
return Z_BINARY
|
|
978
|
+
}
|
|
979
|
+
}
|
|
980
|
+
|
|
981
|
+
/* Check for textual ("white-listed") bytes. */
|
|
982
|
+
if (s.dyn_ltree[9 * 2] /*.Freq*/ !== 0 || s.dyn_ltree[10 * 2] /*.Freq*/ !== 0 || s.dyn_ltree[13 * 2] /*.Freq*/ !== 0) {
|
|
983
|
+
return Z_TEXT
|
|
984
|
+
}
|
|
985
|
+
for (n = 32; n < LITERALS; n++) {
|
|
986
|
+
if (s.dyn_ltree[n * 2] /*.Freq*/ !== 0) {
|
|
987
|
+
return Z_TEXT
|
|
988
|
+
}
|
|
989
|
+
}
|
|
990
|
+
|
|
991
|
+
/* There are no "black-listed" or "white-listed" bytes:
|
|
992
|
+
* this stream either is empty or has tolerated ("gray-listed") bytes only.
|
|
993
|
+
*/
|
|
994
|
+
return Z_BINARY
|
|
995
|
+
}
|
|
996
|
+
|
|
997
|
+
let static_init_done = false
|
|
998
|
+
|
|
999
|
+
/* ===========================================================================
|
|
1000
|
+
* Initialize the tree data structures for a new zlib stream.
|
|
1001
|
+
*/
|
|
1002
|
+
const _tr_init = (s) => {
|
|
1003
|
+
if (!static_init_done) {
|
|
1004
|
+
tr_static_init()
|
|
1005
|
+
static_init_done = true
|
|
1006
|
+
}
|
|
1007
|
+
|
|
1008
|
+
s.l_desc = new TreeDesc(s.dyn_ltree, static_l_desc)
|
|
1009
|
+
s.d_desc = new TreeDesc(s.dyn_dtree, static_d_desc)
|
|
1010
|
+
s.bl_desc = new TreeDesc(s.bl_tree, static_bl_desc)
|
|
1011
|
+
|
|
1012
|
+
s.bi_buf = 0
|
|
1013
|
+
s.bi_valid = 0
|
|
1014
|
+
|
|
1015
|
+
/* Initialize the first block of the first file: */
|
|
1016
|
+
init_block(s)
|
|
1017
|
+
}
|
|
1018
|
+
|
|
1019
|
+
/* ===========================================================================
|
|
1020
|
+
* Send a stored block
|
|
1021
|
+
*/
|
|
1022
|
+
const _tr_stored_block = (s, buf, stored_len, last) =>
|
|
1023
|
+
//DeflateState *s;
|
|
1024
|
+
//charf *buf; /* input block */
|
|
1025
|
+
//ulg stored_len; /* length of input block */
|
|
1026
|
+
//int last; /* one if this is the last block for a file */
|
|
1027
|
+
{
|
|
1028
|
+
send_bits(s, (STORED_BLOCK << 1) + (last ? 1 : 0), 3) /* send block type */
|
|
1029
|
+
copy_block(s, buf, stored_len, true) /* with header */
|
|
1030
|
+
}
|
|
1031
|
+
|
|
1032
|
+
/* ===========================================================================
|
|
1033
|
+
* Send one empty static block to give enough lookahead for inflate.
|
|
1034
|
+
* This takes 10 bits, of which 7 may remain in the bit buffer.
|
|
1035
|
+
*/
|
|
1036
|
+
const _tr_align = (s) => {
|
|
1037
|
+
send_bits(s, STATIC_TREES << 1, 3)
|
|
1038
|
+
send_code(s, END_BLOCK, static_ltree)
|
|
1039
|
+
bi_flush(s)
|
|
1040
|
+
}
|
|
1041
|
+
|
|
1042
|
+
/* ===========================================================================
|
|
1043
|
+
* Determine the best encoding for the current block: dynamic trees, static
|
|
1044
|
+
* trees or store, and output the encoded block to the zip file.
|
|
1045
|
+
*/
|
|
1046
|
+
const _tr_flush_block = (s, buf, stored_len, last) =>
|
|
1047
|
+
//DeflateState *s;
|
|
1048
|
+
//charf *buf; /* input block, or NULL if too old */
|
|
1049
|
+
//ulg stored_len; /* length of input block */
|
|
1050
|
+
//int last; /* one if this is the last block for a file */
|
|
1051
|
+
{
|
|
1052
|
+
let opt_lenb, static_lenb /* opt_len and static_len in bytes */
|
|
1053
|
+
let max_blindex = 0 /* index of last bit length code of non zero freq */
|
|
1054
|
+
|
|
1055
|
+
/* Build the Huffman trees unless a stored block is forced */
|
|
1056
|
+
if (s.level > 0) {
|
|
1057
|
+
/* Check if the file is binary or text */
|
|
1058
|
+
if (s.strm.data_type === Z_UNKNOWN) {
|
|
1059
|
+
s.strm.data_type = detect_data_type(s)
|
|
1060
|
+
}
|
|
1061
|
+
|
|
1062
|
+
/* Construct the literal and distance trees */
|
|
1063
|
+
build_tree(s, s.l_desc)
|
|
1064
|
+
// Tracev((stderr, "\nlit data: dyn %ld, stat %ld", s->opt_len,
|
|
1065
|
+
// s->static_len));
|
|
1066
|
+
|
|
1067
|
+
build_tree(s, s.d_desc)
|
|
1068
|
+
// Tracev((stderr, "\ndist data: dyn %ld, stat %ld", s->opt_len,
|
|
1069
|
+
// s->static_len));
|
|
1070
|
+
/* At this point, opt_len and static_len are the total bit lengths of
|
|
1071
|
+
* the compressed block data, excluding the tree representations.
|
|
1072
|
+
*/
|
|
1073
|
+
|
|
1074
|
+
/* Build the bit length tree for the above two trees, and get the index
|
|
1075
|
+
* in bl_order of the last bit length code to send.
|
|
1076
|
+
*/
|
|
1077
|
+
max_blindex = build_bl_tree(s)
|
|
1078
|
+
|
|
1079
|
+
/* Determine the best encoding. Compute the block lengths in bytes. */
|
|
1080
|
+
opt_lenb = (s.opt_len + 3 + 7) >>> 3
|
|
1081
|
+
static_lenb = (s.static_len + 3 + 7) >>> 3
|
|
1082
|
+
|
|
1083
|
+
// Tracev((stderr, "\nopt %lu(%lu) stat %lu(%lu) stored %lu lit %u ",
|
|
1084
|
+
// opt_lenb, s->opt_len, static_lenb, s->static_len, stored_len,
|
|
1085
|
+
// s->last_lit));
|
|
1086
|
+
|
|
1087
|
+
if (static_lenb <= opt_lenb) {
|
|
1088
|
+
opt_lenb = static_lenb
|
|
1089
|
+
}
|
|
1090
|
+
} else {
|
|
1091
|
+
// Assert(buf != (char*)0, "lost buf");
|
|
1092
|
+
opt_lenb = static_lenb = stored_len + 5 /* force a stored block */
|
|
1093
|
+
}
|
|
1094
|
+
|
|
1095
|
+
if (stored_len + 4 <= opt_lenb && buf !== -1) {
|
|
1096
|
+
/* 4: two words for the lengths */
|
|
1097
|
+
|
|
1098
|
+
/* The test buf != NULL is only necessary if LIT_BUFSIZE > WSIZE.
|
|
1099
|
+
* Otherwise we can't have processed more than WSIZE input bytes since
|
|
1100
|
+
* the last block flush, because compression would have been
|
|
1101
|
+
* successful. If LIT_BUFSIZE <= WSIZE, it is never too late to
|
|
1102
|
+
* transform a block into a stored block.
|
|
1103
|
+
*/
|
|
1104
|
+
_tr_stored_block(s, buf, stored_len, last)
|
|
1105
|
+
} else if (s.strategy === Z_FIXED || static_lenb === opt_lenb) {
|
|
1106
|
+
send_bits(s, (STATIC_TREES << 1) + (last ? 1 : 0), 3)
|
|
1107
|
+
compress_block(s, static_ltree, static_dtree)
|
|
1108
|
+
} else {
|
|
1109
|
+
send_bits(s, (DYN_TREES << 1) + (last ? 1 : 0), 3)
|
|
1110
|
+
send_all_trees(s, s.l_desc.max_code + 1, s.d_desc.max_code + 1, max_blindex + 1)
|
|
1111
|
+
compress_block(s, s.dyn_ltree, s.dyn_dtree)
|
|
1112
|
+
}
|
|
1113
|
+
// Assert (s->compressed_len == s->bits_sent, "bad compressed size");
|
|
1114
|
+
/* The above check is made mod 2^32, for files larger than 512 MB
|
|
1115
|
+
* and uLong implemented on 32 bits.
|
|
1116
|
+
*/
|
|
1117
|
+
init_block(s)
|
|
1118
|
+
|
|
1119
|
+
if (last) {
|
|
1120
|
+
bi_windup(s)
|
|
1121
|
+
}
|
|
1122
|
+
// Tracev((stderr,"\ncomprlen %lu(%lu) ", s->compressed_len>>3,
|
|
1123
|
+
// s->compressed_len-7*last));
|
|
1124
|
+
}
|
|
1125
|
+
|
|
1126
|
+
/* ===========================================================================
|
|
1127
|
+
* Save the match info and tally the frequency counts. Return true if
|
|
1128
|
+
* the current block must be flushed.
|
|
1129
|
+
*/
|
|
1130
|
+
const _tr_tally = (s, dist, lc) =>
|
|
1131
|
+
// deflate_state *s;
|
|
1132
|
+
// unsigned dist; /* distance of matched string */
|
|
1133
|
+
// unsigned lc; /* match length-MIN_MATCH or unmatched char (if dist==0) */
|
|
1134
|
+
{
|
|
1135
|
+
//let out_length, in_length, dcode;
|
|
1136
|
+
|
|
1137
|
+
s.pending_buf[s.d_buf + s.last_lit * 2] = (dist >>> 8) & 0xff
|
|
1138
|
+
s.pending_buf[s.d_buf + s.last_lit * 2 + 1] = dist & 0xff
|
|
1139
|
+
|
|
1140
|
+
s.pending_buf[s.l_buf + s.last_lit] = lc & 0xff
|
|
1141
|
+
s.last_lit++
|
|
1142
|
+
|
|
1143
|
+
if (dist === 0) {
|
|
1144
|
+
/* lc is the unmatched char */
|
|
1145
|
+
s.dyn_ltree[lc * 2] /*.Freq*/++
|
|
1146
|
+
} else {
|
|
1147
|
+
s.matches++
|
|
1148
|
+
/* Here, lc is the match length - MIN_MATCH */
|
|
1149
|
+
dist-- /* dist = match distance - 1 */
|
|
1150
|
+
//Assert((ush)dist < (ush)MAX_DIST(s) &&
|
|
1151
|
+
// (ush)lc <= (ush)(MAX_MATCH-MIN_MATCH) &&
|
|
1152
|
+
// (ush)d_code(dist) < (ush)D_CODES, "_tr_tally: bad match");
|
|
1153
|
+
|
|
1154
|
+
s.dyn_ltree[(_length_code[lc] + LITERALS + 1) * 2] /*.Freq*/++
|
|
1155
|
+
s.dyn_dtree[d_code(dist) * 2] /*.Freq*/++
|
|
1156
|
+
}
|
|
1157
|
+
|
|
1158
|
+
// (!) This block is disabled in zlib defaults,
|
|
1159
|
+
// don't enable it for binary compatibility
|
|
1160
|
+
|
|
1161
|
+
//#ifdef TRUNCATE_BLOCK
|
|
1162
|
+
// /* Try to guess if it is profitable to stop the current block here */
|
|
1163
|
+
// if ((s.last_lit & 0x1fff) === 0 && s.level > 2) {
|
|
1164
|
+
// /* Compute an upper bound for the compressed length */
|
|
1165
|
+
// out_length = s.last_lit*8;
|
|
1166
|
+
// in_length = s.strstart - s.block_start;
|
|
1167
|
+
//
|
|
1168
|
+
// for (dcode = 0; dcode < D_CODES; dcode++) {
|
|
1169
|
+
// out_length += s.dyn_dtree[dcode*2]/*.Freq*/ * (5 + extra_dbits[dcode]);
|
|
1170
|
+
// }
|
|
1171
|
+
// out_length >>>= 3;
|
|
1172
|
+
// //Tracev((stderr,"\nlast_lit %u, in %ld, out ~%ld(%ld%%) ",
|
|
1173
|
+
// // s->last_lit, in_length, out_length,
|
|
1174
|
+
// // 100L - out_length*100L/in_length));
|
|
1175
|
+
// if (s.matches < (s.last_lit>>1)/*int /2*/ && out_length < (in_length>>1)/*int /2*/) {
|
|
1176
|
+
// return true;
|
|
1177
|
+
// }
|
|
1178
|
+
// }
|
|
1179
|
+
//#endif
|
|
1180
|
+
|
|
1181
|
+
return s.last_lit === s.lit_bufsize - 1
|
|
1182
|
+
/* We avoid equality with lit_bufsize because of wraparound at 64K
|
|
1183
|
+
* on 16 bit machines and because stored blocks are restricted to
|
|
1184
|
+
* 64K-1 bytes.
|
|
1185
|
+
*/
|
|
1186
|
+
}
|
|
1187
|
+
|
|
1188
|
+
module.exports._tr_init = _tr_init
|
|
1189
|
+
module.exports._tr_stored_block = _tr_stored_block
|
|
1190
|
+
module.exports._tr_flush_block = _tr_flush_block
|
|
1191
|
+
module.exports._tr_tally = _tr_tally
|
|
1192
|
+
module.exports._tr_align = _tr_align
|